merge : kms

This commit is contained in:
gandhimathi 2018-11-16 16:39:40 +05:30
parent 6b693aadec
commit ee8a7d7cf0
8 changed files with 68 additions and 47 deletions

View File

@ -193,13 +193,34 @@
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<!--<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Year and Month of Purchase" formControlName="year_of_purchase">
</mat-form-field>
</div>
<div>
<label>Year and Month of Purchase?</label>
<br>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput type="number" placeholder="Year" formControlName="purchase_year">
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Month" formControlName="purchase_month">
</mat-form-field>
</div>
</div>
</div>
</div>-->
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<label>Year and Month of Purchase?</label>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput type="number" placeholder="Year" formControlName="purchase_year">
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Month" formControlName="purchase_month">
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5">
@ -221,12 +242,12 @@
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Elapsed Tenure in months" formControlName="elapsed_tenure">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Balance Tenure in months" formControlName="balance_tenure">
<input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure">
</mat-form-field>
</div>
</div>
@ -260,7 +281,7 @@
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Asset Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event); false"><mat-icon>add</mat-icon></button>
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" (click)="onReset(); false"><mat-icon>settings_backup_restore</mat-icon></button>-->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" (click)="onReset(); false"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</form>

View File

@ -299,7 +299,8 @@ public m_investmentType = [];
details: this._formBuilder.array([]),
approximate_market_value: ['', Validators.compose([Validators.required])],
name_of_the_owner: ['', Validators.compose([Validators.required])],
year_of_purchase: ['', Validators.compose([Validators.required])],
purchase_year: ['', Validators.compose([Validators.required])],
purchase_month: ['', Validators.compose([Validators.required])],
emi: [''],
emi_paid: [''],
elapsed_tenure: [''],
@ -467,7 +468,8 @@ public m_investmentType = [];
details: this._formBuilder.array([]),
approximate_market_value: [data.approximate_market_value, Validators.compose([Validators.required])],
name_of_the_owner: [data.name_of_the_owner, Validators.compose([Validators.required])],
year_of_purchase: [data.year_of_purchase, Validators.compose([Validators.required])],
purchase_year: [data.purchase_year, Validators.compose([Validators.required])],
purchase_month: [data.purchase_month, Validators.compose([Validators.required])],
emi: [data.emi || 0],
emi_paid: [data.emi_paid || ''],
elapsed_tenure: [data.elapsed_tenure || ''],
@ -485,7 +487,8 @@ public m_investmentType = [];
assets_mode: val.assets_mode,
approximate_market_value: val.approximate_market_value,
name_of_the_owner: val.name_of_the_owner,
year_of_purchase: val.year_of_purchase,
purchase_year: val.purchase_year,
purchase_month: val.purchase_month,
emi: val.emi,
emi_paid: val.emi_paid,
elapsed_tenure: val.elapsed_tenure,

View File

@ -282,7 +282,7 @@
<div formArrayName="documents" *ngIf="businessForm.controls['other_documents'].value == 'yes'">
<div *ngFor="let members of businessForm.controls.documents['controls']; let i=index"
[formGroupName]="i">
<mat-form-field style="width:100%">
<mat-form-field style="width:86%">
<input matInput placeholder="Specify Document Details"
formControlName="document">
</mat-form-field>

View File

