feat(sgw): Add new services and utilities for ship, trip, and photo management

This commit is contained in:
Lê Tuấn Anh
2026-01-23 15:18:02 +07:00
parent e5b388505a
commit 1a06328c77
75 changed files with 9749 additions and 8 deletions

View File

@@ -0,0 +1,62 @@
import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
import { Button, Popconfirm, Tooltip } from 'antd';
import { useState } from 'react';
/* =======================
DeleteButton
======================= */
interface DeleteButtonProps {
title: string;
text: string;
onOk: () => void | Promise<void>;
}
export const DeleteButton: React.FC<DeleteButtonProps> = ({
title,
text,
onOk,
}) => {
const [visible, setVisible] = useState<boolean>(false);
const handleConfirm = async () => {
await onOk();
setVisible(false);
};
return (
<Popconfirm
title={title}
open={visible}
onConfirm={handleConfirm}
onCancel={() => setVisible(false)}
>
<Tooltip title={text}>
<Button
size="small"
danger
type="primary"
icon={<DeleteOutlined />}
onClick={() => setVisible(true)}
/>
</Tooltip>
</Popconfirm>
);
};
/* =======================
EditButton
======================= */
interface EditButtonProps {
text: string;
onClick: () => void;
}
export const EditButton: React.FC<EditButtonProps> = ({ text, onClick }) => {
return (
<Tooltip title={text}>
<Button size="small" icon={<EditOutlined />} onClick={onClick} />
</Tooltip>
);
};