Commit 4997ddae by Nattana Chaiyamat

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

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