Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -210,7 +210,31 @@ class CorporateMemberController extends Controller
|
||||
};
|
||||
$query->getQuery()->orderBy($orderBy, $request->order);
|
||||
})
|
||||
->paginate($per_page);
|
||||
->when($request->search, function ($q, $search) {
|
||||
$q->where('code', 'LIKE', "%".$search."%");
|
||||
$q->orWhereHas('member', function ($subQuery) use ($search) {
|
||||
$subQuery->where('name', 'LIKE', "%".$search."%");
|
||||
});
|
||||
})
|
||||
->when($request->status, function ($q, $search) {
|
||||
if ($search == 'kondisi') {
|
||||
$q->whereHas('files', function ($subQuery) {
|
||||
$subQuery->where('type', 'final-log-kondisi');
|
||||
});
|
||||
} elseif ($search == 'diagnosa') {
|
||||
$q->whereHas('files', function ($subQuery) {
|
||||
$subQuery->where('type', 'final-log-diagnosis');
|
||||
});
|
||||
} elseif ($search == 'result') {
|
||||
$q->whereHas('files', function ($subQuery) {
|
||||
$subQuery->where('type', 'final-log-result');
|
||||
});
|
||||
} elseif ($search == 'none') {
|
||||
$q->doesntHave('files');
|
||||
}
|
||||
})
|
||||
->with(['member','files'])
|
||||
->paginate($per_page);
|
||||
return response()->json(['full_name' => $member->full_name?? null, 'paginations' => Helper::paginateResources(DataListClaimMemberResource::collection($data))]);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Models\Service;
|
||||
use App\Models\Organization;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DataListClaimMemberResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
@@ -16,6 +18,9 @@ class DataListClaimMemberResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$filesGroupByType = $this->files->mapToGroups(function($file) {
|
||||
return [Str::slug($file->type, '_') => $file];
|
||||
});
|
||||
$serviceData = Service::where('code', $this->service_code)->first();
|
||||
$organization = Organization::where('id', $this->organization_id)->first();
|
||||
$organizationName = '-';
|
||||
@@ -43,6 +48,7 @@ class DataListClaimMemberResource extends JsonResource
|
||||
'provider_name' => $organizationName ?? null,
|
||||
'service_type' => $serviceName,
|
||||
'status' => $status,
|
||||
'files_by_type' => $filesGroupByType
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* ---------------------------------- @mui ---------------------------------- */
|
||||
import { Stack, Typography, MenuItem, Grid } from '@mui/material';
|
||||
import { SelectChangeEvent, Stack, Typography, MenuItem, Grid } from '@mui/material';
|
||||
/* ---------------------------------- axios --------------------------------- */
|
||||
// import axios from 'axios';
|
||||
import axios from '../../utils/axios';
|
||||
@@ -122,6 +122,12 @@ export default function List() {
|
||||
label: 'Service Type',
|
||||
isSort: false,
|
||||
},
|
||||
{
|
||||
id: 'files_by_type',
|
||||
align: 'left',
|
||||
label: 'File Upload',
|
||||
isSort: false,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
align: 'center',
|
||||
@@ -136,6 +142,57 @@ export default function List() {
|
||||
},
|
||||
];
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ------------------------------ handle search ----------------------------- */
|
||||
const [searchText, setSearchText] = useState('');
|
||||
|
||||
const handleSearchSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (searchText === '') {
|
||||
searchParams.delete('search');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['search', searchText]]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const searchs = {
|
||||
useSearchs: true,
|
||||
searchText: searchText,
|
||||
setSearchText: setSearchText,
|
||||
handleSearchSubmit: handleSearchSubmit,
|
||||
};
|
||||
/* ------------------------------ handle filter ----------------------------- */
|
||||
const [statusValue, setStatusValue] = useState('all');
|
||||
const [filterData, setStatusData] = useState([]);
|
||||
// handle status
|
||||
const handleStatusChanges = (event: SelectChangeEvent) => {
|
||||
setStatusValue(event.target.value as string);
|
||||
|
||||
if (event.target.value === 'all') {
|
||||
searchParams.delete('status');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([
|
||||
...searchParams.entries(),
|
||||
['status', event.target.value as string],
|
||||
]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const filterStatus = {
|
||||
useFilter: true,
|
||||
config: {
|
||||
label: 'Status',
|
||||
statusValue: statusValue,
|
||||
statusData: filterData,
|
||||
handleStatusChange: handleStatusChanges,
|
||||
},
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
@@ -154,6 +211,14 @@ export default function List() {
|
||||
|
||||
setSearchParams(parameters);
|
||||
|
||||
const status = [
|
||||
{ id: 'kondisi', name: 'Dokumen Billing' },
|
||||
{ id: 'diagnosa', name: 'Dokumen Diagnosa' },
|
||||
{ id: 'result', name: 'Dokumen Penduk Medis' },
|
||||
{ id: 'none', name: 'Belum ada Dokumen' },
|
||||
];
|
||||
setStatusData(status);
|
||||
|
||||
setData({
|
||||
full_name: response.data.full_name,
|
||||
paginations: response.data.paginations.data.map((obj: any) => ({
|
||||
@@ -168,6 +233,35 @@ export default function List() {
|
||||
) : (
|
||||
''
|
||||
),
|
||||
files_by_type:
|
||||
<>
|
||||
{obj.files_by_type?.final_log_diagnosis?.length > 0 ? (
|
||||
<>
|
||||
<Label variant='ghost' color='primary'>
|
||||
File Diagnosa {obj.files_by_type.final_log_diagnosis.length}
|
||||
</Label>
|
||||
<br />
|
||||
</>
|
||||
):('')}
|
||||
{obj.files_by_type?.final_log_kondisi?.length > 0 ? (
|
||||
<>
|
||||
<Label variant='ghost' color='success'>
|
||||
File Billing {obj.files_by_type.final_log_kondisi.length}
|
||||
</Label>
|
||||
<br />
|
||||
</>
|
||||
):('')}
|
||||
{obj.files_by_type?.final_log_result?.length > 0 ? (
|
||||
<>
|
||||
<Label variant='ghost' color='warning'>
|
||||
File Pendukung Medis {obj.files_by_type.final_log_result.length}
|
||||
</Label>
|
||||
</>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
</>
|
||||
,
|
||||
status:
|
||||
obj.status === 'Done' ? (
|
||||
<Label color="success">Done</Label>
|
||||
@@ -221,12 +315,14 @@ export default function List() {
|
||||
<Grid item xs={12}>
|
||||
<Stack>
|
||||
<TableComponent
|
||||
searchs={searchs}
|
||||
headCells={headCells}
|
||||
rows={data.paginations}
|
||||
orders={orders}
|
||||
paginations={paginations}
|
||||
loadings={loadings}
|
||||
params={params}
|
||||
filterStatus={filterStatus}
|
||||
/>
|
||||
</Stack>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user