Merge remote-tracking branch 'refs/remotes/origin/staging' into staging
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@ajoelp/json-to-formdata": "^1.5.0",
|
||||
"@date-io/date-fns": "^2.16.0",
|
||||
"@emotion/cache": "^11.10.5",
|
||||
"@emotion/react": "^11.10.5",
|
||||
|
||||
@@ -28,7 +28,9 @@ import {
|
||||
ButtonGroup,
|
||||
Grid,
|
||||
Tooltip,
|
||||
Divider,
|
||||
} from '@mui/material';
|
||||
import Iconify from '@/components/Iconify';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
@@ -49,8 +51,34 @@ import { enqueueSnackbar } from 'notistack';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import DialogLog from './sections/DialogLog';
|
||||
import HistoryIcon from '@mui/icons-material/History';
|
||||
import { makeFormData } from '@/utils/jsonToFormData';
|
||||
|
||||
export default function CorporatePlanList() {
|
||||
export default function CorporatePlanList({handleSubmitSuccess}) {
|
||||
// Files MCU
|
||||
const fileMcuInput = useRef<HTMLInputElement>(null);
|
||||
const [fileMcus, setFileMcus] = useState([]);
|
||||
|
||||
const handleMcuInputChange = (id, member_id) => (event) => {
|
||||
if (event.target.files[0]) {
|
||||
const updatedFiles = Array.from(event.target.files).map((file) => ({
|
||||
file,
|
||||
id
|
||||
}));
|
||||
setFileMcus((prevFileMcus) => {
|
||||
const newFileMcus = [...prevFileMcus, ...updatedFiles];
|
||||
submitRequest(id, newFileMcus, member_id);
|
||||
return newFileMcus;
|
||||
});
|
||||
} else {
|
||||
console.log('Tidak ada file');
|
||||
}
|
||||
};
|
||||
const removeMcuFiles = (id, index) => {
|
||||
setFileMcus((filesState) =>
|
||||
filesState.filter((file, fileIndex) => fileIndex !== index || file.id !== id)
|
||||
);
|
||||
};
|
||||
const [submitLoading, setSubmitLoading] = useState(false);
|
||||
const { themeStretch } = useSettings();
|
||||
const { corporate_id } = useParams();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
@@ -149,6 +177,47 @@ export default function CorporatePlanList() {
|
||||
</form>
|
||||
);
|
||||
}
|
||||
function submitRequest(id, newFileMcus, member_id) {
|
||||
setSubmitLoading(true);
|
||||
if (newFileMcus && newFileMcus.length > 0) {
|
||||
const fileWithId = newFileMcus.find((file) => file.id === id);
|
||||
if (fileWithId) {
|
||||
const formData = makeFormData({
|
||||
id: id,
|
||||
memberid: member_id,
|
||||
result_files: fileWithId.file,
|
||||
});
|
||||
axios
|
||||
.post('/files-mcu', formData)
|
||||
.then((response) => {
|
||||
const responseData = response?.data;
|
||||
if(responseData)
|
||||
{
|
||||
setTimeout(() => {
|
||||
loadDataTableData();
|
||||
}, 2000);
|
||||
enqueueSnackbar(responseData.message ?? 'Berhasil tambah file MemberID '+member_id+', silahkan lihat dilaporan', { variant: 'success' });
|
||||
handleSubmitSuccess();
|
||||
}
|
||||
|
||||
})
|
||||
.catch(({ response }) => {
|
||||
const responseData = response?.data;
|
||||
if(responseData)
|
||||
{
|
||||
enqueueSnackbar(responseData.message ?? 'Something Went Wrong', { variant: 'error' });
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
setSubmitLoading(false);
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log(`File dengan ID ${id} tidak ditemukan`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// End Files MCU
|
||||
|
||||
function ImportForm(props: any) {
|
||||
// IMPORT
|
||||
@@ -178,9 +247,7 @@ export default function CorporatePlanList() {
|
||||
|
||||
const handleMemberList = async (appliedFilter = null) => {
|
||||
axios.get('corporates/' + corporate_id + '/members/list').then((response) => {
|
||||
console.log(response);
|
||||
const link = document.createElement('a');
|
||||
console.log(response.data.data.file_name);
|
||||
link.href = response.data.data.file_url;
|
||||
link.setAttribute('download', response.data.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
@@ -577,21 +644,81 @@ export default function CorporatePlanList() {
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Typography sx={{ fontWeight: '600', mb: 1 }}>File History</Typography>
|
||||
<Grid container sx={{ pb: 2, mb: 2, borderBottom: 1 }}>
|
||||
<Grid item xs={12}>
|
||||
<Grid container>
|
||||
<Grid item xs={12}>
|
||||
{row.file_mcu_names
|
||||
? row.file_mcu_names.split(',').map((fileName, index) => (
|
||||
<div key={index}>{fileName}</div>
|
||||
))
|
||||
: '-'}
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid>
|
||||
<LoadingButton
|
||||
id="upload-button"
|
||||
variant="outlined"
|
||||
startIcon={<InsertDriveFileIcon />}
|
||||
// sx={{ p: 1.8 }}
|
||||
// onClick={() => {handleDownloadLog(row)}}
|
||||
onClick={() => {
|
||||
setDialogLogOpen(true);
|
||||
}}
|
||||
loading={loadingLog}
|
||||
>
|
||||
Download LOG
|
||||
</LoadingButton>
|
||||
<Grid spacing={1}>
|
||||
<Stack sx={{ marginTop: 1}}>
|
||||
<LoadingButton
|
||||
id="upload-button"
|
||||
variant="outlined"
|
||||
startIcon={<InsertDriveFileIcon />}
|
||||
// sx={{ p: 1.8 }}
|
||||
// onClick={() => {handleDownloadLog(row)}}
|
||||
onClick={() => {
|
||||
setDialogLogOpen(true);
|
||||
}}
|
||||
loading={loadingLog}
|
||||
>
|
||||
Download LOG
|
||||
</LoadingButton>
|
||||
</Stack>
|
||||
{/* -------------------------------Upload Dokumen MCU------------------------------- */}
|
||||
<Stack sx={{ marginTop: 1}}>
|
||||
{/*<Stack
|
||||
divider={<Divider orientation="horizontal" flexItem />}
|
||||
spacing={1}
|
||||
sx={{ marginY: 2}}
|
||||
>
|
||||
{fileMcus &&
|
||||
fileMcus
|
||||
.filter((datas) => datas.id === row.id)
|
||||
.map((datas, index) => (
|
||||
<Stack direction="row" justifyContent={'space-between'} key={index}>
|
||||
<Typography sx={{ color: "text.secondary" }}>{datas.file.name}</Typography>
|
||||
<Iconify
|
||||
icon="eva:trash-2-outline"
|
||||
color={'darkred'}
|
||||
onClick={() => {
|
||||
removeMcuFiles(datas.id, index);
|
||||
}}
|
||||
sx={{ cursor: 'pointer' }}
|
||||
></Iconify>
|
||||
</Stack>
|
||||
))}
|
||||
</Stack>*/}
|
||||
<input
|
||||
type="file"
|
||||
id={`file-${row.id}`}
|
||||
ref={fileMcuInput}
|
||||
style={{ display: 'none' }}
|
||||
onChange={(event) => {
|
||||
handleMcuInputChange(row.id, row.member_id)(event);
|
||||
}}
|
||||
accept="application/pdf"
|
||||
/>
|
||||
<LoadingButton
|
||||
variant="outlined"
|
||||
onClick={() => {
|
||||
fileMcuInput.current.click();
|
||||
}}
|
||||
>
|
||||
<Iconify icon="eva:plus-fill" />
|
||||
Add Result
|
||||
</LoadingButton>
|
||||
</Stack>
|
||||
</Grid>
|
||||
|
||||
<DialogLog
|
||||
|
||||
6
frontend/dashboard/src/utils/jsonToFormData.ts
Normal file
6
frontend/dashboard/src/utils/jsonToFormData.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import jsonToFormData from '@ajoelp/json-to-formdata';
|
||||
|
||||
export function makeFormData(object: any) {
|
||||
return jsonToFormData(object)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
REACT_APP_HOST_API_URL="http://localhost:8000"
|
||||
|
||||
VITE_API_URL="http://localhost:8000/api/hospitalportal"
|
||||
VITE_API_URL="http://localhost:8000/api/v1/hospitalportal"
|
||||
|
||||
@@ -1 +1 @@
|
||||
VITE_API_URL="https://aso-api.linksehat.dev/api/hospitalportal"
|
||||
VITE_API_URL="https://aso-api.linksehat.dev/api/v1/hospitalportal"
|
||||
18
frontend/hospital-portal/public/icons/ic_flag_en.svg
Normal file
18
frontend/hospital-portal/public/icons/ic_flag_en.svg
Normal file
@@ -0,0 +1,18 @@
|
||||
<svg height="20" viewBox="0 0 28 20" width="28" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs><rect id="a" height="20" rx="3" width="28"/>
|
||||
<mask id="b" fill="#fff">
|
||||
<use fill="#fff" fill-rule="evenodd" xlink:href="#a"/>
|
||||
</mask>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<use fill="#0a17a7" xlink:href="#a"/>
|
||||
<path d="m29.2824692-1.91644623 1.4911811 2.21076686-9.4483006 6.37223314 6.6746503.0001129v6.66666663l-6.6746503-.0007795 9.4483006 6.3731256-1.4911811 2.2107668-11.9501195-8.0608924.0009836 7.4777795h-6.6666666l-.000317-7.4777795-11.9488189 8.0608924-1.49118107-2.2107668 9.448-6.3731256-6.67434973.0007795v-6.66666663l6.67434973-.0001129-9.448-6.37223314 1.49118107-2.21076686 11.9488189 8.06.000317-7.4768871h6.6666666l-.0009836 7.4768871z" fill="#fff" mask="url(#b)"/>
|
||||
<g stroke="#db1f35" stroke-linecap="round" stroke-width=".667">
|
||||
<path d="m18.668 6.332 12.665-8.332" mask="url(#b)"/>
|
||||
<path d="m20.013 21.35 11.354-7.652" mask="url(#b)" transform="matrix(1 0 0 -1 0 35.048)"/>
|
||||
<path d="m8.006 6.31-11.843-7.981" mask="url(#b)"/>
|
||||
<path d="m9.29 22.31-13.127-8.705" mask="url(#b)" transform="matrix(1 0 0 -1 0 35.915)"/>
|
||||
</g>
|
||||
<path d="m0 12h12v8h4v-8h12v-4h-12v-8h-4v8h-12z" fill="#e6273e" mask="url(#b)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
9
frontend/hospital-portal/public/icons/ic_flag_id.svg
Normal file
9
frontend/hospital-portal/public/icons/ic_flag_id.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg height="20" viewBox="0 0 28 20" width="28" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<rect id="a" height="10" rx="0" width="28"/>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<use fill="#D82028" xlink:href="#a"/>
|
||||
<use fill="#FFF" xlink:href="#a" y="10"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 334 B |
15
frontend/hospital-portal/public/image/en-US.json
Normal file
15
frontend/hospital-portal/public/image/en-US.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"greeting": "Hello",
|
||||
"buttonText": "Click Me",
|
||||
"infoLogin": "Enter the registered account",
|
||||
"txtLogin1" : "Sign in to Hospital Portal",
|
||||
"txtLogin2" : "Enter your details below",
|
||||
"txtCardSearchMember1" : "Guarantee Submission",
|
||||
"txtCardSearchMember2" : "Find Member",
|
||||
"txtCardSearchMember3" : "Date Birth",
|
||||
"txtCardSearchMember4" : "Member ID",
|
||||
"txtCardSearchMember5" : "Member",
|
||||
"txtDialogMember1" : "Benefit Summary",
|
||||
"txtDialogMember2" : "Request LOG",
|
||||
"txtDialogMember3" : "Member Detail"
|
||||
}
|
||||
18
frontend/hospital-portal/public/image/ic_flag_en.svg
Normal file
18
frontend/hospital-portal/public/image/ic_flag_en.svg
Normal file
@@ -0,0 +1,18 @@
|
||||
<svg height="20" viewBox="0 0 28 20" width="28" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs><rect id="a" height="20" rx="3" width="28"/>
|
||||
<mask id="b" fill="#fff">
|
||||
<use fill="#fff" fill-rule="evenodd" xlink:href="#a"/>
|
||||
</mask>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<use fill="#0a17a7" xlink:href="#a"/>
|
||||
<path d="m29.2824692-1.91644623 1.4911811 2.21076686-9.4483006 6.37223314 6.6746503.0001129v6.66666663l-6.6746503-.0007795 9.4483006 6.3731256-1.4911811 2.2107668-11.9501195-8.0608924.0009836 7.4777795h-6.6666666l-.000317-7.4777795-11.9488189 8.0608924-1.49118107-2.2107668 9.448-6.3731256-6.67434973.0007795v-6.66666663l6.67434973-.0001129-9.448-6.37223314 1.49118107-2.21076686 11.9488189 8.06.000317-7.4768871h6.6666666l-.0009836 7.4768871z" fill="#fff" mask="url(#b)"/>
|
||||
<g stroke="#db1f35" stroke-linecap="round" stroke-width=".667">
|
||||
<path d="m18.668 6.332 12.665-8.332" mask="url(#b)"/>
|
||||
<path d="m20.013 21.35 11.354-7.652" mask="url(#b)" transform="matrix(1 0 0 -1 0 35.048)"/>
|
||||
<path d="m8.006 6.31-11.843-7.981" mask="url(#b)"/>
|
||||
<path d="m9.29 22.31-13.127-8.705" mask="url(#b)" transform="matrix(1 0 0 -1 0 35.915)"/>
|
||||
</g>
|
||||
<path d="m0 12h12v8h4v-8h12v-4h-12v-8h-4v8h-12z" fill="#e6273e" mask="url(#b)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
9
frontend/hospital-portal/public/image/ic_flag_id.svg
Normal file
9
frontend/hospital-portal/public/image/ic_flag_id.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg height="20" viewBox="0 0 28 20" width="28" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<rect id="a" height="10" rx="0" width="28"/>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<use fill="#D82028" xlink:href="#a"/>
|
||||
<use fill="#FFF" xlink:href="#a" y="10"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 334 B |
15
frontend/hospital-portal/public/image/id-ID.json
Normal file
15
frontend/hospital-portal/public/image/id-ID.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"greeting": "Halo",
|
||||
"buttonText": "Klik Saya",
|
||||
"infoLogin": "Masukan akun yang telah terdaftar",
|
||||
"txtLogin1" : "Masuk ke Hospital Portal",
|
||||
"txtLogin2" : "Masukkan detail Anda di bawah ini",
|
||||
"txtCardSearchMember1" : "Pengajuan Jaminan",
|
||||
"txtCardSearchMember2" : "Cari Anggota",
|
||||
"txtCardSearchMember3" : "Tanggal Lahir",
|
||||
"txtCardSearchMember4" : "Member ID",
|
||||
"txtCardSearchMember5" : "Member",
|
||||
"txtDialogMember1" : "Ringkasan Manfaat",
|
||||
"txtDialogMember2" : "Request LOG",
|
||||
"txtDialogMember3" : "Detail Member"
|
||||
}
|
||||
15
frontend/hospital-portal/public/lang/en-US.json
Normal file
15
frontend/hospital-portal/public/lang/en-US.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"greeting": "Hello",
|
||||
"buttonText": "Click Me",
|
||||
"infoLogin": "Enter the registered account",
|
||||
"txtLogin1" : "Sign in to Hospital Portal",
|
||||
"txtLogin2" : "Enter your details below",
|
||||
"txtCardSearchMember1" : "Guarantee Submission",
|
||||
"txtCardSearchMember2" : "Find Member",
|
||||
"txtCardSearchMember3" : "Date Birth",
|
||||
"txtCardSearchMember4" : "Member ID",
|
||||
"txtCardSearchMember5" : "Member",
|
||||
"txtDialogMember1" : "Benefit Summary",
|
||||
"txtDialogMember2" : "Request LOG",
|
||||
"txtDialogMember3" : "Member Detail"
|
||||
}
|
||||
15
frontend/hospital-portal/public/lang/id-ID.json
Normal file
15
frontend/hospital-portal/public/lang/id-ID.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"greeting": "Halo",
|
||||
"buttonText": "Klik Saya",
|
||||
"infoLogin": "Masukan akun yang telah terdaftar",
|
||||
"txtLogin1" : "Masuk ke Hospital Portal",
|
||||
"txtLogin2" : "Masukkan detail Anda di bawah ini",
|
||||
"txtCardSearchMember1" : "Pengajuan Jaminan",
|
||||
"txtCardSearchMember2" : "Cari Anggota",
|
||||
"txtCardSearchMember3" : "Tanggal Lahir",
|
||||
"txtCardSearchMember4" : "Member ID",
|
||||
"txtCardSearchMember5" : "Member",
|
||||
"txtDialogMember1" : "Ringkasan Manfaat",
|
||||
"txtDialogMember2" : "Request LOG",
|
||||
"txtDialogMember3" : "Detail Member"
|
||||
}
|
||||
9
frontend/hospital-portal/public/logo/ic_flag_id.svg
Normal file
9
frontend/hospital-portal/public/logo/ic_flag_id.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg height="20" viewBox="0 0 28 20" width="28" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<rect id="a" height="10" rx="0" width="28"/>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<use fill="#D82028" xlink:href="#a"/>
|
||||
<use fill="#FFF" xlink:href="#a" y="10"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 334 B |
7
frontend/hospital-portal/src/LocalizationUtil.ts
Normal file
7
frontend/hospital-portal/src/LocalizationUtil.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
const getLocalizedData = async (locale) => {
|
||||
const response = await fetch(`../public/image/${locale}.json`); // Mengambil file lokal berdasarkan bahasa yang dipilih
|
||||
const data = await response.json();
|
||||
return data;
|
||||
};
|
||||
|
||||
export default getLocalizedData;
|
||||
@@ -17,7 +17,7 @@ export default function Logo({ disabledLink = false, sx }: Props) {
|
||||
|
||||
const logo = (
|
||||
<Box sx={{ width: 40, height: 40, ...sx }}>
|
||||
<img src="/logo/logo-linksehat.png" alt="LinkSehat" />
|
||||
<img src="/logo/logo_single.svg" alt="LinkSehat" />
|
||||
</Box>
|
||||
);
|
||||
|
||||
|
||||
38
frontend/hospital-portal/src/contexts/LanguageContext.tsx
Normal file
38
frontend/hospital-portal/src/contexts/LanguageContext.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import React, { createContext, useState, useEffect, useRef } from 'react';
|
||||
import getLocalizedData from '../LocalizationUtil';
|
||||
export const LanguageContext = createContext();
|
||||
|
||||
export const LanguageProvider = ({ children }) => {
|
||||
const [currentLocale, setCurrentLocale] = useState(localStorage.getItem('currentLocale') ? localStorage.getItem('currentLocale') : 'id-ID');
|
||||
const [localeData, setLocaleData] = useState('id');
|
||||
const cancelToken = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const token = { cancelled: false };
|
||||
cancelToken.current = token;
|
||||
|
||||
try {
|
||||
const data = await getLocalizedData(currentLocale);
|
||||
if (!cancelToken.current.cancelled) {
|
||||
setLocaleData(data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching localized data:', error);
|
||||
// Tangani kesalahan jika diperlukan
|
||||
}
|
||||
};
|
||||
|
||||
fetchData();
|
||||
|
||||
return () => {
|
||||
cancelToken.current.cancelled = true;
|
||||
};
|
||||
}, [currentLocale]);
|
||||
|
||||
return (
|
||||
<LanguageContext.Provider value={{ currentLocale, setCurrentLocale, localeData }}>
|
||||
{children}
|
||||
</LanguageContext.Provider>
|
||||
);
|
||||
};
|
||||
@@ -122,10 +122,18 @@ function AuthProvider({ children }: AuthProviderProps) {
|
||||
initialize();
|
||||
}, []);
|
||||
|
||||
const headers = {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type' : 'application/json',
|
||||
'Accept-Language': (localStorage.getItem('currentLocale') ? localStorage.getItem('currentLocale') : 'id-ID'),
|
||||
},
|
||||
};
|
||||
|
||||
const login = async (email: string, password: string) => axios
|
||||
.post('/login', { email, password })
|
||||
.post('/login', { email, password }, headers)
|
||||
.then((response) => {
|
||||
const { user, token } = response.data;
|
||||
const { user, token } = response.data.data;
|
||||
setSession(token);
|
||||
|
||||
dispatch({
|
||||
|
||||
@@ -12,6 +12,7 @@ import { HelmetProvider } from 'react-helmet-async';
|
||||
// contexts
|
||||
import { SettingsProvider } from './contexts/SettingsContext';
|
||||
import { CollapseDrawerProvider } from './contexts/CollapseDrawerContext';
|
||||
import { LanguageProvider } from './contexts/LanguageContext';
|
||||
|
||||
//
|
||||
import App from './App';
|
||||
@@ -23,7 +24,9 @@ ReactDOM.render(
|
||||
<SettingsProvider>
|
||||
<CollapseDrawerProvider>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
<LanguageProvider>
|
||||
<App />
|
||||
</LanguageProvider>
|
||||
</BrowserRouter>
|
||||
</CollapseDrawerProvider>
|
||||
</SettingsProvider>
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
import { useState } from 'react';
|
||||
import React, { useState, useContext } from 'react';
|
||||
// @mui
|
||||
import { MenuItem, Stack } from '@mui/material';
|
||||
import { ButtonBase, Box, Typography, MenuItem, Stack } from '@mui/material';
|
||||
// components
|
||||
import Image from '@/components/Image';
|
||||
import MenuPopover from '@/components/MenuPopover';
|
||||
import { IconButtonAnimate } from '@/components/animate';
|
||||
import { LanguageContext } from '@/contexts/LanguageContext';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const LANGS = [
|
||||
{
|
||||
label: 'Bahasa Indonesia',
|
||||
value: 'id-ID',
|
||||
icon: '/image/ic_flag_id.svg',
|
||||
},
|
||||
{
|
||||
label: 'English',
|
||||
value: 'en',
|
||||
icon: 'https://minimal-assets-api.vercel.app/assets/icons/ic_flag_en.svg',
|
||||
},
|
||||
{
|
||||
label: 'German',
|
||||
value: 'de',
|
||||
icon: 'https://minimal-assets-api.vercel.app/assets/icons/ic_flag_de.svg',
|
||||
},
|
||||
{
|
||||
label: 'French',
|
||||
value: 'fr',
|
||||
icon: 'https://minimal-assets-api.vercel.app/assets/icons/ic_flag_fr.svg',
|
||||
value: 'en-US',
|
||||
icon: '/image/ic_flag_en.svg',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -39,18 +35,50 @@ export default function LanguagePopover() {
|
||||
setOpen(null);
|
||||
};
|
||||
|
||||
const { setCurrentLocale } = useContext(LanguageContext);
|
||||
const handleChangeLanguage = (language) => {
|
||||
localStorage.setItem('currentLocale', language);
|
||||
setCurrentLocale(language);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<IconButtonAnimate
|
||||
onClick={handleOpen}
|
||||
sx={{
|
||||
width: 40,
|
||||
height: 40,
|
||||
...(open && { bgcolor: 'action.selected' }),
|
||||
}}
|
||||
>
|
||||
<Image disabledEffect src={LANGS[0].icon} alt={LANGS[0].label} />
|
||||
</IconButtonAnimate>
|
||||
<Box display="flex" alignItems="center" border={0} borderColor="grey.300" borderRadius={3} p={1}>
|
||||
|
||||
<IconButtonAnimate
|
||||
onClick={handleOpen}
|
||||
sx={{
|
||||
width: 35,
|
||||
height: 35,
|
||||
...(open && { bgcolor: 'action.selected' }),
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
disabledEffect
|
||||
src={(
|
||||
!localStorage.getItem('currentLocale')
|
||||
? LANGS[0].icon
|
||||
: localStorage.getItem('currentLocale') === 'id-ID'
|
||||
? LANGS[0].icon
|
||||
: LANGS[1].icon
|
||||
)}
|
||||
alt={
|
||||
!localStorage.getItem('currentLocale')
|
||||
? LANGS[0].label
|
||||
: localStorage.getItem('currentLocale') === 'id-ID'
|
||||
? LANGS[0].label
|
||||
: LANGS[1].label
|
||||
}
|
||||
/>
|
||||
</IconButtonAnimate>
|
||||
|
||||
|
||||
<ButtonBase onClick={handleOpen}>
|
||||
<Typography variant="body2" component="span" marginRight={1} color="textPrimary">
|
||||
Language
|
||||
</Typography>
|
||||
</ButtonBase>
|
||||
</Box>
|
||||
|
||||
<MenuPopover
|
||||
open={Boolean(open)}
|
||||
@@ -67,17 +95,22 @@ export default function LanguagePopover() {
|
||||
{LANGS.map((option) => (
|
||||
<MenuItem
|
||||
key={option.value}
|
||||
selected={option.value === LANGS[0].value}
|
||||
onClick={handleClose}
|
||||
selected={option.value === localStorage.getItem('currentLocale')}
|
||||
onClick = {() => {
|
||||
handleClose();
|
||||
handleChangeLanguage(option.value);
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
disabledEffect
|
||||
alt={option.label}
|
||||
src={option.icon}
|
||||
sx={{ width: 28, mr: 2 }}
|
||||
sx={{ width: 28 }}
|
||||
/>
|
||||
|
||||
<Typography variant="body2" component="span" marginLeft={1} color="textPrimary">
|
||||
{option.label}
|
||||
</Typography>
|
||||
</MenuItem>
|
||||
))}
|
||||
</Stack>
|
||||
|
||||
@@ -93,8 +93,8 @@ export default function DashboardHeader({
|
||||
|
||||
<Stack direction="row" alignItems="center" spacing={{ xs: 0.5, sm: 1.5 }}>
|
||||
<LanguagePopover />
|
||||
<NotificationsPopover />
|
||||
<ContactsPopover />
|
||||
{/*<NotificationsPopover />
|
||||
<ContactsPopover />*/}
|
||||
<AccountPopover />
|
||||
</Stack>
|
||||
</Toolbar>
|
||||
|
||||
@@ -20,12 +20,12 @@ import DialogDetailClaim from '@/components/dialogs/DialogDetailClaim';
|
||||
|
||||
// const [notifications, setNotifications] = useState([])
|
||||
|
||||
// const itemList = [
|
||||
// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '08:00 WIB' },
|
||||
// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '09:00 WIB' },
|
||||
// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '10:00 WIB' },
|
||||
// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '11:00 WIB' },
|
||||
// ];
|
||||
const itemList = [
|
||||
{ info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '08:00 WIB' },
|
||||
{ info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '09:00 WIB' },
|
||||
{ info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '10:00 WIB' },
|
||||
{ info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '11:00 WIB' },
|
||||
];
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +66,7 @@ export default function Dashboard() {
|
||||
const [policyData, setPolicyData] = useState<PolicyProps>(defaultPolicyData);
|
||||
|
||||
// TODO Remove This
|
||||
const [itemList, setItemList] = useState([]);
|
||||
//const [itemList, setItemList] = useState([]);
|
||||
function handleDataLoaded(dataTable) {
|
||||
let dummyData = [];
|
||||
dataTable.map(function(data) {
|
||||
@@ -79,7 +79,7 @@ export default function Dashboard() {
|
||||
}
|
||||
})
|
||||
|
||||
setItemList(dummyData);
|
||||
//setItemList(dummyData);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import React, { useContext, useRef, useState, useEffect } from 'react';
|
||||
import { capitalCase } from "change-case";
|
||||
import { Link as RouterLink } from "react-router-dom";
|
||||
// @mui
|
||||
@@ -23,6 +24,7 @@ import Logo from "@/components/Logo";
|
||||
import Image from "@/components/Image";
|
||||
// sections
|
||||
import { LoginForm } from "@/sections/auth/login";
|
||||
import { LanguageContext } from '@/contexts/LanguageContext';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -70,6 +72,7 @@ const ContentStyle = styled("div")(({ theme }) => ({
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export default function Login() {
|
||||
const { localeData } = useContext(LanguageContext);
|
||||
const { method } = useAuth();
|
||||
|
||||
const smUp = useResponsive("up", "sm");
|
||||
@@ -80,7 +83,7 @@ export default function Login() {
|
||||
<Page title="Login">
|
||||
<RootStyle>
|
||||
<HeaderStyle>
|
||||
<Logo sx={{ width: 150, height: 150 }} />
|
||||
{/*<Logo sx={{ width: 150, height: 150 }} />
|
||||
{smUp && (
|
||||
<Typography variant="body2" sx={{ mt: { md: -2 } }}>
|
||||
Has problem with your account? {""}
|
||||
@@ -97,7 +100,7 @@ export default function Login() {
|
||||
Contact Us
|
||||
</Link>
|
||||
</Typography>
|
||||
)}
|
||||
)}*/}
|
||||
</HeaderStyle>
|
||||
|
||||
{/* {mdUp && (
|
||||
@@ -121,16 +124,17 @@ export default function Login() {
|
||||
alignItems="center"
|
||||
sx={{ mb: 5 }}
|
||||
>
|
||||
<Logo sx={{ width: 90, height: 90 }} />
|
||||
<Box sx={{ flexGrow: 1 }}>
|
||||
<Typography variant="h4" gutterBottom>
|
||||
Sign in to LinkSehat
|
||||
{localeData.txtLogin1}
|
||||
</Typography>
|
||||
<Typography sx={{ color: "text.secondary" }}>
|
||||
Enter your details below.
|
||||
<Typography variant="body1" sx={{ color: 'text.secondary' }}>
|
||||
{localeData.txtLogin2}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
<Tooltip
|
||||
{/*<Tooltip
|
||||
title={capitalCase(method)}
|
||||
placement="right"
|
||||
>
|
||||
@@ -141,12 +145,12 @@ export default function Login() {
|
||||
sx={{ width: 32, height: 32 }}
|
||||
/>
|
||||
</>
|
||||
</Tooltip>
|
||||
</Tooltip>*/}
|
||||
</Stack>
|
||||
|
||||
<LoginForm />
|
||||
|
||||
{false && !smUp && (
|
||||
{/*{false && !smUp && (
|
||||
<Typography
|
||||
variant="body2"
|
||||
align="center"
|
||||
@@ -161,7 +165,7 @@ export default function Login() {
|
||||
Get started
|
||||
</Link>
|
||||
</Typography>
|
||||
)}
|
||||
)}*/}
|
||||
</ContentStyle>
|
||||
</Container>
|
||||
</RootStyle>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as Yup from 'yup';
|
||||
import { useState } from 'react';
|
||||
import React, { useContext, useRef, useState, useEffect } from 'react';
|
||||
import { Link as RouterLink, useNavigate } from 'react-router-dom';
|
||||
// form
|
||||
import { useForm } from 'react-hook-form';
|
||||
@@ -15,6 +15,7 @@ import useIsMountedRef from '@/hooks/useIsMountedRef';
|
||||
// components
|
||||
import Iconify from '@/components/Iconify';
|
||||
import { FormProvider, RHFTextField, RHFCheckbox } from '@/components/hook-form';
|
||||
import { LanguageContext } from '@/contexts/LanguageContext';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -26,6 +27,7 @@ type FormValuesProps = {
|
||||
};
|
||||
|
||||
export default function LoginForm() {
|
||||
const { localeData } = useContext(LanguageContext);
|
||||
const { login } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -34,8 +36,8 @@ export default function LoginForm() {
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
|
||||
const LoginSchema = Yup.object().shape({
|
||||
email: Yup.string().email('Email must be a valid email address').required('Email is required'),
|
||||
password: Yup.string().required('Password is required'),
|
||||
email: Yup.string().email('Format email tidak valid').required('Email harus diisi'),
|
||||
password: Yup.string().required('Password harus diisi'),
|
||||
});
|
||||
|
||||
const defaultValues = {
|
||||
@@ -75,10 +77,10 @@ export default function LoginForm() {
|
||||
return (
|
||||
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||
<Stack spacing={3}>
|
||||
<Alert severity="info">Email : admin@linksehat.dev & Password : password</Alert>
|
||||
{!!errors.afterSubmit && <Alert severity="error">{errors.afterSubmit.message}</Alert>}
|
||||
<Alert severity="info">{localeData.infoLogin}</Alert>
|
||||
{!!errors.afterSubmit && <Alert severity="error">{errors.afterSubmit.data.meta.message}</Alert>}
|
||||
|
||||
<RHFTextField name="email" label="Email address" />
|
||||
<RHFTextField name="email" label="Email" required/>
|
||||
|
||||
<RHFTextField
|
||||
name="password"
|
||||
@@ -93,14 +95,15 @@ export default function LoginForm() {
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
required
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between" sx={{ my: 2 }}>
|
||||
<RHFCheckbox name="remember" label="Remember me" />
|
||||
{/*<RHFCheckbox name="remember" label="Remember me" />
|
||||
<Link component={RouterLink} variant="subtitle2" to={PATH_AUTH.resetPassword}>
|
||||
Forgot password?
|
||||
</Link>
|
||||
</Link>*/}
|
||||
</Stack>
|
||||
|
||||
<LoadingButton
|
||||
@@ -109,6 +112,7 @@ export default function LoginForm() {
|
||||
type="submit"
|
||||
variant="contained"
|
||||
loading={isSubmitting}
|
||||
sx={{ marginTop: 2 }}
|
||||
>
|
||||
Login
|
||||
</LoadingButton>
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from '@mui/material';
|
||||
import { ChevronRight } from '@mui/icons-material';
|
||||
// React
|
||||
import React, { useState } from 'react';
|
||||
import React, { useContext, useState } from 'react';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import Iconify from '@/components/Iconify';
|
||||
import { DatePicker, LocalizationProvider, MobileDatePicker } from '@mui/x-date-pickers';
|
||||
@@ -25,6 +25,7 @@ import MuiDialog from '@/components/MuiDialog';
|
||||
import axios from '@/utils/axios';
|
||||
import { useSnackbar } from 'notistack';
|
||||
import DialogMember from './DialogMember';
|
||||
import { LanguageContext } from '@/contexts/LanguageContext';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -46,29 +47,32 @@ const ItemNotificationStyle = styled(Card)(({ theme }) => ({
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export default function CardSearchMember(handleSubmitSuccess) {
|
||||
const { localeData } = useContext(LanguageContext);
|
||||
const {enqueueSnackbar} = useSnackbar();
|
||||
|
||||
const [noPolis, setNoPolis] = useState('AW001-01');
|
||||
const [tanggalLahir, setTanggalLahir] = useState('1991-01-10');
|
||||
const [birthDate, setBirthDate] = useState('1991-01-10');
|
||||
const [loadingBenefit, setLoadingBenefit] = useState(false);
|
||||
const [loadingClaim, setLoadingClaim] = useState(false);
|
||||
const [openDialogBenefit, setOpenDialogBenefit] = useState(false);
|
||||
const [openDialogClaim, setOpenDialogClaim] = useState(false);
|
||||
const [currentMember, setCurrentMember] = useState(null);
|
||||
const [nameMember, setNameMember] = useState('');
|
||||
|
||||
function handleSearchMember() {
|
||||
setLoadingBenefit(true)
|
||||
|
||||
axios.post('/search-member', {
|
||||
no_polis: noPolis,
|
||||
birth_date: tanggalLahir ? fPostFormat(tanggalLahir, 'yyyy-MM-dd') : null
|
||||
birth_date: birthDate ? fPostFormat(birthDate, 'yyyy-MM-dd') : null
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenDialogBenefit(true)
|
||||
setCurrentMember(response.data.data)
|
||||
setNameMember(response.data.data.name);
|
||||
})
|
||||
.catch(({response}) => {
|
||||
enqueueSnackbar(response.data.errors ? response.data.errors[0] : (response.data ? response.data.message : 'Opps, Something went Wrong!'), {variant : "error"})
|
||||
enqueueSnackbar(response.data.errors ? response.data.errors[0] : (response.data ? response.data.meta.message : 'Opps, Something went Wrong!'), {variant : "error"})
|
||||
})
|
||||
.then(() => {
|
||||
setLoadingBenefit(false)
|
||||
@@ -90,23 +94,23 @@ export default function CardSearchMember(handleSubmitSuccess) {
|
||||
component="span"
|
||||
sx={{ display: 'flex', alignItems: 'center' }}
|
||||
>
|
||||
Pengajuan Jaminan
|
||||
{localeData.txtCardSearchMember1}
|
||||
</Typography>
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Stack gap={2}>
|
||||
<TextField variant="outlined" label="Member ID" value={noPolis} onChange={(event) => {
|
||||
<TextField variant="outlined" label={localeData.txtCardSearchMember4} value={noPolis} onChange={(event) => {
|
||||
setNoPolis(event.target.value)
|
||||
}}></TextField>
|
||||
}} required></TextField>
|
||||
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||
<DatePicker
|
||||
label="Tanggal Lahir"
|
||||
value={tanggalLahir}
|
||||
label={localeData.txtCardSearchMember3}
|
||||
value={birthDate}
|
||||
onChange={(newValue) => {
|
||||
setTanggalLahir( (newValue));
|
||||
}}
|
||||
inputFormat="dd-MM-yyyy"
|
||||
renderInput={(params) => <TextField {...params} />}
|
||||
renderInput={(params) => <TextField {...params} required/>}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
|
||||
@@ -124,7 +128,7 @@ export default function CardSearchMember(handleSubmitSuccess) {
|
||||
}}
|
||||
>
|
||||
<Iconify icon="eva:eye-fill" marginRight={0.75} />
|
||||
Cari Member
|
||||
{localeData.txtCardSearchMember2}
|
||||
</LoadingButton>
|
||||
{/* <LoadingButton
|
||||
variant="contained"
|
||||
@@ -142,7 +146,7 @@ export default function CardSearchMember(handleSubmitSuccess) {
|
||||
{/*
|
||||
<DialogBenefit open={openDialogBenefit} setOpen={setOpenDialogBenefit}></DialogBenefit> */}
|
||||
<MuiDialog
|
||||
title={{name: "Member"}}
|
||||
title={{name: nameMember}}
|
||||
openDialog={openDialogBenefit}
|
||||
setOpenDialog={setOpenDialogBenefit}
|
||||
content={DialogMember(currentMember, () => {setOpenDialogBenefit(false); handleSubmitSuccess()})}
|
||||
|
||||
@@ -4,20 +4,22 @@ import { LoadingButton, TabPanel } from "@mui/lab";
|
||||
import { Button, Card, Divider, Grid, LinearProgress, linearProgressClasses, Typography } from "@mui/material";
|
||||
import { Tab, Tabs } from "@mui/material";
|
||||
import { Box, Stack } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
import React, { useEffect, useState, useContext } from "react";
|
||||
import { fCurrency } from '@/utils/formatNumber';
|
||||
import { fPostFormat } from '@/utils/formatTime';
|
||||
import { Avatar } from '@mui/material';
|
||||
import Iconify from '@/components/Iconify';
|
||||
import FormRequestClaim from './FormRequestClaim';
|
||||
import { LanguageContext } from '@/contexts/LanguageContext';
|
||||
|
||||
export default function DialogMember(member, handleSubmitSuccess) {
|
||||
const { localeData } = useContext(LanguageContext);
|
||||
const [currentTab, setCurrentTab] = useState('request')
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentTab('benefit')
|
||||
setCurrentTab('detail')
|
||||
}, [member])
|
||||
|
||||
function handleChangeTab(event: React.SyntheticEvent, newValue: string) {
|
||||
@@ -67,13 +69,93 @@ export default function DialogMember(member, handleSubmitSuccess) {
|
||||
onChange={handleChangeTab}
|
||||
aria-label="wrapped label tabs example"
|
||||
>
|
||||
<Tab
|
||||
value="benefit"
|
||||
label="Benefit Summary"
|
||||
/>
|
||||
<Tab value="request" label="Request Penjaminan" />
|
||||
<Tab value="detail" label={localeData.txtDialogMember3} />
|
||||
<Tab value="benefit" label={localeData.txtDialogMember1} />
|
||||
<Tab value="request" label={localeData.txtDialogMember2} />
|
||||
</Tabs>
|
||||
|
||||
<TabPanel value={currentTab} index={'detail'}>
|
||||
<Stack spacing={2}>
|
||||
<Grid container sx={{ pb: 2, mb: 2, borderBottom: 0 }}>
|
||||
<Grid item xs={6}>
|
||||
<Grid container>
|
||||
<Grid item xs={6}>
|
||||
Mapping ID
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
Policy Number
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
NRIC
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={6}>
|
||||
NIK
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
Email
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Grid container>
|
||||
<Grid item xs={6}>
|
||||
Birth Date
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
Gender
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
Marital Status
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
Language
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
Race
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
Relationship
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: {1 ?? '-'}
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</TabPanel>
|
||||
|
||||
<TabPanel value={currentTab} index={'benefit'}>
|
||||
<Grid container spacing={2}>
|
||||
{ member && member?.current_plan?.corporate_benefits?.map((corporateBenefit, index) => {return (
|
||||
|
||||
@@ -29,12 +29,18 @@ const setSession = (accessToken: string | null) => {
|
||||
if (accessToken) {
|
||||
localStorage.setItem('accessToken', accessToken);
|
||||
axios.defaults.headers.common.Authorization = `Bearer ${accessToken}`;
|
||||
axios.defaults.headers.common['Accept-Language'] = (localStorage.getItem('currentLocale') ? localStorage.getItem('currentLocale') : 'id-ID');
|
||||
axios.defaults.headers.common['Accept'] = 'application/json';
|
||||
axios.defaults.headers.common['Content-Type'] = 'application/json';
|
||||
// This function below will handle when token is expired
|
||||
// const { exp } = jwtDecode(accessToken);
|
||||
// handleTokenExpired(exp);
|
||||
} else {
|
||||
localStorage.removeItem('accessToken');
|
||||
delete axios.defaults.headers.common.Authorization;
|
||||
delete axios.defaults.headers.common['Accept-Language'];
|
||||
delete axios.defaults.headers.common['Accept'];
|
||||
delete axios.defaults.headers.common['Content-Type'];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,14 @@ export default defineConfig({
|
||||
// comment this out if that isn't relevant for your project
|
||||
build: {
|
||||
outDir: 'build',
|
||||
chunkSizeWarningLimit: 100,
|
||||
rollupOptions: {
|
||||
onwarn(warning, warn) {
|
||||
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
|
||||
return
|
||||
}
|
||||
warn(warning)
|
||||
}}
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
|
||||
Reference in New Issue
Block a user