Commit a253c195 by DESKTOP-E3GSHH7\myhr

เเก้ไขตอนกดเซฟ

parent 5927934c
<app-page-header [title]="'จัดการประเภทงาน'" [activeTitle]="'ผู้ดูแลระบบ'" [title1]="'จัดการประเภทงาน'"></app-page-header> <app-page-header [title]="'จัดการประเภทงาน'" [activeTitle]="'ผู้ดูแลระบบ'"
[title1]="'จัดการประเภทงาน'"></app-page-header>
<div class="grid grid-cols-12 gap-6"> <div class="grid grid-cols-12 gap-6">
<div class="xl:col-span-12 col-span-12"> <div class="xl:col-span-12 col-span-12">
...@@ -172,10 +173,10 @@ ...@@ -172,10 +173,10 @@
</div> </div>
</div> </div>
<div class="xl:col-span-12 col-span-12"> <div class="xl:col-span-12 col-span-12">
<label for="thName" class="form-label">{{'Description(ENG)' | translate}}</label> <label for="engName" class="form-label">{{'Description(ENG)' | translate}}</label>
<input type="text" class="form-control" id="thName" placeholder="" [(ngModel)]="selectModel.engName" <input type="text" class="form-control" id="engName" placeholder="" [(ngModel)]="selectModel.engName"
[disabled]="action === 'edit'"> [disabled]="action === 'edit'">
<div class="text-danger" *ngIf="!selectModel.thName"> <div class="text-danger" *ngIf="!selectModel.engName">
{{'Please fill in information' | translate}} {{'Please fill in information' | translate}}
</div> </div>
</div> </div>
...@@ -187,7 +188,9 @@ ...@@ -187,7 +188,9 @@
data-hs-overlay="#modal-detail"> data-hs-overlay="#modal-detail">
{{'Cancel' | translate}} {{'Cancel' | translate}}
</button> </button>
<button type="button" (click)="save()" class="ti-btn bg-primary text-white !font-medium">{{'Save' | <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' |
translate}}</button> translate}}</button>
</div> </div>
</div> </div>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<input class="form-check-input check-all" type="checkbox" id="all-products" <input class="form-check-input check-all" type="checkbox" id="all-products"
(change)="toggleAll($event)" [checked]="allSelected" aria-label="..."> (change)="toggleAll($event)" [checked]="allSelected" aria-label="...">
</th> </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">ชื่อย่อ (ไทย)</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">รายละเอียด (ไทย)</th>
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
<div class="grid grid-cols-12 gap-4"> <div class="grid grid-cols-12 gap-4">
<div class="xl:col-span-12 col-span-12"> <div class="xl:col-span-12 col-span-12">
<label for="provinceId" class="form-label">{{'provinceId' | translate}}</label> <label for="provinceId" class="form-label">{{'รหัสจังหวัด' | translate}}</label>
<input type="text" class="form-control" id="provinceId" placeholder="" [(ngModel)]="selectModel.provinceId" <input type="text" class="form-control" id="provinceId" placeholder="" [(ngModel)]="selectModel.provinceId"
[readonly]="action === 'edit'" [readonly]="action === 'edit'" [readonly]="action === 'edit'" [readonly]="action === 'edit'"
[ngClass]="{ '!bg-input-readonly': action === 'edit' }"> [ngClass]="{ '!bg-input-readonly': action === 'edit' }">
...@@ -256,7 +256,9 @@ ...@@ -256,7 +256,9 @@
data-hs-overlay="#modal-detail"> data-hs-overlay="#modal-detail">
{{'Cancel' | translate}} {{'Cancel' | translate}}
</button> </button>
<button type="button" (click)="save()" class="ti-btn bg-primary text-white !font-medium">{{'Save' | <button type="button" (click)="save()" class="ti-btn bg-primary text-white !font-medium"
[class.ti-btn-disabled]="!selectModel.provinceId||!selectModel.thName||!selectModel.engName||!selectedCountry||!selectedRegion"
[disabled]="!selectModel.provinceId||!selectModel.thName||!selectModel.engName||!selectedCountry||!selectedRegion">{{'Save' |
translate}}</button> translate}}</button>
</div> </div>
</div> </div>
......
...@@ -49,7 +49,7 @@ export class ProvinceComponent { ...@@ -49,7 +49,7 @@ export class ProvinceComponent {
countryList: CountryModel[] = []; countryList: CountryModel[] = [];
selectedCountry: CountryModel | undefined selectedCountry: CountryModel | undefined
regionList : RegionModel[] = [] regionList: RegionModel[] = []
selectedRegion: RegionModel | undefined selectedRegion: RegionModel | undefined
pageIndex = 0; pageIndex = 0;
...@@ -184,7 +184,7 @@ export class ProvinceComponent { ...@@ -184,7 +184,7 @@ export class ProvinceComponent {
c => c.countryId === this.selectModel.country?.countryId c => c.countryId === this.selectModel.country?.countryId
); );
} }
if (this.selectModel.region && this.regionList){ if (this.selectModel.region && this.regionList) {
this.selectedRegion = this.regionList.find( this.selectedRegion = this.regionList.find(
r => r.regionId === this.selectModel.region?.regionId r => r.regionId === this.selectModel.region?.regionId
) )
...@@ -208,32 +208,6 @@ export class ProvinceComponent { ...@@ -208,32 +208,6 @@ export class ProvinceComponent {
save() { save() {
const checkprovince = this.selectModel;
if (!checkprovince.provinceId) {
swal({
title: "ข้อผิดพลาด!",
text: "กรุณาระบุรหัสจังหวัด",
icon: "warning",
buttons: ["ยกเลิก", "ยืนยัน"],
});
return;
} else if(!checkprovince.country){
swal({
title: "ข้อผิดพลาด!",
text: "กรุณาเลือกประเทศ",
icon: "warning",
buttons: ["ยกเลิก", "ยืนยัน"],
});
return;
} else if(!checkprovince.region){
swal({
title: "ข้อผิดพลาด!",
text: "กรุณาเลือกภูมิภาค",
icon: "warning",
buttons: ["ยกเลิก", "ยืนยัน"],
});
return;
}
console.log('Before Save, selectModel is:', this.selectModel); console.log('Before Save, selectModel is:', this.selectModel);
swal({ swal({
title: "คุณแน่ใจหรือไม่?", title: "คุณแน่ใจหรือไม่?",
......
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