supplier form changes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-07-04 20:08:25 +05:30
parent 54d868b0d8
commit 5c3a90de96
19 changed files with 1557 additions and 1287 deletions

View File

@ -1 +1 @@
{"version":3,"sources":["../../@angular/common/http (ignored)"],"names":[],"mappings":";;;;;AAAA,e","file":"0.js","sourcesContent":["/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// @angular/common/http (ignored)\n// module id = 713\n// module chunks = 0"],"sourceRoot":""}
{"version":3,"sources":["../../@angular/common/http (ignored)"],"names":[],"mappings":";;;;;AAAA,e","file":"0.js","sourcesContent":["/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// @angular/common/http (ignored)\n// module id = 712\n// module chunks = 0"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2004
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -126,4 +126,4 @@
"android"
]
}
}
}

View File

@ -111,7 +111,6 @@ import { PdQuestionGeneralOtherApplicantPage } from '../pages/pd-question/pd-que
import { PdQuestionNeighbourHoodPage } from '../pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood';
import { PdQuestionFinalRemarkPage } from '../pages/pd-question/pd-question-final-remark/pd-question-final-remark';
import { PdQuestionFuturePlansAndBusinessEnvironmentPage } from '../pages/pd-question/pd-question-business-group/pd-question-future-plans-and-business-environment/pd-question-future-plans-and-business-environment';
import { PdQuestionBusinessPage } from '../pages/pd-question/pd-question-business/pd-question-business'
import { PdQuestionBusinessGroupPage } from '../pages/pd-question/pd-question-business-group/pd-question-business-group'
import { PdQuestionBusinessAssetsPage } from '../pages/pd-question/pd-question-business-group/pd-question-business-assets/pd-question-business-assets'
import {PdQuestionBusinessBankingPage} from '../pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking'
@ -183,7 +182,6 @@ import {Push} from '@ionic-native/push'
PdQuestionNeighbourHoodPage,
PdQuestionFinalRemarkPage,
PdQuestionFuturePlansAndBusinessEnvironmentPage,
PdQuestionBusinessPage,
PdQuestionBusinessGroupPage,
PdQuestionBusinessAssetsPage,
PdQuestionBusinessBankingPage,
@ -284,7 +282,6 @@ import {Push} from '@ionic-native/push'
PdQuestionNeighbourHoodPage,
PdQuestionFinalRemarkPage,
PdQuestionFuturePlansAndBusinessEnvironmentPage,
PdQuestionBusinessPage,
PdQuestionBusinessGroupPage,
PdQuestionBusinessAssetsPage,
PdQuestionBusinessBankingPage,

View File

@ -30,7 +30,6 @@ import { PdQuestionLenderRepresentativePage } from '../pd-question/pd-question-l
import { PdQuestionGeneralInfoPage } from '../pd-question/pd-question-general-info/pd-question-general-info';
import { PdQuestionNeighbourHoodPage } from '../pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood';
import { PdQuestionFinalRemarkPage } from '../pd-question/pd-question-final-remark/pd-question-final-remark';
import { PdQuestionBusinessPage } from '../pd-question/pd-question-business/pd-question-business'
import { PdQuestionBusinessGroupPage } from '../pd-question/pd-question-business-group/pd-question-business-group'
import {PdQuestionRentalDashPage} from '../pd-question/pd-question-rental-info/pd-question-rental-dash/pd-question-rental-dash'
import { PdQuestionFuturePlansAndBusinessEnvironmentPage } from '../pd-question/pd-question-business-group/pd-question-future-plans-and-business-environment/pd-question-future-plans-and-business-environment'

View File

