issues fixes :ps

This commit is contained in:
venbatechnologies@gmail.com 2019-04-04 20:01:14 +05:30
parent 675538fa3e
commit 007cd49551
8 changed files with 58 additions and 34 deletions

View File

@ -15,7 +15,7 @@
<div>
<mat-card-header>
<mat-card-title>
<small class="expan_table_header">expandDetails.purchaseItem</small>
<small class="expan_table_header">{{expandDetails.purchaseItem == 'Others' ? expandDetails.purchaseItem + ' ( ' + expandDetails.otherPurchaseItem + ' )' : expandDetails.purchaseItem}}</small>
</mat-card-title>
<mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">
<div fxFlex="100" class="subtitle_message">

View File

@ -21,7 +21,8 @@
<div *ngSwitchCase="1">
<mat-card-header>
<mat-card-title>
<small class="expan_table_header">{{expandDetails.salesItem}}</small>
<!-- <small class="expan_table_header">{{expandDetails.salesItem}}</small> -->
<small class="expan_table_header">{{expandDetails.salesItem == 'Others' ? expandDetails.salesItem +' ( '+ expandDetails.otherSalesItem +' )' : expandDetails.salesItem}}</small>
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">&nbsp;( Gross Margin : {{expandDetails.margin_per}} % &nbsp;&nbsp;Gross Profit : {{expandDetails.margin_value}} )</small>
</mat-card-title>
<mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">
@ -62,7 +63,8 @@
<div *ngSwitchCase="2">
<mat-card-header>
<mat-card-title>
<small class="expan_table_header">{{expandDetails.salesItem}}</small>
<!-- <small class="expan_table_header">{{expandDetails.salesItem}}</small> -->
<small class="expan_table_header">{{expandDetails.salesItem == 'Others' ? expandDetails.salesItem +' ( '+ expandDetails.otherSalesItem +' )' : expandDetails.salesItem}}</small>
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">&nbsp;( Gross Margin : {{expandDetails.margin_per}} % &nbsp;&nbsp;Gross Profit : {{expandDetails.margin_value}} )</small>
</mat-card-title>
<!-- <mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">

View File

@ -16,7 +16,7 @@
<ng-container matColumnDef="raw_material" sticky>
<th mat-header-cell *matHeaderCellDef> Raw Material/Trading Item </th>
<td mat-cell *matCellDef="let element"> {{element.purchase_item}} </td>
<td mat-cell *matCellDef="let element"> {{element.purchase_item == 'Others' ? element.purchase_item +' ( '+ element.other_purchase_item + ' )' : element.purchase_item }} </td>
<td mat-footer-cell *matFooterCellDef> Total of Purchase</td>
</ng-container>

View File

@ -19,7 +19,7 @@
<ng-container matColumnDef="product_services" sticky>
<th mat-header-cell *matHeaderCellDef> Product/Services </th>
<td mat-cell *matCellDef="let element"> {{element.sales_item}} </td>
<td mat-cell *matCellDef="let element"> {{element.sales_item == 'Others' ? element.sales_item + ' ( ' + element.other_sales_item + ' )' : element.sales_item }} </td>
<td mat-footer-cell *matFooterCellDef> Total of Sales </td>
</ng-container>

View File

@ -38,7 +38,7 @@
</mat-form-field>
<mat-form-field style="width:64%">
<mat-select placeholder="Sub Product" formControlName="sub_product"
(selectionChange)="onChangeSubProduct($event.value)">
(selectionChange)="onChangeSubProduct($event)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let list of m_endUseofLoad" [value]="list.subproduct_id">
{{list.name }} ( {{list.abbr}} ) </mat-option>

View File

