Asset Details : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-12-15 18:21:56 +05:30
parent 972c7b4b7b
commit 47aba2af71
2 changed files with 579 additions and 117 deletions

View File

@ -14,7 +14,7 @@
<mat-tab-group> <mat-tab-group>
<mat-tab label="Questions"> <mat-tab label="Other Asset Questions">
<ng-template matTabContent> <ng-template matTabContent>
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="100"> <div fxFlex="100">
@ -29,7 +29,7 @@
<div [formGroupName]="i"> <div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event, i)" placeholder="Assets Type" formControlName="assets_mode" requried> <mat-select (selectionChange)="selectedAssetsType($event, i,1)" placeholder="Assets Type" formControlName="assets_mode" requried>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option> <mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -50,7 +50,7 @@
</div> </div>
<div> <div>
<mat-form-field *ngIf="detail.get('property_type').value == 5"> <mat-form-field *ngIf="detail.get('property_type').value == 5">
<input matInput placeholder="Other Property Type" formControlName="other_property_type"> <input matInput placeholder="Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -64,7 +64,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" required> <input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -78,7 +78,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" required> <input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -92,7 +92,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description" formControlName="jwell_description"> <input matInput placeholder="Description" formControlName="jwell_description" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -128,7 +128,7 @@
</div>--> </div>-->
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Premium Paid" formControlName="premium_paid" required (keypress)="keyPress($event)"> <input matInput placeholder="Premium Paid" formControlName="premium_paid" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
@ -140,14 +140,14 @@
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Sum Assured" formControlName="sum_assured" required (keypress)="keyPress($event)"> <input matInput placeholder="Sum Assured" formControlName="sum_assured" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Members Covered" formControlName="members_coverd" required> <input matInput placeholder="Members Covered" formControlName="members_coverd" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -170,17 +170,17 @@
</div> </div>
<!-- <div fxFlex="33" *ngIf="detail.get('investments_type').value == 6 "> --> <!-- <div fxFlex="33" *ngIf="detail.get('investments_type').value == 6 "> -->
<mat-form-field> <mat-form-field>
<input matInput placeholder="Specify Other Type" formControlName="other_investments_type"> <input matInput placeholder="Specify Other Type" formControlName="other_investments_type" autocomplete="off">
</mat-form-field> </mat-form-field>
<!-- </div> --> <!-- </div> -->
<div fxFlex="33" > <div fxFlex="33" >
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" required (keypress)="keyPress($event)"> <input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Bank Name" formControlName="bank_name" required> <input matInput placeholder="Bank Name" formControlName="bank_name" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -195,10 +195,10 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets" required> <input matInput placeholder="Description of the Assets" formControlName="any_other_assets" required autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" required> <input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" required autocomplete="off">
</mat-form-field> </mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width"> --> <!-- <mat-form-field class="ml-xs example-full-width"> -->
<!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" required> --> <!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" required> -->
@ -209,10 +209,12 @@
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
<mat-option value="nan">NAN</mat-option> <mat-option value="nan">NAN</mat-option>
</mat-select> </mat-select>
<!-- <input matInput placeholder="What is the EMI amount ?" formControlName="any_other_asset_loan" autocomplete="off"> -->
</mat-form-field> </mat-form-field>
<mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> <!-- <mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> -->
<input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt"> <mat-form-field class="ml-xs example-full-width">
<span matSuffix>.00</span> <input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt" autocomplete="off">
<!-- <span matSuffix>.00</span> -->
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -225,7 +227,7 @@
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4"> <div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value" (keypress)="keyPress($event)"> <input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -233,7 +235,7 @@
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Name of the Owner" formControlName="name_of_the_owner"> <input matInput placeholder="Name of the Owner" formControlName="name_of_the_owner" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -261,24 +263,30 @@
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%"> <mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Amount of EMI on This Loan?" formControlName="emi_paid" (keypress)="keyPress($event)"> <input matInput placeholder="Amount of EMI on This Loan?" formControlName="emi_paid" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%"> <mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="elapsed_tenure"> <input matInput placeholder="Original Loan Tenure in Months" formControlName="original_loan_tenure" (change)="loanCalc(sup)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33" style="width:95%"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width"> <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" (change)="loanCalc(sup)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes' && sup.get('original_loan_tenure').value != '' && sup.get('balance_tenure').value != '' " fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure" autocomplete="off">
</mat-form-field>
<!-- <p>Elapsed tenure is {{elapsed_tenure}}</p> -->
</div>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="20"> <div fxFlex="20">
<span *ngIf="_assetsQuesFrom.controls.assets_details.controls.length > 1" (click)="removeLanguage(i)"> <span *ngIf="_assetsQuesFrom.controls.assets_details.controls.length > 1" (click)="removeLanguage(i,1)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span> </span>
</div> </div>
@ -292,10 +300,7 @@
<div class="row" style="text-align:right;"> <div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Asset Details" matTooltipPosition="above" <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> class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event,1); false"><mat-icon>add</mat-icon></button>
</div> </div>
</mat-card-content> </mat-card-content>
@ -306,8 +311,278 @@
</div> </div>
</div> </div>
</ng-template> </ng-template>
</mat-tab> </mat-tab>
<mat-tab label="Docs"> <mat-tab label="Bussiness Asset Questions">
<ng-template matTabContent>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card style="min-height: 550px;">
<mat-card-content>
<div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="business_assets_details" fxFill>
<div *ngFor="let sup of _assetsQuesFrom.controls.business_assets_details['controls']; let i=index">
<mat-card>
<mat-card-content>
<div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event, i,2)" placeholder="Assets Type" formControlName="business_assets_mode" requried>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<!--Desction Dynamic details: START-->
<div formArrayName="business_details" class="example-full-width">
<!--Property-->
<div *ngIf="sup.get('business_assets_mode').value == 1 ">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
<mat-select placeholder="Property Type" formControlName="property_type" required>
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div>
<mat-form-field *ngIf="detail.get('property_type').value == 5">
<input matInput placeholder="Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Four Wheeler-->
<div *ngIf="sup.get('business_assets_mode').value == 2">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Two Wheeler-->
<div *ngIf="sup.get('business_assets_mode').value == 3">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Consumer Durable-->
<div *ngIf="sup.get('business_assets_mode').value == 5">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description" formControlName="consumer_durable_description" required>
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Insurance-->
<div *ngIf="sup.get('business_assets_mode').value == 6">
<div fxFill>
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Premium Paid" formControlName="premium_paid" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field>
<mat-select placeholder="Frequency" formControlName="frequency_mode" required>
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Sum Assured" formControlName="sum_assured" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Members Covered" formControlName="members_coverd" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Investments-->
<div *ngIf="sup.get('business_assets_mode').value == 7">
<div>
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field>
<mat-select placeholder="Type" formControlName="investments_type" required>
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<!-- <div fxFlex="33" *ngIf="detail.get('investments_type').value == 6 "> -->
<mat-form-field>
<input matInput placeholder="Specify Other Type" formControlName="other_investments_type" autocomplete="off">
</mat-form-field>
<!-- </div> -->
<div fxFlex="33" >
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Bank Name" formControlName="bank_name" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--other assets-->
<!-- <div *ngIf="sup.get('assets_mode').value == 8"> -->
<div *ngIf="sup.get('business_assets_mode').value == 8">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets" required autocomplete="off">
</mat-form-field>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" required autocomplete="off">
</mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width"> -->
<!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" required> -->
<!-- </mat-form-field> -->
<mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="nan">NAN</mat-option>
</mat-select>
</mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> -->
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt" autocomplete="off">
<!-- <span matSuffix>.00</span> -->
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Desction Dynamic details : END -->
<!-- {{sup.get('business_assets_mode').value}} -->
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 4">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Approximate Market Value" formControlName="business_approximate_market_value" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Name of the Owner" formControlName="business_name_of_the_owner" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
<div *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<mat-select placeholder="Is there a loan existing against this asset?" formControlName="business_emi">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Amount of EMI on This Loan?" formControlName="business_emi_paid" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="business_original_loan_tenure" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Balance Tenure in Months" formControlName="business_balance_tenure" autocomplete="off">
</mat-form-field>
</div>
<!-- <div *ngIf="sup.get('emi').value === 'yes' && sup.get('original_loan_tenure').value != '' && sup.get('balance_tenure').value != '' " fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure" autocomplete="off">
</mat-form-field> -->
<!-- <p>Elapsed tenure is {{elapsed_tenure}}</p> -->
<!-- </div> -->
</div>
</div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="20">
<span *ngIf="_assetsQuesFrom.controls.business_assets_details.controls.length > 1" (click)="removeLanguage(i,2)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</div>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Business Asset Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event,2); false"><mat-icon>add</mat-icon></button>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</ng-template>
</mat-tab>
<mat-tab label="Docs">
<ng-template matTabContent> <ng-template matTabContent>
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="25" class="m-gap p-gap"> <div fxFlex="25" class="m-gap p-gap">
@ -416,7 +691,7 @@
</div> </div>
</ng-template> </ng-template>
</mat-tab> </mat-tab>
</mat-tab-group> </mat-tab-group>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
@ -424,7 +699,7 @@
<div fxFlex="60" class="pb-0 text-sm-left" align="left"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="assets_form_remark"></textarea> <textarea matInput placeholder="Remarks" formControlName="assets_form_remark" autocomplete="off"></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">

