diff --git a/ng-ttc-frontend/src/app/app.module.ts b/ng-ttc-frontend/src/app/app.module.ts index 255e75c..4e3ffbb 100644 --- a/ng-ttc-frontend/src/app/app.module.ts +++ b/ng-ttc-frontend/src/app/app.module.ts @@ -30,6 +30,7 @@ import { MainProjectContent } from './content/main-project-content/main-project- import { MainProjectAdd } from './component/main-project-add/main-project-add'; import { BudgetAprovalContent } from './content/budget-aproval-content/budget-aproval-content'; import { ThemeSwitcherComponent } from './component/theme-switcher/theme-switcher'; +import { ChatWidgetComponent } from './component/chat-widget-component/chat-widget-component'; // import { BudgetAproval } from './component/budget-aproval/budget-aproval'; // import { AccDateFormatPipe } from './pipe/dtmtodatetime.pipe'; // import { DtmtodatetimePipe } from './dtmtodatetime.pipe'; @@ -42,6 +43,7 @@ import { ThemeSwitcherComponent } from './component/theme-switcher/theme-switche SidebarComponent, LicensePrivacyTermsComponent, TokenTimerComponent, + // ChatWidgetComponent, // ThemeSwitcherComponent, // BudgetAprovalContent // MainProjectAdd, diff --git a/ng-ttc-frontend/src/app/component/budget-aproval/budget-aproval.html b/ng-ttc-frontend/src/app/component/budget-aproval/budget-aproval.html index 4ad774a..e459dd5 100644 --- a/ng-ttc-frontend/src/app/component/budget-aproval/budget-aproval.html +++ b/ng-ttc-frontend/src/app/component/budget-aproval/budget-aproval.html @@ -184,7 +184,6 @@ - @if(showConfirmModal) {
diff --git a/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.css b/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.css new file mode 100644 index 0000000..413a4d5 --- /dev/null +++ b/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.css @@ -0,0 +1,30 @@ + + /* Custom Scrollbar */ + ::-webkit-scrollbar { + width: 6px; + } + ::-webkit-scrollbar-track { + background: transparent; + } + ::-webkit-scrollbar-thumb { + background: #cbd5e1; + border-radius: 3px; + } + ::-webkit-scrollbar-thumb:hover { + background: #94a3b8; + } + + .animate-fade-in-up { + animation: fadeInUp 0.3s ease-out forwards; + } + + @keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(20px) scale(0.95); + } + to { + opacity: 1; + transform: translateY(0) scale(1); + } + } diff --git a/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.html b/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.html new file mode 100644 index 0000000..a2c6a19 --- /dev/null +++ b/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.html @@ -0,0 +1,96 @@ +
+ + +
+ + +
+
+
+
+ AI +
+
+
+
+ ผู้ช่วยวิเคราะห์ข้อมูล + ตอบกลับภายใน 1 นาที +
+
+ +
+ + +
+
+ + +
+ AI +
+ +
+ {{ msg.text }} + + + +
+
+
+ + +
+ + + +
+
+ + + + +
diff --git a/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.ts b/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.ts new file mode 100644 index 0000000..b1b573c --- /dev/null +++ b/ng-ttc-frontend/src/app/component/chat-widget-component/chat-widget-component.ts @@ -0,0 +1,36 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-chat-widget-component', + standalone: false, + templateUrl: './chat-widget-component.html', + styleUrl: './chat-widget-component.css', +}) +export class ChatWidgetComponent { + isOpen = false; + newMessage = ''; + + messages = [ + { text: 'สวัสดีครับ มีอะไรให้ทีมงานช่วยเหลือไหมครับ? 👋', isUser: false }, + ]; + + toggleChat() { + this.isOpen = !this.isOpen; + } + + sendMessage() { + if (this.newMessage.trim()) { + // 1. ใส่ข้อความเราลงไป + this.messages.push({ text: this.newMessage, isUser: true }); + this.newMessage = ''; + + // 2. จำลองบอทตอบกลับ (Auto Reply Simulation) + setTimeout(() => { + this.messages.push({ + text: 'ขอบคุณที่ติดต่อมาครับ ขณะนี้เจ้าหน้าที่กำลังติดลูกค้าท่านอื่น จะรีบตอบกลับให้เร็วที่สุดครับ', + isUser: false + }); + }, 1000); + } + } +} diff --git a/ng-ttc-frontend/src/app/component/main-manager/main-manager.component.ts b/ng-ttc-frontend/src/app/component/main-manager/main-manager.component.ts index 5c7dfff..5bb7533 100644 --- a/ng-ttc-frontend/src/app/component/main-manager/main-manager.component.ts +++ b/ng-ttc-frontend/src/app/component/main-manager/main-manager.component.ts @@ -36,6 +36,9 @@ export class MainManagerComponent implements OnInit { p.status = 'CN'; } + download(){ + + } openBudgetDetail(idx: IPrjMst) { this.router.navigate(['/main/manager/aproval'], { state: { diff --git a/ng-ttc-frontend/src/app/content/main-manager-content/main-manager-content.component.html b/ng-ttc-frontend/src/app/content/main-manager-content/main-manager-content.component.html index c21a098..6957979 100644 --- a/ng-ttc-frontend/src/app/content/main-manager-content/main-manager-content.component.html +++ b/ng-ttc-frontend/src/app/content/main-manager-content/main-manager-content.component.html @@ -1,2 +1,3 @@ + diff --git a/ng-ttc-frontend/src/app/controls/main-control/main-control.module.ts b/ng-ttc-frontend/src/app/controls/main-control/main-control.module.ts index 9782db9..292ac43 100644 --- a/ng-ttc-frontend/src/app/controls/main-control/main-control.module.ts +++ b/ng-ttc-frontend/src/app/controls/main-control/main-control.module.ts @@ -1,3 +1,4 @@ +import { ChatWidgetComponent } from './../../component/chat-widget-component/chat-widget-component'; import { MainManagerContentComponent } from './../../content/main-manager-content/main-manager-content.component'; import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; @@ -36,7 +37,8 @@ import { BudgetAprovalContent } from '../../content/budget-aproval-content/budge MainProject, MainProjectAdd, BudgetAprovalContent, - AccDateFormatPipe + AccDateFormatPipe, + ChatWidgetComponent // MainReportComponent ], imports: [ diff --git a/ng-ttc-frontend/src/app/services/generalservice.ts b/ng-ttc-frontend/src/app/services/generalservice.ts index ea4fb13..cd3d1c9 100644 --- a/ng-ttc-frontend/src/app/services/generalservice.ts +++ b/ng-ttc-frontend/src/app/services/generalservice.ts @@ -62,7 +62,7 @@ export class GeneralService { map((res: any) => res), catchError((error: any) => { const response = error?.error; - console.error('❌ [POST Request Error]:', error); + // console.error('❌ [POST Request Error]:', error); return throwError(() => ({ status: error.status, code: response?.code ?? '500', @@ -117,7 +117,7 @@ export class GeneralService { const options: any = { ...this.getHttpOptions(true), params: httpParams, - responseType: isBlob ? 'blob' : 'json' // ✅ สลับ Type ตามค่า isBlob + responseType: isBlob ? 'blob' : 'json' }; return this.http.get(fullUrl, options).pipe(