@ -74,6 +74,7 @@ export class LoanDetailsComponent implements OnInit {
mergeCompanyApplicant: any = [];
existCompanyList: any = [];
companies: any = [];
typeofproperties:any = [];
/** Constructor Of the Class */
constructor(notifier: NotifierService,
@ -108,7 +109,6 @@ export class LoanDetailsComponent implements OnInit {
/** init Fns */
ngOnInit() {
this.initloanDetailsForm();
this.getM_EndUseofLoad();
this.getM_EndUseForLoan(this.pdid, this.pd_all_details.pdmaster_details.fk_subproduct_id);
@ -319,9 +319,10 @@ export class LoanDetailsComponent implements OnInit {
data => {
if (data.dataStatus == true) {
let that = this;
this.typeofproperties = data.records;
this.m_mortageTypeProperty = data.records.filter(
function (data) {
if (that.productAbbr != "LAP") {
if (data.group_name == that.productAbbr && data.isactive == 1) {
@ -340,8 +341,6 @@ export class LoanDetailsComponent implements OnInit {
}
}
});
this.m_mortageTypeProperty
}
});
}
@ -422,14 +421,32 @@ export class LoanDetailsComponent implements OnInit {
else {
return false;
}
}
onChangeSubProduct(e) {
this._pd.getEndUseForLoan(this.pdid, e).subscribe(
data => {
let splitted = e.source.triggerValue.split(" ( ", 2);
this._pd.getEndUseForLoan(this.pdid, e.value).subscribe(data => {
this.m_endUseForLoan = data.records.filter(data => data.isactive == 1);
});
});
if(this.mortageCardAccess == true) {
let that = this;
this.m_mortageTypeProperty = this.typeofproperties.filter(
function (data) {
if (that.productAbbr != "LAP") {
if (data.group_name == that.productAbbr && data.isactive == 1) {
return data;
}
}
else if (that.productAbbr == "LAP") {
if (data.group_name == that.productAbbr && data.sub_group_name == splitted[0] && data.isactive == 1) {
return data;
}
else if (data.group_name == that.productAbbr && (data.sub_group_name == null || data.sub_group_name == '') && data.isactive == 1) {
return data;
}
}
});
}
}
/** Enduse Changes And its Validation */
@ -580,7 +597,7 @@ export class LoanDetailsComponent implements OnInit {
console.log('this.m_mortageTypeProperty',this.m_mortageTypeProperty);
let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0];
let property_name = mortagetypes.property_name.replace(/\s/g, "").toLowerCase();
if(property_name=='others(pleasespecify)')
if(property_name=='others')
{
this.mortageAccess = true;
this.loanDetailsForm.controls['property_type_others'].setValidators([Validators.required]);

View File

@ -587,8 +587,7 @@
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['payment_mode_per_met']">
<mat-label>Mode of Payment of Rent as Validated by PD Officer with Tenant / Lessee During Visit</mat-label>
<mat-select placeholder=""
formControlName="payment_mode_per_met" [compareWith]="compareSingleObjects" (selectionChange)="generatePaymentOptions(units.value,u,2)" required>
<mat-select placeholder="" formControlName="payment_mode_per_met" [compareWith]="compareSingleObjects" (selectionChange)="generatePaymentOptions(units.value,u,2)" required>
<mat-option *ngFor="let payment of paymentPaidOptions" [value]="payment">
{{payment.name}}
</mat-option>
@ -616,7 +615,7 @@
</mat-form-field>
<!-- start validate appplicant/agreement payment options -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="(units.value.monthly_rent_amount>0 && units.value.paid_monthly_rent_per_met>0 && units.value.payment_mode!='' && units.value.payment_mode_per_met!='') && (units.value.monthly_rent_amount!=units.value.paid_monthly_rent_per_met) && units.value.payment_mode_per_met.id != 2 "><!-- || units.value.payment_mode.id!=units.value.payment_mode_per_met.id -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="(units.value.monthly_rent_amount>0 && units.value.paid_monthly_rent_per_met>0 && units.value.payment_mode!='' && units.value.payment_mode_per_met!='') && (units.value.monthly_rent_amount!=units.value.paid_monthly_rent_per_met) || units.value.payment_mode_per_met.id != 2 "><!-- || units.value.payment_mode.id!=units.value.payment_mode_per_met.id -->
<mat-label>What is the Reason for Difference in Rent Amount</mat-label><!-- or Mode of Payment -->
<input matInput autocomplete="off" placeholder="" formControlName="payment_difference_per_met">
</mat-form-field>

View File

@ -367,7 +367,7 @@ loadFormData(){
element.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_cash_per_met');
element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_bank_per_met');
element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met');
element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met');
(element.met_tenant_lessees_options=="1") ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met');
if(element.payment_mode_per_met){
@ -467,7 +467,7 @@ addMoreUnitDetails(){
control.controls[index].addControl('amount_received_cash_per_met', new FormControl(value.amount_received_cash_per_met ? value.amount_received_cash_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)]));
control.controls[index].removeControl('amount_received_bank_per_met');
control.controls[index].removeControl('payment_received_reason_per_met');
}
}
else if(value && value.payment_mode_per_met.id==2){
control.controls[index].addControl('amount_received_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)]));
control.controls[index].removeControl('amount_received_cash_per_met');
@ -483,24 +483,31 @@ addMoreUnitDetails(){
control.controls[index].removeControl('amount_received_bank_per_met');
control.controls[index].removeControl('payment_received_reason_per_met');
}
control.controls[index].payment_difference_per_met.setValue('');
control.controls[index].payment_difference_per_met.updateValueAndValidity();
if(control.controls[index].payment_difference_per_met){
console.log('control.controls[index].payment_difference_per_met);',control.controls[index].payment_difference_per_met);
control.controls[index].payment_difference_per_met.setValue('');
control.controls[index].payment_difference_per_met.updateValueAndValidity();
}
else{
console.log('There is NO Control');
}
}
}
ValidatedRentAmount(value:any,index:number,type: number){
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
console.log('value',value);
if(type==1){
let monthlyrentamt : any = value.monthly_rent_amount ;
if(value && value.payment_mode.id==3){
let ChildCtrl : any = control.controls[index];
ChildCtrl.controls['amount_received_bank'].clearValidators();
ChildCtrl.controls['amount_received_bank'].updateValueAndValidity();
ChildCtrl.controls['amount_received_cash'].clearValidators();;
ChildCtrl.controls['amount_received_cash'].updateValueAndValidity();
let monthlyrentamt : any = value.monthly_rent_amount ;
if(monthlyrentamt != ''){
@ -508,9 +515,9 @@ addMoreUnitDetails(){
ChildCtrl.controls['amount_received_bank'].setValidators([Validators.required,Validators.max(monthlyrentamt),Validators.min(0)]);
ChildCtrl.controls['amount_received_bank'].updateValueAndValidity();
let maxamt = monthlyrentamt-bank_amount
if(maxamt >= 0 ){
ChildCtrl.controls['amount_received_cash'].setValue(maxamt);
let remainingAmt = monthlyrentamt-bank_amount
if(remainingAmt >= 0 ){
ChildCtrl.controls['amount_received_cash'].setValue(remainingAmt);
ChildCtrl.controls['amount_received_cash'].setValidators([Validators.required,Validators.max(monthlyrentamt-bank_amount),Validators.min(monthlyrentamt-bank_amount)]);
}
else{
@ -523,8 +530,9 @@ addMoreUnitDetails(){
}
}
if(type==2 && value.payment_mode_per_met != ''){
console.log('type,value.payment_mode_per_met',type,value.payment_mode_per_met);
if(value && value.payment_mode.id==3){
if(value && value.payment_mode_per_met.id==3){
let ChildCtrl : any = control.controls[index];
ChildCtrl.controls['amount_received_bank_per_met'].clearValidators();
ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity();
@ -532,10 +540,9 @@ addMoreUnitDetails(){
ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity();
let paidmonthlyrentamt : any = value.paid_monthly_rent_per_met;
if(paidmonthlyrentamt != ''){
let bank_amount = value.amount_received_bank;
let bank_amount = value.amount_received_bank_per_met;
ChildCtrl.controls['amount_received_bank_per_met'].setValidators([Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(0)]);
ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity();
let remainingAmt = paidmonthlyrentamt-bank_amount
@ -964,7 +971,6 @@ saveRental(formData: any) {
if(formData.property_unit_details.length > 0){
formData.property_unit_details.forEach((data,index) => {
TempArray1[index] = data.monthly_rent_amount;
ApplicantRentAmt = TempArray1.reduce((sum, val) => sum + +val, 0);
@ -978,7 +984,7 @@ saveRental(formData: any) {
let Array : any = [];
if(formData.multistoried_building_details.length > 0){
formData.multistoried_building_details.forEach((val,index) => {
// console.log('val.floor_rent_amount',val.floor_rent_amount,index);
Array[index] = val.floor_rent_amount;
FloorsTotalRentAmt = Array.reduce((sum, val) => sum + +val, 0);
});