View File

@ -35,6 +35,7 @@ export class AssetsInfoComponent implements OnInit {
public _assetsQuesFrom: FormGroup; public _assetsQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public m_assets_type = []; public m_assets_type = [];
// public m_assets_type = [ // public m_assets_type = [
// { // {
// 'id': "1", // 'id': "1",
@ -274,9 +275,11 @@ public m_investmentType = [];
assets_details: this._formBuilder.array([ assets_details: this._formBuilder.array([
// this.initDetails(), // this.initDetails(),
]), ]),
business_assets_details : this._formBuilder.array([]),
assets_form_remark:[value.assets_form_remark || 'check'] assets_form_remark:[value.assets_form_remark || 'check']
}); });
this.addAssetsDetailsWithData(value.assets_details); this.addAssetsDetailsWithData(value.assets_details);
this.addAssetsDetailsWithData2(value.business_assets_details);
} else { } else {
this._assetsQuesFrom = this._formBuilder.group({ this._assetsQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
@ -284,6 +287,9 @@ public m_investmentType = [];
assets_details: this._formBuilder.array([ assets_details: this._formBuilder.array([
this.initDetails(), this.initDetails(),
]), ]),
business_assets_details : this._formBuilder.array([
this.initnewDetails(),
]),
assets_form_remark:[''] assets_form_remark:['']
}); });
} }
@ -308,56 +314,90 @@ public m_investmentType = [];
//purchase_month: ['', Validators.compose([])], //purchase_month: ['', Validators.compose([])],
emi: [''], emi: [''],
emi_paid: [''], emi_paid: [''],
original_loan_tenure: [''],
balance_tenure: [''],
elapsed_tenure: [''], elapsed_tenure: [''],
balance_tenure: ['']
}); });
} }
initnewDetails() {
return this._formBuilder.group({
business_assets_mode: ['', Validators.compose([Validators.required])],
business_details: this._formBuilder.array([]),
business_approximate_market_value: ['', Validators.compose([])],
business_name_of_the_owner: ['', Validators.compose([])],
// purchase_year: ['', Validators.compose([])],
//purchase_month: ['', Validators.compose([])],
business_emi: [''],
business_emi_paid: [''],
business_original_loan_tenure: [''],
business_balance_tenure: [''],
business_elapsed_tenure: [''],
});
}
show: boolean; show: boolean;
selectedAssetsType(e: any, i: any): void { selectedAssetsType(e: any, i: any,flag : any): void {
console.log(e);
console.log(i);
console.log(flag);
let val = i; let val = i;
if(flag == 1){
const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
arr.controls.splice(0); arr.controls.splice(0);
}
else if(flag == 2){
const arr = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray;
arr.controls.splice(0);
}
switch (e.value) { switch (e.value) {
case '1': { case '1': {
let val = i; let val = i;
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadProperty()); control.push(this.loadProperty());
break; break;
} }
case '2': { case '2': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_Weeler()); control.push(this.load_Four_Weeler());
break; break;
} }
case '3': { case '3': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_Weeler()); control.push(this.load_Two_Weeler());
break; break;
} }
case '4': { case '4': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
//control.push(this.loadJwellDescription()); //control.push(this.loadJwellDescription());
break; break;
} }
case '5': { case '5': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadConsumerDurableDescription()); control.push(this.loadConsumerDurableDescription());
break; break;
} }
case '6': { case '6': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInsuranceDescription()); control.push(this.loadInsuranceDescription());
break; break;
} }
case '7': { case '7': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInvestDescription()); control.push(this.loadInvestDescription());
break; break;
} }
case '8': { case '8': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('details') as FormArray ;
control.push(this.otherAssetsDescription()); control.push(this.otherAssetsDescription());
break; break;
} }
@ -410,7 +450,7 @@ public m_investmentType = [];
loadInvestDescription() { loadInvestDescription() {
return this._formBuilder.group({ return this._formBuilder.group({
investments_type: ['', Validators.compose([Validators.required])], investments_type: ['', Validators.compose([Validators.required])],
other_investment_type:[''], other_investments_type:[''],
amount_of_invest: ['', Validators.compose([Validators.required])], amount_of_invest: ['', Validators.compose([Validators.required])],
bank_name: ['', Validators.compose([Validators.required])] bank_name: ['', Validators.compose([Validators.required])]
}); });
@ -433,6 +473,14 @@ public m_investmentType = [];
loadPropertyWithData(data) { loadPropertyWithData(data) {
return this._formBuilder.group({ return this._formBuilder.group({
property_type: [data.property_type, Validators.compose([Validators.required])] property_type: [data.property_type, Validators.compose([Validators.required])]
//property_type:['']
});
}
loadPropertyWithData2(data) {
return this._formBuilder.group({
property_type: [data.property_type, Validators.compose([Validators.required])]
//property_type:['']
}); });
} }
@ -500,12 +548,29 @@ public m_investmentType = [];
// purchase_month: [data.purchase_month, Validators.compose([])], // purchase_month: [data.purchase_month, Validators.compose([])],
emi: [data.emi || 0], emi: [data.emi || 0],
emi_paid: [data.emi_paid || ''], emi_paid: [data.emi_paid || ''],
elapsed_tenure: [data.elapsed_tenure || ''], original_loan_tenure: [data.original_loan_tenure || ''],
balance_tenure: [data.balance_tenure || ''] balance_tenure: [data.balance_tenure || ''],
elapsed_tenure: [data.elapsed_tenure || '']
});
}
initnewDetailsWithdata(data) {
return this._formBuilder.group({
business_assets_mode: [data.business_assets_mode, Validators.compose([Validators.required])],
business_details: this._formBuilder.array([]),
business_approximate_market_value: [data.business_approximate_market_value, Validators.compose([])],
business_name_of_the_owner: [data.business_name_of_the_owner, Validators.compose([])],
// purchase_year: [data.purchase_year, Validators.compose([])],
// purchase_month: [data.purchase_month, Validators.compose([])],
business_emi: [data.business_emi || 0],
business_emi_paid: [data.business_emi_paid || ''],
business_original_loan_tenure: [data.business_original_loan_tenure || ''],
business_balance_tenure: [data.business_balance_tenure || ''],
business_elapsed_tenure: [data.business_elapsed_tenure || '']
}); });
} }
loadDetails: boolean; loadDetails: boolean;
addAssetsDetailsWithData(supp_data) { addAssetsDetailsWithData(supp_data) {
console.log(supp_data);
var result = Object.keys(supp_data).map(function (key) { var result = Object.keys(supp_data).map(function (key) {
return supp_data[key]; return supp_data[key];
}); });
@ -519,6 +584,7 @@ public m_investmentType = [];
// purchase_month: val.purchase_month, // purchase_month: val.purchase_month,
emi: val.emi, emi: val.emi,
emi_paid: val.emi_paid, emi_paid: val.emi_paid,
original_loan_tenure: val.original_loan_tenure,
elapsed_tenure: val.elapsed_tenure, elapsed_tenure: val.elapsed_tenure,
balance_tenure: val.balance_tenure balance_tenure: val.balance_tenure
}; };
@ -530,6 +596,39 @@ public m_investmentType = [];
this.loadDetails = true; this.loadDetails = true;
} }
addAssetsDetailsWithData2(supp_data) {
console.log(supp_data);
var result = Object.keys(supp_data).map(function (key) {
return supp_data[key];
});
if (result.length > 0) {
for (let val of result) {
let vals = {
business_assets_mode: val.business_assets_mode,
business_approximate_market_value: val.business_approximate_market_value,
business_name_of_the_owner: val.business_name_of_the_owner,
// purchase_year: val.purchase_year,
// purchase_month: val.purchase_month,
business_emi: val.business_emi,
business_emi_paid: val.business_emi_paid,
business_original_loan_tenure: val.business_original_loan_tenure,
business_elapsed_tenure: val.business_elapsed_tenure,
business_balance_tenure: val.business_balance_tenure
};
// const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
// control.push(this.initDetailsWithdata(vals));
// this.setAssetsDetailsWithData(vals.business_assets_mode, val.details, control.length - 1)
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.push(this.initnewDetailsWithdata(vals));
this.setAssetsDetailsWithData2(vals.business_assets_mode, val.business_details, control.length - 1)
}
}
//this.loadDetails = true;
}
setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void { setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
let val = i; let val = i;
// var data = Object.keys(datas).map(function (key) { // var data = Object.keys(datas).map(function (key) {
@ -539,6 +638,7 @@ public m_investmentType = [];
let data = datas; let data = datas;
const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
arr.controls.splice(0); arr.controls.splice(0);
switch (assets_details_mode) { switch (assets_details_mode) {
case '1': { case '1': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
@ -586,13 +686,76 @@ public m_investmentType = [];
} }
} }
addSupplierDetails(e) { setAssetsDetailsWithData2(assets_details_mode: any, datas: any, i: any): void {
let val = i;
let data = datas;
const arr = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
arr.controls.splice(0);
switch (assets_details_mode) {
case '1': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadPropertyWithData2(data));
break;
}
case '2': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_WeelerWithData(data));
break;
}
case '3': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_WeelerWithData(data));
break;
}
case '4': {
break;
}
case '5': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadConsumerDurableDescriptionWithData(data));
break;
}
case '6': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInsuranceDescriptionWithData(data));
break;
}
case '7': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInvestDescriptionWithData(data));
break;
}
case '8': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.otherAssetsDescriptionWithData(data));
break;
}
default: {
break;
}
}
}
addSupplierDetails(e,flag) {
console.log(flag);
console.log(e);
if(flag == 1){
const control = <FormArray>this._assetsQuesFrom.controls['assets_details']; const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.push(this.initDetails()); control.push(this.initDetails());
}else if(flag == 2){
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.push(this.initnewDetails());
} }
removeLanguage(i: number) { }
removeLanguage(i: number,flag) {
if(flag == 1){
const control = <FormArray>this._assetsQuesFrom.controls['assets_details']; const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.removeAt(i); control.removeAt(i);
}else if(flag == 2){
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.removeAt(i);
}
} }
public paymentModeTextBox: number; public paymentModeTextBox: number;
@ -621,8 +784,19 @@ public m_investmentType = [];
answerFormValues.assets_details.map(val => { answerFormValues.assets_details.map(val => {
if (val.emi == '0') { if (val.emi == '0') {
val.emi_paid = ''; val.emi_paid = '';
val.elapsed_tenure = ''; val.original_loan_tenure = '';
val.balance_tenure = ''; val.balance_tenure = '';
val.elapsed_tenure = '';
}
});
//To Remove The "Null" With Key also
answerFormValues.business_assets_details.map(val => {
if (val.business_emi == '0') {
val.business_emi_paid = '';
val.business_original_loan_tenure = '';
val.business_balance_tenure = '';
val.business_elapsed_tenure = '';
} }
}); });
@ -664,6 +838,19 @@ public m_investmentType = [];
event.preventDefault(); event.preventDefault();
} }
} }
loanCalc(details)
{
//console.log(details.value);
let ElapsedValues;
if(details.value.original_loan_tenure != null && details.value.original_loan_tenure != '' && details.value.balance_tenure != null && details.value.balance_tenure != ''){
ElapsedValues = details.value.original_loan_tenure - details.value.balance_tenure ;
details.controls['elapsed_tenure'].setValue(ElapsedValues);
}
}
// { // {
// 'main_raw_materials': 'sdkjfal', // 'main_raw_materials': 'sdkjfal',
// 'supplier_details' ; [ // 'supplier_details' ; [