Commit cdbb9d74 by Nattana Chaiyamat

ทะเบียนบริษัท

parent 0825b2ac
......@@ -87,7 +87,7 @@
<tr
*ngFor="let item of dataListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="text-center">
<input type="checkbox" class="ti-form-checkbox cursor-pointer" id="checkbox-{{item.data.code}}"
<input *ngIf="item.data.code!='100'" type="checkbox" class="ti-form-checkbox cursor-pointer" id="checkbox-{{item.data.code}}"
[(ngModel)]="item.check">
<label for="checkbox-{{item.data.code}}">&nbsp;{{item.data.code}}</label>
</td>
......@@ -97,7 +97,7 @@
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="modalStatus='edit';setData(item.data)"
data-hs-overlay="#company-registration-page-modal"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" *ngIf="item.data.code!='100'"
(click)="modalStatus='delete';setData(item.data)"
data-hs-overlay="#company-registration-page-alert-modal"></i>
</td>
......@@ -270,7 +270,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-danger" href="javascript:void(0);"
data-hs-overlay="#company-registration-page-alert-modal">
data-hs-overlay="#company-registration-page-alert-modal" (click)="deleteCompany()">
ลบข้อมูล
</a>
</ng-container>
......
......@@ -36,7 +36,7 @@ export class CompanyRegistrationPageComponent {
this.dataLoading = true
this.companyService.getList().subscribe({
next: response => {
this.dataList = response.map(x => ({ check: false, data: { code: x.companyId, tdesc: x.tdesc, edesc: x.edesc, address: x.taddr, contact: x.descOther } }))
this.dataList = response.map(x => ({ check: false, data: { code: x.companyId, tdesc: x.tdesc, edesc: x.edesc, address: x.addressText, contact: x.descOther } }))
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges()
......@@ -63,7 +63,7 @@ export class CompanyRegistrationPageComponent {
}
addCompany() {
const body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, taddr: this.dataSelect.address, descOther: this.dataSelect.contact })
const body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, addressText: this.dataSelect.address, descOther: this.dataSelect.contact })
this.companyService.post(body).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
......@@ -71,6 +71,15 @@ export class CompanyRegistrationPageComponent {
}
})
}
deleteCompany() {
const body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, addressText: this.dataSelect.address, descOther: this.dataSelect.contact })
this.companyService.delete(body).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
this.getCompanyList()
}
})
}
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'แจ้งเตือน', {
......
......@@ -128,8 +128,6 @@
</div>
</div>
<div id="sub-employee-registration-modal-add" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]">
<div class="max-h-full overflow-hidden ti-modal-content">
......@@ -166,7 +164,7 @@
</div>
</div>
</div>
<div class="ti-modal-body-content mt-5">
<div class="ti-modal-body mt-5">
<form class="space-y-3">
<div class="sm:grid grid-cols-12 gap-x-6">
<label class="col-span-3 ti-form-label text-primary mt-2">รหัสพนักงาน</label>
......@@ -368,7 +366,7 @@
</div>
</div>
</div>
<div class="ti-modal-body-content mt-5">
<div class="ti-modal-body mt-5">
<form class="space-y-3">
<div class="sm:grid grid-cols-12 gap-x-6">
<label class="col-span-3 ti-form-label text-primary mt-2">รหัสพนักงาน</label>
......
......@@ -46,6 +46,7 @@ export interface CompanyModel {
brandTdesc: string
brandEdesc: string
logo: string
addressText: string
}
......@@ -97,6 +98,7 @@ export class MyCompanyModel implements CompanyModel {
brandTdesc: string
brandEdesc: string
logo: string
addressText: string
constructor(data: Partial<CompanyModel>) {
this.companyId = data.companyId || ""
this.tdesc = data.tdesc || ""
......@@ -145,6 +147,7 @@ export class MyCompanyModel implements CompanyModel {
this.brandTdesc = data.brandTdesc || ""
this.brandEdesc = data.brandEdesc || ""
this.logo = data.logo || ""
this.addressText = data.addressText || ""
}
}
......@@ -20,13 +20,13 @@ export class CompanyService {
post(body: CompanyModel) {
return this.http.post(this.urlApi, body)
}
// delete(body: CompanyModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
delete(body: CompanyModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ No newline at end of file
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