web review changes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-07-04 16:58:02 +05:30
parent d54d5dcd6c
commit ba71f47504
14 changed files with 1040 additions and 397 deletions

View File

@ -28,7 +28,7 @@
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:20%">
<input matInput [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" [max]="todaydate" formControlName="pd_to_date" placeholder="Choose a todate">
<input matInput [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" [max]="todaydate" formControlName="pd_to_date" placeholder="Choose a To date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>

View File

@ -30,7 +30,7 @@
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [max]="todaydate" [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" formControlName="pd_to_date" placeholder="Choose a todate">
<input matInput [max]="todaydate" [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" formControlName="pd_to_date" placeholder="Choose a To date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>

View File

@ -29,7 +29,7 @@
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value" formControlName="pd_to_date" placeholder="Choose a todate">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value" formControlName="pd_to_date" placeholder="Choose a To date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>

View File

@ -29,7 +29,7 @@
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>&nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value"formControlName="pd_to_date" placeholder="Choose a todate">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value"formControlName="pd_to_date" placeholder="Choose a To date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>

View File

@ -29,7 +29,7 @@
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value"formControlName="pd_to_date" placeholder="Choose a todate">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value"formControlName="pd_to_date" placeholder="Choose a To date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>

View File

@ -74,17 +74,20 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Mobile Number"
autocomplete="off"
OnlyNumber type="text" maxlength="10"
formControlName="manufacturing_contact_person_mobile_number">
<mat-error>Enter Valid Mobile Number.</mat-error>
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode"
type="text" OnlyNumber type="text">
type="text" OnlyNumber >
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Client Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber type="text">
formControlName="person_landline" type="text" OnlyNumber >
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>
@ -208,18 +211,18 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Mobile Number"
formControlName="trade_product_contact_person_mobile_number" OnlyNumber
type="text">
formControlName="trade_product_contact_person_mobile_number" autocomplete="off"
OnlyNumber type="text" maxlength="10">
<mat-error>Enter Valid Mobile Number.</mat-error>
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode"
type="text" OnlyNumber type="text">
OnlyNumber type="text">
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Client Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber type="text">
formControlName="person_landline" type="text" OnlyNumber>
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>
@ -345,17 +348,18 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Mobile Number"
formControlName="service_provider_product_contact_person_mobile_number">
formControlName="service_provider_product_contact_person_mobile_number"
autocomplete="off" OnlyNumber type="text" maxlength="10">
<mat-error>Enter Valid Mobile Number.</mat-error>
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode"
type="text" OnlyNumber type="text">
type="text" OnlyNumber>
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Client Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber type="text">
formControlName="person_landline" type="text" OnlyNumber>
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>

View File

@ -147,22 +147,30 @@
<mat-card *ngIf="lender_short_name == 'CLIX' || product_abbr == 'LAEP'">
<mat-card-content>
<mat-card-subtitle>CLIX</mat-card-subtitle>
<mat-form-field style="width:94%;" *ngIf="_finalRemarkForm.controls['outlet_location']">
<mat-select placeholder="Comment on Footfall in the market where the B2C outlet is located…" formControlName="outlet_location"
required>
<mat-option>Select</mat-option>
<mat-option value="heavy_footfall"> Heavy Footfall (lots of customers in the locality / marketplace).</mat-option>
<mat-option value="medium_footfall"> Medium Footfall (Medium no of customers in the locality / marketplace).</mat-option>
<mat-option value="low_footfall"> Low Footfall (Few customers seen in the locality / marketplace).</mat-option>
</mat-select>
<mat-error *ngIf="_finalRemarkForm.controls['outlet_location'].hasError('required')">Comment on Footfall in the market where the B2C outlet is located Required</mat-error>
</mat-form-field>
<mat-form-field style="width:94%;" *ngIf="_finalRemarkForm.controls['outlet_location']">
<mat-select placeholder="Comment on Footfall in the market where the B2C outlet is located…" formControlName="outlet_location"
required>
<mat-option>Select</mat-option>
<mat-option value="heavy_footfall"> Heavy Footfall (lots of customers in the locality / marketplace).</mat-option>
<mat-option value="medium_footfall"> Medium Footfall (Medium no of customers in the locality / marketplace).</mat-option>
<mat-option value="low_footfall"> Low Footfall (Few customers seen in the locality / marketplace).</mat-option>
</mat-select>
<mat-error *ngIf="_finalRemarkForm.controls['outlet_location'].hasError('required')">Comment on Footfall in the market where the B2C outlet is located Required</mat-error>
</mat-form-field>
<div class="toggle" fxLayout="row nowrap" *ngIf="_finalRemarkForm.controls['is_competition']">
<!-- <div class="toggle" fxLayout="row nowrap" *ngIf="_finalRemarkForm.controls['is_competition']">
<mat-checkbox color="primary" formControlName="is_competition" (change)="clixChange($event.checked,1)">
Is there Competition to the applicants business in the location <strong>( {{ _finalRemarkForm.value.is_competition ===true ? 'Yes' : 'No'}} )</strong>
</mat-checkbox>
</div>
</div> -->
<mat-form-field style="width:94%;" *ngIf="_finalRemarkForm.controls['is_competition']">
<mat-select placeholder="Is there Competition to the applicants business in the location" formControlName="is_competition" (selectionChange)="clixChange($event.value,1)">
<mat-option>Select</mat-option>
<mat-option value="yes"> Yes</mat-option>
<mat-option value="no"> No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:80%;" *ngIf="_finalRemarkForm.controls['appx_outlet_or_stores']">
<input matInput autocomplete="off"
placeholder="Approximate No of similar outlets / stores seen by PD officer during the visit to that location"
@ -171,33 +179,48 @@
<mat-error *ngIf="_finalRemarkForm.controls['appx_outlet_or_stores'].hasError('required')">Approximate No of similar outlets / stores seen by PD officer during the visit to that location Required</mat-error>
</mat-form-field>
<div class="toggle" fxLayout="row nowrap" *ngIf="_finalRemarkForm.controls['demolition_activity']">
<!-- <div class="toggle" fxLayout="row nowrap" *ngIf="_finalRemarkForm.controls['demolition_activity']">
<mat-checkbox color="primary" formControlName="demolition_activity" (change)="clixChange($event.checked,2)">
Any demolition activity seen in the locality by PD officer <strong>( {{ _finalRemarkForm.value.demolition_activity ===true ? 'Yes' : 'No'}} )</strong></mat-checkbox>
</div>
</div> -->
<mat-form-field style="width:94%;" *ngIf="_finalRemarkForm.controls['demolition_activity']">
<mat-select placeholder="Any demolition activity seen in the locality by PD officer" formControlName="demolition_activity" (selectionChange)="clixChange($event.value,2)">
<mat-option>Select</mat-option>
<mat-option value="yes"> Yes</mat-option>
<mat-option value="no"> No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:80%;" *ngIf="_finalRemarkForm.controls['comment_of_demolition_activity']">
<input matInput autocomplete="off" type="text" placeholder="Specify The Demolition Activity Comment" formControlName="comment_of_demolition_activity" required>
<mat-error *ngIf="_finalRemarkForm.controls['comment_of_demolition_activity'].hasError('required')">Specify The Demolition Activity Comment Required</mat-error>
<input matInput autocomplete="off" type="text" placeholder="Comment on any demolition activity observed" formControlName="comment_of_demolition_activity" required>
<mat-error *ngIf="_finalRemarkForm.controls['comment_of_demolition_activity'].hasError('required')">Comment on any demolition activity observed is Required</mat-error>
</mat-form-field>
<span *ngIf="_finalRemarkForm.value.demolition_activity === true">
<span *ngIf="_finalRemarkForm.value.demolition_activity === yes">
<span class="carbon-wrap" *ngIf="_finalRemarkForm.controls['demolition_activity_pic'] && _finalRemarkForm.controls['demolition_activity_pic'].value != ''" >
<img src="{{_finalRemarkForm.controls['demolition_activity_pic'].value}}" alt="" border="0" height="100" width="130" style="max-width: 130px;" ngxViewer>
<p class="carbon-text" > Demolition Activity Image</p>
</span>
</span>
<div class="toggle" fxLayout="row nowrap" *ngIf="_finalRemarkForm.controls['sealing_activity']">
<!-- <div class="toggle" fxLayout="row nowrap" *ngIf="_finalRemarkForm.controls['sealing_activity']">
<mat-checkbox color="primary" formControlName="sealing_activity" (change)="clixChange($event.checked,3)">
Any sealing activity observed in the locality by PD office <strong>( {{ _finalRemarkForm.value.sealing_activity ===true ? 'Yes' : 'No'}} )</strong></mat-checkbox>
</div>
</div> -->
<mat-form-field style="width:94%;" *ngIf="_finalRemarkForm.controls['demolition_activity']">
<mat-select placeholder="Any sealing activity observed in the locality by PD officer" formControlName="sealing_activity" (selectionChange)="clixChange($event.value,3)">
<mat-option>Select</mat-option>
<mat-option value="yes"> Yes</mat-option>
<mat-option value="no"> No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:80%;" *ngIf="_finalRemarkForm.controls['comment_of_sealing_activity']">
<input matInput autocomplete="off" type="text" placeholder="Specify The Sealing Activity Comment " formControlName="comment_of_sealing_activity" required>
<mat-error *ngIf="_finalRemarkForm.controls['comment_of_sealing_activity'].hasError('required')">Specify The Sealing Activity Comment Required</mat-error>
<input matInput autocomplete="off" type="text" placeholder="Comment on any sealing activity observed in area " formControlName="comment_of_sealing_activity" required>
<mat-error *ngIf="_finalRemarkForm.controls['comment_of_sealing_activity'].hasError('required')">Comment on any sealing activity observed in area is Required</mat-error>
</mat-form-field>
<span *ngIf="_finalRemarkForm.value.sealing_activity === true">
<span *ngIf="_finalRemarkForm.value.sealing_activity === yes">
<span class="carbon-wrap" *ngIf="_finalRemarkForm.controls['sealing_activity_pic'] && _finalRemarkForm.controls['sealing_activity_pic'].value != ''" >
<img src="{{_finalRemarkForm.controls['sealing_activity_pic'].value}}" alt="" border="0" height="100" width="130" style="max-width: 130px;" ngxViewer>
<p class="carbon-text" > Sealing Activity Image</p>

View File

@ -236,10 +236,10 @@ export class FinalRemarksComponent implements OnInit {
this.clixChange(data.records.sealing_activity,2);
this.clixChange(data.records.demolition_activity,3);
if(data.records.is_competition ==true){ this._finalRemarkForm.controls.appx_outlet_or_stores.setValue(data.records.appx_outlet_or_stores);}
if(data.records.sealing_activity ==true){ this._finalRemarkForm.controls.comment_of_demolition_activity.setValue(data.records.comment_of_demolition_activity);
if(data.records.is_competition =='yes'){ this._finalRemarkForm.controls.appx_outlet_or_stores.setValue(data.records.appx_outlet_or_stores);}
if(data.records.sealing_activity =='yes'){ this._finalRemarkForm.controls.comment_of_demolition_activity.setValue(data.records.comment_of_demolition_activity);
this._finalRemarkForm.controls.demolition_activity_pic.setValue(data.records.demolition_activity_pic); }
if(data.records.demolition_activity ==true) {this._finalRemarkForm.controls.comment_of_sealing_activity.setValue(data.records.comment_of_sealing_activity);
if(data.records.demolition_activity =='yes') {this._finalRemarkForm.controls.comment_of_sealing_activity.setValue(data.records.comment_of_sealing_activity);
this._finalRemarkForm.controls.sealing_activity_pic.setValue(data.records.sealing_activity_pic); }
}
@ -618,16 +618,17 @@ export class FinalRemarksComponent implements OnInit {
}
clixChange(e,flag){
console.log(e,flag);
if(flag == 1){
e==true ? this._finalRemarkForm.addControl('appx_outlet_or_stores', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('appx_outlet_or_stores');
e == 'yes' ? this._finalRemarkForm.addControl('appx_outlet_or_stores', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('appx_outlet_or_stores');
}
if(flag == 2){
e==true ? this._finalRemarkForm.addControl('comment_of_demolition_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_demolition_activity');
e==true ? this._finalRemarkForm.addControl('demolition_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('demolition_activity_pic');
e== 'yes' ? this._finalRemarkForm.addControl('comment_of_demolition_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_demolition_activity');
e== 'yes' ? this._finalRemarkForm.addControl('demolition_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('demolition_activity_pic');
}
if(flag == 3){
e==true ? this._finalRemarkForm.addControl('comment_of_sealing_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_sealing_activity');
e==true ? this._finalRemarkForm.addControl('sealing_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('sealing_activity_pic');
e== 'yes' ? this._finalRemarkForm.addControl('comment_of_sealing_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_sealing_activity');
e== 'yes' ? this._finalRemarkForm.addControl('sealing_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('sealing_activity_pic');
}
}

View File

@ -371,17 +371,119 @@
</mat-form-field>
</div>
<mat-card *ngIf="serviceProviderForm">
<mat-card *ngIf="servicingForm">
<h5 class="highlight" style="margin: 12px;">Service Provider Details</h5>
<div formArrayName="servicing_details">
<div *ngFor="let spd of stockForms.controls.servicing_details['controls']; let k=index"
[formGroupName]="k">
<div formArrayName="service_provider">
<div *ngFor="let sp of spd.controls.service_provider['controls']; let g=index;let last = last"
[formGroupName]="g">
<mat-card style="margin: 12px;">
<mat-label class="highlight"> <i>Service Provider {{g+1}} </i>
</mat-label>
<mat-card-content class="matcard">
<mat-form-field style="width:30%">
<input matInput autocomplete="off" placeholder="Name"
formControlName="service_provider_name">
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Stock" formControlName="service_provider_observed"
(selectionChange)="checkComments($event.value,5,g)" required>
<mat-option>Select</mat-option>
<mat-option value="yes">Add Stock Details</mat-option>
<mat-option value="no">No stock observed</mat-option>
<!-- <mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option> -->
</mat-select>
</mat-form-field>
<span *ngIf="sp.get('service_provider_observed').value == 'yes'">
<mat-form-field style="width:30%">
<input matInput autocomplete="off" placeholder="Estimated Quantity"
formControlName="service_provider_quantity"
OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Unit of Measurement" (selectionChange)="selectedUOM(sp,$event.value,5)"
formControlName="service_provider_uom">
<mat-option>Select</mat-option>
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="sp.get('service_provider_uom').value == 1"
style="width:28%">
<input matInput autocomplete="off" placeholder="Specify UOM"
formControlName="service_provider_other_uom">
<mat-error *ngIf="sp.controls['service_provider_other_uom'].hasError('required')">UOM Required</mat-error>
</mat-form-field>
<mat-form-field style="width:90%">
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed"
formControlName="estimated_service_provider_value"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:70%" *ngIf="sp.get('estimated_service_provider_value').value != ''">{{"&#8377;"}}
{{sp.get('estimated_service_provider_value').value
| numberToWords}} Only</mat-hint>
</mat-form-field>
</span>
</mat-card-content>
<mat-card-actions>
<div align="center">
<button type="button" mat-flat-button (click)="addServiceProvider(2)"
matTooltip="Add More" matTooltipPosition="left"
color="primary" *ngIf="last">
<strong>Add More Service Provier </strong>
</button>
</div>
<div align="right">
<button type="button" mat-raised-button mat-icon-button
(click)="deleteServiceProvider(g,2)" matTooltip="Delete Service Provider"
matTooltipPosition="above" class="mr-1 mb-1 hover-icon"
*ngIf="spd.controls.service_provider.controls.length>1">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-actions>
</mat-card>
</div>
</div>
</div>
</div>
</mat-card>
<div *ngIf="SPCommentCard">
<br>
<mat-form-field style="width:90%">
<mat-select placeholder="Is the stock of finished / goods observed, sufficient considering the size of operations"
formControlName="is_sufficiant_service_goods" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let val of SPsufficientList" [value]="val.value" [disabled]="val.isdisabled">
{{val.isdisplayvalue}}
</mat-option>
<!-- <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="not applicable">Stock not required to be maintained</mat-option> -->
<!-- <mat-option value="not applicable">Not Applicable</mat-option> -->
</mat-select>
<mat-error *ngIf="stockForms.controls['is_sufficiant_service_goods'].hasError('required')">Is the stock of finished / goods observed, sufficient considering the size of operations Required</mat-error>
</mat-form-field>
<mat-form-field appearance="outline" style="width: 90%" *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 *ngIf="serviceProviderForm">
<!-- <mat-card-header>
<p>Service Provider</p>
</mat-card-header> -->
</mat-card-header> --
<h5 class="highlight" style="margin: 12px;">Service Provider</h5>
<div style="text-align: center; margin: 12px;">Service Provider Details Not
applicable here !!</div>
</mat-card>
</mat-card> -->
</div>
</div>
</ng-template>

View File

@ -43,17 +43,19 @@ export class StockComponent implements OnInit {
company_id: string;
RMCommentCard: boolean = false;
TGCommentCard: boolean = false
TGCommentCard: boolean = false;
SPCommentCard: boolean = false;
serviceProviderForm: Boolean = false;
// serviceProviderForm: Boolean = false;
suppliers_raw_materials: any = [];
suppliers_retail_trade_details: any = [];
suppliers_wholesale_trade_details: any = [];
suppliers_finished_goods: any = [];
// suppliers_service_product : any = [];
suppliers_service_providers : any = [];
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}];
/** Constructor */
constructor(notifier: NotifierService,
@ -134,7 +136,7 @@ export class StockComponent implements OnInit {
let api = Object.keys(record.from_business).map(function (key) {
return record.from_business[key];
});
let type2 = record.from_business.filter(data => data.type_of_activity_id == 2);
let type2length = type2[0].hasOwnProperty("products") ? type2[0].products.length : 0;
@ -142,7 +144,9 @@ export class StockComponent implements OnInit {
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;
let rm_api = record.from_supplier.hasOwnProperty("raw_material") ? record.from_supplier.raw_material : [];
let params: any = {};
@ -163,8 +167,11 @@ export class StockComponent implements OnInit {
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
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_finished_and_traded_goods: [dataForm.is_sufficiant_finished_and_traded_goods],
finished_and_traded_goods_remarks: [dataForm.finished_and_traded_goods_remarks]
finished_and_traded_goods_remarks: [dataForm.finished_and_traded_goods_remarks],
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 => {
@ -196,7 +203,16 @@ export class StockComponent implements OnInit {
}
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);
}
}
}
});
@ -215,8 +231,11 @@ export class StockComponent implements OnInit {
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
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_finished_and_traded_goods: [''],
finished_and_traded_goods_remarks: ['']
finished_and_traded_goods_remarks: [''],
is_sufficiant_service_goods: [''],
service_goods_remarks: ['']
});
if (api.length > 0) {
@ -244,8 +263,9 @@ export class StockComponent implements OnInit {
}
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;
}
}
@ -265,8 +285,11 @@ export class StockComponent implements OnInit {
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
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_finished_and_traded_goods: [''],
finished_and_traded_goods_remarks: ['']
finished_and_traded_goods_remarks: [''],
is_sufficiant_service_goods: [''],
service_goods_remarks: ['']
});
if (api.length > 0) {
api.forEach(val => {
@ -293,8 +316,8 @@ export class StockComponent implements OnInit {
}
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);
}
}
});
@ -352,6 +375,19 @@ export class StockComponent implements OnInit {
}
}
servicingForm: Boolean = false;
servicingFormCreation(val) {
// let arr = val.filter(data => data.type_of_activity_id == 4);
if (val > 0) {
this.servicingForm = true;
return this.fb.group({
service_provider: this.fb.array([])
});
} else {
return;
}
}
initManufacturingDetails(datas) {
@ -608,6 +644,75 @@ export class StockComponent implements OnInit {
}
}
initServicingDetails(datas) {
const service = <FormArray>this.stockForms.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) => {
this.checkComments(val.traded_goods_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: [''],
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],
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],
})
}
}
/** Manufacturing -> To Add More Raw Material Details */
addRawMaterials(flag) {
if (flag == 1) {
@ -657,6 +762,11 @@ export class StockComponent implements OnInit {
control.push(this.createTradedGoods(null));
break;
}
case 3: {
const control = <FormArray>this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider'];
control.push(this.createServiceProvider(null));
break;
}
default: {
break;
}
@ -679,6 +789,11 @@ export class StockComponent implements OnInit {
control.removeAt(index);
break;
}
case 3: {
const control = <FormArray>this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider'];
control.removeAt(index);
break;
}
default: {
break;
}
@ -758,6 +873,11 @@ export class StockComponent implements OnInit {
else{ items.controls['traded_goods_other_uom'].clearValidators(); items.controls['traded_goods_other_uom'].setValue('');}
items.controls['traded_goods_other_uom'].updateValueAndValidity();
}
else if (flag == 5) {
if(e == 1){ items.controls['service_provider_other_uom'].setValidators([Validators.required]); }
else{ items.controls['service_provider_other_uom'].clearValidators(); items.controls['service_provider_other_uom'].setValue('');}
items.controls['service_provider_other_uom'].updateValueAndValidity();
}
}
getUOM() {
@ -785,11 +905,13 @@ export class StockComponent implements OnInit {
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) {
@ -829,9 +951,34 @@ export class StockComponent implements OnInit {
this.WholeSaleCounterArray[index] = value != "" ? 1 : 0
this.not_stock_of_ws[index] = value == "yes" ? 1 : 0;
}
if (flag == 5) {
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);
let WTGOverallCount = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0);
let TGOverallCount = FGOverallCount + RTGOverallCount + WTGOverallCount;
this.TGCommentCard = TGOverallCount > 0 ? true : false;

View File

@ -13,340 +13,569 @@
<div *ngIf="noRecordsFound" style="max-width: 100vw !important;width: 100% !important;height: 95% !important;">
<form [formGroup]="_supplierQuesFrom" (submit)="onSubmit()" novalidate>
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;">
<mat-tab-group>
<mat-tab label="Questions">
<ng-template matTabContent>
<mat-card *ngIf="manufacturingForm">
<h5 style="margin: 12px;padding:10px !important;">Manufacturing Product Details</h5>
<div formArrayName="manufacturing_details">
<div *ngFor="let item of _supplierQuesFrom.controls.manufacturing_details['controls']; let i=index"
[formGroupName]="i">
<div formArrayName="main_raw_materials">
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index"
[formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Raw Material {{l+1}}</h6>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<input matInput placeholder="Raw Material Name" formControlName="manufacturing_raw_material_name">
</mat-form-field>
<mat-form-field style="width: 45%">
<input matInput placeholder="Supplier Name" formControlName="manufacturing_supplier_name">
</mat-form-field>
</div>
<div fxLayout="row nowrap">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="person_title_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Name" formControlName="manufacturing_contact_person_name"
[value]="items.get('manufacturing_contact_person_name').value | titlecase">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation" formControlName="person_designation"
(selectionChange)="selectedPersonDesignation(items,$event.value,1)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<!-- <mat-option value="1" > Not Applicable </mat-option> -->
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
<mat-error *ngIf="items.controls['other_person_designation'].hasError('required')">Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Mobile Number" autocomplete="off"
formControlName="manufacturing_contact_person_mobile_number" OnlyNumber
type="text" maxlength="10">
<mat-error>Enter Valid Mobile Number.</mat-error>
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode"
type="text" OnlyNumber type="text">
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber type="text">
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<!-- //(selectionChange)="selectedPM($event)" -->
<!-- <mat-select placeholder="Payment Type" formControlName="manufacturing_payment_type">
<mat-tab-group>
<mat-tab label="Questions">
<ng-template matTabContent>
<mat-card *ngIf="manufacturingForm">
<h5 style="margin: 12px;padding:10px !important;">Manufacturing Product Details</h5>
<div formArrayName="manufacturing_details">
<div *ngFor="let item of _supplierQuesFrom.controls.manufacturing_details['controls']; let i=index"
[formGroupName]="i">
<div formArrayName="main_raw_materials">
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index"
[formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Raw Material {{l+1}}
</h6>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<input matInput placeholder="Raw Material Name"
formControlName="manufacturing_raw_material_name">
</mat-form-field>
<mat-form-field style="width: 45%">
<input matInput placeholder="Supplier Name"
formControlName="manufacturing_supplier_name">
</mat-form-field>
</div>
<div fxLayout="row nowrap">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title"
formControlName="person_title_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let tl of titleList"
[value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Name"
formControlName="manufacturing_contact_person_name"
[value]="items.get('manufacturing_contact_person_name').value | titlecase">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation"
formControlName="person_designation"
(selectionChange)="selectedPersonDesignation(items,$event.value,1)">
<mat-option>Select</mat-option>
<mat-option
*ngFor="let comrelShip of companyRelationShipList"
[value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<!-- <mat-option value="1" > Not Applicable </mat-option> -->
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%"
*ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation"
formControlName="other_person_designation">
<mat-error
*ngIf="items.controls['other_person_designation'].hasError('required')">
Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Mobile Number"
autocomplete="off"
formControlName="manufacturing_contact_person_mobile_number"
OnlyNumber type="text" maxlength="10">
<mat-error>Enter Valid Mobile Number.</mat-error>
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code"
formControlName="person_stdcode" type="text" OnlyNumber>
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off"
placeholder="Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber>
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<!-- //(selectionChange)="selectedPM($event)" -->
<!-- <mat-select placeholder="Payment Type" formControlName="manufacturing_payment_type">
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field> -->
<mat-select placeholder="Payment Terms" formControlName="manufacturing_payment_type"
(selectionChange)="selectedPaymentTerms(items,$event.value,1);checkCard($event.value,1,l);">
<mat-option>Select</mat-option>
<mat-option *ngFor="let pm of m_paymentType" [value]="pm.id">{{ pm.name
<mat-select placeholder="Payment Terms"
formControlName="manufacturing_payment_type"
(selectionChange)="selectedPaymentTerms(items,$event.value,1);checkCard($event.value,1,l);">
<mat-option>Select</mat-option>
<mat-option *ngFor="let pm of m_paymentType"
[value]="pm.id">{{ pm.name
}}</mat-option>
</mat-select>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Mode" formControlName="manufacturing_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment made in Cash.">Payment made in Cash.</mat-option>
<mat-option value="Payment made through Banking channels.">Payment made
through Banking channels.</mat-option>
<mat-option value="Payment made through Cash and Banking channels.">Payment made through Cash and Banking Channels.</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Mode"
formControlName="manufacturing_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment made in Cash.">Payment made in
Cash.</mat-option>
<mat-option value="Payment made through Banking channels.">
Payment made
through Banking channels.</mat-option>
<mat-option
value="Payment made through Cash and Banking channels.">
Payment made through Cash and Banking Channels.
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row nowrap" style="padding-left: 2%;"
*ngIf="items.get('manufacturing_payment_type').value == 3">
<mat-label>No.of days of Credit Provided by Supplier </mat-label>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days From"
formControlName="manufacturing_credit_days_from"
type="number">
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days To"
formControlName="manufacturing_credit_days_to"
type="number">
</mat-form-field>
</div>
<div align="end">
<span *ngIf="item.controls.main_raw_materials.controls.length > 1"
(click)="removeRawMaterials(l)">
<button mat-raised-button mat-icon-button
class="mr-1 mb-1 hover-icon" color="primary"
matTooltip="Delete" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</span>
</div>
</mat-card>
</div>
</div>
<div fxLayout="row">
<div fxFlex="100" align="center">
<button color="primary" mat-flat-button matTooltip="Add More"
matTooltipPosition="above" type="button" class="mr-1 mb-1 hover-icon"
(click)="addMoreRawMaterials($event); false"><strong>Add
More Supplier</strong></button>
</div>
</div>
<div fxLayout="row" *ngIf="mfgCreditCardFlag">
<mat-form-field style="width: 100%">
<input matInput placeholder="What % of Total Purchase is Done on Credit?"
formControlName="main_raw_materials_total_payments_percent_on_credit"
type="number" autocomplete="off" OnlyNumber type="text" maxlength="3">
</mat-form-field>
</div>
<div fxLayout="row nowrap" style="padding-left: 2%;" *ngIf="items.get('manufacturing_payment_type').value == 3">
<mat-label>No.of days of Credit Provided by Supplier </mat-label>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days From" formControlName="manufacturing_credit_days_from"
type="number">
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days To" formControlName="manufacturing_credit_days_to"
type="number">
</mat-form-field>
</div>
<div align="end">
<span *ngIf="item.controls.main_raw_materials.controls.length > 1" (click)="removeRawMaterials(l)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon"
color="primary" matTooltip="Delete" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</span>
</div>
</mat-card>
</div>
</div>
<div fxLayout="row">
<div fxFlex="100" align="center">
<button color="primary" mat-flat-button matTooltip="Add More" matTooltipPosition="above"
type="button" class="mr-1 mb-1 hover-icon" (click)="addMoreRawMaterials($event); false"><strong>Add
More Supplier</strong></button>
</div>
</div>
<div fxLayout="row" *ngIf="mfgCreditCardFlag">
<mat-form-field style="width: 100%">
<input matInput placeholder="What % of Total Purchase is Done on Credit?"
formControlName="main_raw_materials_total_payments_percent_on_credit" type="number"
autocomplete="off" OnlyNumber type="text" maxlength="3">
</mat-form-field>
</div>
</div>
</div>
</mat-card>
<mat-card *ngIf="tradingForm">
<h5 style="margin: 12px;padding:10px !important;">Trading Product Details</h5>
<div formArrayName="trade_details">
<div *ngFor="let item of _supplierQuesFrom.controls.trade_details['controls']; let i=index"
[formGroupName]="i">
<div formArrayName="trading_products">
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index"
[formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Trading Product {{l+1}}</h6>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<!-- <mat-form-field style="width: 45%">
<input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
</mat-form-field> -->
<mat-form-field style="width: 45%">
<mat-select placeholder="Trading Product Name" formControlName="trade_product_name">
<mat-option *ngFor="let pm of m_tradingProducts" [value]="pm.name">{{
pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<input matInput placeholder="Supplier Name" formControlName="trade_supplier_name">
</mat-form-field>
</div>
<div fxLayout="row nowrap">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="person_title_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Name" formControlName="trade_product_contact_person_name"
[value]="items.get('trade_product_contact_person_name').value | titlecase">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation" formControlName="person_designation"
(selectionChange)="selectedPersonDesignation(items,$event.value,2)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<!-- <mat-option value="1" > Not Applicable </mat-option> -->
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
<mat-error *ngIf="items.controls['other_person_designation'].hasError('required')">Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Mobile Number" autocomplete="off"
formControlName="trade_product_contact_person_mobile_number" OnlyNumber
type="text" maxlength="10">
<mat-error>Enter Valid Mobile Number.</mat-error>
<!-- <mat-error *ngIf="items.controls['trade_product_contact_person_mobile_number'].invaild">Enter Valid Mobile Number.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode"
type="text" OnlyNumber type="text">
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber type="text">
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<!-- <mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Type" formControlName="trade_product_payment_type">
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select> -->
<mat-select placeholder="Payment Terms" formControlName="trade_product_payment_type"
(selectionChange)="selectedPaymentTerms(items,$event.value,2);checkCard($event.value,2,l);">
<mat-option>Select</mat-option>
<mat-option *ngFor="let pm of m_paymentType" [value]="pm.id">{{ pm.name
}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Mode" formControlName="trade_product_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment made in Cash.">Payment made in Cash.</mat-option>
<mat-option value="Payment made through Banking channels.">Payment made
through Banking channels.</mat-option>
<mat-option value="Payment made through Cash and Banking channels.">Payment made through Cash and Banking Channels.</mat-option>
</mat-select>
</mat-form-field>
</div>
<!-- <mat-form-field style="width: 45%" *ngIf="items.get('trade_product_payment_type').value == 3">
<input matInput placeholder="No.of Days of Credit Provided by Supplier" autocomplete="off" formControlName="trade_product_credit_days" OnlyNumber type="text">
</mat-form-field> -->
<div fxLayout="row nowrap" style="padding-left: 2%;display: none !important;" *ngIf="items.get('trade_product_payment_type').value == 3">
<mat-label>No.of days of Credit Provided by Supplier </mat-label>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days From" formControlName="trade_product_credit_days_from"
type="number">
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days To" formControlName="trade_product_credit_days_to"
type="number">
</mat-form-field>
</div>
<div align="end">
<span *ngIf="item.controls.trading_products.controls.length > 1" (click)="removeTradingProduct(l)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon"
color="primary" matTooltip="Delete" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</span>
</div>
</mat-card>
</div>
</div>
<div fxlayout="row">
<div fxFlex="100" align="center">
<button mat-flat-button color="primary" matTooltip="Add More" matTooltipPosition="above"
type="button" class="mr-1 mb-1 hover-icon" (click)="addMoretradeProduct($event); false"><strong>Add
More Supplier</strong></button>
</div>
</div>
<div fxlayout="row" *ngIf="trdCreditCardFlag">
<mat-form-field style="width: 90%">
<input matInput placeholder="What % of Total Purchase is done on Credit?"
formControlName="trading_products_total_payments_percent_on_credit" type="number"
autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</mat-card>
<mat-card *ngIf="serviceProviderForm">
<h5 style="margin: 12px;padding:10px !important;">Service Provider Product Details</h5>
<div style="text-align: center; margin: 12px;">Service Provider Details Not applicable here !!</div>
</mat-card>
</ng-template>
</mat-tab>
<mat-tab label="Docs">
<ng-template matTabContent>
<div ngxViewer *ngIf="documentsAndFilesList.length>0; else noFiles">
<div fxLayout="row wrap" style="padding:20px;">
<div fxFlex="100">
<div fxFlex="20" class="m-gap p-gap" *ngFor="let doc of documentsAndFilesList">
<div class="p-list-main mb-2" *ngIf="doc.document_type != 'pdf'">
<div class="p-list">
<div class="top">
<!-- Thumbnail-->
<div class="thumbnail">
<button mat-raised-button mat-icon-button class="date mr-1 mb-1 hover-icon" type="button" matTooltip="edit" (click)="imageCrop(doc)"
matTooltipPosition="right">
<mat-icon>edit</mat-icon>
</button>
<img src="{{doc.document}}" alt="{{doc.document_name}}">
</div>
<label *ngIf="doc.document_title != ''"
style="font-size: 0.85rem">{{doc.document_title}}</label></div>
</div>
</div>
</div>
</div>
<div fxFlex="row">
<div fxFlex="100" class="m-gap p-gap">
<div fxLayout="row" fxLayoutWrap="wrap">
<div *ngFor="let doc of documentsAndFilesList">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50"
fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"
*ngIf="doc.document_type == 'pdf';">
<!-- <a href="http://www.google.com" target="_blank"> -->
<mat-icon
style="color: #e00201;font-size: 60px !important;width:inherit !important;"
(click)="pdf(doc.document)">picture_as_pdf</mat-icon>
<span class="d-block">{{doc.document_title}}</span>
<!-- </a> -->
</mat-card>
<mat-card *ngIf="tradingForm">
<h5 style="margin: 12px;padding:10px !important;">Trading Product Details</h5>
<div formArrayName="trade_details">
<div *ngFor="let item of _supplierQuesFrom.controls.trade_details['controls']; let i=index"
[formGroupName]="i">
<div formArrayName="trading_products">
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index"
[formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Trading Product
{{l+1}}</h6>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<!-- <mat-form-field style="width: 45%">
<input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
</mat-form-field> -->
<mat-form-field style="width: 45%">
<mat-select placeholder="Trading Product Name"
formControlName="trade_product_name">
<mat-option *ngFor="let pm of m_tradingProducts"
[value]="pm.name">{{
pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<input matInput placeholder="Supplier Name"
formControlName="trade_supplier_name">
</mat-form-field>
</div>
<div fxLayout="row nowrap">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title"
formControlName="person_title_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let tl of titleList"
[value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Name"
formControlName="trade_product_contact_person_name"
[value]="items.get('trade_product_contact_person_name').value | titlecase">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation"
formControlName="person_designation"
(selectionChange)="selectedPersonDesignation(items,$event.value,2)">
<mat-option>Select</mat-option>
<mat-option
*ngFor="let comrelShip of companyRelationShipList"
[value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<!-- <mat-option value="1" > Not Applicable </mat-option> -->
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%"
*ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation"
formControlName="other_person_designation">
<mat-error
*ngIf="items.controls['other_person_designation'].hasError('required')">
Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Mobile Number"
autocomplete="off"
formControlName="trade_product_contact_person_mobile_number"
OnlyNumber type="text" maxlength="10">
<mat-error>Enter Valid Mobile Number.</mat-error>
<!-- <mat-error *ngIf="items.controls['trade_product_contact_person_mobile_number'].invaild">Enter Valid Mobile Number.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code"
formControlName="person_stdcode" type="text" OnlyNumber>
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off"
placeholder="Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber>
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<!-- <mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Type" formControlName="trade_product_payment_type">
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select> -->
<mat-select placeholder="Payment Terms"
formControlName="trade_product_payment_type"
(selectionChange)="selectedPaymentTerms(items,$event.value,2);checkCard($event.value,2,l);">
<mat-option>Select</mat-option>
<mat-option *ngFor="let pm of m_paymentType"
[value]="pm.id">{{ pm.name
}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Mode"
formControlName="trade_product_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment made in Cash.">Payment made in
Cash.</mat-option>
<mat-option value="Payment made through Banking channels.">
Payment made
through Banking channels.</mat-option>
<mat-option
value="Payment made through Cash and Banking channels.">
Payment made through Cash and Banking Channels.
</mat-option>
</mat-select>
</mat-form-field>
</div>
<!-- <mat-form-field style="width: 45%" *ngIf="items.get('trade_product_payment_type').value == 3">
<input matInput placeholder="No.of Days of Credit Provided by Supplier" autocomplete="off" formControlName="trade_product_credit_days" OnlyNumber type="text">
</mat-form-field> -->
<div fxLayout="row nowrap"
style="padding-left: 2%;display: none !important;"
*ngIf="items.get('trade_product_payment_type').value == 3">
<mat-label>No.of days of Credit Provided by Supplier </mat-label>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days From"
formControlName="trade_product_credit_days_from"
type="number">
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days To"
formControlName="trade_product_credit_days_to"
type="number">
</mat-form-field>
</div>
<div align="end">
<span *ngIf="item.controls.trading_products.controls.length > 1"
(click)="removeTradingProduct(l)">
<button mat-raised-button mat-icon-button
class="mr-1 mb-1 hover-icon" color="primary"
matTooltip="Delete" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</span>
</div>
</mat-card>
</div>
</div>
<div fxlayout="row">
<div fxFlex="100" align="center">
<button mat-flat-button color="primary" matTooltip="Add More"
matTooltipPosition="above" type="button" class="mr-1 mb-1 hover-icon"
(click)="addMoretradeProduct($event); false"><strong>Add
More Supplier</strong></button>
</div>
</div>
<div fxlayout="row" *ngIf="trdCreditCardFlag">
<mat-form-field style="width: 90%">
<input matInput placeholder="What % of Total Purchase is done on Credit?"
formControlName="trading_products_total_payments_percent_on_credit"
type="number" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</mat-card>
<mat-card *ngIf="servicingForm">
<h5 style="margin: 12px;padding:10px !important;">Service Provider Product Details</h5>
<div formArrayName="servicing_details">
<div *ngFor="let item of _supplierQuesFrom.controls.servicing_details['controls']; let i=index"
[formGroupName]="i">
<div formArrayName="service_providers">
<div *ngFor="let items of item.controls.service_providers['controls']; let l=index"
[formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Service Provider
{{l+1}}</h6>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<mat-select placeholder="Service Provide Name"
formControlName="service_provider_name">
<mat-option *ngFor="let sp of m_serviceProvider"
[value]="sp.name">{{
sp.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<input matInput placeholder="Supplier Name"
formControlName="service_provider_supplier_name">
</mat-form-field>
</div>
<div fxLayout="row nowrap">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title"
formControlName="person_title_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let tl of titleList"
[value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Name"
formControlName="service_provider_contact_person_name"
[value]="items.get('service_provider_contact_person_name').value | titlecase">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation"
formControlName="person_designation"
(selectionChange)="selectedPersonDesignation(items,$event.value,3)">
<mat-option>Select</mat-option>
<mat-option
*ngFor="let comrelShip of companyRelationShipList"
[value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<!-- <mat-option value="1" > Not Applicable </mat-option> -->
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%"
*ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation"
formControlName="other_person_designation">
<mat-error
*ngIf="items.controls['other_person_designation'].hasError('required')">
Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Mobile Number"
autocomplete="off"
formControlName="service_provider_contact_person_mobile_number"
OnlyNumber type="text" maxlength="10">
<mat-error>Enter Valid Mobile Number.</mat-error>
<!-- <mat-error *ngIf="items.controls['trade_product_contact_person_mobile_number'].invaild">Enter Valid Mobile Number.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code"
formControlName="person_stdcode" type="text" OnlyNumber>
<mat-error>Enter Valid STD Code Number.</mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off"
placeholder="Contact Person Landline Number"
formControlName="person_landline" type="text" OnlyNumber>
<mat-error>Enter Valid LandLine Number.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Terms"
formControlName="service_provider_payment_type"
(selectionChange)="selectedPaymentTerms(items,$event.value,3);checkCard($event.value,3,l);">
<mat-option>Select</mat-option>
<mat-option *ngFor="let pm of m_paymentType"
[value]="pm.id">{{ pm.name
}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Mode"
formControlName="service_provider_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment made in Cash.">Payment made in
Cash.</mat-option>
<mat-option value="Payment made through Banking channels.">
Payment made
through Banking channels.</mat-option>
<mat-option
value="Payment made through Cash and Banking channels.">
Payment made through Cash and Banking Channels.
</mat-option>
</mat-select>
</mat-form-field>
</div>
<!-- <mat-form-field style="width: 45%" *ngIf="items.get('trade_product_payment_type').value == 3">
<input matInput placeholder="No.of Days of Credit Provided by Supplier" autocomplete="off" formControlName="trade_product_credit_days" OnlyNumber type="text">
</mat-form-field> -->
<div fxLayout="row nowrap"
style="padding-left: 2%;display: none !important;"
*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: 25%">
<input matInput placeholder="Days From"
formControlName="service_provider_credit_days_from"
type="number">
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput placeholder="Days To"
formControlName="service_provider_credit_days_to"
type="number">
</mat-form-field>
</div>
<div align="end">
<span *ngIf="item.controls.service_providers.controls.length > 1"
(click)="removeServiceProvider(l)">
<button mat-raised-button mat-icon-button
class="mr-1 mb-1 hover-icon" color="primary"
matTooltip="Delete" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</span>
</div>
</mat-card>
</div>
</div>
<div fxlayout="row">
<div fxFlex="100" align="center">
<button mat-flat-button color="primary" matTooltip="Add More"
matTooltipPosition="above" type="button" class="mr-1 mb-1 hover-icon"
(click)="addMoreServiceProvider($event); false"><strong>Add
More Supplier</strong></button>
</div>
</div>
<div fxlayout="row" *ngIf="spCreditCardFlag">
<mat-form-field style="width: 90%">
<input matInput placeholder="What % of Total Purchase is done on Credit?"
formControlName="service_providers_total_payments_percent_on_credit"
type="number" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</mat-card>
<!-- <mat-card *ngIf="serviceProviderForm">
<h5 style="margin: 12px;padding:10px !important;">Service Provider Product Details</h5>
<div style="text-align: center; margin: 12px;">Service Provider Details Not applicable here !!</div>
</mat-card> -->
</ng-template>
</mat-tab>
<mat-tab label="Docs">
<ng-template matTabContent>
<div ngxViewer *ngIf="documentsAndFilesList.length>0; else noFiles">
<div fxLayout="row wrap" style="padding:20px;">
<div fxFlex="100">
<div fxFlex="20" class="m-gap p-gap" *ngFor="let doc of documentsAndFilesList">
<div class="p-list-main mb-2" *ngIf="doc.document_type != 'pdf'">
<div class="p-list">
<div class="top">
<!-- Thumbnail-->
<div class="thumbnail">
<button mat-raised-button mat-icon-button
class="date mr-1 mb-1 hover-icon" type="button"
matTooltip="edit" (click)="imageCrop(doc)"
matTooltipPosition="right">
<mat-icon>edit</mat-icon>
</button>
<img src="{{doc.document}}" alt="{{doc.document_name}}">
</div>
<label *ngIf="doc.document_title != ''"
style="font-size: 0.85rem">{{doc.document_title}}</label>
</div>
</div>
</div>
</div>
</div>
<div fxFlex="row">
<div fxFlex="100" class="m-gap p-gap">
<div fxLayout="row" fxLayoutWrap="wrap">
<div *ngFor="let doc of documentsAndFilesList">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50"
fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"
*ngIf="doc.document_type == 'pdf';">
<!-- <a href="http://www.google.com" target="_blank"> -->
<mat-icon
style="color: #e00201;font-size: 60px !important;width:inherit !important;"
(click)="pdf(doc.document)">picture_as_pdf</mat-icon>
<span class="d-block">{{doc.document_title}}</span>
<!-- </a> -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ng-template #noFiles>
<mat-card-content>
<p style="margin: 20px;">No Files</p>
</mat-card-content>
</ng-template>
</ng-template>
</mat-tab>
<ng-template #noFiles>
<mat-card-content>
<p style="margin: 20px;">No Files</p>
</mat-card-content>
</ng-template>
</ng-template>
</mat-tab>
</mat-tab-group>
</mat-tab-group>
</mat-dialog-content>
<mat-dialog-actions>

View File

@ -32,6 +32,7 @@ export class SupplierInfoComponent implements OnInit {
public m_manufacturingProducts = [];
public m_tradingProducts = [];
public m_serviceProvider = [];
company_id: string;
public _supplierQuesFrom: FormGroup;
@ -110,11 +111,11 @@ export class SupplierInfoComponent implements OnInit {
let datas = data.records;
this.initFormLoadDetails(datas.type_of_activity);
this.m_manufacturingProducts = datas.type_of_activity.filter(data => { if (data.type_of_activity_id == 2) { return data } }).map(data => [...data.prodcuts]);
// this.m_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3){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) {
@ -128,10 +129,17 @@ export class SupplierInfoComponent implements OnInit {
this.m_tradingProducts.push(val.prodcuts);
}
}
if(val.type_of_activity_id == 5){
if (val.prodcuts) {
this.m_serviceProvider.push(val.prodcuts);
}
}
});
}
this.m_tradingProducts = [].concat.apply([], this.m_tradingProducts);
this.m_serviceProvider = [].concat.apply([], this.m_serviceProvider);
} else {
this.notifier.notify('warning', 'No Category Records Found.!');
this.noRecordsFound = false;
@ -151,8 +159,6 @@ export class SupplierInfoComponent implements OnInit {
this.retriveFile();
}
serviceProviderForm: Boolean = false;
initFormLoadDetails(record) {
let params: any = {};
params.parent_pdid = this.parent_pdid;
@ -172,6 +178,7 @@ export class SupplierInfoComponent implements OnInit {
company_id: [this.company_id],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]),
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
@ -208,6 +215,22 @@ export class SupplierInfoComponent implements OnInit {
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
}
}
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
if (dataForm.hasOwnProperty('servicing_details') && dataForm.servicing_details[0] !== null) {
let api_service_providers = dataForm.servicing_details[0].service_providers;
this.initServiceProvidersDetails(api_service_providers);
this._supplierQuesFrom.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 {
this.initServiceProvidersDetails(null);
this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(null);
}
}
this.noRecordsFound = true;
} else {
this._supplierQuesFrom = this._formBuilder.group({
@ -217,6 +240,7 @@ export class SupplierInfoComponent implements OnInit {
company_id: [this.company_id],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]),
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
@ -230,12 +254,14 @@ export class SupplierInfoComponent implements OnInit {
this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);
}
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
this.initServiceProvidersDetails(null);
this._supplierQuesFrom.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);
}
this.noRecordsFound = true;
}
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
this.serviceProviderForm = true;
}
} else {
this._supplierQuesFrom = this._formBuilder.group({
parent_pdid: [this.parent_pdid],
@ -244,6 +270,7 @@ export class SupplierInfoComponent implements OnInit {
company_id: [this.company_id],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]),
supplier_info_form_remark: []
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
@ -259,7 +286,9 @@ export class SupplierInfoComponent implements OnInit {
}
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
this.serviceProviderForm = true;
// this.serviceProviderForm = true;
this.initServiceProvidersDetails(null);
this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(null);
}
this.noRecordsFound = true;
}
@ -299,6 +328,20 @@ export class SupplierInfoComponent implements OnInit {
}
}
servicingForm: Boolean = false;
servicingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 5);
if (arr.length > 0) {
this.servicingForm = true;
return this._formBuilder.group({
service_providers: this._formBuilder.array([]),
service_providers_total_payments_percent_on_credit: []
});
} else {
return;
}
}
initManufacturingProductsDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
if (datas === null) {
@ -349,7 +392,7 @@ export class SupplierInfoComponent implements OnInit {
})
}
}
initTradingProductsDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
@ -401,6 +444,58 @@ export class SupplierInfoComponent implements OnInit {
}
}
initServiceProvidersDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers'];
if (datas === null) {
control.push(this.initServiceProviders(null));
} else {
datas.forEach((val, inx) => {
this.checkCard(val.trade_product_payment_type, 3, inx);
control.push(this.initServiceProviders(val));
});
}
}
initServiceProviders(records) {
if (records === null) {
return this._formBuilder.group({
service_provider_name: [''],
service_provider_supplier_name: [''],
person_title_name: [''],
person_designation: [''],
other_person_designation: [''],
service_provider_contact_person_name: [''],
service_provider_contact_person_mobile_number: ['', Validators.compose([Validators.minLength(10), Validators.maxLength(10)])],
person_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
person_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
service_provider_payment_type: [''],
service_provider_payment_mode: [''],
service_provider_frequency_of_purchase: [''],
service_provider_credit_days_from: [''],
service_provider_credit_days_to: [''],
})
} else {
return this._formBuilder.group({
service_provider_name: [records.service_provider_name],
person_title_name: [records.person_title_name],
person_designation: [records.person_designation],
other_person_designation: [records.other_person_designation],
service_provider_supplier_name: [records.service_provider_supplier_name],
service_provider_contact_person_name: [records.service_provider_contact_person_name],
service_provider_contact_person_mobile_number: [records.service_provider_contact_person_mobile_number, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])],
person_stdcode: [records.person_stdcode, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
person_landline: [records.person_landline, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
service_provider_payment_type: [records.service_provider_payment_type],
service_provider_payment_mode: [records.service_provider_payment_mode],
service_provider_frequency_of_purchase: [records.service_provider_frequency_of_purchase],
service_provider_credit_days_from: [records.service_provider_credit_days_from],
service_provider_credit_days_to: [records.service_provider_credit_days_to],
})
}
}
addMoreRawMaterials(e): void {
// e.stropPropagation();
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
@ -424,6 +519,17 @@ export class SupplierInfoComponent implements OnInit {
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
control.removeAt(inx);
}
addMoreServiceProvider(e): void {
// e.stropPropagation();
const control = <FormArray>this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers'];
control.push(this.initServiceProviders(null));
}
removeServiceProvider(inx): void {
const control = <FormArray>this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers'];
control.removeAt(inx);
}
// get all master details
getMasterDetails(table: string, type: number) {
@ -528,12 +634,20 @@ export class SupplierInfoComponent implements OnInit {
else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');}
items.controls['other_person_designation'].updateValueAndValidity();
}
else if (flag == 3) {
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); }
else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');}
items.controls['other_person_designation'].updateValueAndValidity();
}
}
mfgCreditCardFlag: boolean = false;
trdCreditCardFlag: boolean = false;
spCreditCardFlag: boolean = false;
mfgCounter: any = [];
trdCounter: any = [];
spCounter: any = [];
checkCard(e, flag, index) {
if (flag == 2 && e == 3) {
this.trdCounter[index] = 1;
@ -552,9 +666,32 @@ export class SupplierInfoComponent implements OnInit {
}
let MFG = this.mfgCounter.reduce((sum, val) => sum + +val, 0);
this.mfgCreditCardFlag = MFG > 0 ? true : false;
if (flag == 3 && e == 3) {
this.spCounter[index] = 1;
}
else if (flag == 3 && e != 3) {
this.spCounter[index] = 0;
}
let SP = this.spCounter.reduce((sum, val) => sum + +val, 0);
this.spCreditCardFlag = SP > 0 ? true : false;
}
selectedPaymentTerms(items, e, flag) {
if (flag == 3) {
if (e == 3) {
items.controls['service_provider_credit_days_from'].setValidators([Validators.required]);
items.controls['service_provider_credit_days_to'].setValidators([Validators.required]);
}
else {
items.controls['service_provider_credit_days_from'].clearValidators();
items.controls['service_provider_credit_days_from'].setValue('');
items.controls['service_provider_credit_days_to'].clearValidators();
items.controls['service_provider_credit_days_to'].setValue('');
}
items.controls['service_provider_credit_days_from'].updateValueAndValidity();
items.controls['service_provider_credit_days_to'].updateValueAndValidity();
}
if (flag == 2) {
if (e == 3) {
items.controls['trade_product_credit_days_from'].setValidators([Validators.required]);

View File

@ -36,7 +36,7 @@
<button *ngIf="pdReportRecords.pd_status!='QC_COMPLETED'" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Re-generate Report" matTooltipPosition="above" (click)="reGeneratePFReport()"><mat-icon>autorenew</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Download PD Report" matTooltipPosition="above" (click)="downloadPDReport()"><mat-icon>get_app</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Download PD Report" matTooltipPosition="above" (click)="archivePDImages()"><mat-icon>save_alt</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Download PD Pictures" matTooltipPosition="above" (click)="archivePDImages()"><mat-icon>save_alt</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="loadPdViewCompoent()" style="margin-right: 2px;"><mat-icon>close</mat-icon></button>
</mat-toolbar>

View File

@ -43,11 +43,11 @@ export class MessagingService {
this.angularFireDB.object('fcmTokens/').update(data)
})
let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}};
this.updateNotificationToken(params).subscribe(
(data) => { console.log('success',data);},
(err) => { console.error('something wents wrong on update notify.', err);
});
// let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}};
// this.updateNotificationToken(params).subscribe(
// (data) => { console.log('success',data);},
// (err) => { console.error('something wents wrong on update notify.', err);
// });
}
updateNotificationToken(params): Observable<any> {