[Client Portal] Alarm Center
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Helpers\Helper;
|
||||
use App\Models\Member;
|
||||
use App\Models\Claim;
|
||||
use App\Models\ClaimRequest;
|
||||
use App\Models\RequestLog;
|
||||
use App\Services\CorporateMemberService;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -184,17 +185,31 @@ class CorporateMemberController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function showPerMember($corporate_id, $member_id)
|
||||
public function showPerMember(Request $request, $corporate_id, $member_id)
|
||||
{
|
||||
$data = ClaimRequest::where(['member_id' => $member_id])
|
||||
->whereNotNull('claim_id')
|
||||
->paginate(10);
|
||||
return response()->json(Helper::paginateResources(DataListClaimMemberResource::collection($data)));
|
||||
$per_page = $request->has('per_page') ? $request->input('per_page') : 10;
|
||||
|
||||
$data = Member::query()
|
||||
->with(['requestLogs'])
|
||||
->whereHas('currentCorporate', function ($query) use ($corporate_id) {
|
||||
$query->where('corporate_id', $corporate_id);
|
||||
})
|
||||
->find($member_id);
|
||||
|
||||
return response()->json(['full_name' => $data->full_name, 'paginations' => Helper::paginateResources(DataListClaimMemberResource::collection($data->requestLogs()->paginate($per_page)))]);
|
||||
}
|
||||
|
||||
public function serviceMonitoring($corporate_id, $claim_id)
|
||||
public function serviceMonitoring(int $corporate_id, int $request_log_id)
|
||||
{
|
||||
$data = Claim::where('id', $claim_id)->first();
|
||||
// $data = Claim::where('id', $claim_id)->first();
|
||||
|
||||
// return $request_log_id;
|
||||
|
||||
$data = RequestLog::query()
|
||||
->with(['member' => ['currentCorporate', 'person'], 'organization', 'requestLogBenefit' => ['benefit'], 'requestLogDailyMonitorings' => ['requestLogMedicalPlans'],])
|
||||
->find($request_log_id);
|
||||
|
||||
// return $data;
|
||||
return Helper::responseJson(DataServiceMonitoring::make($data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ Route::prefix('client')->group(function () {
|
||||
Route::get('members/{id}', [CorporateMemberController::class, 'show']);
|
||||
Route::get('export-members/list', [CorporateMemberController::class, 'generateMemberList']);
|
||||
Route::get('alarm-center-members/{id}', [CorporateMemberController::class, 'showPerMember']);
|
||||
Route::get('service-monitoring/{id}', [CorporateMemberController::class, 'serviceMonitoring']);
|
||||
Route::get('service-monitoring/{request_log_id}', [CorporateMemberController::class, 'serviceMonitoring']);
|
||||
Route::get('claims/status', [ClaimController::class, 'status']);
|
||||
Route::get('claims', [ClaimController::class, 'index']);
|
||||
Route::get('claims/export', [ClaimController::class, 'export']);
|
||||
@@ -65,8 +65,6 @@ Route::prefix('client')->group(function () {
|
||||
|
||||
Route::get('corporate', [CorporateCurrentController::class, 'index']);
|
||||
Route::put('corporate-update', [CorporateCurrentController::class, 'update']);
|
||||
|
||||
|
||||
});
|
||||
Route::get('claims/{id}', [ClaimController::class, 'show']);
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace Modules\Client\Transformers\AlarmCenter;
|
||||
|
||||
use App\Models\Member;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class DataListClaimMemberResource extends JsonResource
|
||||
{
|
||||
@@ -16,22 +14,13 @@ class DataListClaimMemberResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$member = Member::findOrFail($this->member_id);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'admission_date' => $this->submission_date,
|
||||
'discharge_date' => $this->submission_date,
|
||||
'code' => $this->code,
|
||||
'admission_date' => $this->submission_date ?? null,
|
||||
'discharge_date' => $this->discharge_date ?? null,
|
||||
'code' => $this->code ?? null,
|
||||
'service_type' => $this->service_code == 'IP' ? 'Inpatient' : 'Outpatient',
|
||||
'status' => $this->service_code == 'approved' ? 'Done' : 'OnGoing',
|
||||
'claim_id' => $this->claim_id,
|
||||
// 'memberId' => $this->member_id,
|
||||
'fullName' => $member->name,
|
||||
// 'division' => $this->division_name ?? '',
|
||||
// 'status' => $this->status,
|
||||
// 'claimRequestId' => $this->claim_request_id,
|
||||
// 'submissionDate' => $this->submission_date,
|
||||
];
|
||||
'status' => $this->status === 'requested' || ($this->status === 'approved' && $this->status_final_log) || ($this->status_final_log === 'requested' && $this->status === 'requested') ? 'Ongoing' : ($this->status === 'approved' && $this->status_final_log === 'approved' ? 'Approved' : 'Declined')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,8 @@
|
||||
|
||||
namespace Modules\Client\Transformers\AlarmCenter;
|
||||
|
||||
use App\Models\ClaimRequest;
|
||||
use App\Models\DiagnosisSecondaryClaimHistoryCare;
|
||||
use App\Models\ClaimEncounter;
|
||||
use App\Models\ClaimHistoryCare;
|
||||
use App\Models\Encounter;
|
||||
use App\Models\Member;
|
||||
use App\Models\Icd;
|
||||
use App\Models\Organization;
|
||||
use App\Models\MedicalPlan;
|
||||
use App\Models\CorporateEmployee;
|
||||
use App\Models\DailyMonitoring;
|
||||
use App\Models\LaboratoriumResult;
|
||||
|
||||
|
||||
use App\Helpers\Helper;
|
||||
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class DataServiceMonitoring extends JsonResource
|
||||
{
|
||||
@@ -32,157 +15,38 @@ class DataServiceMonitoring extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$claim_request = ClaimRequest::findOrFail($this->claim_request_id);
|
||||
$member = Member::findOrFail($this->member_id);
|
||||
|
||||
|
||||
// History Care Hospital
|
||||
$historyCareHospital = ClaimHistoryCare::where('claim_id', $this->id)->first();
|
||||
if ($historyCareHospital) {
|
||||
$hospital = Organization::findOrFail($historyCareHospital->organization_id)->name;
|
||||
$mainDianosis = Icd::findOrFail($historyCareHospital->main_diagnosis_id)->name;
|
||||
$mainDianosisCode = Icd::findOrFail($historyCareHospital->main_diagnosis_id)->code;
|
||||
|
||||
$comporatationDiagnosis = DiagnosisSecondaryClaimHistoryCare::where('claim_history_care_id', $historyCareHospital->id)->first();
|
||||
|
||||
$comporatationDiagnosisName = Icd::findOrFail($comporatationDiagnosis->icd_id)->name;
|
||||
$comporatationDiagnosisCode = Icd::findOrFail($comporatationDiagnosis->icd_id)->code;
|
||||
|
||||
$admissionDate = $historyCareHospital->admission_date;
|
||||
$dischargeDate = $historyCareHospital->discharge_date;
|
||||
$serviceCode = $historyCareHospital->service_code;
|
||||
$symptoms = $historyCareHospital->symptoms;
|
||||
$sign = $historyCareHospital->sign;
|
||||
} else {
|
||||
$hospital = '-';
|
||||
$mainDianosis = '-';
|
||||
$mainDianosisCode = '-';
|
||||
$comporatationDiagnosisName = '-';
|
||||
$comporatationDiagnosisCode = '-';
|
||||
$admissionDate = '-';
|
||||
$dischargeDate = '-';
|
||||
$serviceCode = '-';
|
||||
$symptoms = '-';
|
||||
$sign = '-';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$dailyMonitoring = DailyMonitoring::where('claim_id', $claim_request->claim_id)->get()->toArray();
|
||||
$laboratoriumResult = LaboratoriumResult::where('claim_id', $claim_request->claim_id)->get()->toArray();
|
||||
|
||||
// Handle Daily Monitoring
|
||||
$dataDailyMonitoring = [];
|
||||
if (count($dailyMonitoring) > 0){
|
||||
$temp = [];
|
||||
foreach($dailyMonitoring as $data){
|
||||
$temp['date'] = Helper::formatDateOnly($data['created_at']);
|
||||
$temp['time'] = Helper::formatTimeOnly($data['created_at']);
|
||||
$temp['status'] = 'Done';
|
||||
$temp['subject_title'] = $data['subject'];
|
||||
$temp['body_temperature'] = $data['body_temperature']. 'mm[Hg]';
|
||||
$temp['sistole'] = $data['sistole']. 'mm[Hg]';
|
||||
$temp['diastole'] = $data['diastole']. 'mm[Hg]';
|
||||
$temp['respiration_rate'] = $data['respiration_rate']. 'mm[Hg]';
|
||||
$temp['analisis_title'] = $data['analysis'];
|
||||
|
||||
$medicalPlan = MedicalPlan::where('claim_daily_monitoring_id', $data['id'])->get('plan')->toArray();
|
||||
if (count( $medicalPlan) > 0){
|
||||
$temp['Perencanaan'] = [];
|
||||
foreach($medicalPlan as $item){
|
||||
array_push($temp['Perencanaan'], $item['plan']);
|
||||
}
|
||||
|
||||
} else {
|
||||
$temp['Perencanaan'] = [];
|
||||
}
|
||||
array_push($dataDailyMonitoring, $temp);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Laboratorium Result
|
||||
$dataLaboratoruiumResult = [];
|
||||
if (count($laboratoriumResult) > 0){
|
||||
$tempLab = [];
|
||||
foreach($laboratoriumResult as $data){
|
||||
$tempLab['datetime'] = $data['date'];
|
||||
$tempLab['reimbursement_code'] = "RE-0" . $data['id'];
|
||||
$tempLab['examination'] = $data['examination'];
|
||||
$tempLab['location'] = $data['location'];
|
||||
|
||||
if (count($data['lab_result_file']) > 0){
|
||||
$tempLab['file'] = $data['lab_result_file'][0]['lab_result_file_obj']->path; // masih dumy untuk download nya belum bisa multiple
|
||||
}
|
||||
array_push($dataLaboratoruiumResult, $tempLab);
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
"id" => $this->id,
|
||||
"company_name" => $member->currentCorporate->name,
|
||||
"member_name" => $member->name,
|
||||
"member_code" => $member->member_id,
|
||||
"member_id" => $member->id,
|
||||
"phone" => $member->person->phone,
|
||||
"email" => $member->email,
|
||||
"birth_date" => $member->birth_date,
|
||||
"symptoms" => $symptoms,
|
||||
"sign" => $sign,
|
||||
"main_diagnose" => $mainDianosis,
|
||||
"main_diagnose_code" => $mainDianosisCode,
|
||||
"comparative_diagnosis" => $comporatationDiagnosisName,
|
||||
"comparative_diagnosis_code" => $comporatationDiagnosisCode,
|
||||
"service_name" => $serviceCode,
|
||||
"benefit_name" => "Konsultasi Dokter",
|
||||
"hospital" => $hospital,
|
||||
"admission_date" => $admissionDate,
|
||||
"discharge_date" => $dischargeDate,
|
||||
"dialy_monitoring" => $dataDailyMonitoring,
|
||||
// "laboratorium_result" => [
|
||||
// "0" => [
|
||||
// [
|
||||
// "datetime" => "2023-10-05 10:00",
|
||||
// "reimbursement_code" => "RE-011",
|
||||
// "examination" => "SGOT",
|
||||
// "location" => "Pramita Jakarta Ragunan",
|
||||
// "files" => "https:://test.com"
|
||||
// ],
|
||||
// [
|
||||
// "datetime" => "2023-10-05 09:00",
|
||||
// "reimbursement_code" => "RE-010",
|
||||
// "examination" => "SGOT",
|
||||
// "location" => "Pramita Jakarta Ragunan",
|
||||
// "files" => "https:://test.com"
|
||||
// ],
|
||||
// ],
|
||||
// "1" => [
|
||||
// [
|
||||
// "datetime" => "2023-10-04 10:00",
|
||||
// "reimbursement_code" => "RE-09",
|
||||
// "examination" => "Hematologi Lengkap",
|
||||
// "location" => "Pramita Jakarta Ragunan",
|
||||
// "files" => "https:://test.com"
|
||||
// ],
|
||||
// [
|
||||
// "datetime" => "2023-10-04 09:00",
|
||||
// "reimbursement_code" => "RE-08",
|
||||
// "examination" => "Hematologi Lengkap",
|
||||
// "location" => "Pramita Jakarta Ragunan",
|
||||
// "files" => "https:://test.com"
|
||||
// ]
|
||||
// ]
|
||||
|
||||
// ],
|
||||
|
||||
"laboratorium_result" => [$dataLaboratoruiumResult], //
|
||||
|
||||
|
||||
return [
|
||||
'companyName' => $this->member->currentCorporate->name ?? null,
|
||||
'memberId' => $this->member->member_id ?? null,
|
||||
'fullName' => $this->member->full_name ?? null,
|
||||
'dateOfBirth' => $this->member->birth_date ?? null,
|
||||
'dateOfBirth' => $this->member->birth_date ?? null,
|
||||
'phoneNumber' => $this->person->phone ?? null,
|
||||
'email' => $this->member->email ?? ($this->member->person->email ?? null),
|
||||
'serviceName' => $this->service_code === 'IP' ? 'Inpatient' : ($this->service_code === 'OP' ? 'Outpatient' : null),
|
||||
'benefitName' => $this->requestLogBenefit->benefit->description ?? null,
|
||||
'hospital' => $this->organization->name ?? null,
|
||||
'admissionDate' => $this->submission_date ?? null,
|
||||
'dischargeDate' => $this->discharge_date ?? null,
|
||||
'dailyMonitorings' => $this->when($this->service_code === 'IP', collect($this->requesLogDailyMonitorings)->map(function ($requesLogDailyMonitoring) {
|
||||
return [
|
||||
'date' => Helper::formatDateOnly($requesLogDailyMonitoring->created_at) ?? null,
|
||||
'time' => Helper::formatTimeOnly($requesLogDailyMonitoring->created_at) ?? null,
|
||||
'status' => 'Done' ?? null,
|
||||
'subject' => $requesLogDailyMonitoring->subject ?? null,
|
||||
'bodyTemperature' => $requesLogDailyMonitoring->body_temperature ?? null,
|
||||
'sistole' => $requesLogDailyMonitoring->sistole . 'mm[Hg]' ?? null,
|
||||
'diastole' => $requesLogDailyMonitoring->diastole . 'mm[Hg]' ?? null,
|
||||
'respirationRate' => $requesLogDailyMonitoring->respiration_rate . '/min' ?? null,
|
||||
'analysis' => $requesLogDailyMonitoring->analysis ?? null,
|
||||
'plan' => collect($requesLogDailyMonitoring->requestLogMedicalPlans)->map(function ($requestLogMedicalPlan) {
|
||||
return $requestLogMedicalPlan->type == 1 ? $requestLogMedicalPlan->plan : null;
|
||||
})->all(),
|
||||
];
|
||||
})->all()),
|
||||
// 'laboratoriumResults' => collect($this->dailyMonitorings)->map(function ($dailyMonitoring) {
|
||||
// $data['date'][Helper::formatDateOnly($dailyMonitoring->created_at)]
|
||||
// })->all() ?? null
|
||||
];
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,11 @@ class Member extends Model
|
||||
{
|
||||
return $this->hasOneThrough(CorporateDivision::class, CorporateEmployee::class, 'member_id', 'id', 'id', 'division_id');
|
||||
}
|
||||
|
||||
public function requestLogs()
|
||||
{
|
||||
return $this->hasMany(RequestLog::class);
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -270,13 +275,13 @@ class Member extends Model
|
||||
protected function relations(): Attribute
|
||||
{
|
||||
$relation = '-';
|
||||
if ($this->relation_with_principal == 'H'){
|
||||
if ($this->relation_with_principal == 'H') {
|
||||
$relation = 'Husbund';
|
||||
} else if ($this->relation_with_principal == 'W'){
|
||||
} else if ($this->relation_with_principal == 'W') {
|
||||
$relation = 'Wife';
|
||||
} else if ($this->relation_with_principal == 'S'){
|
||||
} else if ($this->relation_with_principal == 'S') {
|
||||
$relation = 'Son';
|
||||
} else if ($this->relation_with_principal == 'D'){
|
||||
} else if ($this->relation_with_principal == 'D') {
|
||||
$relation = 'Daughter';
|
||||
}
|
||||
return Attribute::make(
|
||||
@@ -287,11 +292,11 @@ class Member extends Model
|
||||
protected function statusMarital(): Attribute
|
||||
{
|
||||
$maritalStatus = '-';
|
||||
if ($this->marital_status == 'M'){
|
||||
if ($this->marital_status == 'M') {
|
||||
$maritalStatus = 'Married';
|
||||
} else if ($this->relation_with_principal == 'D'){
|
||||
} else if ($this->relation_with_principal == 'D') {
|
||||
$maritalStatus = 'Divorced';
|
||||
} else if ($this->relation_with_principal == 'S'){
|
||||
} else if ($this->relation_with_principal == 'S') {
|
||||
$maritalStatus = 'Single';
|
||||
}
|
||||
return Attribute::make(
|
||||
@@ -311,12 +316,12 @@ class Member extends Model
|
||||
protected function birthDateeCard(): Attribute
|
||||
{
|
||||
// $date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
if ($this->birth_date){
|
||||
if ($this->birth_date) {
|
||||
$date = $this->birth_date;
|
||||
return Attribute::make(
|
||||
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
|
||||
);
|
||||
} else if ($this->person->birth_date){
|
||||
} else if ($this->person->birth_date) {
|
||||
return Attribute::make(
|
||||
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
|
||||
);
|
||||
|
||||
@@ -94,7 +94,7 @@ class RequestLog extends Model
|
||||
"CLAIM METHOD",
|
||||
"STATUS",
|
||||
];
|
||||
|
||||
|
||||
|
||||
public static $status = [
|
||||
'draft' => 'Draft',
|
||||
@@ -241,6 +241,16 @@ class RequestLog extends Model
|
||||
return $this->belongsTo(Service::class, 'service_code', 'code');
|
||||
}
|
||||
|
||||
public function requestLogBenefit()
|
||||
{
|
||||
return $this->hasOne(RequestLogBenefit::class, 'request_log_id');
|
||||
}
|
||||
|
||||
public function requestLogDailyMonitorings()
|
||||
{
|
||||
return $this->hasMany(RequestLogDailyMonitoring::class, 'request_log_id');
|
||||
}
|
||||
|
||||
public function getPaymentTypeNameAttribute()
|
||||
{
|
||||
return self::$payment_types[$this->payment_type] ?? $this->payment_type;
|
||||
|
||||
@@ -24,7 +24,13 @@ class RequestLogBenefit extends Model
|
||||
'deleted_by',
|
||||
];
|
||||
|
||||
public function benefit(){
|
||||
public function benefit()
|
||||
{
|
||||
return $this->belongsTo(Benefit::class, 'benefit_id', 'id');
|
||||
}
|
||||
|
||||
public function requestLog()
|
||||
{
|
||||
return $this->belongsTo(RequestLog::class, 'aa');
|
||||
}
|
||||
}
|
||||
|
||||
21
app/Models/RequestLogDailyMonitoring.php
Normal file
21
app/Models/RequestLogDailyMonitoring.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RequestLogDailyMonitoring extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function requestLog()
|
||||
{
|
||||
return $this->belongsTo(RequestLog::class);
|
||||
}
|
||||
|
||||
public function requestLogMedicalPlans()
|
||||
{
|
||||
return $this->hasMany(RequestLogMedicalPlan::class);
|
||||
}
|
||||
}
|
||||
16
app/Models/RequestLogMedicalPlan.php
Normal file
16
app/Models/RequestLogMedicalPlan.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RequestLogMedicalPlan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function requestLogDailyMonitoring()
|
||||
{
|
||||
return $this->belongsTo(RequestLogDailyMonitoring::class);
|
||||
}
|
||||
}
|
||||
@@ -196,6 +196,26 @@ export default function Table<T>({
|
||||
/>
|
||||
</form>
|
||||
</Grid>
|
||||
) : exportReport && exportReport.useExport && filterStatus === undefined ? (
|
||||
<Grid item xs={12} lg={10} xl={10}>
|
||||
<form onSubmit={searchs.handleSearchSubmit}>
|
||||
<TextField
|
||||
id="search-input"
|
||||
variant="outlined"
|
||||
onChange={(event) => searchs.setSearchText(event.target.value)}
|
||||
value={searchs.searchText}
|
||||
fullWidth
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<SearchIcon />
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
placeholder="Search Name or Member ID... "
|
||||
/>
|
||||
</form>
|
||||
</Grid>
|
||||
) : (
|
||||
<Grid item xs={12} lg={searchs.fullWidth ? 12 : 6} xl={searchs.fullWidth ? 12 : 6}>
|
||||
<form onSubmit={searchs.handleSearchSubmit}>
|
||||
|
||||
@@ -32,16 +32,18 @@ export default function NavSectionVertical({
|
||||
<Box {...other}>
|
||||
{navConfig.map((group, index) => (
|
||||
<List key={index} disablePadding sx={{ px: 2 }}>
|
||||
<ListSubheaderStyle
|
||||
key={index}
|
||||
sx={{
|
||||
...(isCollapse && {
|
||||
opacity: 0,
|
||||
}),
|
||||
}}
|
||||
>
|
||||
{group.subheader}
|
||||
</ListSubheaderStyle>
|
||||
{group.subheader && (
|
||||
<ListSubheaderStyle
|
||||
key={index}
|
||||
sx={{
|
||||
...(isCollapse && {
|
||||
opacity: 0,
|
||||
}),
|
||||
}}
|
||||
>
|
||||
{group.subheader}
|
||||
</ListSubheaderStyle>
|
||||
)}
|
||||
|
||||
{group.items.map((list) => (
|
||||
<NavListRoot key={list.title} list={list} isCollapse={isCollapse} />
|
||||
|
||||
@@ -7,7 +7,7 @@ const navConfig = [
|
||||
items: [{ title: 'Dashboard', path: '/dashboard' }],
|
||||
},
|
||||
|
||||
// Corporate
|
||||
// Corporate
|
||||
// ----------------------------------------------------------------------
|
||||
{
|
||||
subheader: 'Corporate',
|
||||
@@ -15,21 +15,19 @@ const navConfig = [
|
||||
{
|
||||
title: 'Corporate',
|
||||
path: '/corporate',
|
||||
// icon: ICONS.default,
|
||||
},
|
||||
{
|
||||
title: 'Employee Data',
|
||||
path: '/employee-data',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
// Alarm Center
|
||||
// ----------------------------------------------------------------------
|
||||
{
|
||||
subheader: 'Case Management',
|
||||
items: [
|
||||
{
|
||||
title: 'Employee Data',
|
||||
path: '/employee-data',
|
||||
},
|
||||
{
|
||||
title: 'Alarm Center',
|
||||
path: '/alarm-center',
|
||||
@@ -45,7 +43,6 @@ const navConfig = [
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
// User Management
|
||||
// ----------------------------------------------------------------------
|
||||
// {
|
||||
|
||||
@@ -1,105 +1,15 @@
|
||||
/* ---------------------------------- react --------------------------------- */
|
||||
import { useState, SyntheticEvent } from 'react';
|
||||
/* ---------------------------------- @mui ---------------------------------- */
|
||||
import { Box, Tabs, Tab, Container, Grid, Card } from '@mui/material';
|
||||
import { styled } from '@mui/material/styles';
|
||||
import { Container, Grid } from '@mui/material';
|
||||
/* ------------------------------- components ------------------------------- */
|
||||
import Page from '../../components/Page';
|
||||
/* ---------------------------------- hooks --------------------------------- */
|
||||
import useSettings from '../../hooks/useSettings';
|
||||
import List from './List';
|
||||
import ServiceMonitoring from './ServiceMonitoring';
|
||||
import UserProfile from './UserProfile';
|
||||
import HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs';
|
||||
|
||||
/* ------------------------------ tabs setting ------------------------------ */
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
|
||||
interface TabPanelProps {
|
||||
children?: React.ReactNode;
|
||||
index: number;
|
||||
value: number;
|
||||
}
|
||||
|
||||
interface StyledTabsProps {
|
||||
children?: React.ReactNode;
|
||||
value: number;
|
||||
onChange: (event: React.SyntheticEvent, newValue: number) => void;
|
||||
}
|
||||
|
||||
interface StyledTabProps {
|
||||
label: string;
|
||||
icon?: string | React.ReactElement;
|
||||
}
|
||||
|
||||
/* -------------------------------- tab style ------------------------------- */
|
||||
|
||||
function TabPanel(props: TabPanelProps) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
role="tabpanel"
|
||||
hidden={value !== index}
|
||||
id={`simple-tabpanel-${index}`}
|
||||
aria-labelledby={`simple-tab-${index}`}
|
||||
{...other}
|
||||
>
|
||||
{value === index && <Box>{children}</Box>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function a11yProps(index: number) {
|
||||
return {
|
||||
id: `simple-tab-${index}`,
|
||||
'aria-controls': `simple-tabpanel-${index}`,
|
||||
};
|
||||
}
|
||||
|
||||
const StyledTabs = styled((props: StyledTabsProps) => <Tabs {...props} />)({
|
||||
backgroundColor: '#F4F6F8',
|
||||
padding: '0 24px',
|
||||
'& .MuiTabs-indicator': {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
'& .MuiTabs-indicatorSpan': {
|
||||
maxWidth: 40,
|
||||
backgroundColor: '#635ee7',
|
||||
},
|
||||
});
|
||||
|
||||
const StyledTab = styled((props: StyledTabProps) => <Tab disableRipple {...props} />)(
|
||||
({ theme }) => ({
|
||||
textTransform: 'none',
|
||||
fontWeight: 600,
|
||||
color: theme.palette.grey[600],
|
||||
marginRight: '5rem',
|
||||
'&.Mui-selected': {
|
||||
color: '#212B36',
|
||||
borderBottom: '2px solid ' + theme.palette.primary.main,
|
||||
},
|
||||
'&:hover': {
|
||||
color: '#212B36',
|
||||
opacity: 1,
|
||||
borderBottom: '2px solid ' + theme.palette.primary.main,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
export default function Drugs() {
|
||||
const { themeStretch } = useSettings();
|
||||
|
||||
const [value, setValue] = useState(0);
|
||||
const handleChange = (event: SyntheticEvent, newValue: number) => {
|
||||
setValue(newValue);
|
||||
};
|
||||
|
||||
return (
|
||||
<Page title="Alarm Center">
|
||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||
@@ -107,29 +17,12 @@ export default function Drugs() {
|
||||
heading={'Alarm Center'}
|
||||
links={[
|
||||
{ name: 'Case Management', href: '/alarm-center' },
|
||||
{ name: 'Alarm Center', href: '/alarm-center'}
|
||||
{ name: 'Alarm Center', href: '/alarm-center' },
|
||||
]}
|
||||
/>
|
||||
<Grid container>
|
||||
<Grid item xs={12} lg={12} md={12}>
|
||||
{/* <Card> */}
|
||||
{/* <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
||||
<StyledTabs value={value} onChange={handleChange} aria-label="basic tabs example">
|
||||
<StyledTab label="All Data" {...a11yProps(0)} />
|
||||
<StyledTab label="Ongoing" {...a11yProps(1)} />
|
||||
<StyledTab label="Done" {...a11yProps(2)} />
|
||||
</StyledTabs>
|
||||
</Box> */}
|
||||
<TabPanel value={value} index={0}>
|
||||
<List />
|
||||
</TabPanel>
|
||||
{/* <TabPanel value={value} index={1}>
|
||||
<ServiceMonitoring/>
|
||||
</TabPanel>
|
||||
<TabPanel value={value} index={2}>
|
||||
<UserProfile />
|
||||
</TabPanel> */}
|
||||
{/* </Card> */}
|
||||
<List />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
|
||||
@@ -1,149 +1,23 @@
|
||||
/* ---------------------------------- @mui ---------------------------------- */
|
||||
import {
|
||||
Paper,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TextField,
|
||||
Stack,
|
||||
Button,
|
||||
TableSortLabel,
|
||||
Box,
|
||||
SelectChangeEvent,
|
||||
Typography,
|
||||
MenuItem
|
||||
} from '@mui/material';
|
||||
import { visuallyHidden } from '@mui/utils';
|
||||
import { SelectChangeEvent, MenuItem } from '@mui/material';
|
||||
/* ---------------------------------- axios --------------------------------- */
|
||||
// import axios from 'axios';
|
||||
import axios from '../../utils/axios';
|
||||
/* ---------------------------------- react --------------------------------- */
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
|
||||
/* -------------------------------- component ------------------------------- */
|
||||
import Iconify from '../../components/Iconify';
|
||||
import BaseTablePagination from '../../components/BaseTablePagination';
|
||||
import TableComponent from '../../components/Table';
|
||||
|
||||
/* ---------------------------------- hooks --------------------------------- */
|
||||
import useMap from '../../hooks/useMap';
|
||||
/* ---------------------------------- theme --------------------------------- */
|
||||
import palette from '../../theme/palette';
|
||||
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
|
||||
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
|
||||
import { useSearchParams, useNavigate, Link } from 'react-router-dom';
|
||||
import { useSearchParams, useNavigate } from 'react-router-dom';
|
||||
import { fDateSuffix } from '../../utils/formatTime';
|
||||
import TableMoreMenu from '../../components/table/TableMoreMenu';
|
||||
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
|
||||
import DetailDataMember from './ListMember';
|
||||
import Label from '../../components/Label';
|
||||
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
|
||||
// type PaginationTableProps = {
|
||||
// current_page: number;
|
||||
// from: number;
|
||||
// last_page: number;
|
||||
// links: [];
|
||||
// path: string;
|
||||
// per_page: number;
|
||||
// to: number;
|
||||
// total: number;
|
||||
// };
|
||||
|
||||
// type DataTableProps = {
|
||||
// fullName: string;
|
||||
// memberId: string;
|
||||
// service: string;
|
||||
// start_date: string;
|
||||
// end_date: string;
|
||||
// status: boolean | number;
|
||||
// };
|
||||
|
||||
// /* -------------------------------------------------------------------------- */
|
||||
|
||||
// /* -------------------------- enchanced table head -------------------------- */
|
||||
|
||||
// type Order = 'asc' | 'desc';
|
||||
|
||||
// interface HeadCell {
|
||||
// id: string;
|
||||
// label: string;
|
||||
// }
|
||||
|
||||
// const headCells: readonly HeadCell[] = [
|
||||
// {
|
||||
// id: 'name',
|
||||
// label: 'Name',
|
||||
// },
|
||||
// {
|
||||
// id: 'member_id',
|
||||
// label: 'Member ID',
|
||||
// },
|
||||
// {
|
||||
// id: 'service',
|
||||
// label: 'Service',
|
||||
// },
|
||||
// {
|
||||
// id: 'start_date',
|
||||
// label: 'Start Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'end_date',
|
||||
// label: 'End Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'status',
|
||||
// label: 'Status',
|
||||
// },
|
||||
// ];
|
||||
|
||||
// interface EnhancedTableProps {
|
||||
// onRequestSort: (event: React.MouseEvent<unknown>, property: string) => void;
|
||||
// order: Order;
|
||||
// orderBy: string;
|
||||
// }
|
||||
|
||||
// function EnhancedTableHead(props: EnhancedTableProps) {
|
||||
// const { order, orderBy, onRequestSort } = props;
|
||||
// const createSortHandler = (property: string) => (event: React.MouseEvent<unknown>) => {
|
||||
// onRequestSort(event, property);
|
||||
// };
|
||||
|
||||
// return (
|
||||
// <TableHead>
|
||||
// <TableRow>
|
||||
// <TableCell align="center">No</TableCell>
|
||||
// {headCells.map((headCell) => (
|
||||
// <TableCell
|
||||
// key={headCell.id}
|
||||
// sortDirection={orderBy === headCell.id ? order : false}
|
||||
// align="center"
|
||||
// >
|
||||
// <TableSortLabel
|
||||
// active={orderBy === headCell.id}
|
||||
// direction={orderBy === headCell.id ? order : 'asc'}
|
||||
// onClick={createSortHandler(headCell.id)}
|
||||
// >
|
||||
// {headCell.label}
|
||||
// {orderBy === headCell.id ? (
|
||||
// <Box component="span" sx={visuallyHidden}>
|
||||
// {order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
||||
// </Box>
|
||||
// ) : null}
|
||||
// </TableSortLabel>
|
||||
// </TableCell>
|
||||
// ))}
|
||||
// </TableRow>
|
||||
// </TableHead>
|
||||
// );
|
||||
// }
|
||||
import { Stack } from '@mui/material';
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@@ -237,7 +111,7 @@ export default function List() {
|
||||
handleSearchSubmit: handleSearchSubmit,
|
||||
};
|
||||
|
||||
/* ------------------------------ handle filter ----------------------------- */
|
||||
/* ------------------------------ handle filter ----------------------------- */
|
||||
const [statusValue, setStatusValue] = useState('all');
|
||||
const [filterData, setStatusData] = useState([]);
|
||||
|
||||
@@ -263,7 +137,7 @@ export default function List() {
|
||||
config: {
|
||||
label: 'Status',
|
||||
statusValue: statusValue,
|
||||
filterData: filterData,
|
||||
statusData: filterData,
|
||||
handleStatusChange: handleStatusChanges,
|
||||
},
|
||||
};
|
||||
@@ -273,13 +147,16 @@ export default function List() {
|
||||
|
||||
const handleStartDateChanges = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
console.log(startDateValue)
|
||||
console.log(startDateValue);
|
||||
if (startDateValue === '') {
|
||||
searchParams.delete('start_date');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['start_date', startDateValue]]);
|
||||
const params = Object.fromEntries([
|
||||
...searchParams.entries(),
|
||||
['start_date', startDateValue],
|
||||
]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
@@ -314,7 +191,7 @@ export default function List() {
|
||||
};
|
||||
|
||||
/* -------------------------------- handle export --------------------------- */
|
||||
const handleExportReport = async () => {
|
||||
const handleExportReport = async () => {
|
||||
var filter = Object.fromEntries([...searchParams.entries()]);
|
||||
|
||||
await axios
|
||||
@@ -339,8 +216,8 @@ export default function List() {
|
||||
startDate: startDateValue,
|
||||
endDate: endDateValue,
|
||||
status: statusValue,
|
||||
handleExportReport: handleExportReport
|
||||
}
|
||||
handleExportReport: handleExportReport,
|
||||
};
|
||||
|
||||
/* -------------------------------- headCell -------------------------------- */
|
||||
const headCells: HeadCell<never>[] = [
|
||||
@@ -356,7 +233,7 @@ export default function List() {
|
||||
label: 'Name',
|
||||
isSort: true,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
id: 'start_date',
|
||||
align: 'center',
|
||||
@@ -400,72 +277,34 @@ export default function List() {
|
||||
});
|
||||
|
||||
const status = [
|
||||
{"id": 1, "name": "Done" },
|
||||
{"id": 0, "name": "On Going" },
|
||||
|
||||
]
|
||||
setStatusData(status)
|
||||
{ id: 1, name: 'Done' },
|
||||
{ id: 0, name: 'On Going' },
|
||||
];
|
||||
setStatusData(status);
|
||||
|
||||
setData(
|
||||
response.data.data.map((obj: any) => {
|
||||
return {
|
||||
...obj,
|
||||
// memberId:
|
||||
// // <Link to={'/user-profile/'+obj.personId} >
|
||||
// <Button
|
||||
// onClick={() => navigate ('/user-profile/'+obj.personId)}
|
||||
// >{obj.memberId}</Button>
|
||||
// ,
|
||||
start_date:
|
||||
<Label>{ fDateSuffix(obj.start_date) }</Label>
|
||||
,
|
||||
end_date:
|
||||
<Label> { fDateSuffix(obj.end_date) }</Label>
|
||||
,
|
||||
// status:
|
||||
// obj.status === 1 ? (
|
||||
// <Typography
|
||||
// sx={{
|
||||
// background: 'rgba(84, 214, 44, 0.16)',
|
||||
// color: '#229A16',
|
||||
// paddingX: 1.5,
|
||||
// paddingY: 1,
|
||||
// borderRadius: 3,
|
||||
// }} variant='overline'
|
||||
// >
|
||||
// Done
|
||||
// </Typography>
|
||||
// ) : (
|
||||
// <Typography
|
||||
// sx={{
|
||||
// background: 'rgba(255, 193, 7, 0.16)',
|
||||
// color: '#BF6919',
|
||||
// paddingX: 1.5,
|
||||
// paddingY: 1,
|
||||
// borderRadius: 3,
|
||||
// }} variant='overline'
|
||||
// >
|
||||
// Ongoing
|
||||
// </Typography>
|
||||
// ),
|
||||
action:
|
||||
<TableMoreMenu actions={
|
||||
response.data.data.map((obj: any) => ({
|
||||
...obj,
|
||||
start_date: <Label>{fDateSuffix(obj.start_date)}</Label>,
|
||||
end_date: <Label> {fDateSuffix(obj.end_date)}</Label>,
|
||||
action: (
|
||||
<TableMoreMenu
|
||||
actions={
|
||||
<>
|
||||
<MenuItem onClick={() => navigate('member/'+obj.id )}>
|
||||
<MenuItem onClick={() => navigate('member/' + obj.id)}>
|
||||
<VisibilityOutlinedIcon />
|
||||
View
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
};
|
||||
})
|
||||
}
|
||||
/>
|
||||
),
|
||||
}))
|
||||
);
|
||||
|
||||
setPaginationTable(response.data);
|
||||
setRowsPerPage(response.data.per_page);
|
||||
|
||||
|
||||
|
||||
if (searchParams.get('page')) {
|
||||
//@ts-ignore
|
||||
const currentPage = parseInt(searchParams.get('page')) - 1;
|
||||
@@ -488,7 +327,6 @@ export default function List() {
|
||||
loadings={loadings}
|
||||
params={params}
|
||||
searchs={searchs}
|
||||
// filters={filters}
|
||||
filterStatus={filterStatus}
|
||||
filterStartDate={filterStartDate}
|
||||
filterEndDate={filterEndDate}
|
||||
|
||||
@@ -1,23 +1,5 @@
|
||||
/* ---------------------------------- @mui ---------------------------------- */
|
||||
import {
|
||||
Paper,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TextField,
|
||||
Stack,
|
||||
Button,
|
||||
TableSortLabel,
|
||||
Box,
|
||||
SelectChangeEvent,
|
||||
Typography,
|
||||
MenuItem,
|
||||
Grid
|
||||
} from '@mui/material';
|
||||
import { visuallyHidden } from '@mui/utils';
|
||||
import { Stack, Typography, MenuItem, Grid } from '@mui/material';
|
||||
/* ---------------------------------- axios --------------------------------- */
|
||||
// import axios from 'axios';
|
||||
import axios from '../../utils/axios';
|
||||
@@ -25,137 +7,27 @@ import axios from '../../utils/axios';
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
|
||||
/* -------------------------------- component ------------------------------- */
|
||||
import Iconify from '../../components/Iconify';
|
||||
import BaseTablePagination from '../../components/BaseTablePagination';
|
||||
import TableComponent from '../../components/Table';
|
||||
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
|
||||
|
||||
/* ---------------------------------- hooks --------------------------------- */
|
||||
import useMap from '../../hooks/useMap';
|
||||
/* ---------------------------------- theme --------------------------------- */
|
||||
import palette from '../../theme/palette';
|
||||
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
|
||||
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
|
||||
import { useSearchParams, useNavigate, Link, useParams } from 'react-router-dom';
|
||||
import { fDateSuffix, fPostFormat } from '../../utils/formatTime';
|
||||
import { useSearchParams, useNavigate, useParams } from 'react-router-dom';
|
||||
import { fDateSuffix } from '../../utils/formatTime';
|
||||
import TableMoreMenu from '../../components/table/TableMoreMenu';
|
||||
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
|
||||
import Label from '../../components/Label';
|
||||
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
|
||||
type DataList = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
// type PaginationTableProps = {
|
||||
// current_page: number;
|
||||
// from: number;
|
||||
// last_page: number;
|
||||
// links: [];
|
||||
// path: string;
|
||||
// per_page: number;
|
||||
// to: number;
|
||||
// total: number;
|
||||
// };
|
||||
|
||||
// type DataTableProps = {
|
||||
// fullName: string;
|
||||
// memberId: string;
|
||||
// service: string;
|
||||
// start_date: string;
|
||||
// end_date: string;
|
||||
// status: boolean | number;
|
||||
// };
|
||||
|
||||
// /* -------------------------------------------------------------------------- */
|
||||
|
||||
// /* -------------------------- enchanced table head -------------------------- */
|
||||
|
||||
// type Order = 'asc' | 'desc';
|
||||
|
||||
// interface HeadCell {
|
||||
// id: string;
|
||||
// label: string;
|
||||
// }
|
||||
|
||||
// const headCells: readonly HeadCell[] = [
|
||||
// {
|
||||
// id: 'name',
|
||||
// label: 'Name',
|
||||
// },
|
||||
// {
|
||||
// id: 'member_id',
|
||||
// label: 'Member ID',
|
||||
// },
|
||||
// {
|
||||
// id: 'service',
|
||||
// label: 'Service',
|
||||
// },
|
||||
// {
|
||||
// id: 'start_date',
|
||||
// label: 'Start Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'end_date',
|
||||
// label: 'End Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'status',
|
||||
// label: 'Status',
|
||||
// },
|
||||
// ];
|
||||
|
||||
// interface EnhancedTableProps {
|
||||
// onRequestSort: (event: React.MouseEvent<unknown>, property: string) => void;
|
||||
// order: Order;
|
||||
// orderBy: string;
|
||||
// }
|
||||
|
||||
// function EnhancedTableHead(props: EnhancedTableProps) {
|
||||
// const { order, orderBy, onRequestSort } = props;
|
||||
// const createSortHandler = (property: string) => (event: React.MouseEvent<unknown>) => {
|
||||
// onRequestSort(event, property);
|
||||
// };
|
||||
|
||||
// return (
|
||||
// <TableHead>
|
||||
// <TableRow>
|
||||
// <TableCell align="center">No</TableCell>
|
||||
// {headCells.map((headCell) => (
|
||||
// <TableCell
|
||||
// key={headCell.id}
|
||||
// sortDirection={orderBy === headCell.id ? order : false}
|
||||
// align="center"
|
||||
// >
|
||||
// <TableSortLabel
|
||||
// active={orderBy === headCell.id}
|
||||
// direction={orderBy === headCell.id ? order : 'asc'}
|
||||
// onClick={createSortHandler(headCell.id)}
|
||||
// >
|
||||
// {headCell.label}
|
||||
// {orderBy === headCell.id ? (
|
||||
// <Box component="span" sx={visuallyHidden}>
|
||||
// {order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
||||
// </Box>
|
||||
// ) : null}
|
||||
// </TableSortLabel>
|
||||
// </TableCell>
|
||||
// ))}
|
||||
// </TableRow>
|
||||
// </TableHead>
|
||||
// );
|
||||
// }
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
export default function List() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { corporateValue } = useContext(UserCurrentCorporateContext);
|
||||
|
||||
const [data, setData] = useState([]);
|
||||
const [data, setData] = useState({
|
||||
full_name: '',
|
||||
paginations: [],
|
||||
});
|
||||
const { id } = useParams();
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -182,7 +54,7 @@ export default function List() {
|
||||
|
||||
/* ------------------------------ handle order ------------------------------ */
|
||||
const [order, setOrder] = useState<Order>('asc');
|
||||
const [orderBy, setOrderBy] = useState('fullName');
|
||||
const [orderBy, setOrderBy] = useState('admission_date');
|
||||
|
||||
const orders = {
|
||||
order: order,
|
||||
@@ -215,141 +87,10 @@ export default function List() {
|
||||
paginationTable: paginationTable,
|
||||
setPaginationTable: setPaginationTable,
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* ------------------------------ handle search ----------------------------- */
|
||||
const [searchText, setSearchText] = useState('');
|
||||
const [name, setName] = 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: false,
|
||||
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: false,
|
||||
config: {
|
||||
label: 'Status',
|
||||
statusValue: statusValue,
|
||||
filterData: filterData,
|
||||
handleStatusChange: handleStatusChanges,
|
||||
},
|
||||
};
|
||||
|
||||
// handle start date
|
||||
const [startDateValue, setStartDateValue] = useState('');
|
||||
|
||||
const handleStartDateChanges = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
console.log(startDateValue)
|
||||
if (startDateValue === '') {
|
||||
searchParams.delete('start_date');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['start_date', startDateValue]]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const filterStartDate = {
|
||||
useFilter: false,
|
||||
startDate: startDateValue,
|
||||
setStartDate: setStartDateValue,
|
||||
handleStartDateChange: handleStartDateChanges,
|
||||
};
|
||||
|
||||
// handle end date
|
||||
const [endDateValue, setEndDateValue] = useState('');
|
||||
|
||||
const handleEndDateChanges = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (endDateValue === '') {
|
||||
searchParams.delete('end_date');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['end_date', endDateValue]]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const filterEndDate = {
|
||||
useFilter: false,
|
||||
endDate: endDateValue,
|
||||
setEndDate: setEndDateValue,
|
||||
handleEndDateChange: handleEndDateChanges,
|
||||
};
|
||||
|
||||
/* -------------------------------- handle export --------------------------- */
|
||||
const handleExportReport = async () => {
|
||||
var filter = Object.fromEntries([...searchParams.entries()]);
|
||||
|
||||
await axios
|
||||
.get('claims/export', { params: filter })
|
||||
.then((res) => {
|
||||
enqueueSnackbar('Data berhasil di Export', {
|
||||
variant: 'success',
|
||||
anchorOrigin: { horizontal: 'right', vertical: 'top' },
|
||||
});
|
||||
|
||||
document.location.href = res.data.data.file_url;
|
||||
})
|
||||
.catch((err) =>
|
||||
enqueueSnackbar('Data Gagal di Export', {
|
||||
variant: 'error',
|
||||
anchorOrigin: { horizontal: 'right', vertical: 'top' },
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const exportReport = {
|
||||
useExport: false,
|
||||
startDate: startDateValue,
|
||||
endDate: endDateValue,
|
||||
status: statusValue,
|
||||
handleExportReport: handleExportReport
|
||||
}
|
||||
|
||||
/* -------------------------------- headCell -------------------------------- */
|
||||
const headCells: HeadCell<never>[] = [
|
||||
const headCells: HeadCell<never>[] = [
|
||||
{
|
||||
id: 'admission_date',
|
||||
align: 'center',
|
||||
@@ -368,6 +109,12 @@ export default function List() {
|
||||
label: 'Code',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'service_type',
|
||||
align: 'center',
|
||||
label: 'Service Type',
|
||||
isSort: false,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
align: 'center',
|
||||
@@ -398,59 +145,45 @@ export default function List() {
|
||||
params: { ...parameters },
|
||||
});
|
||||
|
||||
const status = [
|
||||
{"id": 1, "name": "Done" },
|
||||
{"id": 0, "name": "On Going" },
|
||||
setSearchParams(parameters);
|
||||
|
||||
]
|
||||
setStatusData(status)
|
||||
const datatable = response.data.data;
|
||||
|
||||
// if (response.data.data.length > 0){
|
||||
// setIsLoading(true);
|
||||
// } else {
|
||||
// setIsLoading(false);
|
||||
// }
|
||||
|
||||
const dataName = response.data.data[0].fullName
|
||||
setName(dataName)
|
||||
setData(
|
||||
datatable.map((obj: any) => {
|
||||
return {
|
||||
...obj,
|
||||
admission_date:
|
||||
<Label>{ fDateSuffix(obj.admission_date) }</Label>
|
||||
,
|
||||
discharge_date:
|
||||
<Label>{ fDateSuffix(obj.discharge_date) }</Label>
|
||||
,
|
||||
status:
|
||||
obj.status === 'Done' ? (
|
||||
<Label color='success'>
|
||||
Done
|
||||
</Label>
|
||||
) : (
|
||||
<Label color='warning'>
|
||||
Ongoing
|
||||
</Label>
|
||||
),
|
||||
action:
|
||||
<TableMoreMenu actions={
|
||||
setData({
|
||||
full_name: response.data.full_name,
|
||||
paginations: response.data.paginations.data.map((obj: any) => ({
|
||||
...obj,
|
||||
admission_date: obj.admission_date ? (
|
||||
<Label> {fDateSuffix(obj.admission_date)} </Label>
|
||||
) : (
|
||||
''
|
||||
),
|
||||
discharge_date: obj.discharge_date ? (
|
||||
<Label> {fDateSuffix(obj.discharge_date)} </Label>
|
||||
) : (
|
||||
''
|
||||
),
|
||||
status:
|
||||
obj.status === 'Done' ? (
|
||||
<Label color="success">Done</Label>
|
||||
) : (
|
||||
<Label color="warning">Ongoing</Label>
|
||||
),
|
||||
action: (
|
||||
<TableMoreMenu
|
||||
actions={
|
||||
<>
|
||||
<MenuItem onClick={() => navigate('service-monitoring/'+obj.claim_id )}>
|
||||
<MenuItem onClick={() => navigate('service-monitoring/' + obj.id)}>
|
||||
<VisibilityOutlinedIcon />
|
||||
View
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
/>
|
||||
),
|
||||
})),
|
||||
});
|
||||
|
||||
setPaginationTable(response.data);
|
||||
setRowsPerPage(response.data.per_page);
|
||||
|
||||
|
||||
setPaginationTable(response.data.paginations);
|
||||
setRowsPerPage(response.data.paginations.per_page);
|
||||
|
||||
if (searchParams.get('page')) {
|
||||
//@ts-ignore
|
||||
@@ -463,17 +196,14 @@ export default function List() {
|
||||
setIsLoading(false);
|
||||
})();
|
||||
}, [appliedParams, searchParams, order, orderBy, setSearchParams, corporateValue]);
|
||||
console.log(loadings);
|
||||
|
||||
return (
|
||||
<Grid container spacing={8}>
|
||||
<Grid item xs={12} paddingX="24px" >
|
||||
<Stack direction="row" alignItems="center">
|
||||
<ArrowBackIosIcon
|
||||
onClick={() => navigate(`/alarm-center`)}
|
||||
sx={{ cursor: 'pointer' }}
|
||||
/>
|
||||
<Grid container spacing={8} padding={3}>
|
||||
<Grid item xs={12}>
|
||||
<Stack direction="row" alignItems="center" gap={3}>
|
||||
<ArrowBackIosIcon onClick={() => navigate(`/alarm-center`)} sx={{ cursor: 'pointer' }} />
|
||||
<Typography variant="h5" sx={{ flexGrow: 1 }}>
|
||||
{name}
|
||||
{data.full_name}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Grid>
|
||||
@@ -481,24 +211,14 @@ export default function List() {
|
||||
<Stack>
|
||||
<TableComponent
|
||||
headCells={headCells}
|
||||
rows={data}
|
||||
rows={data.paginations}
|
||||
orders={orders}
|
||||
paginations={paginations}
|
||||
loadings={loadings}
|
||||
params={params}
|
||||
searchs={searchs}
|
||||
// filters={filters}
|
||||
filterStatus={filterStatus}
|
||||
filterStartDate={filterStartDate}
|
||||
filterEndDate={filterEndDate}
|
||||
exportReport={exportReport}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,15 +39,12 @@ export default function UserProfile() {
|
||||
});
|
||||
}, []);
|
||||
|
||||
// console.log('data', data);
|
||||
// console.log('data', data);
|
||||
|
||||
return (
|
||||
<Page title="Profile">
|
||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||
<Stack direction="row" alignItems="center" sx={{ marginBottom: 2 }}>
|
||||
{/* <IconButton sx={{ marginRight: '10px', color: '#424242' }} onClick={() => navigate()}>
|
||||
<Iconify icon="heroicons-outline:arrow-narrow-left" />
|
||||
</IconButton> */}
|
||||
<ButtonBack />
|
||||
<Typography variant="h5">Profil Peserta</Typography>
|
||||
</Stack>
|
||||
@@ -74,7 +71,7 @@ export default function UserProfile() {
|
||||
</Grid>
|
||||
{/* Item 2 */}
|
||||
<Grid item xs={12}>
|
||||
<CardClaimHistory data={data}/>
|
||||
<CardClaimHistory data={data} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -121,14 +121,14 @@ export default function ServiceMonitoring() {
|
||||
const { corporateValue } = useContext(UserCurrentCorporateContext);
|
||||
const { id } = useParams();
|
||||
const claimId = '2';
|
||||
// console.log('id', id);
|
||||
// console.log('id', id);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('fetching data...');
|
||||
axios
|
||||
.get('/data/' + id)
|
||||
.then((response) => {
|
||||
// console.log('data fetched...', response.data);
|
||||
// console.log('data fetched...', response.data);
|
||||
setData(response.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -138,7 +138,7 @@ export default function ServiceMonitoring() {
|
||||
axios
|
||||
.get('/corporate-manage/' + corporateValue)
|
||||
.then((response) => {
|
||||
// console.log('corporate fetched...', response.data);
|
||||
// console.log('corporate fetched...', response.data);
|
||||
setCorporate(response.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -146,15 +146,15 @@ export default function ServiceMonitoring() {
|
||||
});
|
||||
}, []);
|
||||
|
||||
// console.log('Data:', data);
|
||||
// console.log('Data:', data);
|
||||
const [encounterData, setEncounterData] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
// console.log('fetching encounter data...');
|
||||
// console.log('fetching encounter data...');
|
||||
axios
|
||||
.get('/claims/${claim_id}/encounters')
|
||||
.then((response) => {
|
||||
// console.log('encounter data fetched...', response.data);
|
||||
// console.log('encounter data fetched...', response.data);
|
||||
setEncounterData(response.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -89,8 +89,8 @@ export default function Router() {
|
||||
},
|
||||
{
|
||||
path: '/employee-data/user-profile/:id',
|
||||
element: <EmployeeDataUserProfile/>,
|
||||
}
|
||||
element: <EmployeeDataUserProfile />,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -112,13 +112,12 @@ export default function Router() {
|
||||
element: <AlarmCenterMemberPerList />,
|
||||
},
|
||||
{
|
||||
path: 'member/:id/service-monitoring/:id',
|
||||
path: 'member/:memberId/service-monitoring/:requestLogId',
|
||||
element: <AlarmCenterServiceMonitoring />,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
path: '/claim-submit',
|
||||
element: (
|
||||
@@ -135,7 +134,7 @@ export default function Router() {
|
||||
},
|
||||
{
|
||||
path: 'dialog-detail',
|
||||
element: <DialogDetailClaim/>
|
||||
element: <DialogDetailClaim />,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -155,7 +154,7 @@ export default function Router() {
|
||||
},
|
||||
{
|
||||
path: 'dialog-detail',
|
||||
element: <DialogDetailClaim/>
|
||||
element: <DialogDetailClaim />,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -180,7 +179,7 @@ export default function Router() {
|
||||
{
|
||||
path: '/claim-report/detail-history/:id',
|
||||
element: <DetailHitoryClaimReport />,
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -262,9 +261,9 @@ const AlarmCenterUserProfile = Loadable(lazy(() => import('../pages/AlarmCenter/
|
||||
const ClaimReport = Loadable(lazy(() => import('../pages/ClaimReport/Index')));
|
||||
const Claims = Loadable(lazy(() => import('../pages/Claims/Index')));
|
||||
const ClaimShow = Loadable(lazy(() => import('../pages/Claims/Show')));
|
||||
const DialogDetailClaim = Loadable(lazy(()=> import('../pages/ClaimReport/DialogDetailClaim')));
|
||||
const DetailClaimReport = Loadable(lazy(()=> import('../pages/ClaimReport/Detail')));
|
||||
const DetailHitoryClaimReport = Loadable(lazy(()=> import('../pages/ClaimReport/DetailHistory')));
|
||||
const DialogDetailClaim = Loadable(lazy(() => import('../pages/ClaimReport/DialogDetailClaim')));
|
||||
const DetailClaimReport = Loadable(lazy(() => import('../pages/ClaimReport/Detail')));
|
||||
const DetailHitoryClaimReport = Loadable(lazy(() => import('../pages/ClaimReport/DetailHistory')));
|
||||
|
||||
// Claim submit
|
||||
const ClaimSubmit = Loadable(lazy(() => import('../pages/ClaimSubmit/Index')));
|
||||
|
||||
Reference in New Issue
Block a user