bug fixed
This commit is contained in:
parent
2e14579ec5
commit
67dab814ee
@ -20,7 +20,8 @@ const createEmptyCodeForm = () => ({
|
|||||||
code: '',
|
code: '',
|
||||||
product: '',
|
product: '',
|
||||||
unit: '',
|
unit: '',
|
||||||
status: '',
|
status: 'Active',
|
||||||
|
is_active: true,
|
||||||
createdBy: '',
|
createdBy: '',
|
||||||
createdOn: '',
|
createdOn: '',
|
||||||
updated: '',
|
updated: '',
|
||||||
@ -28,7 +29,7 @@ const createEmptyCodeForm = () => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Toast notification component
|
// Toast notification component
|
||||||
const Toast = ({ message, type = 'success', onClose, position = 'page' }) => {
|
const Toast = ({ message, type = 'success', onClose, position = 'modal' }) => {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
onClose();
|
onClose();
|
||||||
@ -370,7 +371,7 @@ const IsicHsCodes = () => {
|
|||||||
show: false,
|
show: false,
|
||||||
message: '',
|
message: '',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
position: 'page' // 'page' or 'modal'
|
position: 'modal' // 'page' or 'modal'
|
||||||
});
|
});
|
||||||
const [showImportModal, setShowImportModal] = React.useState(false);
|
const [showImportModal, setShowImportModal] = React.useState(false);
|
||||||
const [isRefreshing, setIsRefreshing] = React.useState(false);
|
const [isRefreshing, setIsRefreshing] = React.useState(false);
|
||||||
@ -784,7 +785,7 @@ const IsicHsCodes = () => {
|
|||||||
setForm(createEmptyCodeForm());
|
setForm(createEmptyCodeForm());
|
||||||
};
|
};
|
||||||
|
|
||||||
const showToast = (message, type = 'success', position = 'page') => {
|
const showToast = (message, type = 'success', position = 'modal') => {
|
||||||
setToast({ show: true, message, type, position });
|
setToast({ show: true, message, type, position });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setToast(prev => ({ ...prev, show: false }));
|
setToast(prev => ({ ...prev, show: false }));
|
||||||
@ -1393,14 +1394,14 @@ const IsicHsCodes = () => {
|
|||||||
|
|
||||||
{/* Form */}
|
{/* Form */}
|
||||||
<div className="p-6 space-y-4">
|
<div className="p-6 space-y-4">
|
||||||
{/* Modal-level toast */}
|
|
||||||
{toast.show && toast.position === 'modal' && (
|
{toast.show && toast.position === 'modal' && (
|
||||||
<Toast
|
<div className="w-full mb-4">
|
||||||
message={toast.message}
|
<Toast
|
||||||
type={toast.type}
|
message={toast.message}
|
||||||
position="modal"
|
type={toast.type}
|
||||||
onClose={() => setToast(prev => ({ ...prev, show: false }))}
|
onClose={() => setToast(prev => ({ ...prev, show: false }))}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user