Commit 8797a543 by sawit

update

parent 942244cb
...@@ -337,6 +337,18 @@ ...@@ -337,6 +337,18 @@
</option> </option>
</select> </select>
</div> </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>
</div> </div>
...@@ -349,7 +361,7 @@ ...@@ -349,7 +361,7 @@
<button type="button" <button type="button"
[class.ti-btn-disabled]="!bodyTemplate.data.tname || !bodyTemplate.data.ename ||!bodyTemplate.data.module" [class.ti-btn-disabled]="!bodyTemplate.data.tname || !bodyTemplate.data.ename ||!bodyTemplate.data.module"
[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> translate}}</button>
</div> </div>
</div> </div>
......
...@@ -24,6 +24,9 @@ import { DatagridSyncfutionComponent } from '../../../../../datagrid-syncfution/ ...@@ -24,6 +24,9 @@ import { DatagridSyncfutionComponent } from '../../../../../datagrid-syncfution/
import { PivotSyncfutionComponent } from "../../../../../pivot-syncfution/pivot-syncfution.component"; import { PivotSyncfutionComponent } from "../../../../../pivot-syncfution/pivot-syncfution.component";
import { SafeUrlPipe } from '../../../../../../pipe/safe-url.pipe'; import { SafeUrlPipe } from '../../../../../../pipe/safe-url.pipe';
import Swal from 'sweetalert2'; 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 { export interface ModalDetail {
text: { cardHead: string, search: string[], tableHead: string[] } text: { cardHead: string, search: string[], tableHead: string[] }
} }
...@@ -77,7 +80,8 @@ export class ExcelListComponent implements OnInit { ...@@ -77,7 +80,8 @@ export class ExcelListComponent implements OnInit {
ename: string, ename: string,
tdesc: string, tdesc: string,
edesc: string, edesc: string,
module: string module: string,
companyId: string,
} }
} = { } = {
status: 'add', status: 'add',
...@@ -87,7 +91,8 @@ export class ExcelListComponent implements OnInit { ...@@ -87,7 +91,8 @@ export class ExcelListComponent implements OnInit {
ename: '', ename: '',
tdesc: '', tdesc: '',
edesc: '', edesc: '',
module: '' module: '',
companyId: ''
} }
} }
...@@ -154,6 +159,7 @@ export class ExcelListComponent implements OnInit { ...@@ -154,6 +159,7 @@ export class ExcelListComponent implements OnInit {
modalRefgridModal: MatDialogRef<any>; modalRefgridModal: MatDialogRef<any>;
modalRefpivotModal: MatDialogRef<any>; modalRefpivotModal: MatDialogRef<any>;
searchText: string = ''; searchText: string = '';
itemsList: DatasourceTableModel[] = [];
@ViewChild('addGroupModal') addGroupModal!: TemplateRef<any>; @ViewChild('addGroupModal') addGroupModal!: TemplateRef<any>;
@ViewChild('addChildModal') addChildModal!: TemplateRef<any>; @ViewChild('addChildModal') addChildModal!: TemplateRef<any>;
...@@ -167,7 +173,8 @@ export class ExcelListComponent implements OnInit { ...@@ -167,7 +173,8 @@ export class ExcelListComponent implements OnInit {
private modalService: NgbModal, private modalService: NgbModal,
private customCubeService: CustomCubeService, private customCubeService: CustomCubeService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private modal: MatDialog) { private modal: MatDialog,
private datasourceTable: DatasourseTableService ) {
} }
ngOnInit(): void { ngOnInit(): void {
...@@ -176,6 +183,7 @@ export class ExcelListComponent implements OnInit { ...@@ -176,6 +183,7 @@ export class ExcelListComponent implements OnInit {
this.getExcelPortalList() this.getExcelPortalList()
this.getExcelPortalgGroupList() this.getExcelPortalgGroupList()
this.getExcelPortalTagsList() this.getExcelPortalTagsList()
this.getData()
} }
get totalItems(): number { get totalItems(): number {
return this.searchText == '' return this.searchText == ''
...@@ -275,7 +283,8 @@ export class ExcelListComponent implements OnInit { ...@@ -275,7 +283,8 @@ export class ExcelListComponent implements OnInit {
}) })
} }
postTemplate() { postTemplate() {
console.log("wait for function")
this.modalRef?.close()
} }
openAlertModal(message?: string) { openAlertModal(message?: string) {
const modalRef = this.modalService.open(AlertModalComponent, { const modalRef = this.modalService.open(AlertModalComponent, {
...@@ -296,7 +305,8 @@ export class ExcelListComponent implements OnInit { ...@@ -296,7 +305,8 @@ export class ExcelListComponent implements OnInit {
ename: data.ename, ename: data.ename,
tdesc: data.tdesc, tdesc: data.tdesc,
edesc: data.edesc, edesc: data.edesc,
module: data.module module: data.module,
companyId: data.companyId
}; };
} else { } else {
this.bodyTemplate.status = 'add'; this.bodyTemplate.status = 'add';
...@@ -306,7 +316,8 @@ export class ExcelListComponent implements OnInit { ...@@ -306,7 +316,8 @@ export class ExcelListComponent implements OnInit {
ename: '', ename: '',
tdesc: '', tdesc: '',
edesc: '', edesc: '',
module: '' module: '',
companyId: ''
}; };
} }
...@@ -951,4 +962,18 @@ export class ExcelListComponent implements OnInit { ...@@ -951,4 +962,18 @@ export class ExcelListComponent implements OnInit {
closeModalpivotModal() { closeModalpivotModal() {
this.modalRefpivotModal?.close() 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 { ...@@ -125,6 +125,7 @@ export interface TemplateModel {
tdesc: string tdesc: string
edesc: string edesc: string
module: string module: string
companyId: string
templateFile: TemplateFileModel[] templateFile: TemplateFileModel[]
} }
export class MyTemplateModel implements TemplateModel { export class MyTemplateModel implements TemplateModel {
...@@ -134,6 +135,7 @@ export class MyTemplateModel implements TemplateModel { ...@@ -134,6 +135,7 @@ export class MyTemplateModel implements TemplateModel {
tdesc: string tdesc: string
edesc: string edesc: string
module: string module: string
companyId: string
templateFile: TemplateFileModel[] templateFile: TemplateFileModel[]
constructor(data?: Partial<TemplateModel>) { constructor(data?: Partial<TemplateModel>) {
this.templateId = data?.templateId || '' 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