Commit cdbb9d74 by Nattana Chaiyamat

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

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