From b771b56194cb6d8040bd7b9d958625a408ebedac Mon Sep 17 00:00:00 2001 From: MxnlodyX Date: Tue, 24 Mar 2026 20:49:54 +0700 Subject: [PATCH 1/4] fix : change thai lang to eng --- client/src/components/ui/ErrorAlert.jsx | 4 +- client/src/components/ui/LoadingSpinner.jsx | 2 +- client/src/pages/UsersPage.jsx | 2 +- client/src/pages/backoffice/HRM.jsx | 112 +++++++++--------- client/src/pages/backoffice/InventoryPage.jsx | 82 ++++++------- .../src/pages/backoffice/PatrolAreasPage.jsx | 14 +-- client/src/pages/field-ops/mockData.js | 6 +- 7 files changed, 111 insertions(+), 111 deletions(-) diff --git a/client/src/components/ui/ErrorAlert.jsx b/client/src/components/ui/ErrorAlert.jsx index e1b916d..15636a8 100644 --- a/client/src/components/ui/ErrorAlert.jsx +++ b/client/src/components/ui/ErrorAlert.jsx @@ -1,4 +1,4 @@ -export function ErrorAlert({ title = 'เกิดข้อผิดพลาด', message, onRetry }) { +export function ErrorAlert({ title = 'An error occurred', message, onRetry }) { return (
diff --git a/client/src/pages/UsersPage.jsx b/client/src/pages/UsersPage.jsx index 77f5b71..6f9dcc4 100644 --- a/client/src/pages/UsersPage.jsx +++ b/client/src/pages/UsersPage.jsx @@ -12,7 +12,7 @@ export function UsersPage() { Users - {loading && } + {loading && } {error && } diff --git a/client/src/pages/backoffice/HRM.jsx b/client/src/pages/backoffice/HRM.jsx index af494d1..feff8d2 100644 --- a/client/src/pages/backoffice/HRM.jsx +++ b/client/src/pages/backoffice/HRM.jsx @@ -92,18 +92,18 @@ export function HRMDashboard() { e.preventDefault(); if (isUploadingImage) { - showToast('กำลังอัปโหลดรูปภาพ กรุณารอสักครู่...', 'error'); + showToast('Uploading image, please wait...', 'error'); return; } // ตรวจสอบฟิลด์บังคับ if (!formData.name || !formData.username || !formData.title || !formData.role) { - showToast('กรุณากรอกข้อมูลที่จำเป็นให้ครบถ้วน', 'error'); + showToast('Please fill in all required fields.', 'error'); return; } if (modalType === 'ADD' && !formData.password) { - showToast('กรุณากำหนดรหัสผ่านสำหรับพนักงานใหม่', 'error'); + showToast('Please set a password for the new staff member.', 'error'); return; } @@ -123,19 +123,19 @@ export function HRMDashboard() { if (modalType === 'ADD') { await api.post('/api/add_new_staff', payload); - showToast('เพิ่มพนักงานสำเร็จ!', 'success'); + showToast('Staff member added successfully!', 'success'); } else if (modalType === 'EDIT') { await api.put('/api/edit_staff', { ...payload, staff_id: selectedStaff.id, }); - showToast('อัปเดตข้อมูลพนักงานสำเร็จ!', 'success'); + showToast('Staff information updated successfully!', 'success'); } fetchStaff(); closeModal(); } catch (error) { - showToast(error.message || 'ไม่สามารถบันทึกข้อมูลได้', 'error'); + showToast(error.message || 'Unable to save data.', 'error'); } finally { setIsSubmitting(false); } @@ -146,11 +146,11 @@ export function HRMDashboard() { try { setIsSubmitting(true); await api.delete(`/api/delete_staff/${selectedStaff.id}`); - showToast('ลบพนักงานสำเร็จ', 'success'); + showToast('Staff member deleted successfully.', 'success'); fetchStaff(); closeModal(); } catch (error) { - showToast(error.message || 'ไม่สามารถลบข้อมูลได้', 'error'); + showToast(error.message || 'Unable to delete data.', 'error'); } finally { setIsSubmitting(false); } @@ -180,13 +180,13 @@ export function HRMDashboard() { const allowedMimeTypes = ['image/png', 'image/jpeg', 'image/webp']; if (!allowedMimeTypes.includes(file.type)) { - showToast('รองรับเฉพาะไฟล์ JPG, PNG หรือ WEBP เท่านั้น', 'error'); + showToast('Only JPG, PNG, or WEBP files are supported.', 'error'); e.target.value = ''; return; } if (file.size > 5 * 1024 * 1024) { - showToast('ขนาดไฟล์ต้องไม่เกิน 5MB', 'error'); + showToast('File size must not exceed 5MB.', 'error'); e.target.value = ''; return; } @@ -200,7 +200,7 @@ export function HRMDashboard() { setFormData((prev) => ({ ...prev, image: result.image_url })); } catch (error) { - showToast(error.message || 'ไม่สามารถอัปโหลดรูปภาพได้', 'error'); + showToast(error.message || 'Unable to upload image.', 'error'); } finally { setIsUploadingImage(false); e.target.value = ''; @@ -213,11 +213,11 @@ export function HRMDashboard() {

Staff Management (HRM)

-

จัดการรายชื่อเจ้าหน้าที่ สิทธิ์การใช้งาน และสถานะปัจจุบัน

+

Manage staff directory, access roles, and current duty status.

@@ -225,7 +225,7 @@ export function HRMDashboard() {
-

เจ้าหน้าที่ทั้งหมด

+

Total Staff

{stats.total}

@@ -260,7 +260,7 @@ export function HRMDashboard() { setSearchQuery(e.target.value)} @@ -283,24 +283,24 @@ export function HRMDashboard() { - - - - - + + + + + {isLoading ? ( ) : filteredStaff.length === 0 ? ( ) : ( @@ -334,9 +334,9 @@ export function HRMDashboard() { @@ -350,7 +350,7 @@ export function HRMDashboard() {
เจ้าหน้าที่บทบาทสถานะติดต่อจัดการStaffRoleStatusContactActions
- กำลังโหลดข้อมูลพนักงาน... + Loading staff data...
- ไม่พบข้อมูลพนักงาน + No staff records found.
{staff.contact || '-'}
- - - + + +
- - - - + + + + @@ -492,7 +492,7 @@ export function InventoryPage() { ) : ( @@ -522,7 +522,7 @@ export function InventoryPage() { @@ -530,7 +530,7 @@ export function InventoryPage() { @@ -538,7 +538,7 @@ export function InventoryPage() { @@ -558,29 +558,29 @@ export function InventoryPage() {
-

{editingItem ? 'แก้ไขอุปกรณ์' : 'ลงทะเบียนอุปกรณ์ใหม่'}

+

{editingItem ? 'Edit Item' : 'Register New Item'}

- - setFormData({...formData, assetId: e.target.value})} className="w-full p-2 border border-gray-300 rounded-lg text-sm" placeholder="เช่น MASK-001" /> + + setFormData({...formData, assetId: e.target.value})} className="w-full p-2 border border-gray-300 rounded-lg text-sm" placeholder="e.g. MASK-001" />
- - setFormData({...formData, name: e.target.value})} className="w-full p-2 border border-gray-300 rounded-lg text-sm" placeholder="เช่น N95 Respirator" /> + + setFormData({...formData, name: e.target.value})} className="w-full p-2 border border-gray-300 rounded-lg text-sm" placeholder="e.g. N95 Respirator" />
- +
- - + +
@@ -592,39 +592,39 @@ export function InventoryPage() {
-

จัดการสถานะ / ผู้เบิก

+

Manage Status / Assignee

-

กำลังจัดการอุปกรณ์

+

Managing item

{formData.assetId} - {formData.name}

- +
{/* แปลงจาก Input ธรรมดาเป็น Dropdown เลือกพนักงาน */} {formData.status === 'In Use' && (
- + + +
- - + +
diff --git a/client/src/pages/backoffice/PatrolAreasPage.jsx b/client/src/pages/backoffice/PatrolAreasPage.jsx index e28e36f..45c26aa 100644 --- a/client/src/pages/backoffice/PatrolAreasPage.jsx +++ b/client/src/pages/backoffice/PatrolAreasPage.jsx @@ -218,7 +218,7 @@ export function PatrolAreasPage() {

Patrol Areas

- จัดการจุด Location ในป่า ว่าจุดไหนอยู่ตรงไหน และจุดนั้นคืออะไร + Manage forest location points, including where they are and what each point represents.

) : ( @@ -398,7 +398,7 @@ export function PatrolAreasPage() {
รหัสอุปกรณ์ (Unique ID)ชื่ออุปกรณ์สถานะผู้ใช้งานปัจจุบันItem ID (Unique ID)Item NameStatusCurrent Assignee Actions
- ไม่พบข้อมูลอุปกรณ์ + No inventory records found.
- ยังไม่พบ Location ที่ตรงกับเงื่อนไขค้นหา + No locations match your search criteria.