exel
This commit is contained in:
@@ -210,5 +210,6 @@
|
|||||||
"update_packet": "編輯套件",
|
"update_packet": "編輯套件",
|
||||||
"party_weight": "大量重量",
|
"party_weight": "大量重量",
|
||||||
"qr_code": "二维码",
|
"qr_code": "二维码",
|
||||||
"created_at": "添加日期"
|
"created_at": "添加日期",
|
||||||
|
"download_all_items_exel": "将所有产品上传至Excel"
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@
|
|||||||
"weight_of_items": "Products weight",
|
"weight_of_items": "Products weight",
|
||||||
"update_packet": "Edit Paket",
|
"update_packet": "Edit Paket",
|
||||||
"party_weight": "Batch weight",
|
"party_weight": "Batch weight",
|
||||||
|
"download_all_items_exel": "Upload all products in Excel",
|
||||||
"qr_code": "QR Code",
|
"qr_code": "QR Code",
|
||||||
"created_at": "Date of joining"
|
"created_at": "Date of joining"
|
||||||
}
|
}
|
||||||
@@ -222,6 +222,7 @@
|
|||||||
"weight_of_items": "Вес продукта",
|
"weight_of_items": "Вес продукта",
|
||||||
"update_packet": "Редактировать пакет",
|
"update_packet": "Редактировать пакет",
|
||||||
"party_weight": "Вес партии",
|
"party_weight": "Вес партии",
|
||||||
|
"download_all_items_exel": "Загрузить все товары в Excel",
|
||||||
|
|
||||||
"qr_code": "QR код",
|
"qr_code": "QR код",
|
||||||
"created_at": "Дата добавления"
|
"created_at": "Дата добавления"
|
||||||
|
|||||||
@@ -216,6 +216,7 @@
|
|||||||
"date_of_birth": "Tug'ilgan kuni",
|
"date_of_birth": "Tug'ilgan kuni",
|
||||||
"are_you_sure_delete_client_id": "Rostdan ham {id} id lik klientni o'chirmoqchimisiz?",
|
"are_you_sure_delete_client_id": "Rostdan ham {id} id lik klientni o'chirmoqchimisiz?",
|
||||||
"download_all_items": "Barcha mahsulotlarni yuklab olish",
|
"download_all_items": "Barcha mahsulotlarni yuklab olish",
|
||||||
|
"download_all_items_exel": "Barcha mahsulotlarni exelda yuklash",
|
||||||
"download_all_clients": "Barcha mijozlarni yuklab olish",
|
"download_all_clients": "Barcha mijozlarni yuklab olish",
|
||||||
"are_you_sure_delete_party": "{name} yuk partiyasini o'chirishga ishonchingiz komilmi?",
|
"are_you_sure_delete_party": "{name} yuk partiyasini o'chirishga ishonchingiz komilmi?",
|
||||||
"passport": "Pasport",
|
"passport": "Pasport",
|
||||||
|
|||||||
@@ -35,4 +35,7 @@ export const party_requests = {
|
|||||||
async downloadPartyItemsExcel(params: { partyId: number | string }) {
|
async downloadPartyItemsExcel(params: { partyId: number | string }) {
|
||||||
return request.get<Blob>('/parties/items/download', { params, responseType: 'blob' });
|
return request.get<Blob>('/parties/items/download', { params, responseType: 'blob' });
|
||||||
},
|
},
|
||||||
|
async downloadPartyItemsAllExcel(params: { partyId: number | string }) {
|
||||||
|
return request.get<Blob>('/parties/download/box-order', { params, responseType: 'blob' });
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ const DashboardPartiesPage = (props: Props) => {
|
|||||||
const [deleteIds, setDeleteIds] = useState<number[]>([]);
|
const [deleteIds, setDeleteIds] = useState<number[]>([]);
|
||||||
const [downloadIds, setDownloadIds] = useState<number[]>([]);
|
const [downloadIds, setDownloadIds] = useState<number[]>([]);
|
||||||
const [downloadItemIds, setDownloadItemIds] = useState<number[]>([]);
|
const [downloadItemIds, setDownloadItemIds] = useState<number[]>([]);
|
||||||
|
const [downloadItemIdsExel, setDownloadItemIdsExel] = useState<number[]>([]);
|
||||||
const [changeStatusIds, setChangeStatusIds] = useState<number[]>([]);
|
const [changeStatusIds, setChangeStatusIds] = useState<number[]>([]);
|
||||||
|
|
||||||
const partyStatusOptions = useMemo(() => {
|
const partyStatusOptions = useMemo(() => {
|
||||||
@@ -145,6 +146,21 @@ const DashboardPartiesPage = (props: Props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onDownloadPartyItemsExel = async (id: number, name: string) => {
|
||||||
|
if (downloadItemIds.includes(id)) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
setDownloadItemIdsExel(p => [...p, id]);
|
||||||
|
const response = await party_requests.downloadPartyItemsAllExcel({ partyId: id });
|
||||||
|
const file = new File([response.data], `${name}.xlsx`, { type: response.data.type });
|
||||||
|
file_service.download(file);
|
||||||
|
} catch (error) {
|
||||||
|
notifyUnknownError(error);
|
||||||
|
} finally {
|
||||||
|
setDownloadItemIdsExel(prev => prev.filter(i => i !== id));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onChangeStatus = async (id: number, newStatus: PartyStatus) => {
|
const onChangeStatus = async (id: number, newStatus: PartyStatus) => {
|
||||||
if (changeStatusIds.includes(id)) return;
|
if (changeStatusIds.includes(id)) return;
|
||||||
|
|
||||||
@@ -301,6 +317,15 @@ const DashboardPartiesPage = (props: Props) => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
{
|
||||||
|
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
|
||||||
|
label: t('download_all_items_exel'),
|
||||||
|
onClick: () => {
|
||||||
|
onDownloadPartyItemsExel(data.id, data.name);
|
||||||
|
},
|
||||||
|
dontCloseOnClick: true,
|
||||||
|
loading: downloadItemIdsExel.includes(data.id),
|
||||||
|
},
|
||||||
...(Boolean(data.partyStatus === 'ON_THE_WAY' || data.partyStatus === 'ARRIVED')
|
...(Boolean(data.partyStatus === 'ON_THE_WAY' || data.partyStatus === 'ARRIVED')
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user