Commit 307b4245 by tungnq

TODO: Điều chỉnh giao diện button

parent 9ce41d07
...@@ -86,6 +86,171 @@ const ListWork = props => { ...@@ -86,6 +86,171 @@ const ListWork = props => {
'Văn bản thông báo lịch nộp thời khóa biểu của học kỳ 2 năm 2025', 'Văn bản thông báo lịch nộp thời khóa biểu của học kỳ 2 năm 2025',
workProgress: 'Đang thực hiện', workProgress: 'Đang thực hiện',
}, },
{
id: 6,
title: 'Cập nhật đề cương môn CSDL nâng cao',
status: 'Đang thực hiện',
deadline: '2025-09-10',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'BM301, Phòng Đào tạo',
workProgress: 'Đang thực hiện',
},
{
id: 7,
title: 'Bổ sung tài liệu tham khảo môn Mạng máy tính',
status: 'Cần chỉnh sửa',
deadline: '2025-09-12',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Công văn 12/MN',
workProgress: 'Đã hoàn thành',
},
{
id: 8,
title: 'Chuẩn bị lịch thi giữa kỳ Khoa CNTT',
status: 'Đợi báo cáo',
deadline: '2025-09-15',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'BM-Exam-2025',
workProgress: 'Đã hoàn thành',
},
{
id: 9,
title: 'Rà soát nội dung slide môn Lập trình di động',
status: 'Chờ duyệt',
deadline: '2025-09-11',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Slide_v2.pptx',
workProgress: 'Đã hoàn thành',
},
{
id: 10,
title: 'Hoàn thiện đề cương môn AI ứng dụng',
status: 'Hoàn thành',
deadline: '2025-09-05',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'AI-Syllabus-Final.pdf',
workProgress: 'Đang thực hiện',
},
{
id: 11,
title: 'Theo dõi tiến độ cập nhật website khoa',
status: 'Đang thực hiện',
deadline: '2025-09-18',
assignedToMe: false,
supervisedByMe: true,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Biên bản họp 09/2025',
workProgress: 'Đang thực hiện',
},
{
id: 12,
title: 'Yêu cầu chỉnh sửa báo cáo đề tài nghiên cứu',
status: 'Đợi chỉnh sửa',
deadline: '2025-09-20',
assignedToMe: false,
supervisedByMe: true,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Report-Draft.docx',
workProgress: 'Đã hoàn thành',
},
{
id: 13,
title: 'Giám sát thu thập minh chứng kiểm định',
status: 'Đợi báo cáo',
deadline: '2025-09-22',
assignedToMe: false,
supervisedByMe: true,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Checklist-KDCL.xlsx',
workProgress: 'Đã hoàn thành',
},
{
id: 14,
title: 'Phê duyệt lịch seminar học kỳ 1',
status: 'Chờ duyệt',
deadline: '2025-09-13',
assignedToMe: false,
supervisedByMe: true,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'SeminarPlan.docx',
workProgress: 'Đang thực hiện',
},
{
id: 15,
title: 'Nghiệm thu giáo trình Nhập môn CNTT',
status: 'Hoàn thành',
deadline: '2025-09-03',
assignedToMe: false,
supervisedByMe: true,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Textbook-Final.pdf',
workProgress: 'Đã hoàn thành',
},
{
id: 16,
title: 'Soạn đề bài lab React Native tuần 3',
status: 'Đang thực hiện',
deadline: '2025-09-16',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'RN-Lab3.md',
workProgress: 'Đang thực hiện',
},
{
id: 17,
title: 'Sửa lỗi bài tập lớn nhóm 2',
status: 'Cần chỉnh sửa',
deadline: '2025-09-17',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Issue#127',
workProgress: 'Đang thực hiện',
},
{
id: 18,
title: 'Giám sát cập nhật slide môn Big Data',
status: 'Đợi chỉnh sửa',
deadline: '2025-09-19',
assignedToMe: false,
supervisedByMe: true,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'BigData-Slides-v1.pptx',
workProgress: 'Đang thực hiện',
},
{
id: 19,
title: 'Hoàn thiện biên bản họp tổ bộ môn',
status: 'Đợi báo cáo',
deadline: '2025-09-14',
assignedToMe: true,
supervisedByMe: false,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Minutes-Dept-0909.docx',
workProgress: 'Đang thực hiện',
},
{
id: 20,
title: 'Xét duyệt danh sách đồ án tốt nghiệp',
status: 'Chờ duyệt',
deadline: '2025-09-21',
assignedToMe: false,
supervisedByMe: true,
supervisor: [{id: 1, name: 'Trần Văn Hùng'}, {id: 2, name: 'Nguyễn Văn A'}],
document: 'Thesis-List.xlsx',
workProgress: 'Chờ duyệt',
},
]); ]);
// ==================== MODAL HANDLERS ==================== // ==================== MODAL HANDLERS ====================
...@@ -210,58 +375,95 @@ const ListWork = props => { ...@@ -210,58 +375,95 @@ const ListWork = props => {
}; };
// Lấy danh sách button theo trạng thái công việc // Lấy danh sách button theo trạng thái công việc
const getButtonsForStatus = status => { const getButtonsForStatus = (status, workItem) => {
// Đang giám sát // Đang giám sát
if (currentTabKey === ROLE.SUPERVISOR) { if (currentTabKey === ROLE.SUPERVISOR) {
switch (status) { return getButtonsForSupervisor(status);
case 'Đang thực hiện':
return [
{title: 'Yêu cầu báo cáo', backgroundColor: R.colors.orange, action: 'requestReport'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Đợi chỉnh sửa':
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
case 'Chờ duyệt':
return [
{title: 'Cần chỉnh sửa', backgroundColor: R.colors.orange, action: 'needsEdit'},
{title: 'Phê duyệt', backgroundColor: R.colors.blue, action: 'approve'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Đợi báo cáo':
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
case 'Đã hoàn thành':
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
default:
return [];
}
} }
// Giao cho tôi // Giao cho tôi
if (currentTabKey === ROLE.ASSIGNEE) { if (currentTabKey === ROLE.ASSIGNEE) {
switch (status) { return getButtonsForAssignee(status);
case 'Đang thực hiện': }
case 'Cần chỉnh sửa':
case 'Đợi báo cáo': // Tất cả - hiển thị buttons theo role của từng công việc
return [ if (currentTabKey === ROLE.ALL) {
{title: 'Báo cáo', backgroundColor: R.colors.orange, action: 'report'}, // Nếu công việc được giao cho tôi
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}, if (workItem.assignedToMe) {
]; return getButtonsForAssignee(status);
case 'Chờ duyệt': }
return [ // Nếu tôi đang giám sát công việc này
{title: 'Sửa báo cáo', backgroundColor: R.colors.orange, action: 'editReport'}, if (workItem.supervisedByMe) {
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}, return getButtonsForSupervisor(status);
];
case 'Hoàn thành':
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
default:
return [];
} }
} }
// Tất cả - hiển thị tất cả buttons có thể
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}]; return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
}; };
// Helper function cho buttons của Supervisor
const getButtonsForSupervisor = (status) => {
switch (status) {
case 'Đang thực hiện':
// Supervisor có thể yêu cầu báo cáo từ người được giao việc
return [
{title: 'Yêu cầu báo cáo', backgroundColor: R.colors.orange, action: 'requestReport'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Đợi chỉnh sửa':
// Đang chờ người được giao việc chỉnh sửa
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
case 'Chờ duyệt':
// Supervisor cần phê duyệt hoặc yêu cầu chỉnh sửa
return [
{title: 'Cần chỉnh sửa', backgroundColor: R.colors.orange, action: 'needsEdit'},
{title: 'Phê duyệt', backgroundColor: R.colors.green, action: 'approve'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Đợi báo cáo':
// Đang chờ người được giao việc nộp báo cáo
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
case 'Hoàn thành':
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
default:
return [];
}
};
// Helper function cho buttons của Assignee
const getButtonsForAssignee = (status) => {
switch (status) {
case 'Đang thực hiện':
// Người được giao việc đang thực hiện và có thể nộp báo cáo
return [
{title: 'Báo cáo', backgroundColor: R.colors.orange, action: 'report'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Cần chỉnh sửa':
// Supervisor yêu cầu chỉnh sửa, người được giao việc cần báo cáo lại
return [
{title: 'Báo cáo', backgroundColor: R.colors.orange, action: 'report'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Đợi báo cáo':
// Supervisor yêu cầu báo cáo, người được giao việc cần nộp báo cáo
return [
{title: 'Báo cáo', backgroundColor: R.colors.orange, action: 'report'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Chờ duyệt':
// Đã nộp báo cáo, đang chờ supervisor duyệt, có thể sửa báo cáo
return [
{title: 'Sửa báo cáo', backgroundColor: R.colors.orange, action: 'editReport'},
{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'},
];
case 'Hoàn thành':
return [{title: 'Chi tiết', backgroundColor: R.colors.blue, action: 'detail'}];
default:
return [];
}
};
const [tabView, setTabView] = useState([ const [tabView, setTabView] = useState([
{key: ROLE.ALL, label: 'Tất cả'}, {key: ROLE.ALL, label: 'Tất cả'},
{key: ROLE.ASSIGNEE, label: 'Giao cho tôi'}, {key: ROLE.ASSIGNEE, label: 'Giao cho tôi'},
......
...@@ -53,8 +53,7 @@ const ListWorkView = props => { ...@@ -53,8 +53,7 @@ const ListWorkView = props => {
}; };
const renderActionButtons = item => { const renderActionButtons = item => {
const buttons = getButtonsForStatus(item.status, item);
const buttons = getButtonsForStatus(item.status);
return buttons.map((button, index) => ( return buttons.map((button, index) => (
<Button <Button
...@@ -71,7 +70,7 @@ const ListWorkView = props => { ...@@ -71,7 +70,7 @@ const ListWorkView = props => {
textColor={R.colors.white} textColor={R.colors.white}
fontSize={R.fontsize.fontSizeContent} fontSize={R.fontsize.fontSizeContent}
height={30} height={30}
width={120} width={100}
containerStyle={{marginRight: 10, borderRadius: 20}} containerStyle={{marginRight: 10, borderRadius: 20}}
/> />
)); ));
......
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