From a52c33706aee1ef69d6d493cb486557673ad942c Mon Sep 17 00:00:00 2001 From: Viet An Date: Wed, 20 May 2026 15:48:05 +0700 Subject: [PATCH] changes --- app/components/common/QRcode.vue | 6 +- app/components/customer/Company.vue | 2 +- app/components/customer/CustomerInfo.vue | 4 +- app/components/customer/CustomerView.vue | 2 +- app/components/datatable/MenuSave.vue | 2 +- app/components/dialog/Delete.vue | 2 +- app/components/media/ImageCard.vue | 4 +- app/components/media/ImageLayout.vue | 10 +-- app/components/media/Imagebox.vue | 2 +- app/components/modal/DealerProductSetting.vue | 6 +- app/components/parameter/ImportData.vue | 2 +- app/components/people/PeopleInfo.vue | 2 +- app/components/people/PeopleView.vue | 2 +- app/components/snackbar/Error.vue | 19 +++--- app/components/snackbar/Info.vue | 6 -- app/components/snackbar/SnackBar.vue | 62 +++++++++++-------- app/components/snackbar/Success.vue | 19 +++--- app/components/user/SetPassword.vue | 2 +- app/plugins/01-common.js | 26 +++----- app/plugins/02-connection.js | 12 ++-- 20 files changed, 86 insertions(+), 106 deletions(-) diff --git a/app/components/common/QRcode.vue b/app/components/common/QRcode.vue index 9839bfb..fcfc9da 100644 --- a/app/components/common/QRcode.vue +++ b/app/components/common/QRcode.vue @@ -106,9 +106,7 @@ async function download() { if (!svg) { console.error("QR Code SVG element not found after waiting."); - $snackbar(isVietnamese.value ? "Không tìm thấy mã QR để tải xuống." : "QR Code not found for download.", { - type: "is-danger", - }); + $snackbar(isVietnamese.value ? "Không tìm thấy mã QR để tải xuống." : "QR Code not found for download.", "Error"); return; } @@ -135,7 +133,7 @@ async function download() { linkElement.click(); URL.revokeObjectURL(url); - $snackbar(isVietnamese.value ? "Đã tải xuống mã QR!" : "QR Code downloaded!", { type: "is-success" }); + $snackbar(isVietnamese.value ? "Đã tải xuống mã QR!" : "QR Code downloaded!", "Error"); }; image.src = url; } diff --git a/app/components/customer/Company.vue b/app/components/customer/Company.vue index 9212c67..9db3fbf 100644 --- a/app/components/customer/Company.vue +++ b/app/components/customer/Company.vue @@ -269,7 +269,7 @@ async function update() { record.update_time = new Date(); let rs = record.value.id ? await $updateapi("company", record.value) : await $insertapi("company", record.value); if (rs === "error") return; - if (!record.value.id) $snackbar(`Khách hàng đã được khởi tạo với mã ${rs.code}`, "Thành công", "Success"); + if (!record.value.id) $snackbar(`Khách hàng đã được khởi tạo với mã ${rs.code}`, "Success"); record.value.id = rs.id; let ele = await $getdata("company", { id: rs.id }, null, true); emit("update", ele); diff --git a/app/components/customer/CustomerInfo.vue b/app/components/customer/CustomerInfo.vue index 881efed..4848138 100644 --- a/app/components/customer/CustomerInfo.vue +++ b/app/components/customer/CustomerInfo.vue @@ -712,7 +712,7 @@ async function update() { } if (rs === "error") { - $snackbar("Có lỗi xảy ra khi lưu dữ liệu", "Lỗi", "Error"); + $snackbar("Có lỗi xảy ra khi lưu dữ liệu", "Error"); return; } record.value.id = rs.id; @@ -725,7 +725,6 @@ async function update() { `${ isVietnamese.value ? "Khách hàng đã được khởi tạo với mã" : "Customer has been created with code" } ${rs.code}`, - "Thành công", "Success", ); } else { @@ -733,7 +732,6 @@ async function update() { `${ isVietnamese.value ? "Khách hàng đã được cập nhật với mã" : "Customer has been updated with code" } ${rs.code}`, - "Thành công", "Success", ); } diff --git a/app/components/customer/CustomerView.vue b/app/components/customer/CustomerView.vue index ed74802..5a1598c 100644 --- a/app/components/customer/CustomerView.vue +++ b/app/components/customer/CustomerView.vue @@ -345,7 +345,7 @@ export default { }, copy(value) { this.$copyToClipboard(value); - this.$snackbar("Đã copy vào clipboard.", "Copy", "Success"); + this.$snackbar("Đã copy vào clipboard", "Success"); }, openPhone() { this.showmodal = { diff --git a/app/components/datatable/MenuSave.vue b/app/components/datatable/MenuSave.vue index 5e183f4..5005590 100644 --- a/app/components/datatable/MenuSave.vue +++ b/app/components/datatable/MenuSave.vue @@ -177,7 +177,7 @@ async function saveSetting() { copy[idx] = result; store.commit("settings", copy); } - $snackbar("Lưu thiết lập thành công", undefined, "Success"); + $snackbar("Lưu thiết lập thành công", "Success"); emit("modalevent", { name: "updatesetting", data: result }); emit("close"); } diff --git a/app/components/dialog/Delete.vue b/app/components/dialog/Delete.vue index 6961b0b..d221ffe 100644 --- a/app/components/dialog/Delete.vue +++ b/app/components/dialog/Delete.vue @@ -48,7 +48,7 @@ export default { result = await this.$updateapi(name, record); } else result = await this.$deleteapi(name, id); if (result === "error") return this.$dialog("Đã xảy ra lỗi, xóa dữ liệu thất bại", "Lỗi", "Error"); - this.$snackbar("Dữ liệu đã được xoá khỏi hệ thống", undefined, "Success"); + this.$snackbar("Dữ liệu đã được xoá khỏi hệ thống", "Success"); let arr = Array.isArray(id) ? id : [{ id: id }]; let copy = this.$copy(this.$store.state[pagename].data); arr.map((x) => { diff --git a/app/components/media/ImageCard.vue b/app/components/media/ImageCard.vue index de98672..79ef8a3 100644 --- a/app/components/media/ImageCard.vue +++ b/app/components/media/ImageCard.vue @@ -40,10 +40,10 @@ async function saveEditImage() { }); props.loadImages(); - $snackbar("Đã cập nhật ảnh thành công", "Thành công", "Success"); + $snackbar("Đã cập nhật ảnh thành công", "Success"); } catch (error) { console.error("Error updating image", error); - $snackbar("Cập nhật ảnh thất bại", "Lỗi", "Error"); + $snackbar("Cập nhật ảnh thất bại", "Error"); } resetEditRefs(); diff --git a/app/components/media/ImageLayout.vue b/app/components/media/ImageLayout.vue index 5ada7e7..6e0b21f 100644 --- a/app/components/media/ImageLayout.vue +++ b/app/components/media/ImageLayout.vue @@ -284,11 +284,11 @@ async function onUploaded(uploadedFiles) { if (attachedCount > 0) { loadImages(); - $snackbar(`Đã thêm ${attachedCount} ảnh thành công`, "Thành công", "Success"); + $snackbar(`Đã thêm ${attachedCount} ảnh thành công`, "Success"); } } catch (error) { console.error("Error attaching images:", error); - $snackbar("Không thể thêm ảnh, vui lòng thử lại", "Lỗi", "Error"); + $snackbar("Không thể thêm ảnh, vui lòng thử lại", "Error"); } } @@ -297,10 +297,10 @@ async function deleteImage(image) { await $deleteapi(isForProduct.value ? "productfile" : "projectfile", image.id); await $deleteapi("file", image.file); loadImages(); - $snackbar("Đã xóa ảnh thành công", "Thành công", "Success"); + $snackbar("Đã xóa ảnh thành công", "Success"); } catch (error) { console.error("Error deleting image:", error); - $snackbar("Xóa ảnh không thành công", "Lỗi", "Error"); + $snackbar("Xóa ảnh không thành công", "Error"); } } @@ -317,7 +317,7 @@ async function excel() { found.url = "exportcsv/File/"; found.params.filter = { code__in: images.value.map((v) => v.file__code) }; const rs = await $getapi([found]); - if (rs === "error") return $snackbar("Đã xảy ra lỗi. Vui lòng thử lại."); + if (rs === "error") return $snackbar("Đã xảy ra lỗi. Vui lòng thử lại.", "Error"); const url = window.URL.createObjectURL(new Blob([rs[0].data])); const link = document.createElement("a"); const fileName = `${$dayjs(new Date()).format("YYYYMMDDhhmmss")}-data.csv`; diff --git a/app/components/media/Imagebox.vue b/app/components/media/Imagebox.vue index 6ee075c..7b611e6 100644 --- a/app/components/media/Imagebox.vue +++ b/app/components/media/Imagebox.vue @@ -308,7 +308,7 @@ export default { setTimeout(() => document.getElementById("url").focus(), 100); }, checkUrl() { - if (this.$empty(this.url)) return this.$snackbar(`Đường dẫn không hợp lệ`, undefined, "Error"); + if (this.$empty(this.url)) return this.$snackbar("Đường dẫn không hợp lệ", "Error"); let self = this; this.loading = true; this.$axios diff --git a/app/components/modal/DealerProductSetting.vue b/app/components/modal/DealerProductSetting.vue index 188eada..efa8616 100644 --- a/app/components/modal/DealerProductSetting.vue +++ b/app/components/modal/DealerProductSetting.vue @@ -76,11 +76,11 @@ async function confirmChange() { ); if (result === "error" || !result) { - $snackbar("Cập nhật thất bại", "Lỗi", "Error"); + $snackbar("Cập nhật thất bại", "Error"); return; } - $snackbar("Cập nhật trạng thái thành công", "Thành công", "Success"); + $snackbar("Cập nhật trạng thái thành công", "Success"); // Phát sự kiện để component cha (hoặc bảng) cập nhật lại dữ liệu emit("modalevent", { @@ -94,7 +94,7 @@ async function confirmChange() { close(); } catch (error) { console.error("Lỗi đổi trạng thái:", error); - $snackbar("Có lỗi xảy ra", "Lỗi", "Error"); + $snackbar("Có lỗi xảy ra", "Error"); } finally { isSaving.value = false; } diff --git a/app/components/parameter/ImportData.vue b/app/components/parameter/ImportData.vue index ee8f8ce..6382509 100644 --- a/app/components/parameter/ImportData.vue +++ b/app/components/parameter/ImportData.vue @@ -193,7 +193,7 @@ export default { let thefile = this.$upload(file, "file", 1); if (thefile.error) { - this.$snackbar(thefile.text, undefined, "Error"); + this.$snackbar(thefile.text, "Error"); return (this.isloading = false); } if (!(thefile.name.search(".xls") > 0 || thefile.name.search(".xlsx") > 0)) { diff --git a/app/components/people/PeopleInfo.vue b/app/components/people/PeopleInfo.vue index 6790a0b..b54d3a4 100644 --- a/app/components/people/PeopleInfo.vue +++ b/app/components/people/PeopleInfo.vue @@ -361,7 +361,7 @@ async function update() { ? await $updateapi("people", record.value) : await $insertapi("people", record.value, undefined, false); if (rs === "error") return; - if (!record.value.id) $snackbar(`Người liên quan đã được khởi tạo với mã ${rs.code}`, "Thành công", "Success"); + if (!record.value.id) $snackbar(`Người liên quan đã được khởi tạo với mã ${rs.code}`, "Success"); record.value.id = rs.id; if (record.value.image ? record.value.image.length > 0 : false) { let arr = []; diff --git a/app/components/people/PeopleView.vue b/app/components/people/PeopleView.vue index d7c9997..f20f157 100644 --- a/app/components/people/PeopleView.vue +++ b/app/components/people/PeopleView.vue @@ -203,7 +203,7 @@ export default { }, copy(value) { this.$copyToClipboard(value); - this.$snackbar("Đã copy vào clipboard.", "Copy", "Success"); + this.$snackbar("Đã copy vào clipboard.", "Success"); }, openPhone() { this.showmodal = { diff --git a/app/components/snackbar/Error.vue b/app/components/snackbar/Error.vue index 9ec2706..053991b 100644 --- a/app/components/snackbar/Error.vue +++ b/app/components/snackbar/Error.vue @@ -1,10 +1,12 @@