stock supplier : ps
This commit is contained in:
parent
4b99096f81
commit
be8421fb07
File diff suppressed because one or more lines are too long
@ -79,8 +79,14 @@
|
||||
<div formArrayName="main_raw_materials">
|
||||
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index;let last =last"
|
||||
[formGroupName]="l">
|
||||
<ion-row>
|
||||
<div style="width: 85%;">
|
||||
<mat-card-subtitle>Manufacturing Product #{{l+1}}</mat-card-subtitle>
|
||||
</div>
|
||||
<div style="width: 10%;">
|
||||
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheClientPics('Manufacturing Product',l,items.get('manufacturing_client_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
|
||||
</div>
|
||||
</ion-row>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width:100%">
|
||||
@ -199,8 +205,14 @@
|
||||
<div formArrayName="trading_products">
|
||||
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index;let last =last"
|
||||
[formGroupName]="l">
|
||||
<ion-row>
|
||||
<div style="width: 85%;">
|
||||
<mat-card-subtitle>Trading Product #{{l+1}}</mat-card-subtitle>
|
||||
</div>
|
||||
<div style="width: 10%;">
|
||||
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheClientPics('Trading Product',l,items.get('trade_client_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
|
||||
</div>
|
||||
</ion-row>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
@ -325,8 +337,14 @@
|
||||
<div formArrayName="service_products">
|
||||
<div *ngFor="let items of item.controls.service_products['controls']; let l=index;let last =last"
|
||||
[formGroupName]="l">
|
||||
<ion-row>
|
||||
<div style="width: 85%;">
|
||||
<mat-card-subtitle>Service Provider #{{l+1}}</mat-card-subtitle>
|
||||
</div>
|
||||
<div style="width: 10%;">
|
||||
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheClientPics('Service Provider',l,items.get('service_provider_client_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
|
||||
</div>
|
||||
</ion-row>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
|
||||
@ -431,42 +431,39 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card>
|
||||
<!-- <mat-card *ngIf="servicingForm || SPCommentCard">
|
||||
<mat-card *ngIf="servicingForm || SPCommentCard">
|
||||
<div *ngIf="servicingForm">
|
||||
<mat-card-title><h5>Service Provider Details</h5></mat-card-title>
|
||||
<div formArrayName="servicing_details">
|
||||
<div *ngFor="let spd of stockForms.controls.servicing_details['controls']; let k=index"
|
||||
[formGroupName]="k">
|
||||
<div *ngFor="let dtl of stockForm.controls.servicing_details['controls']; let par=index" [formGroupName]="par">
|
||||
<div formArrayName="service_provider">
|
||||
<div *ngFor="let sp of spd.controls.service_provider['controls']; let g=index;let last = last"
|
||||
[formGroupName]="g">
|
||||
<mat-card-subtitle>Service Provider #{{g+1}}</mat-card-subtitle>
|
||||
<div *ngFor="let serv of dtl.controls.service_provider['controls']; let chd=index;let last = last" [formGroupName]="chd">
|
||||
<mat-card-subtitle>Service Provider #{{chd+1}}</mat-card-subtitle>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:100%">
|
||||
<input matInput autocomplete="off" placeholder="Name" formControlName="service_provider_name">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:100%">
|
||||
<mat-select placeholder="Stock" formControlName="service_provider_observed"
|
||||
(selectionChange)="checkComments($event.value,5,g)" required>
|
||||
<mat-select placeholder="Stock" formControlName="service_provider_observed"
|
||||
(selectionChange)="checkComments($event.value,5,chd)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Add Stock Details</mat-option>
|
||||
<mat-option value="no">No stock observed</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<span *ngIf="tradetg.get('traded_goods_observed').value == 'yes'">
|
||||
<span *ngIf="serv.get('service_provider_observed').value == 'yes'">
|
||||
<mat-form-field style="width:100%">
|
||||
<input matInput autocomplete="off" placeholder="Estimated Quantity"
|
||||
formControlName="traded_goods_quantity" type="number">
|
||||
formControlName="service_provider_quantity" type="number">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:100%">
|
||||
<mat-select placeholder="Unit of Mearsurement" formControlName="traded_goods_uom">
|
||||
<mat-select placeholder="Unit of Mearsurement" formControlName="service_provider_uom">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option>
|
||||
<ngx-mat-select-search formControlName="uomSearch"
|
||||
[placeholderLabel]="'Search Unit'"
|
||||
[noEntriesFoundLabel]="'No Matching Result'" (keyup)="searchFun(tradetg,a)">
|
||||
[noEntriesFoundLabel]="'No Matching Result'" (keyup)="searchFun(serv,a)">
|
||||
<ion-icon name="md-close" ngxMatSelectSearchClear></ion-icon>
|
||||
</ngx-mat-select-search>
|
||||
</mat-option>
|
||||
@ -474,28 +471,28 @@
|
||||
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomDataValue">{{uom.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="tradetg.get('traded_goods_uom').value == 1" style="width:100%">
|
||||
<mat-form-field *ngIf="serv.get('service_provider_uom').value == 1" style="width:100%">
|
||||
<input matInput autocomplete="off" placeholder="Specify UOM"
|
||||
formControlName="traded_goods_other_uom">
|
||||
formControlName="service_provider_other_uom">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:100%">
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed"
|
||||
formControlName="estimated_traded_goods_value" type="number"
|
||||
(keyup)="inWords($event.target.value,4,g)">
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="tradetg.get('estimated_traded_goods_value').value != ''">{{"₹"}}
|
||||
{{T_tradedGoodsValueInWords[g]}} Only</mat-hint>
|
||||
formControlName="estimated_service_provider_value" type="number"
|
||||
(keyup)="inWords($event.target.value,5,chd)">
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="serv.get('estimated_service_provider_value').value != ''">{{"₹"}}
|
||||
{{S_GoodsValueInWords[g]}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<ion-buttons end>
|
||||
<ion-col col-3 offset-3>
|
||||
<a (click)="deleteTradedGoods(g,2)" *ngIf="td.controls.trading_traded_goods.controls.length>1">
|
||||
<a (click)="deleteTradedGoods(chd,3)" *ngIf="dtl.controls.service_provider.controls.length>1">
|
||||
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
|
||||
</a>
|
||||
</ion-col>
|
||||
<ion-col col-2 offset-1>
|
||||
<a (click)="addTradedGoods(2)" *ngIf="last">
|
||||
<a (click)="addTradedGoods(3)" *ngIf="last">
|
||||
<ion-icon name="add-circle" color="optblue" style="font-size: 24px;"></ion-icon>
|
||||
</a>
|
||||
</ion-col>
|
||||
@ -506,27 +503,28 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="TGCommentCard">
|
||||
<div *ngIf="SPCommentCard">
|
||||
<br>
|
||||
<mat-form-field style="width:100%">
|
||||
<mat-placeholder>Is the stock of finished / traded goods observed, sufficient considering the size of operations</mat-placeholder><br/>
|
||||
<mat-select formControlName="is_sufficiant_finished_and_traded_goods">
|
||||
<mat-placeholder>Is the stock of finished / goods observed, sufficient considering the size of operations</mat-placeholder><br/>
|
||||
<mat-select formControlName="is_sufficiant_service_goods">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let val of TGsufficientList" [value]="val.value" [disabled]="val.isdisabled">
|
||||
<mat-option *ngFor="let val of SPsufficientList" [value]="val.value" [disabled]="val.isdisabled">
|
||||
{{val.isdisplayvalue}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" style="width: 100%" *ngIf="this.stockForm.controls.is_sufficiant_finished_and_traded_goods.value == 'no'">
|
||||
<mat-label> <i>Please comment on the stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the stock level observed" formControlName="finished_and_traded_goods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" style="width: 100%" *ngIf="this.stockForms.controls.is_sufficiant_service_goods.value == 'no'">
|
||||
<mat-label> <i>Please comment on the stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the stock level observed"
|
||||
formControlName="service_goods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card> -->
|
||||
<mat-card *ngIf="serviceProviderForm">
|
||||
</mat-card>
|
||||
<!-- <mat-card *ngIf="serviceProviderForm">
|
||||
<mat-card-title><h5>Service Provider Details</h5></mat-card-title>
|
||||
<div style="text-align: center; margin: 12px;">Service Provider Details Not applicable here !!</div>
|
||||
</mat-card>
|
||||
</mat-card> -->
|
||||
<mat-card>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
|
||||
@ -38,22 +38,28 @@ export class PdQuestionStockInfoPage {
|
||||
M_goodsValueInWords: any = [];
|
||||
R_tradedGoodsValueInWords: any = [];
|
||||
T_tradedGoodsValueInWords: any = [];
|
||||
S_GoodsValueInWords: any = [];
|
||||
mrmCommentFlag: any = [];
|
||||
mfgCommentFlag: any = [];
|
||||
rtrdCommentFlag: any = [];
|
||||
wtrdCommentFlag: any = [];
|
||||
serviceProviderForm: Boolean = false;
|
||||
spdCommentFlag: any = [];
|
||||
|
||||
// serviceProviderForm: Boolean = false;
|
||||
suppliers_raw_materials: any = [];
|
||||
suppliers_retail_trade_details: any = [];
|
||||
suppliers_wholesale_trade_details: any = [];
|
||||
suppliers_finished_goods: any = [];
|
||||
suppliers_service_providers : any = [];
|
||||
|
||||
protected _onDestroy = new Subject<void>();
|
||||
|
||||
RMCommentCard: boolean = false;
|
||||
TGCommentCard: boolean = false
|
||||
TGCommentCard: boolean = false;
|
||||
SPCommentCard: boolean = false;
|
||||
public RMsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",disabled:false},{value:"no",isdisplayvalue:"No",disabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",disabled:false}];
|
||||
public TGsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",isdisabled:false},{value:"no",isdisplayvalue:"No",isdisabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",isdisabled:false}];
|
||||
public SPsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",isdisabled:false},{value:"no",isdisplayvalue:"No",isdisabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",isdisabled:false}];
|
||||
imageDisplay: any[];
|
||||
imageBucket: any=[];
|
||||
tab: string='0';
|
||||
@ -111,6 +117,9 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0;
|
||||
let type4 = record.from_business.filter(data => data.type_of_activity_id == 4);
|
||||
let type4length = type4[0].hasOwnProperty("products") ? type4[0].products.length : 0;
|
||||
let type5 = record.from_business.filter(data => data.type_of_activity_id == 5);
|
||||
let type5length = type5[0].hasOwnProperty("products") ? type5[0].products.length : 0;
|
||||
console.log('type5length',type5,type5length);
|
||||
|
||||
|
||||
let rm_api = record.from_supplier.hasOwnProperty("raw_material") ? record.from_supplier.raw_material : [];
|
||||
@ -148,6 +157,9 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record,type2length)]),
|
||||
retail_details: this.fb.array([this.retailFormCreation(type3length)]),
|
||||
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
||||
servicing_details: this.fb.array([this.servicingFormCreation(type5length)]),
|
||||
is_sufficiant_service_goods: [dataForm.hasOwnProperty('is_sufficiant_service_goods') ? dataForm.is_sufficiant_service_goods : ''],
|
||||
service_goods_remarks: [dataForm.hasOwnProperty('service_goods_remarks') ? dataForm.service_goods_remarks : '' ]
|
||||
});
|
||||
if (api.length > 0) {
|
||||
api.forEach(val => {
|
||||
@ -182,9 +194,18 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if (val.products) {
|
||||
this.serviceProviderForm = true;
|
||||
}
|
||||
// this.serviceProviderForm = true;
|
||||
let servicing_temparr = [];
|
||||
if(dataForm.hasOwnProperty('service_provider')){
|
||||
servicing_temparr['service_provider'] = dataForm.servicing_details[0].service_provider;
|
||||
this.initServicingDetails(servicing_temparr);
|
||||
}
|
||||
else{
|
||||
this.suppliers_service_providers = val.products;
|
||||
this.initServicingDetails(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
@ -204,6 +225,9 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record,type2length)]),
|
||||
retail_details: this.fb.array([this.retailFormCreation(type3length)]),
|
||||
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
||||
servicing_details: this.fb.array([this.servicingFormCreation(type5length)]),
|
||||
is_sufficiant_service_goods: [''],
|
||||
service_goods_remarks: ['']
|
||||
});
|
||||
if (api.length > 0) {
|
||||
api.forEach(val => {
|
||||
@ -232,8 +256,10 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if (val.products) {
|
||||
// this.suppliers_service_product = val.products;
|
||||
this.serviceProviderForm = true;
|
||||
|
||||
this.suppliers_service_providers = val.products;
|
||||
this.initServicingDetails(null);
|
||||
// this.serviceProviderForm = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -260,6 +286,10 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
retail_details: this.fb.array([this.retailFormCreation(type3length)]),
|
||||
|
||||
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
||||
servicing_details: this.fb.array([this.servicingFormCreation(type5length)]),
|
||||
|
||||
is_sufficiant_service_goods: [''],
|
||||
service_goods_remarks: ['']
|
||||
});
|
||||
if (api.length > 0) {
|
||||
api.forEach(val => {
|
||||
@ -289,8 +319,9 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if (val.products) {
|
||||
// this.suppliers_service_product = val.products;
|
||||
this.serviceProviderForm = true;
|
||||
this.suppliers_service_providers = val.products;
|
||||
this.initServicingDetails(null);
|
||||
// this.serviceProviderForm = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -391,6 +422,26 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
servicingForm: Boolean = false;
|
||||
servicingFormCreation(val) {
|
||||
console.log('inside servicingFormCreation',val);
|
||||
let arr = val
|
||||
// let arr = val.filter(data => data.type_of_activity_id == 4);
|
||||
if (arr > 0){
|
||||
console.log('IF');
|
||||
this.servicingForm = true;
|
||||
return this.fb.group({
|
||||
service_provider: this.fb.array([])
|
||||
});
|
||||
} else {
|
||||
console.log('Else');
|
||||
return this.fb.group({
|
||||
service_provider: this.fb.array([])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
initManufacturingDetails(datas) {
|
||||
const rawMaterial = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||
const finishedGoods = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
@ -405,8 +456,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
'raw_uom': '',
|
||||
'other_uom': '',
|
||||
'raw_value': '',
|
||||
'is_sufficiant_raw': '',
|
||||
'rawmaterial_remarks': ''
|
||||
// 'is_sufficiant_raw': '',
|
||||
// 'rawmaterial_remarks': ''
|
||||
};
|
||||
rawMaterial.push(this.createRawmaterial(Ref_RawMaterials));
|
||||
});
|
||||
@ -423,8 +474,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
'goods_uom': '',
|
||||
'goods_other_uom': '',
|
||||
'goods_value': '',
|
||||
'is_sufficiant_goods': '',
|
||||
'finishedgoods_remarks': ''
|
||||
// 'is_sufficiant_goods': '',
|
||||
// 'finishedgoods_remarks': ''
|
||||
};
|
||||
finishedGoods.push(this.createGoods(Ref_Finished_Goods));
|
||||
});
|
||||
@ -473,8 +524,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
uomSearch:[null],
|
||||
other_uom: [''],
|
||||
raw_value: [''],
|
||||
is_sufficiant_raw: [''],
|
||||
rawmaterial_remarks: ['']
|
||||
// is_sufficiant_raw: [''],
|
||||
// rawmaterial_remarks: ['']
|
||||
})
|
||||
} else {
|
||||
return this.fb.group({
|
||||
@ -485,8 +536,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
uomSearch:[null],
|
||||
other_uom: [records.other_uom],
|
||||
raw_value: [records.raw_value],
|
||||
is_sufficiant_raw: [records.is_sufficiant_raw],
|
||||
rawmaterial_remarks: [records.rawmaterial_remarks]
|
||||
// is_sufficiant_raw: [records.is_sufficiant_raw],
|
||||
// rawmaterial_remarks: [records.rawmaterial_remarks]
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -504,8 +555,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
'traded_goods_uom': '',
|
||||
'traded_goods_other_uom': '',
|
||||
'estimated_traded_goods_value': '',
|
||||
'is_sufficiant_traded_goods': '',
|
||||
'traded_goods_remarks': ''
|
||||
// 'is_sufficiant_traded_goods': '',
|
||||
// 'traded_goods_remarks': ''
|
||||
};
|
||||
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
|
||||
});
|
||||
@ -541,8 +592,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
uomSearch:[null],
|
||||
goods_other_uom: [''],
|
||||
goods_value: [''],
|
||||
is_sufficiant_goods: [''],
|
||||
finishedgoods_remarks: ['']
|
||||
// is_sufficiant_goods: [''],
|
||||
// finishedgoods_remarks: ['']
|
||||
});
|
||||
}
|
||||
else {
|
||||
@ -554,8 +605,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
uomSearch:[null],
|
||||
goods_other_uom: [records.goods_other_uom],
|
||||
goods_value: [records.goods_value],
|
||||
is_sufficiant_goods: [records.is_sufficiant_goods],
|
||||
finishedgoods_remarks: [records.finishedgoods_remarks]
|
||||
// is_sufficiant_goods: [records.is_sufficiant_goods],
|
||||
// finishedgoods_remarks: [records.finishedgoods_remarks]
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -572,8 +623,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
'traded_goods_uom': '',
|
||||
'traded_goods_other_uom': '',
|
||||
'estimated_traded_goods_value': '',
|
||||
'is_sufficiant_traded_goods': '',
|
||||
'traded_goods_remarks': ''
|
||||
// 'is_sufficiant_traded_goods': '',
|
||||
// 'traded_goods_remarks': ''
|
||||
};
|
||||
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
|
||||
});
|
||||
@ -609,8 +660,8 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
uomSearch:[null],
|
||||
traded_goods_other_uom: [''],
|
||||
estimated_traded_goods_value: [''],
|
||||
is_sufficiant_traded_goods: [''],
|
||||
traded_goods_remarks: ['']
|
||||
// is_sufficiant_traded_goods: [''],
|
||||
// traded_goods_remarks: ['']
|
||||
});
|
||||
}
|
||||
else {
|
||||
@ -622,8 +673,78 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
uomSearch:[null],
|
||||
traded_goods_other_uom: [records.traded_goods_other_uom],
|
||||
estimated_traded_goods_value: [records.estimated_traded_goods_value],
|
||||
is_sufficiant_traded_goods: [records.is_sufficiant_traded_goods],
|
||||
traded_goods_remarks: [records.traded_goods_remarks]
|
||||
// is_sufficiant_traded_goods: [records.is_sufficiant_traded_goods],
|
||||
// traded_goods_remarks: [records.traded_goods_remarks]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
initServicingDetails(datas) {
|
||||
const service = <FormArray>this.stockForm.controls['servicing_details']['controls'][0].controls['service_provider'];
|
||||
if (datas === null) {
|
||||
|
||||
if (this.suppliers_service_providers.length > 0) {
|
||||
this.suppliers_service_providers.forEach(val => {
|
||||
let Serv_Prov_Goods: any = {
|
||||
'service_provider_name': val,
|
||||
'service_provider_observed': '',
|
||||
'service_provider_quantity': '',
|
||||
'service_provider_uom': '',
|
||||
'service_provider_other_uom': '',
|
||||
'estimated_service_provider_value': ''
|
||||
}
|
||||
|
||||
service.push(this.createServiceProvider(Serv_Prov_Goods));
|
||||
});
|
||||
}
|
||||
else {
|
||||
service.push(this.createServiceProvider(null));
|
||||
}
|
||||
} else {
|
||||
if (datas.service_provider !== undefined) {
|
||||
datas.service_provider.forEach((val, index) => {
|
||||
if (val.estimated_service_provider_value) {
|
||||
this.inWords(val.estimated_service_provider_value, 5, index);
|
||||
}
|
||||
this.checkComments(val.service_provider_observed, 5, index);
|
||||
service.push(this.createServiceProvider(val));
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
service.push(this.createServiceProvider(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createServiceProvider(records) {
|
||||
|
||||
if (records === null) {
|
||||
|
||||
return this.fb.group({
|
||||
service_provider_name: [''],
|
||||
service_provider_observed: [''],
|
||||
service_provider_quantity: [''],
|
||||
service_provider_uom: [''],
|
||||
uomSearch:[null],
|
||||
service_provider_other_uom: [''],
|
||||
estimated_service_provider_value: [''],
|
||||
// traded_goods_value: [''],
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
return this.fb.group({
|
||||
service_provider_name: [records.service_provider_name],
|
||||
service_provider_observed: [records.service_provider_observed],
|
||||
service_provider_quantity: [records.service_provider_quantity],
|
||||
service_provider_uom: [records.service_provider_uom],
|
||||
uomSearch:[null],
|
||||
service_provider_other_uom: [records.service_provider_other_uom],
|
||||
estimated_service_provider_value: [records.estimated_service_provider_value],
|
||||
// traded_goods_value: [records.traded_goods_value],
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -676,6 +797,11 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
control.push(this.createTradedGoods(null));
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const control = <FormArray>this.stockForm.controls['servicing_details']['controls'][0].controls['service_provider'];
|
||||
control.push(this.createServiceProvider(null));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@ -698,6 +824,11 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const control = <FormArray>this.stockForm.controls['servicing_details']['controls'][0].controls['service_provider'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@ -711,14 +842,18 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
FinishedCounterArray: any = [];
|
||||
RetailCounterArray: any = [];
|
||||
WholeSaleCounterArray: any = [];
|
||||
ServiceCounterArray: any = [];
|
||||
|
||||
not_stock_of_rm: any = [];
|
||||
not_stock_of_fg: any = [];
|
||||
not_stock_of_tg: any = [];
|
||||
not_stock_of_ws: any = [];
|
||||
not_stock_of_sp: any = [];
|
||||
|
||||
checkComments(value, flag, index) {
|
||||
|
||||
console.log(value, flag, index);
|
||||
return;
|
||||
if (flag == 1) {
|
||||
|
||||
this.ManufacturingCounterArray[index] = value != "" ? 1 : 0;
|
||||
@ -757,6 +892,30 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
this.WholeSaleCounterArray[index] = value != "" ? 1 : 0
|
||||
this.not_stock_of_ws[index] = value == "yes" ? 1 : 0;
|
||||
}
|
||||
if (flag == 5) {
|
||||
console.log('adf');
|
||||
this.ServiceCounterArray[index] = value != "" ? 1 : 0
|
||||
this.not_stock_of_sp[index] = value == "yes" ? 1 : 0;
|
||||
|
||||
let SPOverallCount = this.ServiceCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||
this.SPCommentCard = SPOverallCount > 0 ? true : false;
|
||||
|
||||
let not_stock3 = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
|
||||
|
||||
if(not_stock3 > 0){
|
||||
|
||||
this.SPsufficientList[0].disabled = false;
|
||||
this.SPsufficientList[2].disabled = true;
|
||||
|
||||
}
|
||||
else if(not_stock3 == 0){
|
||||
|
||||
this.SPsufficientList[0].disabled = true;
|
||||
this.SPsufficientList[2].disabled = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
let FGOverallCount = this.FinishedCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||
let RTGOverallCount = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||
let WTGOverallCount = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||
@ -833,6 +992,10 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
case 4:
|
||||
this.T_tradedGoodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
||||
break;
|
||||
case 5:
|
||||
this.S_GoodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -80,8 +80,14 @@
|
||||
<div formArrayName="main_raw_materials">
|
||||
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index let last =last"
|
||||
[formGroupName]="l">
|
||||
<ion-row>
|
||||
<div style="width: 85%;">
|
||||
<mat-card-subtitle>Raw Material #{{l+1}}</mat-card-subtitle>
|
||||
</div>
|
||||
<div style="width: 10%;">
|
||||
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheSupplierPics('Raw Material',l,items.get('manufacturing_supplier_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
|
||||
</div>
|
||||
</ion-row>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
@ -191,8 +197,15 @@
|
||||
<div formArrayName="trading_products">
|
||||
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index; let last = last"
|
||||
[formGroupName]="l">
|
||||
<ion-row>
|
||||
<div style="width: 85%;">
|
||||
<mat-card-subtitle>Trading Product #{{l+1}}</mat-card-subtitle>
|
||||
</div>
|
||||
<div style="width: 10%;">
|
||||
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheSupplierPics('Trading Product',l,items.get('trade_supplier_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
|
||||
</div>
|
||||
</ion-row>
|
||||
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
@ -295,6 +308,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
|
||||
<mat-card *ngIf="servicingForm">
|
||||
|
||||
<mat-card-title>
|
||||
@ -302,19 +316,27 @@
|
||||
</mat-card-title>
|
||||
|
||||
<div formArrayName="servicing_details">
|
||||
<div *ngFor="let serv of supplierInfoForm.controls.servicing_details['controls']; let i=index" [formGroupName]="i">
|
||||
<div *ngFor="let item of supplierInfoForm.controls.servicing_details['controls']; let i=index" [formGroupName]="i">
|
||||
<div formArrayName="service_providers">
|
||||
<div *ngFor="let ser of serv.controls.service_providers['controls']; let s=index; let last = last"
|
||||
[formGroupName]="s">
|
||||
<mat-card-subtitle>Service Provider #{{s+1}}</mat-card-subtitle>
|
||||
|
||||
<div *ngFor="let items of item.controls.service_providers['controls']; let l=index; let last = last"
|
||||
[formGroupName]="l">
|
||||
<ion-row>
|
||||
<div style="width: 85%;">
|
||||
<mat-card-subtitle>Service Provider #{{l+1}}</mat-card-subtitle>
|
||||
</div>
|
||||
<div style="width: 10%;">
|
||||
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheSupplierPics('Service Provider',l,items.get('service_provider_supplier_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
|
||||
</div>
|
||||
</ion-row>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Service Provide Name" formControlName="service_provider_name">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let sp of business_serviceProvider" [value]="sp.name">{{sp.name }}</mat-option>
|
||||
</mat-select>
|
||||
|
||||
<mat-select placeholder="Trading Product Name" formControlName="service_provider_name">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let tp of business_serviceProvider" [value]="tp.name">{{ tp.name }}</mat-option>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Supplier Name" formControlName="service_provider_supplier_name">
|
||||
@ -333,7 +355,7 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Contact Person Designation" formControlName="person_designation"
|
||||
(selectionChange)="selectedPersonDesignation(ser,$event.value,3)">
|
||||
(selectionChange)="selectedPersonDesignation(items,$event.value,3)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let comrelShip of m_companyRelationShipList" [value]="comrelShip.company_relationship_id">
|
||||
{{comrelShip.name}}
|
||||
@ -341,7 +363,7 @@
|
||||
<!-- <mat-option value="1" > Not Applicable </mat-option> -->
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%" *ngIf="ser.get('person_designation').value == 1">
|
||||
<mat-form-field style="width: 100%" *ngIf="items.get('person_designation').value == 1">
|
||||
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
@ -362,7 +384,7 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Payment Terms" formControlName="service_provider_payment_type"
|
||||
(selectionChange)="selectedPaymentTerms(ser,$event.value,3);checkCard($event.value,3,s);">
|
||||
(selectionChange)="selectedPaymentTerms(items,$event.value,3);checkCard($event.value,3,l);">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let pm of m_paymentList" [value]="pm.id">{{ pm.name }}</mat-option>
|
||||
</mat-select>
|
||||
@ -376,7 +398,7 @@
|
||||
<mat-option value="Payment made through Cash and Banking channels.">Payment made through Cash and Banking Channels.</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="items.get('trade_product_payment_type').value == 3">
|
||||
<span *ngIf="items.get('service_provider_payment_type').value == 3">
|
||||
<mat-label>No.of days of Credit Provided by Supplier </mat-label>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Days From" formControlName="service_provider_credit_days_from" type="number">
|
||||
@ -389,8 +411,7 @@
|
||||
</mat-card-content>
|
||||
<ion-buttons end>
|
||||
<ion-col col-3 offset-3>
|
||||
<a (click)="removeServiceProvider(s)"
|
||||
*ngIf="serv.controls.service_providers.controls.length > 1">
|
||||
<a (click)="removeServiceProvider(l)" *ngIf="item.controls.service_providers.controls.length > 1">
|
||||
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
|
||||
</a>
|
||||
</ion-col>
|
||||
|
||||
@ -57,39 +57,46 @@ export class PdQuestionSupplierInfoPage {
|
||||
|
||||
|
||||
this.qustCat.getTypeofActivityForSuppliedInfoForm(this.pdDetails.pd_id, this.company_id).subscribe(data => {
|
||||
|
||||
if(data.dataStatus){
|
||||
|
||||
let datas = data.records;
|
||||
console.log('datas',datas);
|
||||
this.initFormLoadDetails(datas.type_of_activity);
|
||||
this.business_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 2 ){return data}}).map(data=> [...data.prodcuts]);
|
||||
// this.business_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3){return data}}).map(data=> [...data.prodcuts]);
|
||||
// this.business_serviceProvider = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 5){return data}}).map(data=> [...data.prodcuts]);
|
||||
|
||||
let api = Object.keys(datas.type_of_activity).map(function (key) {
|
||||
return datas.type_of_activity[key];
|
||||
});
|
||||
|
||||
if (data.dataStatus) {
|
||||
if(api.length > 0){
|
||||
api.forEach(val => {
|
||||
if (val.type_of_activity_id == 3) {
|
||||
if(val.prodcuts){
|
||||
this.business_tradingProducts.push(val.prodcuts);
|
||||
}
|
||||
}
|
||||
|
||||
let datas = data.records;
|
||||
this.initFormLoadDetails(datas.type_of_activity);
|
||||
this.business_manufacturingProducts = datas.type_of_activity.filter(data => { if (data.type_of_activity_id == 2) { return data } }).map(data => [...data.prodcuts]);
|
||||
// this.business_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3){return data}}).map(data=> [...data.prodcuts]);
|
||||
this.business_serviceProvider = datas.type_of_activity.filter(data => { if (data.type_of_activity_id == 5) { return data } }).map(data => [...data.prodcuts]);
|
||||
|
||||
let api = Object.keys(datas.type_of_activity).map(function (key) {
|
||||
return datas.type_of_activity[key];
|
||||
});
|
||||
|
||||
if (api.length > 0) {
|
||||
api.forEach(val => {
|
||||
if (val.type_of_activity_id == 3) {
|
||||
if (val.prodcuts) {
|
||||
this.business_tradingProducts.push(val.prodcuts);
|
||||
}
|
||||
if (val.type_of_activity_id == 4) {
|
||||
if(val.prodcuts){
|
||||
this.business_tradingProducts.push(val.prodcuts);
|
||||
}
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if(val.prodcuts){
|
||||
this.business_serviceProvider.push(val.prodcuts);
|
||||
console.log(this.business_serviceProvider);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (val.type_of_activity_id == 4) {
|
||||
if (val.prodcuts) {
|
||||
this.business_tradingProducts.push(val.prodcuts);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
this.business_tradingProducts = [].concat.apply([], this.business_tradingProducts);
|
||||
|
||||
} else {
|
||||
this.business_tradingProducts = [].concat.apply([], this.business_tradingProducts);
|
||||
|
||||
|
||||
}else {
|
||||
this.toast.pdTriggerappmessage('No Category Records Found.!');
|
||||
this.noRecordsFound = false;
|
||||
this.errorMessage = data.msg;
|
||||
@ -102,14 +109,13 @@ export class PdQuestionSupplierInfoPage {
|
||||
this.getdropList();
|
||||
}
|
||||
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad PdQuestionSupplierInfoPage');
|
||||
this.getPDImages();
|
||||
}
|
||||
|
||||
|
||||
serviceProviderForm: Boolean = false;
|
||||
// serviceProviderForm: Boolean = false;
|
||||
initFormLoadDetails(record) {
|
||||
let params: any = {};
|
||||
params.parent_pdid = this.pdDetails.parent_pd_id
|
||||
@ -120,6 +126,7 @@ export class PdQuestionSupplierInfoPage {
|
||||
this.qustCat.retiverForm(params).subscribe(
|
||||
data => {
|
||||
if (data['dataStatus'] == true) {
|
||||
|
||||
let dataForm = data['records'];
|
||||
if (dataForm !== undefined) {
|
||||
this.supplierInfoForm = this.fb.group({
|
||||
@ -168,9 +175,9 @@ export class PdQuestionSupplierInfoPage {
|
||||
let arr2 = record.filter(data => data.type_of_activity_id == 5);
|
||||
if (arr2.length > 0) {
|
||||
// this.serviceProviderForm = true;
|
||||
if (dataForm.trade_details[0] != null) {
|
||||
let api_service_provider = dataForm.servicing_details[0].service_provider;
|
||||
this.initServiceProvidersDetails(api_service_provider);
|
||||
if (dataForm.servicing_details[0] != null) {
|
||||
let api_service_providers = dataForm.servicing_details[0].service_providers;
|
||||
this.initServiceProvidersDetails(api_service_providers);
|
||||
this.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(dataForm.servicing_details[0].service_providers_total_payments_percent_on_credit || null);
|
||||
}
|
||||
else {
|
||||
@ -180,6 +187,7 @@ export class PdQuestionSupplierInfoPage {
|
||||
}
|
||||
this.noRecordsFound = true;
|
||||
} else {
|
||||
|
||||
this.supplierInfoForm = this.fb.group({
|
||||
parent_pdid: [this.pdDetails.parent_pd_id],
|
||||
pdid: [this.pdDetails.pd_id],
|
||||
@ -210,6 +218,7 @@ export class PdQuestionSupplierInfoPage {
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
} else {
|
||||
console.log(' data in else part');
|
||||
this.supplierInfoForm = this.fb.group({
|
||||
parent_pdid: [this.pdDetails.parent_pd_id],
|
||||
pdid: [this.pdDetails.pd_id],
|
||||
@ -234,7 +243,6 @@ export class PdQuestionSupplierInfoPage {
|
||||
}
|
||||
let arr2 = record.filter(data => data.type_of_activity_id == 5);
|
||||
if (arr2.length > 0) {
|
||||
// this.serviceProviderForm = true;
|
||||
this.initServiceProvidersDetails(null);
|
||||
this.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(null);
|
||||
}
|
||||
@ -277,14 +285,18 @@ export class PdQuestionSupplierInfoPage {
|
||||
|
||||
servicingForm: Boolean = false;
|
||||
servicingFormCreation(val) {
|
||||
|
||||
let arr = val.filter(data => data.type_of_activity_id == 5);
|
||||
console.log(arr,arr.length);
|
||||
if (arr.length > 0) {
|
||||
console.log('IF');
|
||||
this.servicingForm = true;
|
||||
return this.fb.group({
|
||||
service_providers: this.fb.array([]),
|
||||
service_providers_total_payments_percent_on_credit: []
|
||||
});
|
||||
} else {
|
||||
console.log('ELSE');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -404,11 +416,14 @@ export class PdQuestionSupplierInfoPage {
|
||||
}
|
||||
|
||||
initServiceProvidersDetails(datas) {
|
||||
console.log('datas',datas);
|
||||
const control = <FormArray>this.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers'];
|
||||
|
||||
if (datas === null) {
|
||||
console.log('initServiceProvidersDetails if null');
|
||||
control.push(this.initServiceProviders(null));
|
||||
} else {
|
||||
console.log('else not null');
|
||||
datas.forEach((val, inx) => {
|
||||
this.checkCard(val.service_provider_payment_type, 3, inx);
|
||||
control.push(this.initServiceProviders(val));
|
||||
@ -417,7 +432,9 @@ export class PdQuestionSupplierInfoPage {
|
||||
}
|
||||
|
||||
initServiceProviders(records) {
|
||||
console.log('initServiceProviders',records);
|
||||
if (records === null) {
|
||||
console.log('if');
|
||||
return this.fb.group({
|
||||
service_provider_name: [''],
|
||||
service_provider_supplier_name: [''],
|
||||
@ -435,6 +452,7 @@ export class PdQuestionSupplierInfoPage {
|
||||
service_provider_credit_days_to: [''],
|
||||
})
|
||||
} else {
|
||||
console.log('else');
|
||||
return this.fb.group({
|
||||
service_provider_name: [records.service_provider_name],
|
||||
person_title_name: [records.person_title_name],
|
||||
@ -686,8 +704,8 @@ export class PdQuestionSupplierInfoPage {
|
||||
|
||||
|
||||
captureTheSupplierPics(materialName, index, supplierName) {
|
||||
console.log('ds');
|
||||
// alert('dsa');
|
||||
|
||||
|
||||
if (supplierName != '') {
|
||||
// 'Raw Material','l',items.get('manufacturing_supplier_name').value
|
||||
this.cameraProvider.getpicture().then(res => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user