Commit 138bdc0e by sawit

เพิ่มช่อง Description(CHINA) job-type

parent 6706f14f
......@@ -5,17 +5,20 @@ export interface JobTypeModel {
jobTypeId: string
thName: string
engName: string
chinaName: string
}
export class JobTypeModel extends BaseModel implements JobTypeModel {
jobTypeId: string
thName: string
engName: string
chinaName: string
constructor(data?: Partial<JobTypeModel>, translateService?: TranslateService) {
super(data, translateService)
this.jobTypeId = checkData(data?.jobTypeId)
this.thName = checkData(data?.thName)
this.engName = checkData(data?.engName)
this.chinaName = checkData(data?.chinaName)
}
getName() {
return baseGetName(this.thName, this.engName, this.translateService?.currentLang)
......
......@@ -33,9 +33,10 @@
<input class="form-check-input check-all" type="checkbox" id="all-products"
(change)="toggleAll($event)" [checked]="allSelected" aria-label="...">
</th>
<th scope="col" class="text-start">รหัสประเภทงาน</th>
<th scope="col" class="text-start">รายละเอียด (ไทย)</th>
<th scope="col" class="text-start">รายละเอียด (อังกฤษ)</th>
<th scope="col" class="text-start">{{ 'JobtypeId' | translate}}</th>
<th scope="col" class="text-start">{{ 'Description(TH)' | translate}}</th>
<th scope="col" class="text-start">{{ 'Description(ENG)' | translate}}</th>
<th scope="col" class="text-start">{{ 'Description(CHINA)' | translate}}</th>
<th scope="col" class="text-start">{{ 'Action' | translate}}</th>
<th scope="col" class="text-start"></th>
</tr>
......@@ -66,6 +67,11 @@
</span>
</td>
<td>
<span class="block mb-1">
{{item.chinaName}}
</span>
</td>
<td>
<div class="flex flex-row items-center !gap-2 ">
<a aria-label="anchor" (click)="view(item)" data-hs-overlay="#modal-detail"
class="ti-btn ti-btn-wave !gap-0 !m-0 bg-info/10 text-info hover:bg-info hover:text-white hover:border-info">
......@@ -142,8 +148,8 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out">
<div class="ti-modal-content">
<div class="ti-modal-header">
<h6 class="modal-title text-[1rem] font-semibold text-defaulttextcolor" id="mail-ComposeLabel">{{ 'Create' |
translate }} {{ 'Company' | translate }}
<h6 class="modal-title text-[1rem] font-semibold text-defaulttextcolor" id="mail-ComposeLabel">
{{ (action == 'add' ? ('Create' | translate) : ('Edit' | translate)) + ' ' + ('Company' | translate) }}
</h6>
<button type="button" class="hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
data-hs-overlay="#modal-detail" #closeModal>
......@@ -166,20 +172,25 @@
<div class="xl:col-span-12 col-span-12">
<label for="thName" class="form-label">{{'Description(TH)' | translate}}</label>
<input type="text" class="form-control" id="thName" placeholder="" [(ngModel)]="selectModel.thName"
[disabled]="action === 'edit'">
<input type="text" class="form-control" id="thName" placeholder="" [(ngModel)]="selectModel.thName">
<div class="text-danger" *ngIf="!selectModel.thName">
{{'Please fill in information' | translate}}
</div>
</div>
<div class="xl:col-span-12 col-span-12">
<label for="engName" class="form-label">{{'Description(ENG)' | translate}}</label>
<input type="text" class="form-control" id="engName" placeholder="" [(ngModel)]="selectModel.engName"
[disabled]="action === 'edit'">
<input type="text" class="form-control" id="engName" placeholder="" [(ngModel)]="selectModel.engName">
<div class="text-danger" *ngIf="!selectModel.engName">
{{'Please fill in information' | translate}}
</div>
</div>
<div class="xl:col-span-12 col-span-12">
<label for="chinaName" class="form-label">{{'Description(CHINA)' | translate}}</label>
<input type="text" class="form-control" id="chinaName" placeholder="" [(ngModel)]="selectModel.chinaName">
<div class="text-danger" *ngIf="!selectModel.chinaName">
{{'Please fill in information' | translate}}
</div>
</div>
</div>
</div>
......@@ -189,8 +200,8 @@
{{'Cancel' | translate}}
</button>
<button type="button" (click)="save()" class="ti-btn bg-primary text-white !font-medium"
[class.ti-btn-disabled]="!selectModel.jobTypeId||!selectModel.thName||!selectModel.engName"
[disabled]="!selectModel.jobTypeId||!selectModel.thName||!selectModel.engName">{{'Save' |
[class.ti-btn-disabled]="!selectModel.jobTypeId||!selectModel.thName||!selectModel.engName||!selectModel.chinaName"
[disabled]="!selectModel.jobTypeId||!selectModel.thName||!selectModel.engName||!selectModel.chinaName">{{'Save' |
translate}}</button>
</div>
</div>
......
......@@ -28,6 +28,7 @@ import { JobTypeService } from '../../../services/job-type.service';
})
export class JobTypeComponent {
@ViewChild("JobTypeModel") JobTypeModel: any;
@ViewChild('closeModal') public childModal?: ElementRef;
dialogRef: any
currentengNameTab: number = 1;
currentExcerptTab: number = 1;
......@@ -85,7 +86,8 @@ export class JobTypeComponent {
(x) =>
x.jobTypeId?.toLowerCase().indexOf(v.toLowerCase()) !== -1 ||
x.thName?.toLowerCase().indexOf(v.toLowerCase()) !== -1 ||
x.engName?.toLowerCase().indexOf(v.toLowerCase()) !== -1
x.engName?.toLowerCase().indexOf(v.toLowerCase()) !== -1 ||
x.chinaName?.toLocaleLowerCase().indexOf(v.toLocaleLowerCase()) !== -1
// x.getStatus().toLowerCase().indexOf(v.toLowerCase()) !== -1
);
}
......@@ -125,24 +127,32 @@ export class JobTypeComponent {
}
save() {
console.log('Before Save, selectModel is:', this.selectModel);
swal({
title: "คุณแน่ใจหรือไม่?",
title: "Are you sure?",
text: "คุณต้องการบันทึกหรือไม่",
icon: "warning",
dangerMode: false,
buttons: ["ยกเลิก", "ยืนยัน"],
buttons: ["Cancel", "Confirm"],
})
.then((willSave: any) => {
if (willSave) {
this.jobtypeservice.post(this.selectModel).subscribe(result => {
console.log(result);
swal("บันทึกสำเร็จ!!", "บันทึกข้อมูลสมาชิก", "success");
this.ngOnInit();
}, error => {
console.error("เกิดข้อผิดพลาดในการบันทึก/อัปเดต:", error);
swal("ข้อผิดพลาด!!", "ไม่สามารถบันทึก/อัปเดตข้อมูลได้", "error");
});
.then((willDelete: any) => {
if (willDelete) {
if (this.action == 'add') {
console.log(this.selectModel);
this.jobtypeservice.post(this.selectModel).subscribe(result => {
swal("Save Success!!", "บันทึกประเภทสำเร็จ", "success");
this.ngOnInit()
this.childModal?.nativeElement.click()
})
} else if (this.action == 'edit') {
const respone = new JobTypeModel(this.selectModel);
this.jobtypeservice.post(respone).subscribe(result => {
console.log(result)
swal("Update Success!!", "บันทึกประเภทสำเร็จ", "success");
this.ngOnInit()
this.childModal?.nativeElement.click()
})
}
}
});
}
......
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