exel name

This commit is contained in:
Samandar Turg'unboev
2025-05-28 15:13:12 +05:00
parent 7043c9a2f4
commit 1c57e2a9ee

View File

@@ -114,13 +114,13 @@ const DashboardRealBoxesPage = (props: Props) => {
}
};
const onDownloadExcel = async (id: number) => {
const onDownloadExcel = async (id: number, name: string) => {
if (downloadIds.includes(id)) return;
try {
setDownloadIds(p => [...p, id]);
const response = await real_box_requests.downloadExcel({ boxId: id });
const file = new File([response.data], 'Boxses-excel.xlsx', { type: response.data.type });
const file = new File([response.data], `${name}.xlsx`, { type: response.data.type });
file_service.download(file);
} catch (error) {
notifyUnknownError(error);
@@ -325,7 +325,7 @@ const DashboardRealBoxesPage = (props: Props) => {
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
label: t('download_excel'),
onClick: () => {
onDownloadExcel(data.id);
onDownloadExcel(data.id, data.boxName);
},
loading: downloadIds.includes(data.id),
dontCloseOnClick: true,