finishing benefit configuration
This commit is contained in:
@@ -59,7 +59,7 @@ class ClaimController extends Controller
|
|||||||
->where('status', '!=', 'requested') // Penjagaan agar approve baru masuk ke claim management
|
->where('status', '!=', 'requested') // Penjagaan agar approve baru masuk ke claim management
|
||||||
->latest()
|
->latest()
|
||||||
->paginate(10);
|
->paginate(10);
|
||||||
|
|
||||||
|
|
||||||
return response()->json($claims);
|
return response()->json($claims);
|
||||||
}
|
}
|
||||||
@@ -118,8 +118,8 @@ class ClaimController extends Controller
|
|||||||
{
|
{
|
||||||
$claim = Claim::query()
|
$claim = Claim::query()
|
||||||
->with([
|
->with([
|
||||||
'member',
|
'member',
|
||||||
// 'member.currentPlan',
|
// 'member.currentPlan',
|
||||||
// 'member.currentPlan.benefits',
|
// 'member.currentPlan.benefits',
|
||||||
'member.currentCorporate',
|
'member.currentCorporate',
|
||||||
// 'member.currentPolicy',
|
// 'member.currentPolicy',
|
||||||
@@ -159,9 +159,9 @@ class ClaimController extends Controller
|
|||||||
{
|
{
|
||||||
$claim = Claim::query()
|
$claim = Claim::query()
|
||||||
->with([
|
->with([
|
||||||
'member',
|
'member',
|
||||||
'plan',
|
'plan',
|
||||||
'member.currentPlan',
|
'member.currentPlan',
|
||||||
'member.currentPlan.benefits',
|
'member.currentPlan.benefits',
|
||||||
'member.currentCorporate',
|
'member.currentCorporate',
|
||||||
'member.currentPolicy',
|
'member.currentPolicy',
|
||||||
@@ -205,7 +205,7 @@ class ClaimController extends Controller
|
|||||||
'amount_not_approved' => $request->amount_not_approved,
|
'amount_not_approved' => $request->amount_not_approved,
|
||||||
'excess_paid' => $request->excess_paid,
|
'excess_paid' => $request->excess_paid,
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
$validator = Validator::make($request->all(), [
|
||||||
'benefit_desc' => 'required',
|
'benefit_desc' => 'required',
|
||||||
'amount_incurred' => 'required|numeric',
|
'amount_incurred' => 'required|numeric',
|
||||||
@@ -213,11 +213,11 @@ class ClaimController extends Controller
|
|||||||
'amount_not_approved' => 'required|numeric',
|
'amount_not_approved' => 'required|numeric',
|
||||||
'excess_paid' => 'required|numeric',
|
'excess_paid' => 'required|numeric',
|
||||||
], $customMessages);
|
], $customMessages);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return ApiResponse::apiResponse('Bad Request', $data, $validator->errors(), 400);
|
return ApiResponse::apiResponse('Bad Request', $data, $validator->errors(), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validasi berhasil, lanjutkan dengan pembaruan data
|
// Validasi berhasil, lanjutkan dengan pembaruan data
|
||||||
$claim = Claim::findOrFail($id);
|
$claim = Claim::findOrFail($id);
|
||||||
$claim->fill([
|
$claim->fill([
|
||||||
@@ -227,8 +227,8 @@ class ClaimController extends Controller
|
|||||||
'amount_not_approved' => $request->amount_not_approved,
|
'amount_not_approved' => $request->amount_not_approved,
|
||||||
'excess_paid' => $request->excess_paid,
|
'excess_paid' => $request->excess_paid,
|
||||||
])->save();
|
])->save();
|
||||||
|
|
||||||
return $claim;
|
return $claim;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -259,12 +259,12 @@ class ClaimController extends Controller
|
|||||||
|
|
||||||
return $claim;
|
return $claim;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateItems(Request $request, $id)
|
public function updateItems(Request $request, $id)
|
||||||
{
|
{
|
||||||
$request->validate([]);
|
$request->validate([]);
|
||||||
$claim = Claim::findOrFail($id);
|
$claim = Claim::findOrFail($id);
|
||||||
|
|
||||||
$order = 1;
|
$order = 1;
|
||||||
$data = [];
|
$data = [];
|
||||||
$claim->items()->forceDelete();
|
$claim->items()->forceDelete();
|
||||||
@@ -290,7 +290,7 @@ class ClaimController extends Controller
|
|||||||
// Update total
|
// Update total
|
||||||
$claim->total_claim = $totalClaim;
|
$claim->total_claim = $totalClaim;
|
||||||
$claim->save();
|
$claim->save();
|
||||||
|
|
||||||
return Helper::responseJson([], message: "Item Claim berhasil di update");
|
return Helper::responseJson([], message: "Item Claim berhasil di update");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ class ClaimController extends Controller
|
|||||||
foreach ($request->primary as $diagnosisId) {
|
foreach ($request->primary as $diagnosisId) {
|
||||||
$claim->diagnoses()->create([
|
$claim->diagnoses()->create([
|
||||||
'claim_id' => $claim->id,
|
'claim_id' => $claim->id,
|
||||||
'type' => 'primary',
|
'type' => 'primary',
|
||||||
'diagnosis_id' => $diagnosisId,
|
'diagnosis_id' => $diagnosisId,
|
||||||
'note' => '',
|
'note' => '',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
@@ -316,7 +316,7 @@ class ClaimController extends Controller
|
|||||||
foreach ($request->secondary as $diagnosisId) {
|
foreach ($request->secondary as $diagnosisId) {
|
||||||
$claim->diagnoses()->create([
|
$claim->diagnoses()->create([
|
||||||
'claim_id' => $claim->id,
|
'claim_id' => $claim->id,
|
||||||
'type' => 'secondary',
|
'type' => 'secondary',
|
||||||
'diagnosis_id' => $diagnosisId,
|
'diagnosis_id' => $diagnosisId,
|
||||||
'note' => '',
|
'note' => '',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
@@ -433,7 +433,7 @@ class ClaimController extends Controller
|
|||||||
|
|
||||||
// TODO Fix this tipu tipu
|
// TODO Fix this tipu tipu
|
||||||
$inpationBenefit = $claim->member->currentPlan->benefits()->first();
|
$inpationBenefit = $claim->member->currentPlan->benefits()->first();
|
||||||
|
|
||||||
$pdf = PDF::loadView('pdf.final_log', [
|
$pdf = PDF::loadView('pdf.final_log', [
|
||||||
'claim' => $claim,
|
'claim' => $claim,
|
||||||
'member' => $claim->member,
|
'member' => $claim->member,
|
||||||
@@ -441,7 +441,7 @@ class ClaimController extends Controller
|
|||||||
'hospital' => $hospital,
|
'hospital' => $hospital,
|
||||||
'inpationBenefit' => $inpationBenefit
|
'inpationBenefit' => $inpationBenefit
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $pdf->download('Final LOG '.$claim->code.'.pdf');
|
return $pdf->download('Final LOG '.$claim->code.'.pdf');
|
||||||
|
|
||||||
$view = view('pdf.final_log', [
|
$view = view('pdf.final_log', [
|
||||||
@@ -461,7 +461,7 @@ class ClaimController extends Controller
|
|||||||
$writer = WriterEntityFactory::createXLSXWriter();
|
$writer = WriterEntityFactory::createXLSXWriter();
|
||||||
// Membuka penulis untuk menulis ke file
|
// Membuka penulis untuk menulis ke file
|
||||||
$writer->openToFile(public_path('files/Benefit Usage Report.xlsx'));
|
$writer->openToFile(public_path('files/Benefit Usage Report.xlsx'));
|
||||||
|
|
||||||
// Sheet 1
|
// Sheet 1
|
||||||
$writer->getCurrentSheet()->setName('Worksheet');
|
$writer->getCurrentSheet()->setName('Worksheet');
|
||||||
$headers_map_to_table_fields = Claim::$listing_doc_headers;
|
$headers_map_to_table_fields = Claim::$listing_doc_headers;
|
||||||
@@ -477,7 +477,7 @@ class ClaimController extends Controller
|
|||||||
return $diagnosis->where('type', 'primary');
|
return $diagnosis->where('type', 'primary');
|
||||||
},
|
},
|
||||||
'diagnoses.icd',
|
'diagnoses.icd',
|
||||||
'plan',
|
'plan',
|
||||||
'benefit',
|
'benefit',
|
||||||
'claimRequest',
|
'claimRequest',
|
||||||
'claimRequest.service',
|
'claimRequest.service',
|
||||||
@@ -598,7 +598,7 @@ class ClaimController extends Controller
|
|||||||
// ];
|
// ];
|
||||||
// $row = WriterEntityFactory::createRowFromArray($rowData);
|
// $row = WriterEntityFactory::createRowFromArray($rowData);
|
||||||
// $writer->addRow($row);
|
// $writer->addRow($row);
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$writer->close();
|
$writer->close();
|
||||||
@@ -618,7 +618,7 @@ class ClaimController extends Controller
|
|||||||
->select('claim_requests.id')
|
->select('claim_requests.id')
|
||||||
->first();
|
->first();
|
||||||
$claim_id = $data_claim_requests->id;
|
$claim_id = $data_claim_requests->id;
|
||||||
|
|
||||||
$customer_data = DB::table('claim_requests')
|
$customer_data = DB::table('claim_requests')
|
||||||
->leftJoin('claims', 'claim_requests.id', '=', 'claims.claim_request_id')
|
->leftJoin('claims', 'claim_requests.id', '=', 'claims.claim_request_id')
|
||||||
->leftJoin('members', 'claim_requests.member_id', '=', 'members.id')
|
->leftJoin('members', 'claim_requests.member_id', '=', 'members.id')
|
||||||
@@ -633,7 +633,7 @@ class ClaimController extends Controller
|
|||||||
'members.payor_id',
|
'members.payor_id',
|
||||||
'members.member_id',
|
'members.member_id',
|
||||||
'claim_requests.payment_type',
|
'claim_requests.payment_type',
|
||||||
'corporates.name AS coporate_name',
|
'corporates.name AS coporate_name',
|
||||||
)
|
)
|
||||||
->first();
|
->first();
|
||||||
$results['customer_data'] = $customer_data;
|
$results['customer_data'] = $customer_data;
|
||||||
@@ -844,7 +844,7 @@ class ClaimController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Helper::responseJson([]);
|
return Helper::responseJson([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,7 +903,7 @@ class ClaimController extends Controller
|
|||||||
'updated_at' => date('Y-m-d H:i:s'),
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
DB::table('claim_request_files')->insert($dataToInsert);
|
DB::table('claim_request_files')->insert($dataToInsert);
|
||||||
|
|
||||||
return Helper::responseJson([]);
|
return Helper::responseJson([]);
|
||||||
}
|
}
|
||||||
@@ -999,4 +999,81 @@ class ClaimController extends Controller
|
|||||||
|
|
||||||
return Helper::responseJson(message: 'Data Berhasil di update');
|
return Helper::responseJson(message: 'Data Berhasil di update');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Benefit Configuration
|
||||||
|
*
|
||||||
|
* Bagaskoro, BSD 03 November 2023
|
||||||
|
*/
|
||||||
|
public function getBenefitConfiguration(Request $request, $claim_id) {
|
||||||
|
|
||||||
|
$benefit_list = DB::table('claims')
|
||||||
|
->leftJoin('claim_services', 'claims.claim_request_id', '=', 'claim_services.claim_request_id')
|
||||||
|
->leftJoin('claim_service_benefits', 'claim_services.id', '=', 'claim_service_benefits.claim_service_id')
|
||||||
|
->leftJoin('benefits', 'claim_service_benefits.benefit_id', '=', 'benefits.id')
|
||||||
|
->select("claim_service_benefits.id AS claim_service_benefits_id", "benefits.description AS benefit_name", "claim_service_benefits.amount_incurred", "claim_service_benefits.amount_approved", "claim_service_benefits.amount_not_approved", "claim_service_benefits.excess_paid")
|
||||||
|
->where("claims.id", "=", $claim_id)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'error' => false,
|
||||||
|
'message' => "success",
|
||||||
|
'data' => [
|
||||||
|
'benefit_list' => $benefit_list,
|
||||||
|
]
|
||||||
|
],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit Benefit Configuration
|
||||||
|
*
|
||||||
|
* Bagaskoro, BSD 03 November 2023
|
||||||
|
*/
|
||||||
|
public function editBenefitConfiguration(Request $request, $claim_service_benefits_id) {
|
||||||
|
$request->merge(['claim_service_benefits_id' => $claim_service_benefits_id]);
|
||||||
|
|
||||||
|
// validation rule
|
||||||
|
$validator = Validator::make($request->all(),[
|
||||||
|
'claim_service_benefits_id' => 'required|exists:claim_service_benefits,id',
|
||||||
|
'amount_incurred' => 'required|numeric',
|
||||||
|
'amount_approved' => 'required|numeric',
|
||||||
|
'amount_not_approved' => 'required|numeric',
|
||||||
|
'excess_paid' => 'required|numeric',
|
||||||
|
],$this->messages());
|
||||||
|
|
||||||
|
// validation error
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'message' => $validator->getMessageBag()
|
||||||
|
],400);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
DB::table('claim_service_benefits')->where('id', $claim_service_benefits_id)->update([
|
||||||
|
'amount_incurred' => $request->amount_incurred,
|
||||||
|
'amount_approved' => $request->amount_approved,
|
||||||
|
'amount_not_approved' => $request->amount_not_approved,
|
||||||
|
'excess_paid' => $request->excess_paid,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
catch (\Throwable $th) {
|
||||||
|
return Helper::responseJson(status: 'failed', statusCode: 500, message: $th->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return Helper::responseJson(status: 'success', statusCode: 200, message: "data berhasil disimpan !");
|
||||||
|
}
|
||||||
|
|
||||||
|
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',
|
||||||
|
'numeric' => ':attribute harus angka',
|
||||||
|
'digits_between'=> ':attribute maximal :max digit minimal :min digit'
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::get('corporates/{corporate_id}/hospitals/data', [HospitalController::class, 'dataHospital']);
|
Route::get('corporates/{corporate_id}/hospitals/data', [HospitalController::class, 'dataHospital']);
|
||||||
Route::post('corporates/{corporate_id}/hospitals/save', [HospitalController::class, 'store']);
|
Route::post('corporates/{corporate_id}/hospitals/save', [HospitalController::class, 'store']);
|
||||||
Route::put('corporates/{corporate_id}/hospitals/{id}/edit', [HospitalController::class, 'update']);
|
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']);
|
||||||
@@ -117,7 +117,7 @@ Route::prefix('internal')->group(function () {
|
|||||||
|
|
||||||
|
|
||||||
Route::get('corporates/{corporate_id}/diagnosis', [DiagnosisExclusionController::class, 'listDiagnosis']);
|
Route::get('corporates/{corporate_id}/diagnosis', [DiagnosisExclusionController::class, 'listDiagnosis']);
|
||||||
|
|
||||||
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::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']);
|
||||||
@@ -140,8 +140,8 @@ Route::prefix('internal')->group(function () {
|
|||||||
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-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');
|
||||||
Route::post('get-files-doc', 'getFilesDoc');
|
Route::post('get-files-doc', 'getFilesDoc');
|
||||||
@@ -231,6 +231,8 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::post('claims/request-documents', [ClaimController::class, 'requestDocuments']);
|
Route::post('claims/request-documents', [ClaimController::class, 'requestDocuments']);
|
||||||
Route::get('claims/get-services/{id}', [ClaimController::class, 'getServices']);
|
Route::get('claims/get-services/{id}', [ClaimController::class, 'getServices']);
|
||||||
Route::post('claims/save-services', [ClaimController::class, 'saveServices']);
|
Route::post('claims/save-services', [ClaimController::class, 'saveServices']);
|
||||||
|
Route::get('claims/{id}/benefit-configuration', [ClaimController::class, 'getBenefitConfiguration']); // Bagaskoro, BSD 03 November 2023
|
||||||
|
Route::put('claims/benefit-configuration/edit/{id}', [ClaimController::class, 'editBenefitConfiguration']); // Bagaskoro, BSD 03 November 2023
|
||||||
|
|
||||||
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
|
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
|
||||||
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
|
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ class ClaimHistoryCareResource extends JsonResource
|
|||||||
$claim = parent::toArray($request);
|
$claim = parent::toArray($request);
|
||||||
|
|
||||||
$secondaryDiagnosis = DiagnosisSecondaryClaimHistoryCare::where('claim_history_care_id', $claim['id'])->with(['icd'])->get()->toArray();
|
$secondaryDiagnosis = DiagnosisSecondaryClaimHistoryCare::where('claim_history_care_id', $claim['id'])->with(['icd'])->get()->toArray();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $claim['id'],
|
'id' => $claim['id'],
|
||||||
'service_code' => $claim['service_code'],
|
'service_code' => $claim['service_code'],
|
||||||
'admision_date' => $claim['admision_date'],
|
'admission_date' => $claim['admission_date'],
|
||||||
'discharge_date' => $claim['discharge_date'],
|
'discharge_date' => $claim['discharge_date'],
|
||||||
'claim_id' => $claim['claim_id'],
|
'claim_id' => $claim['claim_id'],
|
||||||
'organization_id' => $claim['organization_id'],
|
'organization_id' => $claim['organization_id'],
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class ClaimHistoryCare extends Model
|
|||||||
use HasFactory;
|
use HasFactory;
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'service_code',
|
'service_code',
|
||||||
'admision_date',
|
'admission_date',
|
||||||
'discharge_date',
|
'discharge_date',
|
||||||
'claim_id',
|
'claim_id',
|
||||||
'organization_id',
|
'organization_id',
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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('claim_service_benefits', function (Blueprint $table) {
|
||||||
|
$table->integer('amount_incurred')->default(0)->after('benefit_id');
|
||||||
|
$table->integer('amount_approved')->default(0)->after('amount_incurred');
|
||||||
|
$table->integer('amount_not_approved')->default(0)->after('amount_approved');
|
||||||
|
$table->integer('excess_paid')->default(0)->after('amount_not_approved');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('claim_service_benefits', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('amount_incurred');
|
||||||
|
$table->dropColumn('amount_approved');
|
||||||
|
$table->dropColumn('amount_not_approved');
|
||||||
|
$table->dropColumn('excess_paid');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -26,8 +26,6 @@ export default function RHFTextFieldMoney({ name, ...other }: IProps & TextField
|
|||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
fullWidth error={!!error}
|
fullWidth error={!!error}
|
||||||
helperText={error?.message}
|
helperText={error?.message}
|
||||||
onFocus={() => { (values[name] === '0') && setValue(name, '') }}
|
|
||||||
onBlur={() => { (values[name] === '') && setValue(name, '0') }}
|
|
||||||
{...other}
|
{...other}
|
||||||
inputProps={{ min: 0, max: 5, style: { textAlign: 'right' } }}
|
inputProps={{ min: 0, max: 5, style: { textAlign: 'right' } }}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
// mui
|
// mui
|
||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
Grid,
|
Grid,
|
||||||
Stack,
|
Stack,
|
||||||
Typography,
|
Typography,
|
||||||
Card,
|
Card,
|
||||||
TextField,
|
TextField,
|
||||||
Divider,
|
Divider,
|
||||||
ButtonBase,
|
ButtonBase,
|
||||||
Box,
|
Box,
|
||||||
IconButton,
|
IconButton,
|
||||||
Autocomplete,
|
Autocomplete,
|
||||||
FormControl,
|
FormControl,
|
||||||
InputLabel,
|
InputLabel,
|
||||||
@@ -93,7 +93,7 @@ export default function Detail() {
|
|||||||
});
|
});
|
||||||
getService();
|
getService();
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
function toTitleCase(str: string | null) {
|
function toTitleCase(str: string | null) {
|
||||||
return str.replace(/\w\S*/g, function(txt) {
|
return str.replace(/\w\S*/g, function(txt) {
|
||||||
@@ -117,7 +117,7 @@ export default function Detail() {
|
|||||||
const handleCloseDialogRequest = () => {
|
const handleCloseDialogRequest = () => {
|
||||||
setOpenDialogRequest(false);
|
setOpenDialogRequest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [conditionChecked, setConditionChecked] = useState(true);
|
const [conditionChecked, setConditionChecked] = useState(true);
|
||||||
const [diagnosisChecked, setDiagnosisChecked] = useState(false);
|
const [diagnosisChecked, setDiagnosisChecked] = useState(false);
|
||||||
const [supportingResultChecked, setSupportingResultChecked] = useState(false);
|
const [supportingResultChecked, setSupportingResultChecked] = useState(false);
|
||||||
@@ -139,7 +139,7 @@ export default function Detail() {
|
|||||||
const isRequiredFieldsFilled = () => {
|
const isRequiredFieldsFilled = () => {
|
||||||
return noteField.trim() !== '';
|
return noteField.trim() !== '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const handelRequestDocument = () => {
|
const handelRequestDocument = () => {
|
||||||
const dataForm = {
|
const dataForm = {
|
||||||
claim_id: id,
|
claim_id: id,
|
||||||
@@ -161,12 +161,12 @@ export default function Detail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------- Handle History Hospital Care ----------------------------*/
|
/*---------------------- Handle History Hospital Care ----------------------------*/
|
||||||
|
|
||||||
interface FormValuesProps extends Partial<ClaimHistoryCare> {
|
interface FormValuesProps extends Partial<ClaimHistoryCare> {
|
||||||
taxes: boolean;
|
taxes: boolean;
|
||||||
inStock: boolean;
|
inStock: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**------------- Handle History Hospital Care ---------------------*/
|
/**------------- Handle History Hospital Care ---------------------*/
|
||||||
const [currentClaimHistoryCare, setCurrentClaimHistoryCare] = useState(null);
|
const [currentClaimHistoryCare, setCurrentClaimHistoryCare] = useState(null);
|
||||||
@@ -191,7 +191,7 @@ export default function Detail() {
|
|||||||
setCorporateId(response.data.data.corporate_id)
|
setCorporateId(response.data.data.corporate_id)
|
||||||
setCurrentClaimHistoryCare(response.data.data.history_hospital_care)
|
setCurrentClaimHistoryCare(response.data.data.history_hospital_care)
|
||||||
setClaim(response.data.data)
|
setClaim(response.data.data)
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
@@ -200,14 +200,14 @@ export default function Detail() {
|
|||||||
.get(`corporates/${corporate_id}/diagnosis`)
|
.get(`corporates/${corporate_id}/diagnosis`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setMainDiagnosis(response.data.data)
|
setMainDiagnosis(response.data.data)
|
||||||
})
|
})
|
||||||
|
|
||||||
// setOrganization atau hospital atau location
|
// setOrganization atau hospital atau location
|
||||||
axios
|
axios
|
||||||
.get(`corporates/${corporate_id}/hospitals`)
|
.get(`corporates/${corporate_id}/hospitals`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setOrganization(response.data.data)
|
setOrganization(response.data.data)
|
||||||
})
|
})
|
||||||
|
|
||||||
}, [corporate_id])
|
}, [corporate_id])
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ export default function Detail() {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
reset({
|
reset({
|
||||||
service_code: response.data.data.service_code,
|
service_code: response.data.data.service_code,
|
||||||
admision_date: response.data.data.admision_date,
|
admission_date: response.data.data.admission_date,
|
||||||
discharge_date: response.data.data.discharge_date,
|
discharge_date: response.data.data.discharge_date,
|
||||||
organization_id: response.data.data.organization_id,
|
organization_id: response.data.data.organization_id,
|
||||||
practitioner_id: response.data.data.practitioner_id,
|
practitioner_id: response.data.data.practitioner_id,
|
||||||
@@ -229,7 +229,7 @@ export default function Detail() {
|
|||||||
main_diagnosis_id: response.data.data.main_diagnosis_id,
|
main_diagnosis_id: response.data.data.main_diagnosis_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
setCarehistory(response.data.data);
|
setCarehistory(response.data.data);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -242,9 +242,9 @@ export default function Detail() {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [claimHistoryId])
|
}, [claimHistoryId])
|
||||||
|
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
@@ -253,14 +253,14 @@ export default function Detail() {
|
|||||||
|
|
||||||
|
|
||||||
const [openDialogHospitalCare, setOpenHospitalCare] = useState(false);
|
const [openDialogHospitalCare, setOpenHospitalCare] = useState(false);
|
||||||
|
|
||||||
const handleCloseDialogHospitalCare = () => {
|
const handleCloseDialogHospitalCare = () => {
|
||||||
setEdit(false)
|
setEdit(false)
|
||||||
setOpenHospitalCare(false);
|
setOpenHospitalCare(false);
|
||||||
setClaimHistoryId(null)
|
setClaimHistoryId(null)
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
const [openDialogApproval, setOpenDialogApproval] = useState(false);
|
const [openDialogApproval, setOpenDialogApproval] = useState(false);
|
||||||
|
|
||||||
const handleCloseDialogApprove = () => {
|
const handleCloseDialogApprove = () => {
|
||||||
@@ -281,20 +281,20 @@ export default function Detail() {
|
|||||||
{ variant: 'success' }
|
{ variant: 'success' }
|
||||||
);
|
);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Location Change
|
// Handle Location Change
|
||||||
const handleLocationChange = (organization_id:number) => {
|
const handleLocationChange = (organization_id:number) => {
|
||||||
// if (newValue) {
|
// if (newValue) {
|
||||||
const selectedValue = organization_id;
|
const selectedValue = organization_id;
|
||||||
setValue('organization_id', selectedValue);
|
setValue('organization_id', selectedValue);
|
||||||
// let data = {
|
// let data = {
|
||||||
// ...values,
|
// ...values,
|
||||||
// practitioner_id: 0
|
// practitioner_id: 0
|
||||||
// }
|
// }
|
||||||
// reset(data)
|
// reset(data)
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.get('/doctors?search=&organization_id=' + selectedValue)
|
.get('/doctors?search=&organization_id=' + selectedValue)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@@ -309,14 +309,14 @@ export default function Detail() {
|
|||||||
const handleDoctorChange = (event, newValue) => {
|
const handleDoctorChange = (event, newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
const selectedValue = newValue.id;
|
const selectedValue = newValue.id;
|
||||||
setValue('practitioner_id', selectedValue);
|
setValue('practitioner_id', selectedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleMainDiagnosisChange = (event, newValue) => {
|
const handleMainDiagnosisChange = (event, newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
const selectedValue = newValue.id;
|
const selectedValue = newValue.id;
|
||||||
setValue('main_diagnosis_id', selectedValue);
|
setValue('main_diagnosis_id', selectedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ export default function Detail() {
|
|||||||
value: 0
|
value: 0
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
admision_date: isEdit ? carehistory?.admision_date : '',
|
admission_date: isEdit ? carehistory?.admission_date : '',
|
||||||
discharge_date: isEdit ? carehistory?.discharge_date : '',
|
discharge_date: isEdit ? carehistory?.discharge_date : '',
|
||||||
organization_id: isEdit ? carehistory?.organization_id : '',
|
organization_id: isEdit ? carehistory?.organization_id : '',
|
||||||
practitioner_id: isEdit ? carehistory?.practitioner_id : '',
|
practitioner_id: isEdit ? carehistory?.practitioner_id : '',
|
||||||
@@ -338,12 +338,12 @@ export default function Detail() {
|
|||||||
sign: isEdit ? carehistory?.sign : '',
|
sign: isEdit ? carehistory?.sign : '',
|
||||||
main_diagnosis_id: isEdit ? carehistory?.main_diagnosis_id : 0,
|
main_diagnosis_id: isEdit ? carehistory?.main_diagnosis_id : 0,
|
||||||
}),
|
}),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
let NewClaimHistoryCareSchema = Yup.object().shape({
|
let NewClaimHistoryCareSchema = Yup.object().shape({
|
||||||
service_code: Yup.string().required('Name is required'),
|
service_code: Yup.string().required('Name is required'),
|
||||||
// admision_date: Yup.date().required('Admisision Date is required'),
|
// admission_date: Yup.date().required('Admisision Date is required'),
|
||||||
// discharge_date: Yup.date().required('Discharge Date is required'),
|
// discharge_date: Yup.date().required('Discharge Date is required'),
|
||||||
// organization_id: Yup.number().required('Location is required'),
|
// organization_id: Yup.number().required('Location is required'),
|
||||||
// practitioner_id: Yup.number().required('Doctor is required'),
|
// practitioner_id: Yup.number().required('Doctor is required'),
|
||||||
@@ -357,7 +357,7 @@ export default function Detail() {
|
|||||||
resolver: yupResolver(NewClaimHistoryCareSchema),
|
resolver: yupResolver(NewClaimHistoryCareSchema),
|
||||||
defaultValues,
|
defaultValues,
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
reset,
|
reset,
|
||||||
watch,
|
watch,
|
||||||
@@ -372,16 +372,16 @@ export default function Detail() {
|
|||||||
|
|
||||||
const values = watch();
|
const values = watch();
|
||||||
|
|
||||||
|
|
||||||
console.log(values, 'debugs')
|
console.log(values, 'debugs')
|
||||||
|
|
||||||
const {fields, append, remove} = useFieldArray<FormValuesProps>({name: "secondary_diagnosis_id", control})
|
const {fields, append, remove} = useFieldArray<FormValuesProps>({name: "secondary_diagnosis_id", control})
|
||||||
|
|
||||||
const onSubmit = async (data: FormValuesProps) => {
|
const onSubmit = async (data: FormValuesProps) => {
|
||||||
if (isEdit){
|
if (isEdit){
|
||||||
let newData = {
|
let newData = {
|
||||||
service_code: data.service_code,
|
service_code: data.service_code,
|
||||||
admision_date: data.admision_date ? fDateOnly(data.admision_date) : null,
|
admission_date: data.admission_date ? fDateOnly(data.admission_date) : null,
|
||||||
discharge_date: data.discharge_date ? fDateOnly(data.discharge_date) : null,
|
discharge_date: data.discharge_date ? fDateOnly(data.discharge_date) : null,
|
||||||
organization_id: data.organization_id,
|
organization_id: data.organization_id,
|
||||||
practitioner_id: data.practitioner_id,
|
practitioner_id: data.practitioner_id,
|
||||||
@@ -391,7 +391,7 @@ export default function Detail() {
|
|||||||
secondary_diagnosis_id: data.secondary_diagnosis_id ? data.secondary_diagnosis_id.map((row) => row.value.id) : null,
|
secondary_diagnosis_id: data.secondary_diagnosis_id ? data.secondary_diagnosis_id.map((row) => row.value.id) : null,
|
||||||
main_diagnosis_id: data.main_diagnosis_id,
|
main_diagnosis_id: data.main_diagnosis_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
const response:any = await axios.post(`/claims/carehistory/${claimHistoryId}/update`, newData);
|
const response:any = await axios.post(`/claims/carehistory/${claimHistoryId}/update`, newData);
|
||||||
// if (response.status == 'success'){
|
// if (response.status == 'success'){
|
||||||
setOpenHospitalCare(false)
|
setOpenHospitalCare(false)
|
||||||
@@ -406,7 +406,7 @@ export default function Detail() {
|
|||||||
} else {
|
} else {
|
||||||
let newData = {
|
let newData = {
|
||||||
service_code: data.service_code,
|
service_code: data.service_code,
|
||||||
admision_date: data.admision_date ? fDateOnly(data.admision_date) : null,
|
admission_date: data.admission_date ? fDateOnly(data.admission_date) : null,
|
||||||
discharge_date: data.discharge_date ? fDateOnly(data.discharge_date) : null,
|
discharge_date: data.discharge_date ? fDateOnly(data.discharge_date) : null,
|
||||||
organization_id: data.organization_id,
|
organization_id: data.organization_id,
|
||||||
practitioner_id: data.practitioner_id,
|
practitioner_id: data.practitioner_id,
|
||||||
@@ -415,9 +415,9 @@ export default function Detail() {
|
|||||||
sign: data.sign,
|
sign: data.sign,
|
||||||
secondary_diagnosis_id: data.secondary_diagnosis_id ? data.secondary_diagnosis_id.map((row) => row.value.id) : null,
|
secondary_diagnosis_id: data.secondary_diagnosis_id ? data.secondary_diagnosis_id.map((row) => row.value.id) : null,
|
||||||
main_diagnosis_id: data.main_diagnosis_id,
|
main_diagnosis_id: data.main_diagnosis_id,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const response:any = await axios.post(`/claims/${id}/carehistory`, newData);
|
const response:any = await axios.post(`/claims/${id}/carehistory`, newData);
|
||||||
// if (response.status == 'success'){
|
// if (response.status == 'success'){
|
||||||
@@ -428,9 +428,9 @@ export default function Detail() {
|
|||||||
);
|
);
|
||||||
navigate('/claims/detail/'+id);
|
navigate('/claims/detail/'+id);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ export default function Detail() {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNewHospitalCare() {
|
function handleNewHospitalCare() {
|
||||||
setEdit(false);
|
setEdit(false);
|
||||||
setOpenHospitalCare(true);
|
setOpenHospitalCare(true);
|
||||||
@@ -474,12 +474,12 @@ export default function Detail() {
|
|||||||
|
|
||||||
//Service
|
//Service
|
||||||
const [openDialogService, setOpenDialogService] = useState(false);
|
const [openDialogService, setOpenDialogService] = useState(false);
|
||||||
const handleCloseDialogService = () => {
|
const handleCloseDialogService = () => {
|
||||||
setOpenDialogService(false);
|
setOpenDialogService(false);
|
||||||
}
|
}
|
||||||
const handleConditionChangeService = (event) => {
|
const handleConditionChangeService = (event) => {
|
||||||
const selectedItem = event.target.value;
|
const selectedItem = event.target.value;
|
||||||
|
|
||||||
if (valBenefitNames.includes(selectedItem)) {
|
if (valBenefitNames.includes(selectedItem)) {
|
||||||
// Item is already selected, remove it
|
// Item is already selected, remove it
|
||||||
setValBenefitNames(valBenefitNames.filter(item => item !== selectedItem));
|
setValBenefitNames(valBenefitNames.filter(item => item !== selectedItem));
|
||||||
@@ -488,7 +488,7 @@ export default function Detail() {
|
|||||||
setValBenefitNames([...valBenefitNames, selectedItem]);
|
setValBenefitNames([...valBenefitNames, selectedItem]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Data
|
//Data
|
||||||
const [serviceTypeData, setServiceTypeData] = useState(null);
|
const [serviceTypeData, setServiceTypeData] = useState(null);
|
||||||
const [benefitNameData, setBenefitNameData] = useState(null);
|
const [benefitNameData, setBenefitNameData] = useState(null);
|
||||||
@@ -509,9 +509,9 @@ export default function Detail() {
|
|||||||
//Hospital
|
//Hospital
|
||||||
const [valHospital, setValHospital] = useState('');
|
const [valHospital, setValHospital] = useState('');
|
||||||
const [valHospitalError, setValHospitalError] = useState('');
|
const [valHospitalError, setValHospitalError] = useState('');
|
||||||
//txt name
|
//txt name
|
||||||
const [txtName, setTxtName] = useState('Add Service');
|
const [txtName, setTxtName] = useState('Add Service');
|
||||||
//flag add or edit service
|
//flag add or edit service
|
||||||
const [flagAddService, setFlagAddService] = useState('add');
|
const [flagAddService, setFlagAddService] = useState('add');
|
||||||
//id claim_services
|
//id claim_services
|
||||||
const [idService, setIdService] = useState(null);
|
const [idService, setIdService] = useState(null);
|
||||||
@@ -532,7 +532,7 @@ export default function Detail() {
|
|||||||
setBenefitNameData(response.data.data.benefit_name),
|
setBenefitNameData(response.data.data.benefit_name),
|
||||||
setHospitalData(response.data.data.hospital),
|
setHospitalData(response.data.data.hospital),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -548,11 +548,11 @@ export default function Detail() {
|
|||||||
setDateAd(serviceData.addmission_date);
|
setDateAd(serviceData.addmission_date);
|
||||||
setDateDis(serviceData.discharge_date);
|
setDateDis(serviceData.discharge_date);
|
||||||
setIdService(serviceData.id);
|
setIdService(serviceData.id);
|
||||||
|
|
||||||
setOpenDialogService(true);
|
setOpenDialogService(true);
|
||||||
setTxtName('Edit Service');
|
setTxtName('Edit Service');
|
||||||
setFlagAddService('edit');
|
setFlagAddService('edit');
|
||||||
|
|
||||||
if (serviceTypeData) {
|
if (serviceTypeData) {
|
||||||
setValServiceType(serviceData.service_id);
|
setValServiceType(serviceData.service_id);
|
||||||
setValHospital(serviceData.hospital_id);
|
setValHospital(serviceData.hospital_id);
|
||||||
@@ -582,7 +582,7 @@ export default function Detail() {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
enqueueSnackbar('Something Went Wrong', { variant: 'error' });
|
enqueueSnackbar('Something Went Wrong', { variant: 'error' });
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const [openDialogSubmit, setOpenDialogSubmit] = useState(false);
|
const [openDialogSubmit, setOpenDialogSubmit] = useState(false);
|
||||||
@@ -793,7 +793,7 @@ export default function Detail() {
|
|||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||||
{currentClaimHistoryCare?.map((claimHistoryCare, index) =>
|
{currentClaimHistoryCare?.map((claimHistoryCare, index) =>
|
||||||
claimHistoryCare.status === 0 ? (
|
claimHistoryCare.status === 0 ? (
|
||||||
<Grid item xs={12} md={12} key={index}> {/* Tambahkan key untuk setiap elemen dalam loop */}
|
<Grid item xs={12} md={12} key={index}> {/* Tambahkan key untuk setiap elemen dalam loop */}
|
||||||
<Card sx={{padding: 2}}>
|
<Card sx={{padding: 2}}>
|
||||||
@@ -804,17 +804,17 @@ export default function Detail() {
|
|||||||
<TableMoreMenu actions={
|
<TableMoreMenu actions={
|
||||||
<>
|
<>
|
||||||
<MenuItem onClick={() => handleEditHospitalCare(claimHistoryCare.id)}>
|
<MenuItem onClick={() => handleEditHospitalCare(claimHistoryCare.id)}>
|
||||||
<EditTwoTone />Edit
|
<EditTwoTone />Edit
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => {setOpenDialogApproval(true); setClaimHistoryId(claimHistoryCare.id)}}>
|
<MenuItem onClick={() => {setOpenDialogApproval(true); setClaimHistoryId(claimHistoryCare.id)}}>
|
||||||
<LoopOutlined />Update Status
|
<LoopOutlined />Update Status
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</>
|
</>
|
||||||
}/>
|
}/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date :</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date :</Typography>
|
||||||
<Typography variant='subtitle2' sx={style2} gutterBottom>{ fDate(claimHistoryCare.admision_date)}</Typography> {/* Perbaikan typo di 'admission_date' */}
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{ fDate(claimHistoryCare.admission_date)}</Typography> {/* Perbaikan typo di 'admission_date' */}
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Discharge Date :</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Discharge Date :</Typography>
|
||||||
@@ -841,7 +841,7 @@ export default function Detail() {
|
|||||||
) : null
|
) : null
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{/* Dialog for input and update */}
|
{/* Dialog for input and update */}
|
||||||
<Dialog open={openDialogHospitalCare} onClose={handleCloseDialogHospitalCare} fullWidth={true} maxWidth={'xl'}>
|
<Dialog open={openDialogHospitalCare} onClose={handleCloseDialogHospitalCare} fullWidth={true} maxWidth={'xl'}>
|
||||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
@@ -873,27 +873,27 @@ export default function Detail() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6} md={6}>
|
<Grid item xs={6} md={6}>
|
||||||
<Typography variant="subtitle1" sx={{marginBottom: '10px'}}>Admission Date*</Typography>
|
<Typography variant="subtitle1" sx={{marginBottom: '10px'}}>Admission Date*</Typography>
|
||||||
<RHFDatepicker name="admision_date" label="Admission Date" required/>
|
<RHFDatepicker name="admission_date" label="Admission Date" required/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6} md={6}>
|
<Grid item xs={6} md={6}>
|
||||||
<Typography variant="subtitle1" sx={{marginBottom: '10px'}}>Discharge Date*</Typography>
|
<Typography variant="subtitle1" sx={{marginBottom: '10px'}}>Discharge Date*</Typography>
|
||||||
<RHFDatepicker name="discharge_date" label="Discharge Date" required/>
|
<RHFDatepicker name="discharge_date" label="Discharge Date" required/>
|
||||||
</Grid>
|
</Grid>
|
||||||
{/* Location */}
|
{/* Location */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant='subtitle1' marginBottom={1}>Location*</Typography>
|
<Typography variant='subtitle1' marginBottom={1}>Location*</Typography>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
|
|
||||||
id="combo-box-demo"
|
id="combo-box-demo"
|
||||||
options={organization}
|
options={organization}
|
||||||
fullWidth
|
fullWidth
|
||||||
getOptionLabel={(option) => {
|
getOptionLabel={(option) => {
|
||||||
return option.name ?? false
|
return option.name ?? false
|
||||||
}}
|
}}
|
||||||
isOptionEqualToValue={(option, value) =>{
|
isOptionEqualToValue={(option, value) =>{
|
||||||
return option.organization_id == value.organization_id
|
return option.organization_id == value.organization_id
|
||||||
}}
|
}}
|
||||||
|
|
||||||
onChange={(e, selectedOption) => {
|
onChange={(e, selectedOption) => {
|
||||||
if (selectedOption) {
|
if (selectedOption) {
|
||||||
const selectedOrganizationId = selectedOption.organization_id;
|
const selectedOrganizationId = selectedOption.organization_id;
|
||||||
@@ -901,7 +901,7 @@ export default function Detail() {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
value={organization.find(row => row.organization_id == values.organization_id)}
|
value={organization.find(row => row.organization_id == values.organization_id)}
|
||||||
|
|
||||||
renderInput={(params) => (
|
renderInput={(params) => (
|
||||||
<RHFTextField
|
<RHFTextField
|
||||||
name="organization_id"
|
name="organization_id"
|
||||||
@@ -913,17 +913,17 @@ export default function Detail() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{/* Dokter */}
|
{/* Dokter */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant='subtitle1' marginBottom={1}>Doctor*</Typography>
|
<Typography variant='subtitle1' marginBottom={1}>Doctor*</Typography>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
id="combo-box-demo"
|
id="combo-box-demo"
|
||||||
options={doctor}
|
options={doctor}
|
||||||
limitTags={1}
|
limitTags={1}
|
||||||
fullWidth
|
fullWidth
|
||||||
getOptionLabel={(option) => {
|
getOptionLabel={(option) => {
|
||||||
return option.name ?? false
|
return option.name ?? false
|
||||||
}}
|
}}
|
||||||
isOptionEqualToValue={(option, value) =>{
|
isOptionEqualToValue={(option, value) =>{
|
||||||
@@ -931,14 +931,14 @@ export default function Detail() {
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
value={doctor.find(row => row.id == values.practitioner_id)}
|
value={doctor.find(row => row.id == values.practitioner_id)}
|
||||||
|
|
||||||
onChange={handleDoctorChange}
|
onChange={handleDoctorChange}
|
||||||
renderInput={(params) => (
|
renderInput={(params) => (
|
||||||
<RHFTextField
|
<RHFTextField
|
||||||
name='practitioner_id'
|
name='practitioner_id'
|
||||||
{...params}
|
{...params}
|
||||||
label="Doctor"
|
label="Doctor"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
fullWidth
|
fullWidth
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
@@ -975,7 +975,7 @@ export default function Detail() {
|
|||||||
options={main_diagnosis}
|
options={main_diagnosis}
|
||||||
limitTags={1}
|
limitTags={1}
|
||||||
fullWidth
|
fullWidth
|
||||||
getOptionLabel={(option) => {
|
getOptionLabel={(option) => {
|
||||||
return option.name ?? false
|
return option.name ?? false
|
||||||
}}
|
}}
|
||||||
isOptionEqualToValue={(option, value) =>{
|
isOptionEqualToValue={(option, value) =>{
|
||||||
@@ -1012,11 +1012,11 @@ export default function Detail() {
|
|||||||
</FormProvider>
|
</FormProvider>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|
||||||
|
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
{/* Dialog for approval */}
|
{/* Dialog for approval */}
|
||||||
<Dialog open={openDialogApproval} onClose={handleCloseDialogApprove} fullWidth={true} maxWidth={'sm'}>
|
<Dialog open={openDialogApproval} onClose={handleCloseDialogApprove} fullWidth={true} maxWidth={'sm'}>
|
||||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
@@ -1038,7 +1038,7 @@ export default function Detail() {
|
|||||||
<Card sx={{padding: 2}}>
|
<Card sx={{padding: 2}}>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date</Typography>
|
||||||
<Typography variant='subtitle1' gutterBottom>{ carehistory ? fDate(carehistory?.admision_date) : '-'}</Typography>
|
<Typography variant='subtitle1' gutterBottom>{ carehistory ? fDate(carehistory?.admission_date) : '-'}</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Discharge Date</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Discharge Date</Typography>
|
||||||
@@ -1069,8 +1069,8 @@ export default function Detail() {
|
|||||||
</FormProvider>
|
</FormProvider>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|
||||||
|
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
@@ -1083,7 +1083,7 @@ export default function Detail() {
|
|||||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Diagnostic History</Typography>
|
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Diagnostic History</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||||
{currentClaimHistoryCare?.map((claimHistoryCare, index) =>
|
{currentClaimHistoryCare?.map((claimHistoryCare, index) =>
|
||||||
claimHistoryCare.status === 1 ? (
|
claimHistoryCare.status === 1 ? (
|
||||||
<Grid item xs={12} md={12} key={index}> {/* Tambahkan key untuk setiap elemen dalam loop */}
|
<Grid item xs={12} md={12} key={index}> {/* Tambahkan key untuk setiap elemen dalam loop */}
|
||||||
<Card sx={{padding: 2}}>
|
<Card sx={{padding: 2}}>
|
||||||
@@ -1094,7 +1094,7 @@ export default function Detail() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date :</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date :</Typography>
|
||||||
<Typography variant='subtitle2' sx={style2} gutterBottom>{ fDate(claimHistoryCare.admision_date)}</Typography> {/* Perbaikan typo di 'admission_date' */}
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{ fDate(claimHistoryCare.admission_date)}</Typography> {/* Perbaikan typo di 'admission_date' */}
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Discharge Date :</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Discharge Date :</Typography>
|
||||||
@@ -1129,7 +1129,7 @@ export default function Detail() {
|
|||||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Diagnosis Summary</Typography>
|
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Diagnosis Summary</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||||
{currentClaimHistoryCare?.map((claimHistoryCare, index) =>
|
{currentClaimHistoryCare?.map((claimHistoryCare, index) =>
|
||||||
claimHistoryCare.status === 1 ? (
|
claimHistoryCare.status === 1 ? (
|
||||||
<Grid item xs={12} md={12} key={index}> {/* Tambahkan key untuk setiap elemen dalam loop */}
|
<Grid item xs={12} md={12} key={index}> {/* Tambahkan key untuk setiap elemen dalam loop */}
|
||||||
<Card sx={{padding: 2}}>
|
<Card sx={{padding: 2}}>
|
||||||
@@ -1145,8 +1145,8 @@ export default function Detail() {
|
|||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Main Diagnosis :</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Main Diagnosis :</Typography>
|
||||||
<Typography variant='subtitle2' sx={style2} gutterBottom>{claimHistoryCare.icd?.name} <Label>{claimHistoryCare.icd?.code}</Label></Typography>
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{claimHistoryCare.icd?.name} <Label>{claimHistoryCare.icd?.code}</Label></Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{/* {claimHistoryCare.comparative_diagnosis?.map((comparativeDiagnosis, i) =>
|
{/* {claimHistoryCare.comparative_diagnosis?.map((comparativeDiagnosis, i) =>
|
||||||
(
|
(
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
<Typography variant='subtitle2' sx={style1} gutterBottom>{i == 0 ? 'Comparative Diagnosis :' : ''}</Typography>
|
<Typography variant='subtitle2' sx={style1} gutterBottom>{i == 0 ? 'Comparative Diagnosis :' : ''}</Typography>
|
||||||
@@ -1168,7 +1168,7 @@ export default function Detail() {
|
|||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
||||||
</Card>
|
</Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
) : null
|
) : null
|
||||||
@@ -1222,7 +1222,7 @@ export default function Detail() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
): ''}
|
): ''}
|
||||||
|
|
||||||
{/* Dialog Service */}
|
{/* Dialog Service */}
|
||||||
<Dialog open={openDialogService} onClose={handleCloseDialogService} fullWidth={true}>
|
<Dialog open={openDialogService} onClose={handleCloseDialogService} fullWidth={true}>
|
||||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
@@ -1288,11 +1288,11 @@ export default function Detail() {
|
|||||||
setValServiceType(e.target.value);
|
setValServiceType(e.target.value);
|
||||||
setValServiceTypeError(e.target.value === '' ? 'This field is required' : '');
|
setValServiceTypeError(e.target.value === '' ? 'This field is required' : '');
|
||||||
}}
|
}}
|
||||||
|
|
||||||
>
|
>
|
||||||
{serviceTypeData?.map((item, index) => (
|
{serviceTypeData?.map((item, index) => (
|
||||||
<MenuItem key={index} value={item.id}>{item.name}</MenuItem>
|
<MenuItem key={index} value={item.id}>{item.name}</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
<FormHelperText style={{ color: 'red' }}>{valServiceTypeError}</FormHelperText>
|
<FormHelperText style={{ color: 'red' }}>{valServiceTypeError}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@@ -1332,7 +1332,7 @@ export default function Detail() {
|
|||||||
label={item.description}
|
label={item.description}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
<FormHelperText style={{ color: 'red' }}>{valBenefitNameError}</FormHelperText>
|
<FormHelperText style={{ color: 'red' }}>{valBenefitNameError}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@@ -1355,11 +1355,11 @@ export default function Detail() {
|
|||||||
setValHospital(e.target.value);
|
setValHospital(e.target.value);
|
||||||
setValHospitalError(e.target.value === '' ? 'This field is required' : '');
|
setValHospitalError(e.target.value === '' ? 'This field is required' : '');
|
||||||
}}
|
}}
|
||||||
|
|
||||||
>
|
>
|
||||||
{hospitalData?.map((item, index) => (
|
{hospitalData?.map((item, index) => (
|
||||||
<MenuItem key={index} value={item.id}>{item.name}</MenuItem>
|
<MenuItem key={index} value={item.id}>{item.name}</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
<FormHelperText style={{ color: 'red' }}>{valHospitalError}</FormHelperText>
|
<FormHelperText style={{ color: 'red' }}>{valHospitalError}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@@ -1406,9 +1406,9 @@ export default function Detail() {
|
|||||||
<>
|
<>
|
||||||
{(customerData && customerData.status === 'received') ? (
|
{(customerData && customerData.status === 'received') ? (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
sx={{color: '#FF4842', borderColor: '#FF4842', marginLeft: 'auto'}}
|
sx={{color: '#FF4842', borderColor: '#FF4842', marginLeft: 'auto'}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpenDialogSubmit(true);
|
setOpenDialogSubmit(true);
|
||||||
setDeclaine('decline');
|
setDeclaine('decline');
|
||||||
@@ -1416,9 +1416,9 @@ export default function Detail() {
|
|||||||
>
|
>
|
||||||
Decline
|
Decline
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
sx={{backgroundColor: '#19BBBB', marginLeft: 1}}
|
sx={{backgroundColor: '#19BBBB', marginLeft: 1}}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={()=> {
|
onClick={()=> {
|
||||||
setOpenDialogSubmit(true);
|
setOpenDialogSubmit(true);
|
||||||
setDeclaine('approve');
|
setDeclaine('approve');
|
||||||
@@ -1429,16 +1429,16 @@ export default function Detail() {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
sx={{color: '#212B36', borderColor: '#919EAB52', marginLeft: 'auto'}}
|
sx={{color: '#212B36', borderColor: '#919EAB52', marginLeft: 'auto'}}
|
||||||
onClick={handelDownloadLog}
|
onClick={handelDownloadLog}
|
||||||
>
|
>
|
||||||
Download Final LOG
|
Download Final LOG
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
sx={{backgroundColor: '#19BBBB', marginLeft: 1}}
|
sx={{backgroundColor: '#19BBBB', marginLeft: 1}}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={()=> {
|
onClick={()=> {
|
||||||
setOpenDialogSubmit(true);
|
setOpenDialogSubmit(true);
|
||||||
setDeclaine('re-open');
|
setDeclaine('re-open');
|
||||||
@@ -1448,7 +1448,7 @@ export default function Detail() {
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) }
|
) }
|
||||||
|
|
||||||
</>
|
</>
|
||||||
{/* Dialog Submits */}
|
{/* Dialog Submits */}
|
||||||
<Dialog open={openDialogSubmit} onClose={handleCloseDialogSubmit} fullWidth={true}>
|
<Dialog open={openDialogSubmit} onClose={handleCloseDialogSubmit} fullWidth={true}>
|
||||||
|
|||||||
@@ -1,23 +1,58 @@
|
|||||||
|
import axios from "@/utils/axios";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
import { BenefitConfigurationListType } from "./Types";
|
import { BenefitConfigurationListType } from "./Types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Benefit Configuration List
|
* Get Benefit Configuration List
|
||||||
*/
|
*/
|
||||||
export const getBenefitConfigurationList = async ( ): Promise<BenefitConfigurationListType[]> => {
|
export const getBenefitConfigurationList = async ( claim_id: string ): Promise<BenefitConfigurationListType[]> => {
|
||||||
return [
|
const response = await axios.get(`/claims/${claim_id}/benefit-configuration`)
|
||||||
{
|
.then((res) =>{
|
||||||
benefit_name: 'Konsultasi Dokter Umum',
|
return res.data.data.benefit_list;
|
||||||
amount_incurred: 75000,
|
})
|
||||||
amount_approved: 75000,
|
.catch((res) => {
|
||||||
amount_not_approved: 0,
|
enqueueSnackbar("server error !", {
|
||||||
excess_paid: 0
|
variant: 'error',
|
||||||
},
|
});
|
||||||
{
|
|
||||||
benefit_name: 'Biaya Perawatan Setelah Rawat Inap',
|
return [];
|
||||||
amount_incurred: 925000,
|
});
|
||||||
amount_approved: 50000,
|
|
||||||
amount_not_approved: 425000,
|
return response;
|
||||||
excess_paid: 0
|
};
|
||||||
},
|
|
||||||
];
|
/**
|
||||||
|
* Edit Benefit Configuration
|
||||||
|
*/
|
||||||
|
export const editBenefitConfiguration = async ( data: BenefitConfigurationListType ): Promise<boolean> => {
|
||||||
|
const response = await axios.put(`/claims/benefit-configuration/edit/${data.claim_service_benefits_id}`, {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
.then((res) =>{
|
||||||
|
enqueueSnackbar(res.data.message, {
|
||||||
|
variant: 'success',
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
if (res.response.status == 400) {
|
||||||
|
let arr_message = res.response.data.message;
|
||||||
|
|
||||||
|
for (const key in arr_message) {
|
||||||
|
enqueueSnackbar(arr_message[key][0], {
|
||||||
|
variant: 'warning',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enqueueSnackbar("server error !", {
|
||||||
|
variant: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return response;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Benefit Configuration List Type
|
* Benefit Configuration List Type
|
||||||
*/
|
*/
|
||||||
export type BenefitConfigurationListType = {
|
export type BenefitConfigurationListType = {
|
||||||
|
claim_service_benefits_id: number,
|
||||||
benefit_name: string,
|
benefit_name: string,
|
||||||
amount_incurred: number,
|
amount_incurred: number,
|
||||||
amount_approved: number,
|
amount_approved: number,
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
import * as Yup from 'yup';
|
||||||
|
import { yupResolver } from '@hookform/resolvers/yup';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Box, Grid } from '@mui/material';
|
import { Box, Grid } from '@mui/material';
|
||||||
|
import { LoadingButton } from '@mui/lab';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import { styled } from '@mui/material/styles';
|
import { styled } from '@mui/material/styles';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
@@ -10,7 +13,8 @@ import IconButton from '@mui/material/IconButton';
|
|||||||
import CloseIcon from '@mui/icons-material/Close';
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { FormProvider, RHFTextField } from '@/components/hook-form';
|
import { FormProvider } from '@/components/hook-form';
|
||||||
|
import RHFTextFieldMoney from '@/components/hook-form/v2/RHFTextFieldMoney';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom Style
|
* Custom Style
|
||||||
@@ -24,8 +28,9 @@ const BootstrapDialog = styled(Dialog)(({ theme }) => ({
|
|||||||
* Utils, Types, Functions
|
* Utils, Types, Functions
|
||||||
* ============================================
|
* ============================================
|
||||||
*/
|
*/
|
||||||
import { BenefitConfigurationListType } from '../Model/Types';
|
|
||||||
import palette from '@/theme/palette';
|
import palette from '@/theme/palette';
|
||||||
|
import { BenefitConfigurationListType } from '../Model/Types';
|
||||||
|
import { editBenefitConfiguration } from '../Model/Functions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Props
|
* Props
|
||||||
@@ -35,6 +40,7 @@ type Props = {
|
|||||||
data?: BenefitConfigurationListType,
|
data?: BenefitConfigurationListType,
|
||||||
isOpen: boolean,
|
isOpen: boolean,
|
||||||
handleCancleProp: () => void,
|
handleCancleProp: () => void,
|
||||||
|
handleSuccessProp: () => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function BenefitConfigurationDialog({ ...props }: Props) {
|
export default function BenefitConfigurationDialog({ ...props }: Props) {
|
||||||
@@ -42,6 +48,7 @@ export default function BenefitConfigurationDialog({ ...props }: Props) {
|
|||||||
// setup form
|
// setup form
|
||||||
// ====================================
|
// ====================================
|
||||||
const defaultValues: BenefitConfigurationListType = {
|
const defaultValues: BenefitConfigurationListType = {
|
||||||
|
claim_service_benefits_id: 0,
|
||||||
benefit_name: '',
|
benefit_name: '',
|
||||||
amount_incurred: 0,
|
amount_incurred: 0,
|
||||||
amount_approved: 0,
|
amount_approved: 0,
|
||||||
@@ -49,21 +56,38 @@ export default function BenefitConfigurationDialog({ ...props }: Props) {
|
|||||||
excess_paid: 0,
|
excess_paid: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const validationSchema = Yup.object().shape({
|
||||||
|
amount_incurred : Yup.string().typeError('').required(''),
|
||||||
|
amount_approved : Yup.string().typeError('').required(''),
|
||||||
|
amount_not_approved : Yup.string().typeError('').required(''),
|
||||||
|
excess_paid : Yup.string().typeError('').required(''),
|
||||||
|
});
|
||||||
|
|
||||||
const methods = useForm<any>({
|
const methods = useForm<any>({
|
||||||
|
resolver: yupResolver(validationSchema),
|
||||||
defaultValues
|
defaultValues
|
||||||
});
|
});
|
||||||
|
|
||||||
const { handleSubmit, reset, setValue, formState: { isDirty, isSubmitting } } = methods;
|
const { handleSubmit, reset, watch, setValue, formState: { isDirty, isSubmitting, errors } } = methods;
|
||||||
|
|
||||||
|
console.log(errors);
|
||||||
|
console.log(watch());
|
||||||
|
|
||||||
// Submit Form
|
// Submit Form
|
||||||
// =====================================
|
// =====================================
|
||||||
const submitHandler = async (data: BenefitConfigurationListType) => {
|
const submitHandler = async (data: BenefitConfigurationListType) => {
|
||||||
return true;
|
let response = await editBenefitConfiguration(data);
|
||||||
|
|
||||||
|
if (response == true) {
|
||||||
|
props.handleSuccessProp()
|
||||||
|
props.handleCancleProp()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Value Form
|
// Set Value Form
|
||||||
// =====================================
|
// =====================================
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setValue('claim_service_benefits_id', props.data?.claim_service_benefits_id)
|
||||||
setValue('amount_incurred', props.data?.amount_incurred)
|
setValue('amount_incurred', props.data?.amount_incurred)
|
||||||
setValue('amount_approved', props.data?.amount_approved)
|
setValue('amount_approved', props.data?.amount_approved)
|
||||||
setValue('amount_not_approved', props.data?.amount_not_approved)
|
setValue('amount_not_approved', props.data?.amount_not_approved)
|
||||||
@@ -71,124 +95,124 @@ export default function BenefitConfigurationDialog({ ...props }: Props) {
|
|||||||
}, [props.data])
|
}, [props.data])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormProvider methods={methods} onSubmit={handleSubmit(submitHandler)}>
|
<Dialog
|
||||||
<BootstrapDialog
|
onClose={props.handleCancleProp}
|
||||||
onClose={props.handleCancleProp}
|
aria-labelledby="customized-dialog-title"
|
||||||
aria-labelledby="customized-dialog-title"
|
open={props.isOpen}
|
||||||
open={props.isOpen}
|
maxWidth={'md'}
|
||||||
maxWidth={'md'}
|
>
|
||||||
>
|
<FormProvider methods={methods} onSubmit={handleSubmit(submitHandler)}>
|
||||||
<DialogTitle sx={{ m: 0, p: 2, background: palette.light.primary.main, color: palette.light.grey[0], display: 'flex', alignItems: 'center', justifyContent: 'space-between' }} id="customized-dialog-title">
|
<DialogTitle sx={{ m: 0, p: 2, background: palette.light.primary.main, color: palette.light.grey[0], display: 'flex', alignItems: 'center', justifyContent: 'space-between' }} id="customized-dialog-title">
|
||||||
<Typography variant="body2" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="body2" sx={{ fontWeight: 'bold' }}>
|
||||||
Client Benefit Configuration
|
Client Benefit Configuration
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="close"
|
aria-label="close"
|
||||||
onClick={props.handleCancleProp}
|
onClick={props.handleCancleProp}
|
||||||
sx={{color: (theme) => theme.palette.grey[0]}}
|
sx={{color: (theme) => theme.palette.grey[0]}}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
|
||||||
<DialogContent sx={{ p: '0px' }}>
|
<DialogContent sx={{ p: '0px' }}>
|
||||||
<Box sx={{ py: '24px', px: '32px'}}>
|
<Box sx={{ py: '24px', px: '32px'}}>
|
||||||
<Box sx={{ p: '24px', border: '1px solid rgba(0,0,0,0.125)', borderRadius: '12px'}}>
|
<Box sx={{ p: '24px', border: '1px solid rgba(0,0,0,0.125)', borderRadius: '12px'}}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
{/* Benefit Name */}
|
{/* Benefit Name */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body2" sx={{ fontWeight: 'bold'}}>
|
<Typography variant="body2" sx={{ fontWeight: 'bold'}}>
|
||||||
{props.data?.benefit_name}
|
{props.data?.benefit_name}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body2" component="div">
|
<Typography variant="body2" component="div">
|
||||||
Amount Incurred*
|
Amount Incurred*
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||||
<RHFTextField
|
<RHFTextFieldMoney
|
||||||
id="amount_incurred"
|
id="amount_incurred"
|
||||||
name='amount_incurred'
|
name='amount_incurred'
|
||||||
placeholder='Amount Incurred'
|
placeholder='Amount Incurred'
|
||||||
/>
|
/>
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body2" component="div">
|
<Typography variant="body2" component="div">
|
||||||
Amount Approved*
|
Amount Approved*
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||||
<RHFTextField
|
<RHFTextFieldMoney
|
||||||
id="amount_approved"
|
id="amount_approved"
|
||||||
name='amount_approved'
|
name='amount_approved'
|
||||||
placeholder='Amount Approved'
|
placeholder='Amount Approved'
|
||||||
/>
|
/>
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body2" component="div">
|
<Typography variant="body2" component="div">
|
||||||
Amount Not Approved*
|
Amount Not Approved*
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||||
<RHFTextField
|
<RHFTextFieldMoney
|
||||||
id="amount_not_approved"
|
id="amount_not_approved"
|
||||||
name='amount_not_approved'
|
name='amount_not_approved'
|
||||||
placeholder='Amount Not Approved'
|
placeholder='Amount Not Approved'
|
||||||
/>
|
/>
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body2" component="div">
|
<Typography variant="body2" component="div">
|
||||||
Excess Paid*
|
Excess Paid*
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||||
<RHFTextField
|
<RHFTextFieldMoney
|
||||||
id="excess_paid"
|
id="excess_paid"
|
||||||
name='excess_paid'
|
name='excess_paid'
|
||||||
placeholder='Excess Paid'
|
placeholder='Excess Paid'
|
||||||
/>
|
/>
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Box>
|
</Grid>
|
||||||
</Box>
|
</Box>
|
||||||
</DialogContent>
|
</Box>
|
||||||
|
</DialogContent>
|
||||||
|
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button variant='outlined' onClick={props.handleCancleProp} aria-label="close">
|
<Button variant='outlined' onClick={props.handleCancleProp} aria-label="close">
|
||||||
Cancle
|
Cancle
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant='contained' onClick={props.handleCancleProp}>
|
<LoadingButton disabled={!isDirty} type="submit" variant="contained" loading={isSubmitting}>
|
||||||
Save
|
Save Changes
|
||||||
</Button>
|
</LoadingButton>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</BootstrapDialog>
|
</FormProvider>
|
||||||
</FormProvider>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* ============================================
|
* ============================================
|
||||||
*/
|
*/
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useParams } from 'react-router';
|
||||||
import { Box, Typography, Grid, MenuItem } from '@mui/material';
|
import { Box, Typography, Grid, MenuItem } from '@mui/material';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,8 +27,11 @@ import { BenefitConfigurationListType } from '../Model/Types';
|
|||||||
import { getBenefitConfigurationList } from '../Model/Functions';
|
import { getBenefitConfigurationList } from '../Model/Functions';
|
||||||
import palette from '@/theme/palette';
|
import palette from '@/theme/palette';
|
||||||
import BenefitConfigurationDialog from './BenefitConfigurationDialog';
|
import BenefitConfigurationDialog from './BenefitConfigurationDialog';
|
||||||
|
import { fNumber } from '@/utils/formatNumber';
|
||||||
|
|
||||||
export default function BenefitConfigurationList() {
|
export default function BenefitConfigurationList() {
|
||||||
|
const { id: claim_id } = useParams();
|
||||||
|
|
||||||
// State
|
// State
|
||||||
// --------------------
|
// --------------------
|
||||||
const [BenefitConfigurationList, setBenefitConfigurationList] = useState<BenefitConfigurationListType[]>();
|
const [BenefitConfigurationList, setBenefitConfigurationList] = useState<BenefitConfigurationListType[]>();
|
||||||
@@ -43,7 +47,7 @@ export default function BenefitConfigurationList() {
|
|||||||
// Load Data
|
// Load Data
|
||||||
// -------------------
|
// -------------------
|
||||||
const loadDataTableData = async () => {
|
const loadDataTableData = async () => {
|
||||||
const response = await getBenefitConfigurationList();
|
const response = await getBenefitConfigurationList(claim_id??'');
|
||||||
|
|
||||||
setBenefitConfigurationList(response);
|
setBenefitConfigurationList(response);
|
||||||
}
|
}
|
||||||
@@ -94,7 +98,7 @@ export default function BenefitConfigurationList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
||||||
{row.amount_incurred}
|
{fNumber(row.amount_incurred)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -110,7 +114,7 @@ export default function BenefitConfigurationList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
||||||
{row.amount_approved}
|
{fNumber(row.amount_approved)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -126,7 +130,7 @@ export default function BenefitConfigurationList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
||||||
{row.amount_not_approved}
|
{fNumber(row.amount_not_approved)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -142,7 +146,7 @@ export default function BenefitConfigurationList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="caption" sx={{ fontWeight: 'bold' }}>
|
||||||
{row.excess_paid}
|
{fNumber(row.excess_paid)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -158,7 +162,7 @@ export default function BenefitConfigurationList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{/* Dialog */}
|
{/* Dialog */}
|
||||||
<BenefitConfigurationDialog data={BenefitConfigurationData} isOpen={isDialogOpen} handleCancleProp={() => setIsDialogOpen(false)} />
|
<BenefitConfigurationDialog data={BenefitConfigurationData} isOpen={isDialogOpen} handleCancleProp={() => setIsDialogOpen(false)} handleSuccessProp={() => loadDataTableData()} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user