Skip to content

Commit

Permalink
Merge pull request #431 from techcomrade/fix-bug
Browse files Browse the repository at this point in the history
fix bug ui device, chat, registers
  • Loading branch information
hwt75 authored Jun 25, 2024
2 parents c1b84d6 + ffdc496 commit dab38e1
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 139 deletions.
11 changes: 11 additions & 0 deletions frontend_web/src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,14 @@ export const convertDeviceTypeColor = (status) => {
return "red";
}
};

export const convertRegisterStatusToString = ( status) => {
switch (status) {
case 0:
return "Đang chờ duyệt";
case 1:
return "Đã duyệt";
default:
return "Từ chối";
}
}
4 changes: 4 additions & 0 deletions frontend_web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

.ant-descriptions-item-label{
color: black !important;
}
2 changes: 1 addition & 1 deletion frontend_web/src/pages/Chat/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Chat = () => {
<div className="chat-container">
<div className="sidebar">
<div className="navbar">
<span className="logo">Chat</span>
<span className="logo">Danh sách bệnh nhân</span>
</div>
<div className="chats">
<div
Expand Down
5 changes: 3 additions & 2 deletions frontend_web/src/pages/Chat/chat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
.navbar {
display: flex;
align-items: center;
background-color: #4598f1;
// background-color: #4598f1;
height: 50px;
padding: 10px;
justify-content: space-between;
color: white;
color: #4693ff;

.logo {
font-weight: bold;
Expand Down Expand Up @@ -327,3 +327,4 @@
}
}
}

48 changes: 47 additions & 1 deletion frontend_web/src/pages/Device/deviceDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const DeviceDetailComponent = (props, ref) => {
device_name: 'Tên thiết bị',
device_type: 'Loại thiết bị',
frequency: "Tần số",
storage: "Lưu trữ dữ liệu",
connection: "Kiểu kết nối",
recordCount: "Số bản ghi",
status: "Trạng thái",
start_date: "Ngày bắt đầu",
Expand All @@ -74,14 +76,58 @@ const DeviceDetailComponent = (props, ref) => {
},
]

const storageColumns = [
{
title: 'Thông tin',
dataIndex: 'information',
key: 'information',
},
{
title: 'Dung lượng',
dataIndex: 'value',
key: 'value',
},
{
title: 'Loại lưu trữ',
dataIndex: 'detail_name',
key: 'detail_name',
},
]
const connectionColumns = [
{
title: 'Thông tin',
dataIndex: 'information',
key: 'information',
},
{
title: 'Tần số kết nối',
dataIndex: 'value',
key: 'value',
},
{
title: 'Kết nối',
dataIndex: 'detail_name',
key: 'detail_name',
},
]
const customDetail = {
frequency: (
<Table
columns={frequencyColumns}
dataSource={data.frequency}
pagination={false}
/>
)
),
storage: (<Table
columns={storageColumns}
dataSource={data.storage}
pagination={false}
/>),
connection: (<Table
columns={connectionColumns}
dataSource={data.connection}
pagination={false}
/>)
}

const customData = (
Expand Down
141 changes: 6 additions & 135 deletions frontend_web/src/pages/Register/registerTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { convertTimeToDate } from "../../utils/dateUtils";
import {
UserStatus,
convertGenderToString,
convertRegisterStatusToString,
convertRoleToString,
convertStatusToString,
convertStringToGender,
Expand Down Expand Up @@ -84,10 +85,13 @@ const RegisterTable = (props) => {
dataSelect: UserStatus,
isEdit: true,
render: (status) => {
let color = status === 0 ? "geekblue" : "volcano";
let color = "";
if(status === 2 ) color = "volcano";
if(status === 1) color = "#95ea78";
if( status === 0 ) color = "geekblue";
return (
<Tag color={color} key={status}>
{convertStatusToString(status)}
{convertRegisterStatusToString(status)}
</Tag>
);
},
Expand Down Expand Up @@ -170,137 +174,4 @@ const RegisterTable = (props) => {

export default RegisterTable;

// import { useDispatch, useSelector } from "react-redux";
// import DataTable from "../../components/Table/dataTable";
// import { useEffect, useRef, useState } from "react";
// import {
// getCheckRegister
// } from "../../redux/reducer/pdaSlice";
// import { findElementById, checkDateTypeKey } from "../../utils/arrayUtils";
// import { convertTimeToDate } from "../../utils/dateUtils";
// import { showNotiSuccess } from "../../components/Notification";
// import { ModalControlData } from "../../components/Modal/ModalControlData";
// import { httpGetData } from "../../api/common.api";
// import dayjs from "dayjs";

// const RegisterTable = () => {
// const dispatch = useDispatch();
// const dataState = useSelector((state) => state.register);
// const [dataTable, setData] = useState([]);
// const [selectedData, setSelectedData] = useState([]);

// const modalUpdateRef = useRef(null);
// const modalAddRef = useRef(null);

// const columns = [
// {
// title: "Họ và tên",
// dataIndex: "username",
// key: "username",
// type: "text",
// isEdit: true,
// },
// {
// title: "Giới tính",
// dataIndex: "gender",
// key: "gender",
// type: "select",
// dataSelect: GENDER,
// isEdit: true,
// },
// {
// title: "Ngày sinh",
// dataIndex: "birth",
// key: "birth",
// type: "date",
// isEdit: true,
// },
// {
// title: "Số điện thoại",
// dataIndex: "phone_number",
// key: "phone_number",
// type: "text",
// isEdit: true,
// },
// {
// title: "Tác vụ",
// dataIndex: "role",
// key: "role",
// type: "select",
// dataSelect: ROLE,
// isEdit: true,
// },
// {
// title: "Trạng thái",
// dataIndex: "status",
// key: "status",
// type: "select",
// dataSelect: UserStatus,
// isEdit: true,
// render: (status)=>{
// let color = status === 0 ? 'geekblue' : 'volcano'
// return ( <Tag color={color} key={status}>
// {convertStatusToString(status)}
// </Tag>)
// }
// }
// ];

// useEffect(() => {
// dispatch(getCheckRegister());
// }, []);

// // Get data
// useEffect(() => {
// if (dataState.loadDataStatus === loadStatus.Success) {
// const rawData = dataState.data.metadata;
// const data = rawData.map((element) => handleData(element, "render"));
// setData(data);
// }
// }, [dataState.loadDataStatus]);

// const handleData = (data, type) => {
// let pdaData = { ...data };

// if (type === "form") {
// Object.keys(data).forEach((key) => {
// if (checkDateTypeKey(key)) {
// pdaData[key] = dayjs(data[key], "DD/MM/YYYY");
// }
// });
// }

// if (type === "render") {
// Object.keys(data).forEach((key) => {
// if (checkDateTypeKey(key)) {
// pdaData[key] = convertTimeToDate(data[key]);
// }
// });
// }

// return pdaData;
// };

// return (
// <>
// <DataTable
// name="Bảng quản lý assignment"
// data={dataTable}
// column={columns}
// loading={dataState.loadDataStatus === loadStatus.Loading}
// />
// {/* <ModalControlData
// ref={modalAddRef}
// title="Thêm thiết bị mới"
// submitFunction={(data) => handleSubmitAddFunction(data)}
// />
// <ModalControlData
// ref={modalUpdateRef}
// title="Sửa thông tin bác sĩ điều trị bệnh nhân"
// submitFunction = {(data) => handleSubmitEditFunction(data)}
// /> */}
// </>
// );
// };

// export default RegisterTable;

0 comments on commit dab38e1

Please sign in to comment.