Commit c8b0be7c by DESKTOP-E3GSHH7\myhr

เเก้ตอนบันทึกข้อมูลเสร็จmodal เปิด เเต่หน้าไม่สามารถกดอะไรได้ เพิ่มpointer hover

parent c3010f5d
<div class="modal-header"> <!-- <div class="modal-header">
<h5 class="modal-title" id="editLabel">ข้อความแจ้งเตือน</h5> <h5 class="modal-title" id="editLabel">ข้อความแจ้งเตือน</h5>
<button type="button" class="close" (click)="activeModal.dismiss('dismiss')" aria-label="Close"> <button type="button" class="close" (click)="activeModal.dismiss('dismiss')" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
...@@ -16,4 +16,23 @@ ...@@ -16,4 +16,23 @@
<ng-template #InnerHTML> <ng-template #InnerHTML>
<div class="modal-body" [innerHTML]="innerHTML"> <div class="modal-body" [innerHTML]="innerHTML">
</div> </div>
</ng-template> -->
<div class="modal-header">
<h5 class="modal-title" id="editLabel">ข้อความแจ้งเตือน</h5>
<button type="button" class="close" (click)="close()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<ng-container *ngIf="data.innerHTML != undefined then InnerHTML else Message"></ng-container>
<ng-template #Message>
<div class="modal-body">
{{data.message}}
</div>
</ng-template>
<ng-template #InnerHTML>
<div class="modal-body" [innerHTML]="data.innerHTML">
</div>
</ng-template> </ng-template>
\ No newline at end of file
import { Component, Input, OnInit } from '@angular/core'; import { Component, OnInit, Inject } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@Component({ @Component({
selector: 'app-alert-modal', selector: 'app-alert-modal',
templateUrl: './alert-modal.component.html', templateUrl: './alert-modal.component.html',
styleUrls: ['./alert-modal.component.scss'] styleUrls: ['./alert-modal.component.scss'],
standalone: true,
imports: [
CommonModule,
FormsModule,
MatDialogModule
]
}) })
export class AlertModalComponent implements OnInit { export class AlertModalComponent implements OnInit {
@Input() message: string = "" constructor(
@Input() innerHTML?: string public dialogRef: MatDialogRef<AlertModalComponent>,
constructor(public activeModal: NgbActiveModal) { } @Inject(MAT_DIALOG_DATA) public data: { message: string; innerHTML?: string }
) { }
ngOnInit(): void { ngOnInit(): void {
} }
} close(): void {
this.dialogRef.close();
}
}
\ No newline at end of file
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<td> <td>
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-link text-blue-600 text-base flex-shrink-0" (click)="openLink(data.link1)" <i class="fa fa-link text-blue-600 text-base flex-shrink-0 cursor-pointer active: hover:text-danger" (click)="openLink(data.link1)"
style="font-size: 20px;"></i> style="font-size: 20px;"></i>
</span> </span>
</div> </div>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<td> <td>
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-download text-blue-600 text-base flex-shrink-0" (click)="downloadFile(data.logId)" <i class="fa fa-download text-blue-600 text-base flex-shrink-0 cursor-pointer active hover:text-success" (click)="downloadFile(data.logId)"
style="font-size: 20px;"></i> style="font-size: 20px;"></i>
</span> </span>
</div> </div>
......
...@@ -154,10 +154,10 @@ export class ListCourseComponent implements OnInit { ...@@ -154,10 +154,10 @@ export class ListCourseComponent implements OnInit {
if (willDelete) { if (willDelete) {
this.courseService.deleteCourse(item).subscribe(result => { this.courseService.deleteCourse(item).subscribe(result => {
if (result) { if (result) {
this.openAlertModalWithMatDialog('ลบข้อมูลสำเร็จ'); swal("ลบสำเร็จ!!", "บันทึกข้อมูลสำเร็จ", "success");
this.getListCourse(); this.getListCourse();
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถลบข้อมูลได้'); swal("สำเร็จบางส่วน/ข้อผิดพลาด!!", "มีการลบข้อมูลบางส่วนไม่สำเร็จ หรือมีข้อผิดพลาด", "warning");
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); this.openAlertModalWithMatDialog(error.message);
...@@ -186,14 +186,15 @@ export class ListCourseComponent implements OnInit { ...@@ -186,14 +186,15 @@ export class ListCourseComponent implements OnInit {
console.log(this.modelCourse); console.log(this.modelCourse);
this.courseService.createCourse(this.modelCourse).subscribe(res => { this.courseService.createCourse(this.modelCourse).subscribe(res => {
if (res) { if (res) {
this.openAlertModalWithMatDialog('อัพเดทข้อมูลสำเร็จ'); swal("บันทึกสำเร็จ!!", "อัพเดทข้อมูลสำเร็จ", "success");
this.closeDialog(); this.closeDialog();
this.getListCourse(); this.getListCourse();
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถอัพเดทข้อมูลได้'); swal('ไม่สามารถอัพเดทข้อมูลได้');
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); console.error("เกิดข้อผิดพลาดในการบันทึก/อัปเดต:", error);
swal("ข้อผิดพลาด!!", "ไม่สามารถบันทึก/อัปเดตข้อมูลได้", "error");
}); });
} }
}); });
...@@ -210,14 +211,15 @@ export class ListCourseComponent implements OnInit { ...@@ -210,14 +211,15 @@ export class ListCourseComponent implements OnInit {
if (willSave) { if (willSave) {
this.courseService.createCourse(this.modelCourse).subscribe(res => { this.courseService.createCourse(this.modelCourse).subscribe(res => {
if (res) { if (res) {
this.openAlertModalWithMatDialog('บันทึกข้อมูลสำเร็จ'); swal("บันทึกสำเร็จ!!", "บันทึกข้อมูลสมาชิก", "success");
this.closeDialog(); this.closeDialog();
this.getListCourse(); this.getListCourse();
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถสร้างเอกสารได้'); swal('ไม่สามารถสร้างเอกสารได้');
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); console.error("เกิดข้อผิดพลาดในการบันทึก/อัปเดต:", error);
swal("ข้อผิดพลาด!!", "ไม่สามารถบันทึก/อัปเดตข้อมูลได้", "error");
}); });
} }
}); });
......
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
<td style="justify-items: center;"> <td style="justify-items: center;">
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-link text-blue-600 text-base flex-shrink-0" (click)="openLink(data.link1)" <i class="fa fa-link text-blue-600 text-base flex-shrink-0 cursor-pointer active: hover:text-danger" (click)="openLink(data.link1)"
style="font-size: 20px;"></i> style="font-size: 20px;"></i>
</span> </span>
</div> </div>
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
<td style="justify-items: center;"> <td style="justify-items: center;">
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-download text-blue-600 text-base flex-shrink-0" <i class="fa fa-download text-blue-600 text-base flex-shrink-0 cursor-pointer active hover:text-success"
(click)="downloadFile(data.logId,'tha')" style="font-size: 20px;"></i> (click)="downloadFile(data.logId,'tha')" style="font-size: 20px;"></i>
</span> </span>
</div> </div>
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
<td style="justify-items: center;"> <td style="justify-items: center;">
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-download text-blue-600 text-base flex-shrink-0" <i class="fa fa-download text-blue-600 text-base flex-shrink-0 cursor-pointer active hover:text-success"
(click)="downloadFile(data.logId,'eng')" style="font-size: 20px;"></i> (click)="downloadFile(data.logId,'eng')" style="font-size: 20px;"></i>
</span> </span>
</div> </div>
......
...@@ -155,10 +155,10 @@ export class ListDocComponent implements OnInit { ...@@ -155,10 +155,10 @@ export class ListDocComponent implements OnInit {
if (willDelete) { if (willDelete) {
this.documentService.deleteExcel(item).subscribe(result => { this.documentService.deleteExcel(item).subscribe(result => {
if (result) { if (result) {
this.openAlertModalWithMatDialog('ลบข้อมูลสำเร็จ'); swal("ลบสำเร็จ!!", "บันทึกข้อมูลสำเร็จ", "success");
this.getListDoc(); // โหลดข้อมูลใหม่ทั้งหมดและใช้ applyFilterAndPagination this.getListDoc(); // โหลดข้อมูลใหม่ทั้งหมดและใช้ applyFilterAndPagination
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถลบข้อมูลได้'); swal("สำเร็จบางส่วน/ข้อผิดพลาด!!", "มีการลบข้อมูลบางส่วนไม่สำเร็จ หรือมีข้อผิดพลาด", "warning");
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); this.openAlertModalWithMatDialog(error.message);
...@@ -187,14 +187,15 @@ export class ListDocComponent implements OnInit { ...@@ -187,14 +187,15 @@ export class ListDocComponent implements OnInit {
console.log(this.modelDoc); console.log(this.modelDoc);
this.documentService.createDoc(this.modelDoc).subscribe(res => { this.documentService.createDoc(this.modelDoc).subscribe(res => {
if (res) { if (res) {
this.openAlertModalWithMatDialog('อัพเดทข้อมูลสำเร็จ'); swal("บันทึกสำเร็จ!!", "อัพเดทข้อมูลสำเร็จ", "success");
this.closeDialog(); // ปิด MatDialog this.closeDialog(); // ปิด MatDialog
this.getListDoc(); // โหลดข้อมูลใหม่ทั้งหมดและใช้ applyFilterAndPagination this.getListDoc(); // โหลดข้อมูลใหม่ทั้งหมดและใช้ applyFilterAndPagination
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถอัพเดทข้อมูลได้'); swal('ไม่สามารถอัพเดทข้อมูลได้');
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); console.error("เกิดข้อผิดพลาดในการบันทึก/อัปเดต:", error);
swal("ข้อผิดพลาด!!", "ไม่สามารถบันทึก/อัปเดตข้อมูลได้", "error");
}); });
} }
}); });
...@@ -211,14 +212,15 @@ export class ListDocComponent implements OnInit { ...@@ -211,14 +212,15 @@ export class ListDocComponent implements OnInit {
if (willSave) { if (willSave) {
this.documentService.createDoc(this.modelDoc).subscribe(res => { this.documentService.createDoc(this.modelDoc).subscribe(res => {
if (res) { if (res) {
this.openAlertModalWithMatDialog('บันทึกข้อมูลสำเร็จ'); swal("บันทึกสำเร็จ!!", "บันทึกข้อมูลสมาชิก", "success");
this.closeDialog(); // ปิด MatDialog this.closeDialog(); // ปิด MatDialog
this.getListDoc(); // โหลดข้อมูลใหม่ทั้งหมดและใช้ applyFilterAndPagination this.getListDoc(); // โหลดข้อมูลใหม่ทั้งหมดและใช้ applyFilterAndPagination
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถสร้างเอกสารได้'); swal('ไม่สามารถสร้างเอกสารได้');
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); console.error("เกิดข้อผิดพลาดในการบันทึก/อัปเดต:", error);
swal("ข้อผิดพลาด!!", "ไม่สามารถบันทึก/อัปเดตข้อมูลได้", "error");
}); });
} }
}); });
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{{ 'All List' | translate}} {{ 'All List' | translate}}
</div> </div>
<div class="flex flex-wrap gap-2"> <div class="flex flex-wrap gap-2">
<a href="javascript:void(0);" class="hs-dropdown-toggle ti-btn ti-btn-primary-full me-2" <a href="javascript:void(0);" class="hs-dropdown-toggle ti-btn ti-btn-primary-full me-2 hover:scale-105 transition duration-300"
(click)="openEditExcelDialog()"><i class="ri-add-line font-semibold align-middle"></i>{{ 'Create' | (click)="openEditExcelDialog()"><i class="ri-add-line font-semibold align-middle"></i>{{ 'Create' |
translate}} translate}}
</a> </a>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<td> <td>
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-link text-blue-600 text-base flex-shrink-0" (click)="openLink(data.link1)" <i class="fa fa-link text-blue-600 text-base flex-shrink-0 cursor-pointer active: hover:text-danger hover:scale-125 transition duration-300" (click)="openLink(data.link1)"
style="font-size: 20px;"></i> style="font-size: 20px;"></i>
</span> </span>
</div> </div>
...@@ -77,8 +77,8 @@ ...@@ -77,8 +77,8 @@
<td> <td>
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-download text-blue-600 text-base flex-shrink-0" (click)="downloadFile(data.logId)" <i class="fa fa-download text-blue-600 text-base flex-shrink-0 cursor-pointer active hover:text-success hover:scale-125 transition duration-300"
style="font-size: 20px;"></i> (click)="downloadFile(data.logId)" style="font-size: 20px;"></i>
</span> </span>
</div> </div>
</td> </td>
...@@ -121,7 +121,8 @@ ...@@ -121,7 +121,8 @@
<div class="box-footer"> <div class="box-footer">
<div class="flex items-center flex-wrap overflow-auto"> <div class="flex items-center flex-wrap overflow-auto">
<div class="mb-2 sm:mb-0"> <div class="mb-2 sm:mb-0">
<select class="custom-select m-r-5" style="width: auto" [(ngModel)]="pageSize" (ngModelChange)="goToPage(0)"> <select class="custom-select m-r-5" style="width: auto" [(ngModel)]="pageSize"
(ngModelChange)="goToPage(0)">
<option [ngValue]="10">รายการต่อหน้า: 10</option> <option [ngValue]="10">รายการต่อหน้า: 10</option>
<option [ngValue]="50">รายการต่อหน้า: 50</option> <option [ngValue]="50">รายการต่อหน้า: 50</option>
<option [ngValue]="100">รายการต่อหน้า: 100</option> <option [ngValue]="100">รายการต่อหน้า: 100</option>
...@@ -158,7 +159,8 @@ ...@@ -158,7 +159,8 @@
</div> </div>
</div> </div>
<div class="box p-4" *ngIf="checkType === '1'"> <div class="flex flex-wrap -mx-2"> <div class="box p-4" *ngIf="checkType === '1'">
<div class="flex flex-wrap -mx-2">
<div class="w-full"> <div class="w-full">
<div class="py-3 px-2"> <div class="py-3 px-2">
<input type="text" <input type="text"
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<td> <td>
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-link text-blue-600 text-base flex-shrink-0 cursor-pointer" <i class="fa fa-link text-blue-600 text-base flex-shrink-0 cursor-pointer active: hover:text-danger hover:scale-125 transition duration-300"
(click)="openLink(data.link1)" style="font-size: 20px;"></i> (click)="openLink(data.link1)" style="font-size: 20px;"></i>
</span> </span>
</div> </div>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<td> <td>
<div> <div>
<span class="block mb-1"> <span class="block mb-1">
<i class="fa fa-download text-blue-600 text-base flex-shrink-0 cursor-pointer" <i class="fa fa-download text-blue-600 text-base flex-shrink-0 cursor-pointer active hover:text-success hover:scale-125 transition duration-300"
(click)="downloadFile(data.widgetId)" style="font-size: 20px;"></i> (click)="downloadFile(data.widgetId)" style="font-size: 20px;"></i>
</span> </span>
</div> </div>
......
...@@ -167,10 +167,10 @@ export class ListWidgetsComponent implements OnInit { ...@@ -167,10 +167,10 @@ export class ListWidgetsComponent implements OnInit {
if (willDelete) { if (willDelete) {
this.widgetService.deleteWidget(item).subscribe(result => { this.widgetService.deleteWidget(item).subscribe(result => {
if (result) { if (result) {
this.openAlertModalWithMatDialog('ลบข้อมูลสำเร็จ'); swal("ลบสำเร็จ!!", "บันทึกข้อมูลสำเร็จ", "success");
this.getListWidgets(); // Re-fetch and re-apply filter/pagination this.getListWidgets(); // Re-fetch and re-apply filter/pagination
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถลบข้อมูลได้'); swal("สำเร็จบางส่วน/ข้อผิดพลาด!!", "มีการลบข้อมูลบางส่วนไม่สำเร็จ หรือมีข้อผิดพลาด", "warning");
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); this.openAlertModalWithMatDialog(error.message);
...@@ -199,14 +199,15 @@ export class ListWidgetsComponent implements OnInit { ...@@ -199,14 +199,15 @@ export class ListWidgetsComponent implements OnInit {
console.log(this.modelWidget); console.log(this.modelWidget);
this.widgetService.createWidget(this.modelWidget).subscribe(res => { this.widgetService.createWidget(this.modelWidget).subscribe(res => {
if (res) { if (res) {
this.openAlertModalWithMatDialog('อัพเดทข้อมูลสำเร็จ'); swal("บันทึกสำเร็จ!!", "อัพเดทข้อมูลสำเร็จ", "success");
this.closeDialog(); this.closeDialog();
this.getListWidgets(); // Re-fetch and re-apply filter/pagination this.getListWidgets(); // Re-fetch and re-apply filter/pagination
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถอัพเดทข้อมูลได้'); swal('ไม่สามารถอัพเดทข้อมูลได้');
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); console.error("เกิดข้อผิดพลาดในการบันทึก/อัปเดต:", error);
swal("ข้อผิดพลาด!!", "ไม่สามารถบันทึก/อัปเดตข้อมูลได้", "error");
}); });
} }
}); });
...@@ -223,14 +224,15 @@ export class ListWidgetsComponent implements OnInit { ...@@ -223,14 +224,15 @@ export class ListWidgetsComponent implements OnInit {
if (willSave) { if (willSave) {
this.widgetService.createWidget(this.modelWidget).subscribe(res => { this.widgetService.createWidget(this.modelWidget).subscribe(res => {
if (res) { if (res) {
this.openAlertModalWithMatDialog('บันทึกข้อมูลสำเร็จ'); swal("บันทึกสำเร็จ!!", "บันทึกข้อมูลสมาชิก", "success");
this.closeDialog(); this.closeDialog();
this.getListWidgets(); // Re-fetch and re-apply filter/pagination this.getListWidgets(); // Re-fetch and re-apply filter/pagination
} else { } else {
this.openAlertModalWithMatDialog('ไม่สามารถสร้างเอกสารได้'); swal('ไม่สามารถสร้างเอกสารได้');
} }
}, error => { }, error => {
this.openAlertModalWithMatDialog(error.message); console.error("เกิดข้อผิดพลาดในการบันทึก/อัปเดต:", error);
swal("ข้อผิดพลาด!!", "ไม่สามารถบันทึก/อัปเดตข้อมูลได้", "error");
}); });
} }
}); });
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
</div> </div>
<div> <div>
<button <button
class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md shadow-md transition duration-150 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50" class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md shadow-md
active hover:bg-success hover:scale-110 transition duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50"
(click)="openView(c.id)" (click)="openView(c.id)"
> >
รายละเอียด รายละเอียด
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
</div> </div>
<div> <div>
<button <button
class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md shadow-md transition duration-150 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50" class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md shadow-md
active hover:bg-success hover:scale-110 transition duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50"
(click)="openView(c.id)" (click)="openView(c.id)"
> >
รายละเอียด รายละเอียด
......
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
</div> </div>
<div> <div>
<button <button
class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md shadow-md transition duration-150 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50" class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700
text-white text-sm font-medium rounded-md shadow-md ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50
active hover:bg-success hover:scale-110 transition duration-300"
(click)="openView(c.id)" (click)="openView(c.id)"
> >
รายละเอียด รายละเอียด
......
...@@ -53,7 +53,8 @@ ...@@ -53,7 +53,8 @@
</div> </div>
<div> <div>
<button <button
class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md shadow-md transition duration-150 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50" class="bg-primary inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md shadow-md
active hover:bg-success hover:scale-110 transition duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50"
(click)="openView(c.id)"> (click)="openView(c.id)">
รายละเอียด รายละเอียด
</button> </button>
......
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