Merge branch 'samandar' into 'dev'

exel name

See merge request azizziy/cpost!11
This commit is contained in:
Azizbek Usmonov
2025-05-28 15:14:16 +05:00

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,