@ -8,7 +8,7 @@
width: 100%;
}
.matcard > * {
width: 45%;
width: 98%;
}
.card mat-form-field {
margin: 0 2%;

View File

@ -1,14 +1,14 @@
<!--<pre> {{ m_group | json}}</pre>-->
<mat-card style="padding: 12px;">
<form *ngIf="apiLoadFinish" [formGroup]="_supplierQuesFrom" (submit)="onSubmit()" novalidate>
<form *ngIf="apiLoadFinish" [formGroup]="_clientQuesFrom" (submit)="onSubmit()" novalidate>
<div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="supplier_details" fxFill>
<div *ngFor="let sup of _supplierQuesFrom.controls.supplier_details['controls']; let i=index">
<div formArrayName="client_details" fxFill>
<div *ngFor="let sup of _clientQuesFrom.controls.client_details['controls']; let i=index">
<div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Supplier Name" formControlName="supplier_name">
<input matInput placeholder="Client Name" formControlName="client_name">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
@ -62,7 +62,7 @@
</div>
<div fxFlex="20">
<span *ngIf="_supplierQuesFrom.controls.supplier_details.controls.length > 1" (click)="removeLanguage(i)">
<span *ngIf="_clientQuesFrom.controls.client_details.controls.length > 1" (click)="removeLanguage(i)">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>

View File

@ -31,7 +31,7 @@ export class ClientInfoComponent implements OnInit {
@Input() pdid: number;
public _supplierQuesFrom: FormGroup;
public _clientQuesFrom: FormGroup;
public submitted = false;
public m_paymentModeType= [
{
@ -88,12 +88,11 @@ export class ClientInfoComponent implements OnInit {
private pdTrigerService: PdTrigerService) { }
ngOnInit() {
this.getPdSupplierFormDetails();
this.getClientFormDetails();
}
apiLoadFinish: boolean = false;
getPdSupplierFormDetails() {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe(
getClientFormDetails() {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '2').subscribe(
data => {
if (data) {
if(data.dataStatus){
@ -112,21 +111,19 @@ apiLoadFinish: boolean = false;
formLoadData(val) {
if(val !== null) {
let value = val;
this._supplierQuesFrom = this._formBuilder.group({
this._clientQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
main_raw_materials: [value.main_raw_materials, Validators.compose([Validators.required])],
supplier_details: this._formBuilder.array([
formid: ['2'],
client_details: this._formBuilder.array([
// this.initDetails(),
])
});
this.addSupplierDetailsWithData(value.supplier_details);
this.addClientDetailsWithData(value.client_details);
} else {
this._supplierQuesFrom = this._formBuilder.group({
this._clientQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
main_raw_materials: [null, Validators.compose([Validators.required])],
supplier_details: this._formBuilder.array([
formid: ['2'],
client_details: this._formBuilder.array([
this.initDetails(),
])
});
@ -134,12 +131,12 @@ apiLoadFinish: boolean = false;
}
// convenience getter for easy access to form fields
get f() { return this._supplierQuesFrom.controls; }
get f() { return this._clientQuesFrom.controls; }
// Dynamic Form field creation Functionality : START ===>
initDetails() {
return this._formBuilder.group({
supplier_name: ['', Validators.compose([Validators.required])],
client_name: ['', Validators.compose([Validators.required])],
contact_person: ['', Validators.compose([Validators.required])],
mobile_number: ['', Validators.compose([Validators.required])],
payment_mode: ['', Validators.compose([Validators.required])],
@ -152,7 +149,7 @@ apiLoadFinish: boolean = false;
initDetailsWithdata(data) {
return this._formBuilder.group({
supplier_name: [data.supplier_name, Validators.compose([Validators.required])],
client_name: [data.client_name, Validators.compose([Validators.required])],
contact_person: [data.contact_person, Validators.compose([Validators.required])],
mobile_number: [data.mobile_number, Validators.compose([Validators.required])],
payment_mode: [data.payment_mode, Validators.compose([Validators.required])],
@ -163,7 +160,7 @@ apiLoadFinish: boolean = false;
});
}
addSupplierDetailsWithData(supp_data) {
addClientDetailsWithData(supp_data) {
var result = Object.keys(supp_data).map(function(key) {
return supp_data[key];
@ -171,7 +168,7 @@ var result = Object.keys(supp_data).map(function(key) {
if (result.length > 0) {
for (let val of result) {
let vals = {
supplier_name: val.supplier_name,
client_name: val.client_name,
contact_person: val.contact_person,
mobile_number: val.mobile_number,
payment_mode: val.payment_mode,
@ -180,18 +177,18 @@ var result = Object.keys(supp_data).map(function(key) {
frequency_of_purchase: val.frequency_of_purchase,
freq_purchase_others_text_value: val.freq_purchase_others_text_value
};
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.push(this.initDetailsWithdata(vals));
}
}
}
addSupplierDetails(e) {
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.push(this.initDetails());
}
removeLanguage(i: number) {
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.removeAt(i);
}
@ -209,14 +206,14 @@ var result = Object.keys(supp_data).map(function(key) {
onSubmit() {
this.submitted = true;
// stop here if form is invalid
if (this._supplierQuesFrom.invalid) {
if (this._clientQuesFrom.invalid) {
return;
} else {
var answerFormValues = this._supplierQuesFrom.value;
var answerFormValues = this._clientQuesFrom.value;
// To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
alert(JSON.stringify(answerFormValues));
// Add BRANCH data with help Service File
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => {

View File

@ -30,10 +30,10 @@
<input matInput placeholder="Lender" formControlName="lender">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Original Tenure" formControlName="original_tenure">
<input matInput placeholder="Original Tenure in Months" formControlName="original_tenure">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Current Balance Tenure" formControlName="current_balance_tenure">
<input matInput placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Loan Details" matTooltipPosition="above" color="primary" (click)="addLoanDetails()"
*ngIf="i==0">

View File

@ -80,8 +80,8 @@
<mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button" matTooltip="Add More Income Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button color="" (click)="addIncomeDetails()"
*ngIf="i==0">
<button type="button" matTooltip="Add More Income Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="addIncomeDetails()"
color="primary" *ngIf="i==0">
<mat-icon>add</mat-icon>
</button>
<button type="button" matTooltip="Delete" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="deleteIncomeDetails(i)"