Commit 8797a543 by sawit

update

parent 942244cb
......@@ -337,6 +337,18 @@
</option>
</select>
</div>
<div class="xl:col-span-12 col-span-12">
<label class="form-label">
ชื่อบริษัท
<span class="required text-danger">*</span>
</label>
<select class="form-select" required [disabled]="bodyTemplate.status=='edit'"
[(ngModel)]="bodyTemplate.data.companyId">
<option style="color: red" [class.d-none]="bodyTemplate.data.companyId==''" [value]="''">
{{bodyTemplate.data.companyId!=''?'ยกเลิก':''}}</option>
<option *ngFor="let item of itemsList" [ngValue]="item.companyId">{{item.companyName}}</option>
</select>
</div>
</div>
</div>
......@@ -349,7 +361,7 @@
<button type="button"
[class.ti-btn-disabled]="!bodyTemplate.data.tname || !bodyTemplate.data.ename ||!bodyTemplate.data.module"
[disabled]="!bodyTemplate.data.tname || !bodyTemplate.data.ename ||!bodyTemplate.data.module"
(click)="closeModalAddGroup()" class="ti-btn bg-primary text-white !font-medium">{{'Save' |
(click)="postTemplate()" class="ti-btn bg-primary text-white !font-medium">{{'Save' |
translate}}</button>
</div>
</div>
......
......@@ -24,6 +24,9 @@ import { DatagridSyncfutionComponent } from '../../../../../datagrid-syncfution/
import { PivotSyncfutionComponent } from "../../../../../pivot-syncfution/pivot-syncfution.component";
import { SafeUrlPipe } from '../../../../../../pipe/safe-url.pipe';
import Swal from 'sweetalert2';
import { DatasourceTableModel, MyDatasourceTableModel } from '../../../../models/datasource-table.model';
import { DatasourseTableService } from '../../../../services/datasourse-table.service';
import swal from 'sweetalert';
export interface ModalDetail {
text: { cardHead: string, search: string[], tableHead: string[] }
}
......@@ -77,7 +80,8 @@ export class ExcelListComponent implements OnInit {
ename: string,
tdesc: string,
edesc: string,
module: string
module: string,
companyId: string,
}
} = {
status: 'add',
......@@ -87,7 +91,8 @@ export class ExcelListComponent implements OnInit {
ename: '',
tdesc: '',
edesc: '',
module: ''
module: '',
companyId: ''
}
}
......@@ -154,6 +159,7 @@ export class ExcelListComponent implements OnInit {
modalRefgridModal: MatDialogRef<any>;
modalRefpivotModal: MatDialogRef<any>;
searchText: string = '';
itemsList: DatasourceTableModel[] = [];
@ViewChild('addGroupModal') addGroupModal!: TemplateRef<any>;
@ViewChild('addChildModal') addChildModal!: TemplateRef<any>;
......@@ -167,7 +173,8 @@ export class ExcelListComponent implements OnInit {
private modalService: NgbModal,
private customCubeService: CustomCubeService,
private cdr: ChangeDetectorRef,
private modal: MatDialog) {
private modal: MatDialog,
private datasourceTable: DatasourseTableService ) {
}
ngOnInit(): void {
......@@ -176,6 +183,7 @@ export class ExcelListComponent implements OnInit {
this.getExcelPortalList()
this.getExcelPortalgGroupList()
this.getExcelPortalTagsList()
this.getData()
}
get totalItems(): number {
return this.searchText == ''
......@@ -275,7 +283,8 @@ export class ExcelListComponent implements OnInit {
})
}
postTemplate() {
console.log("wait for function")
this.modalRef?.close()
}
openAlertModal(message?: string) {
const modalRef = this.modalService.open(AlertModalComponent, {
......@@ -296,7 +305,8 @@ export class ExcelListComponent implements OnInit {
ename: data.ename,
tdesc: data.tdesc,
edesc: data.edesc,
module: data.module
module: data.module,
companyId: data.companyId
};
} else {
this.bodyTemplate.status = 'add';
......@@ -306,7 +316,8 @@ export class ExcelListComponent implements OnInit {
ename: '',
tdesc: '',
edesc: '',
module: ''
module: '',
companyId: ''
};
}
......@@ -951,4 +962,18 @@ export class ExcelListComponent implements OnInit {
closeModalpivotModal() {
this.modalRefpivotModal?.close()
}
getData() {
this.datasourceTable.getList().subscribe({
next: (response: DatasourceTableModel[]) => {
this.itemsList = response.map((x: any) => new MyDatasourceTableModel(x));
console.log('ข้อมูล (itemsList)', this.itemsList);
this.updatePagedItems();
},
error: (error) => {
console.error('error cant get position', error);
swal("ข้อผิดพลาด", "ไม่สามารถดึงข้อมูลได้", "error");
}
});
}
}
\ No newline at end of file
......@@ -125,6 +125,7 @@ export interface TemplateModel {
tdesc: string
edesc: string
module: string
companyId: string
templateFile: TemplateFileModel[]
}
export class MyTemplateModel implements TemplateModel {
......@@ -134,6 +135,7 @@ export class MyTemplateModel implements TemplateModel {
tdesc: string
edesc: string
module: string
companyId: string
templateFile: TemplateFileModel[]
constructor(data?: Partial<TemplateModel>) {
this.templateId = data?.templateId || ''
......
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