Merge branch 'staging' of https://dev.sismedika.online/febio/aso into staging
This commit is contained in:
@@ -235,12 +235,12 @@ export default function Index() {
|
||||
label: 'Divisi',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'limit',
|
||||
align: 'center',
|
||||
label: 'Limit',
|
||||
isSort: false,
|
||||
},
|
||||
// {
|
||||
// id: 'limit',
|
||||
// align: 'center',
|
||||
// label: 'Limit',
|
||||
// isSort: false,
|
||||
// },
|
||||
{
|
||||
id: 'status',
|
||||
align: 'center',
|
||||
@@ -292,18 +292,18 @@ export default function Index() {
|
||||
corporateMembers.data.data.map((obj: any) => {
|
||||
return {
|
||||
...obj,
|
||||
limit: (
|
||||
<Stack>
|
||||
<BorderLinearProgress
|
||||
variant="determinate"
|
||||
value={obj.limit.percentage}
|
||||
sx={{ mb: 1 }}
|
||||
/>
|
||||
<Typography sx={{ typography: 'caption', color: '#637381' }}>
|
||||
{fSplit(obj.limit.current)} / {fSplit(obj.limit.total)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
),
|
||||
// limit: (
|
||||
// <Stack>
|
||||
// <BorderLinearProgress
|
||||
// variant="determinate"
|
||||
// value={obj.limit.percentage}
|
||||
// sx={{ mb: 1 }}
|
||||
// />
|
||||
// <Typography sx={{ typography: 'caption', color: '#637381' }}>
|
||||
// {fSplit(obj.limit.current)} / {fSplit(obj.limit.total)}
|
||||
// </Typography>
|
||||
// </Stack>
|
||||
// ),
|
||||
status:
|
||||
obj.status === 1 ? (
|
||||
<Button
|
||||
@@ -369,12 +369,12 @@ export default function Index() {
|
||||
</Stack>
|
||||
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12} lg={6} md={12}>
|
||||
{/* <Grid item xs={12} lg={6} md={12}>
|
||||
<CardNotification data={itemList} />
|
||||
</Grid>
|
||||
<Grid item xs={12} lg={6} md={12}>
|
||||
<CardPolicy data={policyData} />
|
||||
</Grid>
|
||||
</Grid> */}
|
||||
<Grid item xs={12} lg={12} md={12}>
|
||||
<Table
|
||||
headCells={headCells}
|
||||
|
||||
@@ -40,6 +40,7 @@ import TableMoreMenu from '../../components/table/TableMoreMenu';
|
||||
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
|
||||
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
|
||||
import Label from '../../components/Label';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
@@ -229,10 +230,32 @@ export default function List() {
|
||||
};
|
||||
|
||||
const searchs = {
|
||||
useSearchs: true,
|
||||
searchText: searchText,
|
||||
setSearchText: setSearchText,
|
||||
handleSearchSubmit: handleSearchSubmit,
|
||||
};
|
||||
const [startDateValue, setStartDateValue] = useState('');
|
||||
const [endDateValue, setEndDateValue] = useState('');
|
||||
const [statusValue, setStatusValue] = useState('all');
|
||||
|
||||
const handleExportReport = async (appliedFilter = null) => {
|
||||
axios.get(corporateValue + '/export-members/list').then((response) => {
|
||||
const link = document.createElement('a');
|
||||
link.href = response.data.data.file_url;
|
||||
link.setAttribute('download', response.data.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
// handleClose();
|
||||
});
|
||||
}
|
||||
const exportReport = {
|
||||
useExport: true,
|
||||
startDate: startDateValue,
|
||||
endDate: endDateValue,
|
||||
status: statusValue,
|
||||
handleExportReport: handleExportReport
|
||||
}
|
||||
|
||||
/* -------------------------------- headCell -------------------------------- */
|
||||
const headCells: HeadCell<never>[] = [
|
||||
@@ -375,6 +398,7 @@ export default function List() {
|
||||
params={params}
|
||||
searchs={searchs}
|
||||
// filters={filters}
|
||||
exportReport={exportReport}
|
||||
/>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
@@ -34,5 +34,9 @@
|
||||
"txtSupportingResultDocument" : "Supporting Result Document",
|
||||
"txtAddResult" : "Add Result",
|
||||
"txtServiceType" : "Service Type",
|
||||
"txtAdditionalDocuments" : "Additional Documents"
|
||||
"txtAdditionalDocuments" : "Additional Documents",
|
||||
"txtAddNew" : "Add New",
|
||||
"txtAddress" : "Address",
|
||||
"txtProvider": "Provider",
|
||||
"txtAlertProvider" : "Please enter provider"
|
||||
}
|
||||
|
||||
@@ -34,5 +34,9 @@
|
||||
"txtSupportingResultDocument" : "Dokumen Hasil Pendukung",
|
||||
"txtAddResult" : "Tambah Hasil",
|
||||
"txtServiceType" : "Tipe Layanan",
|
||||
"txtAdditionalDocuments" : "Dokumen Tambahan"
|
||||
"txtAdditionalDocuments" : "Dokumen Tambahan",
|
||||
"txtAddNew" : "Tambah Baru",
|
||||
"txtAddress" : "Alamat",
|
||||
"txtProvider": "Penyedia",
|
||||
"txtAlertProvider" : "Mohon masukan provider"
|
||||
}
|
||||
|
||||
@@ -16,10 +16,14 @@ import { useRef, useState, useContext } from 'react';
|
||||
import { makeFormData } from '@/utils/jsonToFormData';
|
||||
import { format } from 'date-fns';
|
||||
import { LanguageContext } from '@/contexts/LanguageContext';
|
||||
import Autocomplete from '@mui/material/Autocomplete';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import Button from '@mui/material/Button';
|
||||
|
||||
interface MemberType {
|
||||
members: any;
|
||||
services: any;
|
||||
providers:any;
|
||||
}
|
||||
interface FormRequestClaimProps {
|
||||
member: MemberType;
|
||||
@@ -28,9 +32,15 @@ interface FormRequestClaimProps {
|
||||
export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRequestClaimProps) {
|
||||
const { localeData }: any = useContext(LanguageContext);
|
||||
const [serviceCode, setServiceCode] = useState<string>('');
|
||||
const [idProvider, setIdProvider] = useState<number>(0);
|
||||
|
||||
const [submitLoading, setSubmitLoading] = useState<boolean>(false);
|
||||
function submitRequest() {
|
||||
if(!idProvider&& (name == '' || alamat == ''))
|
||||
{
|
||||
enqueueSnackbar(localeData.txtAlertProvider, { variant: 'warning' });
|
||||
return false;
|
||||
}
|
||||
if(serviceCode == '')
|
||||
{
|
||||
enqueueSnackbar(localeData.txtDialogMember4, { variant: 'warning' });
|
||||
@@ -39,7 +49,10 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
setSubmitLoading(true);
|
||||
const formData = {
|
||||
member_id: member.members.id,
|
||||
service_code: serviceCode
|
||||
service_code: serviceCode,
|
||||
id_provider: idProvider,
|
||||
name_provider : name,
|
||||
address_provider: alamat
|
||||
};
|
||||
axios
|
||||
.post('/request-log', formData)
|
||||
@@ -64,8 +77,26 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Providers {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
const [showAddNewForm, setShowAddNewForm] = useState(false);
|
||||
const [name, setName] = useState('');
|
||||
const [alamat, setAlamat] = useState('');
|
||||
|
||||
const handleAddNewData = () => {
|
||||
// Logika untuk menambahkan data baru ke database
|
||||
// Pastikan untuk menyesuaikan logika ini sesuai dengan kebutuhan aplikasi Anda
|
||||
console.log('Adding new data:', { name, alamat });
|
||||
|
||||
// Setelah menambahkan data baru, Anda mungkin ingin melakukan sesuatu seperti menutup formulir tambahan atau melakukan pengaturan lainnya
|
||||
setShowAddNewForm(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack direction="column" spacing={4}>
|
||||
<Stack direction="column" spacing={2}>
|
||||
<Stack direction="row" justifyContent={'end'} sx={{ marginBottom: 2 }} spacing={2}>
|
||||
<Typography variant='body2' sx={{color: '#757575'}}>
|
||||
{localeData.txtDialogMember5}
|
||||
@@ -74,27 +105,71 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
</Stack>
|
||||
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Stack spacing={2} sx={{width:'100%'}}>
|
||||
<Typography variant='subtitle1'>{localeData.txtDialogMember1}*</Typography>
|
||||
<FormControl>
|
||||
<InputLabel htmlFor="service_type">
|
||||
{localeData.txtDialogMember1}
|
||||
</InputLabel>
|
||||
<Select
|
||||
id="service_type"
|
||||
value={serviceCode}
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Typography variant='subtitle1'>{localeData.txtProvider} *</Typography>
|
||||
<Autocomplete
|
||||
id="provider"
|
||||
options={[{ name: localeData.txtAddNew, id: 0 }, ...member?.providers || []]}
|
||||
getOptionLabel={(option: Providers) => option.name || ''}
|
||||
value={member?.providers.find((item: Providers) => item.id === idProvider) || null}
|
||||
onChange={(event: React.ChangeEvent<{}>, newValue: Providers | null) => {
|
||||
if (newValue?.id === 0) {
|
||||
// Pengguna memilih opsi "Tambahkan Data Baru"
|
||||
setIdProvider(0); // Reset nilai
|
||||
setShowAddNewForm(true); // Menampilkan formulir tambahan
|
||||
} else {
|
||||
// Pengguna memilih opsi dari hasil pencarian
|
||||
setIdProvider(newValue?.id || 0);
|
||||
setShowAddNewForm(false); // Menyembunyikan formulir tambahan
|
||||
}
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
label={localeData.txtProvider}
|
||||
fullWidth
|
||||
label={localeData.txtDialogMember1}
|
||||
onChange={(e) => {
|
||||
setServiceCode(e.target.value);
|
||||
}}
|
||||
>
|
||||
{member && member?.services?.map((item: MemberService, index:number) => (
|
||||
<MenuItem key={index} value={item.service_code}>{item.name}</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{showAddNewForm && (
|
||||
<Stack direction="column" spacing={1} padding={1}>
|
||||
<Typography variant='body2'>{localeData.txtAddNew} *</Typography>
|
||||
<TextField
|
||||
label={localeData.txtName}
|
||||
fullWidth
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
/>
|
||||
<TextField
|
||||
label={localeData.txtAddress}
|
||||
fullWidth
|
||||
onChange={(e) => setAlamat(e.target.value)}
|
||||
/>
|
||||
</Stack>
|
||||
)}
|
||||
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Typography variant='subtitle1'>{localeData.txtDialogMember1} *</Typography>
|
||||
<Autocomplete
|
||||
id="service_type"
|
||||
options={member?.services || []}
|
||||
getOptionLabel={(option: MemberService) => option.name || ''}
|
||||
value={member?.services.find((item: MemberService) => item.service_code === serviceCode) || null}
|
||||
onChange={(event: React.ChangeEvent<{}>, newValue: MemberService | null) => {
|
||||
setServiceCode(newValue?.service_code || '');
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
label={localeData.txtDialogMember1}
|
||||
fullWidth
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user