@ -431,6 +431,98 @@
</mat-form-field>
</div>
</mat-card>
<!-- <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 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>
<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-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'">
<mat-form-field style="width:100%">
<input matInput autocomplete="off" placeholder="Estimated Quantity"
formControlName="traded_goods_quantity" type="number">
</mat-form-field>
<mat-form-field style="width:100%">
<mat-select placeholder="Unit of Mearsurement" formControlName="traded_goods_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)">
<ion-icon name="md-close" ngxMatSelectSearchClear></ion-icon>
</ngx-mat-select-search>
</mat-option>
<mat-option> Select</mat-option>
<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%">
<input matInput autocomplete="off" placeholder="Specify UOM"
formControlName="traded_goods_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 != ''">{{"&#8377;"}}
{{T_tradedGoodsValueInWords[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">
<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">
<ion-icon name="add-circle" color="optblue" style="font-size: 24px;"></ion-icon>
</a>
</ion-col>
</ion-buttons>
</mat-card-actions>
</div>
</div>
</div>
</div>
</div>
<div *ngIf="TGCommentCard">
<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-option>Select</mat-option>
<mat-option *ngFor="let val of TGsufficientList" [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>
</div>
</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>

View File

@ -295,14 +295,130 @@
</div>
</div>
</mat-card>
<mat-card *ngIf="serviceProviderForm">
<mat-card *ngIf="servicingForm">
<mat-card-title>
<h5>Service Provider Details</h5>
</mat-card-title>
<div formArrayName="servicing_details">
<div *ngFor="let serv 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>
<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-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Supplier Name" formControlName="service_provider_supplier_name">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Title" formControlName="person_title_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let tl of m_titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Name" formControlName="service_provider_contact_person_name"
maxlength="10">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Contact Person Designation" formControlName="person_designation"
(selectionChange)="selectedPersonDesignation(ser,$event.value,3)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of m_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: 100%" *ngIf="ser.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Mobile Number" autocomplete="off" formControlName="service_provider_contact_person_mobile_number"
type="tel" maxlength="10" minlength="10">
<mat-error style="font-size: 12px">Enter Valid Mobile Number</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode" type="tel"
minlength="3" maxlength="5">
<mat-error style="font-size: 12px">Enter Valid STD Code Number</mat-error>
</mat-form-field>
<!-- &nbsp; - &nbsp; -->
<mat-form-field style="width: 100%">
<input matInput autocomplete="off" placeholder="Contact Person Landline Number" formControlName="person_landline"
type="tel" minlength="6" maxlength="8">
<mat-error style="font-size: 12px">Enter Valid LandLine Number</mat-error>
</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);">
<mat-option>Select</mat-option>
<mat-option *ngFor="let pm of m_paymentList" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<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>
<span *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: 100%">
<input matInput placeholder="Days From" formControlName="service_provider_credit_days_from" type="number">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Days To" formControlName="service_provider_credit_days_to" type="number">
</mat-form-field>
</span>
</div>
</mat-card-content>
<ion-buttons end>
<ion-col col-3 offset-3>
<a (click)="removeServiceProvider(s)"
*ngIf="serv.controls.service_providers.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)="addMoreServiceProvider($event); false" *ngIf="last">
<ion-icon name="add-circle" color="optblue" style="font-size: 24px;"></ion-icon>
</a>
</ion-col>
</ion-buttons>
</div>
</div>
<div *ngIf="spCreditCardFlag">
<mat-form-field style="width: 100%">
<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">
<mat-card-title>
<h5>Service Provider Product 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>

View File

@ -4,9 +4,9 @@ import { FormBuilder, FormGroup, FormArray } from '@angular/forms';
import { AwsServiceProvider } from '../../../../providers/aws-service/aws-service';
import { QuestionCategoryProvider } from '../../../../providers/question-category/question-category';
import { ToastProvider } from '../../../../providers/common-provider/toast';
import {CameraProvider} from '../../../../providers/common-provider/camera'
import {LoadingProvider} from '../../../../providers/common-provider/loading'
import {ConstantsProvider} from '../../../../providers/constants/constants'
import { CameraProvider } from '../../../../providers/common-provider/camera'
import { LoadingProvider } from '../../../../providers/common-provider/loading'
import { ConstantsProvider } from '../../../../providers/constants/constants'
/**
* Generated class for the PdQuestionSupplsierInfoPage page.
*
@ -30,6 +30,8 @@ export class PdQuestionSupplierInfoPage {
business_manufacturingProducts: any = [];
business_tradingProducts: any = [];
business_serviceProvider: any = [];
m_titleList: any = [];
m_paymentList: any = [];
m_companyRelationShipList: any = [];
@ -38,14 +40,13 @@ export class PdQuestionSupplierInfoPage {
public submitted = false;
errorMessage: any = '';
imageDisplay: any[];
imageBucket: any=[];
tab: string='0';
imageBucket: any = [];
tab: string = '0';
constructor(public navCtrl: NavController, public navParams: NavParams, public fb: FormBuilder,
public aws: AwsServiceProvider, public qustCat: QuestionCategoryProvider,
public toast: ToastProvider,private cameraProvider:CameraProvider,private loading:LoadingProvider,
private constantProvider:ConstantsProvider)
{
public aws: AwsServiceProvider, public qustCat: QuestionCategoryProvider,
public toast: ToastProvider, private cameraProvider: CameraProvider, private loading: LoadingProvider,
private constantProvider: ConstantsProvider) {
this.questionDetails = this.navParams.get('questionDetails');
this.pdDetails = this.navParams.get('pdDetails');
@ -63,6 +64,7 @@ export class PdQuestionSupplierInfoPage {
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];
@ -81,6 +83,7 @@ export class PdQuestionSupplierInfoPage {
this.business_tradingProducts.push(val.prodcuts);
}
}
});
}
@ -109,7 +112,7 @@ export class PdQuestionSupplierInfoPage {
serviceProviderForm: Boolean = false;
initFormLoadDetails(record) {
let params: any = {};
params.parent_pdid=this.pdDetails.parent_pd_id
params.parent_pdid = this.pdDetails.parent_pd_id
params.pd_id = this.pdDetails.pd_id;
params.pd_form_id = this.form_id;
params.company_id = this.company_id;
@ -120,13 +123,14 @@ export class PdQuestionSupplierInfoPage {
let dataForm = data['records'];
if (dataForm !== undefined) {
this.supplierInfoForm = this.fb.group({
parent_pdid:[this.pdDetails.parent_pd_id],
parent_pdid: [this.pdDetails.parent_pd_id],
pdid: [this.pdDetails.pd_id],
formid: [this.form_id],
company_id: [this.company_id],
fk_createdby: [this.users],
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
trade_details: this.fb.array([this.tradingFormCreation(record)]),
servicing_details: this.fb.array([this.servicingFormCreation(record)]),
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
});
@ -163,18 +167,28 @@ export class PdQuestionSupplierInfoPage {
}
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
this.serviceProviderForm = true;
}
// this.serviceProviderForm = true;
if (dataForm.trade_details[0] != null) {
let api_service_provider = dataForm.servicing_details[0].service_provider;
this.initServiceProvidersDetails(api_service_provider);
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 {
this.initServiceProvidersDetails(null);
this.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(null);
}
}
this.noRecordsFound = true;
} else {
this.supplierInfoForm = this.fb.group({
parent_pdid:[this.pdDetails.parent_pd_id],
parent_pdid: [this.pdDetails.parent_pd_id],
pdid: [this.pdDetails.pd_id],
formid: [this.form_id],
company_id: [this.company_id],
fk_createdby: [this.users],
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
trade_details: this.fb.array([this.tradingFormCreation(record)]),
servicing_details: this.fb.array([this.servicingFormCreation(record)]),
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
});
@ -188,21 +202,23 @@ export class PdQuestionSupplierInfoPage {
this.initTradingProductsDetails(null);
this.supplierInfoForm.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.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);
}
this.noRecordsFound = true;
}
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
this.serviceProviderForm = true;
}
} else {
this.supplierInfoForm = this.fb.group({
parent_pdid:[this.pdDetails.parent_pd_id],
parent_pdid: [this.pdDetails.parent_pd_id],
pdid: [this.pdDetails.pd_id],
formid: [this.form_id],
company_id: [this.company_id],
fk_createdby: [this.users],
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
trade_details: this.fb.array([this.tradingFormCreation(record)]),
servicing_details: this.fb.array([this.servicingFormCreation(record)]),
supplier_info_form_remark: []
// wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
});
@ -218,7 +234,9 @@ export class PdQuestionSupplierInfoPage {
}
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.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(null);
}
this.noRecordsFound = true;
}
@ -257,6 +275,20 @@ export class PdQuestionSupplierInfoPage {
}
}
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.fb.group({
service_providers: this.fb.array([]),
service_providers_total_payments_percent_on_credit: []
});
} else {
return;
}
}
initManufacturingProductsDetails(datas) {
const control = <FormArray>this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
if (datas === null) {
@ -371,6 +403,57 @@ export class PdQuestionSupplierInfoPage {
}
}
initServiceProvidersDetails(datas) {
const control = <FormArray>this.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers'];
if (datas === null) {
control.push(this.initServiceProviders(null));
} else {
datas.forEach((val, inx) => {
this.checkCard(val.service_provider_payment_type, 3, inx);
control.push(this.initServiceProviders(val));
});
}
}
initServiceProviders(records) {
if (records === null) {
return this.fb.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: [''],
person_stdcode: [null],
person_landline: [null],
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.fb.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],
person_stdcode: [records.person_stdcode],
person_landline: [records.person_landline],
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.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
@ -395,6 +478,17 @@ export class PdQuestionSupplierInfoPage {
control.removeAt(inx);
}
addMoreServiceProvider(e): void {
// e.stropPropagation();
const control = <FormArray>this.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers'];
control.push(this.initServiceProviders(null));
}
removeServiceProvider(inx): void {
const control = <FormArray>this.supplierInfoForm.controls['servicing_details']['controls'][0].controls['service_providers'];
control.removeAt(inx);
}
getdropList() {
@ -415,25 +509,25 @@ export class PdQuestionSupplierInfoPage {
this.m_paymentList = data['records'].filter(data => data.isactive == 1);
});
}
saveSupplierInfoWithImageCheck(answerFormValues){
console.log("forms",answerFormValues);
let required_imageCheck=this.mandatoryImageCheck(answerFormValues)
console.log("required image check",required_imageCheck);
if(!required_imageCheck){
let alert=this.toast.setAlert("Mandatory photographs not taken"," Do you want to take it later?")
saveSupplierInfoWithImageCheck(answerFormValues) {
console.log("forms", answerFormValues);
let required_imageCheck = this.mandatoryImageCheck(answerFormValues)
console.log("required image check", required_imageCheck);
if (!required_imageCheck) {
let alert = this.toast.setAlert("Mandatory photographs not taken", " Do you want to take it later?")
alert.present();
alert.onDidDismiss(value=>{
if(value=='s'){
alert.onDidDismiss(value => {
if (value == 's') {
this.saveSupplierInfo(answerFormValues)
}
else{
else {
return true;
}
})
}
else{
this.saveSupplierInfo(answerFormValues)
}
}
else {
this.saveSupplierInfo(answerFormValues)
}
}
@ -470,12 +564,19 @@ export class PdQuestionSupplierInfoPage {
// :items.controls['other_person_designation'].clearValidators(),items.controls['other_person_designation'].setValue('');
// items.controls['other_person_designation'].updateValueAndValidity();
}
else if (flag == 3) {
e == 1 ? '' : '';
}
}
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;
@ -494,6 +595,16 @@ export class PdQuestionSupplierInfoPage {
}
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) {
@ -524,215 +635,230 @@ export class PdQuestionSupplierInfoPage {
items.controls['manufacturing_credit_days_from'].updateValueAndValidity();
items.controls['manufacturing_credit_days_to'].updateValueAndValidity();
}
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();
}
}
/*IMAGE SECTION*/
getPDImages(){
/*IMAGE SECTION*/
getPDImages() {
//FOR RETRIEVING PICTURES
this.imageDisplay=[]
let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.formDetails.form_id,'company_id':this.pdDetails.company_id}
this.qustCat.getPDImages(record_for_pic).subscribe(val=>{
if(!val['msg']){
this.imageDisplay = []
let record_for_pic = { 'pd_id': this.pdDetails.pd_id, 'form_id': this.formDetails.form_id, 'company_id': this.pdDetails.company_id }
this.qustCat.getPDImages(record_for_pic).subscribe(val => {
if (!val['msg']) {
console.log(val['records'])
if(val['records'].length>0){
val['records'].forEach(result=>{
this.imageDisplay.push({'image':result.doc_url,'Name':result.pd_document_title,'option':'dummy'})
})
console.log("imageBuck",this.imageDisplay);
if (val['records'].length > 0) {
val['records'].forEach(result => {
this.imageDisplay.push({ 'image': result.doc_url, 'Name': result.pd_document_title, 'option': 'dummy' })
})
console.log("imageBuck", this.imageDisplay);
}
}
}
})
}
changeName(value,index,img){
changeName(value, index, img) {
console.log(value);
this.imageDisplay[index]={'image':img,'Name':value}
this.imageDisplay[index] = { 'image': img, 'Name': value }
}
changeNameForBucket(value,index,img){
this.imageBucket[index]={'image':img,'Name':value}
changeNameForBucket(value, index, img) {
this.imageBucket[index] = { 'image': img, 'Name': value }
}
removeImg(index){
this.imageDisplay.splice(index,1);
removeImg(index) {
this.imageDisplay.splice(index, 1);
}
removeImgForBucket(index){
this.imageBucket.splice(index,1)
removeImgForBucket(index) {
this.imageBucket.splice(index, 1)
}
captureTheSupplierPics(materialName,index,supplierName){
captureTheSupplierPics(materialName, index, supplierName) {
console.log('ds');
// alert('dsa');
if(supplierName != ''){
if (supplierName != '') {
// 'Raw Material','l',items.get('manufacturing_supplier_name').value
this.cameraProvider.getpicture().then(res=>{
if(res != 'error'){
this.constantProvider.getGeoTag().then(geoCoordinates=>{
console.log("geo promise",geoCoordinates)
this.imageBucket.push({'image':res,'Name':supplierName + ' - ' + materialName + ' ' + (index+1),'link':geoCoordinates});
this.cameraProvider.getpicture().then(res => {
if (res != 'error') {
this.constantProvider.getGeoTag().then(geoCoordinates => {
console.log("geo promise", geoCoordinates)
this.imageBucket.push({ 'image': res, 'Name': supplierName + ' - ' + materialName + ' ' + (index + 1), 'link': geoCoordinates });
})
}
},error=>{
console.log("Camera Error ",JSON.stringify(error));
}, error => {
console.log("Camera Error ", JSON.stringify(error));
})
this.tab='1';
this.tab = '1';
}
else if(supplierName == ''){
alert('Please Fill The Supplier Name');
else if (supplierName == '') {
alert('Please Fill The Supplier Name');
}
}
mandatoryImageCheck(Form_values){
let Form_names=[]
if(Form_values.manufacturing_details.length != 0 && Form_values.manufacturing_details[0] != null){
if(Form_values.manufacturing_details[0].main_raw_materials.length != 0){
Form_values.manufacturing_details[0].main_raw_materials.forEach((value,index)=>{
Form_names.push({'index':index+1,'name':value.manufacturing_supplier_name+' - '+ 'Raw Material ' + (index+1) })
})
}
}
// if(Form_values.service_provider_details.length != 0 && Form_values.service_provider_details[0] != null ){
// if(Form_values.service_provider_details[0].service_products.length != 0){
// Form_values.service_provider_details[0].service_products.forEach((value,index)=>{
// Form_names.push({'index':index+1,'name':value.service_provider_client_name+' - '+ 'Service Provided ' + (index+1) })
// })
// }
// }
if(Form_values.trade_details.length != 0 && Form_values.trade_details[0] != null){
if( Form_values.trade_details[0].trading_products.length != 0){
Form_values.trade_details[0].trading_products.forEach((value,index)=>{
Form_names.push({'index':index+1,'name':value.trade_supplier_name+' - '+ 'Trading Product ' + (index+1) })
})
}
}
mandatoryImageCheck(Form_values) {
let Form_names = []
if (Form_values.manufacturing_details.length != 0 && Form_values.manufacturing_details[0] != null) {
if (Form_values.manufacturing_details[0].main_raw_materials.length != 0) {
Form_values.manufacturing_details[0].main_raw_materials.forEach((value, index) => {
Form_names.push({ 'index': index + 1, 'name': value.manufacturing_supplier_name + ' - ' + 'Raw Material ' + (index + 1) })
})
}
}
// if(Form_values.service_provider_details.length != 0 && Form_values.service_provider_details[0] != null ){
// if(Form_values.service_provider_details[0].service_products.length != 0){
// Form_values.service_provider_details[0].service_products.forEach((value,index)=>{
// Form_names.push({'index':index+1,'name':value.service_provider_client_name+' - '+ 'Service Provided ' + (index+1) })
// })
// }
// }
if (Form_values.trade_details.length != 0 && Form_values.trade_details[0] != null) {
if (Form_values.trade_details[0].trading_products.length != 0) {
Form_values.trade_details[0].trading_products.forEach((value, index) => {
Form_names.push({ 'index': index + 1, 'name': value.trade_supplier_name + ' - ' + 'Trading Product ' + (index + 1) })
})
}
}
// console.log("Form Values",Form_names);
// console.log("image values",this.imageDisplay)
let valBool
let count:number=0;
let mandatoryimgSaved=[]
let mandatoryimgNotSaved=[]
let count: number = 0;
let mandatoryimgSaved = []
let mandatoryimgNotSaved = []
if(Form_names.length != 0 ){
// if( this.imageDisplay.length !=0){
Form_names.forEach(formvalue=>{
this.imageDisplay.forEach((imgvalue)=>{
// console.log("Form values individuals",formvalue)
if(formvalue.name != imgvalue.Name){
valBool=true
}
else{
if (Form_names.length != 0) {
// if( this.imageDisplay.length !=0){
Form_names.forEach(formvalue => {
this.imageDisplay.forEach((imgvalue) => {
// console.log("Form values individuals",formvalue)
if (formvalue.name != imgvalue.Name) {
valBool = true
}
else {
valBool = false
count++;
}
if (count >= 2 && valBool == false) {
// console.log("end of image dis",formvalue.name,"count ",count)
mandatoryimgSaved.push(formvalue.name)
//return
}
else {
mandatoryimgNotSaved.push(formvalue.name)
return
}
})
if (valBool == true)
console.log("Form name", formvalue.name)
mandatoryimgNotSaved.push(formvalue.name)
valBool=false
count ++;
}
if(count >=2 && valBool == false){
// console.log("end of image dis",formvalue.name,"count ",count)
mandatoryimgSaved.push(formvalue.name)
//return
}
else{
mandatoryimgNotSaved.push(formvalue.name)
return
}
})
if(valBool==true)
console.log("Form name",formvalue.name)
mandatoryimgNotSaved.push(formvalue.name)
})
console.log("mandatoryimgSaved",mandatoryimgSaved)
console.log("mandatoryimgNot Saved",mandatoryimgNotSaved)
mandatoryimgSaved.forEach(res=>{
mandatoryimgNotSaved=mandatoryimgNotSaved.filter(val=>val != res)
})
// console.log("res for not saved img",mandatoryimgNotSaved);
// let uniquenotsavedImage=[ ...new Set(mandatoryimgNotSaved)]
let uniquenotsavedImage=(mandatoryimgNotSaved)=>mandatoryimgNotSaved.filter((val,i)=>mandatoryimgNotSaved.indexOf(val) === i)
console.log("uniw",uniquenotsavedImage(mandatoryimgNotSaved));
if(uniquenotsavedImage(mandatoryimgNotSaved).length > 0){
return false
}
else{
return true
}
//COUNTING THE DUPLICATES IN AN ARRAY
// var arr = ['a','b','c','d','d','e','a','b','c','f','g','h','h','h','e','a'];
// var map = arr.reduce(function(prev, cur) {
// prev[cur] = (prev[cur] || 0) + 1;
// return prev;
// }, {});
// map is an associative array mapping the elements to their frequency:
// console.log(map);
// prints {"a": 3, "b": 2, "c": 2, "d": 2, "e": 2, "f": 1, "g": 1, "h": 3}
//}
}
else{
return true
}
console.log("mandatoryimgSaved", mandatoryimgSaved)
console.log("mandatoryimgNot Saved", mandatoryimgNotSaved)
mandatoryimgSaved.forEach(res => {
mandatoryimgNotSaved = mandatoryimgNotSaved.filter(val => val != res)
})
// console.log("res for not saved img",mandatoryimgNotSaved);
// let uniquenotsavedImage=[ ...new Set(mandatoryimgNotSaved)]
let uniquenotsavedImage = (mandatoryimgNotSaved) => mandatoryimgNotSaved.filter((val, i) => mandatoryimgNotSaved.indexOf(val) === i)
console.log("uniw", uniquenotsavedImage(mandatoryimgNotSaved));
if (uniquenotsavedImage(mandatoryimgNotSaved).length > 0) {
return false
}
else {
return true
}
//COUNTING THE DUPLICATES IN AN ARRAY
// var arr = ['a','b','c','d','d','e','a','b','c','f','g','h','h','h','e','a'];
// var map = arr.reduce(function(prev, cur) {
// prev[cur] = (prev[cur] || 0) + 1;
// return prev;
// }, {});
// map is an associative array mapping the elements to their frequency:
// console.log(map);
// prints {"a": 3, "b": 2, "c": 2, "d": 2, "e": 2, "f": 1, "g": 1, "h": 3}
//}
}
else {
return true
}
}
capture(){
capture() {
//FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{
console.log("Value",res)
if(res != 'error'){
this.constantProvider.getGeoTag().then(geoCoordinates=>{
console.log("geo promise",geoCoordinates)
this.imageBucket.push({'image':res,'Name':'','link':geoCoordinates});
//FOR GETTING THE DOC NAME FROM ALERT
let alert =this.toast.setAlertForDocName()
alert.present()
alert.onDidDismiss(value=>{
console.log("alert value",value);
if(value){
this.imageBucket[this.imageBucket.length-1].Name=value.Name
}
})
})
}
},error=>{
console.log("Camera Error ",JSON.stringify(error));
})
this.tab='1';
}
sendImage(){
this.loading.loaderForSendImage()
console.log("ll",JSON.stringify(this.imageBucket));
let records:any={
'pd_id':this.pdDetails.pd_id,
'formid':this.formDetails.form_id,
'images':this.imageBucket,
'company_id':this.pdDetails.company_id,
this.cameraProvider.getpicture().then(res => {
console.log("Value", res)
if (res != 'error') {
this.constantProvider.getGeoTag().then(geoCoordinates => {
console.log("geo promise", geoCoordinates)
this.imageBucket.push({ 'image': res, 'Name': '', 'link': geoCoordinates });
//FOR GETTING THE DOC NAME FROM ALERT
let alert = this.toast.setAlertForDocName()
alert.present()
alert.onDidDismiss(value => {
console.log("alert value", value);
if (value) {
this.imageBucket[this.imageBucket.length - 1].Name = value.Name
}
})
})
}
console.log("records",JSON.stringify(records))
this.qustCat.savePDImages(records).subscribe(res=>{
if(res['dataStatus']== true){
this.toast.pdTriggerappmessage("Image Saved Successfully")
this.imageBucket=[]
this.getPDImages();
}
else{
this.toast.pdTriggerappmessage('Fail');
}
})
}, error => {
console.log("Camera Error ", JSON.stringify(error));
})
this.tab = '1';
}
sendImage() {
this.loading.loaderForSendImage()
console.log("ll", JSON.stringify(this.imageBucket));
let records: any = {
'pd_id': this.pdDetails.pd_id,
'formid': this.formDetails.form_id,
'images': this.imageBucket,
'company_id': this.pdDetails.company_id,
}
console.log("records", JSON.stringify(records))
this.qustCat.savePDImages(records).subscribe(res => {
if (res['dataStatus'] == true) {
this.toast.pdTriggerappmessage("Image Saved Successfully")
this.imageBucket = []
this.getPDImages();
}
else {
this.toast.pdTriggerappmessage('Fail');
}
})
}
}

View File

@ -1,18 +0,0 @@
<!--
Generated template for the PdQuestionBusinessPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar color="optblue">
<ion-title>{{FormId.form_name}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
</ion-content>

View File

@ -1,3 +0,0 @@
page-pd-question-business {
}

View File

@ -1,43 +0,0 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category'
import { AwsServiceProvider } from '../../../providers/aws-service/aws-service'
/**
* Generated class for the PdQuestionBusinessPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@Component({
selector: 'page-pd-question-business',
templateUrl: 'pd-question-business.html',
})
export class PdQuestionBusinessPage {
pdDetails:any;
pdid:any;
users:any;
FormId:any;
existCompanyList:any=[]
constructor(public navCtrl: NavController, public navParams: NavParams,public qustcat:QuestionCategoryProvider,public aws:AwsServiceProvider) {
this.pdDetails=this.navParams.get('pdDetails');
this.pdid=this.pdDetails.pd_id;
this.FormId=this.navParams.get('FormId');
this.users=this.aws.getlocale
this.getDropDown();
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionBusinessPage');
}
getDropDown(){
this.qustcat.getCompaniesListsForBusiness(this.pdid).subscribe(res=>{
this.existCompanyList=res['records'].filter(data=>data.is_active == true && data.is_company_applicant == true);
console.log(this.existCompanyList);
})
}
}

View File

@ -128,8 +128,8 @@
<ion-row>
<ion-col end>
<div class="btn">
<button *ngIf="!buttonClick" float-right ion-button large color="optblue" icon-left clear (click)="addRec(1)">
<ion-icon name="person-add"></ion-icon>
<button *ngIf="!buttonClick" float-right ion-button large color="optblue" icon-left clear (click)="addRec(1)">Add Applicant
<!-- <ion-icon name="person-add"></ion-icon> -->
</button>
<button *ngIf="buttonClick" float-right ion-button large color="optblue" icon-left clear (click)="addRec(1)">Close
&nbsp;&nbsp;<ion-icon name="md-close"></ion-icon></button>
@ -235,7 +235,7 @@
<ion-row>
<ion-col end>
<button *ngIf="addIndi" float-right ion-button color="optblue" (click)="addParticular(1,indi)">Add</button>
<button *ngIf="addIndi" float-right ion-button color="optblue" (click)="addParticular(1,indi)">Save</button>
<button *ngIf="!addIndi" float-right ion-button color="optblue" (click)="update(1,indi)">Update</button>
</ion-col>
</ion-row>

View File

@ -64,6 +64,6 @@ export class PdtriggerProvider {
return this.http.post(this.apiurl+'getPDCompleteDetails',{'records':details})
}
pdFormsCompletenessCheck(pd_id){
return this.http.post(this.apiurl+'pdFormsCompletenessCheck',{'pd_id':pd_id})
return this.http.post(this.apiurl+'pdFormsCompletenessCheck',{'pd_id':pd_id,'client':'MOB'})
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.