Merge branch 'samandar' into 'dev'
exel name See merge request azizziy/cpost!11
This commit is contained in:
@@ -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;
|
if (downloadIds.includes(id)) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setDownloadIds(p => [...p, id]);
|
setDownloadIds(p => [...p, id]);
|
||||||
const response = await real_box_requests.downloadExcel({ boxId: 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);
|
file_service.download(file);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifyUnknownError(error);
|
notifyUnknownError(error);
|
||||||
@@ -325,7 +325,7 @@ const DashboardRealBoxesPage = (props: Props) => {
|
|||||||
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
|
icon: <Download sx={{ path: { color: '#3489E4' } }} />,
|
||||||
label: t('download_excel'),
|
label: t('download_excel'),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
onDownloadExcel(data.id);
|
onDownloadExcel(data.id, data.boxName);
|
||||||
},
|
},
|
||||||
loading: downloadIds.includes(data.id),
|
loading: downloadIds.includes(data.id),
|
||||||
dontCloseOnClick: true,
|
dontCloseOnClick: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user