downloadbottomsheet
This commit is contained in:
@@ -22,7 +22,7 @@ import { AccountHolderAuthFilter } from '@/entities/additional-service/ui/accoun
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { AccountHolderAuthStatus, AccountHolderAuthItem, ExtensionAccountHolderAuthDownloadExcelParams, ExtensionAccountHolderAuthDownloadExcelResponse } from '@/entities/additional-service/model/account-holder-auth/types';
|
||||
import { AdditionalServiceCategory, DetailData } from '@/entities/additional-service/model/types';
|
||||
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||
import { DownloadBottomSheet, DownloadSelectedMode } from '@/entities/common/ui/download-bottom-sheet';
|
||||
import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access-check';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { AccountHolderAuthDetail } from '@/entities/additional-service/ui/account-holder-auth/detail/account-holder-auth-detail';
|
||||
@@ -53,7 +53,8 @@ export const AccountHolderAuthPage = () => {
|
||||
const [detailOn, setDetailOn] = useState<boolean>(false);
|
||||
const [detailMid, setDetailMid] = useState<string>('');
|
||||
const [detailTid, setDetailTid] = useState<string>('');
|
||||
const [emailBottomSheetOn, setEmailBottomSheetOn] = useState<boolean>(false);
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
|
||||
useSetHeaderTitle(t('additionalService.accountHolderAuth.title'));
|
||||
useSetHeaderType(HeaderType.LeftArrow);
|
||||
@@ -156,19 +157,24 @@ export const AccountHolderAuthPage = () => {
|
||||
};
|
||||
|
||||
|
||||
const onClickToOpenEmailBottomSheet = () => {
|
||||
const onClickToOpenDownloadBottomSheet = () => {
|
||||
if (!checkGrant(59, '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: ExtensionAccountHolderAuthDownloadExcelParams = {
|
||||
mid: mid,
|
||||
email: selectedEmail,
|
||||
email: userEmail,
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
authStatus: authStatus
|
||||
@@ -182,7 +188,6 @@ export const AccountHolderAuthPage = () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
setEmailBottomSheetOn(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -220,14 +225,14 @@ export const AccountHolderAuthPage = () => {
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_setting.svg'}
|
||||
alt={t('common.searchOptions')}
|
||||
onClick={() => onClickToOpenFilter()}
|
||||
onClick={ onClickToOpenFilter }
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
className="download-btn"
|
||||
aria-label={t('common.download')}
|
||||
onClick={() => onClickToOpenEmailBottomSheet()}
|
||||
onClick={ onClickToOpenDownloadBottomSheet }
|
||||
>
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_download.svg'}
|
||||
@@ -288,13 +293,15 @@ export const AccountHolderAuthPage = () => {
|
||||
mid={detailMid}
|
||||
tid={detailTid}
|
||||
></AccountHolderAuthDetail>
|
||||
<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