Di chuyển button BAUN trong chi tiết line
This commit is contained in:
parent
8b986232e6
commit
ec55c169ba
|
|
@ -525,13 +525,76 @@ const ModalTerminal = ({
|
||||||
<IconCircleCheckFilled color="green" fontSize={"18px"} />
|
<IconCircleCheckFilled color="green" fontSize={"18px"} />
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex mt="4px">
|
<Flex
|
||||||
<Text size="md" mr="6px">
|
mt="4px"
|
||||||
BAUD:
|
align="center"
|
||||||
</Text>
|
justify="space-between"
|
||||||
<Text size="md">
|
style={{ width: "100%" }}
|
||||||
<strong>{line?.baud || ""}</strong>
|
>
|
||||||
</Text>
|
<Flex align="center" gap="xs">
|
||||||
|
<Text size="md" mr="6px">
|
||||||
|
BAUD:
|
||||||
|
</Text>
|
||||||
|
<Text size="md">
|
||||||
|
<strong>{line?.baud || ""}</strong>
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
<Menu
|
||||||
|
closeOnItemClick={false}
|
||||||
|
closeOnClickOutside={false}
|
||||||
|
trigger="hover"
|
||||||
|
shadow="md"
|
||||||
|
position="right"
|
||||||
|
>
|
||||||
|
<Menu.Target>
|
||||||
|
<Button
|
||||||
|
fw={400}
|
||||||
|
disabled={isDisable}
|
||||||
|
variant="filled"
|
||||||
|
size="xs"
|
||||||
|
style={{
|
||||||
|
height: "26px",
|
||||||
|
width: "80px",
|
||||||
|
marginRight: "20px",
|
||||||
|
}}
|
||||||
|
onClick={() => {}}
|
||||||
|
>
|
||||||
|
BAUD
|
||||||
|
</Button>
|
||||||
|
</Menu.Target>
|
||||||
|
<Menu.Dropdown style={{ width: "110px" }}>
|
||||||
|
<Flex
|
||||||
|
justify={"space-between"}
|
||||||
|
direction={"column"}
|
||||||
|
style={{
|
||||||
|
gap: "8px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{listBaudDefault.map((el, i) => (
|
||||||
|
<Button
|
||||||
|
key={i}
|
||||||
|
disabled={isDisable}
|
||||||
|
variant="outline"
|
||||||
|
size="xs"
|
||||||
|
onClick={() => {
|
||||||
|
if (!line) return;
|
||||||
|
socket?.emit("change_baud", {
|
||||||
|
stationId: line?.stationId || line?.station_id,
|
||||||
|
lineId: line?.id,
|
||||||
|
baud: el,
|
||||||
|
});
|
||||||
|
setIsDisable(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setIsDisable(false);
|
||||||
|
}, 5000);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{el}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</Flex>
|
||||||
|
</Menu.Dropdown>
|
||||||
|
</Menu>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex mt="4px" align="center">
|
<Flex mt="4px" align="center">
|
||||||
<Text size="md" mr="6px">
|
<Text size="md" mr="6px">
|
||||||
|
|
@ -874,79 +937,6 @@ const ModalTerminal = ({
|
||||||
</Box>
|
</Box>
|
||||||
</Menu.Dropdown>
|
</Menu.Dropdown>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Menu
|
|
||||||
closeOnItemClick={false}
|
|
||||||
closeOnClickOutside={false}
|
|
||||||
trigger="hover"
|
|
||||||
shadow="md"
|
|
||||||
position="top"
|
|
||||||
>
|
|
||||||
<Menu.Target>
|
|
||||||
<Button
|
|
||||||
fw={400}
|
|
||||||
disabled={isDisable}
|
|
||||||
variant="filled"
|
|
||||||
size="xs"
|
|
||||||
style={{ height: "30px", width: "100px" }}
|
|
||||||
onClick={() => {}}
|
|
||||||
>
|
|
||||||
BAUD
|
|
||||||
</Button>
|
|
||||||
</Menu.Target>
|
|
||||||
<Menu.Dropdown style={{ width: "110px" }}>
|
|
||||||
<Flex
|
|
||||||
justify={"space-between"}
|
|
||||||
direction={"column"}
|
|
||||||
style={{
|
|
||||||
gap: "8px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{listBaudDefault.map((el, i) => (
|
|
||||||
<Button
|
|
||||||
key={i}
|
|
||||||
disabled={isDisable}
|
|
||||||
variant="outline"
|
|
||||||
size="xs"
|
|
||||||
fw={400}
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
socket?.emit("set_baud", {
|
|
||||||
lineId: line?.id,
|
|
||||||
baud: el,
|
|
||||||
stationId: Number(stationItem?.id),
|
|
||||||
});
|
|
||||||
setIsDisable(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsDisable(false);
|
|
||||||
}, 5000);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{el}
|
|
||||||
</Button>
|
|
||||||
))}
|
|
||||||
<Input
|
|
||||||
placeholder="Custom"
|
|
||||||
value={valueBaud}
|
|
||||||
onChange={(e) => setValueBaud(e.target.value)}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === "Enter") {
|
|
||||||
socket?.emit("set_baud", {
|
|
||||||
lineId: line?.id,
|
|
||||||
baud: Number(valueBaud),
|
|
||||||
stationId: Number(stationItem?.id),
|
|
||||||
});
|
|
||||||
setValueBaud("");
|
|
||||||
setIsDisable(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsDisable(false);
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Flex>
|
|
||||||
</Menu.Dropdown>
|
|
||||||
</Menu>
|
|
||||||
<Button
|
<Button
|
||||||
disabled={true}
|
disabled={true}
|
||||||
fw={400}
|
fw={400}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue