Commit ba632578 by Nattana Chaiyamat

ทะเบียนแผนก

parent e5a9079a
......@@ -3,7 +3,7 @@
<div class="flex pr-2">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay="#department-register-upload-modal">
data-hs-overlay="#department-register-upload-modal" (click)="selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ri-add-line"></i>
นำเข้าข้อมูล
</button>
......@@ -219,7 +219,7 @@
<div class="absolute flex">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(click)="selectBu1(undefined,bu1.bu1id)">
(click)="bu1.tdesc='';bu1.edesc=''">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
......
......@@ -96,8 +96,8 @@ export class DepartmentRegisterComponent implements OnInit {
x.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.search.toLowerCase()))
}
selectBu1(bu1?: Bu1Model, bu1id?: string) {
this.bu1 = new MyBu1Model(bu1 || { bu1id: bu1id })
selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1 || {})
}
showAlert(text: string, type: 'success' | 'error') {
......@@ -107,6 +107,7 @@ export class DepartmentRegisterComponent implements OnInit {
})
}
addBu1() {
this.bu1ListLoading = true
this.bu1Service.post(this.bu1).subscribe({
next: response => {
if (response.success) {
......@@ -116,11 +117,13 @@ export class DepartmentRegisterComponent implements OnInit {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.bu1ListLoading = false
this.showAlert(error.message, 'error')
}
})
}
deleteBu1() {
this.bu1ListLoading = true
this.bu1Service.delete(this.bu1).subscribe({
next: response => {
if (response.success) {
......@@ -130,6 +133,7 @@ export class DepartmentRegisterComponent implements OnInit {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.bu1ListLoading = false
this.showAlert(error.message, 'error')
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment