diff --git a/src/core/json/siderbar_data.jsx b/src/core/json/siderbar_data.jsx
index 5c9f0c6..ade97db 100644
--- a/src/core/json/siderbar_data.jsx
+++ b/src/core/json/siderbar_data.jsx
@@ -65,14 +65,14 @@ export const SidebarData = [
{ label: "Create Product", link: "/add-product", icon: ,showSubRoute: false, submenu: false },
{ label: "Expired Products", link: "/expired-products", icon: ,showSubRoute: false,submenu: false },
{ label: "Low Stocks", link: "/low-stocks", icon: ,showSubRoute: false,submenu: false },
- { label: "Category", link: "/category-list", icon: ,showSubRoute: false,submenu: false },
+ { label: "Danh mục", link: "/category-list", icon: ,showSubRoute: false,submenu: false },
{ label: "Sub Category", link: "/sub-categories", icon: ,showSubRoute: false,submenu: false },
- { label: "Brands", link: "/brand-list", icon: ,showSubRoute: false,submenu: false },
+ { label: "Thương hiệu", link: "/brand-list", icon: ,showSubRoute: false,submenu: false },
{ label: "Units", link: "/units", icon: ,showSubRoute: false,submenu: false },
{ label: "Variant Attributes", link: "/variant-attributes", icon: ,showSubRoute: false,submenu: false },
- { label: "Warranties", link: "/warranty", icon: ,showSubRoute: false,submenu: false },
- { label: "Print Barcode", link: "/barcode", icon: , showSubRoute: false,submenu: false },
- { label: "Print QR Code", link: "/qrcode", icon: ,showSubRoute: false,submenu: false },
+ { label: "Bảo hành", link: "/warranty", icon: ,showSubRoute: false,submenu: false },
+ { label: "In Barcode", link: "/barcode", icon: , showSubRoute: false,submenu: false },
+ { label: "In QR Code", link: "/qrcode", icon: ,showSubRoute: false,submenu: false },
{ label: "Khách mời đám cưới", link: "/wedding-guest-list", icon: ,showSubRoute: false,submenu: false }
]
},
diff --git a/src/feature-module/projects/createproject.jsx b/src/feature-module/projects/createproject.jsx
index c79c4b1..3d666e4 100644
--- a/src/feature-module/projects/createproject.jsx
+++ b/src/feature-module/projects/createproject.jsx
@@ -65,7 +65,8 @@ const CreateProject = () => {
{ id: 1, name: 'Web Development', color: 'blue' },
{ id: 2, name: 'Mobile App', color: 'green' },
{ id: 3, name: 'Design', color: 'purple' },
- { id: 4, name: 'Marketing', color: 'orange' }
+ { id: 4, name: 'Marketing', color: 'orange' },
+ { id: 5, name: 'Khác', color: 'orange' },
]);
}
} catch (error) {
@@ -285,8 +286,8 @@ const CreateProject = () => {
-
Create New Project
- Add a new project to your workspace
+ Tạo dự án
+ Thêm một dự án mới vào không gian làm việc của bạn
@@ -308,19 +309,19 @@ const CreateProject = () => {
-
Project Information
+
Thông tin
-
Project Name *
+
Tên dự án *
handleInputChange('projectName', e.target.value)}
- placeholder="Enter project name"
+ placeholder="Nhập tên dự án"
/>
{errors.projectName &&
{errors.projectName}
}
@@ -328,13 +329,13 @@ const CreateProject = () => {
-
Client Name *
+
Đối tác *
handleInputChange('clientName', e.target.value)}
- placeholder="Enter client name"
+ placeholder="Nhập đối tác"
/>
{errors.clientName &&
{errors.clientName}
}
@@ -342,13 +343,13 @@ const CreateProject = () => {
-
Project Description *
+
Mô tả *
@@ -362,13 +363,13 @@ const CreateProject = () => {
-
Project Settings
+
Cấu hình mục tiêu
-
Category *
+
Danh mục *
handleInputChange('categoryId', value)}
@@ -389,7 +390,7 @@ const CreateProject = () => {
- Priority
+ Mức độ
handleInputChange('priority', value)}
@@ -397,15 +398,15 @@ const CreateProject = () => {
>
- Low Priority
+ Thấp
- Medium Priority
+ Trung bình
- High Priority
+ Ưu tiên
@@ -413,17 +414,17 @@ const CreateProject = () => {
- Status
+ Trạng thái
handleInputChange('status', value)}
className="project-select"
>
- Planning
- In Progress
- Review
- Completed
- On Hold
+ Dự định
+ Đang thực hiện
+ Xem xét
+ Hoàn thành
+ Tạm dừng
@@ -436,13 +437,13 @@ const CreateProject = () => {
-
Timeline, Budget & Progress
+
Thời gian, Ngân sách & Tiến độ
-
Start Date
+
Thời gian bắt đầu
handleInputChange('startDate', date)}
@@ -455,7 +456,7 @@ const CreateProject = () => {
-
End Date
+
Thời gian kết thúc
handleInputChange('endDate', date)}
@@ -469,7 +470,7 @@ const CreateProject = () => {
-
Budget *
+
Ngân sách *
@@ -488,7 +489,7 @@ const CreateProject = () => {
-
Progress Percentage
+
Phần trăm tiến độ
{
%
{errors.progressPercentage &&
{errors.progressPercentage}
}
-
Enter progress from 0 to 100
+
Nhập giá trị từ 0 đến 100
@@ -514,19 +515,19 @@ const CreateProject = () => {
-
Team Assignment
+
Phân công nhóm
- Project Manager
+ Người quản lý
handleInputChange('managers', value)}
className="project-select"
- placeholder="Select project manager(s) (Optional)"
+ placeholder="Chọn quản lý dự án"
optionLabelProp="label"
loading={usersLoading}
allowClear
@@ -543,19 +544,19 @@ const CreateProject = () => {
))}
- You can assign managers later
+ Bạn có thể chỉ định người quản lý sau
- Team Members
+ Thành viên
handleInputChange('teamMembers', value)}
className="project-select"
- placeholder="Select team members (Optional)"
+ placeholder="Chọn thành viên tham gia dự án"
optionLabelProp="label"
loading={usersLoading}
allowClear
@@ -572,7 +573,7 @@ const CreateProject = () => {
))}
- You can assign team members later
+ Bạn có thể chỉ định sau
diff --git a/src/feature-module/projects/projecttracker.jsx b/src/feature-module/projects/projecttracker.jsx
index ca7f52e..334ac09 100644
--- a/src/feature-module/projects/projecttracker.jsx
+++ b/src/feature-module/projects/projecttracker.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
-import { Table, Progress, Tag, Avatar, Button, DatePicker, Select, Spin } from 'antd';
+import { Table, Progress, Tag, Avatar, Button, DatePicker, Select, Spin, Modal, message } from 'antd';
import {
Star,
Edit,
@@ -162,6 +162,13 @@ const ProjectTracker = () => {
borderColor: '#f5222d',
textColor: '#f5222d',
icon: '⏸️'
+ },
+ 'review':{
+ color: '#1890ff',
+ backgroundColor: 'rgba(24, 144, 255, 0.1)',
+ borderColor: '#66a2a3',
+ textColor: '#ffffff',
+ icon: '📋'
}
};
@@ -179,6 +186,80 @@ const ProjectTracker = () => {
return statusMap[status] || status;
};
+ // Delete project function
+ const handleDeleteProject = async (projectId) => {
+ Modal.confirm({
+ title: 'Xác nhận xóa dự án',
+ content: 'Bạn có chắc chắn muốn xóa dự án này không? Hành động này không thể hoàn tác.',
+ okText: 'Xóa',
+ okType: 'danger',
+ cancelText: 'Hủy',
+ onOk: async () => {
+ try {
+ const apiBaseUrl = process.env.REACT_APP_API_BASE_URL || '';
+ console.log('🗑️ Deleting project:', projectId);
+
+ const response = await fetch(`${apiBaseUrl}Projects/delete/${projectId}`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json'
+ }
+ });
+
+ console.log('📡 Delete response status:', response.status);
+ console.log('📡 Delete response ok:', response.ok);
+
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}`);
+ }
+
+ // Try to parse JSON response
+ let result = null;
+ try {
+ const responseText = await response.text();
+ console.log('📄 Raw response text:', responseText);
+
+ if (responseText) {
+ result = JSON.parse(responseText);
+ console.log('✅ Parsed response:', result);
+ } else {
+ console.log('📄 Empty response body');
+ result = { success: true, message: 'Delete successful' };
+ }
+ } catch (parseError) {
+ console.log('⚠️ JSON parse error:', parseError.message);
+ // If JSON parsing fails but HTTP status is OK, consider it success
+ result = { success: true, message: 'Delete successful' };
+ }
+
+ // Check if response indicates success
+ const isSuccess = response.ok && (
+ !result ||
+ result.success !== false ||
+ result.status !== 'error'
+ );
+
+ if (isSuccess) {
+ console.log('✅ Delete operation successful');
+ message.success('Xóa dự án thành công!');
+
+ // Reload projects after successful deletion
+ loadProjects(currentPage, pageSize);
+ } else {
+ console.log('❌ Delete operation failed:', result);
+ const errorMessage = result?.message || result?.error || 'Unknown error occurred';
+ message.error('Xóa dự án thất bại: ' + errorMessage);
+ }
+
+ } catch (error) {
+ console.error('💥 Error deleting project:', error);
+ message.error('Có lỗi xảy ra khi xóa dự án: ' + error.message);
+ }
+ }
+ });
+ };
+
// Load data on component mount
useEffect(() => {
loadProjects();
@@ -210,7 +291,6 @@ const ProjectTracker = () => {
};
-
// Table columns configuration
const columns = [
{
@@ -242,7 +322,7 @@ const ProjectTracker = () => {
)
},
{
- title: 'Project Name',
+ title: 'Tên dự án',
dataIndex: 'projectName',
key: 'projectName',
render: (text) => (
@@ -261,7 +341,7 @@ const ProjectTracker = () => {
)
},
{
- title: 'Project Manager',
+ title: 'Quản lý',
dataIndex: 'manager',
key: 'manager',
render: (managers) => (
@@ -278,7 +358,7 @@ const ProjectTracker = () => {
)
},
{
- title: 'Start Date',
+ title: 'Bắt đầu',
dataIndex: 'startDate',
key: 'startDate',
render: (date) => (
@@ -304,7 +384,7 @@ const ProjectTracker = () => {
)
},
{
- title: 'Deadline',
+ title: 'Kết thúc',
dataIndex: 'deadline',
key: 'deadline',
render: (date) => (
@@ -341,7 +421,7 @@ const ProjectTracker = () => {
}
},
{
- title: 'Budget',
+ title: 'Ngân sách',
dataIndex: 'budget',
key: 'budget',
render: (budget) => (
@@ -352,11 +432,22 @@ const ProjectTracker = () => {
title: '',
key: 'actions',
width: 100,
- render: () => (
+ render: (_, record) => (
-
-
+ {
+ // TODO: Navigate to edit page
+ message.info('Edit functionality will be implemented');
+ }}
+ />
+ handleDeleteProject(record.id || record.key)}
+ />
)
@@ -381,8 +472,8 @@ const ProjectTracker = () => {
-
Project Tracker
- Manage Your Projects
+ Theo dõi tiến độ dự án
+ Quản lý dự án
@@ -392,7 +483,7 @@ const ProjectTracker = () => {
icon={
}
className="btn btn-added"
>
- Create New Project
+ Thêm mới
@@ -405,7 +496,7 @@ const ProjectTracker = () => {
- Project Lists
+ Danh sách dự án
@@ -455,12 +546,12 @@ const ProjectTracker = () => {
className="project-filter-select"
style={{ width: 140, height: 42 }}
>
-
Select Status
-
📋 Planning
-
✅ Completed
+
Chọn trạng thái
+
📋 Dự định
+
✅ Hoàn thành
⏳ Pending
-
🚀 In Progress
-
⏸️ On Hold
+
🚀 Hiện thực
+
⏸️ Tạm dừng