|
@@ -29,6 +29,7 @@ export class UnitBuildingInformationAddComponent implements OnInit {
|
|
check : boolean = false;
|
|
check : boolean = false;
|
|
isEdit: boolean = false;
|
|
isEdit: boolean = false;
|
|
editPageId: number;
|
|
editPageId: number;
|
|
|
|
+ disable: boolean = false;
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
private dashBoardSer: DashboardService,
|
|
private dashBoardSer: DashboardService,
|
|
@@ -112,6 +113,9 @@ export class UnitBuildingInformationAddComponent implements OnInit {
|
|
getBuildingsType(event){
|
|
getBuildingsType(event){
|
|
console.log('sdsdsd',event);
|
|
console.log('sdsdsd',event);
|
|
const id = event;
|
|
const id = event;
|
|
|
|
+ this.isComplex = false;
|
|
|
|
+ this.isBuildingType = false;
|
|
|
|
+ this.show_amount = false;
|
|
|
|
|
|
console.log(id);
|
|
console.log(id);
|
|
|
|
|
|
@@ -125,6 +129,9 @@ export class UnitBuildingInformationAddComponent implements OnInit {
|
|
this.isComplex = false;
|
|
this.isComplex = false;
|
|
this.isBuildingType = false;
|
|
this.isBuildingType = false;
|
|
}
|
|
}
|
|
|
|
+ if(this.editPageId){
|
|
|
|
+ this.getBuilding(this.formData.building_type_id);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
err => {
|
|
err => {
|
|
console.log(err);
|
|
console.log(err);
|
|
@@ -171,16 +178,20 @@ export class UnitBuildingInformationAddComponent implements OnInit {
|
|
}
|
|
}
|
|
onSubmitted(){
|
|
onSubmitted(){
|
|
console.log('HERE',this.unitInfoForm.value);
|
|
console.log('HERE',this.unitInfoForm.value);
|
|
|
|
+ this.disable = true;
|
|
if(this.editPageId) {
|
|
if(this.editPageId) {
|
|
this.dashBoardSer.editItem(this.editPageId, this.unitInfoForm.value, 'unitsBuildingInformation').subscribe(
|
|
this.dashBoardSer.editItem(this.editPageId, this.unitInfoForm.value, 'unitsBuildingInformation').subscribe(
|
|
res => {
|
|
res => {
|
|
console.log(res);
|
|
console.log(res);
|
|
this.toastr.success('تم التعديل بنجاح');
|
|
this.toastr.success('تم التعديل بنجاح');
|
|
this.location.back();
|
|
this.location.back();
|
|
|
|
+ this.disable = false;
|
|
},
|
|
},
|
|
err => {
|
|
err => {
|
|
console.log(err);
|
|
console.log(err);
|
|
this.toastr.error('خطأ في الخادم ، رجاء المحارله لاحقا');
|
|
this.toastr.error('خطأ في الخادم ، رجاء المحارله لاحقا');
|
|
|
|
+ this.disable = false;
|
|
|
|
+
|
|
}
|
|
}
|
|
)
|
|
)
|
|
} else {
|
|
} else {
|
|
@@ -190,10 +201,13 @@ export class UnitBuildingInformationAddComponent implements OnInit {
|
|
this.toastr.success('تم الإضافه بنجاح');
|
|
this.toastr.success('تم الإضافه بنجاح');
|
|
this.checkSaveclick = false;
|
|
this.checkSaveclick = false;
|
|
this.location.back();
|
|
this.location.back();
|
|
|
|
+ this.disable = false;
|
|
|
|
+
|
|
},
|
|
},
|
|
err => {
|
|
err => {
|
|
console.log(err);
|
|
console.log(err);
|
|
this.checkSaveclick = false;
|
|
this.checkSaveclick = false;
|
|
|
|
+ this.disable = false;
|
|
this.toastr.error('خطأ في الخادم ، حاول لاحقا');
|
|
this.toastr.error('خطأ في الخادم ، حاول لاحقا');
|
|
}
|
|
}
|
|
);
|
|
);
|