-downloads
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 7m6s
Build Docker Image / Restart Docker Compose (push) Successful in 0s

-subscribe project
This commit is contained in:
x2Skyz
2025-11-30 23:47:29 +07:00
parent 07d49d87cf
commit 40e682e5d8
10 changed files with 193 additions and 77 deletions

View File

@@ -1,2 +1,2 @@
<!-- <app-main-dashboard></app-main-dashboard> -->
<app-main-manager></app-main-manager>
<app-main-manager (documentDownload)="OnDownloadPrjDoc($event)"></app-main-manager>

View File

@@ -62,7 +62,46 @@ export class MainManagerContentComponent implements OnInit {
});
}
OnDownloadPrjDoc(value: any): void {
let uri = `/api/ttc/projectdownload`;
let param = {
prjseq: value
}
// isBlob = true
this.generalService.getRequest(uri, param, true).subscribe({
next: (blob: Blob) => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `เอกสาร_โครงการ_${value}.zip`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
const mockResult = {
code: '200',
message: 'Download Successful',
message_th: 'ดาวน์โหลดเอกสารสำเร็จเรียบร้อย'
};
// this.generalService.trowApi(mockResult);
},
error: (error: any) => {
if (error.status === 404) {
// แจ้งเตือนเฉพาะเจาะจง
this.generalService.trowApi({
code: '404',
message: 'No documents found',
message_th: 'ไม่พบเอกสารแนบของโครงการนี้'
});
} else {
// Error อื่นๆ (500, etc.)
this.generalService.trowApi(error);
}
}
});
}
// OnSetupDashboard(value: any, setupFirst: boolean): void {
// const uri = '/api/web/accountingSetup';