real-boxing
This commit is contained in:
@@ -19,7 +19,7 @@ import useRequest from '@/hooks/useRequest';
|
||||
import { file_service } from '@/services/file-service';
|
||||
import { notifyUnknownError } from '@/services/notification';
|
||||
import { getBoxStatusStyles, getStatusColor } from '@/theme/getStatusBoxStyles';
|
||||
import { Add, AddCircleOutline, Circle, Delete, Download, Edit, FilterList, FilterListOff, Search, PlusOne } from '@mui/icons-material';
|
||||
import { Add, QrCode, AddCircleOutline, Circle, Delete, Download, Edit, FilterList, FilterListOff, Search, PlusOne } from '@mui/icons-material';
|
||||
import { Box, Button, Stack, Tooltip, Typography } from '@mui/material';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
@@ -84,7 +84,6 @@ const DashboardRealBoxesPage = (props: Props) => {
|
||||
}
|
||||
}, [getBoxesQuery]);
|
||||
const loading = getBoxesQuery.loading;
|
||||
|
||||
const handleChange = (newPage: number) => {
|
||||
setTimeout(() => {
|
||||
setPage(newPage);
|
||||
@@ -158,39 +157,23 @@ const DashboardRealBoxesPage = (props: Props) => {
|
||||
},
|
||||
},
|
||||
{
|
||||
dataKey: 'id',
|
||||
label: "Qo'shish",
|
||||
label: t("qr_code"),
|
||||
width: 120,
|
||||
renderCell: data => {
|
||||
return <Button onClick={() => navigation.push(pageLinks.dashboard.boxes.edit(data.id))}>
|
||||
<Add />
|
||||
return <Button>
|
||||
<QrCode />
|
||||
</Button>;
|
||||
},
|
||||
},
|
||||
{
|
||||
dataKey: 'partyName',
|
||||
label: t('party_name'),
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
dataKey: 'name',
|
||||
label: t('name'),
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
dataKey: 'packetNetWeight',
|
||||
label: t("weight"),
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
dataKey: 'totalItems',
|
||||
label: t('count_of_items'),
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
dataKey: 'totalNetWeight',
|
||||
label: t("party_weight"),
|
||||
dataKey: 'id',
|
||||
label: t("add_more"),
|
||||
width: 120,
|
||||
renderCell: data => {
|
||||
return <Button onClick={() => navigation.push(pageLinks.dashboard.real_boxes.edit(data.id))}>
|
||||
<Add />
|
||||
</Button>;
|
||||
},
|
||||
},
|
||||
{
|
||||
dataKey: 'cargoId',
|
||||
@@ -198,73 +181,98 @@ const DashboardRealBoxesPage = (props: Props) => {
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
dataKey: 'passportName',
|
||||
label: t('client'),
|
||||
dataKey: 'partyName',
|
||||
label: t('party_name'),
|
||||
width: 120,
|
||||
},
|
||||
// {
|
||||
// dataKey: 'name',
|
||||
// label: t('name'),
|
||||
// width: 120,
|
||||
// },
|
||||
// {
|
||||
// dataKey: 'packetNetWeight',
|
||||
// label: t("weight"),
|
||||
// width: 120,
|
||||
// },
|
||||
{
|
||||
dataKey: 'status',
|
||||
label: t('status'),
|
||||
width: 240,
|
||||
renderHeaderCell(rowIndex) {
|
||||
return (
|
||||
<Stack direction={'row'} alignItems={'center'}>
|
||||
<span>{t('box_status')}</span>
|
||||
<ActionPopMenu
|
||||
buttons={BoxStatusList.map(stat => {
|
||||
return {
|
||||
icon: <Circle sx={{ path: { color: getStatusColor(stat) } }} />,
|
||||
label: t(stat),
|
||||
onClick() {
|
||||
setBoxStatusFilter(stat);
|
||||
setPage(1);
|
||||
},
|
||||
};
|
||||
})}
|
||||
mainIcon={<FilterList />}
|
||||
placement={{
|
||||
anchorOrigin: {
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center',
|
||||
},
|
||||
transformOrigin: {
|
||||
horizontal: 'center',
|
||||
vertical: 'top',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
renderCell(data) {
|
||||
return (
|
||||
<StatusChangePopup
|
||||
anchor={{
|
||||
status: data.status,
|
||||
text: t(data.status),
|
||||
}}
|
||||
loading={changeStatusIds.includes(data.id)}
|
||||
buttons={boxStatusOptions.map(stat => {
|
||||
return {
|
||||
icon: (
|
||||
<Circle
|
||||
sx={{
|
||||
path: {
|
||||
color: getStatusColor(stat),
|
||||
},
|
||||
}}
|
||||
/>
|
||||
),
|
||||
label: t(stat),
|
||||
onClick: () => {
|
||||
onChangeStatus(data.id, stat);
|
||||
},
|
||||
};
|
||||
})}
|
||||
/>
|
||||
);
|
||||
},
|
||||
dataKey: 'totalItems',
|
||||
label: t('count_of_items'),
|
||||
width: 120,
|
||||
},
|
||||
// {
|
||||
// dataKey: 'totalNetWeight',
|
||||
// label: t("party_weight"),
|
||||
// width: 120,
|
||||
// },
|
||||
// {
|
||||
// dataKey: 'passportName',
|
||||
// label: t('client'),
|
||||
// width: 120,
|
||||
// },
|
||||
// {
|
||||
// dataKey: 'status',
|
||||
// label: t('status'),
|
||||
// width: 240,
|
||||
// renderHeaderCell(rowIndex) {
|
||||
// return (
|
||||
// <Stack direction={'row'} alignItems={'center'}>
|
||||
// <span>{t('box_status')}</span>
|
||||
// <ActionPopMenu
|
||||
// buttons={BoxStatusList.map(stat => {
|
||||
// return {
|
||||
// icon: <Circle sx={{ path: { color: getStatusColor(stat) } }} />,
|
||||
// label: t(stat),
|
||||
// onClick() {
|
||||
// setBoxStatusFilter(stat);
|
||||
// setPage(1);
|
||||
// },
|
||||
// };
|
||||
// })}
|
||||
// mainIcon={<FilterList />}
|
||||
// placement={{
|
||||
// anchorOrigin: {
|
||||
// vertical: 'bottom',
|
||||
// horizontal: 'center',
|
||||
// },
|
||||
// transformOrigin: {
|
||||
// horizontal: 'center',
|
||||
// vertical: 'top',
|
||||
// },
|
||||
// }}
|
||||
// />
|
||||
// </Stack>
|
||||
// );
|
||||
// },
|
||||
// renderCell(data) {
|
||||
// return (
|
||||
// <StatusChangePopup
|
||||
// anchor={{
|
||||
// status: data.status,
|
||||
// text: t(data.status),
|
||||
// }}
|
||||
// loading={changeStatusIds.includes(data.id)}
|
||||
// buttons={boxStatusOptions.map(stat => {
|
||||
// return {
|
||||
// icon: (
|
||||
// <Circle
|
||||
// sx={{
|
||||
// path: {
|
||||
// color: getStatusColor(stat),
|
||||
// },
|
||||
// }}
|
||||
// />
|
||||
// ),
|
||||
// label: t(stat),
|
||||
// onClick: () => {
|
||||
// onChangeStatus(data.id, stat);
|
||||
// },
|
||||
// };
|
||||
// })}
|
||||
// />
|
||||
// );
|
||||
// },
|
||||
// },
|
||||
{
|
||||
label: '',
|
||||
width: 100,
|
||||
@@ -277,7 +285,7 @@ const DashboardRealBoxesPage = (props: Props) => {
|
||||
icon: <Edit sx={{ path: { color: '#3489E4' } }} />,
|
||||
label: t('edit'),
|
||||
onClick: () => {
|
||||
navigation.push(pageLinks.dashboard.boxes.edit(data.id));
|
||||
navigation.push(pageLinks.dashboard.real_boxes.edit(data.id));
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -289,19 +297,15 @@ const DashboardRealBoxesPage = (props: Props) => {
|
||||
dontCloseOnClick: true,
|
||||
loading: deleteIds.includes(data.id),
|
||||
},
|
||||
...(data.status === 'READY'
|
||||
? [
|
||||
{
|
||||
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
|
||||
label: t('download_excel'),
|
||||
onClick: () => {
|
||||
onDownloadExcel(data.id);
|
||||
},
|
||||
loading: downloadIds.includes(data.id),
|
||||
dontCloseOnClick: true,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
|
||||
label: t('download_excel'),
|
||||
onClick: () => {
|
||||
onDownloadExcel(data.id);
|
||||
},
|
||||
loading: downloadIds.includes(data.id),
|
||||
dontCloseOnClick: true,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
@@ -312,8 +316,8 @@ const DashboardRealBoxesPage = (props: Props) => {
|
||||
return (
|
||||
<Box>
|
||||
<Stack direction={'row'} mb={3} spacing={3}>
|
||||
<BaseButton colorVariant='blue' startIcon={<Add />} href={pageLinks.dashboard.boxes.create}>
|
||||
{t('create_packet')}
|
||||
<BaseButton colorVariant='blue' startIcon={<Add />} href={pageLinks.dashboard.real_boxes.create}>
|
||||
{t('create_box')}
|
||||
</BaseButton>
|
||||
</Stack>
|
||||
<Box
|
||||
@@ -335,7 +339,7 @@ const DashboardRealBoxesPage = (props: Props) => {
|
||||
color: '#000',
|
||||
}}
|
||||
>
|
||||
{t('packet')}
|
||||
{t('boxes')}
|
||||
</Typography>
|
||||
<Stack direction={'row'} alignItems={'center'} spacing={2}>
|
||||
<BaseInput
|
||||
|
||||
Reference in New Issue
Block a user