rebase
This commit is contained in:
@@ -20,10 +20,12 @@ class CorporateBenefitController extends Controller
|
|||||||
$benefits = CorporateBenefit::query()
|
$benefits = CorporateBenefit::query()
|
||||||
->filter($request->all())
|
->filter($request->all())
|
||||||
->where('corporate_id', $corporate_id)
|
->where('corporate_id', $corporate_id)
|
||||||
->paginate(0)
|
->with('benefit', 'plan')
|
||||||
|
->paginate(10)
|
||||||
->appends($request->all());
|
->appends($request->all());
|
||||||
return $benefits;
|
return $benefits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function activation(Request $request, $benefit_id)
|
public function activation(Request $request, $benefit_id)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
@@ -31,9 +33,8 @@ class CorporateBenefitController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// abort(404);
|
// abort(404);
|
||||||
|
$benefit = CorporateBenefit::find($benefit_id);
|
||||||
$benefit = CorporateBenefit::findOrFail($benefit_id);
|
$benefit->active = $request->active == 1 ? 0 : 1;
|
||||||
$benefit->active = $request->active == '1';
|
|
||||||
$benefit->reason = $request->reason;
|
$benefit->reason = $request->reason;
|
||||||
|
|
||||||
if ($benefit->save()) {
|
if ($benefit->save()) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Exceptions\ImportRowException;
|
|||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\CorporateFormularium;
|
use App\Models\CorporateFormularium;
|
||||||
use App\Models\Formularium;
|
use App\Models\Formularium;
|
||||||
|
use App\Models\FormulariumTemplate;
|
||||||
use App\Services\ImportService;
|
use App\Services\ImportService;
|
||||||
use Illuminate\Contracts\Support\Renderable;
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -52,9 +53,16 @@ class CorporateFormulariumController extends Controller
|
|||||||
* Show the form for creating a new resource.
|
* Show the form for creating a new resource.
|
||||||
* @return Renderable
|
* @return Renderable
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create(Request $request, $corporate_id)
|
||||||
{
|
{
|
||||||
return view('internal::create');
|
$data = CorporateFormularium::where('corporate_id', $corporate_id)->pluck('formularium_template_id')->toArray(); // agar tidak dobel
|
||||||
|
$formularium_template = FormulariumTemplate::whereNotIn('id', $data)->get();
|
||||||
|
$respone = [
|
||||||
|
"status" => 200,
|
||||||
|
"message" => 'data berhasil diambil',
|
||||||
|
"data" => $formularium_template
|
||||||
|
];
|
||||||
|
return $respone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,9 +70,36 @@ class CorporateFormulariumController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Renderable
|
* @return Renderable
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request, $corporate_id)
|
||||||
{
|
{
|
||||||
//
|
$request->validate([
|
||||||
|
'id' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$checkFormularium = FormulariumTemplate::find($request->id);
|
||||||
|
if (!$checkFormularium){
|
||||||
|
$respone = [
|
||||||
|
"status" => 404,
|
||||||
|
"message" => "data master formularium tidak ditemukan",
|
||||||
|
"data" => []
|
||||||
|
];
|
||||||
|
return $respone;
|
||||||
|
}
|
||||||
|
$newCorporateFormularium = CorporateFormularium::create([
|
||||||
|
'corporate_id' => $corporate_id,
|
||||||
|
'formularium_template_id' => $request->id,
|
||||||
|
'active' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($newCorporateFormularium){
|
||||||
|
$respone = [
|
||||||
|
"status" => 200,
|
||||||
|
"message" => "data berhasil disimpan"
|
||||||
|
];
|
||||||
|
return $respone;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $newCorporatePlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,9 +107,15 @@ class CorporateFormulariumController extends Controller
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @return Renderable
|
* @return Renderable
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show(Request $request, $corporate_id, $id)
|
||||||
{
|
{
|
||||||
return view('internal::show');
|
$data = Formularium::where('formularium_template_id', $id)->get();
|
||||||
|
$respone = [
|
||||||
|
"status" => 200,
|
||||||
|
"message" => 'data berhasil diambil',
|
||||||
|
"data" => $data
|
||||||
|
];
|
||||||
|
return $respone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,9 +123,16 @@ class CorporateFormulariumController extends Controller
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @return Renderable
|
* @return Renderable
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit(Request $request, $corporate_id)
|
||||||
{
|
{
|
||||||
return view('internal::edit');
|
$data = CorporateFormularium::where('corporate_id', $corporate_id)->pluck('formularium_template_id')->toArray(); // agar tidak dobel
|
||||||
|
$formularium_template = FormulariumTemplate::whereNotIn('id', $data)->get();
|
||||||
|
$respone = [
|
||||||
|
"status" => 200,
|
||||||
|
"message" => 'data berhasil diambil',
|
||||||
|
"data" => $formularium_template
|
||||||
|
];
|
||||||
|
return $respone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,6 +187,22 @@ class CorporateFormulariumController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function active(Request $request, $corporate_id, $id)
|
||||||
|
{
|
||||||
|
$corporateFormularium = CorporateFormularium::find($id);
|
||||||
|
$corporateFormularium->fill([
|
||||||
|
'active' => $request->active,
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
$respone = [
|
||||||
|
"status" => 200,
|
||||||
|
"message" => 'data berhasil diedit',
|
||||||
|
"data" => $corporateFormularium
|
||||||
|
];
|
||||||
|
|
||||||
|
return $respone;
|
||||||
|
}
|
||||||
|
|
||||||
public function import(Request $request, $id)
|
public function import(Request $request, $id)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
|
|||||||
@@ -69,13 +69,14 @@ class CorporateMemberController extends Controller
|
|||||||
public function activation(Request $request, $member_id)
|
public function activation(Request $request, $member_id)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'active' => 'required'
|
'active' => 'required',
|
||||||
|
'reason' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// abort(404);
|
// abort(404);
|
||||||
|
|
||||||
$member = Member::findOrFail($member_id);
|
$member = Member::findOrFail($member_id);
|
||||||
$member->active = $request->active == '1';
|
$member->active = $request->active;
|
||||||
$member->reason = $request->reason;
|
$member->reason = $request->reason;
|
||||||
|
|
||||||
if ($member->save()) {
|
if ($member->save()) {
|
||||||
|
|||||||
@@ -25,6 +25,31 @@ class CorporatePlanController extends Controller
|
|||||||
return $benefits;
|
return $benefits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function filter(Request $request, $corporate_id){
|
||||||
|
|
||||||
|
$benefits = CorporatePlan::query()
|
||||||
|
->filter($request->all())
|
||||||
|
->where('corporate_id', $corporate_id);
|
||||||
|
// ->where('type', $request->type)
|
||||||
|
// ->where('code', $request->code);
|
||||||
|
|
||||||
|
if ($request->has('service_code') && is_array($request->service_code) && count($request->service_code) > 0) {
|
||||||
|
$benefits->whereIn('service_code', $request->service_code);
|
||||||
|
}
|
||||||
|
if ($request->has('type') && is_array($request->type) && count($request->type) > 0) {
|
||||||
|
$benefits->whereIn('type', $request->type);
|
||||||
|
}
|
||||||
|
if ($request->has('code') && is_array($request->code) && count($request->code) > 0) {
|
||||||
|
$benefits->whereIn('code', $request->code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$benefits = $benefits->paginate(0)->appends($request->all());
|
||||||
|
|
||||||
|
return $benefits;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function activation(Request $request, $plan_id)
|
public function activation(Request $request, $plan_id)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ class DiagnosisExclusionController extends Controller
|
|||||||
$gender = implode(",", $gender);
|
$gender = implode(",", $gender);
|
||||||
$gender = trim($gender, ",");
|
$gender = trim($gender, ",");
|
||||||
|
|
||||||
|
$exclusion->rules()->corporate_id = $corporate_id;
|
||||||
|
|
||||||
$exclusion->rules()->updateOrCreate([
|
$exclusion->rules()->updateOrCreate([
|
||||||
'exclusion_id' => $exclusion->id,
|
'exclusion_id' => $exclusion->id,
|
||||||
@@ -302,7 +303,6 @@ class DiagnosisExclusionController extends Controller
|
|||||||
'values' => $data['min_age'] ?? '',
|
'values' => $data['min_age'] ?? '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$exclusion->rules()->updateOrCreate([
|
$exclusion->rules()->updateOrCreate([
|
||||||
'exclusion_id' => $exclusion->id,
|
'exclusion_id' => $exclusion->id,
|
||||||
'name' => 'max_age',
|
'name' => 'max_age',
|
||||||
@@ -330,6 +330,59 @@ class DiagnosisExclusionController extends Controller
|
|||||||
return Helper::paginateResources(DiagnosisExclusionResource::collection($exclusions));
|
return Helper::paginateResources(DiagnosisExclusionResource::collection($exclusions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bagaskoro BSD 20-10-2023
|
||||||
|
*
|
||||||
|
* Fungsi untuk get detil exclusion
|
||||||
|
*/
|
||||||
|
public function detilExclusion(Request $request, $corporate_id, $id_exclusion)
|
||||||
|
{
|
||||||
|
$corporate = Corporate::query()
|
||||||
|
->with(['currentPolicy', 'plans'])
|
||||||
|
->withCount('corporatePlans')
|
||||||
|
->withCount('employees')
|
||||||
|
->findOrFail($corporate_id);
|
||||||
|
|
||||||
|
$plans = $corporate['plans']->map(function ($plan) {
|
||||||
|
return $plan['code'];
|
||||||
|
});
|
||||||
|
|
||||||
|
$exclusions = Exclusion::query()
|
||||||
|
->where('id', $id_exclusion)
|
||||||
|
->where('type', 'diagnosis')
|
||||||
|
->where('deleted_at', null)
|
||||||
|
->with(['rules'])
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$exclusion = DiagnosisExclusionResource::collection($exclusions);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'error' => false,
|
||||||
|
'messages' => "success",
|
||||||
|
'data' => [
|
||||||
|
'exclusion' => empty($exclusion) ? [] : $exclusion[0],
|
||||||
|
'plans' => $plans,
|
||||||
|
]
|
||||||
|
],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bagaskoro BSD 19-10-2023
|
||||||
|
*
|
||||||
|
* Fungsi untuk update status active
|
||||||
|
*/
|
||||||
|
protected function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'required' => ':attribute harus diisi',
|
||||||
|
'integer' => ':attribute harus angka',
|
||||||
|
'unique' => ':attribute (:input) sudah ada',
|
||||||
|
'max' => ':attribute maximal :max karakter',
|
||||||
|
'exists' => ':attribute (:input) tidak ditemukan',
|
||||||
|
'digits_between'=> ':attribute maximal :max digit minimal :min digit'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function updateActivation(Request $request)
|
public function updateActivation(Request $request)
|
||||||
{
|
{
|
||||||
// validation rule
|
// validation rule
|
||||||
@@ -340,8 +393,21 @@ class DiagnosisExclusionController extends Controller
|
|||||||
|
|
||||||
// validation error
|
// validation error
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return response()->json($validator->getMessageBag(),400);
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'messages' => $validator->getMessageBag()
|
||||||
|
],400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Exclusion::where('id', $request->id)->update([
|
||||||
|
'active' => $request->active == 1 ? 0 : 1,
|
||||||
|
'reason' => $request->reason
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'error' => false,
|
||||||
|
'messages' => "status berhasil diupdate",
|
||||||
|
'data' => []
|
||||||
|
],200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
153
Modules/Internal/Http/Controllers/Api/HospitalController.php
Normal file
153
Modules/Internal/Http/Controllers/Api/HospitalController.php
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Models\CorporateHospital;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class HospitalController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index(Request $request, $corporate_id)
|
||||||
|
{
|
||||||
|
$datas = CorporateHospital::query()
|
||||||
|
->filter($request->all())
|
||||||
|
->where('corporate_id', $corporate_id)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->paginate(0)
|
||||||
|
->appends($request->all());
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function activation(Request $request, $hospital_id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'active' => 'required',
|
||||||
|
'reason' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// abort(404);
|
||||||
|
|
||||||
|
$hostpital = CorporateHospital::findOrFail($hospital_id);
|
||||||
|
$hostpital->active = $request->active;
|
||||||
|
$hostpital->reason = $request->reason;
|
||||||
|
|
||||||
|
if ($hostpital->save()) {
|
||||||
|
return response()->json([
|
||||||
|
'hostpital' => $hostpital,
|
||||||
|
'message' => 'Status Updated Successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataHospital(Request $request, $corporate_id)
|
||||||
|
{
|
||||||
|
$data = DB::table('organizations')
|
||||||
|
->where('type', 'hospital')
|
||||||
|
->where('status', 'active')
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->get();
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request, $corporate_id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'corporate_id' => 'required',
|
||||||
|
'code' => 'required',
|
||||||
|
'name' => 'required',
|
||||||
|
'organization_id' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$newCorporateHospital = CorporateHospital::create([
|
||||||
|
'corporate_id' => $corporate_id,
|
||||||
|
'code' => $request->code,
|
||||||
|
'name' => $request->name,
|
||||||
|
'organization_id' => $request->organization_id,
|
||||||
|
'description' => $request->description ? $request->description : null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $newCorporateHospital;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('internal::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($corporate_id, $id)
|
||||||
|
{
|
||||||
|
$corporatePlan = CorporateDivision::findOrFail($id);
|
||||||
|
|
||||||
|
return $corporatePlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $corporate_id, $id)
|
||||||
|
{
|
||||||
|
$corporatePlan = CorporateHospital::findOrFail($id);
|
||||||
|
$request->validate([
|
||||||
|
'corporate_id' => 'required',
|
||||||
|
'code' => 'required',
|
||||||
|
'name' => 'required',
|
||||||
|
'organization_id' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$corporatePlan->fill([
|
||||||
|
'corporate_id' => $corporate_id,
|
||||||
|
'code' => $request->code,
|
||||||
|
'name' => $request->name,
|
||||||
|
'organization_id' => $request->organization_id,
|
||||||
|
'description' => $request->description ? $request->description : null,
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
return $corporatePlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ use Modules\Internal\Http\Controllers\Api\DiagnosisTemplateController;
|
|||||||
use Modules\Internal\Http\Controllers\Api\DiagnosisExclusionController;
|
use Modules\Internal\Http\Controllers\Api\DiagnosisExclusionController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DistrictController;
|
use Modules\Internal\Http\Controllers\Api\DistrictController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DivisionController;
|
use Modules\Internal\Http\Controllers\Api\DivisionController;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\HospitalController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DoctorController;
|
use Modules\Internal\Http\Controllers\Api\DoctorController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DoctorRatingController;
|
use Modules\Internal\Http\Controllers\Api\DoctorRatingController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DrugController;
|
use Modules\Internal\Http\Controllers\Api\DrugController;
|
||||||
@@ -80,6 +81,7 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::post('corporates/{corporate_id}/corporate-plans', [CorporatePlanController::class, 'store']);
|
Route::post('corporates/{corporate_id}/corporate-plans', [CorporatePlanController::class, 'store']);
|
||||||
Route::get('corporates/{corporate_id}/corporate-plans/{id}/edit', [CorporatePlanController::class, 'edit']);
|
Route::get('corporates/{corporate_id}/corporate-plans/{id}/edit', [CorporatePlanController::class, 'edit']);
|
||||||
Route::put('corporates/{corporate_id}/corporate-plans/{id}', [CorporatePlanController::class, 'update']);
|
Route::put('corporates/{corporate_id}/corporate-plans/{id}', [CorporatePlanController::class, 'update']);
|
||||||
|
Route::post('corporates/{corporate_id}/corporate-plans/filter', [CorporatePlanController::class, 'filter']);
|
||||||
Route::put('plans/{plan_id}/activation', [CorporatePlanController::class, 'activation']);
|
Route::put('plans/{plan_id}/activation', [CorporatePlanController::class, 'activation']);
|
||||||
|
|
||||||
Route::get('corporates/{corporate_id}/plans', [PlanController::class, 'index']);
|
Route::get('corporates/{corporate_id}/plans', [PlanController::class, 'index']);
|
||||||
@@ -99,6 +101,12 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::get('corporates/{corporate_id}/divisions/{id}/edit', [DivisionController::class, 'edit']);
|
Route::get('corporates/{corporate_id}/divisions/{id}/edit', [DivisionController::class, 'edit']);
|
||||||
Route::put('corporates/{corporate_id}/divisions/{id}', [DivisionController::class, 'update']);
|
Route::put('corporates/{corporate_id}/divisions/{id}', [DivisionController::class, 'update']);
|
||||||
|
|
||||||
|
Route::get('corporates/{corporate_id}/hospitals', [HospitalController::class, 'index']);
|
||||||
|
Route::put('hospitals/{hospital_id}/activation', [HospitalController::class, 'activation']);
|
||||||
|
Route::get('corporates/{corporate_id}/hospitals/data', [HospitalController::class, 'dataHospital']);
|
||||||
|
Route::post('corporates/{corporate_id}/hospitals/save', [HospitalController::class, 'store']);
|
||||||
|
Route::put('corporates/{corporate_id}/hospitals/{id}/edit', [HospitalController::class, 'update']);
|
||||||
|
|
||||||
Route::get('corporates/{corporate_id}/members', [CorporateMemberController::class, 'index']);
|
Route::get('corporates/{corporate_id}/members', [CorporateMemberController::class, 'index']);
|
||||||
Route::get('corporates/{corporate_id}/members/list', [CorporateMemberController::class, 'generateMemberList']);
|
Route::get('corporates/{corporate_id}/members/list', [CorporateMemberController::class, 'generateMemberList']);
|
||||||
Route::post('corporates/{corporate_id}/members/import', [CorporateMemberController::class, 'import']);
|
Route::post('corporates/{corporate_id}/members/import', [CorporateMemberController::class, 'import']);
|
||||||
@@ -106,8 +114,9 @@ Route::prefix('internal')->group(function () {
|
|||||||
|
|
||||||
|
|
||||||
Route::get('corporates/{corporate_id}/diagnosis-exclusions', [DiagnosisExclusionController::class, 'index']);
|
Route::get('corporates/{corporate_id}/diagnosis-exclusions', [DiagnosisExclusionController::class, 'index']);
|
||||||
|
Route::get('corporates/{corporate_id}/diagnosis-exclusions/{id_exclusion}', [DiagnosisExclusionController::class, 'detilExclusion']); // By Bagaskoro, get detil exclusion
|
||||||
Route::post('corporates/{corporate_id}/diagnosis-exclusions/store', [DiagnosisExclusionController::class, 'storeExclusion']);
|
Route::post('corporates/{corporate_id}/diagnosis-exclusions/store', [DiagnosisExclusionController::class, 'storeExclusion']);
|
||||||
Route::put('corporates/diagnosis-exclusions/update_activation', [DiagnosisExclusionController::class, 'updateActivation']);
|
Route::put('corporates/diagnosis-exclusions/update_activation', [DiagnosisExclusionController::class, 'updateActivation']); // By Bagaskoro, edit status aktif
|
||||||
Route::delete('diagnosis-exclusions/{id}', [DiagnosisExclusionController::class, 'destroy']);
|
Route::delete('diagnosis-exclusions/{id}', [DiagnosisExclusionController::class, 'destroy']);
|
||||||
Route::post('corporates/{corporate_id}/diagnosis-exclusions/import', [DiagnosisExclusionController::class, 'import']);
|
Route::post('corporates/{corporate_id}/diagnosis-exclusions/import', [DiagnosisExclusionController::class, 'import']);
|
||||||
|
|
||||||
@@ -119,8 +128,12 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::post('corporates/{corporate_id}/services/{service_code}/specialities/exclusion', [CorporateServiceController::class, 'storeExclusion']);
|
Route::post('corporates/{corporate_id}/services/{service_code}/specialities/exclusion', [CorporateServiceController::class, 'storeExclusion']);
|
||||||
|
|
||||||
Route::get('corporates/{corporate_id}/formulariums', [CorporateFormulariumController::class, 'index']);
|
Route::get('corporates/{corporate_id}/formulariums', [CorporateFormulariumController::class, 'index']);
|
||||||
|
Route::get('corporates/{corporate_id}/formulariums/{formularium_id}', [CorporateFormulariumController::class, 'show']);
|
||||||
|
Route::get('corporates/{corporate_id}/formulariums/create', [CorporateFormulariumController::class, 'create']);
|
||||||
|
Route::post('corporates/{corporate_id}/formulariums', [CorporateFormulariumController::class, 'store']);
|
||||||
Route::get('corporates/{corporate_id}/formulariums/list', [CorporateFormulariumController::class, 'generateFormulariumList']);
|
Route::get('corporates/{corporate_id}/formulariums/list', [CorporateFormulariumController::class, 'generateFormulariumList']);
|
||||||
Route::post('corporates/{corporate_id}/formulariums/import', [CorporateFormulariumController::class, 'import']);
|
Route::post('corporates/{corporate_id}/formulariums/import', [CorporateFormulariumController::class, 'import']);
|
||||||
|
Route::put('corporates/{corporate_id}/formulariums-update-status/{id}', [CorporateFormulariumController::class, 'active']);
|
||||||
Route::put('corporates/{corporate_id}/formulariums/{formularium_id}/{action}', [CorporateFormulariumController::class, 'updateStatus']);
|
Route::put('corporates/{corporate_id}/formulariums/{formularium_id}/{action}', [CorporateFormulariumController::class, 'updateStatus']);
|
||||||
Route::controller(CorporateController::class)->group(function () {
|
Route::controller(CorporateController::class)->group(function () {
|
||||||
Route::post('add-files-doc', 'addFilesDoc');
|
Route::post('add-files-doc', 'addFilesDoc');
|
||||||
|
|||||||
@@ -326,6 +326,7 @@ class MemberEnrollmentService
|
|||||||
|
|
||||||
public function __construct(Member $member)
|
public function __construct(Member $member)
|
||||||
{
|
{
|
||||||
|
app()->setLocale('en');
|
||||||
$this->member = $member;
|
$this->member = $member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,27 +14,11 @@ class CorporateFormulariumResource extends JsonResource
|
|||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $this->formularium->id,
|
'id' => $this->id,
|
||||||
'code' => $this->formularium->code,
|
'formulaurium_category_id' => $this->formularium_template->id,
|
||||||
'name' => $this->formularium->name,
|
'category' => $this->formularium_template->name,
|
||||||
'description' => $this->formularium->description,
|
'description' => $this->formularium_template->description,
|
||||||
'manufacturer' => $this->formularium->manufacturer,
|
|
||||||
'category_name' => $this->formularium->category_name,
|
|
||||||
'kategori_obat' => $this->formularium->kategori_obat,
|
|
||||||
'uom' => $this->formularium->uom,
|
|
||||||
'general_indication' => $this->formularium->general_indication,
|
|
||||||
'composition' => $this->formularium->composition,
|
|
||||||
'atc_code' => $this->formularium->atc_code,
|
|
||||||
'class' => $this->formularium->class,
|
|
||||||
'bpom_registration' => $this->formularium->bpom_registration,
|
|
||||||
'classifications' => $this->formularium->classifications,
|
|
||||||
'cat_for' => $this->formularium->cat_for,
|
|
||||||
'items_count' => $this->formularium->items_count,
|
|
||||||
'status' => $this->active ? 'active' : 'inactive',
|
|
||||||
// 'corporate_formulariums' => $this->formua,
|
|
||||||
'active' => $this->active == 1 ? 'Active' : 'Inactive',
|
'active' => $this->active == 1 ? 'Active' : 'Inactive',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Traits\Blameable;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Altek\Accountant\Contracts\Recordable;
|
||||||
|
|
||||||
class CorporateFormularium extends Model
|
class CorporateFormularium extends Model
|
||||||
{
|
{
|
||||||
@@ -15,7 +16,7 @@ class CorporateFormularium extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'corporate_id',
|
'corporate_id',
|
||||||
'formularium_id',
|
'formularium_template_id',
|
||||||
'active'
|
'active'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -24,8 +25,8 @@ class CorporateFormularium extends Model
|
|||||||
return $this->belongsTo(Corporate::class);
|
return $this->belongsTo(Corporate::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function formularium()
|
public function formularium_template()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Formularium::class);
|
return $this->belongsTo(FormulariumTemplate::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
app/Models/CorporateHospital.php
Normal file
36
app/Models/CorporateHospital.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class CorporateHospital extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'corporate_id',
|
||||||
|
'organization_id',
|
||||||
|
'code',
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
'active',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function corporate()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Corporate::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeFilter($query, array $filters)
|
||||||
|
{
|
||||||
|
$query->when($filters['search'] ?? false, function ($query, $search) {
|
||||||
|
return $query
|
||||||
|
->where('code', 'like', "%" . $search . "%")
|
||||||
|
->orWhere('name', 'like', "%" . $search . "%");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ class Exclusion extends Model
|
|||||||
'exclusionable_id',
|
'exclusionable_id',
|
||||||
'exclusionable_type',
|
'exclusionable_type',
|
||||||
'active',
|
'active',
|
||||||
|
'reason'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@@ -37,11 +37,6 @@ class Formularium extends Model
|
|||||||
$this->attributes['code'] = !empty($value) ? $value : Str::upper(Str::random('6'));
|
$this->attributes['code'] = !empty($value) ? $value : Str::upper(Str::random('6'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function corporateFormulariums()
|
|
||||||
{
|
|
||||||
return $this->hasMany(CorporateFormularium::class, 'formularium_id', 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function items()
|
public function items()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Drug::class, 'formularium_items', 'formularium_id', 'item_id');
|
return $this->belongsToMany(Drug::class, 'formularium_items', 'formularium_id', 'item_id');
|
||||||
|
|||||||
@@ -23,4 +23,9 @@ class FormulariumTemplate extends Model
|
|||||||
'updated_by',
|
'updated_by',
|
||||||
// 'deleted_by',
|
// 'deleted_by',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// public function corporateFormulariums()
|
||||||
|
// {
|
||||||
|
// return $this->hasMany(CorporateFormularium::class, 'formularium_template_id', 'id');
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use App\Models\Corporate;
|
use App\Models\Corporate;
|
||||||
|
use App\Models\CorporateFormularium;
|
||||||
use App\Models\CorporateService;
|
use App\Models\CorporateService;
|
||||||
use App\Models\CorporatePlan;
|
use App\Models\CorporatePlan;
|
||||||
use App\Models\CorporateBenefit;
|
use App\Models\CorporateBenefit;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
|
use App\Models\CorporateHospital;
|
||||||
use App\Models\ExclusionRules;
|
use App\Models\ExclusionRules;
|
||||||
use App\Models\ExclusionImport;
|
use App\Models\ExclusionImport;
|
||||||
use App\Models\Icd;
|
use App\Models\Icd;
|
||||||
@@ -40,7 +42,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
|
|
||||||
Str::macro('initials', fn($value, $sep = ' ', $glue = '') => trim(collect(explode($sep, $value))->map(function ($segment) {
|
Str::macro('initials', fn($value, $sep = ' ', $glue = '') => trim(collect(explode($sep, $value))->map(function ($segment) {
|
||||||
return $segment[0] ?? '';
|
return $segment[0] ?? '';
|
||||||
})->join($glue)));
|
})->join($glue)));
|
||||||
@@ -51,7 +53,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
Corporate::updated(function ($model) {
|
Corporate::updated(function ($model) {
|
||||||
|
|
||||||
$this->logAuditTrail($model, 'updated');
|
$this->logAuditTrail($model, 'updated');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -60,7 +62,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
});
|
});
|
||||||
|
|
||||||
Member::updated(function ($model) {
|
Member::updated(function ($model) {
|
||||||
|
|
||||||
$this->logAuditTrail($model, 'updated');
|
$this->logAuditTrail($model, 'updated');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,10 +70,20 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->logAuditTrail($model, 'deleted');
|
$this->logAuditTrail($model, 'deleted');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Hospital
|
||||||
|
CorporateHospital::updated(function ($model) {
|
||||||
|
|
||||||
|
$this->logAuditTrail($model, 'updated');
|
||||||
|
});
|
||||||
|
|
||||||
|
CorporateHospital::deleted(function ($model) {
|
||||||
|
$this->logAuditTrail($model, 'deleted');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Corporate Service
|
// Corporate Service
|
||||||
CorporateService::updated(function ($model) {
|
CorporateService::updated(function ($model) {
|
||||||
|
|
||||||
$this->logAuditTrail($model, 'updated');
|
$this->logAuditTrail($model, 'updated');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -81,7 +93,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// Corporate Plans
|
// Corporate Plans
|
||||||
CorporatePlan::updated(function ($model) {
|
CorporatePlan::updated(function ($model) {
|
||||||
|
|
||||||
$this->logAuditTrail($model, 'updated');
|
$this->logAuditTrail($model, 'updated');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,7 +103,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// Corporate Benefits
|
// Corporate Benefits
|
||||||
CorporateBenefit::updated(function ($model) {
|
CorporateBenefit::updated(function ($model) {
|
||||||
|
|
||||||
$this->logAuditTrail($model, 'updated');
|
$this->logAuditTrail($model, 'updated');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -102,21 +114,20 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// Corporate Exclusion
|
// Corporate Exclusion
|
||||||
ExclusionRules::updated(function ($model) {
|
ExclusionRules::updated(function ($model) {
|
||||||
|
$this->logAuditTrail($model, 'updated');
|
||||||
$this->logAuditTrailExclusion($model, 'updated');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ExclusionRules::deleted(function ($model) {
|
ExclusionRules::deleted(function ($model) {
|
||||||
$this->logAuditTrailExclusion($model, 'deleted');
|
$this->logAuditTrail($model, 'deleted');
|
||||||
});
|
});
|
||||||
|
|
||||||
ExclusionImport::updated(function ($model) {
|
ExclusionImport::updated(function ($model) {
|
||||||
|
|
||||||
$this->logAuditTrailExclusion($model, 'updated');
|
$this->logAuditTrail($model, 'updated');
|
||||||
});
|
});
|
||||||
|
|
||||||
ExclusionImport::deleted(function ($model) {
|
ExclusionImport::deleted(function ($model) {
|
||||||
$this->logAuditTrailExclusion($model, 'deleted');
|
$this->logAuditTrail($model, 'deleted');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ICD or exlusion
|
// ICD or exlusion
|
||||||
@@ -144,6 +155,14 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->logAuditTrail($model, 'deleted');
|
$this->logAuditTrail($model, 'deleted');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Formualrium Template
|
||||||
|
CorporateFormularium::updated(function ($model) {
|
||||||
|
$this->logAuditTrail($model, 'updated');
|
||||||
|
});
|
||||||
|
CorporateFormularium::deleted(function ($model) {
|
||||||
|
$this->logAuditTrail($model, 'deleted');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('corporate_hospitals', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->bigInteger('corporate_id');
|
||||||
|
$table->bigInteger('organization_id');
|
||||||
|
$table->string('code', 255);
|
||||||
|
$table->string('name', 255);
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->tinyInteger('active')->default(1);
|
||||||
|
$table->text('reason')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->bigInteger('created_by')->nullable();
|
||||||
|
$table->bigInteger('updated_by')->nullable();
|
||||||
|
$table->bigInteger('deleted_by')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('corporate_hospitals');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('corporate_formulariums', function (Blueprint $table) {
|
||||||
|
$table->renameColumn('formularium_id', 'formularium_template_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('corporate_formulariums', function (Blueprint $table) {
|
||||||
|
$table->renameColumn('formularium_template_id', 'formularium_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('exclusions', function (Blueprint $table) {
|
||||||
|
$table->string('reason')->after('active');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('exclusions', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('reason');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
GENERATE_SOURCEMAP=false
|
GENERATE_SOURCEMAP=false
|
||||||
|
|
||||||
PORT=8083
|
PORT=8000
|
||||||
|
|
||||||
REACT_APP_HOST_API_URL="http://lms.test"
|
REACT_APP_HOST_API_URL="http://lms.test"
|
||||||
|
|
||||||
|
|||||||
726
frontend/dashboard/package-lock.json
generated
726
frontend/dashboard/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,13 @@ export type Division = {
|
|||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Hospital = {
|
||||||
|
id: number;
|
||||||
|
corporate_id: number;
|
||||||
|
code: string;
|
||||||
|
name?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type Employee = {
|
export type Employee = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ export type Icd = {
|
|||||||
version?: string;
|
version?: string;
|
||||||
code: string;
|
code: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
service_code: string;
|
||||||
|
active: number;
|
||||||
description?: any;
|
description?: any;
|
||||||
childs?: Icd[];
|
childs?: Icd[];
|
||||||
status: string;
|
status: string;
|
||||||
|
rules:any
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// form
|
// form
|
||||||
import { useFormContext, Controller } from 'react-hook-form';
|
import { useFormContext, Controller } from 'react-hook-form';
|
||||||
// @mui
|
// @mui
|
||||||
import { Checkbox, FormControlLabel, FormGroup, FormControlLabelProps } from '@mui/material';
|
import { Checkbox, FormControlLabel, FormGroup, FormControlLabelProps, SxProps } from '@mui/material';
|
||||||
|
import { Theme } from '@mui/system';
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -77,9 +78,10 @@ interface optionsCustomInterface {
|
|||||||
interface RHFCustomMultiCheckboxProps {
|
interface RHFCustomMultiCheckboxProps {
|
||||||
name: string;
|
name: string;
|
||||||
options: optionsCustomInterface[];
|
options: optionsCustomInterface[];
|
||||||
|
sx?: SxProps<Theme>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RHFCustomMultiCheckbox({ name, options, ...other }: RHFCustomMultiCheckboxProps) {
|
export function RHFCustomMultiCheckbox({ name, options, sx, ...other }: RHFCustomMultiCheckboxProps) {
|
||||||
const { control } = useFormContext();
|
const { control } = useFormContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -93,7 +95,7 @@ export function RHFCustomMultiCheckbox({ name, options, ...other }: RHFCustomMul
|
|||||||
: [...field.value, option.value];
|
: [...field.value, option.value];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormGroup>
|
<FormGroup sx={{ ...sx }}>
|
||||||
{options.map((option, index) => (
|
{options.map((option, index) => (
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
key={index}
|
key={index}
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ function ConfiguredCorporateProvider({ children }: ConfiguredCorporateProviderPr
|
|||||||
const [corporate, setCorporate] = useState(null);
|
const [corporate, setCorporate] = useState(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Load Corporate
|
|
||||||
console.log('calling corporate' + corporate_id);
|
|
||||||
|
|
||||||
axios.get(`corporates/${corporate_id}`)
|
axios.get(`corporates/${corporate_id}`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
setCorporate(res.data)
|
setCorporate(res.data)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// @mui
|
// @mui
|
||||||
|
import * as Yup from 'yup';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -38,6 +39,8 @@ import HistoryIcon from '@mui/icons-material/History';
|
|||||||
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
|
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
|
||||||
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
|
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
|
||||||
|
|
||||||
|
import { yupResolver } from '@hookform/resolvers/yup';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
// hooks
|
// hooks
|
||||||
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
||||||
@@ -73,6 +76,8 @@ import { Edit } from '@mui/icons-material';
|
|||||||
import { fData, fNumber } from '@/utils/formatNumber';
|
import { fData, fNumber } from '@/utils/formatNumber';
|
||||||
import DialogUpdateStatus from '@/components/DialogUpdateStatus';
|
import DialogUpdateStatus from '@/components/DialogUpdateStatus';
|
||||||
|
|
||||||
|
import { ro } from 'date-fns/locale';
|
||||||
|
|
||||||
export default function PlanList() {
|
export default function PlanList() {
|
||||||
const { themeStretch } = useSettings();
|
const { themeStretch } = useSettings();
|
||||||
const { corporate_id } = useParams();
|
const { corporate_id } = useParams();
|
||||||
@@ -313,12 +318,18 @@ export default function PlanList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DataContent = {
|
type DataContent = {
|
||||||
code: string;
|
service: string;
|
||||||
name: string;
|
|
||||||
id: number;
|
id: number;
|
||||||
status: string|number;
|
status: number;
|
||||||
|
plan: string,
|
||||||
|
benefit_code: string,
|
||||||
|
customer_benefit_code: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type FormValuesProps = {
|
||||||
|
value: string;
|
||||||
|
active: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
// Generate the every row of the table
|
// Generate the every row of the table
|
||||||
const [isDialogOpen, setDialogOpen] = useState(false)
|
const [isDialogOpen, setDialogOpen] = useState(false)
|
||||||
@@ -335,6 +346,14 @@ export default function PlanList() {
|
|||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
const [openEdit, setOpenEdit] = React.useState(false);
|
const [openEdit, setOpenEdit] = React.useState(false);
|
||||||
|
|
||||||
|
const handleActivate = (isOpen: boolean, dataValue: DataContent) => {
|
||||||
|
console.log(dataValue)
|
||||||
|
setDialogOpen(isOpen)
|
||||||
|
setDataValue(dataValue)
|
||||||
|
setDescriptionValue('Are you sure to inactive this service ?')
|
||||||
|
setUrl(url)
|
||||||
|
};
|
||||||
|
|
||||||
// const handleActivate = (model: any, status: string) => {
|
// const handleActivate = (model: any, status: string) => {
|
||||||
// axios
|
// axios
|
||||||
// .put(`/benefits/${row.id}/activation`, {
|
// .put(`/benefits/${row.id}/activation`, {
|
||||||
@@ -362,36 +381,36 @@ export default function PlanList() {
|
|||||||
// });
|
// });
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
|
||||||
const handleActivate = (isOpen: boolean, dataValue: DataContent) => {
|
|
||||||
setDialogOpen(isOpen)
|
|
||||||
setDataValue(dataValue)
|
|
||||||
setDescriptionValue('Are you sure to inactive this service ?')
|
|
||||||
setUrl(url)
|
|
||||||
};
|
|
||||||
|
|
||||||
let frequency_period_name: string
|
let frequency_period_name: string
|
||||||
|
let limit_frequency: string
|
||||||
switch (row.max_frequency_period) {
|
switch (row.max_frequency_period) {
|
||||||
case '1' :
|
case '1' :
|
||||||
frequency_period_name = 'Daily Visit';
|
frequency_period_name = 'Daily Visit';
|
||||||
|
limit_frequency = row.daily_frequency ? row.daily_frequency : '1';
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
frequency_period_name = 'Weekly';
|
frequency_period_name = 'Weekly';
|
||||||
|
limit_frequency = row.weekly_frequency ? row.weekly_frequency : '7';
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
frequency_period_name = 'Monthly';
|
frequency_period_name = 'Monthly';
|
||||||
|
limit_frequency = row.monthly_frequency ? row.monthly_frequency : '30';
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
frequency_period_name = 'Yearly';
|
frequency_period_name = 'Yearly';
|
||||||
|
limit_frequency = row.yearly_frequency ? row.yearly_frequency : '365';
|
||||||
break;
|
break;
|
||||||
case '5':
|
case '5':
|
||||||
frequency_period_name = 'Disability';
|
frequency_period_name = 'Disability';
|
||||||
|
limit_frequency = row.max_days_for_disability ? row.max_days_for_disability : '-';
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
frequency_period_name = 'Visit';
|
frequency_period_name = 'Visit';
|
||||||
|
limit_frequency = row.daily_frequency ? row.daily_frequency : '-';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
frequency_period_name = 'Policy Period';
|
frequency_period_name = 'Policy Period';
|
||||||
|
limit_frequency = row.daily_frequency ? row.daily_frequency : '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -408,7 +427,8 @@ export default function PlanList() {
|
|||||||
<TableCell align="left">{row.corporate_benefit_code}</TableCell>
|
<TableCell align="left">{row.corporate_benefit_code}</TableCell>
|
||||||
<TableCell align="left">{row.benefit?.description}</TableCell>
|
<TableCell align="left">{row.benefit?.description}</TableCell>
|
||||||
<TableCell align="left">{ fNumber(row.limit_amount)}</TableCell>
|
<TableCell align="left">{ fNumber(row.limit_amount)}</TableCell>
|
||||||
<TableCell align="left">{ row.max_frequency_period}</TableCell>
|
<TableCell align="left">{ frequency_period_name}</TableCell>
|
||||||
|
<TableCell align="left">{ limit_frequency}</TableCell>
|
||||||
|
|
||||||
<TableCell align="center">
|
<TableCell align="center">
|
||||||
{row.active == 1 && (
|
{row.active == 1 && (
|
||||||
@@ -476,7 +496,18 @@ export default function PlanList() {
|
|||||||
<HistoryIcon />
|
<HistoryIcon />
|
||||||
History
|
History
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => handleActivate(true, {code: row.code, name: row.service_code, id:row.id, status: row.active}) }>
|
<MenuItem
|
||||||
|
onClick={() =>
|
||||||
|
handleActivate(true, {
|
||||||
|
service: row.benefit?.service_code,
|
||||||
|
plan: row.plan?.code,
|
||||||
|
benefit_code: row.benefit?.code,
|
||||||
|
customer_benefit_code: row.corporate_benefit_code,
|
||||||
|
id:row.id,
|
||||||
|
status: row.active
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
<CachedOutlinedIcon />
|
<CachedOutlinedIcon />
|
||||||
Update Status
|
Update Status
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -866,7 +897,7 @@ export default function PlanList() {
|
|||||||
const loadDataTableData = async (appliedFilter = null) => {
|
const loadDataTableData = async (appliedFilter = null) => {
|
||||||
setDataTableLoading(true);
|
setDataTableLoading(true);
|
||||||
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
||||||
const response = await axios.get('/corporates/' + corporate_id + '/benefits', {
|
const response = await axios.get('/corporates/' + corporate_id + '/corporate-benefits', {
|
||||||
params: filter,
|
params: filter,
|
||||||
});
|
});
|
||||||
// console.log(response.data);
|
// console.log(response.data);
|
||||||
@@ -879,6 +910,19 @@ export default function PlanList() {
|
|||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onSubmit = async (row : any) => {
|
||||||
|
try {
|
||||||
|
handleUpdate(dataValue.status, dataValue.id, row.reason)
|
||||||
|
} catch (error: any) {
|
||||||
|
console.log('data gagal');
|
||||||
|
}
|
||||||
|
|
||||||
|
const ascent = document?.querySelector('ascent');
|
||||||
|
if (ascent != null) {
|
||||||
|
ascent.innerHTML = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const applyFilter = async (searchFilter: string) => {
|
const applyFilter = async (searchFilter: string) => {
|
||||||
await loadDataTableData({ search: searchFilter });
|
await loadDataTableData({ search: searchFilter });
|
||||||
setSearchParams({ search: searchFilter });
|
setSearchParams({ search: searchFilter });
|
||||||
@@ -894,25 +938,64 @@ export default function PlanList() {
|
|||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const NewCorporateSchema = Yup.object().shape({
|
||||||
|
reason: Yup.string().required('Reason Edit is required'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const methods = useForm<FormValuesProps>({
|
||||||
|
resolver: yupResolver(NewCorporateSchema),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const {
|
||||||
|
reset,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = methods;
|
||||||
|
|
||||||
|
const handleUpdate = (active: number, id: number, reason:string) => {
|
||||||
|
console.log(active)
|
||||||
|
axios
|
||||||
|
.put(`/benefits/${id}/activation`, {
|
||||||
|
active: active,
|
||||||
|
reason: reason
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const getContent = () => (
|
const getContent = () => (
|
||||||
<>
|
<>
|
||||||
<Stack paddingX={2} paddingY={2}>
|
<Stack paddingX={2} paddingY={2}>
|
||||||
<Typography variant='subtitle1'>Are you sure to {dataValue?.status == 1 ? 'inactive' : 'active'} this service ?</Typography>
|
<Typography variant='subtitle1'>Are you sure to {dataValue?.status == 1 ? 'inactive' : 'active'} this benefit ?</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Card>
|
<Card>
|
||||||
<Grid container paddingX={2} paddingY={2}>
|
<Grid container paddingX={2} paddingY={2}>
|
||||||
<Grid item xs={4} md={4}>
|
<Grid item xs={5} md={5}>
|
||||||
|
<Typography variant='inherit'>Service</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={7}>
|
||||||
|
<Typography variant='subtitle1'>{dataValue?.service}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={5} md={5} marginTop={2}>
|
||||||
|
<Typography variant='inherit'>Plan</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={7} marginTop={2}>
|
||||||
|
<Typography variant='subtitle1'>{dataValue?.plan}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={5} md={5} marginTop={2}>
|
||||||
<Typography variant='inherit'>Code</Typography>
|
<Typography variant='inherit'>Code</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={8}>
|
<Grid item xs={7} marginTop={2}>
|
||||||
<Typography variant='subtitle1'>{dataValue?.code}</Typography>
|
<Typography variant='subtitle1'>{dataValue?.benefit_code}</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={4} md={4} marginTop={2}>
|
<Grid item xs={5} md={5} marginTop={2}>
|
||||||
<Typography variant='inherit'>Service Name</Typography>
|
<Typography variant='inherit'>Customer Benefit Code</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={8} marginTop={2}>
|
<Grid item xs={7} marginTop={2}>
|
||||||
<Typography variant='subtitle1'>{dataValue?.name}</Typography>
|
<Typography variant='subtitle1'>{dataValue?.customer_benefit_code}</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -1012,6 +1095,9 @@ export default function PlanList() {
|
|||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Limit Benefit
|
Limit Benefit
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell style={headStyle} align="left">
|
||||||
|
Freq. Period
|
||||||
|
</TableCell>
|
||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Limit Frequency
|
Limit Frequency
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@@ -1058,7 +1144,7 @@ export default function PlanList() {
|
|||||||
title={{ name: 'Reason For Update' }}
|
title={{ name: 'Reason For Update' }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* <DialogUpdateStatus
|
<DialogUpdateStatus
|
||||||
openDialog={isDialogOpen}
|
openDialog={isDialogOpen}
|
||||||
setOpenDialog={setDialogOpen}
|
setOpenDialog={setDialogOpen}
|
||||||
title={titles}
|
title={titles}
|
||||||
@@ -1066,7 +1152,7 @@ export default function PlanList() {
|
|||||||
description={dataDescription}
|
description={dataDescription}
|
||||||
content={getContent()}
|
content={getContent()}
|
||||||
// maxWidth='50px'
|
// maxWidth='50px'
|
||||||
/> */}
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ export default function CustomizedAccordions() {
|
|||||||
if (key !== 'reason') {
|
if (key !== 'reason') {
|
||||||
return null; // Melewati iterasi saat key adalah 'deleted_by'
|
return null; // Melewati iterasi saat key adalah 'deleted_by'
|
||||||
}
|
}
|
||||||
|
|
||||||
renderedValue = item.new_values[key];
|
renderedValue = item.new_values[key];
|
||||||
|
|
||||||
const field = key.charAt(0).toUpperCase() + key.slice(1);
|
const field = key.charAt(0).toUpperCase() + key.slice(1);
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ export default function CorporateTabNavigations({ position }: Props) {
|
|||||||
path: 'formulariums',
|
path: 'formulariums',
|
||||||
label: 'Formularium',
|
label: 'Formularium',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: 'claim-history',
|
// path: 'claim-history',
|
||||||
label: 'Claim History',
|
// label: 'Claim History',
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let currentIndex = mainTabItems.findIndex((item) => item.path === position);
|
let currentIndex = mainTabItems.findIndex((item) => item.path === position);
|
||||||
|
|||||||
@@ -0,0 +1,273 @@
|
|||||||
|
/**
|
||||||
|
* Core
|
||||||
|
* ============================================
|
||||||
|
*/
|
||||||
|
import axios from '@/utils/axios';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
import { Box, IconButton, Typography, Grid, Card, TextField, Autocomplete, Button } from '@mui/material';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Components
|
||||||
|
* ============================================
|
||||||
|
*/
|
||||||
|
import Page from '../../../components/Page';
|
||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
import { FormProvider, RHFCustomMultiCheckbox, RHFTextField } from '@/components/hook-form';
|
||||||
|
import { enqueueSnackbar } from 'notistack';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icon
|
||||||
|
* ============================================
|
||||||
|
*/
|
||||||
|
import ArrowBackIosNew from '@mui/icons-material/ArrowBackIosNew';
|
||||||
|
|
||||||
|
export default function Divisions() {
|
||||||
|
const pageTitle = 'Edit Exclusion';
|
||||||
|
const navigate = useNavigate()
|
||||||
|
const { corporate_id, exclusion_id } = useParams(); // id di url
|
||||||
|
const [ plans, setPlans ] = useState<string[]>([]); // option untuk field plans
|
||||||
|
|
||||||
|
// checkbox option
|
||||||
|
// ====================================
|
||||||
|
const msc_checkbox_option = [
|
||||||
|
{
|
||||||
|
value: 'm',
|
||||||
|
label: 'Member',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 's',
|
||||||
|
label: 'Spouse',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'c',
|
||||||
|
label: 'Child',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const gender_checkbox_option = [
|
||||||
|
{
|
||||||
|
value: 'male',
|
||||||
|
label: 'Male',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'female',
|
||||||
|
label: 'Female',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
// setup form
|
||||||
|
// ====================================
|
||||||
|
const defaultValues: any = {
|
||||||
|
msc: [],
|
||||||
|
gender: [],
|
||||||
|
min_age: '',
|
||||||
|
max_age: '',
|
||||||
|
plans: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const methods = useForm<any>({
|
||||||
|
defaultValues
|
||||||
|
});
|
||||||
|
|
||||||
|
const { setValue, handleSubmit, reset, watch, formState: { isDirty, isSubmitting } } = methods;
|
||||||
|
const formValues = watch();
|
||||||
|
|
||||||
|
// set form value
|
||||||
|
// =====================================
|
||||||
|
useEffect(() => {
|
||||||
|
axios.get(`corporates/${corporate_id}/diagnosis-exclusions/${exclusion_id}`)
|
||||||
|
.then((res) => {
|
||||||
|
// plan option
|
||||||
|
setPlans(res.data.data.plans);
|
||||||
|
|
||||||
|
// set value
|
||||||
|
let res_plan = res.data.data.exclusion.rules.plan;
|
||||||
|
|
||||||
|
if (res_plan.length == 1 && res_plan[0] == '') {
|
||||||
|
res_plan = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
reset({
|
||||||
|
msc : res.data.data.exclusion.rules.msc[0].split(','),
|
||||||
|
gender : res.data.data.exclusion.rules.gender[0].split(','),
|
||||||
|
min_age : res.data.data.exclusion.value_rules.min_age,
|
||||||
|
max_age : res.data.data.exclusion.value_rules.max_age,
|
||||||
|
plans : res_plan,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}, [exclusion_id]);
|
||||||
|
|
||||||
|
// Submit Form
|
||||||
|
// =====================================
|
||||||
|
const submitHandler = async (data: any) => {
|
||||||
|
let one_row = {
|
||||||
|
msc: {
|
||||||
|
m: data.msc.includes('m'),
|
||||||
|
s: data.msc.includes('s'),
|
||||||
|
c: data.msc.includes('c'),
|
||||||
|
},
|
||||||
|
gender : {
|
||||||
|
male : data.gender.includes('male') == true ? 1 : 0,
|
||||||
|
female: data.gender.includes('female') == true ? 1 : 0,
|
||||||
|
},
|
||||||
|
min_age: data.min_age,
|
||||||
|
max_age: data.max_age,
|
||||||
|
plan : data.plans.join(','),
|
||||||
|
icd_id : exclusion_id,
|
||||||
|
}
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.post(`/corporates/${corporate_id}/diagnosis-exclusions/store`, {
|
||||||
|
type: 'one_row',
|
||||||
|
icd_id: exclusion_id,
|
||||||
|
one_row
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
enqueueSnackbar('Exclusion Updated', {
|
||||||
|
variant: 'success',
|
||||||
|
});
|
||||||
|
|
||||||
|
reset({
|
||||||
|
msc : data.msc,
|
||||||
|
gender : data.gender,
|
||||||
|
min_age : data.min_age,
|
||||||
|
max_age : data.max_age,
|
||||||
|
plans : data.plans,
|
||||||
|
})
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
enqueueSnackbar('Terjadi kesalahan pada server', {
|
||||||
|
variant: 'error',
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page title={pageTitle}>
|
||||||
|
<Box sx={{ display: 'flex', alignItems: 'center', pl: '12px', mb: '40px' }}>
|
||||||
|
<IconButton size='large' color='inherit' onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions`)} >
|
||||||
|
<ArrowBackIosNew/>
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<Typography variant="h5" sx={{ marginLeft: '24px' }}>
|
||||||
|
{pageTitle}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box sx={{ px: '28px' }}>
|
||||||
|
<FormProvider methods={methods} onSubmit={handleSubmit(submitHandler)}>
|
||||||
|
<Card sx={{ padding: '24px' }}>
|
||||||
|
<Grid container spacing={6}>
|
||||||
|
{/* MSC row */}
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Grid container spacing={2}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div" color={'GrayText'}>
|
||||||
|
MSC* :
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFCustomMultiCheckbox name="msc" options={msc_checkbox_option} sx={{ flexDirection: 'row' }} />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{/* Gender row */}
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Grid container spacing={2}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div" color={'GrayText'}>
|
||||||
|
Gender* :
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFCustomMultiCheckbox name="gender" options={gender_checkbox_option} sx={{ flexDirection: 'row' }} />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{/* Age row */}
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Grid container spacing={3}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div" color={'GrayText'}>
|
||||||
|
Age* :
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||||
|
<Grid container spacing={2}>
|
||||||
|
<Grid item xs={3} md={3}>
|
||||||
|
<RHFTextField
|
||||||
|
id="min_age"
|
||||||
|
name='min_age'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={3} md={3}>
|
||||||
|
<RHFTextField
|
||||||
|
id="max_age"
|
||||||
|
name='max_age'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{/* Plan Section */}
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Grid container spacing={3}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div" color={'GrayText'}>
|
||||||
|
Plan* :
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||||
|
<Autocomplete
|
||||||
|
options={plans}
|
||||||
|
fullWidth
|
||||||
|
multiple
|
||||||
|
limitTags={5}
|
||||||
|
getOptionLabel={(option) => {
|
||||||
|
return option ?? false
|
||||||
|
}}
|
||||||
|
value={formValues.plans}
|
||||||
|
isOptionEqualToValue={(option, value) =>{
|
||||||
|
return option === value
|
||||||
|
}}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField {...params} label="Plan" variant="outlined" />
|
||||||
|
)}
|
||||||
|
onChange={(event,value) => {
|
||||||
|
setValue('plans', value, {shouldDirty: true});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{/* Button Cancle & Save */}
|
||||||
|
<Grid item xs={12} md={12}>
|
||||||
|
<Box display="flex" justifyContent={'flex-end'}>
|
||||||
|
<Box display="flex" gap={1}>
|
||||||
|
<Button variant="outlined" color="inherit" onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions`)}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<LoadingButton disabled={!isDirty} type="submit" variant="contained" loading={isSubmitting}>
|
||||||
|
Save Changes
|
||||||
|
</LoadingButton>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Card>
|
||||||
|
</FormProvider>
|
||||||
|
</Box>
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// @mui
|
// @mui
|
||||||
|
import * as Yup from 'yup';
|
||||||
import {
|
import {
|
||||||
Autocomplete,
|
Autocomplete,
|
||||||
Box,
|
Box,
|
||||||
@@ -46,6 +47,9 @@ import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'reac
|
|||||||
import useSettings from '../../../hooks/useSettings';
|
import useSettings from '../../../hooks/useSettings';
|
||||||
import { Link, useParams, useSearchParams, useNavigate } from 'react-router-dom';
|
import { Link, useParams, useSearchParams, useNavigate } from 'react-router-dom';
|
||||||
// components
|
// components
|
||||||
|
import { yupResolver } from '@hookform/resolvers/yup';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import axios from '../../../utils/axios';
|
import axios from '../../../utils/axios';
|
||||||
import { LaravelPaginatedData } from '../../../@types/paginated-data';
|
import { LaravelPaginatedData } from '../../../@types/paginated-data';
|
||||||
import { Icd } from '../../../@types/diagnosis';
|
import { Icd } from '../../../@types/diagnosis';
|
||||||
@@ -59,6 +63,8 @@ import TableMoreMenu from '@/components/table/TableMoreMenu';
|
|||||||
import { EditOutlined, FindInPageOutlined } from '@mui/icons-material';
|
import { EditOutlined, FindInPageOutlined } from '@mui/icons-material';
|
||||||
import Label from '@/components/Label';
|
import Label from '@/components/Label';
|
||||||
import { display } from '@mui/system';
|
import { display } from '@mui/system';
|
||||||
|
import DialogUpdateStatus from '@/components/DialogUpdateStatus'
|
||||||
|
import { FormProvider, RHFSelect } from '@/components/hook-form';
|
||||||
|
|
||||||
export default function List(props: any) {
|
export default function List(props: any) {
|
||||||
const { themeStretch } = useSettings();
|
const { themeStretch } = useSettings();
|
||||||
@@ -272,6 +278,14 @@ export default function List(props: any) {
|
|||||||
...icd,
|
...icd,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
type DataContent = {
|
||||||
|
service: string;
|
||||||
|
id: number;
|
||||||
|
status: number;
|
||||||
|
code: string,
|
||||||
|
name: string,
|
||||||
|
rules: string,
|
||||||
|
};
|
||||||
const plans = props?.data.map((plan: any) => {
|
const plans = props?.data.map((plan: any) => {
|
||||||
return {
|
return {
|
||||||
value: plan.code,
|
value: plan.code,
|
||||||
@@ -305,6 +319,16 @@ export default function List(props: any) {
|
|||||||
const { row, index, data } = props;
|
const { row, index, data } = props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [isDialogOpen, setDialogOpen] = useState(false)
|
||||||
|
let titles = {
|
||||||
|
name: 'Update Status',
|
||||||
|
icon: '-'
|
||||||
|
}
|
||||||
|
const [dataValue, setDataValue] = useState('');
|
||||||
|
const [dataDescription, setDescriptionValue] = useState('');
|
||||||
|
const [url, setUrl] = useState('');
|
||||||
|
|
||||||
|
|
||||||
function Row(props: {
|
function Row(props: {
|
||||||
row: ReturnType<typeof createData>;
|
row: ReturnType<typeof createData>;
|
||||||
data: any;
|
data: any;
|
||||||
@@ -337,9 +361,6 @@ export default function List(props: any) {
|
|||||||
|
|
||||||
const [openEdit, setOpenEdit] = React.useState(false);
|
const [openEdit, setOpenEdit] = React.useState(false);
|
||||||
|
|
||||||
console.log('open', open);
|
|
||||||
console.log('openEdit', openEdit);
|
|
||||||
|
|
||||||
// const [plans, setPlans] = useState([]);
|
// const [plans, setPlans] = useState([]);
|
||||||
|
|
||||||
const plans = data;
|
const plans = data;
|
||||||
@@ -469,30 +490,53 @@ export default function List(props: any) {
|
|||||||
|
|
||||||
console.log('exclusions', exclusions);
|
console.log('exclusions', exclusions);
|
||||||
|
|
||||||
const handleActivate = (row: any) => {
|
// const handleActivate = (row: any) => {
|
||||||
axios
|
|
||||||
.put(`/corporates/diagnosis-exclusions/update_activation`, {
|
// axios
|
||||||
id: row.id,
|
// .put(`/corporates/diagnosis-exclusions/update_activation`, {
|
||||||
active: row.active == 1 ? 0 : 1,
|
// id: row.id,
|
||||||
})
|
// active: row.active == 1 ? 0 : 1,
|
||||||
.then((res) => {
|
// })
|
||||||
// setDataTableData({
|
// .then((res) => {
|
||||||
// ...dataTableData,
|
// setDataTableData({
|
||||||
// data: dataTableData.data.map((model) => {
|
// ...dataTableData,
|
||||||
// let updatedModel = model;
|
// data: dataTableData.data.map((model) => {
|
||||||
// if (row.id == model.id) {
|
// let updatedModel = model;
|
||||||
// updatedModel.active = res.data.corporate.active;
|
|
||||||
// }
|
// if (model.id == row.id) {
|
||||||
// return updatedModel;
|
// updatedModel.active = row.active == 1 ? 0 : 1;
|
||||||
// }),
|
// }
|
||||||
// });
|
|
||||||
})
|
// return updatedModel;
|
||||||
.catch((error) => {
|
// }),
|
||||||
enqueueSnackbar(
|
// });
|
||||||
error.response.data.message ?? error.message ?? 'Failed Processing Request',
|
// })
|
||||||
{ variant: 'error' }
|
// .catch((error) => {
|
||||||
);
|
// if (error.response.status == 400) {
|
||||||
});
|
// let data = error.response.data.messages;
|
||||||
|
|
||||||
|
// for (const key in data) {
|
||||||
|
// enqueueSnackbar(
|
||||||
|
// data[key][0],
|
||||||
|
// { variant: 'error' }
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// enqueueSnackbar(
|
||||||
|
// error.response.data.message ?? error.message ?? 'Failed Processing Request',
|
||||||
|
// { variant: 'error' }
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
|
const handleActivate = (isOpen: boolean, dataValue: DataContent) => {
|
||||||
|
console.log(dataValue)
|
||||||
|
setDialogOpen(isOpen)
|
||||||
|
setDataValue(dataValue)
|
||||||
|
setDescriptionValue('Are you sure to inactive this service ?')
|
||||||
|
setUrl(url)
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -514,7 +558,7 @@ export default function List(props: any) {
|
|||||||
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
|
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
|
||||||
{row.active == 1 && (
|
{row.active == 1 && (
|
||||||
<Label
|
<Label
|
||||||
variant="outlined"
|
variant="ghost"
|
||||||
color="success"
|
color="success"
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
@@ -523,7 +567,7 @@ export default function List(props: any) {
|
|||||||
)}
|
)}
|
||||||
{row.active != 1 && (
|
{row.active != 1 && (
|
||||||
<Label
|
<Label
|
||||||
variant="outlined"
|
variant="ghost"
|
||||||
color="error"
|
color="error"
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
@@ -539,11 +583,19 @@ export default function List(props: any) {
|
|||||||
<FindInPageOutlined />
|
<FindInPageOutlined />
|
||||||
Detail
|
Detail
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions/history`)} >
|
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions/${row.id}/edit`)} >
|
||||||
<EditOutlined />
|
<EditOutlined />
|
||||||
Edit
|
Edit
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => handleActivate(row)}>
|
<MenuItem onClick={() => handleActivate(true, {
|
||||||
|
code: row.code,
|
||||||
|
name: row.name,
|
||||||
|
rules: Object.keys(row.rules).length ? 'With Rules' : 'All',
|
||||||
|
id:row.id,
|
||||||
|
status: row.active,
|
||||||
|
service: row.service_code
|
||||||
|
})
|
||||||
|
} >
|
||||||
<CachedIcon />
|
<CachedIcon />
|
||||||
Update Status
|
Update Status
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -571,16 +623,30 @@ export default function List(props: any) {
|
|||||||
MSC :
|
MSC :
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
|
<Grid item xs={9} sx={{ display: 'flex', gap: 1 }}>
|
||||||
{row?.rules?.msc && row?.rules?.msc[0] ? (
|
{row?.rules?.msc && row?.rules?.msc[0] ? (
|
||||||
row?.rules?.msc[0].split(',').map((text,i) => {
|
row?.rules?.msc[0].split(',').map((text, i) => {
|
||||||
return (
|
let labelMSC: string = text;
|
||||||
<Typography key={i} component="div">
|
switch (labelMSC) {
|
||||||
<Label>{text}</Label>
|
case 'm':
|
||||||
</Typography>
|
labelMSC = 'Member';
|
||||||
)
|
break;
|
||||||
})
|
case 'c':
|
||||||
) : '-'}
|
labelMSC = 'Child';
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
labelMSC = 'Spouse';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
labelMSC = 'Member';
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Typography key={i} component="div">
|
||||||
|
<Label>{labelMSC}</Label>
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
) : '-'}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
<Typography variant="body1" component="div" color={'GrayText'}>
|
<Typography variant="body1" component="div" color={'GrayText'}>
|
||||||
@@ -589,9 +655,14 @@ export default function List(props: any) {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
|
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
|
||||||
{row?.rules?.gender && row?.rules?.gender[0] ? (
|
{row?.rules?.gender && row?.rules?.gender[0] ? (
|
||||||
<Typography component="div">
|
row?.rules?.gender[0].split(',').map((text,i) => {
|
||||||
<Label>{row?.rules?.gender[0]}</Label>
|
const capitalizedText = text.charAt(0).toUpperCase() + text.slice(1);
|
||||||
</Typography>
|
return (
|
||||||
|
<Typography key={i} component="div">
|
||||||
|
<Label>{capitalizedText}</Label>
|
||||||
|
</Typography>
|
||||||
|
)
|
||||||
|
})
|
||||||
) : '-'}
|
) : '-'}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
@@ -630,222 +701,6 @@ export default function List(props: any) {
|
|||||||
</Card>
|
</Card>
|
||||||
</Box>
|
</Box>
|
||||||
) : null }
|
) : null }
|
||||||
{/* {open == true ? (
|
|
||||||
openEdit == false ? (
|
|
||||||
<Box sx={{ borderBottom: 1 }}>
|
|
||||||
<div>
|
|
||||||
<Typography variant="body" sx={{ fontWeight: 'bold' }}>
|
|
||||||
Excluded Only for :
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
{row.rules.msc && (
|
|
||||||
<Typography variant="body" component="div">
|
|
||||||
MSC : {row.rules.msc.join(', ') ?? '-'}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
{row.rules.gender && (
|
|
||||||
<Typography variant="body" component="div">
|
|
||||||
Gender : {row.rules.gender.join(', ') ?? '-'}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
{(row.rules.min_age || row.rules.max_age) && (
|
|
||||||
<Typography variant="body" component="div">
|
|
||||||
Age : {row.rules.min_age ?? '-'} - {row.rules.max_age ?? '-'}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
{row.rules.plan && (
|
|
||||||
<Typography variant="body" component="div">
|
|
||||||
Plan : {row.rules.plan.join(', ') ?? '-'}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</Box>
|
|
||||||
) : (
|
|
||||||
// <CollapseEdit row={row} index={index} plans={plans} />
|
|
||||||
<Box sx={{ borderBottom: 1, pb: 2 }}>
|
|
||||||
<Typography variant="body2" sx={{ fontWeight: 'bold', mb: 2 }}>
|
|
||||||
Edit Exclusion :
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<Stack direction={'column'} spacing={2}>
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<Grid container spacing={2}>
|
|
||||||
<Grid item xs={2} md={2}>
|
|
||||||
<Typography id="demo-simple-select-label">MSC</Typography>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={10} md={10}>
|
|
||||||
<Stack direction={'row'} spacing={2}>
|
|
||||||
<Grid item xs={3} md={3}>
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={row.value_rules.msc?.m == '1'}
|
|
||||||
onChange={(event) => {
|
|
||||||
// handleConfigExclusion(event, row, 'm', 'msc');
|
|
||||||
handleChange(index, event, 'msc', row.id, 'm');
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label="Member"
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={3} md={3}>
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={row.value_rules.msc?.s == '1'}
|
|
||||||
onChange={(event) => {
|
|
||||||
// handleConfigExclusion(event, row, 's', 'msc');
|
|
||||||
handleChange(index, event, 'msc', row.id, 's');
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label="Spouse"
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={3} md={3}>
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={row.value_rules.msc?.c == '1'}
|
|
||||||
onChange={(event) => {
|
|
||||||
// handleConfigExclusion(event, row, 'c', 'msc');
|
|
||||||
handleChange(index, event, 'msc', row.id, 'c');
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label="Child"
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
</Stack>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</FormControl>
|
|
||||||
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<Grid container spacing={2}>
|
|
||||||
<Grid item xs={2} md={2}>
|
|
||||||
<Typography id="demo-simple-select-label">Gender</Typography>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={10} md={10}>
|
|
||||||
<Stack direction={'row'} spacing={2}>
|
|
||||||
<Grid item xs={3} md={3}>
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={row.value_rules.gender?.male == '1'}
|
|
||||||
onChange={(event) => {
|
|
||||||
// handleConfigExclusion(event, row, 'male', 'gender');
|
|
||||||
handleChange(index, event, 'gender', row.id, 'male');
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label="Male"
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={3} md={3}>
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={row.value_rules.gender?.female == '1'}
|
|
||||||
onChange={(event) => {
|
|
||||||
// handleConfigExclusion(event, row, 'female', 'gender');
|
|
||||||
handleChange(index, event, 'gender', row.id, 'female');
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label="Female"
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
</Stack>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<Grid container spacing={2}>
|
|
||||||
<Grid item xs={2} md={2}>
|
|
||||||
<Typography id="demo-simple-select-label">Age</Typography>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={10} md={10}>
|
|
||||||
<Stack direction={'row'} spacing={2}>
|
|
||||||
<Grid item xs={3} md={3}>
|
|
||||||
<TextField
|
|
||||||
id="outlined-number"
|
|
||||||
type="number"
|
|
||||||
defaultValue={row.value_rules.min_age ?? ''}
|
|
||||||
onChange={(event) => {
|
|
||||||
handleMinAge(event);
|
|
||||||
handleChange(index, event, 'min_age', row.id);
|
|
||||||
}}
|
|
||||||
onKeyDown={(event) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
handleConfigExclusion(event, row, minAge, 'min_age');
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={3} md={3}>
|
|
||||||
<TextField
|
|
||||||
id="outlined-number"
|
|
||||||
type="number"
|
|
||||||
defaultValue={row.value_rules.max_age ?? ''}
|
|
||||||
onChange={(event) => {
|
|
||||||
handleMaxAge(event);
|
|
||||||
handleChange(index, event, 'max_age', row.id);
|
|
||||||
}}
|
|
||||||
onKeyDown={(event) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
handleConfigExclusion(event, row, maxAge, 'max_age');
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
</Stack>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<Grid container spacing={2}>
|
|
||||||
<Grid item xs={2} md={2}>
|
|
||||||
<Typography id="demo-simple-select-label">Plan</Typography>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={10} md={10}>
|
|
||||||
<Stack direction={'row'} spacing={2}>
|
|
||||||
<Grid item xs={12} md={12}>
|
|
||||||
<Autocomplete
|
|
||||||
id="combo-box-demo"
|
|
||||||
options={plans}
|
|
||||||
multiple
|
|
||||||
limitTags={5}
|
|
||||||
fullWidth
|
|
||||||
getOptionLabel={(option) => option.label}
|
|
||||||
defaultValue={converToArray(row.value_rules.plan) || []}
|
|
||||||
isOptionEqualToValue={(option, value) =>
|
|
||||||
option.value === value.value
|
|
||||||
}
|
|
||||||
onChange={(event, value) => {
|
|
||||||
handlePlanChange(event, value);
|
|
||||||
handleChange(index, event, 'plan', row.id, value);
|
|
||||||
}}
|
|
||||||
onKeyDown={(event) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
handleConfigExclusion(event, row, valuePlan, 'plan');
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
renderInput={(params) => (
|
|
||||||
<TextField {...params} label="Plan" variant="outlined" />
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
</Stack>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</FormControl>
|
|
||||||
</Stack>
|
|
||||||
</Box>
|
|
||||||
)
|
|
||||||
) : null} */}
|
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
@@ -944,6 +799,18 @@ export default function List(props: any) {
|
|||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onSubmit = async (row : any) => {
|
||||||
|
try {
|
||||||
|
handleUpdate(dataValue.status, dataValue.id, row.reason)
|
||||||
|
} catch (error: any) {
|
||||||
|
console.log('data gagal');
|
||||||
|
}
|
||||||
|
|
||||||
|
const ascent = document?.querySelector('ascent');
|
||||||
|
if (ascent != null) {
|
||||||
|
ascent.innerHTML = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
const applyFilter = async (searchFilter: any) => {
|
const applyFilter = async (searchFilter: any) => {
|
||||||
await loadDataTableData({ search: searchFilter });
|
await loadDataTableData({ search: searchFilter });
|
||||||
setSearchParams({ search: searchFilter });
|
setSearchParams({ search: searchFilter });
|
||||||
@@ -961,6 +828,136 @@ export default function List(props: any) {
|
|||||||
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
const NewCorporateSchema = Yup.object().shape({
|
||||||
|
reason: Yup.string().required('Reason Edit is required'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const methods = useForm<FormValuesProps>({
|
||||||
|
resolver: yupResolver(NewCorporateSchema),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const {
|
||||||
|
reset,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting },
|
||||||
|
} = methods;
|
||||||
|
|
||||||
|
const handleUpdate = (active: number, id: number, reason:string) => {
|
||||||
|
console.log(active)
|
||||||
|
axios
|
||||||
|
.put(`/corporates/diagnosis-exclusions/update_activation`, {
|
||||||
|
id: id,
|
||||||
|
active: active,
|
||||||
|
reason: reason
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const getContent = () => (
|
||||||
|
<>
|
||||||
|
<Stack paddingX={2} paddingY={2}>
|
||||||
|
<Typography variant='subtitle1'>Are you sure to {dataValue?.status == 1 ? 'inactive' : 'active'} this benefit ?</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Card>
|
||||||
|
<Grid container paddingX={2} paddingY={2}>
|
||||||
|
<Grid item xs={5} md={5}>
|
||||||
|
<Typography variant='inherit'>Service</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={7}>
|
||||||
|
<Typography variant='subtitle1'>{dataValue?.service}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={5} md={5} marginTop={2}>
|
||||||
|
<Typography variant='inherit'>Code</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={7} marginTop={2}>
|
||||||
|
<Typography variant='subtitle1'>{dataValue?.code}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={5} md={5} marginTop={2}>
|
||||||
|
<Typography variant='inherit'>Name</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={7} marginTop={2}>
|
||||||
|
<Typography variant='subtitle1'>{dataValue?.name}</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={5} md={5} marginTop={2}>
|
||||||
|
<Typography variant='inherit'>Rules</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={7} marginTop={2}>
|
||||||
|
<Typography variant='subtitle1'>{dataValue?.rules}</Typography>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Typography marginTop={5} marginBottom={3} variant='subtitle1'>
|
||||||
|
Reason for update*
|
||||||
|
</Typography>
|
||||||
|
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<RHFSelect
|
||||||
|
name="reason"
|
||||||
|
label="Reason for update"
|
||||||
|
>
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="Agreement changed">Agreement changed</option>
|
||||||
|
<option value="Endorsement">Endorsement</option>
|
||||||
|
<option value="Renewal">Renewal</option>
|
||||||
|
<option value="Worng Setting">Worng Setting</option>
|
||||||
|
</RHFSelect>
|
||||||
|
<Stack
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="flex-end"
|
||||||
|
direction={{ xs: 'column', md: 'row' }}
|
||||||
|
spacing={2}
|
||||||
|
marginTop={5}
|
||||||
|
>
|
||||||
|
<Stack direction="row" spacing={1}>
|
||||||
|
<Button
|
||||||
|
sx={{
|
||||||
|
boxShadow: 'none',
|
||||||
|
}}
|
||||||
|
variant="outlined"
|
||||||
|
size="medium"
|
||||||
|
fullWidth={true}
|
||||||
|
onClick={() => setDialogOpen(false)}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
{dataValue?.status == 1?
|
||||||
|
<LoadingButton
|
||||||
|
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
size="medium"
|
||||||
|
fullWidth={true}
|
||||||
|
loading={isSubmitting}
|
||||||
|
color='error'
|
||||||
|
>
|
||||||
|
Inactive
|
||||||
|
</LoadingButton>
|
||||||
|
:
|
||||||
|
<LoadingButton
|
||||||
|
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
size="medium"
|
||||||
|
fullWidth={true}
|
||||||
|
loading={isSubmitting}
|
||||||
|
color='success'
|
||||||
|
>
|
||||||
|
Active
|
||||||
|
</LoadingButton>
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
</FormProvider>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<ImportForm />
|
<ImportForm />
|
||||||
@@ -1033,6 +1030,16 @@ export default function List(props: any) {
|
|||||||
|
|
||||||
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
|
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
<DialogUpdateStatus
|
||||||
|
openDialog={isDialogOpen}
|
||||||
|
setOpenDialog={setDialogOpen}
|
||||||
|
title={titles}
|
||||||
|
data={dataValue}
|
||||||
|
description={dataDescription}
|
||||||
|
content={getContent()}
|
||||||
|
// maxWidth='50px'
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,64 +1,63 @@
|
|||||||
|
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import HeaderBreadcrumbs from "../../../components/HeaderBreadcrumbs";
|
import HeaderBreadcrumbs from "../../../components/HeaderBreadcrumbs";
|
||||||
import Page from "../../../components/Page";
|
import Page from "../../../components/Page";
|
||||||
import useSettings from "../../../hooks/useSettings";
|
import useSettings from "../../../hooks/useSettings";
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useContext, useEffect, useMemo, useState } from 'react';
|
||||||
import axios from '../../../utils/axios';
|
import CorporateHospitalForm from './Form';
|
||||||
import { useSnackbar } from 'notistack';
|
import { Hospital } from '../../../@types/corporates';
|
||||||
import CorporatePlanForm from './Form';
|
import { Corporate } from "@/@types/corporates";
|
||||||
import { CorporatePlan } from '../../../@types/corporates';
|
import { ConfiguredCorporateContext } from "@/contexts/ConfiguredCorporateContext";
|
||||||
|
import { Stack, Typography } from '@mui/material';
|
||||||
|
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function PlanCreate() {
|
export default function HospitalCreate() {
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
const { corporate_id, id } = useParams();
|
const { corporate_id, id } = useParams();
|
||||||
const [ currentCorporatePlan, setCurrentCorporatePlan ] = useState<CorporatePlan>();
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const [corporate, setCorporate] = useState<Corporate|null>();
|
||||||
|
|
||||||
|
const configuredCorporateContext = useContext(ConfiguredCorporateContext);
|
||||||
|
|
||||||
const isEdit = !!id;
|
const isEdit = !!id;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isEdit) {
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
axios.get('/corporates/'+corporate_id+'/divisions/'+id+'/edit')
|
}, [corporate_id, id, configuredCorporateContext]);
|
||||||
.then((res) => {
|
|
||||||
setCurrentCorporatePlan(res.data);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
if (err.response.status === 404) {
|
|
||||||
navigate('/404');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [corporate_id, id]);
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title="Create Corporate Division">
|
<Page title="Create Hospital">
|
||||||
<HeaderBreadcrumbs
|
{isEdit ? (
|
||||||
heading={'Create Corporate Division'}
|
<Stack direction="row" alignItems="center" sx={{ marginBottom: 3 }}>
|
||||||
links={[
|
<ArrowBackIosIcon sx={{cursor:'pointer'}} onClick={() => navigate(-1)}/>
|
||||||
{
|
<Typography variant="h5" sx={{marginLeft:2}}>Edit Hospital</Typography>
|
||||||
name: 'Corporates',
|
</Stack>
|
||||||
href: '/corporates',
|
) : (
|
||||||
},
|
<HeaderBreadcrumbs
|
||||||
{
|
heading={'Create Hospital'}
|
||||||
name: 'Corporate Name',
|
links={[
|
||||||
href: '/corporates/'+corporate_id,
|
{
|
||||||
},
|
name: 'Corporates',
|
||||||
{
|
href: '/corporates',
|
||||||
name: 'Division',
|
},
|
||||||
href: '/corporates/'+corporate_id+'/divisions',
|
{
|
||||||
},
|
name: corporate?.name ?? '-',
|
||||||
{
|
href: '/corporates/'+corporate_id,
|
||||||
name: !isEdit ? 'Create' : 'Edit',
|
},
|
||||||
href: '/corporates/'+corporate_id+'/divisions/'+id,
|
{
|
||||||
},
|
name: 'Hospital',
|
||||||
]}
|
href: '/corporates/'+corporate_id+'/hospitals',
|
||||||
/>
|
},
|
||||||
|
{
|
||||||
<CorporatePlanForm isEdit={isEdit} currentCorporatePlan={currentCorporatePlan}/>
|
name: !isEdit ? 'Create' : 'Edit',
|
||||||
|
href: '/corporates/'+corporate_id+'/hospitals/create',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<CorporateHospitalForm isEdit={isEdit} />
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,129 +1,171 @@
|
|||||||
import * as Yup from 'yup';
|
import { Button, Card, Grid, Stack, Typography, FormControl, InputLabel, Select, FormHelperText, MenuItem } from "@mui/material";
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { Card, Grid, Stack, Typography } from "@mui/material";
|
|
||||||
import { CorporatePlan } from "../../../@types/corporates";
|
|
||||||
import { FormProvider, RHFSwitch, RHFTextField } from "../../../components/hook-form";
|
|
||||||
import { useEffect, useMemo } from 'react';
|
|
||||||
import { useForm } from 'react-hook-form';
|
|
||||||
import { yupResolver } from '@hookform/resolvers/yup';
|
|
||||||
import { useSnackbar } from 'notistack';
|
import { useSnackbar } from 'notistack';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import axios from '../../../utils/axios';
|
import axios from '../../../utils/axios';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isEdit: boolean;
|
isEdit: boolean;
|
||||||
currentCorporatePlan?: CorporatePlan;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Props) {
|
export default function CorporateHospitalForm({ isEdit }: Props) {
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { corporate_id } = useParams();
|
const { corporate_id, id, organization_id } = useParams();
|
||||||
|
const [dataHospital, setDataHospital] = useState(null);
|
||||||
const NewCorporatePlanSchema = Yup.object().shape({
|
let idHospital = organization_id && isEdit ? organization_id : 0;
|
||||||
name: Yup.string().required('Name is required'),
|
const [indexData, setIndexData] = useState(idHospital);
|
||||||
code: Yup.string().required('Corporate Code is required'),
|
const [updateData, setUpdateData] = useState(null);
|
||||||
});
|
const [dataDefault, setDataDefault] = useState(null);
|
||||||
|
|
||||||
const defaultValues = useMemo(
|
|
||||||
() => ({
|
|
||||||
name: currentCorporatePlan?.name || '',
|
|
||||||
code: currentCorporatePlan?.code || '',
|
|
||||||
active: currentCorporatePlan?.active === 1 ? true : false,
|
|
||||||
}),
|
|
||||||
[currentCorporatePlan]
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isEdit && currentCorporatePlan) {
|
axios.get('/corporates/' + corporate_id + '/hospitals/data')
|
||||||
reset(defaultValues);
|
.then((res) => {
|
||||||
|
setDataHospital(res.data);
|
||||||
|
const data = {
|
||||||
|
corporate_id : corporate_id ? corporate_id : null,
|
||||||
|
organization_id : res.data[0] ? res.data[0].id : null,
|
||||||
|
code : res.data[0] ? res.data[0].code : null,
|
||||||
|
name : res.data[0] ? res.data[0].name : null,
|
||||||
|
}
|
||||||
|
setDataDefault(data);
|
||||||
|
})
|
||||||
|
|
||||||
|
}, [isEdit]);
|
||||||
|
|
||||||
|
const [addData, setAddData] = useState(dataDefault);
|
||||||
|
|
||||||
|
const handlePageChange = (index:any) => {
|
||||||
|
setIndexData(index);
|
||||||
|
const data = {
|
||||||
|
corporate_id : corporate_id ? corporate_id : null,
|
||||||
|
organization_id : dataHospital ? dataHospital[index].id : null,
|
||||||
|
code : dataHospital ? dataHospital[index].code : null,
|
||||||
|
name : dataHospital ? dataHospital[index].name : null,
|
||||||
}
|
}
|
||||||
if (!isEdit) {
|
setAddData(data);
|
||||||
reset(defaultValues);
|
|
||||||
|
}
|
||||||
|
const handleSaveData = () => {
|
||||||
|
//Save data
|
||||||
|
axios
|
||||||
|
.post('/corporates/'+corporate_id+'/hospitals/save', (addData ? addData : dataDefault))
|
||||||
|
.then((response) => {
|
||||||
|
if(response.data)
|
||||||
|
{
|
||||||
|
enqueueSnackbar('Data saved successfully', { variant: 'success' });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
enqueueSnackbar('Failed to add data', { variant: 'error' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageChangeUpdate = (id: any) => {
|
||||||
|
setIndexData(id);
|
||||||
|
const foundData = dataHospital?.find(item => item.id === id);
|
||||||
|
const dataUpdate = {
|
||||||
|
corporate_id : corporate_id ? corporate_id : null,
|
||||||
|
organization_id : dataHospital ? foundData.id : null,
|
||||||
|
code : dataHospital ? foundData.code : null,
|
||||||
|
name : dataHospital ? foundData.name : null,
|
||||||
}
|
}
|
||||||
}, [isEdit, currentCorporatePlan]);
|
setUpdateData(dataUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
const methods = useForm({
|
const handleUpdateData = () => {
|
||||||
resolver: yupResolver(NewCorporatePlanSchema),
|
//Update data
|
||||||
defaultValues,
|
if(updateData)
|
||||||
});
|
{
|
||||||
|
axios
|
||||||
const {
|
.put('/corporates/'+corporate_id+'/hospitals/'+id+'/edit', updateData)
|
||||||
reset,
|
.then((response) => {
|
||||||
watch,
|
if(response.data)
|
||||||
control,
|
{
|
||||||
setValue,
|
enqueueSnackbar('Data updated successfully', { variant: 'success' });
|
||||||
getValues,
|
navigate(-1);
|
||||||
setError,
|
window.history.replaceState(null, '', '/corporates/'+corporate_id+'/hospitals');
|
||||||
handleSubmit,
|
|
||||||
formState: { isSubmitting },
|
|
||||||
} = methods;
|
|
||||||
|
|
||||||
|
|
||||||
const onSubmit = async (data: any) => {
|
|
||||||
if (!isEdit) {
|
|
||||||
await axios
|
|
||||||
.post('/corporate/' + corporate_id + '/divisions', data)
|
|
||||||
.then((res) => {
|
|
||||||
enqueueSnackbar('Division created successfully', { variant: 'success' });
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
navigate('/corporate/' + corporate_id + '/divisions', { replace: true });
|
|
||||||
})
|
|
||||||
.catch(({ response }) => {
|
|
||||||
if (response.status === 422) {
|
|
||||||
for (const [key, value] of Object.entries(response.data.errors)) {
|
|
||||||
setError(key, { message: value[0] });
|
|
||||||
enqueueSnackbar(value[0] ?? 'Failed Processing Request', { variant: 'error' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
enqueueSnackbar('Create Failed : '+ response.data.message, { variant: 'error' });
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
enqueueSnackbar('Failed to update data', { variant: 'error' });
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
await axios
|
|
||||||
.put('/corporate/' + corporate_id + '/divisions/' + currentCorporatePlan?.id , data)
|
|
||||||
.then((res) => {
|
|
||||||
enqueueSnackbar('Division updated successfully', { variant: 'success' });
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
navigate('/corporate/' + corporate_id + '/divisions/' , { replace: true });
|
|
||||||
})
|
|
||||||
.catch(({ response }) => {
|
|
||||||
enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
else
|
||||||
|
{
|
||||||
|
enqueueSnackbar('Data has not changed.', { variant: 'error' });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
<Stack>
|
||||||
<Grid container spacing={2}>
|
<Card sx={{ p: 2 }}>
|
||||||
<Grid item xs={8}>
|
<Stack spacing={2} direction='column'>
|
||||||
<Card sx={{ p: 2 }}>
|
<Typography variant='subtitle1'>Hospital *</Typography>
|
||||||
<Stack spacing={3}>
|
{dataHospital && dataHospital.length > 0 ? (
|
||||||
|
isEdit ? (
|
||||||
|
<FormControl>
|
||||||
|
<InputLabel htmlFor="id_hospital" required>
|
||||||
|
Hospital
|
||||||
|
</InputLabel>
|
||||||
|
<Select
|
||||||
|
id="id_hospital"
|
||||||
|
value={dataHospital && dataHospital.length > 0 ? indexData : ''}
|
||||||
|
fullWidth
|
||||||
|
label="Hospital"
|
||||||
|
onChange={(e) => {
|
||||||
|
handlePageChangeUpdate(e.target.value);
|
||||||
|
}}
|
||||||
|
|
||||||
|
>
|
||||||
|
{dataHospital?.map((data, index) => (
|
||||||
|
<MenuItem key={index} value={data.id}>{data.name}</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
) : (
|
||||||
|
<FormControl>
|
||||||
|
<InputLabel htmlFor="id_hospital" required>
|
||||||
|
Hospital
|
||||||
|
</InputLabel>
|
||||||
|
<Select
|
||||||
|
id="id_hospital"
|
||||||
|
value={dataHospital && dataHospital.length > 0 ? indexData : ''}
|
||||||
|
fullWidth
|
||||||
|
label="Hospital"
|
||||||
|
onChange={(e) => {
|
||||||
|
handlePageChange(e.target.value);
|
||||||
|
}}
|
||||||
|
|
||||||
|
>
|
||||||
|
{dataHospital?.map((data, index) => (
|
||||||
|
<MenuItem key={index} value={index}>{data.name}</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<Typography variant='body2' style={{ position: 'relative', margin: 'auto', width: 'fit-content' }}>
|
||||||
|
Loading
|
||||||
|
</Typography>
|
||||||
|
|
||||||
<Typography variant="h6">Division Detail</Typography>
|
)}
|
||||||
|
|
||||||
<RHFTextField name="name" label="Name" />
|
<Stack direction='row' spacing={2} justifyContent='flex-end'>
|
||||||
|
<Button variant="outlined" sx={{color: '#212B36'}} onClick={() => navigate(-1)}>Cancel</Button>
|
||||||
<RHFTextField name="code" label="Code" />
|
{isEdit ? (
|
||||||
|
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" onClick={() => handleUpdateData()}>Save</Button>
|
||||||
<LoadingButton type="submit" variant="contained" size="large" fullWidth={true} loading={isSubmitting}>
|
):(
|
||||||
{ isEdit? 'Update' : 'Create' }
|
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" onClick={() => handleSaveData()}>Save</Button>
|
||||||
</LoadingButton>
|
)}
|
||||||
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Card>
|
</Stack>
|
||||||
</Grid>
|
</Card>
|
||||||
<Grid item xs={4}>
|
</Stack>
|
||||||
<Card sx={{ p:2 }}>
|
|
||||||
|
|
||||||
<RHFSwitch name="active" label="Active" />
|
|
||||||
</Card>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</FormProvider>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
158
frontend/dashboard/src/pages/Corporates/Hospital/History.tsx
Normal file
158
frontend/dashboard/src/pages/Corporates/Hospital/History.tsx
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import HeaderBreadcrumbs from "../../../components/HeaderBreadcrumbs";
|
||||||
|
import Page from "../../../components/Page";
|
||||||
|
import { useContext, useEffect, useState } from 'react';
|
||||||
|
import { Hospital } from '../../../@types/corporates';
|
||||||
|
import { Corporate } from "@/@types/corporates";
|
||||||
|
import { ConfiguredCorporateContext } from "@/contexts/ConfiguredCorporateContext";
|
||||||
|
import {
|
||||||
|
Stack,
|
||||||
|
Typography,
|
||||||
|
Card,
|
||||||
|
Paper,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableContainer,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
Collapse,
|
||||||
|
Box,
|
||||||
|
Tab,
|
||||||
|
} from '@mui/material';
|
||||||
|
import axios from '@/utils/axios';
|
||||||
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||||
|
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
||||||
|
import { fDate, fDateTime } from '@/utils/formatTime';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default function HospitalHistory() {
|
||||||
|
const { corporate_id, id } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const [corporate, setCorporate] = useState<Corporate|null>();
|
||||||
|
|
||||||
|
const [ currentHospital, setCurrentHospital ] = useState<Hospital>();
|
||||||
|
|
||||||
|
const configuredCorporateContext = useContext(ConfiguredCorporateContext);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
|
const model = 'App\\Models\\CorporateHospital';
|
||||||
|
const url = `/audittrail/${id}?model=${model}`;
|
||||||
|
axios.get(url)
|
||||||
|
.then((res) => {
|
||||||
|
setCurrentHospital(res.data);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Terjadi kesalahan:', error);
|
||||||
|
});
|
||||||
|
}, [corporate_id, id, configuredCorporateContext]);
|
||||||
|
|
||||||
|
const [openRows, setOpenRows] = useState({});
|
||||||
|
|
||||||
|
const handleRowToggle = (index) => {
|
||||||
|
setOpenRows((prevOpenRows) => ({
|
||||||
|
...prevOpenRows,
|
||||||
|
[index]: !prevOpenRows[index],
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page title="History Hospital">
|
||||||
|
<HeaderBreadcrumbs
|
||||||
|
heading={'History Hospital'}
|
||||||
|
links={[
|
||||||
|
{
|
||||||
|
name: 'Corporates',
|
||||||
|
href: '/corporates',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: corporate?.name ?? '-',
|
||||||
|
href: '/corporates/'+corporate_id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Hospital',
|
||||||
|
href: '/corporates/'+corporate_id+'/hospitals',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'History',
|
||||||
|
href: '/corporates/'+corporate_id+'/hospitals/history',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<Card>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label="collapsible table">
|
||||||
|
{/* Condition Table Body */}
|
||||||
|
{currentHospital?.data.map((item, index) => (
|
||||||
|
<TableBody key={index}>
|
||||||
|
<TableRow sx={{backgroundColor: '#919EAB29'}}>
|
||||||
|
<TableCell align="left" sx={{fontWeight: 'bold', width: '95%'}}><Typography variant="subtitle1">Data has {item.action} by {item.user_id} on {fDateTime(item.updated_at)}</Typography></TableCell>
|
||||||
|
<TableCell align="left" sx={{width: '5%'}}>
|
||||||
|
{openRows[index] ? (
|
||||||
|
<KeyboardArrowDownIcon sx={{ cursor: 'pointer' }} onClick={() => handleRowToggle(index)} />
|
||||||
|
) : (
|
||||||
|
<KeyboardArrowRightIcon sx={{ cursor: 'pointer' }} onClick={() => handleRowToggle(index)} />
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
<TableRow sx={{display: openRows[index] ? '' : 'none',}}>
|
||||||
|
<TableCell colSpan={2}>
|
||||||
|
{/* COLLAPSIBLE ROW */}
|
||||||
|
<Collapse in={openRows[index]} timeout="auto" unmountOnExit>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label="collapsible table">
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography sx={{width: '25%'}} variant="subtitle2">Field</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography sx={{width: '25%'}} variant="subtitle2">Old Value</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography sx={{width: '50%'}} variant="subtitle2">New Value</Typography>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{Object.entries(item.old_values).map(([key, value]) => {
|
||||||
|
let renderedValue;
|
||||||
|
if (key === 'code' || key === 'name') {
|
||||||
|
renderedValue = item.new_values[key];
|
||||||
|
const field = key.charAt(0).toUpperCase() + key.slice(1);
|
||||||
|
return (
|
||||||
|
<TableRow key={key}>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant="body2">{field ? field : '-'}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant="body2">{value ? value : '-'}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant="body2">{renderedValue ? renderedValue : ''}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</Collapse>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableBody>
|
||||||
|
))}
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</Card>
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,32 +1,33 @@
|
|||||||
import { Card, Grid, Typography } from '@mui/material';
|
import { Corporate } from "@/@types/corporates";
|
||||||
import { useParams } from 'react-router-dom';
|
import { ConfiguredCorporateContext } from "@/contexts/ConfiguredCorporateContext";
|
||||||
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
|
import { Card } from "@mui/material";
|
||||||
import Page from '../../../components/Page';
|
import { useContext, useEffect, useState } from "react";
|
||||||
import useSettings from '../../../hooks/useSettings';
|
import { useParams } from "react-router-dom";
|
||||||
import CorporateTabNavigations from '../CorporateTabNavigations';
|
import HeaderBreadcrumbs from "../../../components/HeaderBreadcrumbs";
|
||||||
import DivisionsList from './List';
|
import Page from "../../../components/Page";
|
||||||
|
import useSettings from "../../../hooks/useSettings";
|
||||||
|
import CorporateTabNavigations from "../CorporateTabNavigations";
|
||||||
|
import List from "./List";
|
||||||
|
|
||||||
import { useContext, useEffect, useState } from 'react';
|
|
||||||
import { ConfiguredCorporateContext } from '@/contexts/ConfiguredCorporateContext';
|
|
||||||
import { Corporate } from '@/@types/corporates';
|
|
||||||
|
|
||||||
export default function Divisions() {
|
|
||||||
const { themeStretch } = useSettings();
|
export default function hospitals() {
|
||||||
|
|
||||||
const { corporate_id } = useParams();
|
const { corporate_id } = useParams();
|
||||||
|
|
||||||
const [corporate, setCorporate] = useState<Corporate | null>();
|
const [corporate, setCorporate] = useState<Corporate|null>();
|
||||||
|
|
||||||
const configuredCorporateContext = useContext(ConfiguredCorporateContext);
|
const configuredCorporateContext = useContext(ConfiguredCorporateContext);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCorporate(configuredCorporateContext.currentCorporate);
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
}, [configuredCorporateContext]);
|
}, [configuredCorporateContext])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title="Hospitals">
|
<Page title="Hospital">
|
||||||
|
|
||||||
<HeaderBreadcrumbs
|
<HeaderBreadcrumbs
|
||||||
heading={'Hospitals'}
|
heading={'Hospital'}
|
||||||
links={[
|
links={[
|
||||||
{
|
{
|
||||||
name: 'Corporates',
|
name: 'Corporates',
|
||||||
@@ -37,7 +38,7 @@ export default function Divisions() {
|
|||||||
href: '/corporates/' + corporate_id,
|
href: '/corporates/' + corporate_id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Hospitals',
|
name: 'Hospital',
|
||||||
href: '/corporates/' + corporate_id + '/hospitals',
|
href: '/corporates/' + corporate_id + '/hospitals',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
@@ -45,7 +46,7 @@ export default function Divisions() {
|
|||||||
|
|
||||||
<Card>
|
<Card>
|
||||||
<CorporateTabNavigations position={'hospitals'} />
|
<CorporateTabNavigations position={'hospitals'} />
|
||||||
<Typography sx={{ m: 4 }}>Feature Not Implemented Yet</Typography>
|
<List />
|
||||||
</Card>
|
</Card>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,124 +1,158 @@
|
|||||||
// @mui
|
// @mui
|
||||||
import { Box, Button, Card, Collapse, IconButton, InputLabel, MenuItem, OutlinedInput, Paper, Select, SelectChangeEvent, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, Badge, Tab, Tabs, CardHeader, Stack, Menu, ButtonGroup } from '@mui/material';
|
import {
|
||||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
Button,
|
||||||
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
Card,
|
||||||
|
IconButton,
|
||||||
|
MenuItem,
|
||||||
|
Paper,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableContainer,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
TextField,
|
||||||
|
Typography,
|
||||||
|
Stack,
|
||||||
|
Collapse,
|
||||||
|
Box,
|
||||||
|
FormControl,
|
||||||
|
InputLabel,
|
||||||
|
Select,
|
||||||
|
FormHelperText,
|
||||||
|
} from '@mui/material';
|
||||||
import AddIcon from '@mui/icons-material/Add';
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
import UploadIcon from '@mui/icons-material/Upload';
|
|
||||||
import CancelIcon from '@mui/icons-material/Cancel';
|
|
||||||
// hooks
|
// hooks
|
||||||
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
|
||||||
import useSettings from '../../../hooks/useSettings';
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
|
||||||
// components
|
// components
|
||||||
import axios from '../../../utils/axios';
|
import axios from '../../../utils/axios';
|
||||||
import { CorporatePlan } from '../../../@types/corporates';
|
import { CorporatePlan } from '../../../@types/corporates';
|
||||||
import { LaravelPaginatedData } from '../../../@types/paginated-data';
|
import { LaravelPaginatedData } from '../../../@types/paginated-data';
|
||||||
import BasePagination from '../../../components/BasePagination';
|
import BasePagination from '../../../components/BasePagination';
|
||||||
|
import TableMoreMenu from '@/components/table/TableMoreMenu';
|
||||||
|
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
|
||||||
|
import HistoryIcon from '@mui/icons-material/History';
|
||||||
|
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
|
||||||
|
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
|
||||||
|
import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
|
||||||
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
|
import { enqueueSnackbar } from 'notistack';
|
||||||
|
import Label from '../../../components/Label';
|
||||||
|
|
||||||
export default function PlanList() {
|
export default function PlanList() {
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
const { corporate_id } = useParams();
|
const { corporate_id } = useParams();
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
function SearchInput(props: any) {
|
function SearchInput(props: any) {
|
||||||
// SEARCH
|
// SEARCH
|
||||||
const searchInput = useRef<HTMLInputElement>(null);
|
const searchInput = useRef<HTMLInputElement>(null);
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState('');
|
||||||
|
|
||||||
const handleSearchChange = (event: any) => {
|
const handleSearchChange = (event: any) => {
|
||||||
const newSearchText = event.target.value ?? ''
|
const newSearchText = event.target.value ?? '';
|
||||||
setSearchText(newSearchText);
|
setSearchText(newSearchText);
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleSubmit = (event: any) => {
|
const handleSubmit = (event: any) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
props.onSearch(searchText); // Trigger to Parent
|
props.onSearch(searchText); // Trigger to Parent
|
||||||
}
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('Search Input: useEffect')
|
|
||||||
setSearchText(searchParams.get('search') ?? '');
|
setSearchText(searchParams.get('search') ?? '');
|
||||||
}, [searchParams])
|
}, [searchParams]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit} style={{ width: '100%' }}>
|
<form onSubmit={handleSubmit} style={{ width: '100%' }}>
|
||||||
<TextField id="search-input" ref={searchInput} label="Search" variant="outlined" fullWidth onChange={handleSearchChange} value={searchText}/>
|
<TextField
|
||||||
|
id="search-input"
|
||||||
|
ref={searchInput}
|
||||||
|
label="Search"
|
||||||
|
variant="outlined"
|
||||||
|
fullWidth
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
value={searchText}
|
||||||
|
/>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on every row to map the data to the columns
|
// Called on every row to map the data to the columns
|
||||||
function createData( plan: CorporatePlan ): CorporatePlan {
|
function createData(plan: CorporatePlan): CorporatePlan {
|
||||||
return {
|
return {
|
||||||
...plan,
|
...plan,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the every row of the table
|
// Generate the every row of the table
|
||||||
function Row(props: { row: ReturnType<typeof createData> }) {
|
function Row(props: { row: ReturnType<typeof createData> }) {
|
||||||
const { row } = props;
|
const { row } = props;
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
|
const style1 = {
|
||||||
|
color: '#637381'
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
|
<TableRow sx={{ '& > *': open ? {borderBottom: 'unset'} : {}, cursor: open ? 'pointer' : '' }} onClick={() => {if(open==true) setOpen(!open)}}>
|
||||||
<TableCell>
|
<TableCell align="left">{row.code ? row.code : '-'}</TableCell>
|
||||||
<IconButton
|
<TableCell align="left">{row.name ? row.name : '-'}</TableCell>
|
||||||
aria-label="expand row"
|
<TableCell align="left">
|
||||||
size="small"
|
{row.active === 1 ? (
|
||||||
onClick={() => setOpen(!open)}
|
<Label color='success' >
|
||||||
>
|
Active
|
||||||
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
|
</Label>
|
||||||
</IconButton>
|
) : (
|
||||||
|
<Label color='error'>
|
||||||
|
Inactive
|
||||||
|
</Label>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<TableMoreMenu actions={
|
||||||
|
<>
|
||||||
|
<MenuItem onClick={() => setOpen(!open)}>
|
||||||
|
<FindInPageOutlinedIcon />
|
||||||
|
Details
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => handleEditData(row)}>
|
||||||
|
<EditOutlinedIcon />
|
||||||
|
Edit
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => handleEditDataStatus(row)}>
|
||||||
|
<CachedOutlinedIcon />
|
||||||
|
Update Status
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => navigate ('/corporates/'+corporate_id+'/hospitals/'+row.id+'/history')}>
|
||||||
|
<HistoryIcon />
|
||||||
|
History
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">{row.id}</TableCell>
|
|
||||||
<TableCell align="left">{row.code}</TableCell>
|
|
||||||
<TableCell align="left">{row.name}</TableCell>
|
|
||||||
<TableCell align="left">{row.description}</TableCell>
|
|
||||||
<TableCell align="right"><Button variant="outlined" color="success" size="small">Active</Button></TableCell>
|
|
||||||
<TableCell align="right"><Link to={`/corporates/${row.corporate_id}/divisions/${row.id}/edit`}><Button variant="outlined" color="success" size="small">Edit</Button></Link></TableCell>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
{/* COLLAPSIBLE ROW */}
|
{/* COLLAPSIBLE ROW */}
|
||||||
<TableRow>
|
<TableRow sx={{display: open ? '' : 'none', cursor: open ? 'pointer' : ''}} onClick={() => {if(open==true) setOpen(!open)}}>
|
||||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={10}>
|
<TableCell colSpan={4}>
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
<Box sx={{ borderBottom: 1 }}>
|
<Card sx={{padding:2}}>
|
||||||
<Typography variant="body2" gutterBottom component="div">
|
<Box sx={{ pb: 2 }}>
|
||||||
No Extra Data
|
<Typography variant='subtitle1'>Detail</Typography>
|
||||||
</Typography>
|
<Stack marginTop={2}>
|
||||||
</Box>
|
<Stack direction='row' spacing={1}>
|
||||||
{false && <Box sx={{ margin: 1 }}>
|
<Typography variant='body2' sx={{color: style1.color, width: '50%'}}>Code:</Typography>
|
||||||
<Typography variant="h6" gutterBottom component="div">
|
<Typography variant='body2' sx={{width: '50%'}}>{row.code ? row.code : '-'}</Typography>
|
||||||
Rules
|
</Stack>
|
||||||
</Typography>
|
<Stack direction='row' spacing={1}>
|
||||||
<Table size="small" aria-label="purchases">
|
<Typography variant='body2' sx={{color: style1.color, width: '50%'}}>Hospital Name:</Typography>
|
||||||
<TableHead>
|
<Typography variant='body2' sx={{width: '50%'}}>{row.name ? row.name : '-'}</Typography>
|
||||||
<TableRow>
|
</Stack>
|
||||||
<TableCell>Date</TableCell>
|
</Stack>
|
||||||
<TableCell>Customer</TableCell>
|
</Box>
|
||||||
<TableCell align="right">Amount</TableCell>
|
</Card>
|
||||||
<TableCell align="right">Total price ($)</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
</TableHead>
|
|
||||||
<TableBody>
|
|
||||||
{/* {row.history ? row.history.map((historyRow) => ( */}
|
|
||||||
<TableRow key={row.id}>
|
|
||||||
<TableCell component="th" scope="row">{row.start} - {row.end}</TableCell>
|
|
||||||
<TableCell>{row.start}</TableCell>
|
|
||||||
<TableCell align="right">{row.start}</TableCell>
|
|
||||||
<TableCell align="right">{row.start}</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
{/* ))
|
|
||||||
: (
|
|
||||||
<TableRow>
|
|
||||||
<TableCell colSpan={8}>No Data</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
)
|
|
||||||
} */}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
</Box>}
|
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
@@ -131,104 +165,230 @@ export default function PlanList() {
|
|||||||
const [dataTableData, setDataTableData] = React.useState<LaravelPaginatedData>({
|
const [dataTableData, setDataTableData] = React.useState<LaravelPaginatedData>({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
data: [],
|
data: [],
|
||||||
path: "",
|
path: '',
|
||||||
first_page_url: "",
|
first_page_url: '',
|
||||||
last_page: 1,
|
last_page: 1,
|
||||||
last_page_url: "",
|
last_page_url: '',
|
||||||
next_page_url: "",
|
next_page_url: '',
|
||||||
prev_page_url: "",
|
prev_page_url: '',
|
||||||
per_page: 10,
|
per_page: 10,
|
||||||
from: 0,
|
from: 0,
|
||||||
to: 0,
|
to: 0,
|
||||||
total: 0
|
total: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const loadDataTableData = async (appliedFilter : any | null = null) => {
|
const loadDataTableData = async (appliedFilter: any | null = null) => {
|
||||||
setDataTableLoading(true);
|
setDataTableLoading(true);
|
||||||
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
||||||
const response = await axios.get('/corporates/'+corporate_id+'/divisions', { params: filter });
|
// Get Data Hospitals
|
||||||
// console.log(response.data);
|
const response = await axios.get('/corporates/' + corporate_id + '/hospitals', {
|
||||||
|
params: filter,
|
||||||
|
});
|
||||||
setDataTableLoading(false);
|
setDataTableLoading(false);
|
||||||
|
|
||||||
setDataTableData(response.data);
|
setDataTableData(response.data);
|
||||||
}
|
|
||||||
|
|
||||||
const headStyle = {
|
|
||||||
fontWeight: 'bold',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyFilter = async (searchFilter: any) => {
|
const applyFilter = async (searchFilter: any) => {
|
||||||
await loadDataTableData({ "search" : searchFilter });
|
await loadDataTableData({ search: searchFilter });
|
||||||
setSearchParams({ "search" : searchFilter });
|
setSearchParams({ search: searchFilter });
|
||||||
}
|
};
|
||||||
|
|
||||||
const handlePageChange = (event : ChangeEvent, value: number) => {
|
const handlePageChange = (event: ChangeEvent, value: number) => {
|
||||||
const filter = Object.fromEntries([...searchParams.entries(), ["page", value]]);
|
const filter = Object.fromEntries([...searchParams.entries(), ['page', value]]);
|
||||||
loadDataTableData(filter);
|
loadDataTableData(filter);
|
||||||
setSearchParams(filter);
|
setSearchParams(filter);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
}, [])
|
}, []);
|
||||||
|
|
||||||
|
//validation dialog
|
||||||
|
const [nameField, setNameField] = useState('');
|
||||||
|
const [codeField, setCodeField] = useState('');
|
||||||
|
// ID for edit data
|
||||||
|
const [idField, setIdField] = useState('');
|
||||||
|
|
||||||
|
const handleAddData = () => {
|
||||||
|
navigate('/corporates/'+corporate_id+'/hospitals/create');
|
||||||
|
}
|
||||||
|
//Edit data
|
||||||
|
const handleEditData = (data : any) => {
|
||||||
|
navigate('/corporates/'+corporate_id+'/hospitals/edit/'+data.id+'/'+data.organization_id);
|
||||||
|
}
|
||||||
|
// End dialog for hospitals
|
||||||
|
|
||||||
|
// Dialog for update status hospitals
|
||||||
|
const [openDialogStatus, setOpenDialogStatus] = useState(false);
|
||||||
|
const [activeField, setActiveField] = useState(0);
|
||||||
|
const [reasonUpdate,setReasonUpdate] = useState('Agreement changed');
|
||||||
|
|
||||||
|
const handleCloseDialogUpdate = () => {
|
||||||
|
setOpenDialogStatus(false);
|
||||||
|
setNameField('');
|
||||||
|
setCodeField('');
|
||||||
|
setIdField('');
|
||||||
|
setActiveField(activeField);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSaveUpdateData = () => {
|
||||||
|
let activeValue = 0;
|
||||||
|
if(activeField === 1)
|
||||||
|
{
|
||||||
|
activeValue = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activeValue = 1;
|
||||||
|
}
|
||||||
|
const updateData = {
|
||||||
|
reason: reasonUpdate,
|
||||||
|
active : activeValue,
|
||||||
|
id: idField,
|
||||||
|
};
|
||||||
|
axios
|
||||||
|
.put('/hospitals/'+idField+'/activation', updateData)
|
||||||
|
.then((response) => {
|
||||||
|
enqueueSnackbar('Data updated successfully', { variant: 'success' });
|
||||||
|
loadDataTableData();
|
||||||
|
handleCloseDialogUpdate();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
enqueueSnackbar('Failed to add data', { variant: 'error' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleEditDataStatus = (data: any) => {
|
||||||
|
setIdField(data.id);
|
||||||
|
setNameField(data.name);
|
||||||
|
setCodeField(data.code);
|
||||||
|
setActiveField(data.active);
|
||||||
|
setOpenDialogStatus(true);
|
||||||
|
}
|
||||||
|
// End dialog for update status devisions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
<SearchInput onSearch={applyFilter}/>
|
<SearchInput onSearch={applyFilter} />
|
||||||
<Link to={`/corporates/${corporate_id}/divisions/create`}>
|
<Button
|
||||||
<Button
|
component="button"
|
||||||
component="button"
|
id="upload-button"
|
||||||
id="upload-button"
|
startIcon={<AddIcon />}
|
||||||
variant='outlined'
|
sx={{ p: 1.8, color: '#FFFFFF', backgroundColor: '#19BBBB', width: '125px', height: '48px' }}
|
||||||
startIcon={<AddIcon />} sx={{ p: 1.8 }}
|
onClick={handleAddData}
|
||||||
>
|
>
|
||||||
Create
|
Create
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Stack>
|
||||||
</Stack>
|
<Card>
|
||||||
|
|
||||||
<Card>
|
|
||||||
{/* The Main Table */}
|
{/* The Main Table */}
|
||||||
<TableContainer component={Paper}>
|
<TableContainer component={Paper}>
|
||||||
<Table aria-label="collapsible table">
|
<Table aria-label="collapsible table">
|
||||||
<TableBody>
|
{/* Table Head */}
|
||||||
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell style={headStyle} align="left" />
|
<TableCell sx={{width: '20%'}} align="left">
|
||||||
<TableCell style={headStyle} align="left">ID</TableCell>
|
<Typography variant='subtitle2'>Code</Typography>
|
||||||
<TableCell style={headStyle} align="left">Code</TableCell>
|
</TableCell>
|
||||||
<TableCell style={headStyle} align="left">Name</TableCell>
|
<TableCell sx={{width: '50%'}} align="left">
|
||||||
<TableCell style={headStyle} align="left">Description</TableCell>
|
<Typography variant='subtitle2'>Hospital</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell sx={{width: '20%'}} align="left">
|
||||||
|
<Typography variant='subtitle2'>Status</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell sx={{width: '10%'}} align="left">
|
||||||
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableBody>
|
</TableHead>
|
||||||
{dataTableIsLoading ?
|
{/* Condition Table Body */}
|
||||||
(
|
{dataTableIsLoading ? (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={8} align="center">Loading</TableCell>
|
<TableCell colSpan={4} align="center">
|
||||||
</TableRow>
|
Loading
|
||||||
</TableBody>
|
</TableCell>
|
||||||
) : (
|
</TableRow>
|
||||||
dataTableData.data.length == 0 ?
|
</TableBody>
|
||||||
(
|
) : dataTableData.data.length == 0 ? (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={8} align="center">No Data</TableCell>
|
<TableCell colSpan={4} align="center">
|
||||||
</TableRow>
|
No Data
|
||||||
</TableBody>
|
</TableCell>
|
||||||
) : (
|
</TableRow>
|
||||||
<TableBody>
|
</TableBody>
|
||||||
{dataTableData.data.map(row => (
|
) : (
|
||||||
<Row key={row.code} row={row} />
|
<TableBody>
|
||||||
))}
|
{dataTableData.data.map((row) => (
|
||||||
</TableBody>
|
<Row key={row.id} row={row} />
|
||||||
)
|
))}
|
||||||
|
</TableBody>
|
||||||
)}
|
)}
|
||||||
</Table>
|
</Table>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange}/>
|
{/* Paginations */}
|
||||||
</Card>
|
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
|
||||||
|
</Card>
|
||||||
|
{/* Dialog Update Status */}
|
||||||
|
<Dialog open={openDialogStatus} onClose={handleCloseDialogUpdate} fullWidth={true}>
|
||||||
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
|
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||||
|
<Stack direction="row" alignItems='center' spacing={1}>
|
||||||
|
<Typography variant="h6">Update Status</Typography>
|
||||||
|
</Stack>
|
||||||
|
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogUpdate}>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Stack>
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<Stack spacing={2} padding={2}>
|
||||||
|
<Typography variant='body1'>Are you sure to {activeField == 1 ? 'Inactive' : 'Active'} this hospital ?</Typography>
|
||||||
|
<Card sx={{padding:2}} >
|
||||||
|
<Stack direction='row' spacing={2}>
|
||||||
|
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Code</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={{width: '70%'}}>{nameField}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2}>
|
||||||
|
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Hospital Name</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={{width: '70%'}}>{codeField}</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
<Stack spacing={2} padding={2}>
|
||||||
|
<Typography variant='subtitle1'>Reason for update*</Typography>
|
||||||
|
<FormControl>
|
||||||
|
<InputLabel htmlFor="reason" required>
|
||||||
|
Reason for update
|
||||||
|
</InputLabel>
|
||||||
|
<Select
|
||||||
|
id="reason"
|
||||||
|
value={reasonUpdate}
|
||||||
|
fullWidth
|
||||||
|
label="Reason for update"
|
||||||
|
onChange={(e) => {
|
||||||
|
setReasonUpdate(e.target.value);
|
||||||
|
}}
|
||||||
|
|
||||||
|
>
|
||||||
|
<MenuItem value="Agreement changed">Agreement changed</MenuItem>
|
||||||
|
<MenuItem value="Endorsement">Endorsement</MenuItem>
|
||||||
|
<MenuItem value="Renewal">Renewal</MenuItem>
|
||||||
|
<MenuItem value="Worng Setting">Worng Setting</MenuItem>
|
||||||
|
</Select>
|
||||||
|
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button variant="outlined" sx={{color: '#212B36'}} onClick={handleCloseDialogUpdate}>Cancel</Button>
|
||||||
|
<Button sx={{backgroundColor: activeField == 0 ? '#19BBBB' : '#FF4842'}} onClick={handleSaveUpdateData} variant="contained">{activeField == 1 ? 'Inactive' : 'Active'}</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ export default function Corporates() {
|
|||||||
Import
|
Import
|
||||||
</Button> */}
|
</Button> */}
|
||||||
<Link to={'/corporates/create'}>
|
<Link to={'/corporates/create'}>
|
||||||
<Button variant="contained" startIcon={<AddIcon sx={{}} />} sx={{ p: 1.8, typography: 'subtitle2', backgroundColor: '#19BBBB' }}>
|
<Button variant="contained" startIcon={<AddIcon sx={{}} />} sx={{ p: 1.8, typography: 'subtitle2' }}>
|
||||||
New Corporate
|
New Corporate
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
166
frontend/dashboard/src/pages/Corporates/Member/History.tsx
Normal file
166
frontend/dashboard/src/pages/Corporates/Member/History.tsx
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import HeaderBreadcrumbs from "../../../components/HeaderBreadcrumbs";
|
||||||
|
import Page from "../../../components/Page";
|
||||||
|
import { useContext, useEffect, useState } from 'react';
|
||||||
|
import { Member } from '../../../@types/corporates';
|
||||||
|
import { Corporate } from "@/@types/corporates";
|
||||||
|
import { ConfiguredCorporateContext } from "@/contexts/ConfiguredCorporateContext";
|
||||||
|
import {
|
||||||
|
Stack,
|
||||||
|
Typography,
|
||||||
|
Card,
|
||||||
|
Paper,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableContainer,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
Collapse,
|
||||||
|
Box,
|
||||||
|
Tab,
|
||||||
|
} from '@mui/material';
|
||||||
|
import axios from '@/utils/axios';
|
||||||
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||||
|
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
||||||
|
import { fDate, fDateTime } from '@/utils/formatTime';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default function MemberHistory() {
|
||||||
|
const { corporate_id, member_id } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const [corporate, setCorporate] = useState<Corporate|null>();
|
||||||
|
|
||||||
|
const [ currentMember, setCurrentMember ] = useState<Member>();
|
||||||
|
|
||||||
|
const configuredCorporateContext = useContext(ConfiguredCorporateContext);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
|
const model = 'App\\Models\\Member';
|
||||||
|
const url = `/audittrail/${member_id}?model=${model}`;
|
||||||
|
axios.get(url)
|
||||||
|
.then((res) => {
|
||||||
|
setCurrentMember(res.data);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Terjadi kesalahan:', error);
|
||||||
|
});
|
||||||
|
}, [corporate_id, member_id, configuredCorporateContext]);
|
||||||
|
|
||||||
|
const [openRows, setOpenRows] = useState({});
|
||||||
|
|
||||||
|
const handleRowToggle = (index) => {
|
||||||
|
setOpenRows((prevOpenRows) => ({
|
||||||
|
...prevOpenRows,
|
||||||
|
[index]: !prevOpenRows[index],
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page title="History Member">
|
||||||
|
<HeaderBreadcrumbs
|
||||||
|
heading={'History Member'}
|
||||||
|
links={[
|
||||||
|
{
|
||||||
|
name: 'Corporates',
|
||||||
|
href: '/corporates',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: corporate?.name ?? '-',
|
||||||
|
href: '/corporates/'+corporate_id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Member',
|
||||||
|
href: '/corporates/'+corporate_id+'/members',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'History',
|
||||||
|
href: '/corporates/'+corporate_id+'/members/history',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<Card>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label="collapsible table">
|
||||||
|
{/* Condition Table Body */}
|
||||||
|
{currentMember?.data.map((item, index) => (
|
||||||
|
<TableBody key={index}>
|
||||||
|
<TableRow sx={{backgroundColor: '#919EAB29'}}>
|
||||||
|
<TableCell align="left" sx={{fontWeight: 'bold', width: '95%'}}><Typography variant="subtitle1">Data has {item.action} by {item.user_id} on {fDateTime(item.updated_at)}</Typography></TableCell>
|
||||||
|
<TableCell align="left" sx={{width: '5%'}}>
|
||||||
|
{openRows[index] ? (
|
||||||
|
<KeyboardArrowDownIcon sx={{ cursor: 'pointer' }} onClick={() => handleRowToggle(index)} />
|
||||||
|
) : (
|
||||||
|
<KeyboardArrowRightIcon sx={{ cursor: 'pointer' }} onClick={() => handleRowToggle(index)} />
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
<TableRow sx={{display: openRows[index] ? '' : 'none',}}>
|
||||||
|
<TableCell colSpan={2}>
|
||||||
|
{/* COLLAPSIBLE ROW */}
|
||||||
|
<Collapse in={openRows[index]} timeout="auto" unmountOnExit>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label="collapsible table">
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography sx={{width: '25%'}} variant="subtitle2">Field</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography sx={{width: '25%'}} variant="subtitle2">Old Value</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography sx={{width: '50%'}} variant="subtitle2">New Value</Typography>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{Object.entries(item.old_values).map(([key, value]) => {
|
||||||
|
let renderedValue;
|
||||||
|
if (key === 'reason' || key === 'updated_at') {
|
||||||
|
switch (key) {
|
||||||
|
case 'updated_at':
|
||||||
|
renderedValue = fDateTime(item.new_values[key]);
|
||||||
|
value = fDateTime(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
renderedValue = item.new_values[key];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const field = key.charAt(0).toUpperCase() + key.slice(1);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow key={key}>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant="body2">{field ? field : '-'}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant="body2">{value ? value : '-'}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant="body2">{renderedValue ? renderedValue : ''}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</Collapse>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableBody>
|
||||||
|
))}
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</Card>
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -29,6 +29,9 @@ import {
|
|||||||
Grid,
|
Grid,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Divider,
|
Divider,
|
||||||
|
ButtonBase,
|
||||||
|
FormControl,
|
||||||
|
FormHelperText,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import Iconify from '@/components/Iconify';
|
import Iconify from '@/components/Iconify';
|
||||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||||
@@ -40,7 +43,7 @@ import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
|||||||
// hooks
|
// hooks
|
||||||
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
||||||
import useSettings from '../../../hooks/useSettings';
|
import useSettings from '../../../hooks/useSettings';
|
||||||
import {Link, useParams, useSearchParams } from 'react-router-dom';
|
import {Link, useParams, useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
// components
|
// components
|
||||||
import axios from '../../../utils/axios';
|
import axios from '../../../utils/axios';
|
||||||
import { Plan } from '../../../@types/corporates';
|
import { Plan } from '../../../@types/corporates';
|
||||||
@@ -52,8 +55,15 @@ import { LoadingButton } from '@mui/lab';
|
|||||||
import DialogLog from './sections/DialogLog';
|
import DialogLog from './sections/DialogLog';
|
||||||
import HistoryIcon from '@mui/icons-material/History';
|
import HistoryIcon from '@mui/icons-material/History';
|
||||||
import { makeFormData } from '@/utils/jsonToFormData';
|
import { makeFormData } from '@/utils/jsonToFormData';
|
||||||
|
import DownloadIcon from '@mui/icons-material/Download';
|
||||||
|
import TableMoreMenu from '@/components/table/TableMoreMenu';
|
||||||
|
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
|
||||||
|
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
|
||||||
|
import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
|
||||||
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
|
|
||||||
export default function CorporatePlanList({handleSubmitSuccess}) {
|
export default function CorporatePlanList({handleSubmitSuccess}) {
|
||||||
|
const navigate = useNavigate();
|
||||||
// Files MCU
|
// Files MCU
|
||||||
const fileMcuInput = useRef<HTMLInputElement>(null);
|
const fileMcuInput = useRef<HTMLInputElement>(null);
|
||||||
const [fileMcus, setFileMcus] = useState([]);
|
const [fileMcus, setFileMcus] = useState([]);
|
||||||
@@ -196,17 +206,17 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
enqueueSnackbar(responseData.message ?? 'Berhasil tambah file MemberID '+member_id+', silahkan lihat dilaporan', { variant: 'success' });
|
enqueueSnackbar(responseData.message ?? 'Berhasil tambah file Member ID '+member_id+', silahkan lihat dilaporan', { variant: 'success' });
|
||||||
handleSubmitSuccess();
|
handleSubmitSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(({ response }) => {
|
.catch(({ response }) => {
|
||||||
const responseData = response?.data;
|
const responseData = response?.data;
|
||||||
if(responseData)
|
if(responseData)
|
||||||
{
|
{
|
||||||
enqueueSnackbar(responseData.message ?? 'Something Went Wrong', { variant: 'error' });
|
enqueueSnackbar(responseData.message ?? 'Something Went Wrong', { variant: 'error' });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setSubmitLoading(false);
|
setSubmitLoading(false);
|
||||||
@@ -319,12 +329,10 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
{!currentImportFileName && (
|
{!currentImportFileName && (
|
||||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
<SearchInput onSearch={applyFilter} />
|
<SearchInput onSearch={applyFilter} />
|
||||||
{/* <h1>kjasndkjandskjasndkjansdkjansd</h1> */}
|
|
||||||
<Button
|
<Button
|
||||||
id="import-button"
|
id="import-button"
|
||||||
variant="outlined"
|
startIcon={<DownloadIcon />}
|
||||||
startIcon={<AddIcon />}
|
sx={{ p: 1.8, color: '#FFFFFF', backgroundColor: '#19BBBB', width: '125px', height: '48px' }}
|
||||||
sx={{ p: 1.8 }}
|
|
||||||
aria-controls={createMenu ? 'basic-menu' : undefined}
|
aria-controls={createMenu ? 'basic-menu' : undefined}
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded={createMenu ? 'true' : undefined}
|
aria-expanded={createMenu ? 'true' : undefined}
|
||||||
@@ -341,15 +349,19 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
'aria-labelledby': 'basic-button',
|
'aria-labelledby': 'basic-button',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={handleImportButton}>Import</MenuItem>
|
<MenuItem onClick={handleImportButton}>
|
||||||
|
<Typography variant='body2'>Import</Typography>
|
||||||
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleGetTemplate('member');
|
handleGetTemplate('member');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Download Template
|
<Typography variant='body2'> Download Template</Typography>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={handleMemberList}>
|
||||||
|
<Typography variant='body2'>Download Member</Typography>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={handleMemberList}>Download Member</MenuItem>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
@@ -412,17 +424,12 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [columns, setColumns] = React.useState([
|
const [columns, setColumns] = React.useState([
|
||||||
{ id: 'member_id', label: 'MemberID', minWidth: 100, align: 'left' },
|
{ id: 'member_id', label: 'Member ID', minWidth: 100, align: 'left', width: '10%' },
|
||||||
// { id: 'principal_id', label: 'Mapping ID', minWidth: 100, align: 'left' },
|
{ id: 'effective_date', label: 'Effective Date', minWidth: 100, align: 'left', width: '20%' },
|
||||||
// { id: 'nik', label: 'NIK', minWidth: 100, align: 'left' },
|
{ id: 'name', label: 'Name', minWidth: 100, align: 'left', width: '20%' },
|
||||||
// { id: 'current_policy.policy_number', label: 'Policy Number', minWidth: 100, align: 'left' },
|
{ id: 'plan_id', label: 'Plan ID', minWidth: 100, align: 'left', width: '10%' },
|
||||||
{ id: 'effective_date', label: 'Effective Date', minWidth: 100, align: 'left' },
|
{ id: 'activation_date', label: 'Activation Date', minWidth: 100, align: 'left', width: '20%' },
|
||||||
{ id: 'name', label: 'Name', minWidth: 100, align: 'left' },
|
{ id: 'termination_date', label: 'Termination Date', minWidth: 100, align: 'left', width: '20%' },
|
||||||
// { id: 'nric', label: 'NRIC', minWidth: 100, align: 'left' },
|
|
||||||
// { id: 'email', label: 'E-mail', minWidth: 100, align: 'left' },
|
|
||||||
{ id: 'plan_id', label: 'PlanID', minWidth: 100, align: 'left' },
|
|
||||||
{ id: 'activation_date', label: 'Activation Date', minWidth: 100, align: 'left' },
|
|
||||||
{ id: 'termination_date', label: 'Termination Date', minWidth: 100, align: 'left' },
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Generate the every row of the table
|
// Generate the every row of the table
|
||||||
@@ -432,17 +439,9 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
const [loadingLog, setLoadingLog] = React.useState(false);
|
const [loadingLog, setLoadingLog] = React.useState(false);
|
||||||
const [dialogLogOpen, setDialogLogOpen] = React.useState(false);
|
const [dialogLogOpen, setDialogLogOpen] = React.useState(false);
|
||||||
|
|
||||||
// useEffect(function () {
|
|
||||||
// if (row.full_name == 'Pajri') {
|
|
||||||
// setDialogLogOpen(true);
|
|
||||||
// console.log('fuck');
|
|
||||||
// }
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
const handleActivate = (model: any, status: string) => {
|
const handleActivate = (model: any, status: string) => {
|
||||||
axios
|
axios
|
||||||
.put(`/members/${row.id}/activation`, {
|
.put(`/members/${row.id}/activation`, {
|
||||||
// service_code: service.service_code,
|
|
||||||
active: status == 'active',
|
active: status == 'active',
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -458,284 +457,203 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// console.log('asdasd', error.response.data.message)
|
|
||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
error.response.data.message ?? error.message ?? 'Failed Processing Request',
|
error.response.data.message ?? error.message ?? 'Failed Processing Request',
|
||||||
{ variant: 'error' }
|
{ variant: 'error' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const style1 = {
|
||||||
|
color: '#637381'
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
|
<TableRow key={row.id || index} sx={{ '& > *': open ? {borderBottom: 'unset'} : {}, cursor: open ? 'pointer' : '' }} onClick={() => {if(open==true) setOpen(!open)}}>
|
||||||
<TableCell>
|
<TableCell align="left">
|
||||||
<IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)}>
|
<Typography variant='body2'>{row.member_id ? row.member_id : '-'}</Typography>
|
||||||
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
|
|
||||||
</IconButton>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
<TableCell align="left">{row.member_id}</TableCell>
|
<Typography variant='body2'>{row.members_effective_date ? row.members_effective_date : '-'}</Typography>
|
||||||
<TableCell align="left">{row.members_effective_date}</TableCell>
|
|
||||||
<TableCell align="left">{row.name}</TableCell>
|
|
||||||
<TableCell align="left">{row.current_plan?.code}</TableCell>
|
|
||||||
<TableCell align="left">{row.activation_date}</TableCell>
|
|
||||||
<TableCell align="left">{row.terminated_date}</TableCell>
|
|
||||||
<TableCell align="center">
|
|
||||||
{row.active == 1 && (
|
|
||||||
<Button
|
|
||||||
variant="outlined"
|
|
||||||
color="success"
|
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
// handleActivate(row, 'inactive');
|
|
||||||
clickHandler('edit');
|
|
||||||
setEdit({id: row.id, service_code: row.service_code, status: 'inactive'});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Active
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
{row.active != 1 && (
|
|
||||||
<Button
|
|
||||||
variant="outlined"
|
|
||||||
color="error"
|
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
// handleActivate(row, 'active');
|
|
||||||
clickHandler('edit');
|
|
||||||
setEdit({id: row.id, service_code: row.service_code, status: 'active'});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Inactive
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="right">
|
<TableCell align="left">
|
||||||
<Tooltip title="History">
|
<Typography variant='body2'>{row.name ? row.name : '-'}</Typography>
|
||||||
<Link to={`/corporate/${corporate_id}/members/${row.id}/history`}>
|
</TableCell>
|
||||||
<HistoryIcon />
|
<TableCell align="left">
|
||||||
</Link>
|
<Typography variant='body2'>{row.current_plan?.code}</Typography>
|
||||||
</Tooltip>
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant='body2'>{row.activation_date ? row.activation_date : '-'}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Typography variant='body2'>{row.terminated_date ? row.terminated_date : '-'}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align='left'>
|
||||||
|
<TableMoreMenu actions={
|
||||||
|
<>
|
||||||
|
<MenuItem onClick={() => setOpen(!open)}>
|
||||||
|
<FindInPageOutlinedIcon />
|
||||||
|
Details
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => handleEditDataStatus(row)}>
|
||||||
|
<CachedOutlinedIcon />
|
||||||
|
Update Status
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => navigate ('/corporates/'+corporate_id+'/members/'+row.id+'/history')}>
|
||||||
|
<HistoryIcon />
|
||||||
|
History
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
{/* COLLAPSIBLE ROW */}
|
{/* COLLAPSIBLE ROW */}
|
||||||
<TableRow>
|
<TableRow sx={{display: open ? '' : 'none', cursor: open ? 'pointer' : ''}} onClick={() => {if(open==true) setOpen(!open)}}>
|
||||||
<TableCell />
|
<TableCell colSpan={8}>
|
||||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={15}>
|
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
<Box sx={{ pb: 2 }}>
|
<Card sx={{padding:2}}>
|
||||||
<Typography sx={{ fontWeight: '600', mb: 1 }}>Detail</Typography>
|
<Box sx={{ pb: 2 }}>
|
||||||
<Grid container sx={{ pb: 2, mb: 2, borderBottom: 1 }}>
|
<Typography variant='subtitle1'>Detail</Typography>
|
||||||
<Grid item xs={6}>
|
<Stack marginTop={2}>
|
||||||
<Grid container>
|
<Stack direction='row' spacing={1}>
|
||||||
<Grid item xs={6}>
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Mapping ID:</Typography>
|
||||||
Mapping ID
|
<Typography variant='body2' sx={{width: '25%'}}>{row.principal_id ? row.principal_id : '-'}</Typography>
|
||||||
</Grid>
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Birth Date:</Typography>
|
||||||
<Grid item xs={6}>
|
<Typography variant='body2' sx={{width: '25%'}}>{row.birth_date ? row.birth_date : '-'}</Typography>
|
||||||
: {row.principal_id ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Policy Number
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.current_policy?.code ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
NRIC
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.nric ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={6}>
|
|
||||||
NIK
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.employeds[0]?.nik ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Email
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.email ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Phone
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.person?.phone ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
<Grid container>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Birth Date
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.birth_date ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Gender
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.gender ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Marital Status
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.marital_status ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Language
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.language ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Race
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.race ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Relationship
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.relation_with_principal ?? '-'}
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<Typography sx={{ fontWeight: '600', mb: 1 }}>Claim History</Typography>
|
|
||||||
<Grid container sx={{ pb: 2, mb: 2, borderBottom: 1 }}>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
<Grid container>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Requested
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.total_claims?.requested}
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Pending
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.total_claims?.received}
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Approved
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.total_claims?.approved}
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Declined
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.total_claims?.declined}
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={6}>
|
|
||||||
Paid
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6}>
|
|
||||||
: {row.total_claims?.paid}
|
|
||||||
</Grid>
|
|
||||||
</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 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>
|
</Stack>
|
||||||
{/* -------------------------------Upload Dokumen MCU------------------------------- */}
|
<Stack direction='row' spacing={1}>
|
||||||
<Stack sx={{ marginTop: 1}}>
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Policy Number:</Typography>
|
||||||
{/*<Stack
|
<Typography variant='body2' sx={{width: '25%'}}>{row.current_policy?.code ? row.current_policy?.code : '-'}</Typography>
|
||||||
divider={<Divider orientation="horizontal" flexItem />}
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Gender:</Typography>
|
||||||
spacing={1}
|
<Typography variant='body2' sx={{width: '25%'}}>{row.gender ? row.gender : '-'}</Typography>
|
||||||
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>
|
</Stack>
|
||||||
</Grid>
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>NRIC:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.nric ? row.nric : '-'}</Typography>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Marital Status:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.marital_status ? row.marital_status : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>NIK:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.employeds[0]?.nik ? row.employeds[0]?.nik : '-'}</Typography>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Language:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.language ? row.language : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Email:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.email ? row.email : '-'}</Typography>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Race:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.race ? row.race : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Phone Number:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.person?.phone ? row.person?.phone : '-'}</Typography>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Relationship:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '25%'}}>{row.relation_with_principal ? row.relation_with_principal : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
<Typography variant='subtitle1' marginTop={2}>Claim History</Typography>
|
||||||
|
<Stack marginTop={2}>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Requested:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '75%'}}>{row.total_claims?.requested ? row.total_claims?.requested : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Pending:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '75%'}}>{row.total_claims?.received ? row.total_claims?.received : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Approved:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '75%'}}>{row.total_claims?.approved ? row.total_claims?.approved : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Declined:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '75%'}}>{row.total_claims?.declined ? row.total_claims?.declined : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={1}>
|
||||||
|
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Paid:</Typography>
|
||||||
|
<Typography variant='body2' sx={{width: '75%'}}>{row.total_claims?.paid ? row.total_claims?.paid : '-'}</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
<Typography variant='subtitle1' marginTop={2}>Files History</Typography>
|
||||||
|
<Stack marginTop={2}>
|
||||||
|
|
||||||
|
{row.file_mcu_names
|
||||||
|
? row.file_mcu_names.split(',').map((fileName, index) => (
|
||||||
|
<>
|
||||||
|
<Stack direction='row' spacing={1} alignItems='center'>
|
||||||
|
<InsertDriveFileIcon />
|
||||||
|
<Typography key={index} variant='body2' sx={{width: '100%'}}>{fileName}</Typography>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
))
|
||||||
|
: '-'}
|
||||||
|
</Stack>
|
||||||
|
<Stack marginTop={2}>
|
||||||
|
<Stack direction='row' spacing={1} alignItems='center'>
|
||||||
|
<ButtonBase sx={{ p: 4, border: '2px dashed #F9FAFB',
|
||||||
|
bgcolor: '#919EAB52',
|
||||||
|
borderRadius: '8px',
|
||||||
|
width: '100%', height: '60px'}} onClick={() => fileMcuInput.current?.click()}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
placeItems: 'center',
|
||||||
|
gap: 1,
|
||||||
|
placeContent: 'center',
|
||||||
|
|
||||||
|
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Iconify icon="icon-park-outline:upload-one" fontSize="3em" />
|
||||||
|
<Typography variant="body1" fontWeight="bold">
|
||||||
|
Upload Result
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
id={`file-${row.id}`}
|
||||||
|
ref={fileMcuInput}
|
||||||
|
style={{ display: 'none' }}
|
||||||
|
onChange={(event) => {
|
||||||
|
handleMcuInputChange(row.id, row.member_id)(event);
|
||||||
|
}}
|
||||||
|
accept="application/pdf"
|
||||||
|
/>
|
||||||
|
</ButtonBase>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Card>
|
||||||
|
<Stack marginTop={2}>
|
||||||
|
<Stack direction='row' alignItems='center' spacing={1} justifyContent="flex-end">
|
||||||
|
<LoadingButton
|
||||||
|
id="upload-button"
|
||||||
|
sx={{ p: 1.8, color: '#FFFFFF', backgroundColor: '#19BBBB', width: '158px', height: '48px' }}
|
||||||
|
startIcon={<DownloadIcon />}
|
||||||
|
// sx={{ p: 1.8 }}
|
||||||
|
// onClick={() => {handleDownloadLog(row)}}
|
||||||
|
onClick={() => {
|
||||||
|
setDialogLogOpen(true);
|
||||||
|
}}
|
||||||
|
loading={loadingLog}
|
||||||
|
>
|
||||||
|
Download LOG
|
||||||
|
</LoadingButton>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<DialogLog
|
||||||
|
title={{
|
||||||
|
name: `Generate LOG - ${row.full_name}`,
|
||||||
|
}}
|
||||||
|
openDialog={dialogLogOpen}
|
||||||
|
setOpenDialog={setDialogLogOpen}
|
||||||
|
data={{ member: row }}
|
||||||
|
></DialogLog>
|
||||||
|
|
||||||
<DialogLog
|
|
||||||
title={{
|
|
||||||
name: `Generate LOG - ${row.full_name}`,
|
|
||||||
}}
|
|
||||||
openDialog={dialogLogOpen}
|
|
||||||
setOpenDialog={setDialogLogOpen}
|
|
||||||
data={{ member: row }}
|
|
||||||
></DialogLog>
|
|
||||||
</Box>
|
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
@@ -746,33 +664,73 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
const headStyle = {
|
const headStyle = {
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
};
|
};
|
||||||
|
const [reasonUpdate,setReasonUpdate] = useState('Agreement changed');
|
||||||
|
const [nameUpdate, setNameUpdate] = useState('');
|
||||||
|
const [memberIdUpdate, setMemberIdUpdate] = useState('');
|
||||||
|
const [activeUpdate, setActiveUpdate] = useState(0);
|
||||||
|
const [idUpdate, setIdUpdate] = useState('');
|
||||||
|
|
||||||
|
const [openDialogStatus, setOpenDialogStatus] = useState(false);
|
||||||
|
|
||||||
|
const handleCloseDialogUpdate = () => {
|
||||||
|
setNameUpdate('');
|
||||||
|
setMemberIdUpdate('');
|
||||||
|
setActiveUpdate(activeUpdate);
|
||||||
|
setIdUpdate('');
|
||||||
|
setOpenDialogStatus(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSaveUpdateData = () => {
|
||||||
|
let activeValue = 0;
|
||||||
|
if(activeUpdate === 1)
|
||||||
|
{
|
||||||
|
activeValue = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activeValue = 1;
|
||||||
|
}
|
||||||
|
const updateData = {
|
||||||
|
reason: reasonUpdate,
|
||||||
|
active : activeValue,
|
||||||
|
id: idUpdate,
|
||||||
|
};
|
||||||
|
axios
|
||||||
|
.put('/members/'+idUpdate+'/activation', updateData)
|
||||||
|
.then((response) => {
|
||||||
|
enqueueSnackbar('Data updated successfully', { variant: 'success' });
|
||||||
|
loadDataTableData();
|
||||||
|
handleCloseDialogUpdate();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
enqueueSnackbar('Failed to add data', { variant: 'error' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleEditDataStatus = (data:any) => {
|
||||||
|
setNameUpdate(data.name);
|
||||||
|
setMemberIdUpdate(data.member_id);
|
||||||
|
setActiveUpdate(data.active);
|
||||||
|
setIdUpdate(data.id);
|
||||||
|
setOpenDialogStatus(true);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<ImportForm />
|
<ImportForm />
|
||||||
|
|
||||||
<Card>
|
<Card>
|
||||||
{/* The Main Table */}
|
{/* The Main Table */}
|
||||||
<TableContainer component={Paper}>
|
<TableContainer component={Paper}>
|
||||||
<Table aria-label="collapsible table">
|
<Table aria-label="collapsible table">
|
||||||
<TableBody>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell style={headStyle} align="left" />
|
|
||||||
{columns.map((column, index) => (
|
{columns.map((column, index) => (
|
||||||
<TableCell style={headStyle} key={index} align={column.align}>
|
<TableCell style={{ minWidth: column.minWidth, width: column.width }} key={index} align={column.align}>
|
||||||
{column.label}
|
<Typography variant='subtitle2'>{column.label}</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
))}
|
))}
|
||||||
<TableCell style={headStyle} align="center">
|
<TableCell align="center"></TableCell>
|
||||||
Status
|
|
||||||
</TableCell>
|
|
||||||
<TableCell style={headStyle} align="center">
|
|
||||||
Action
|
|
||||||
</TableCell>
|
|
||||||
{/* <TableCell style={headStyle} align="center">
|
|
||||||
Action
|
|
||||||
</TableCell> */}
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableBody>
|
</TableHead>
|
||||||
{dataTableIsLoading ? (
|
{dataTableIsLoading ? (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
@@ -801,6 +759,62 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
|
|
||||||
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
|
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
|
||||||
</Card>
|
</Card>
|
||||||
|
{/* Dialog Update Status */}
|
||||||
|
<Dialog open={openDialogStatus} onClose={handleCloseDialogUpdate} fullWidth={true}>
|
||||||
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
|
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||||
|
<Stack direction="row" alignItems='center' spacing={1}>
|
||||||
|
<Typography variant="h6">Update Status</Typography>
|
||||||
|
</Stack>
|
||||||
|
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogUpdate}>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Stack>
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<Stack spacing={2} padding={2}>
|
||||||
|
<Typography variant='body1'>Are you sure to {activeUpdate == 1 ? 'Inactive' : 'Active'} this member ?</Typography>
|
||||||
|
<Card sx={{padding:2}} >
|
||||||
|
<Stack direction='row' spacing={2}>
|
||||||
|
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Member ID</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={{width: '70%'}}>{memberIdUpdate}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2}>
|
||||||
|
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Name</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={{width: '70%'}}>{nameUpdate}</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
<Stack spacing={2} padding={2}>
|
||||||
|
<Typography variant='subtitle1'>Reason for update*</Typography>
|
||||||
|
<FormControl>
|
||||||
|
<InputLabel htmlFor="reason" required>
|
||||||
|
Reason for update
|
||||||
|
</InputLabel>
|
||||||
|
<Select
|
||||||
|
id="reason"
|
||||||
|
value={reasonUpdate}
|
||||||
|
fullWidth
|
||||||
|
label="Reason for update"
|
||||||
|
onChange={(e) => {
|
||||||
|
setReasonUpdate(e.target.value);
|
||||||
|
}}
|
||||||
|
|
||||||
|
>
|
||||||
|
<MenuItem value="Agreement changed">Agreement changed</MenuItem>
|
||||||
|
<MenuItem value="Endorsement">Endorsement</MenuItem>
|
||||||
|
<MenuItem value="Renewal">Renewal</MenuItem>
|
||||||
|
<MenuItem value="Worng Setting">Worng Setting</MenuItem>
|
||||||
|
</Select>
|
||||||
|
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button variant="outlined" sx={{color: '#212B36'}} onClick={handleCloseDialogUpdate}>Cancel</Button>
|
||||||
|
<Button sx={{backgroundColor: activeUpdate == 0 ? '#19BBBB' : '#FF4842'}} onClick={handleSaveUpdateData} variant="contained">{activeUpdate == 1 ? 'Inactive' : 'Active'}</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
{isDialog === 'edit' && (
|
{isDialog === 'edit' && (
|
||||||
<DialogLog
|
<DialogLog
|
||||||
data={edit}
|
data={edit}
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ const DialogTopUpLimit = ({ title, openDialog, setOpenDialog, data }: MuiDialogP
|
|||||||
|
|
||||||
const { id, service_code, status } = data;
|
const { id, service_code, status } = data;
|
||||||
|
|
||||||
|
const [memberId, setMemberId] = useState(data.member.id);
|
||||||
|
|
||||||
const isEdit = id ? true : false;
|
const isEdit = id ? true : false;
|
||||||
|
|
||||||
const NewCorporateSchema = Yup.object().shape({
|
const NewCorporateSchema = Yup.object().shape({
|
||||||
@@ -103,10 +105,11 @@ const DialogTopUpLimit = ({ title, openDialog, setOpenDialog, data }: MuiDialogP
|
|||||||
// const { plan_id } = useParams();
|
// const { plan_id } = useParams();
|
||||||
const handleActivate = (model: any, status: string) => {
|
const handleActivate = (model: any, status: string) => {
|
||||||
axios
|
axios
|
||||||
.put(`/members/${id}/activation`, {
|
.put(`/members/${memberId}/activation`, {
|
||||||
// service_code: service.service_code,
|
// service_code: service.service_code,
|
||||||
active: status == 'active',
|
active: status == 'active',
|
||||||
reason: model.reason
|
reason: model.reason,
|
||||||
|
id: memberId,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// Memuat ulang halaman saat ini
|
// Memuat ulang halaman saat ini
|
||||||
@@ -133,7 +136,7 @@ const DialogTopUpLimit = ({ title, openDialog, setOpenDialog, data }: MuiDialogP
|
|||||||
const data = {
|
const data = {
|
||||||
service_code : service_code,
|
service_code : service_code,
|
||||||
reason : row.reason,
|
reason : row.reason,
|
||||||
id : id,
|
id : memberId,
|
||||||
}
|
}
|
||||||
handleActivate(data, status)
|
handleActivate(data, status)
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -157,18 +160,18 @@ const DialogTopUpLimit = ({ title, openDialog, setOpenDialog, data }: MuiDialogP
|
|||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Box sx={{ width: '100%', typography: 'body1', p: 2, mt: 1 }}>
|
<Box sx={{ width: '100%', typography: 'body1', p: 2, mt: 1 }}>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
|
<Typography variant='subtitle1' sx={{marginBottom: 2}}>Reason for update*</Typography>
|
||||||
<RHFSelect
|
<RHFSelect
|
||||||
name="reason"
|
name="reason"
|
||||||
label="Reason for update"
|
label="Reason for update"
|
||||||
>
|
>
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option value="Agreement changed">Agreement changed</option>
|
<option value="Agreement changed">Agreement changed</option>
|
||||||
<option value="Endorsement">Endorsement</option>
|
<option value="Endorsement">Endorsement</option>
|
||||||
<option value="Renewal">Renewal</option>
|
<option value="Renewal">Renewal</option>
|
||||||
<option value="Worng Setting">Worng Setting</option>
|
<option value="Worng Setting">Worng Setting</option>
|
||||||
</RHFSelect>
|
</RHFSelect>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Box sx={{ pt: 5 }}>
|
<Box sx={{ pt: 5 }}>
|
||||||
<Stack
|
<Stack
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
@@ -181,6 +184,7 @@ const DialogTopUpLimit = ({ title, openDialog, setOpenDialog, data }: MuiDialogP
|
|||||||
<Button
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
boxShadow: 'none',
|
boxShadow: 'none',
|
||||||
|
color: '#212B36'
|
||||||
}}
|
}}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
size="medium"
|
size="medium"
|
||||||
@@ -190,7 +194,7 @@ const DialogTopUpLimit = ({ title, openDialog, setOpenDialog, data }: MuiDialogP
|
|||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)' }}
|
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)', backgroundColor: '#19BBBB' }}
|
||||||
type="submit"
|
type="submit"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
|||||||
@@ -81,6 +81,19 @@ export default function CorporatePlanList() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// filter
|
||||||
|
const defaultValue = [
|
||||||
|
{
|
||||||
|
value: '-',
|
||||||
|
label: '-'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const [serviceCode, setServiceCode] = useState(defaultValue);
|
||||||
|
const [type, setType] = useState(defaultValue);
|
||||||
|
const [code, setCode] = useState(defaultValue);
|
||||||
|
const [codePlan, setCodePlan] = useState(defaultValue);
|
||||||
|
|
||||||
function SearchInput(props: any) {
|
function SearchInput(props: any) {
|
||||||
// SEARCH
|
// SEARCH
|
||||||
const searchInput = useRef<HTMLInputElement>(null);
|
const searchInput = useRef<HTMLInputElement>(null);
|
||||||
@@ -227,16 +240,7 @@ export default function CorporatePlanList() {
|
|||||||
<Grid item xs={2}>
|
<Grid item xs={2}>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
id="combo-box-demo"
|
id="combo-box-demo"
|
||||||
options={[
|
options={serviceCode}
|
||||||
{
|
|
||||||
value: 'IP',
|
|
||||||
label: 'Inpatient'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'OP',
|
|
||||||
label: 'Outpatient'
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
multiple
|
multiple
|
||||||
limitTags={1}
|
limitTags={1}
|
||||||
fullWidth
|
fullWidth
|
||||||
@@ -252,16 +256,7 @@ export default function CorporatePlanList() {
|
|||||||
<Grid item xs={1.5}>
|
<Grid item xs={1.5}>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
id="combo-box-demo"
|
id="combo-box-demo"
|
||||||
options={[
|
options={codePlan}
|
||||||
{
|
|
||||||
value: 'IP',
|
|
||||||
label: 'IP-001'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'OP',
|
|
||||||
label: 'OP-001'
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
multiple
|
multiple
|
||||||
limitTags={1}
|
limitTags={1}
|
||||||
fullWidth
|
fullWidth
|
||||||
@@ -277,16 +272,7 @@ export default function CorporatePlanList() {
|
|||||||
<Grid item xs={1.5}>
|
<Grid item xs={1.5}>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
id="combo-box-demo"
|
id="combo-box-demo"
|
||||||
options={[
|
options={code}
|
||||||
{
|
|
||||||
value: 'IP',
|
|
||||||
label: 'IP-001'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'OP',
|
|
||||||
label: 'OP-001'
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
multiple
|
multiple
|
||||||
limitTags={1}
|
limitTags={1}
|
||||||
fullWidth
|
fullWidth
|
||||||
@@ -302,16 +288,7 @@ export default function CorporatePlanList() {
|
|||||||
<Grid item xs={1.5}>
|
<Grid item xs={1.5}>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
id="combo-box-demo"
|
id="combo-box-demo"
|
||||||
options={[
|
options={type}
|
||||||
{
|
|
||||||
value: 'IP',
|
|
||||||
label: 'IP-001'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'OP',
|
|
||||||
label: 'OP-001'
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
multiple
|
multiple
|
||||||
limitTags={1}
|
limitTags={1}
|
||||||
fullWidth
|
fullWidth
|
||||||
@@ -790,10 +767,68 @@ export default function CorporatePlanList() {
|
|||||||
setDataTableLoading(true);
|
setDataTableLoading(true);
|
||||||
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
||||||
const response = await axios.get('/corporates/' + corporate_id + '/plans', { params: filter });
|
const response = await axios.get('/corporates/' + corporate_id + '/plans', { params: filter });
|
||||||
// console.log(response.data);
|
|
||||||
setDataTableLoading(false);
|
setDataTableLoading(false);
|
||||||
|
|
||||||
setDataTableData(response.data);
|
setDataTableData(response.data);
|
||||||
|
|
||||||
|
const data = response.data.data;
|
||||||
|
const serviceCodeArray :string[] = [];
|
||||||
|
const codeArray :string[] = [];
|
||||||
|
const typeArray :string[] = [];
|
||||||
|
const planArray :string[] = [];
|
||||||
|
|
||||||
|
data.forEach((row: any) => {
|
||||||
|
if (!serviceCodeArray.includes(row.service_code)) {
|
||||||
|
serviceCodeArray.push(row.service_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!codeArray.includes(row.code)) {
|
||||||
|
codeArray.push(row.code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!typeArray.includes(row.type)) {
|
||||||
|
typeArray.push(row.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!planArray.includes(row.corporate_plan_id)) {
|
||||||
|
planArray.push(row.corporate_plan_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
const optionServiceCode = serviceCodeArray.map((value) => {
|
||||||
|
return {
|
||||||
|
value: value,
|
||||||
|
label: value
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const optionCode = codeArray.map((value) => {
|
||||||
|
return {
|
||||||
|
value: value,
|
||||||
|
label: value
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const optionType = typeArray.map((value) => {
|
||||||
|
return {
|
||||||
|
value: value,
|
||||||
|
label: value
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const optionPlan = planArray.map((value) => {
|
||||||
|
return {
|
||||||
|
value: value,
|
||||||
|
label: value
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
console.log(optionCode)
|
||||||
|
setServiceCode(optionServiceCode)
|
||||||
|
setType(optionType)
|
||||||
|
setCode(optionCode)
|
||||||
|
setCodePlan(optionPlan)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const headStyle = {
|
const headStyle = {
|
||||||
@@ -854,7 +889,7 @@ export default function CorporatePlanList() {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const getContent = () => (
|
const getContent = () => (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -177,6 +177,10 @@ export default function Router() {
|
|||||||
path: ':corporate_id/diagnosis-exclusions',
|
path: ':corporate_id/diagnosis-exclusions',
|
||||||
element: <DiagnosisExclusions />,
|
element: <DiagnosisExclusions />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: ':corporate_id/diagnosis-exclusions/:exclusion_id/edit',
|
||||||
|
element: <EditDiagnosisExclusions />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: ':corporate_id/diagnosis-exclusions/history',
|
path: ':corporate_id/diagnosis-exclusions/history',
|
||||||
element: <DiagnosisExclusionsHistory />,
|
element: <DiagnosisExclusionsHistory />,
|
||||||
@@ -186,7 +190,18 @@ export default function Router() {
|
|||||||
path: ':corporate_id/hospitals',
|
path: ':corporate_id/hospitals',
|
||||||
element: <CorporateHospitals />,
|
element: <CorporateHospitals />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: ':corporate_id/hospitals/create',
|
||||||
|
element: <HospitalCreateUpdate />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':corporate_id/hospitals/edit/:id/:organization_id',
|
||||||
|
element: <HospitalCreateUpdate />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':corporate_id/hospitals/:id/history',
|
||||||
|
element: <HospitalHistory />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: ':corporate_id/claim-history',
|
path: ':corporate_id/claim-history',
|
||||||
element: <CorporateClaimHistories />,
|
element: <CorporateClaimHistories />,
|
||||||
@@ -438,7 +453,7 @@ const CorporateDivisionsCreate = Loadable(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const CorporateMembers = Loadable(lazy(() => import('../pages/Corporates/Member/Index')));
|
const CorporateMembers = Loadable(lazy(() => import('../pages/Corporates/Member/Index')));
|
||||||
const CorporateHistoryMembers = Loadable(lazy(() => import('../pages/Corporates/Member/sections/History')));
|
const CorporateHistoryMembers = Loadable(lazy(() => import('../pages/Corporates/Member/History')));
|
||||||
|
|
||||||
const BenefitCreate = Loadable(lazy(() => import('../pages/Corporates/Benefit/Create')));
|
const BenefitCreate = Loadable(lazy(() => import('../pages/Corporates/Benefit/Create')));
|
||||||
const Benefits = Loadable(lazy(() => import('../pages/Corporates/Benefit/Index')));
|
const Benefits = Loadable(lazy(() => import('../pages/Corporates/Benefit/Index')));
|
||||||
@@ -468,6 +483,9 @@ const CorporatePlansHistory = Loadable(lazy(() => import('../pages/Corporates/Pl
|
|||||||
const DiagnosisExclusions = Loadable(
|
const DiagnosisExclusions = Loadable(
|
||||||
lazy(() => import('../pages/Corporates/DiagnosisExclusion/Index'))
|
lazy(() => import('../pages/Corporates/DiagnosisExclusion/Index'))
|
||||||
);
|
);
|
||||||
|
const EditDiagnosisExclusions = Loadable(
|
||||||
|
lazy(() => import('../pages/Corporates/DiagnosisExclusion/Edit'))
|
||||||
|
);
|
||||||
const DiagnosisExclusionsHistory = Loadable(
|
const DiagnosisExclusionsHistory = Loadable(
|
||||||
lazy(() => import('../pages/Corporates/DiagnosisExclusion/History'))
|
lazy(() => import('../pages/Corporates/DiagnosisExclusion/History'))
|
||||||
);
|
);
|
||||||
@@ -515,9 +533,11 @@ const CorporateServicesCreate = Loadable(lazy(() => import('../pages/Corporates/
|
|||||||
const CorporateServicesHistory = Loadable(lazy(() => import('../pages/Corporates/Services/sections/History')));
|
const CorporateServicesHistory = Loadable(lazy(() => import('../pages/Corporates/Services/sections/History')));
|
||||||
|
|
||||||
const CorporateHospitals = Loadable(lazy(() => import('../pages/Corporates/Hospital/Index')));
|
const CorporateHospitals = Loadable(lazy(() => import('../pages/Corporates/Hospital/Index')));
|
||||||
|
const HospitalCreateUpdate = Loadable(lazy(() => import('../pages/Corporates/Hospital/CreateUpdate')));
|
||||||
const CorporateClaimHistories = Loadable(
|
const CorporateClaimHistories = Loadable(
|
||||||
lazy(() => import('../pages/Corporates/ClaimHistory/Index'))
|
lazy(() => import('../pages/Corporates/ClaimHistory/Index'))
|
||||||
);
|
);
|
||||||
|
const HospitalHistory = Loadable(lazy(() => import('../pages/Corporates/Hospital/History')));
|
||||||
|
|
||||||
const CorporateHistories = Loadable(
|
const CorporateHistories = Loadable(
|
||||||
lazy(() => import('../pages/Corporates/History'))
|
lazy(() => import('../pages/Corporates/History'))
|
||||||
|
|||||||
Reference in New Issue
Block a user