logic save ketika room di remove semua
This commit is contained in:
parent
9529da581a
commit
2b1f6c0cfe
|
@ -263,7 +263,7 @@
|
|||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary"
|
||||
[disabled]="disableButton"
|
||||
[disabled]="disableButtonSave"
|
||||
style="
|
||||
color: #ffffff !important;
|
||||
border-color: #37a647 !important;
|
||||
|
|
|
@ -38,6 +38,7 @@ export class AddEditListComponent {
|
|||
roombuildingId: any;
|
||||
dataRoomBuilding: any;
|
||||
disableButton: boolean = true;
|
||||
disableButtonSave: boolean = true;
|
||||
lewatModal: boolean = false;
|
||||
// userProfileForm: FormGroup;
|
||||
public userList: FormArray;
|
||||
|
@ -97,23 +98,29 @@ export class AddEditListComponent {
|
|||
addPhone() {
|
||||
this.userList.push(this.createRoom());
|
||||
this.disableButton = true;
|
||||
this.disableButtonSave = true;
|
||||
}
|
||||
|
||||
removePhone(index) {
|
||||
this.userList.removeAt(index);
|
||||
this.isRoomDuplicate(index);
|
||||
if (this.userList.value.length === 0) {
|
||||
this.disableButtonSave = true;
|
||||
}
|
||||
}
|
||||
|
||||
validateDouble(event: any, index: number) {
|
||||
const selectedRoomId = (event.target as HTMLSelectElement).value;
|
||||
if (this.isRoomDuplicate(index)) {
|
||||
this.disableButton = true;
|
||||
this.disableButtonSave = true;
|
||||
this.toastr.error("Room", "Data yang ada masukan double!", {
|
||||
timeOut: 2000,
|
||||
closeButton: true,
|
||||
});
|
||||
} else {
|
||||
this.disableButton = false;
|
||||
this.disableButtonSave = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -126,6 +133,7 @@ export class AddEditListComponent {
|
|||
).length;
|
||||
if (roomOccurrences === 0) {
|
||||
this.disableButton = false;
|
||||
this.disableButtonSave = false;
|
||||
}
|
||||
return roomOccurrences > 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue