Commit 4997ddae by Nattana Chaiyamat

แก้ไข เพิ่มรายงาน Excel

parent 16a26cd2
......@@ -303,9 +303,9 @@
<div class="form-group row ml-0">
<div class="custom-control custom-radio col-sm-4 d-flex align-items-center">
<input type="radio" class="custom-control-input cursor-pointer" name="excelFile" id="excelFilePortal"
[checked]="templateFileType=='portal'"
(click)="templateFileType='portal';templateFile.fileData='';templateFile.fileType='';templateFileName=''">
<label class="custom-control-label cursor-pointer" for="excelFilePortal">เลือกเอ็กเซลล์ไฟล์จาก
[checked]="templateFileType=='portal'" (click)="templateFileTypeChange()">
<label class="custom-control-label cursor-pointer"
(click)="templateFileTypeChange()">เลือกเอ็กเซลล์ไฟล์จาก
Portal<span *ngIf="templateFileType=='portal'" style="color: red">*</span></label>
</div>
<div class="col-sm-8 d-flex align-items-center">
......@@ -321,9 +321,10 @@
<div class="form-group row ml-0">
<div class="custom-control custom-radio col-sm-4">
<input type="radio" class="custom-control-input cursor-pointer" name="excelFile" id="excelFileUpload"
[checked]="templateFileType=='upload'" (click)="templateFileType='upload';templateFile.portalId=''">
<label class="custom-control-label cursor-pointer" for="excelFileUpload">อัพโหลดเอ็กเซลล์ไฟล์<span
*ngIf="templateFileType=='upload'" style="color: red">*</span></label>
[checked]="templateFileType=='upload'" (click)="templateFileTypeChange()">
<label class="custom-control-label cursor-pointer"
(click)="templateFileTypeChange()">อัพโหลดเอ็กเซลล์ไฟล์<span *ngIf="templateFileType=='upload'"
style="color: red">*</span></label>
</div>
<div class="col-sm-8 d-flex align-items-center">
<ng-container *ngIf="templateFileType=='upload'">
......@@ -403,7 +404,7 @@
</div>
<div class="modal-footer ">
<button type="submit" class="btn btn-info"
[disabled]="(!templateFile.portalId&&!templateFile.fileData)||!templateFile.tdesc"
[disabled]="(!templateFile.portalId&&!templateFileName)||!templateFile.tdesc"
(click)="postTemplateFile()">บันทึก</button>
<button type="button" class="btn btn-danger" (click)="modal.dismiss()">ปิด</button>
</div>
......
......@@ -263,6 +263,7 @@ export class ExcelListComponent implements OnInit {
this.templateFile = new MyTemplateFileModel(data)
this.templateFileType = this.templateFile.portalId ? 'portal' : 'upload'
this.templateFileName = this.templateFile.portalId ? '' : this.templateFile.fileName
this.templateFile.realFileNameOld = this.templateFile.fileName
}
this.addChildModalRef = this.modalService.open(targetModal, {
centered: true,
......@@ -600,4 +601,31 @@ export class ExcelListComponent implements OnInit {
ngOnDestroy(): void {
this.getTemplateFileSubscription?.unsubscribe()
}
templateFileTypeChange() {
if (this.templateFileName || this.templateFile.portalId) {
const modalConfirmRef = this.modalService.open(ConfirmModalComponent, {
centered: true,
backdrop: 'static',
})
modalConfirmRef.componentInstance.message = 'คุณต้องการยกเลิกไฟล์ที่เลือกหรือไม่'
modalConfirmRef.result.then(result => {
this.onToggleTemplateFile()
}, reject => { })
} else {
this.onToggleTemplateFile()
}
}
onToggleTemplateFile() {
if (this.templateFileType == 'portal') {
this.templateFileType = 'upload'
this.templateFile.portalId = ''
} else if (this.templateFileType == 'upload') {
this.templateFileType = 'portal';
this.templateFile.fileData = '';
this.templateFile.fileType = '';
this.templateFileName = ''
}
}
}
\ 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