-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from UPbrella/develop
Deploy: Dev
- Loading branch information
Showing
9 changed files
with
155 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/components/pages/admin/umbrella/UI/UmbrellaExcelButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Button } from "@mui/material"; | ||
import { useGetUmbrellas } from "@/hooks/queries/umbrellaQueries"; | ||
import { | ||
UMBRELLA_TABLE, | ||
downloadUmbrellaDataExcel, | ||
} from "@/components/pages/admin/umbrella/helper"; | ||
|
||
type TProps = { | ||
storeId: number; | ||
totalCount?: number; | ||
isLoading: boolean; | ||
storeName: string; | ||
}; | ||
|
||
const UmbrellaExcelButton = ({ storeId, totalCount, isLoading, storeName }: TProps) => { | ||
const { data: umbrellaRes } = useGetUmbrellas({ | ||
page: 0, | ||
storeId, | ||
size: isLoading ? undefined : totalCount, | ||
}); | ||
|
||
// 한글 매핑 | ||
const onClickExcelBtn = () => { | ||
if (umbrellaRes) | ||
downloadUmbrellaDataExcel( | ||
storeName, | ||
umbrellaRes.map((e) => ({ | ||
[UMBRELLA_TABLE.id.label]: e.id, | ||
[UMBRELLA_TABLE.historyId.label]: e.historyId ?? "-", | ||
[UMBRELLA_TABLE.storeMetaId.label]: e.storeMetaId, | ||
[UMBRELLA_TABLE.uuid.label]: e.uuid, | ||
[UMBRELLA_TABLE.rentable.label]: e.rentable ? "O" : "X", | ||
[UMBRELLA_TABLE.etc.label]: e.etc, | ||
})) | ||
); | ||
}; | ||
|
||
return ( | ||
<Button | ||
disabled={!umbrellaRes} | ||
size="large" | ||
className="!mb-16 w-[180px]" | ||
variant="outlined" | ||
onClick={onClickExcelBtn} | ||
> | ||
우산 목록 다운로드 | ||
</Button> | ||
); | ||
}; | ||
|
||
export default UmbrellaExcelButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.