downloadbottomsheet
This commit is contained in:
@@ -29,7 +29,7 @@ import { ListDateGroup } from '@/entities/additional-service/ui/list-date-group'
|
||||
import { AdditionalServiceCategory, DetailData } from '@/entities/additional-service/model/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||
import { DownloadBottomSheet, DownloadSelectedMode } from '@/entities/common/ui/download-bottom-sheet';
|
||||
import { AlimtalkFilter } from '@/entities/additional-service/ui/filter/alimtalk-filter';
|
||||
import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access-check';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
@@ -62,7 +62,8 @@ export const AlimtalkListPage = () => {
|
||||
const [sendType, setSendType] = useState<AlimtalkSendType>(AlimtalkSendType.ALL);
|
||||
const [sendCl, setSendCl] = useState<AlimTalkSendCl>(AlimTalkSendCl.ALL);
|
||||
|
||||
const [emailBottomSheetOn, setEmailBottomSheetOn] = useState<boolean>(false);
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
|
||||
const [detailOn, setDetailOn] = useState<boolean>(false);
|
||||
const [detailMid, setDetailMid] = useState<string>('');
|
||||
const [detailTid, setDetailTid] = useState<string>('');
|
||||
@@ -149,16 +150,21 @@ export const AlimtalkListPage = () => {
|
||||
};
|
||||
|
||||
|
||||
const onClickToOpenEmailBottomSheet = () => {
|
||||
const onClickToOpenDownloadBottomSheet = () => {
|
||||
if (!checkGrant(58, 'D')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
setEmailBottomSheetOn(true);
|
||||
setDownloadBottomSheetOn(true);
|
||||
}
|
||||
|
||||
const onSendRequest = (selectedEmail?: string) => {
|
||||
if (selectedEmail) {
|
||||
const onRequestDownloadExcel = (
|
||||
selectedMode: DownloadSelectedMode,
|
||||
userEmail?: string
|
||||
) => {
|
||||
if(selectedMode === DownloadSelectedMode.EMAIL
|
||||
&& userEmail
|
||||
){
|
||||
const params: ExtensionAlimtalkDownloadExcelParams = {
|
||||
mid: mid,
|
||||
searchCl: searchCl,
|
||||
@@ -169,7 +175,7 @@ export const AlimtalkListPage = () => {
|
||||
toDate: toDate,
|
||||
sendType: sendType,
|
||||
sendCl: sendCl,
|
||||
email: selectedEmail
|
||||
email: userEmail
|
||||
};
|
||||
extensionAlimtalkDownloadExcel(params).then((rs: ExtensionAlimtalkDownloadExcelResponse) => {
|
||||
console.log('Excel Download Status:', rs.status);
|
||||
@@ -180,7 +186,6 @@ export const AlimtalkListPage = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
setEmailBottomSheetOn(false);
|
||||
};
|
||||
|
||||
const setDetailData = (detailData: DetailData) => {
|
||||
@@ -293,7 +298,7 @@ export const AlimtalkListPage = () => {
|
||||
<button
|
||||
className="filter-btn"
|
||||
aria-label="필터"
|
||||
onClick={() => onClickToOpenFilter()}
|
||||
onClick={ onClickToOpenFilter }
|
||||
>
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_setting.svg'}
|
||||
@@ -304,7 +309,7 @@ export const AlimtalkListPage = () => {
|
||||
<button
|
||||
className="download-btn"
|
||||
aria-label="다운로드"
|
||||
onClick={onClickToOpenEmailBottomSheet}
|
||||
onClick={ onClickToOpenDownloadBottomSheet }
|
||||
>
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_download.svg'}
|
||||
@@ -356,13 +361,15 @@ export const AlimtalkListPage = () => {
|
||||
tid={ detailTid }
|
||||
seq={ detailSeq }
|
||||
></AlimtalkDetail>
|
||||
<EmailBottomSheet
|
||||
bottomSheetOn={ emailBottomSheetOn }
|
||||
setBottomSheetOn={ setEmailBottomSheetOn }
|
||||
imageMode={ false }
|
||||
emailMode={ true }
|
||||
sendRequest={onSendRequest}
|
||||
></EmailBottomSheet>
|
||||
{ !!downloadBottomSheetOn &&
|
||||
<DownloadBottomSheet
|
||||
bottomSheetOn={ downloadBottomSheetOn }
|
||||
setBottomSheetOn={ setDownloadBottomSheetOn }
|
||||
imageMode={ false }
|
||||
emailMode={ true }
|
||||
sendRequest={ onRequestDownloadExcel }
|
||||
></DownloadBottomSheet>
|
||||
}
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user