14 Commits

Author SHA1 Message Date
R
bcf6662db6 Update Generate Log 2023-02-21 17:01:57 +07:00
R
912edcdae7 [Build] Dashboard Production 2023-02-15 10:47:39 +07:00
R
5a7695b404 Add Appointment Type 2023-02-15 10:46:37 +07:00
R
5f05f191c6 [Build] Dashboard Prod 2023-02-15 10:14:20 +07:00
R
46af57b17c Show additional patient information in Dashboard Appointment 2023-02-15 10:13:07 +07:00
R
016bd3f605 [Hotfix] No PaymentDetail 2023-02-15 10:02:49 +07:00
R
093f8160d2 [Build] Additional Information 2023-02-15 10:00:53 +07:00
R
d8f493103c Add Additional Information 2023-02-15 09:57:00 +07:00
R
7f77deb09e Order Appointment & Livechat by newset 2023-02-15 09:10:22 +07:00
R
d38bc8dbfc [Build] Dashboard 2023-02-15 09:07:33 +07:00
R
b225084991 Update OLDLMS Appointment & Livechat Status 2023-02-15 09:03:13 +07:00
R
d8a98f4648 Merge remote-tracking branch 'origin/feature/appointment' 2023-02-15 08:08:51 +07:00
pajri
f309f4039c list dan show appointment 2023-02-10 16:55:24 +07:00
pajri
387658a992 CRUD Doctor Hospital 2023-02-09 13:15:45 +07:00
134 changed files with 4583 additions and 806 deletions

View File

@@ -0,0 +1,89 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Models\OLDLMS\Appointment;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\Internal\Transformers\AppointmentResource;
class AppointmentController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index()
{
$appointments = Appointment::query()
->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare', 'user', 'user.detail')
->latest()
->paginate(15);
return response()->json(Helper::paginateResources(AppointmentResource::collection($appointments)));
}
/**
* 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)
{
//
}
/**
* Show the specified resource.
* @param int $id
* @return Renderable
*/
public function show($id)
{
$appointments = Appointment::query()
->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare')
->where('nID', $id)
->first();
return response()->json(new AppointmentResource($appointments));
}
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Models\City;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class CityController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index(Request $request)
{
$city = City::where('province_id', $request->province_id)->orderBy('name', 'asc')->get();
if (!$city) {
return response(['message' => 'Tidak ada data'], 404);
} else {
return response(['message' => 'Data ditemukan', 'data' => $city]);
}
}
/**
* 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)
{
//
}
/**
* 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($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -10,6 +10,7 @@ use App\Models\Member;
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
use Box\Spout\Common\Entity\Row;
use Carbon\Carbon;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
@@ -42,10 +43,10 @@ class CorporateMemberController extends Controller
'claims' => function ($claim) {
// return $claim->whereBetween('requested_at', [now()->startOfYear(), now()->endOfYear()]);
// return $claim->used(now()->startOfYear(), now()->endOfYear());
}
},
'currentPlan',
'currentPlan.benefits'
])
->with('currentPlan')
// ->with
->paginate()
->appends($request->all());
@@ -231,15 +232,23 @@ class CorporateMemberController extends Controller
}
public function generateLog($member_id)
public function generateLog(Request $request, $member_id)
{
$member = Member::findOrFail($member_id)
->load(['currentPlan', 'currentPolicy', 'currentPlan.corporateBenefits', 'currentPlan.corporateBenefits.benefit']);
->load([
'currentPlan',
'currentPolicy',
'currentPlan.corporateBenefits' => function ($benefit) use ($request) {
return $benefit->when($request->benefit_ids, function ($q, $ids) {
return $q->whereIn('id', $ids);
});
},
'currentPlan.corporateBenefits.benefit']);
// dd($member->currentPlan->corporateBenefits->toArray());
$dateOfAdmission = $request->date_of_admission ? Carbon::parse($request->date_of_admission) : now();
// return view('pdf.guaranted_leter', compact('member'));
$pdf = PDF::loadView('pdf.guaranted_leter', compact('member'));
$pdf = PDF::loadView('pdf.guaranted_leter', compact(['member', 'dateOfAdmission']));
return $pdf->download('Guaranted Letter - '.$member->full_name.'.pdf');
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Models\District;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class DistrictController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index(Request $request)
{
$district = District::where('city_id', $request->city_id)->orderBy('name', 'asc')->get();
if (!$district) {
return response(['message' => 'Tidak ada data'], 404);
} else {
return response(['message' => 'Data ditemukan', 'data' => $district]);
}
}
/**
* 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)
{
//
}
/**
* 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($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -3,6 +3,7 @@
namespace Modules\Internal\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Models\Person;
use App\Models\Practitioner;
use App\Models\PractitionerRole;
use Illuminate\Contracts\Support\Renderable;
@@ -18,12 +19,6 @@ class DoctorController extends Controller
*/
public function index(Request $request)
{
// $doctors = PractitionerRole::active()->with('practitioner.person', 'organization')
// ->when($request->search ?? null, function ($query, $search) {
// $query->whereHas('practitioner.person', function ($person) use ($search) {
// $person->where('name', 'LIKE', '%' . $search . '%');
// });
// })->paginate();
$doctors = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')
->when($request->search ?? null, function ($query, $search) {
@@ -31,6 +26,9 @@ class DoctorController extends Controller
$person->where('name', 'LIKE', '%' . $search . '%');
});
})
->when($request->id ?? null, function ($query, $id) {
$query->where('id', $id);
})
->when($request->organization_id ?? null, function ($query, $organization_id) {
$query->whereHas('practitionerRoles', function ($practitionerRole) use ($organization_id) {
$practitionerRole->where('organization_id', $organization_id);
@@ -65,7 +63,58 @@ class DoctorController extends Controller
*/
public function store(Request $request)
{
//
$data_person = [
'name' => $request->name,
'gender' => $request->gender,
'address' => $request->address,
'phone' => $request->phone,
'email' => $request->email,
'birth_date' => date('Y-m-d', strtotime($request->birth_date)),
'birth_place' => $request->birth_place,
];
$person = Person::create($data_person);
$address = $person->addresses()->create([
'use' => 'both',
'type' => 'physical',
'text' => $request->address,
]);
$person->main_address_id = $address->id;
$person->save();
$practitioner = $person->practitioner()->create();
$practices = $request->practices;
if ($practices[0]['organization_id'] !== null) {
foreach ($practices as $key => $practice) {
if (isset($practice['specialities'])) {
//jika input spesialis
foreach ($practice['specialities'] as $key => $speciality) {
$speciality_id = $speciality['speciality_id'];
$organization_id = $practice['organization_id'];
$practitionerRole = $practitioner->practitionerRoles()->create([
'organization_id' => $organization_id,
'speciality_id' => $speciality_id,
]);
}
} else {
//jika tidak input spesialis
$speciality_id = null;
$organization_id = $practice['organization_id'];
$practitionerRole = $practitioner->practitionerRoles()->create([
'organization_id' => $organization_id,
'speciality_id' => $speciality_id,
]);
}
}
}
return response()->json([
'status' => 'success',
'message' => 'Data berhasil disimpan',
]);
}
/**
@@ -75,7 +124,8 @@ class DoctorController extends Controller
*/
public function show($id)
{
return view('internal::show');
$practitioner = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')->find($id);
return response()->json(DoctorResource::make($practitioner));
}
/**
@@ -85,7 +135,8 @@ class DoctorController extends Controller
*/
public function edit($id)
{
return view('internal::edit');
$practitioner = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')->find($id);
return response()->json(DoctorResource::make($practitioner));
}
/**
@@ -96,7 +147,81 @@ class DoctorController extends Controller
*/
public function update(Request $request, $id)
{
//
$practitioner = Practitioner::find($id);
$data_person = [
'name' => $request->name,
'gender' => $request->gender,
'address' => $request->address,
'phone' => $request->phone,
'email' => $request->email,
'birth_date' => date('Y-m-d', strtotime($request->birth_date)),
'birth_place' => $request->birth_place,
];
$person = $practitioner->person;
$person->update($data_person);
$address = $practitioner->person->addresses()->updateOrCreate([
'use' => 'both',
'type' => 'physical',
'text' => $request->address,
]);
$practitioner->person->main_address_id = $address->id;
$practitioner->person->save();
$practices = $request->practices;
$practitionerRole = $practitioner->practitionerRoles()->get() ?? null;
foreach ($practices as $practice) {
$organization_id = $practice['organization_id'];
foreach ($practice['specialities'] as $speciality) {
$speciality_id = $speciality['speciality_id'];
$cek = $practitionerRole->where('organization_id', $organization_id)
->where('speciality_id', $speciality_id)->first() ?? null;
if (!$cek || $practitionerRole->isEmpty()) {
// Create new practitioner role if not found
$practitioner->practitionerRoles()->create([
'organization_id' => $organization_id,
'speciality_id' => $speciality_id,
]);
}
}
}
if ($practitionerRole) {
// Remove practitioner roles that are no longer exists
$currentRoleIds = $practitionerRole->pluck('id')->toArray();
$newRoleIds = [];
foreach ($practices as $practice) {
$organization_id = $practice['organization_id'];
foreach ($practice['specialities'] as $speciality) {
$speciality_id = $speciality['speciality_id'];
$newPractitionerRole = $practitionerRole->where('organization_id', $organization_id)
->where('speciality_id', $speciality_id)
->first();
if ($newPractitionerRole) {
$newRoleIds[] = $newPractitionerRole->id;
}
}
}
$deletedRoleIds = array_diff($currentRoleIds, $newRoleIds);
if (count($deletedRoleIds) > 0) {
// Delete practitioner roles that are no longer exists
$data = $practitionerRole->whereIn('id', $deletedRoleIds);
$data->each(function ($item) {
$item->delete();
});
}
}
return response()->json([
'status' => 'success',
'message' => 'Data berhasil disimpan',
]);
}
/**
@@ -106,6 +231,14 @@ class DoctorController extends Controller
*/
public function destroy($id)
{
//
$practitioner = Practitioner::find($id);
$person = $practitioner->person->delete();
$address = $practitioner->person->addresses()->delete();
$practitionerRole = $practitioner->practitionerRoles()->delete();
$practitioner->delete();
return response()->json([
'status' => 'success',
'message' => 'Data berhasil dihapus',
]);
}
}

View File

@@ -0,0 +1,90 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Models\OLDLMS\Livechat;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\Internal\Transformers\LivechatResource;
class LivechatController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index()
{
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '')
->latest()
->paginate(15);
return response()->json(Helper::paginateResources(LivechatResource::collection($livechat)));
}
/**
* 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)
{
}
/**
* Show the specified resource.
* @param int $id
* @return Renderable
*/
public function show($id)
{
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '')
->where('nID', $id)
->first();
return response()->json(new LivechatResource($livechat));
}
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -47,7 +47,44 @@ class OrganizationController extends Controller
*/
public function store(Request $request)
{
//
$organization = [
'code' => $request->code,
'name' => $request->name,
'type' => 'hospital',
'status' => $request->active == 1 ? 'active' : 'inactive',
'description' => $request->description,
];
$create_organization = Organization::create($organization);
if ($request->phone != null) {
$create_organization->metas()->create([
'system' => 'default',
'type' => 'phone',
'value' => $request->phone,
]);
}
$address = $create_organization->addresses()->create([
'use' => 'both',
'type' => 'physical',
'text' => $request->address,
'province_id' => $request->province_id,
'city_id' => $request->city_id,
'district_id' => $request->district_id,
'village_id' => $request->village_id,
'postal_code' => $request->postal_code,
'lat' => $request->lat,
'lng' => $request->lng,
]);
$create_organization->main_address_id = $address->id;
$create_organization->save();
return response()->json([
'message' => 'Data berhasil disimpan',
'data' => new OrganizationResource($create_organization)
]);
}
/**
@@ -57,7 +94,7 @@ class OrganizationController extends Controller
*/
public function show($id)
{
return view('internal::show');
return response()->json(OrganizationResource::make(Organization::find($id)));
}
/**
@@ -67,7 +104,7 @@ class OrganizationController extends Controller
*/
public function edit($id)
{
return view('internal::edit');
return response()->json(OrganizationResource::make(Organization::find($id)));
}
/**
@@ -78,7 +115,46 @@ class OrganizationController extends Controller
*/
public function update(Request $request, $id)
{
//
$update_organization = Organization::find($id);
$update_organization->update([
'code' => $request->code,
'name' => $request->name,
'type' => 'hospital',
'status' => $request->active == 1 ? 'active' : 'inactive',
'description' => $request->description,
]);
if ($request->phone != null) {
$update_organization->metas()->updateOrCreate([
'system' => 'default',
'type' => 'phone',
], [
'system' => 'default',
'type' => 'phone',
'value' => $request->phone,
]);
}
$update_organization->addresses()->updateOrCreate([
'id' => $update_organization->main_address_id
], [
'use' => 'both',
'type' => 'physical',
'text' => $request->address,
'province_id' => $request->province_id,
'city_id' => $request->city_id,
'district_id' => $request->district_id,
'village_id' => $request->village_id,
'postal_code' => $request->postal_code,
'lat' => $request->lat,
'lng' => $request->lng,
]);
return response()->json([
'message' => 'Data berhasil diubah',
'data' => new OrganizationResource($update_organization)
]);
}
/**
@@ -88,6 +164,12 @@ class OrganizationController extends Controller
*/
public function destroy($id)
{
//
$delete_organization = Organization::find($id);
$delete_organization->addresses()->delete();
$delete_organization->delete();
return response()->json([
'message' => 'Data berhasil dihapus',
'data' => new OrganizationResource($delete_organization)
]);
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Models\Province;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class ProvinceController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index(Request $request)
{
$province = Province::orderBy('name', 'ASC')->get();
if (empty($province)) {
return response(['message' => 'Tidak ada data'], 404);
} else {
return response(['message' => 'Data ditemukan', 'data' => $province]);
}
}
/**
* 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)
{
//
}
/**
* 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($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Models\Village;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class VillageController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index(Request $request)
{
$villages = Village::where('district_id', $request->district_id)->orderBy('name', 'asc')->get();
if (!$villages) {
return response(['message' => 'Tidak ada data'], 404);
} else {
return response(['message' => 'Data ditemukan', 'data' => $villages]);
}
}
/**
* 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)
{
//
}
/**
* 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($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -3,7 +3,9 @@
use App\Http\Controllers\Api\MemberController as ApiMemberController;
use Modules\Internal\Http\Controllers\Api\AuthController;
use Illuminate\Http\Request;
use Modules\Internal\Http\Controllers\Api\AppointmentController;
use Modules\Internal\Http\Controllers\Api\BenefitController;
use Modules\Internal\Http\Controllers\Api\CityController;
use Modules\Internal\Http\Controllers\Api\ClaimController;
use Modules\Internal\Http\Controllers\Api\CorporateBenefitController;
use Modules\Internal\Http\Controllers\Api\CorporateController;
@@ -13,14 +15,18 @@ use Modules\Internal\Http\Controllers\Api\CorporatePlanController;
use Modules\Internal\Http\Controllers\Api\CorporateServiceController;
use Modules\Internal\Http\Controllers\Api\DiagnosisController;
use Modules\Internal\Http\Controllers\Api\DiagnosisExclusionController;
use Modules\Internal\Http\Controllers\Api\DistrictController;
use Modules\Internal\Http\Controllers\Api\DivisionController;
use Modules\Internal\Http\Controllers\Api\DoctorController;
use Modules\Internal\Http\Controllers\Api\DrugController;
use Modules\Internal\Http\Controllers\Api\FormulariumController;
use Modules\Internal\Http\Controllers\Api\LivechatController;
use Modules\Internal\Http\Controllers\Api\MemberController;
use Modules\Internal\Http\Controllers\Api\OrganizationController;
use Modules\Internal\Http\Controllers\Api\PlanController;
use Modules\Internal\Http\Controllers\Api\ProvinceController;
use Modules\Internal\Http\Controllers\Api\SpecialityController;
use Modules\Internal\Http\Controllers\Api\VillageController;
/*
|--------------------------------------------------------------------------
@@ -119,14 +125,19 @@ Route::prefix('internal')->group(function () {
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
Route::resource('organizations', OrganizationController::class);
Route::resource('appointments', AppointmentController::class);
Route::resource('live-chat', LivechatController::class);
Route::resource('doctors', DoctorController::class);
Route::post('generate-log/{member_id}', [CorporateMemberController::class, 'generateLog']);
Route::get('generate-log/{member_id}', [CorporateMemberController::class, 'generateLog']);
Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
Route::post('claim-requests/{id}/approve', [ClaimRequestController::class, 'approve'])->name('claim-requests.approve');
});
// Route::resource('organizations', OrganizationController::class);
// Route::resource('doctors', DoctorController::class);
// Route::get('something', [DiagnosisExclusionController::class, 'index']);
Route::get('province', [ProvinceController::class, 'index']);
Route::get('city', [CityController::class, 'index']);
Route::get('district', [DistrictController::class, 'index']);
Route::get('village', [VillageController::class, 'index']);
});

View File

@@ -0,0 +1,53 @@
<?php
namespace Modules\Internal\Transformers;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
class AppointmentResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
$appointment = [
'id' => $this->nID,
'patient_name' => $this->user ? $this->user->full_name : '',
'doctor_name' => $this->doctor ? $this->doctor->user?->full_name : '',
'speciality' => $this->doctor->speciality->sKeterangan,
'date_appointment' => Carbon::parse($this->appointmentDetail->dTanggalAppointment)->format('d-m-Y') . ' ' . $this->appointmentDetail->tTimeAppointment,
'date_created' => Carbon::parse($this->dCreateOn)->format('d-m-Y H:i:s') ?? null,
'appointment_media' => $this->sMedia,
'status' => $this->status_name,
'health_care' => $this->healthCare->sHealthCare ?? null,
'payment_method' => $this->payment_method ?? null,
'patient' => $this->user,
'booking_code' => $this->sBookingCode,
'his_detail' => [
'RegID' => $this->sRegID,
'Medrec' => $this->sNomorRekamMedis
],
'type' => $this->type
];
$payment_detail = null;
if ($this->appointmentDetail->sPaymentDetails != null) {
$payment_detail = [
'payment_type' => $this->appointmentDetail->sPaymentDetails['payment_type'] ?? '',
'transaction_time' => $this->appointmentDetail->sPaymentDetails['transaction_time'] ?? '',
'gross_amount' => $this->appointmentDetail->sPaymentDetails['gross_amount'] ?? '',
'currency' => $this->appointmentDetail->sPaymentDetails['currency'] ?? '',
'status_message' => $this->appointmentDetail->sPaymentDetails['status_message'] ?? '',
];
}
$appointment['payment_detail'] = $payment_detail;
return $appointment;
}
}

View File

@@ -4,6 +4,8 @@ namespace Modules\Internal\Transformers;
use Illuminate\Http\Resources\Json\JsonResource;
use function PHPSTORM_META\map;
class DoctorResource extends JsonResource
{
/**
@@ -19,35 +21,51 @@ class DoctorResource extends JsonResource
// 'his_dokter_id' => $this->practitionerRoles->meta,
'name' => $this->person->name,
'person_id' => $this->person->id,
'phone' => $this->person->phone,
'email' => $this->person->email,
'gender' => $this->person->gender == "L" ? 'Laki-laki' : 'Perempuan',
'address' => $this->person->currentAddress->text,
'phone' => $this->person->phone ?? null,
'email' => $this->person->email ?? null,
'birth_date' => $this->person->birth_date ?? null,
'birth_place' => $this->person->birth_place ?? null,
'gender' => $this->person->gender == "L" || $this->person->gender == "male" ? 'male' : 'female',
'address' => $this->person->currentAddress->text ?? null,
'organizations' => $this->practitionerRoles->unique('organization_id')->map(function ($practitionerRole) {
return [
'organization_id' => $practitionerRole->organization->id,
'organization_name' => $practitionerRole->organization->name,
];
}),
})->values(),
"specialties" => $this->practitionerRoles->unique('speciality_id')->map(function ($practitionerRole) {
return [
'specialty_id' => $practitionerRole->speciality->id,
'specialty_name' => $practitionerRole->speciality->name,
];
}),
"departemen" => $this->practitionerRoles->map(function ($practitionerRole) {
return [
'departemen_id' => $practitionerRole->meta->DepartemenID,
];
}),
'education' => $this->meta->education,
'experience' => $this->meta->work_experience,
'award' => $this->meta->award,
'keilmuan' => $this->meta->Keilmuan,
'tipe_dokter' => $this->meta->tipeDokter,
// "departemen" => $this->practitionerRoles->map(function ($practitionerRole) {
// return [
// 'departemen_id' => $practitionerRole->meta->DepartemenID ?? null,
// ];
// }) ?? null,
'education' => $this->meta->education ?? null,
'experience' => $this->meta->work_experience ?? null,
'award' => $this->meta->award ?? null,
'keilmuan' => $this->meta->Keilmuan ?? null,
'tipe_dokter' => $this->meta->tipeDokter ?? null,
];
$grouped = $this->collection($this->practitionerRoles)->groupBy('organization_id');
$grouped->transform(function ($items, $key) {
return [
'organization_id' => $key,
'specialities' => $items->map(function ($item) {
return [
'speciality_id' => $item->speciality->id,
];
}),
];
});
$doctor['practices'] = $grouped->toArray();
return $doctor;
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace Modules\Internal\Transformers;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
class LivechatResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
$livechat = [
'id' => $this->nID,
'doctor_name' => isset($this->doctor->user->sFirstName) ? $this->doctor->user->sFirstName . ' ' . $this->doctor->user->sLastName : null,
'speciality' => $this->doctor->speciality->sKeterangan ?? null,
'health_care' => $this->healthCare->sHealthCare ?? null,
'date_appointment' => Carbon::parse($this->appointment->appointmentDetail->dTanggalAppointment)->format('d-m-Y')
. ' ' . $this->appointment->appointmentDetail->tTimeAppointment ?? null,
'status_appointment' => $this->appointment->status_name ?? null,
'date_created' => Carbon::parse($this->appointment->dCreateOn)->format('d-m-Y H:i:s') ?? null,
'patient_media' => $this->sMedia ?? null,
'doctor_media' => $this->sMediaDokter ?? null,
'appointment_media' => $this->appointment->sMedia ?? null,
'status_chat' => $this->status_name ?? null,
'payment_method' => $this->appointment->payment_method ?? null,
];
$start_time = $this->dStartTime;
$end_time = $this->dEndTime;
$data_duration = 0 . ' jam ' . 0 . ' menit ' . 0 . ' detik';
if ($start_time != null && $end_time != null) {
$duration = Carbon::parse($start_time)->diffInMinutes(Carbon::parse($end_time));
$hours = floor($duration / 60);
$minutes = $duration % 60;
$seconds = ($duration - ($hours * 60) - $minutes) * 60;
$data_duration = $hours . ' jam ' . $minutes . ' menit ' . $seconds . ' detik';
}
$livechat['duration'] = $data_duration;
$payment_detail = null;
if ($this->appointment->appointmentDetail->sPaymentDetails != null) {
$payment_detail = [
'payment_type' => $this->appointment->appointmentDetail->sPaymentDetails['payment_type'],
'transaction_time' => $this->appointment->appointmentDetail->sPaymentDetails['transaction_time'],
'gross_amount' => $this->appointment->appointmentDetail->sPaymentDetails['gross_amount'],
'currency' => $this->appointment->appointmentDetail->sPaymentDetails['currency'],
'status_message' => $this->appointment->appointmentDetail->sPaymentDetails['status_message'],
];
}
$livechat['payment_detail'] = $payment_detail;
return $livechat;
}
}

View File

@@ -14,17 +14,24 @@ class OrganizationResource extends JsonResource
*/
public function toArray($request)
{
$organization = [
'id' => $this->id,
'name' => $this->name,
'type' => $this->type,
'code' => $this->code,
'description' => $this->description,
'kodeRs' => $this->meta->kodeRs ?? null,
'kodeRs' => $this->meta->KodeRS ?? null,
'phone' => $this->meta->phone ?? null,
'lat' => $this->currentAddress->lat ?? null,
'lng' => $this->currentAddress->lng ?? null,
'address' => $this->currentAddress ?? null,
'address' => $this->currentAddress->text ?? null,
'province_id' => $this->currentAddress->province_id ?? null,
'city_id' => $this->currentAddress->city_id ?? null,
'district_id' => $this->currentAddress->district_id ?? null,
'village_id' => $this->currentAddress->village_id ?? null,
'postal_code' => $this->currentAddress->postal_code ?? null,
'active' => $this->status == 'active' ? 1 : 0,
];
return $organization;

View File

@@ -2,6 +2,7 @@
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@@ -14,12 +15,99 @@ class Appointment extends Model
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
public $sStatusNames = [
0 => 'Menunggu Pembayaran',
1 => 'Pembayaran Terkonfirmasi', // Pembayaran Diterima
2 => 'Ditolak',
3 => 'Dibatalkan', // Canceled
4 => 'Expired',
];
public $sPaymentMethodName = [
1 => 'Pribadi',
2 => 'On-Site Payment',
3 => 'OVO',
4 => 'Asuransi',
5 => 'Voucher',
];
public $nIDJenisBookingNames = [
1 => 'Rawat Jalan',
2 => 'Telekonsultasi',
3 => 'Chat Sekarang'
];
protected $connection = 'oldlms';
protected $table = 'tx_appointment';
public function detail()
protected $primaryKey = 'nID';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'nID',
'nIDDokter',
'nIDUser',
'sStatus',
'dCreateOn',
'dUpdateOn',
'dDeleteOn',
];
protected $appends = [
'status_name',
'payment_method',
'type'
];
protected function statusName(): Attribute
{
return $this->hasOne(AppointmentDetail::class, '');
return Attribute::make(
get: function ($value) {
return $this->sStatusNames[$this->sStatus] ?? '-';
},
);
}
protected function paymentMethod(): Attribute
{
return Attribute::make(
get: function ($value) {
return $this->sPaymentMethodName[$this->sPaymentMethod] ?? '-';
},
);
}
protected function type(): Attribute
{
return Attribute::make(
get: function($value) {
return $this->nIDJenisBookingNames[$this->nIDJenisBooking] ?? '-';
}
);
}
public function appointmentDetail()
{
return $this->hasOne(AppointmentDetail::class, 'nIDAppointment', 'nID');
}
public function doctor()
{
return $this->belongsTo(Dokter::class, 'nIDDokter', 'nID');
}
public function user()
{
return $this->belongsTo(User::class, 'nIDUser', 'nID');
}
public function healthCare()
{
return $this->belongsTo(Healthcare::class, 'nIDHealthCare', 'nID');
}
}

View File

@@ -8,4 +8,19 @@ use Illuminate\Database\Eloquent\Model;
class AppointmentDetail extends Model
{
use HasFactory;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tx_appointment_detail';
protected $casts = [
'sPaymentDetails' => 'array',
];
public function appointment()
{
return $this->belongsTo(Appointment::class, 'nIDAppointment', 'nID');
}
}

View File

@@ -24,4 +24,14 @@ class Dokter extends Model
{
return $this->hasMany(JadwalDokter::class, 'nIDDokter', 'nID');
}
public function user()
{
return $this->belongsTo(User::class, 'nIDUser', 'nID');
}
public function speciality()
{
return $this->belongsTo(Speciality::class, 'nIDSpesialis', 'nID');
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Livechat extends Model
{
use HasFactory;
public $sStatusNames = [
0 => 'Menunggu Konfirmasi',
1 => 'Diterima',
2 => 'Ditolak',
3 => 'Selesai',
4 => 'Expired',
];
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tx_livechat';
protected $appends = [
'status_name',
];
protected function statusName(): Attribute
{
return Attribute::make(
get: function ($value) {
return $this->sStatusNames[$this->sStatus] ?? '-';
},
);
}
public function user()
{
return $this->belongsTo(User::class, 'nIDUser', 'nID');
}
public function doctor()
{
return $this->belongsTo(Dokter::class, 'nIDDokter', 'nID');
}
public function appointment()
{
return $this->belongsTo(Appointment::class, 'nIDAppointment', 'nID');
}
public function healthCare()
{
return $this->belongsTo(Healthcare::class, 'nIDHealthCare', 'nID');
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Speciality extends Model
{
use HasFactory;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tm_spesialis';
protected $primaryKey = 'nID';
public function dokter()
{
return $this->hasMany(Dokter::class, 'nIDSpesialis', 'nID');
}
}

View File

@@ -2,10 +2,46 @@
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model
{
use HasFactory;
use HasFactory, SoftDeletes;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tm_users';
protected $appends = [
'full_name',
];
protected function fullName(): Attribute
{
return Attribute::make(
get: function ($value) {
$names = [];
if (!empty($this->sFirstName)) {
array_push($names, $this->sFirstName);
}
if (!empty($this->sLastName)) {
array_push($names, $this->sLastName);
}
return implode(' ', $names);
}
);
}
public function detail()
{
return $this->hasOne(UserDetail::class, 'nIDUser', 'nID');
}
}

View File

@@ -8,4 +8,13 @@ use Illuminate\Database\Eloquent\Model;
class UserDetail extends Model
{
use HasFactory;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tm_users_detail';
}

View File

@@ -114,6 +114,11 @@ class Person extends Model
return $this->hasOne(User::class, 'person_id');
}
public function practitioner()
{
return $this->hasOne(Practitioner::class, 'person_id');
}
public function appointmentParticipantables()
{
return $this->morphMany(AppointmentParticipant::class, 'participantable');

View File

@@ -0,0 +1,7 @@
GENERATE_SOURCEMAP=false
PORT=8083
REACT_APP_HOST_API_URL="http://localhost:8000"
VITE_API_URL="http://localhost:8000/api/internal"

View File

@@ -69,6 +69,13 @@ const navConfig = [
title: 'CUSTOMER SERVICES',
children: [{ title: 'Request', path: '/cs-request' }],
},
{
title: 'REPORT',
children: [
{ title: 'Appointment', path: '/report/appointments' },
{ title: 'Live Chat', path: '/report/live-chat' },
],
},
{
title: 'USER MANAGEMENT',
path: '/users',

View File

@@ -46,6 +46,7 @@ import { Member } from '../../../@types/member';
import BasePagination from '../../../components/BasePagination';
import { enqueueSnackbar } from 'notistack';
import { LoadingButton } from '@mui/lab';
import DialogLog from './sections/DialogLog';
export default function CorporatePlanList() {
const { themeStretch } = useSettings();
@@ -198,19 +199,17 @@ export default function CorporatePlanList() {
enqueueSnackbar('No File Selected', { variant: 'warning' });
}
};
const handleGetTemplate = (type :string) => {
axios.get('corporates/import-document-example/' + type)
.then((response) => {
const link = document.createElement('a');
link.href = response.data.data.file_url;
link.setAttribute('download', response.data.data.file_name);
document.body.appendChild(link);
link.click();
handleClose();
})
}
const handleGetTemplate = (type: string) => {
axios.get('corporates/import-document-example/' + type).then((response) => {
const link = document.createElement('a');
link.href = response.data.data.file_url;
link.setAttribute('download', response.data.data.file_name);
document.body.appendChild(link);
link.click();
handleClose();
});
};
return (
<div>
@@ -248,7 +247,13 @@ export default function CorporatePlanList() {
}}
>
<MenuItem onClick={handleImportButton}>Import</MenuItem>
<MenuItem onClick={() => {handleGetTemplate('member')}}>Download Template</MenuItem>
<MenuItem
onClick={() => {
handleGetTemplate('member');
}}
>
Download Template
</MenuItem>
</Menu>
</Stack>
)}
@@ -329,6 +334,15 @@ export default function CorporatePlanList() {
const { row } = props;
const [open, setOpen] = React.useState(false);
const [loadingLog, setLoadingLog] = 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) => {
axios
.put(`/members/${row.id}/activation`, {
@@ -355,33 +369,7 @@ export default function CorporatePlanList() {
);
});
};
const handleDownloadLog = (row: ReturnType<typeof createData>) => {
setLoadingLog(true);
axios.get(`generate-log/${row.id}`, {
responseType: 'blob'
})
.then((response) => {
window.open(URL.createObjectURL(response.data));
// const content = response.headers['content-type'];
// download(response.data, file.file_name, content);
// const link = document.createElement('a');
// console.log(response.data);
// link.href = response.data.data.file_url;
// link.setAttribute('download', response.data.data.file_name);
// document.body.appendChild(link);
// link.click();
setLoadingLog(false);
})
// .then((blobFile) => {
// new File([blobFile], 'asdads.pdf', { type: blobFile.type })
// setLoadingLog(false);
// })
.catch((response) => {
enqueueSnackbar(response.message, {variant: 'error'})
setLoadingLog(false);
})
}
return (
<React.Fragment>
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
@@ -546,31 +534,29 @@ export default function CorporatePlanList() {
</Grid>
<Grid>
<LoadingButton
id="upload-button"
variant="outlined"
startIcon={<InsertDriveFileIcon />}
// sx={{ p: 1.8 }}
onClick={() => {handleDownloadLog(row)}}
loading={loadingLog}
>
Download LOG
</LoadingButton>
<LoadingButton
id="upload-button"
variant="outlined"
startIcon={<InsertDriveFileIcon />}
// sx={{ p: 1.8 }}
// onClick={() => {handleDownloadLog(row)}}
onClick={() => {
setDialogLogOpen(true);
}}
loading={loadingLog}
>
Download LOG
</LoadingButton>
</Grid>
{/* <Typography sx={{ fontWeight: '600', mb: 1, mt: 2 }}>Sub Corporate</Typography>
<Grid container>
<Grid item xs={12}>
<Grid container>
<Grid item xs={6}>
Sub Corporates (asdasdasdasd)
</Grid>
<Grid item xs={6}>
: qweqweqweqwe
</Grid>
</Grid>
</Grid>
</Grid> */}
<DialogLog
title={{
name: `Generate LOG - ${row.full_name}`,
}}
openDialog={dialogLogOpen}
setOpenDialog={setDialogLogOpen}
data={{ member: row }}
></DialogLog>
</Box>
</Collapse>
</TableCell>

View File

@@ -0,0 +1,203 @@
// react
import { ReactElement, useEffect, useState } from 'react';
// mui
import {
Card,
Checkbox,
Divider,
Grid,
Input,
Link,
Stack,
Table,
TableCell,
TableContainer,
TableRow,
Typography,
} from '@mui/material';
import { styled } from '@mui/material/styles';
// Component
import MuiDialog from '@/components/MuiDialog';
import { Box } from '@mui/material';
import { TextField } from '@mui/material';
import { DesktopDatePicker, LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
import { fPostFormat } from '@/utils/formatTime';
import { LoadingButton } from '@mui/lab';
import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
import axios from '@/utils/axios';
import { enqueueSnackbar } from 'notistack';
type DataContent = {
info: string;
date: string;
time: string;
};
type MuiDialogProps = {
title?: {
name?: string;
icon?: string;
};
openDialog: boolean;
setOpenDialog: Function;
content?: ReactElement;
data?: DataContent[];
};
const ItemNotificationStyle = styled(Card)(({ theme }) => ({
boxShadow: 'none',
padding: theme.spacing(1),
borderRadius: 0.5,
color: 'black',
}));
const DialogLog = ({ title, openDialog, setOpenDialog, data }: MuiDialogProps) => {
const [openDialogClaim, setOpenDialogClaim] = useState(false);
const [dialogTitleClaim, setDialogTitleClaim] = useState('');
const [dateOfAdmission, setDateOfAdmission] = useState(new Date());
const [checkedBenefitIds, setCheckedBenefitIds] = useState([]);
const [benefitIds, setBenefitIds] = useState([]);
const [loadingLog, setLoadingLog] = useState(false);
useEffect(() => {
setBenefitIds(data.member.current_plan?.benefits.map((benefit) => benefit.id))
setCheckedBenefitIds(benefitIds)
console.log('Check All', benefitIds, 'X', data.member.current_plan?.benefits.map((benefit) => benefit.id))
}, [])
const clickHandler = () => {
setDialogTitleClaim('Claim Details');
setOpenDialogClaim(true);
};
const handleCheckAll = (event) => {
if (event.target.checked) {
setCheckedBenefitIds(benefitIds)
} else {
setCheckedBenefitIds([])
}
}
const handleCheckChange = (event, benefit) => {
if ( event.target.checked ) {
setCheckedBenefitIds([...checkedBenefitIds, benefit.id])
} else {
// setCheckedBenefitIds([])
setCheckedBenefitIds(checkedBenefitIds.filter((benefitId) => benefitId !== benefit.id))
}
}
const handleDownloadLog = (row) => {
setLoadingLog(true);
axios
.post(`generate-log/${row.id}`, {
date_of_admission : dateOfAdmission,
benefit_ids : checkedBenefitIds
}, {
responseType: 'blob',
})
.then((response) => {
window.open(URL.createObjectURL(response.data));
setLoadingLog(false);
setOpenDialog(false);
})
.catch((response) => {
enqueueSnackbar(response.message, { variant: 'error' });
setLoadingLog(false);
});
}
const getContent = () => (
<Stack sx={{ marginTop: 2 }}>
<ItemNotificationStyle>
<Stack>
<Grid container spacing={2}>
<Grid item xs={12}>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<DesktopDatePicker
inputFormat="dd/MM/Y"
value={dateOfAdmission}
onChange={(value) => {
setDateOfAdmission(new Date(fPostFormat(value)));
// console.log('value')
}}
renderInput={(params) => (
<TextField
{...params}
fullWidth
label="Date of Admission"
placeholder="dd/mm/yyyy"
/>
)}
/>
</LocalizationProvider>
</Grid>
<Grid item xs={12} sx={{marginTop: 2}}>
<Stack direction="row" alignItems="center" justifyContent={'space-between'}>
<Typography variant="body1" fontWeight={800}>List Of Benefit</Typography>
<Stack direction="row" alignItems="center">
<Typography>All</Typography>
<Checkbox onChange={handleCheckAll} checked={benefitIds.length == checkedBenefitIds.length}/>
</Stack>
</Stack>
</Grid>
<Grid item xs={12}>
<Stack divider={<Divider flexItem />}>
{ data.member.current_plan?.benefits && (
data.member.current_plan?.benefits.map((benefit, index) => (
<Stack direction="row" alignItems="center" key={index}>
<Box sx={{ width: '100%' }}>
<Typography>{benefit.code} {benefit.description ? ` - ${benefit.description} ` : ''}</Typography>
</Box>
<Checkbox checked={checkedBenefitIds.includes(benefit.id)} onClick={(event) => {handleCheckChange(event, benefit)} } />
</Stack>
))
)}
</Stack>
{/* <TableContainer>
<Table>
<TableRow>
<TableCell>
ASD
</TableCell>
<TableCell>
ASD
</TableCell>
</TableRow>
</Table>
</TableContainer> */}
</Grid>
<Grid item xs={12}>
<LoadingButton
id="upload-button"
variant="outlined"
fullWidth
startIcon={<InsertDriveFileIcon />}
onClick={() => {handleDownloadLog(data.member)}}
loading={loadingLog}
>
Download LOG
</LoadingButton>
</Grid>
</Grid>
</Stack>
</ItemNotificationStyle>
</Stack>
);
return (
<>
<MuiDialog
title={title}
openDialog={openDialog}
setOpenDialog={setOpenDialog}
content={getContent()}
/>
</>
);
};
export default DialogLog;

View File

@@ -9,7 +9,6 @@ import Form from './Form';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import axios from '../../../utils/axios';
import { Practitioner } from '../../../@types/doctor';
import ButtonBack from '../../../components/ButtonBack';
export default function Create() {
const { themeStretch } = useSettings();
@@ -31,7 +30,6 @@ export default function Create() {
<Page title="Membership: Create a new Dokter">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center">
<ButtonBack />
<HeaderBreadcrumbs
heading={!isEdit ? 'Manage a new Dokter' : 'Manage Dokter'}
links={[
@@ -54,40 +52,3 @@ export default function Create() {
</Page>
);
}
// const pageTitle = 'Create Data Dokter';
// return (
// <Page title={pageTitle}>
// <Container maxWidth={themeStretch ? false : 'xl'}>
// <HeaderBreadcrumbs
// heading={pageTitle}
// links={[
// {
// name: 'Master',
// href: '/master',
// },
// {
// name: 'Dokter',
// href: '/master/organizations/',
// },
// {
// name: 'Create',
// href: '/master/organizations/create/',
// },
// ]}
// />
// <Grid container spacing={2}>
// <Grid item xs={12}>
// <Card sx={{ p: 2 }}>
// <Form
// isSubmitting={isSubmitting}
// isEdit={isEdit}
// currentOrganizations={currentOrganizations}
// />
// </Card>
// </Grid>
// </Grid>
// </Container>
// </Page>
// );
// }

View File

@@ -8,7 +8,7 @@ import Select, { SelectChangeEvent } from '@mui/material/Select';
import * as React from 'react';
// form
import { useForm } from 'react-hook-form';
import { useForm, Controller } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
// @mui
import { styled } from '@mui/material/styles';
@@ -25,6 +25,7 @@ import {
Typography,
TextField,
Chip,
Autocomplete,
} from '@mui/material';
import CancelIcon from '@mui/icons-material/Cancel';
@@ -41,17 +42,20 @@ import {
RHFMultiCheckbox,
RHFCheckbox,
RHFCustomMultiCheckbox,
RHFSelect,
} from '../../../components/hook-form';
import axios from '../../../utils/axios';
import { fCurrency } from '../../../utils/formatNumber';
import { Practitioner } from '../../../@types/doctor';
import AddIcon from '@mui/icons-material/Add';
import { Label, Rowing } from '@mui/icons-material';
import { email } from '../../../_mock/email';
const LabelStyle = styled(Typography)(({ theme }) => ({
...theme.typography.subtitle2,
color: theme.palette.text.secondary,
marginBottom: theme.spacing(1),
...theme.typography.h6,
marginBottom: theme.spacing(2),
marginTop: theme.spacing(2),
}));
const HeaderStyle = styled('header')(({ theme }) => ({
@@ -66,7 +70,6 @@ const Title = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
// paddingBottom: theme.spacing(3),
fontWeight: 700,
color: '#005B7F',
}));
interface FormValuesProps extends Partial<Practitioner> {
@@ -106,6 +109,8 @@ export default function PractitionerForm({ isEdit, currentPractitioner }: Props)
() => ({
id: currentPractitioner?.id,
name: currentPractitioner?.name || '',
email: currentPractitioner?.email || '',
phone: currentPractitioner?.phone || '',
address: currentPractitioner?.address || '',
birth_date: currentPractitioner?.birth_date || '',
gender: currentPractitioner?.gender || '',
@@ -121,6 +126,8 @@ export default function PractitionerForm({ isEdit, currentPractitioner }: Props)
[currentPractitioner]
);
console.log('currentPractitioner', currentPractitioner);
console.log('defaultValues', defaultValues);
function StatusLabel({ value }: { value: boolean }) {
@@ -168,91 +175,391 @@ export default function PractitionerForm({ isEdit, currentPractitioner }: Props)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isEdit, currentPractitioner]);
const handleActivate = (event: React.ChangeEvent<HTMLInputElement>) => {
setValue('active', event.target.checked);
const onSubmit = async (data: FormValuesProps) => {
try {
const formData = new FormData();
formData.append('name', data.name);
formData.append('gender', data.gender);
formData.append('address', data.address);
formData.append('birth_place', data.birth_place);
formData.append('birth_date', data.birth_date);
formData.append('email', data.email);
formData.append('phone', data.phone);
// formData.append('active', data.active ? '1' : '0');
forms.forEach((form, index) => {
formData.append(`practices[${index}][organization_id]`, form.organizationId);
form.specialities.forEach((speciality, i) => {
formData.append(`practices[${index}][specialities][${i}][speciality_id]`, speciality);
});
});
console.log('event.target.checked', event.target.checked);
if (!isEdit) {
console.log('formData', formData);
const response = await axios.post('/doctors', formData);
} else {
formData.append('_method', 'PUT');
const response = await axios.post('/doctors/' + currentPractitioner?.id ?? '', formData);
}
reset();
enqueueSnackbar(!isEdit ? 'Doctors Created Successfully!' : 'Doctors Udpated Successfully!', {
variant: 'success',
});
navigate('/master/doctors');
} catch (error: any) {
if (error && error.response.status === 422) {
console.log('error', error.response.data.errors);
for (const [key, value] of Object.entries(error.response.data.errors)) {
setError(key, { message: value[0] });
enqueueSnackbar(value[0] ?? 'Failed Processing Request', { variant: 'error' });
}
} else {
enqueueSnackbar(error.message ?? 'Failed Processing Request', { variant: 'error' });
}
}
const formData = new FormData();
formData.append('active', event.target.checked ? '1' : '0');
formData.append('_method', 'PUT');
axios.post('/doctors/' + currentPractitioner?.id ?? '', formData);
const ascent = document?.querySelector('ascent');
if (ascent != null) {
ascent.innerHTML = '';
}
};
enqueueSnackbar('active Updated Successfully!', { variant: 'success' });
const [organizations, setOrganizations] = useState<any>([]);
const [specialities, setSpecialities] = useState<any>([]);
useEffect(() => {
axios.get(`/search-organizations`).then((response) => {
setOrganizations(
response.data.map((item: any) => ({ ...item, name: item.name, value: item.id }))
);
});
axios.get(`/search-specialities`).then((response) => {
setSpecialities(
response.data.map((item: any) => ({ ...item, name: item.name, value: item.id }))
);
});
}, []);
// const specialities = [
// { name: 'Dentistry', id: 1 },
// { name: 'Dermatology', id: 2 },
// { name: 'General Medicine', id: 3 },
// { name: 'Pediatrics', id: 4 },
// { name: 'Surgery', id: 5 },
// ];
const practices = currentPractitioner?.practices || [];
// const practices = [
// {
// organization_id: 187,
// specialities: [
// {
// speciality_id: 7,
// },
// {
// speciality_id: 6,
// },
// ],
// },
// {
// organization_id: 181,
// specialities: [
// {
// speciality_id: 2,
// },
// ],
// },
// ];
const [forms, setForms] = useState<any>([]);
useEffect(() => {
if (practices.length > 0) {
const newForms = practices.map((practice: any) => {
return {
organizationId: practice.organization_id,
specialities: practice.specialities.map((s) => s.speciality_id),
};
});
setForms(newForms);
} else {
setForms([
{
organizationId: '',
specialities: [],
},
]);
}
}, [practices && practices.length]);
// }, []);
console.log('forms', forms);
const findValueOrganization = (organizationId) => {
if (organizationId === '' || organizationId === null) {
return { name: '', value: '' };
} else {
const organization = organizations.find((o) => o.id === organizationId);
return { name: organization?.name, value: organizationId };
}
};
// console.log('findValueOrganization', findValueOrganization(187));
// const findValueSpeciality = (specialityIds: number[]) => {
// if (specialityIds.length === 0) {
// return [];
// } else {
// const data = specialities.filter((s) => specialityIds.includes(s.id));
// return data.map((d) => ({ name: d.name, value: d.id }));
// }
// };
const findValueSpeciality = (values: any) => {
return specialities.filter((s) => values.includes(s.value));
};
// const [forms, setForms] = useState([
// {
// organizationId: '',
// specialities: [],
// },
// ]);
const addForm = () => {
setForms([
...forms,
{
organizationId: '',
specialities: [],
},
]);
};
console.log('forms', forms);
const gender = [
{
value: 'male',
label: 'Laki-Laki',
},
{
value: 'female',
label: 'Perempuan',
},
];
console.log('forms', forms);
// const handleSpecialitiesChange = (index: number, value: any) => {
// const newForms = [...forms];
// newForms[index].specialities = value.map((v: any) => ({ speciality_id: v.id }));
// setForms(newForms);
// };
// const handleSpecialitiesChange = (index: number, value: any) => {
// const updatedForms = [...forms];
// updatedForms[index].specialities = value.map((v: any) => v.speciality_id);
// setForms(updatedForms);
// };
const handleOrganizationIdChange = (index, value) => {
const updatedForms = [...forms];
updatedForms[index].organizationId = value.id;
setForms(updatedForms);
};
const handleSpecialitiesChange = (index: number, value: any) => {
setForms((forms) => {
forms[index].specialities = value.map((v: any) => v.value);
return [...forms];
});
};
// const availableOrganizations = organizations.filter(
// (org) =>
// !forms.some((f) => f.organization && f.organization.id === org.id) ||
// forms.findIndex((f) => f.organization && f.organization.id === org.id) === editIndex
// );
const availableOrganizations =
practices.length > 0
? organizations.filter(
(org) => !practices.some((practice) => practice.organization_id === org.id)
)
: organizations.filter((org) => !forms.some((f) => f.organizationId === org.id));
// const availableOrganizations = organizations.filter(
// (org) => !practices.some((p) => p.organization_id === org.id)
// );
const handleDeleteForm = (index) => {
const updatedForms = [...forms];
updatedForms.splice(index, 1);
setForms(updatedForms);
};
return (
<FormProvider methods={methods}>
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<Stack spacing={3}>
<Box sx={{ width: '100%' }}>
{/* <Stack spacing={3}> */}
<Card sx={{ p: 5 }}>
<HeaderStyle>
{/* <HeaderStyle>
<Grid item xs={6} md={6}>
<Title>Data Dokter</Title>
</Grid>
<Grid item xs={6} md={6}>
{/* <Typography>Status Rumah Sakit</Typography> */}
<RHFSwitch name="active" label="" onClick={handleActivate} />
<RHFSwitch name="active" label="" />
<StatusLabel value={values.active} />
</Grid>
</HeaderStyle>
</HeaderStyle> */}
<Title variant="h5">Informasi Umum</Title>
<Avatar
alt="Remy Sharp"
src={currentPractitioner?.avatar_url}
sx={{ width: 120, height: 120, marginBottom: 2 }}
/>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Span style={{ fontWeight: 'bold' }}>Nama Dokter</Span>
<Text>{currentPractitioner?.name ? currentPractitioner?.name : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>No Telp</Span>
<Text>{currentPractitioner?.phone ? currentPractitioner?.phone : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Tempat Lahir</Span>
<Text>
{currentPractitioner?.birth_place ? currentPractitioner?.birth_place : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Alamat</Span>
<Text>{currentPractitioner?.address ? currentPractitioner?.address : '-'}</Text>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }} sx={{ mt: 2 }}>
<Grid item xs={12}>
<LabelStyle>Nama Dokter</LabelStyle>
<RHFTextField name="name" placeholder="Tuliskan Nama Dokter" />
</Grid>
<Grid item xs={5} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Span style={{ fontWeight: 'bold' }}>Jenis Kelamin</Span>
<Text>{currentPractitioner?.gender ? currentPractitioner?.gender : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Email</Span>
<Text>{currentPractitioner?.email ? currentPractitioner?.email : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Tanggal Lahir</Span>
<Text>
{currentPractitioner?.birth_date ? currentPractitioner?.birth_date : '-'}
</Text>
<Grid item xs={6}>
<LabelStyle>Jenis Kelamin</LabelStyle>
<RHFSelect name="gender" label="Pilih Jenis Kelamin">
<option value="" />
{gender.map((option, index) => (
<option key={index} value={option.value}>
{option.label}
</option>
))}
</RHFSelect>
</Grid>
<Grid item xs={6}>
<LabelStyle>Alamat</LabelStyle>
<RHFTextField name="address" placeholder="Tuliskan Alamat" />
</Grid>
<Grid item xs={6}>
<LabelStyle>Tempat Lahir</LabelStyle>
<RHFTextField name="birth_place" placeholder="Tuliskan Tempat Lahir" />
</Grid>
<Grid item xs={6}>
<LabelStyle>Tanggal Lahir</LabelStyle>
<RHFDatepicker name="birth_date" placeholder="Silahkan Pilih Tanggal Lahir" />
</Grid>
<Grid item xs={6}>
<LabelStyle>Email</LabelStyle>
<RHFTextField name="email" placeholder="Tuliskan Email" type="email" />
</Grid>
<Grid item xs={6}>
<LabelStyle>No. Telp</LabelStyle>
<RHFTextField name="phone" placeholder="Tuliskan Nomor Telepon" />
</Grid>
</Grid>
</Card>
<Card sx={{ p: 5, marginTop: 2 }}>
<Title variant="h5">Tempat Praktik</Title>
{currentPractitioner?.organizations?.map((item, index) => (
<Box key={index} sx={{ mt: 3 }}>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Text>{item.name}</Text>
<Stack spacing={3} direction="row" justifyContent="space-between">
<Title variant="h5">Tempat Praktik</Title>
<Button
variant="contained"
color="primary"
size="small"
sx={{ boxShadow: 'none' }}
onClick={addForm}
startIcon={<AddIcon />}
>
Tambah Tempat Praktik
</Button>
</Stack>
{forms.map((form, index) => (
<div key={index}>
<Box sx={{ mt: 3 }}>
<Stack spacing={3} direction="row" justifyContent="space-between">
<LabelStyle></LabelStyle>
{index !== 0 && (
<Button
sx={{ color: 'red', m: 1 }}
aria-label="close"
onClick={() => handleDeleteForm(index)}
>
Delete
</Button>
// <Button onClick={() => handleDeleteForm(index)}>Delete</Button>
)}
</Stack>
{/* <h1>{form.organizationId}</h1> */}
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={6}>
<Autocomplete
options={availableOrganizations}
value={findValueOrganization(form.organizationId) ?? ''}
getOptionLabel={(option) => option.name}
isOptionEqualToValue={(option, value) => option.value === value.value}
onChange={(event, value) => handleOrganizationIdChange(index, value)}
renderInput={(params) => (
<TextField {...params} label="Rumah Sakit" variant="outlined" />
)}
/>
{/* <Autocomplete
options={organizations}
value={findValueOrganization(form.organizationId)}
getOptionLabel={(option) =>
option.name ?? findValueOrganization(form.organizationId).name ?? ''
}
onChange={(event, value) => handleOrganizationIdChange(index, value)}
renderInput={(params) => (
<TextField {...params} label="Rumah Sakit" variant="outlined" />
)}
/> */}
</Grid>
<Grid item xs={6}>
{form.specialities && (
// <Autocomplete
// multiple
// // options={specialities}
// options={specialities}
// value={findValueSpeciality(form.specialities) ?? ''}
// getOptionLabel={(option) => option.name}
// isOptionEqualToValue={(option, value) => option.value === value.value}
// onChange={(event, value) => handleSpecialitiesChange(index, value)}
// renderInput={(params) => (
// <TextField {...params} label="Spesialis" variant="outlined" />
// )}
// />
<Autocomplete
multiple
options={specialities}
value={findValueSpeciality(form.specialities)}
getOptionLabel={(option) => option.name}
onChange={(event, value) => handleSpecialitiesChange(index, value)}
renderInput={(params) => (
<TextField {...params} label="Spesialis" variant="outlined" />
)}
/>
)}
</Grid>
</Grid>
</Grid>
</Box>
))}
</Card>
<Card sx={{ p: 5, marginTop: 2 }}>
<Title variant="h5">Spesialisasi</Title>
{currentPractitioner?.specialities?.map((item, index) => (
<Box key={index} sx={{ mt: 3 }}>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Text>{item.name}</Text>
</Grid>
</Grid>
</Box>
</Box>
</div>
))}
</Card>
<Box sx={{ width: '100%', mt: 5 }}>
<Stack
alignItems="center"
justifyContent="end"
direction={{ xs: 'column', md: 'row' }}
sx={{ width: 1, textAlign: { xs: 'center', md: 'left' } }}
>
<Grid item xs={12} md={4}>
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)' }}
type="submit"
variant="contained"
size="large"
// fullWidth={true}
loading={isSubmitting}
>
{!isEdit ? 'Simpan' : 'Simpan Perubahan'}
</LoadingButton>
</Grid>
</Stack>
</Box>
</Box>
</Stack>
</FormProvider>

View File

@@ -57,6 +57,7 @@ import { Search } from '@mui/icons-material';
import { Icon } from '@iconify/react';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import AddIcon from '@mui/icons-material/Add';
// ----------------------------------------------------------------------
@@ -205,9 +206,16 @@ export default function List() {
spacing={2}
sx={{ p: 2, justifyContent: 'space-between', alignItems: 'center' }}
>
<Grid item xs={12} md={12} lg={12}>
<Grid item xs={12} md={10} lg={10}>
<Filter onSearch={applyItems} />
</Grid>
<Grid item xs={12} md={2} lg={2} sx={{ textAlign: 'right' }}>
<Link to="/master/doctors/create" style={{ textDecoration: 'none' }}>
<Button variant="outlined" startIcon={<AddIcon />} sx={{ p: 1.8 }}>
Create
</Button>
</Link>
</Grid>
</Grid>
);
}
@@ -297,15 +305,22 @@ export default function List() {
<CheckStatus row={row} />
</TableCell> */}
{/* <TableCell align="center">
<TableCell align="center">
<ButtonGroup variant="text" aria-label="text button group">
<Link to={'/master/doctors/' + row.id}>
<Link to={'/master/doctors/' + row.id + '/edit'}>
<Button>
<Icon icon="ph:eye-bold" style={{ width: '24px', height: '24px' }} />
<Icon icon="ph:pencil-simple-fill" style={{ width: '24px', height: '24px' }} />
</Button>
</Link>
<Button
onClick={() => {
setOpenDialog(true);
}}
>
<Icon icon="eva:trash-2-outline" style={{ width: '24px', height: '24px' }} />
</Button>
</ButtonGroup>
</TableCell> */}
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
<TableRow>
@@ -336,7 +351,12 @@ export default function List() {
Jenis Kelamin
</Grid>
<Grid item xs={6}>
: {row.gender ? row.gender : '-'}
:{' '}
{row.gender == 'male'
? 'Laki-Laki'
: row.gender == 'female'
? 'Perempuan'
: '-'}
</Grid>
</Grid>
</Grid>

View File

@@ -9,7 +9,6 @@ import Form from './Form';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import axios from '../../../utils/axios';
import { Organizations } from '../../../@types/organization';
import ButtonBack from '../../../components/ButtonBack';
export default function Create() {
const { themeStretch } = useSettings();
@@ -31,25 +30,20 @@ export default function Create() {
<Page title="Membership: Create a new Rumah Sakit">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center">
<ButtonBack />
<HeaderBreadcrumbs
heading={!isEdit ? 'Create a new Rumah Sakit' : 'Edit Rumah Sakit'}
links={[
{ name: 'Master', href: '/master' },
{
name: 'Organizations',
href: '/master/organizations',
href: '/master/hospitals',
},
{ name: !isEdit ? 'Create' : currentOrganizations?.name ?? '' },
]}
/>
</Stack>
<Form
// isSubmitting={isSubmitting}
isEdit={isEdit}
currentOrganizations={currentOrganizations}
/>
<Form isEdit={isEdit} currentOrganizations={currentOrganizations} />
</Container>
</Page>
);

View File

@@ -65,7 +65,6 @@ const LabelStyle = styled(Typography)(({ theme }) => ({
}));
const HeaderStyle = styled('header')(({ theme }) => ({
padding: theme.spacing(5),
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
@@ -76,7 +75,6 @@ const Title = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
// paddingBottom: theme.spacing(3),
fontWeight: 700,
color: '#005B7F',
}));
// const [timezone, setTimezone] = React.useState('');
@@ -110,10 +108,6 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
const NewCorporateSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
code: Yup.string().required('Corporate Code is required'),
active: Yup.boolean().required('Corporate Status is required'),
lat: Yup.string().required('Latitude is required'),
lng: Yup.string().required('Longitude is required'),
timezone: Yup.string().required('Timezone is required'),
// file: Yup.boolean().required('Corporate Status is required'),
});
@@ -133,12 +127,6 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
village_id: currentOrganizations?.village_id || '',
postal_code: currentOrganizations?.postal_code || '',
description: currentOrganizations?.description || '',
technology: currentOrganizations?.technology || '',
support_services: currentOrganizations?.support_services || '',
merchant_code: currentOrganizations?.merchant_code || '',
merchant_key: currentOrganizations?.merchant_key || '',
image_url: currentOrganizations?.image_url || '',
region_groups: currentOrganizations?.region_groups || '',
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[currentOrganizations]
@@ -192,25 +180,15 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isEdit, currentOrganizations]);
const currentImage = currentOrganizations?.image_url;
console.log('currentImage', currentImage);
console.log('current_image', currentImage);
const [file, setFile] = useState(null);
console.log('file', file);
const onSubmit = async (data: FormValuesProps) => {
try {
const formData = new FormData();
console.log('data', data);
formData.append('name', data.name);
formData.append('code', data.code);
formData.append('phone', data.phone);
formData.append('lat', data.lat);
formData.append('lng', data.lng);
formData.append('address', data.address);
formData.append('timezone', data.timezone);
formData.append('active', data.active ? '1' : '0');
if (data.province_id === currentOrganizations?.province_id) {
formData.append('province_id', data.province_id);
@@ -235,21 +213,12 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
} else {
formData.append('village_id', data.village_id?.value ?? '');
}
if (data.region_groups === currentOrganizations?.region_groups) {
formData.append('region_groups', data.region_groups);
} else {
formData.append('region_groups', data.region_groups?.value ?? '');
}
formData.append('postal_code', data.postal_code);
formData.append('description', data.description);
formData.append('technology', data.technology);
formData.append('support_services', data.support_services);
formData.append('merchant_code', data.merchant_code);
formData.append('merchant_key', data.merchant_key);
formData.append('image', file);
if (!isEdit) {
console.log('formData', formData);
const response = await axios.post('/organizations', formData);
} else {
formData.append('_method', 'PUT');
@@ -263,9 +232,10 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
!isEdit ? 'Organizations Created Successfully!' : 'Organizations Udpated Successfully!',
{ variant: 'success' }
);
navigate('/master/organizations');
navigate('/master/hospitals');
} catch (error: any) {
if (error && error.response.status === 422) {
console.log('error', error.response.data.errors);
for (const [key, value] of Object.entries(error.response.data.errors)) {
setError(key, { message: value[0] });
enqueueSnackbar(value[0] ?? 'Failed Processing Request', { variant: 'error' });
@@ -281,34 +251,10 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
}
};
const [valueTab, setValueTab] = React.useState('1');
const handleChangeTab = (event: React.SyntheticEvent, newValueTab: string) => {
setValueTab(newValueTab);
};
const handleDrop = useCallback(
(acceptedFiles) => {
setValue(
'logo',
acceptedFiles.map((file: Blob | MediaSource) =>
Object.assign(file, {
preview: URL.createObjectURL(file),
})
)
);
},
[setValue]
);
const handleRemove = (file: File | string) => {
setValue('logo', null);
};
const [province, setProvince] = useState<any>([]);
const [city, setCity] = useState<any>([]);
const [district, setDistrict] = useState<any>([]);
// const [village, setVillage] = useState<any>([]);
const [village, setVillage] = useState<any>([]);
useEffect(() => {
axios.get('/province').then((res) => {
@@ -335,17 +281,15 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
}
};
// if (values.province_id) {
// if (values.city_id) {
// loadDistrict();
// } else {
// loadCity();
// }
// } else {
// axios.get('/province').then((res) => {
// setProvince(res.data.data.map((item: any) => ({ value: item.id, label: item.name })));
// });
// }
const loadVillage = async () => {
if (values.district_id == currentOrganizations?.district_id) {
const res = await axios.get('/village?district_id=' + values.district_id);
setVillage(res.data.data.map((item: any) => ({ value: item.id, label: item.name })));
} else {
const res = await axios.get('/village?district_id=' + values.district_id?.value);
setVillage(res.data.data.map((item: any) => ({ value: item.id, label: item.name })));
}
};
if (values.province_id) {
loadCity();
@@ -354,12 +298,11 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
if (values.city_id) {
loadDistrict();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [values.province_id, values.city_id, values.district_id]);
console.log('province', values.province_id);
console.log('city', values.city_id);
console.log('district', values.district_id);
if (values.district_id) {
loadVillage();
}
}, [values.province_id, values.city_id, values.district_id, values.village_id]);
const findValueProvince = province.find(
(item: any) => item.value === currentOrganizations?.province_id
@@ -368,53 +311,8 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
const findValueDistrict = district.find(
(item: any) => item.value === currentOrganizations?.district_id
);
console.log('findValueProvince', findValueProvince);
console.log('findValueCity', findValueCity);
console.log('findValueDistrict', findValueDistrict);
const timezone = [
{
value: 'WIB',
label: 'WIB',
},
{
value: 'WITA',
label: 'WITA',
},
{
value: 'WIT',
label: 'WIT',
},
];
const region_groups = [
{
value: 'Jabodetabek',
label: 'Jabodetabek',
},
{
value: 'Jawa',
label: 'Jawa',
},
{
value: 'Kalimantan',
label: 'Kalimantan',
},
{
value: 'Papua',
label: 'Papua',
},
{
value: 'Sulawesi',
label: 'Sulawesi',
},
{
value: 'Sumatera',
label: 'Sumatera',
},
];
const findVaalueGroupWilayah = region_groups.find(
(item: any) => item.value === currentOrganizations?.region_groups
const findValueVillage = village.find(
(item: any) => item.value === currentOrganizations?.village_id
);
return (
@@ -431,326 +329,147 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
<StatusLabel value={values.active} />
</Grid>
</HeaderStyle>
<Box sx={{ width: '100%', typography: 'body1' }}>
<TabContext value={valueTab}>
<Box
sx={{
borderBottom: 1,
borderColor: 'divider',
backgroundColor: '#F4F6F8',
pl: 5,
pr: 5,
}}
>
<TabList onChange={handleChangeTab} aria-label="lab API tabs example">
<Tab label="Rumah Sakit" value="1" sx={{ pr: 5, pl: 5 }} />
<Tab label="Informasi" value="2" sx={{ pr: 5, pl: 5 }} />
<Tab label="Duitku Setting" value="3" sx={{ pr: 5, pl: 5 }} />
</TabList>
</Box>
<TabPanel value="1">
<Box sx={{ width: '100%', p: 5 }}>
<Grid container rowSpacing={4} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={12}>
<LabelStyle>Nama Rumah Sakit</LabelStyle>
<RHFTextField name="name" placeholder="Tuliskan Nama Rumah Sakit" />
</Grid>
<Grid item xs={12} md={12}>
<LabelStyle>Pilih Foto Rumah Sakit</LabelStyle>
<Box sx={{ width: '100%' }}>
<MyDropzone setFile={setFile} currentImage={currentImage} />
</Box>
</Grid>
<Grid item xs={12}>
<LabelStyle>Nomor IGD</LabelStyle>
<RHFTextField name="phone" placeholder="Tuliskan No IGD" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Code Rumah Sakit</LabelStyle>
<RHFTextField name="code" placeholder="Tuliskan Code Rumah Sakit" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Group Wilayah</LabelStyle>
<Controller
name="region_groups"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={region_groups}
getOptionLabel={(option) =>
option.label ?? findVaalueGroupWilayah?.label ?? ''
}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('region_groups', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField
{...params}
label="Group Wilayah"
variant="outlined"
fullWidth
/>
)}
/>
)}
/>
</Grid>
<Grid item xs={12}>
<LabelStyle>Alamat</LabelStyle>
<RHFTextField name="address" placeholder="Tuliskan Alamat" />
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Provinsi</LabelStyle>
{/*
<Controller
name="province_id"
control={control}
render={({ field: { onChange, value } }) => (
<Select
className="input-container"
size="medium"
disabled={!province?.length}
value={value}
onChange={(e: any) => {
onChange(e);
}}
fullWidth
MenuProps={{
PaperProps: {
sx: {
maxHeight: 224,
width: 250,
p: 1,
},
},
}}
>
{province?.map((item: any) => (
<MenuItem key={item.value} value={item.value}>
{item.label}
</MenuItem>
))}
</Select>
)}
/> */}
<Box sx={{ width: '100%', typography: 'body1', mt: 2 }}>
<Grid container rowSpacing={4} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={12}>
<LabelStyle>Nama Rumah Sakit</LabelStyle>
<RHFTextField name="name" placeholder="Tuliskan Nama Rumah Sakit" />
</Grid>
<Controller
name="province_id"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={province}
getOptionLabel={(option) =>
option.label ?? findValueProvince?.label ?? ''
}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('province_id', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField
{...params}
label="Provinsi"
variant="outlined"
fullWidth
/>
)}
/>
)}
/>
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Kabupaten / Kota</LabelStyle>
{/* <Controller
name="city_id"
control={control}
render={({ field: { onChange, value } }) => (
<Select
className="input-container"
size="medium"
disabled={!city?.length}
value={value}
onChange={(e: any) => {
onChange(e);
}}
fullWidth
MenuProps={{
PaperProps: {
sx: {
maxHeight: 224,
width: 250,
p: 1,
},
},
}}
>
{city?.map((item: any) => (
<MenuItem key={item.value} value={item.value}>
{item.label}
</MenuItem>
))}
</Select>
)}
/> */}
<Controller
name="city_id"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={city}
getOptionLabel={(option) => option.label ?? findValueCity?.label ?? ''}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('city_id', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField
{...params}
label="Kabupaten / Kota"
variant="outlined"
fullWidth
/>
)}
/>
)}
/>
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Code Rumah Sakit</LabelStyle>
<RHFTextField name="code" placeholder="Tuliskan Code Rumah Sakit" />
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Nomor IGD</LabelStyle>
<RHFTextField name="phone" placeholder="Tuliskan No IGD" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Alamat</LabelStyle>
<RHFTextField name="address" placeholder="Tuliskan Alamat" />
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Provinsi</LabelStyle>
<Grid item xs={12} md={6}>
<LabelStyle>Kecamatan</LabelStyle>
<Controller
name="province_id"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={province}
getOptionLabel={(option) => option.label ?? findValueProvince?.label ?? ''}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('province_id', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField {...params} label="Provinsi" variant="outlined" fullWidth />
)}
/>
)}
/>
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Kabupaten / Kota</LabelStyle>
{/* <Controller
name="district_id"
control={control}
render={({ field: { onChange, value } }) => (
<Select
className="input-container"
size="medium"
disabled={!district?.length}
value={value}
onChange={(e: any) => {
onChange(e);
}}
fullWidth
MenuProps={{
PaperProps: {
sx: {
maxHeight: 224,
width: 250,
p: 1,
},
},
}}
>
{district?.map((item: any) => (
<MenuItem key={item.value} value={item.value}>
{item.label}
</MenuItem>
))}
</Select>
)}
/> */}
<Controller
name="city_id"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={city}
getOptionLabel={(option) => option.label ?? findValueCity?.label ?? ''}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('city_id', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField
{...params}
label="Kabupaten / Kota"
variant="outlined"
fullWidth
/>
)}
/>
)}
/>
</Grid>
<Controller
name="district_id"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={district}
getOptionLabel={(option) =>
option.label ?? findValueDistrict?.label ?? ''
}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('district_id', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField
{...params}
label="Kecamatan"
variant="outlined"
fullWidth
/>
)}
/>
)}
/>
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Kode Pos</LabelStyle>
<RHFTextField name="postal_code" placeholder="Tuliskan Kode Pos" />
</Grid>
<Grid item xs={12} md={4}>
<LabelStyle>Latitude</LabelStyle>
<RHFTextField name="lat" placeholder="Tuliskan Lattitude" />
</Grid>
<Grid item xs={12} md={4}>
<LabelStyle>Longitude</LabelStyle>
<RHFTextField name="lng" placeholder="Tuliskan Longitude" />
</Grid>
<Grid item xs={12} md={4}>
<LabelStyle>Timezone</LabelStyle>
{/* <RHFTextField name="timezone" /> */}
<RHFSelect name="timezone" label="Pilih Timezone">
<option value="" />
{timezone.map((option, index) => (
<option key={index} value={option.value}>
{option.label}
</option>
))}
</RHFSelect>
</Grid>
</Grid>
</Box>
</TabPanel>
<TabPanel value="2">
<Box sx={{ width: '100%', p: 5 }}>
<Grid container rowSpacing={4} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={12}>
<LabelStyle>Deskripsi</LabelStyle>
<RHFEditor name="description" placeholder="Tuliskan Deskripsi" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Teknologi</LabelStyle>
<RHFEditor name="technology" placeholder="Tuliskan Teknologi" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Layanan Penunjang</LabelStyle>
<RHFEditor name="support_services" placeholder="Tuliskan Layanan Penunjang" />
</Grid>
</Grid>
</Box>
</TabPanel>
<TabPanel value="3">
<Box sx={{ width: '100%', p: 5 }}>
<Grid container rowSpacing={4} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={12}>
<LabelStyle>Merchant Code</LabelStyle>
<RHFTextField name="merchant_code" placeholder="Tuliskan Merchant Code" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Merchant Key</LabelStyle>
<RHFTextField name="merchant_key" placeholder="Tuliskan Merchant Key" />
</Grid>
</Grid>
</Box>
</TabPanel>
</TabContext>
<Grid item xs={12} md={6}>
<LabelStyle>Kecamatan</LabelStyle>
<Controller
name="district_id"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={district}
getOptionLabel={(option) => option.label ?? findValueDistrict?.label ?? ''}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('district_id', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField {...params} label="Kecamatan" variant="outlined" fullWidth />
)}
/>
)}
/>
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Desa</LabelStyle>
<Controller
name="village_id"
control={control}
render={({ field: { onChange, value } }) => (
<Autocomplete
id="combo-box-demo"
options={village}
getOptionLabel={(option) => option.label ?? findValueVillage?.label ?? ''}
value={value}
onChange={(event: any, newValue: any) => {
console.log('newValue', newValue);
setValue('village_id', newValue?.value);
onChange(newValue);
}}
renderInput={(params) => (
<TextField {...params} label="Desa" variant="outlined" fullWidth />
)}
/>
)}
/>
</Grid>
<Grid item xs={12} md={4}>
<LabelStyle>Kode Pos</LabelStyle>
<RHFTextField name="postal_code" placeholder="Tuliskan Kode Pos" />
</Grid>
<Grid item xs={12} md={4}>
<LabelStyle>Latitude</LabelStyle>
<RHFTextField name="lat" placeholder="Tuliskan Lattitude" />
</Grid>
<Grid item xs={12} md={4}>
<LabelStyle>Longitude</LabelStyle>
<RHFTextField name="lng" placeholder="Tuliskan Longitude" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Deskripsi</LabelStyle>
<RHFEditor name="description" placeholder="Tuliskan Deskripsi" />
</Grid>
</Grid>
</Box>
<Box sx={{ width: '100%', p: 5 }}>
<Box sx={{ width: '100%', mt: 5 }}>
<Stack
alignItems="center"
justifyContent="end"

View File

@@ -23,7 +23,7 @@ export default function Organizations() {
},
{
name: 'Rumah Sakit',
href: '/master/organizations',
href: '/master/hospitals',
},
]}
/>

View File

@@ -147,9 +147,11 @@ export default function List() {
>
<SearchInput onSearch={applyFilter} />
{/* <Link to="/master/organizations/create/" style={{ textDecoration: 'none' }}>
<ButtonCreate />
</Link> */}
<Link to="/master/hospitals/create" style={{ textDecoration: 'none' }}>
<Button variant="outlined" startIcon={<AddIcon />} sx={{ p: 1.8 }}>
Create
</Button>
</Link>
</Stack>
);
}
@@ -259,26 +261,26 @@ export default function List() {
</TableCell>
<TableCell align="left">{row.name}</TableCell>
<TableCell align="left">{row.phone}</TableCell>
<TableCell align="left">{row.address?.text}</TableCell>
<TableCell align="left">{row.address}</TableCell>
{/* <TableCell align="left">
<Stack direction="row">
<ButtonGroup variant="text" aria-label="text button group">
<Link to={'/master/organizations/' + row.id + '/edit'}>
<Button>
<Icon icon="ph:pencil-simple-fill" style={{ width: '24px', height: '24px' }} />
</Button>
</Link>
<Button
onClick={() => {
setOpenDialog(true);
}}
>
<Icon icon="eva:trash-2-outline" style={{ width: '24px', height: '24px' }} />
<TableCell align="right">
{/* <Stack direction="row"> */}
<ButtonGroup variant="text" aria-label="text button group">
<Link to={'/master/hospitals/' + row.id + '/edit'}>
<Button>
<Icon icon="ph:pencil-simple-fill" style={{ width: '24px', height: '24px' }} />
</Button>
</ButtonGroup>
</Stack>
</TableCell> */}
</Link>
<Button
onClick={() => {
setOpenDialog(true);
}}
>
<Icon icon="eva:trash-2-outline" style={{ width: '24px', height: '24px' }} />
</Button>
</ButtonGroup>
{/* </Stack> */}
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}

View File

@@ -0,0 +1,93 @@
import { useEffect, useState } from 'react';
import { paramCase } from 'change-case';
import { useParams, useLocation } from 'react-router-dom';
// @mui
import { Container, Stack } from '@mui/material';
import useSettings from '../../../hooks/useSettings';
import Page from '../../../components/Page';
import Form from './Form';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import axios from '../../../utils/axios';
import { Practitioner } from '../../../@types/doctor';
import ButtonBack from '../../../components/ButtonBack';
export default function Create() {
const { themeStretch } = useSettings();
const { id } = useParams();
const isEdit = id ? true : false;
const [currentPractitioner, setCurrentPractitioner] = useState<Practitioner>();
useEffect(() => {
if (isEdit) {
axios.get('/doctors/' + id).then((res) => {
setCurrentPractitioner(res.data);
});
}
}, [id]);
return (
<Page title="Membership: Create a new Dokter">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center">
{/* <ButtonBack /> */}
<HeaderBreadcrumbs
heading={!isEdit ? 'Manage a new Dokter' : 'Manage Dokter'}
links={[
{ name: 'Master', href: '/master' },
{
name: 'Doctors',
href: '/master/doctors',
},
{ name: !isEdit ? 'Create' : currentPractitioner?.name ?? '' },
]}
/>
</Stack>
<Form
// isSubmitting={isSubmitting}
isEdit={isEdit}
currentPractitioner={currentPractitioner}
/>
</Container>
</Page>
);
}
// const pageTitle = 'Create Data Dokter';
// return (
// <Page title={pageTitle}>
// <Container maxWidth={themeStretch ? false : 'xl'}>
// <HeaderBreadcrumbs
// heading={pageTitle}
// links={[
// {
// name: 'Master',
// href: '/master',
// },
// {
// name: 'Dokter',
// href: '/master/organizations/',
// },
// {
// name: 'Create',
// href: '/master/organizations/create/',
// },
// ]}
// />
// <Grid container spacing={2}>
// <Grid item xs={12}>
// <Card sx={{ p: 2 }}>
// <Form
// isSubmitting={isSubmitting}
// isEdit={isEdit}
// currentOrganizations={currentOrganizations}
// />
// </Card>
// </Grid>
// </Grid>
// </Container>
// </Page>
// );
// }

View File

@@ -0,0 +1,260 @@
import * as Yup from 'yup';
import { useSnackbar } from 'notistack';
import { useNavigate } from 'react-router-dom';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import MenuItem from '@mui/material/MenuItem';
import Select, { SelectChangeEvent } from '@mui/material/Select';
import * as React from 'react';
// form
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
// @mui
import { styled } from '@mui/material/styles';
import { LoadingButton } from '@mui/lab';
import {
Box,
Avatar,
Button,
ButtonGroup,
Card,
FormHelperText,
Grid,
Stack,
Typography,
TextField,
Chip,
} from '@mui/material';
import CancelIcon from '@mui/icons-material/Cancel';
// components
import {
FormProvider,
RHFTextField,
RHFRadioGroup,
RHFUploadAvatar,
RHFSwitch,
RHFEditor,
RHFDatepicker,
RHFMultiCheckbox,
RHFCheckbox,
RHFCustomMultiCheckbox,
} from '../../../components/hook-form';
import axios from '../../../utils/axios';
import { fCurrency } from '../../../utils/formatNumber';
import { Practitioner } from '../../../@types/doctor';
import { Label, Rowing } from '@mui/icons-material';
const LabelStyle = styled(Typography)(({ theme }) => ({
...theme.typography.subtitle2,
color: theme.palette.text.secondary,
marginBottom: theme.spacing(1),
}));
const HeaderStyle = styled('header')(({ theme }) => ({
paddingBottom: theme.spacing(5),
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}));
const Title = styled(Typography)(({ theme }) => ({
...theme.typography.h4,
boxShadow: 'none',
// paddingBottom: theme.spacing(3),
fontWeight: 700,
color: '#005B7F',
}));
interface FormValuesProps extends Partial<Practitioner> {
taxes: boolean;
inStock: boolean;
}
type Props = {
isEdit: boolean;
currentPractitioner?: Practitioner;
};
const Span = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(1),
}));
const Text = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(3),
}));
export default function PractitionerForm({ isEdit, currentPractitioner }: Props) {
const navigate = useNavigate();
const [practitioner_group, setPractitionerGroups] = useState([]);
// const [ errors, setErrors ] = useState<{ [key: string]: string }>({});
const { enqueueSnackbar } = useSnackbar();
const NewCorporateSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
// file: Yup.boolean().required('Corporate Status is required'),
});
const defaultValues = useMemo(
() => ({
id: currentPractitioner?.id,
name: currentPractitioner?.name || '',
address: currentPractitioner?.address || '',
birth_date: currentPractitioner?.birth_date || '',
gender: currentPractitioner?.gender || '',
description: currentPractitioner?.description || '',
birth_place: currentPractitioner?.birth_place || '',
active: currentPractitioner?.active === 1 ? true : false,
avatar_url: currentPractitioner?.avatar_url || '',
doctor_id: currentPractitioner?.doctor_id || '',
organizations: currentPractitioner?.organizations || [],
specialities: currentPractitioner?.specialities || [],
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[currentPractitioner]
);
console.log('defaultValues', defaultValues);
function StatusLabel({ value }: { value: boolean }) {
return (
<Chip
label={value ? 'Aktif' : 'Tidak Aktif'}
size="medium"
sx={{
backgroundColor: value ? 'rgba(84, 214, 44, 0.16)' : 'rgba(255, 72, 66, 0.16)',
color: value ? '#229A16' : '#B72136',
padding: '1 8 1 8 px',
borderRadius: '4px',
fontSize: '12px',
fontWeight: 'bold',
}}
/>
);
}
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
defaultValues,
});
const {
reset,
watch,
control,
setValue,
getValues,
setError,
handleSubmit,
formState: { isSubmitting },
} = methods;
const values = watch();
useEffect(() => {
if (isEdit && currentPractitioner) {
reset(defaultValues);
}
if (!isEdit) {
reset(defaultValues);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isEdit, currentPractitioner]);
const handleActivate = (event: React.ChangeEvent<HTMLInputElement>) => {
setValue('active', event.target.checked);
console.log('event.target.checked', event.target.checked);
const formData = new FormData();
formData.append('active', event.target.checked ? '1' : '0');
formData.append('_method', 'PUT');
axios.post('/doctors/' + currentPractitioner?.id ?? '', formData);
enqueueSnackbar('active Updated Successfully!', { variant: 'success' });
};
return (
<FormProvider methods={methods}>
<Stack spacing={3}>
<Box sx={{ width: '100%' }}>
{/* <Stack spacing={3}> */}
<Card sx={{ p: 5 }}>
<HeaderStyle>
<Grid item xs={6} md={6}>
<Title>Data Dokter</Title>
</Grid>
<Grid item xs={6} md={6}>
{/* <Typography>Status Rumah Sakit</Typography> */}
<RHFSwitch name="active" label="" onClick={handleActivate} />
<StatusLabel value={values.active} />
</Grid>
</HeaderStyle>
<Title variant="h5">Informasi Umum</Title>
<Avatar
alt="Remy Sharp"
src={currentPractitioner?.avatar_url}
sx={{ width: 120, height: 120, marginBottom: 2 }}
/>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Span style={{ fontWeight: 'bold' }}>Nama Dokter</Span>
<Text>{currentPractitioner?.name ? currentPractitioner?.name : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>No Telp</Span>
<Text>{currentPractitioner?.phone ? currentPractitioner?.phone : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Tempat Lahir</Span>
<Text>
{currentPractitioner?.birth_place ? currentPractitioner?.birth_place : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Alamat</Span>
<Text>{currentPractitioner?.address ? currentPractitioner?.address : '-'}</Text>
</Grid>
<Grid item xs={5} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Span style={{ fontWeight: 'bold' }}>Jenis Kelamin</Span>
<Text>{currentPractitioner?.gender ? currentPractitioner?.gender : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Email</Span>
<Text>{currentPractitioner?.email ? currentPractitioner?.email : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Tanggal Lahir</Span>
<Text>
{currentPractitioner?.birth_date ? currentPractitioner?.birth_date : '-'}
</Text>
</Grid>
</Grid>
</Card>
<Card sx={{ p: 5, marginTop: 2 }}>
<Title variant="h5">Tempat Praktik</Title>
{currentPractitioner?.organizations?.map((item, index) => (
<Box key={index} sx={{ mt: 3 }}>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Text>{item.name}</Text>
</Grid>
</Grid>
</Box>
))}
</Card>
<Card sx={{ p: 5, marginTop: 2 }}>
<Title variant="h5">Spesialisasi</Title>
{currentPractitioner?.specialities?.map((item, index) => (
<Box key={index} sx={{ mt: 3 }}>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Text>{item.name}</Text>
</Grid>
</Grid>
</Box>
))}
</Card>
</Box>
</Stack>
</FormProvider>
);
}

View File

@@ -0,0 +1,35 @@
import { Card, Grid, Container } from '@mui/material';
import { useParams } from 'react-router-dom';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import Page from '../../../components/Page';
import useSettings from '../../../hooks/useSettings';
import List from './List';
export default function Doctors() {
const { themeStretch } = useSettings();
const { id } = useParams();
const pageTitle = 'Appointments';
return (
<Page title={pageTitle}>
<Container maxWidth={themeStretch ? false : 'xl'}>
<HeaderBreadcrumbs
heading={pageTitle}
links={[
{
name: 'Report',
href: '/report',
},
{
name: 'Appointments',
href: '/report/appointments',
},
]}
/>
<List />
</Container>
</Page>
);
}

View File

@@ -0,0 +1,416 @@
import {
Box,
Button,
Card,
Collapse,
Paper,
Select,
SelectChangeEvent,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
TextField,
Typography,
Stack,
ButtonGroup,
Grid,
Chip,
Dialog,
DialogContent,
DialogContentText,
DialogActions,
FormControl,
Autocomplete,
InputAdornment,
IconButton,
} from '@mui/material';
import {
Link,
NavLink as RouterLink,
useSearchParams,
useNavigate,
useParams,
} from 'react-router-dom';
// hooks
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
import useSettings from '../../../hooks/useSettings';
// components
import axios from '../../../utils/axios';
import { LaravelPaginatedData } from '../../../@types/paginated-data';
import { Icd } from '../../../@types/diagnosis';
import BasePagination from '../../../components/BasePagination';
import { Practitioner } from '../../../@types/doctor';
import CreateIcon from '@mui/icons-material/Create';
import { Props } from '../../../components/editor/index';
import { red } from '@mui/material/colors';
import { margin, padding } from '@mui/system';
import { enqueueSnackbar } from 'notistack';
import { Controller } from 'react-hook-form';
import SvgIconStyle from '../../../components/SvgIconStyle';
import { GridSearchIcon } from '@mui/x-data-grid';
import { Search } from '@mui/icons-material';
import { Icon } from '@iconify/react';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
// ----------------------------------------------------------------------
export default function List() {
// Generate the every row of the table
const navigate = useNavigate();
const { organization_id } = useParams();
const [searchParams, setSearchParams] = useSearchParams();
const [searchParamsOrganizations, setSearchParamsOrganizations] = useSearchParams();
const [searchParamsSpecialities, setSearchParamsSpecialities] = useSearchParams();
const [searchParamsFilter, setSearchParamsFilter] = useSearchParams();
function Filter(props: any) {
// SEARCH
const searchInput = useRef<HTMLInputElement>(null);
const [searchText, setSearchText] = useState('');
//handle search
const handleSearchChange = (event: any) => {
const newSearchText = event.target.value ?? '';
setSearchText(newSearchText);
};
const handleSearchSubmit = (event: any) => {
event.preventDefault();
props.onSearch(searchText);
};
useEffect(() => {
// Trigger First Search
setSearchText(searchParams.get('search') ?? '');
}, []);
const item = [
{
id: '',
value: '',
name: 'Semua',
},
];
return (
<form style={{ width: '100%' }}>
<Grid container spacing={2} sx={{ justifyContent: 'space-between', alignItems: 'center' }}>
<Grid item xs={12} sm={12} md={12} lg={12}>
<TextField
id="search-input"
ref={searchInput}
variant="outlined"
fullWidth
onChange={handleSearchChange}
onKeyDown={(event) => {
if (event.key === 'Enter') {
handleSearchSubmit(event);
}
}}
value={searchText}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<Search />
</InputAdornment>
),
placeholder: 'Search',
}}
/>
</Grid>
</Grid>
</form>
);
}
function FilterForm(props: any) {
// IMPORT
return (
<Grid
container
spacing={2}
sx={{ p: 2, justifyContent: 'space-between', alignItems: 'center' }}
>
<Grid item xs={12} md={12} lg={12}>
<Filter onSearch={applyItems} />
</Grid>
</Grid>
);
}
function createData(doctor: Practitioner): Practitioner {
return {
...doctor,
};
}
function Row(props: { row: ReturnType<typeof createData> }) {
const { row } = props;
const [open, setOpen] = React.useState(false);
const [openDialog, setOpenDialog] = React.useState(false);
const handleDelete = (model: any) => {
axios
.delete(`/doctors/${row.id}`)
.then((res) => {
setDataTableData({
...dataTableData,
data: dataTableData.data.filter((model) => model.id != row.id),
});
enqueueSnackbar('Data berhasil dihapus', { variant: 'success' });
})
.catch((error) => {
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
};
return (
<React.Fragment>
<TableRow>
<TableCell>
<IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)}>
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
</TableCell>
<TableCell align="left">{row.date_created ? row.date_created : '-'}</TableCell>
<TableCell align="left">{row.date_appointment ? row.date_appointment : '-'}</TableCell>
<TableCell align="left">{row.booking_code ?? '-'}</TableCell>
<TableCell align="left">{row.patient_name ? row.patient_name : '-'}</TableCell>
<TableCell align="left">{row.health_care ? row.health_care : '-'}</TableCell>
<TableCell align="left">{row.doctor_name ? row.doctor_name : '-'}</TableCell>
<TableCell align="left">{row.type ? row.type : '-'}</TableCell>
<TableCell align="left">{row.status ? row.status : '-'}</TableCell>
<TableCell align="center">
<ButtonGroup variant="text" aria-label="text button group">
<Link to={'/report/appointments/' + row.id + '/show'}>
<Button>
<Icon icon="ph:eye-bold" style={{ width: '24px', height: '24px' }} />
</Button>
</Link>
</ButtonGroup>
</TableCell>
</TableRow>
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={15}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Stack>
<Grid container>
<Grid item xs={2}>Spesialisasi</Grid><Grid item xs="10">: {row.speciality}</Grid>
<Grid item xs={2}>Via</Grid><Grid item xs="10">: {row.appointment_media}</Grid>
<Grid item xs={2}>Metode Pembayaran</Grid><Grid item xs="10">: {row.payment_method}</Grid>
<Grid item xs={2}>HIS RegID</Grid><Grid item xs="10">: {row.his_detail?.sRegID}</Grid>
<Grid item xs={2}>HIS Medrec</Grid><Grid item xs="10">: {row.his_detail?.Medrec}</Grid>
<Grid item xs={2}>No HP</Grid><Grid item xs="10">: {row.patient.sPhone ?? ''}</Grid>
<Grid item xs={2}>E-mail</Grid><Grid item xs="10">: {row.patient.sEmail ?? ''}</Grid>
<Grid item xs={2}>Alamat</Grid><Grid item xs="10">: {row.patient.detail.sAlamat ?? ''}</Grid>
<Grid item xs={2}>KTP</Grid><Grid item xs="10">: {row.patient.detail.sKTP ?? ''}</Grid>
</Grid>
</Stack>
</Collapse>
</TableCell>
</TableRow>
<Dialog
open={openDialog}
onClose={() => {
setOpenDialog(false);
}}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogContent sx={{ p: 5 }}>
<Icon
icon="eva:trash-2-outline"
style={{
width: '100px',
height: '100px',
color: '#FF0000',
margin: 'auto',
display: 'block',
marginBottom: '20px',
alignContent: 'center',
}}
/>
<DialogContentText sx={{ fontWeight: 'bold', pb: 1 }} id="alert-dialog-title">
Apakah anda yakin ingin menghapus
</DialogContentText>
<Typography sx={{ fontWeight: 'bold' }} id="alert-dialog-title">
{row.name}?
</Typography>
</DialogContent>
<DialogActions>
<Button
onClick={() => {
setOpenDialog(false);
}}
color="primary"
>
Batal
</Button>
<Button
onClick={() => {
handleDelete(row.id);
}}
color="primary"
autoFocus
>
Hapus
</Button>
</DialogActions>
</Dialog>
</React.Fragment>
);
}
const headStyle = {
fontWeight: 'bold',
};
// Dummy Default Data
const [dataTableIsLoading, setDataTableLoading] = useState(true);
const [dataTableLastRequest, setDataTableLastRequest] = useState(0);
const [dataTableResponseState, setDataTableResponseState] = useState('idle');
const [dataTableData, setDataTableData] = useState<LaravelPaginatedData>({
current_page: 1,
data: [],
path: '',
first_page_url: '',
last_page: 1,
last_page_url: '',
next_page_url: '',
prev_page_url: '',
per_page: 10,
from: 0,
to: 0,
total: 0,
});
const [dataTablePage, setDataTablePage] = useState(5);
const loadDataTableData = async (appliedFilter: any | null = null) => {
setDataTableLoading(true);
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
const response = await axios.get('/appointments', {
params: filter,
});
setDataTableLoading(false);
setDataTableData(response.data);
};
// const applyFilter = async (searchFilter: string) => {
// await loadDataTableData({ search: searchFilter });
// setSearchParams({ search: searchFilter });
// };
const applyItems = async (
searchFilter: string,
searchFilterOrganization: string,
searchFilterSpecialities: string
) => {
await loadDataTableData({
search: searchFilter,
organization_id: searchFilterOrganization,
speciality_id: searchFilterSpecialities,
});
setSearchParamsFilter({
search: searchFilter,
organization_id: searchFilterOrganization,
speciality_id: searchFilterSpecialities,
});
};
const handlePageChange = (event: ChangeEvent, value: number) => {
const filter = Object.fromEntries([...searchParams.entries(), ['page', value]]);
loadDataTableData(filter);
setSearchParams(filter);
};
useEffect(() => {
loadDataTableData();
}, []);
return (
<Stack>
{/* <Ambulace /> */}
<Card sx={{ marginTop: '30px' }}>
<FilterForm sx={{ marginTop: '100px' }} />
{/* The Main Table */}
<TableContainer component={Paper}>
<Table>
<TableBody>
<TableRow>
<TableCell style={headStyle} align="left" />
<TableCell style={headStyle} align="left">
Tanggal Pemesanan
</TableCell>
<TableCell style={headStyle} align="left">
Tanggal Appointment
</TableCell>
<TableCell style={headStyle} align="left">
Kode Booking
</TableCell>
<TableCell style={headStyle} align="left">
Pasien
</TableCell>
<TableCell style={headStyle} align="left">
Faskes
</TableCell>
<TableCell style={headStyle} align="left">
Dokter
</TableCell>
<TableCell style={headStyle} align="left">
Jenis
</TableCell>
<TableCell style={headStyle} align="left">
Status Appointment
</TableCell>
<TableCell style={headStyle} align="left" />
{/* <TableCell style={headStyle} align="center">
Aksi
</TableCell> */}
</TableRow>
</TableBody>
{dataTableIsLoading ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align="center">
Loading
</TableCell>
</TableRow>
</TableBody>
) : dataTableData.data.length == 0 ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align="center">
No Data
</TableCell>
</TableRow>
</TableBody>
) : (
<TableBody>
{dataTableData.data.map((row) => (
<Row key={row.id} row={row} />
))}
</TableBody>
)}
</Table>
</TableContainer>
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
</Card>
</Stack>
);
}

View File

@@ -0,0 +1,53 @@
import { useEffect, useState } from 'react';
import { paramCase } from 'change-case';
import { useParams, useLocation } from 'react-router-dom';
// @mui
import { Container, Stack } from '@mui/material';
import useSettings from '../../../hooks/useSettings';
import Page from '../../../components/Page';
import View from './View';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import axios from '../../../utils/axios';
import { Appointment } from '../../../@types/doctor';
export default function Create() {
const { themeStretch } = useSettings();
const { id } = useParams();
const isEdit = id ? true : false;
const [currentAppointment, setCurrentAppointment] = useState<Appointment>();
useEffect(() => {
if (isEdit) {
axios.get('/appointments/' + id).then((res) => {
setCurrentAppointment(res.data);
});
}
}, [id]);
return (
<Page title="Appointment">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center">
<HeaderBreadcrumbs
heading={!isEdit ? 'Appointment' : 'Appointment'}
links={[
{ name: 'Report', href: '/report' },
{
name: 'Appointments',
href: '/report/appointments',
},
]}
/>
</Stack>
<View
// isSubmitting={isSubmitting}
isEdit={isEdit}
currentAppointment={currentAppointment}
/>
</Container>
</Page>
);
}

View File

@@ -0,0 +1,275 @@
import * as Yup from 'yup';
import { useSnackbar } from 'notistack';
import { useNavigate } from 'react-router-dom';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import MenuItem from '@mui/material/MenuItem';
import Select, { SelectChangeEvent } from '@mui/material/Select';
import * as React from 'react';
// form
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
// @mui
import { styled } from '@mui/material/styles';
import { LoadingButton } from '@mui/lab';
import {
Box,
Avatar,
Button,
ButtonGroup,
Card,
FormHelperText,
Grid,
Stack,
Typography,
TextField,
Chip,
Badge,
Divider,
} from '@mui/material';
import CancelIcon from '@mui/icons-material/Cancel';
// components
import {
FormProvider,
RHFTextField,
RHFRadioGroup,
RHFUploadAvatar,
RHFSwitch,
RHFEditor,
RHFDatepicker,
RHFMultiCheckbox,
RHFCheckbox,
RHFCustomMultiCheckbox,
} from '../../../components/hook-form';
import axios from '../../../utils/axios';
import { fCurrency } from '../../../utils/formatNumber';
import { Appointment } from '../../../@types/doctor';
import { Label, Rowing, Spa } from '@mui/icons-material';
import { border } from '@mui/system';
const LabelStyle = styled(Typography)(({ theme }) => ({
...theme.typography.subtitle2,
color: theme.palette.text.secondary,
marginBottom: theme.spacing(1),
}));
const HeaderStyle = styled('header')(({ theme }) => ({
paddingBottom: theme.spacing(5),
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}));
const Title = styled(Typography)(({ theme }) => ({
...theme.typography.h4,
boxShadow: 'none',
// paddingBottom: theme.spacing(3),
fontWeight: 700,
color: '#005B7F',
}));
interface FormValuesProps extends Partial<Appointment> {
taxes: boolean;
inStock: boolean;
}
type Props = {
isEdit: boolean;
currentAppointment?: Appointment;
};
const Span = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(1),
}));
const Text = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(3),
}));
export default function AppointmentForm({ isEdit, currentAppointment }: Props) {
const navigate = useNavigate();
// const [ errors, setErrors ] = useState<{ [key: string]: string }>({});
const { enqueueSnackbar } = useSnackbar();
const NewCorporateSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
// file: Yup.boolean().required('Corporate Status is required'),
});
const defaultValues = useMemo(
() => ({
id: currentAppointment?.id,
name: currentAppointment?.name || '',
address: currentAppointment?.address || '',
birth_date: currentAppointment?.birth_date || '',
gender: currentAppointment?.gender || '',
description: currentAppointment?.description || '',
birth_place: currentAppointment?.birth_place || '',
active: currentAppointment?.active === 1 ? true : false,
avatar_url: currentAppointment?.avatar_url || '',
doctor_id: currentAppointment?.doctor_id || '',
organizations: currentAppointment?.organizations || [],
specialities: currentAppointment?.specialities || [],
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[currentAppointment]
);
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
defaultValues,
});
const {
reset,
watch,
control,
setValue,
getValues,
setError,
handleSubmit,
formState: { isSubmitting },
} = methods;
const values = watch();
useEffect(() => {
if (isEdit && currentAppointment) {
reset(defaultValues);
}
if (!isEdit) {
reset(defaultValues);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isEdit, currentAppointment]);
return (
<FormProvider methods={methods}>
<Stack spacing={3}>
<Box sx={{ width: '100%' }}>
{/* <Stack spacing={3}> */}
<Card sx={{ p: 5 }}>
<HeaderStyle>
<Grid item xs={6} md={6}>
<Stack
direction="row"
divider={<Divider orientation="vertical" flexItem />}
spacing={2}
>
<Title>Data Appointment</Title>
<Chip label={currentAppointment?.status} variant="outlined" />
</Stack>
</Grid>
</HeaderStyle>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={12}>
<Stack direction="row" spacing={2}>
<Grid item xs={6}>
<Stack direction="row" spacing={2}>
<Span style={{ fontWeight: 'bold' }}>Tanggal Booking :</Span>
<Text>
{currentAppointment?.date_created ? currentAppointment?.date_created : '-'}
</Text>
</Stack>
</Grid>
<Grid item xs={6}>
<Stack direction="row" spacing={2}>
<Span style={{ fontWeight: 'bold' }}>Tanggal Appointment :</Span>
<Text>
{currentAppointment?.date_appointment
? currentAppointment?.date_appointment
: '-'}
</Text>
</Stack>
</Grid>
</Stack>
</Grid>
<Grid item xs={6}>
<Span style={{ fontWeight: 'bold' }}>Nama Dokter</Span>
<Text>
{currentAppointment?.doctor_name ? currentAppointment?.doctor_name : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Faskes</Span>
<Text>
{currentAppointment?.health_care ? currentAppointment?.health_care : '-'}
</Text>
</Grid>
<Grid item xs={6} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Span style={{ fontWeight: 'bold' }}>Spesialis</Span>
<Text>{currentAppointment?.speciality ? currentAppointment?.speciality : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Appointment Via Web/App</Span>
<Text>
{currentAppointment?.appointment_media
? currentAppointment?.appointment_media
: '-'}
</Text>
</Grid>
</Grid>
</Card>
<Card sx={{ mt: 5, p: 5 }}>
<HeaderStyle>
<Grid item xs={6} md={6}>
<Title>Data Pembayaran</Title>
</Grid>
</HeaderStyle>
{currentAppointment?.payment_detail !== null ? (
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={6}>
<Span style={{ fontWeight: 'bold' }}>Metode Pembayaran</Span>
<Text>
{currentAppointment?.payment_method ? currentAppointment?.payment_method : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Harga</Span>
<Text>
{currentAppointment?.payment_detail?.gross_amount
? currentAppointment?.payment_detail?.gross_amount
: '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Mata Uang</Span>
<Text>
{currentAppointment?.payment_detail?.currency
? currentAppointment?.payment_detail?.currency
: '-'}
</Text>
</Grid>
<Grid item xs={6} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Span style={{ fontWeight: 'bold' }}>Tipe Pembayaran</Span>
<Text>
{currentAppointment?.payment_detail?.payment_type
? currentAppointment?.payment_detail?.payment_type
: '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Waktu Transaksi</Span>
<Text>
{currentAppointment?.payment_detail?.transaction_time
? currentAppointment?.payment_detail?.transaction_time
: '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Status</Span>
<Text>
{currentAppointment?.payment_detail?.status_message
? currentAppointment?.payment_detail?.status_message
: '-'}
</Text>
</Grid>
</Grid>
) : (
<Span>Belum ada pembayaran</Span>
)}
</Card>
</Box>
</Stack>
</FormProvider>
);
}

View File

@@ -0,0 +1,93 @@
import { useEffect, useState } from 'react';
import { paramCase } from 'change-case';
import { useParams, useLocation } from 'react-router-dom';
// @mui
import { Container, Stack } from '@mui/material';
import useSettings from '../../../hooks/useSettings';
import Page from '../../../components/Page';
import Form from './Form';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import axios from '../../../utils/axios';
import { Practitioner } from '../../../@types/doctor';
import ButtonBack from '../../../components/ButtonBack';
export default function Create() {
const { themeStretch } = useSettings();
const { id } = useParams();
const isEdit = id ? true : false;
const [currentPractitioner, setCurrentPractitioner] = useState<Practitioner>();
useEffect(() => {
if (isEdit) {
axios.get('/doctors/' + id).then((res) => {
setCurrentPractitioner(res.data);
});
}
}, [id]);
return (
<Page title="Membership: Create a new Dokter">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center">
{/* <ButtonBack /> */}
<HeaderBreadcrumbs
heading={!isEdit ? 'Manage a new Dokter' : 'Manage Dokter'}
links={[
{ name: 'Master', href: '/master' },
{
name: 'Doctors',
href: '/master/doctors',
},
{ name: !isEdit ? 'Create' : currentPractitioner?.name ?? '' },
]}
/>
</Stack>
<Form
// isSubmitting={isSubmitting}
isEdit={isEdit}
currentPractitioner={currentPractitioner}
/>
</Container>
</Page>
);
}
// const pageTitle = 'Create Data Dokter';
// return (
// <Page title={pageTitle}>
// <Container maxWidth={themeStretch ? false : 'xl'}>
// <HeaderBreadcrumbs
// heading={pageTitle}
// links={[
// {
// name: 'Master',
// href: '/master',
// },
// {
// name: 'Dokter',
// href: '/master/organizations/',
// },
// {
// name: 'Create',
// href: '/master/organizations/create/',
// },
// ]}
// />
// <Grid container spacing={2}>
// <Grid item xs={12}>
// <Card sx={{ p: 2 }}>
// <Form
// isSubmitting={isSubmitting}
// isEdit={isEdit}
// currentOrganizations={currentOrganizations}
// />
// </Card>
// </Grid>
// </Grid>
// </Container>
// </Page>
// );
// }

View File

@@ -0,0 +1,260 @@
import * as Yup from 'yup';
import { useSnackbar } from 'notistack';
import { useNavigate } from 'react-router-dom';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import MenuItem from '@mui/material/MenuItem';
import Select, { SelectChangeEvent } from '@mui/material/Select';
import * as React from 'react';
// form
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
// @mui
import { styled } from '@mui/material/styles';
import { LoadingButton } from '@mui/lab';
import {
Box,
Avatar,
Button,
ButtonGroup,
Card,
FormHelperText,
Grid,
Stack,
Typography,
TextField,
Chip,
} from '@mui/material';
import CancelIcon from '@mui/icons-material/Cancel';
// components
import {
FormProvider,
RHFTextField,
RHFRadioGroup,
RHFUploadAvatar,
RHFSwitch,
RHFEditor,
RHFDatepicker,
RHFMultiCheckbox,
RHFCheckbox,
RHFCustomMultiCheckbox,
} from '../../../components/hook-form';
import axios from '../../../utils/axios';
import { fCurrency } from '../../../utils/formatNumber';
import { Practitioner } from '../../../@types/doctor';
import { Label, Rowing } from '@mui/icons-material';
const LabelStyle = styled(Typography)(({ theme }) => ({
...theme.typography.subtitle2,
color: theme.palette.text.secondary,
marginBottom: theme.spacing(1),
}));
const HeaderStyle = styled('header')(({ theme }) => ({
paddingBottom: theme.spacing(5),
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}));
const Title = styled(Typography)(({ theme }) => ({
...theme.typography.h4,
boxShadow: 'none',
// paddingBottom: theme.spacing(3),
fontWeight: 700,
color: '#005B7F',
}));
interface FormValuesProps extends Partial<Practitioner> {
taxes: boolean;
inStock: boolean;
}
type Props = {
isEdit: boolean;
currentPractitioner?: Practitioner;
};
const Span = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(1),
}));
const Text = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(3),
}));
export default function PractitionerForm({ isEdit, currentPractitioner }: Props) {
const navigate = useNavigate();
const [practitioner_group, setPractitionerGroups] = useState([]);
// const [ errors, setErrors ] = useState<{ [key: string]: string }>({});
const { enqueueSnackbar } = useSnackbar();
const NewCorporateSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
// file: Yup.boolean().required('Corporate Status is required'),
});
const defaultValues = useMemo(
() => ({
id: currentPractitioner?.id,
name: currentPractitioner?.name || '',
address: currentPractitioner?.address || '',
birth_date: currentPractitioner?.birth_date || '',
gender: currentPractitioner?.gender || '',
description: currentPractitioner?.description || '',
birth_place: currentPractitioner?.birth_place || '',
active: currentPractitioner?.active === 1 ? true : false,
avatar_url: currentPractitioner?.avatar_url || '',
doctor_id: currentPractitioner?.doctor_id || '',
organizations: currentPractitioner?.organizations || [],
specialities: currentPractitioner?.specialities || [],
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[currentPractitioner]
);
console.log('defaultValues', defaultValues);
function StatusLabel({ value }: { value: boolean }) {
return (
<Chip
label={value ? 'Aktif' : 'Tidak Aktif'}
size="medium"
sx={{
backgroundColor: value ? 'rgba(84, 214, 44, 0.16)' : 'rgba(255, 72, 66, 0.16)',
color: value ? '#229A16' : '#B72136',
padding: '1 8 1 8 px',
borderRadius: '4px',
fontSize: '12px',
fontWeight: 'bold',
}}
/>
);
}
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
defaultValues,
});
const {
reset,
watch,
control,
setValue,
getValues,
setError,
handleSubmit,
formState: { isSubmitting },
} = methods;
const values = watch();
useEffect(() => {
if (isEdit && currentPractitioner) {
reset(defaultValues);
}
if (!isEdit) {
reset(defaultValues);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isEdit, currentPractitioner]);
const handleActivate = (event: React.ChangeEvent<HTMLInputElement>) => {
setValue('active', event.target.checked);
console.log('event.target.checked', event.target.checked);
const formData = new FormData();
formData.append('active', event.target.checked ? '1' : '0');
formData.append('_method', 'PUT');
axios.post('/doctors/' + currentPractitioner?.id ?? '', formData);
enqueueSnackbar('active Updated Successfully!', { variant: 'success' });
};
return (
<FormProvider methods={methods}>
<Stack spacing={3}>
<Box sx={{ width: '100%' }}>
{/* <Stack spacing={3}> */}
<Card sx={{ p: 5 }}>
<HeaderStyle>
<Grid item xs={6} md={6}>
<Title>Data Dokter</Title>
</Grid>
<Grid item xs={6} md={6}>
{/* <Typography>Status Rumah Sakit</Typography> */}
<RHFSwitch name="active" label="" onClick={handleActivate} />
<StatusLabel value={values.active} />
</Grid>
</HeaderStyle>
<Title variant="h5">Informasi Umum</Title>
<Avatar
alt="Remy Sharp"
src={currentPractitioner?.avatar_url}
sx={{ width: 120, height: 120, marginBottom: 2 }}
/>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Span style={{ fontWeight: 'bold' }}>Nama Dokter</Span>
<Text>{currentPractitioner?.name ? currentPractitioner?.name : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>No Telp</Span>
<Text>{currentPractitioner?.phone ? currentPractitioner?.phone : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Tempat Lahir</Span>
<Text>
{currentPractitioner?.birth_place ? currentPractitioner?.birth_place : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Alamat</Span>
<Text>{currentPractitioner?.address ? currentPractitioner?.address : '-'}</Text>
</Grid>
<Grid item xs={5} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Span style={{ fontWeight: 'bold' }}>Jenis Kelamin</Span>
<Text>{currentPractitioner?.gender ? currentPractitioner?.gender : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Email</Span>
<Text>{currentPractitioner?.email ? currentPractitioner?.email : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Tanggal Lahir</Span>
<Text>
{currentPractitioner?.birth_date ? currentPractitioner?.birth_date : '-'}
</Text>
</Grid>
</Grid>
</Card>
<Card sx={{ p: 5, marginTop: 2 }}>
<Title variant="h5">Tempat Praktik</Title>
{currentPractitioner?.organizations?.map((item, index) => (
<Box key={index} sx={{ mt: 3 }}>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Text>{item.name}</Text>
</Grid>
</Grid>
</Box>
))}
</Card>
<Card sx={{ p: 5, marginTop: 2 }}>
<Title variant="h5">Spesialisasi</Title>
{currentPractitioner?.specialities?.map((item, index) => (
<Box key={index} sx={{ mt: 3 }}>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={7}>
<Text>{item.name}</Text>
</Grid>
</Grid>
</Box>
))}
</Card>
</Box>
</Stack>
</FormProvider>
);
}

View File

@@ -0,0 +1,35 @@
import { Card, Grid, Container } from '@mui/material';
import { useParams } from 'react-router-dom';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import Page from '../../../components/Page';
import useSettings from '../../../hooks/useSettings';
import List from './List';
export default function Doctors() {
const { themeStretch } = useSettings();
const { id } = useParams();
const pageTitle = 'Live Chat';
return (
<Page title={pageTitle}>
<Container maxWidth={themeStretch ? false : 'xl'}>
<HeaderBreadcrumbs
heading={pageTitle}
links={[
{
name: 'Report',
href: '/report',
},
{
name: 'Live Chat',
href: '/report/live-chat',
},
]}
/>
<List />
</Container>
</Page>
);
}

View File

@@ -0,0 +1,466 @@
import {
Box,
Button,
Card,
Collapse,
Paper,
Select,
SelectChangeEvent,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
TextField,
Typography,
Stack,
ButtonGroup,
Grid,
Chip,
Dialog,
DialogContent,
DialogContentText,
DialogActions,
FormControl,
Autocomplete,
InputAdornment,
IconButton,
} from '@mui/material';
import {
Link,
NavLink as RouterLink,
useSearchParams,
useNavigate,
useParams,
} from 'react-router-dom';
// hooks
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
import useSettings from '../../../hooks/useSettings';
// components
import axios from '../../../utils/axios';
import { LaravelPaginatedData } from '../../../@types/paginated-data';
import { Icd } from '../../../@types/diagnosis';
import BasePagination from '../../../components/BasePagination';
import { Practitioner } from '../../../@types/doctor';
import CreateIcon from '@mui/icons-material/Create';
import { Props } from '../../../components/editor/index';
import { red } from '@mui/material/colors';
import { margin, padding } from '@mui/system';
import { enqueueSnackbar } from 'notistack';
import { Controller } from 'react-hook-form';
import SvgIconStyle from '../../../components/SvgIconStyle';
import { GridSearchIcon } from '@mui/x-data-grid';
import { Search } from '@mui/icons-material';
import { Icon } from '@iconify/react';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
// ----------------------------------------------------------------------
export default function List() {
// Generate the every row of the table
const navigate = useNavigate();
const { organization_id } = useParams();
const [searchParams, setSearchParams] = useSearchParams();
const [searchParamsOrganizations, setSearchParamsOrganizations] = useSearchParams();
const [searchParamsSpecialities, setSearchParamsSpecialities] = useSearchParams();
const [searchParamsFilter, setSearchParamsFilter] = useSearchParams();
function Filter(props: any) {
// SEARCH
const searchInput = useRef<HTMLInputElement>(null);
const [searchText, setSearchText] = useState('');
//handle search
const handleSearchChange = (event: any) => {
const newSearchText = event.target.value ?? '';
setSearchText(newSearchText);
};
const handleSearchSubmit = (event: any) => {
event.preventDefault();
props.onSearch(searchText);
};
useEffect(() => {
// Trigger First Search
setSearchText(searchParams.get('search') ?? '');
}, []);
const item = [
{
id: '',
value: '',
name: 'Semua',
},
];
return (
<form style={{ width: '100%' }}>
<Grid container spacing={2} sx={{ justifyContent: 'space-between', alignItems: 'center' }}>
<Grid item xs={12} sm={12} md={12} lg={12}>
<TextField
id="search-input"
ref={searchInput}
variant="outlined"
fullWidth
onChange={handleSearchChange}
onKeyDown={(event) => {
if (event.key === 'Enter') {
handleSearchSubmit(event);
}
}}
value={searchText}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<Search />
</InputAdornment>
),
placeholder: 'Search',
}}
/>
</Grid>
</Grid>
</form>
);
}
function FilterForm(props: any) {
// IMPORT
return (
<Grid
container
spacing={2}
sx={{ p: 2, justifyContent: 'space-between', alignItems: 'center' }}
>
<Grid item xs={12} md={12} lg={12}>
<Filter onSearch={applyItems} />
</Grid>
</Grid>
);
}
function createData(doctor: Practitioner): Practitioner {
return {
...doctor,
};
}
function Row(props: { row: ReturnType<typeof createData> }) {
const { row } = props;
const [open, setOpen] = React.useState(false);
const [openDialog, setOpenDialog] = React.useState(false);
const handleDelete = (model: any) => {
axios
.delete(`/doctors/${row.id}`)
.then((res) => {
setDataTableData({
...dataTableData,
data: dataTableData.data.filter((model) => model.id != row.id),
});
enqueueSnackbar('Data berhasil dihapus', { variant: 'success' });
})
.catch((error) => {
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
};
return (
<React.Fragment>
<TableRow>
<TableCell>
<IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)}>
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
</TableCell>
<TableCell align="left">{row.date_created ? row.date_created : '-'}</TableCell>
<TableCell align="left">{row.date_appointment ? row.date_appointment : '-'}</TableCell>
<TableCell align="left">{row.health_care ? row.health_care : '-'}</TableCell>
<TableCell align="left">{row.doctor_name ? row.doctor_name : '-'}</TableCell>
<TableCell align="left">{row.speciality ? row.speciality : '-'}</TableCell>
<TableCell align="left">{row.appointment_media ? row.appointment_media : '-'}</TableCell>
<TableCell align="left">{row.patient_media ? row.patient_media : '-'}</TableCell>
<TableCell align="left">{row.doctor_media ? row.doctor_media : '-'}</TableCell>
<TableCell align="left">
{row.status_appointment ? row.status_appointment : '-'}
</TableCell>
<TableCell align="left">{row.status_chat ? row.status_chat : '-'}</TableCell>
<TableCell align="center">
<ButtonGroup variant="text" aria-label="text button group">
<Link to={'/report/live-chat/' + row.id + '/show'}>
<Button>
<Icon icon="ph:eye-bold" style={{ width: '24px', height: '24px' }} />
</Button>
</Link>
</ButtonGroup>
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
<TableRow>
<TableCell
style={{ paddingBottom: 0, paddingTop: 0, backgroundColor: 'rgba(244, 246, 248, 0.5)' }}
colSpan={6}
>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box sx={{ margin: 1, pb: 2, pl: 4 }}>
<Grid container>
<Grid item xs={12} sx={{ padding: 2 }}>
<Grid container>
<Grid item xs={6}>
Metode Pembayaran
</Grid>
<Grid item xs={6}>
: {row.payment_method ? row.payment_method : '-'}
</Grid>
<Grid item xs={6}>
Jenis Benefit
</Grid>
<Grid item xs={6}>
: -
</Grid>
<Grid item xs={6}>
Durasi
</Grid>
<Grid item xs={6}>
: {row.duration ? row.duration : '-'}
</Grid>
</Grid>
</Grid>
</Grid>
</Box>
</Collapse>
</TableCell>
</TableRow>
{/* END COLLAPSIBLE ROW */}
<Dialog
open={openDialog}
onClose={() => {
setOpenDialog(false);
}}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogContent sx={{ p: 5 }}>
<Icon
icon="eva:trash-2-outline"
style={{
width: '100px',
height: '100px',
color: '#FF0000',
margin: 'auto',
display: 'block',
marginBottom: '20px',
alignContent: 'center',
}}
/>
<DialogContentText sx={{ fontWeight: 'bold', pb: 1 }} id="alert-dialog-title">
Apakah anda yakin ingin menghapus
</DialogContentText>
<Typography sx={{ fontWeight: 'bold' }} id="alert-dialog-title">
{row.name}?
</Typography>
</DialogContent>
<DialogActions>
<Button
onClick={() => {
setOpenDialog(false);
}}
color="primary"
>
Batal
</Button>
<Button
onClick={() => {
handleDelete(row.id);
}}
color="primary"
autoFocus
>
Hapus
</Button>
</DialogActions>
</Dialog>
</React.Fragment>
);
}
const headStyle = {
fontWeight: 'bold',
};
// Dummy Default Data
const [dataTableIsLoading, setDataTableLoading] = useState(true);
const [dataTableLastRequest, setDataTableLastRequest] = useState(0);
const [dataTableResponseState, setDataTableResponseState] = useState('idle');
const [dataTableData, setDataTableData] = useState<LaravelPaginatedData>({
current_page: 1,
data: [],
path: '',
first_page_url: '',
last_page: 1,
last_page_url: '',
next_page_url: '',
prev_page_url: '',
per_page: 10,
from: 0,
to: 0,
total: 0,
});
const [dataTablePage, setDataTablePage] = useState(5);
const loadDataTableData = async (appliedFilter: any | null = null) => {
setDataTableLoading(true);
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
const response = await axios.get('/live-chat', {
params: filter,
});
setDataTableLoading(false);
setDataTableData(response.data);
};
// const applyFilter = async (searchFilter: string) => {
// await loadDataTableData({ search: searchFilter });
// setSearchParams({ search: searchFilter });
// };
const applyItems = async (
searchFilter: string,
searchFilterOrganization: string,
searchFilterSpecialities: string
) => {
await loadDataTableData({
search: searchFilter,
organization_id: searchFilterOrganization,
speciality_id: searchFilterSpecialities,
});
setSearchParamsFilter({
search: searchFilter,
organization_id: searchFilterOrganization,
speciality_id: searchFilterSpecialities,
});
};
const handlePageChange = (event: ChangeEvent, value: number) => {
const filter = Object.fromEntries([...searchParams.entries(), ['page', value]]);
loadDataTableData(filter);
setSearchParams(filter);
};
useEffect(() => {
loadDataTableData();
}, []);
return (
<Stack>
{/* <Ambulace /> */}
<Card sx={{ marginTop: '30px' }}>
<FilterForm sx={{ marginTop: '100px' }} />
{/* The Main Table */}
<TableContainer component={Paper}>
<Table>
<TableBody>
<TableRow>
{/* <TableCell colSpan={8} rowSpan={1} align="center" /> */}
<TableCell style={headStyle} align="left" />
<TableCell style={headStyle} rowSpan={2} align="left">
Tanggal Booking
</TableCell>
<TableCell style={headStyle} rowSpan={2} align="left">
Tanggal Appointment
</TableCell>
<TableCell style={headStyle} rowSpan={2} align="left">
Faskes
</TableCell>
<TableCell style={headStyle} rowSpan={2} align="left">
Nama Dokter
</TableCell>
<TableCell style={headStyle} rowSpan={2} align="left">
Spesialisasi
</TableCell>
<TableCell style={headStyle} rowSpan={2} align="left">
Appointment Via App/Website
</TableCell>
<TableCell
colSpan={2}
style={headStyle}
align="center"
sx={{ borderBottom: '3px solid #d7d7d7' }}
>
Chat Via App/Website
</TableCell>
<TableCell style={headStyle} rowSpan={2} align="left">
Status Appointment
</TableCell>
<TableCell style={headStyle} rowSpan={2} align="left">
Status Chat
</TableCell>
</TableRow>
<TableRow>
<TableCell style={headStyle} align="left" />
{/* <TableCell style={headStyle} align="left">
Tanggal Booking
</TableCell>
<TableCell style={headStyle} align="left">
Tanggal Appointment
</TableCell>
<TableCell style={headStyle} align="left">
Faskes
</TableCell>
<TableCell style={headStyle} align="left">
Nama Dokter
</TableCell>
<TableCell style={headStyle} align="left">
Spesialisasi
</TableCell> */}
<TableCell style={headStyle} align="left">
Pasien
</TableCell>
<TableCell style={headStyle} align="left">
Dokter
</TableCell>
</TableRow>
</TableBody>
{dataTableIsLoading ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align="center">
Loading
</TableCell>
</TableRow>
</TableBody>
) : dataTableData.data.length == 0 ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align="center">
No Data
</TableCell>
</TableRow>
</TableBody>
) : (
<TableBody>
{dataTableData.data.map((row) => (
<Row key={row.id} row={row} />
))}
</TableBody>
)}
</Table>
</TableContainer>
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
</Card>
</Stack>
);
}

View File

@@ -0,0 +1,53 @@
import { useEffect, useState } from 'react';
import { paramCase } from 'change-case';
import { useParams, useLocation } from 'react-router-dom';
// @mui
import { Container, Stack } from '@mui/material';
import useSettings from '../../../hooks/useSettings';
import Page from '../../../components/Page';
import View from './View';
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import axios from '../../../utils/axios';
import { Appointment } from '../../../@types/doctor';
export default function Create() {
const { themeStretch } = useSettings();
const { id } = useParams();
const isEdit = id ? true : false;
const [currentAppointment, setCurrentAppointment] = useState<Appointment>();
useEffect(() => {
if (isEdit) {
axios.get('/live-chat/' + id).then((res) => {
setCurrentAppointment(res.data);
});
}
}, [id]);
return (
<Page title="Live Chat">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center">
<HeaderBreadcrumbs
heading={!isEdit ? 'Live Chat' : 'Live Chat'}
links={[
{ name: 'Report', href: '/report' },
{
name: 'Live Chat',
href: '/report/live-chat',
},
]}
/>
</Stack>
<View
// isSubmitting={isSubmitting}
isEdit={isEdit}
currentAppointment={currentAppointment}
/>
</Container>
</Page>
);
}

View File

@@ -0,0 +1,309 @@
import * as Yup from 'yup';
import { useSnackbar } from 'notistack';
import { useNavigate } from 'react-router-dom';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import MenuItem from '@mui/material/MenuItem';
import Select, { SelectChangeEvent } from '@mui/material/Select';
import * as React from 'react';
// form
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
// @mui
import { styled } from '@mui/material/styles';
import { LoadingButton } from '@mui/lab';
import {
Box,
Avatar,
Button,
ButtonGroup,
Card,
FormHelperText,
Grid,
Stack,
Typography,
TextField,
Chip,
Badge,
Divider,
} from '@mui/material';
import CancelIcon from '@mui/icons-material/Cancel';
// components
import {
FormProvider,
RHFTextField,
RHFRadioGroup,
RHFUploadAvatar,
RHFSwitch,
RHFEditor,
RHFDatepicker,
RHFMultiCheckbox,
RHFCheckbox,
RHFCustomMultiCheckbox,
} from '../../../components/hook-form';
import axios from '../../../utils/axios';
import { fCurrency } from '../../../utils/formatNumber';
import { Appointment } from '../../../@types/doctor';
import { Label, Rowing, Spa } from '@mui/icons-material';
import { border, padding } from '@mui/system';
const LabelStyle = styled(Typography)(({ theme }) => ({
...theme.typography.subtitle2,
color: theme.palette.text.secondary,
marginBottom: theme.spacing(1),
}));
const HeaderStyle = styled('header')(({ theme }) => ({
paddingBottom: theme.spacing(5),
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}));
const Title = styled(Typography)(({ theme }) => ({
...theme.typography.h4,
boxShadow: 'none',
// paddingBottom: theme.spacing(3),
fontWeight: 700,
color: '#005B7F',
}));
interface FormValuesProps extends Partial<Appointment> {
taxes: boolean;
inStock: boolean;
}
type Props = {
isEdit: boolean;
currentAppointment?: Appointment;
};
const Span = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(1),
}));
const Text = styled(Typography)(({ theme }) => ({
boxShadow: 'none',
paddingBottom: theme.spacing(3),
}));
export default function AppointmentForm({ isEdit, currentAppointment }: Props) {
const navigate = useNavigate();
// const [ errors, setErrors ] = useState<{ [key: string]: string }>({});
const { enqueueSnackbar } = useSnackbar();
const NewCorporateSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
// file: Yup.boolean().required('Corporate Status is required'),
});
const defaultValues = useMemo(
() => ({
id: currentAppointment?.id,
name: currentAppointment?.name || '',
address: currentAppointment?.address || '',
birth_date: currentAppointment?.birth_date || '',
gender: currentAppointment?.gender || '',
description: currentAppointment?.description || '',
birth_place: currentAppointment?.birth_place || '',
active: currentAppointment?.active === 1 ? true : false,
avatar_url: currentAppointment?.avatar_url || '',
doctor_id: currentAppointment?.doctor_id || '',
organizations: currentAppointment?.organizations || [],
specialities: currentAppointment?.specialities || [],
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[currentAppointment]
);
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
defaultValues,
});
const {
reset,
watch,
control,
setValue,
getValues,
setError,
handleSubmit,
formState: { isSubmitting },
} = methods;
const values = watch();
useEffect(() => {
if (isEdit && currentAppointment) {
reset(defaultValues);
}
if (!isEdit) {
reset(defaultValues);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isEdit, currentAppointment]);
return (
<FormProvider methods={methods}>
<Stack spacing={3}>
<Box sx={{ width: '100%' }}>
{/* <Stack spacing={3}> */}
<Card sx={{ p: 5 }}>
<HeaderStyle>
<Grid item xs={6} md={6}>
<Stack
direction="row"
divider={<Divider orientation="vertical" flexItem />}
spacing={2}
>
<Title>Data Live Chat</Title>
</Stack>
</Grid>
</HeaderStyle>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={12}>
<Stack direction="row" spacing={2}>
<Grid item xs={6}>
<Stack direction="row" spacing={2} alignItems="center">
<Span style={{ fontWeight: 'bold', paddingBottom: '0px' }}>
Status Appointment :
</Span>
<Chip
label={
currentAppointment?.status_appointment
? currentAppointment?.status_appointment
: '-'
}
variant="outlined"
/>
</Stack>
</Grid>
<Grid item xs={6}>
<Stack direction="row" spacing={2} alignItems="center">
<Span style={{ fontWeight: 'bold', paddingBottom: '0px' }}>
Status Chat :
</Span>
<Chip
label={
currentAppointment?.status_chat ? currentAppointment?.status_chat : '-'
}
variant="outlined"
/>
</Stack>
</Grid>
</Stack>
</Grid>
<Grid item xs={12} sx={{ marginTop: '20px' }}>
<Stack direction="row" spacing={2}>
<Grid item xs={6}>
<Stack direction="row" spacing={2}>
<Span style={{ fontWeight: 'bold' }}>Tanggal Booking :</Span>
<Text>
{currentAppointment?.date_created ? currentAppointment?.date_created : '-'}
</Text>
</Stack>
</Grid>
<Grid item xs={6}>
<Stack direction="row" spacing={2}>
<Span style={{ fontWeight: 'bold' }}>Tanggal Appointment :</Span>
<Text>
{currentAppointment?.date_appointment
? currentAppointment?.date_appointment
: '-'}
</Text>
</Stack>
</Grid>
</Stack>
</Grid>
<Grid item xs={6}>
<Span style={{ fontWeight: 'bold' }}>Nama Dokter</Span>
<Text>
{currentAppointment?.doctor_name ? currentAppointment?.doctor_name : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Faskes</Span>
<Text>
{currentAppointment?.health_care ? currentAppointment?.health_care : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Durasi</Span>
<Text>{currentAppointment?.duration ? currentAppointment?.duration : '-'}</Text>
</Grid>
<Grid item xs={6} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Span style={{ fontWeight: 'bold' }}>Spesialis</Span>
<Text>{currentAppointment?.speciality ? currentAppointment?.speciality : '-'}</Text>
<Span style={{ fontWeight: 'bold' }}>Appointment Via Web/App</Span>
<Text>
{currentAppointment?.appointment_media
? currentAppointment?.appointment_media
: '-'}
</Text>
</Grid>
</Grid>
</Card>
<Card sx={{ mt: 5, p: 5 }}>
<HeaderStyle>
<Grid item xs={6} md={6}>
<Title>Data Pembayaran</Title>
</Grid>
</HeaderStyle>
{currentAppointment?.payment_detail !== null ? (
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Grid item xs={6}>
<Span style={{ fontWeight: 'bold' }}>Metode Pembayaran</Span>
<Text>
{currentAppointment?.payment_method ? currentAppointment?.payment_method : '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Harga</Span>
<Text>
{currentAppointment?.payment_detail?.gross_amount
? currentAppointment?.payment_detail?.gross_amount
: '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Mata Uang</Span>
<Text>
{currentAppointment?.payment_detail?.currency
? currentAppointment?.payment_detail?.currency
: '-'}
</Text>
</Grid>
<Grid item xs={6} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
<Span style={{ fontWeight: 'bold' }}>Tipe Pembayaran</Span>
<Text>
{currentAppointment?.payment_detail?.payment_type
? currentAppointment?.payment_detail?.payment_type
: '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Waktu Transaksi</Span>
<Text>
{currentAppointment?.payment_detail?.transaction_time
? currentAppointment?.payment_detail?.transaction_time
: '-'}
</Text>
<Span style={{ fontWeight: 'bold' }}>Status</Span>
<Text>
{currentAppointment?.payment_detail?.status_message
? currentAppointment?.payment_detail?.status_message
: '-'}
</Text>
</Grid>
</Grid>
) : (
<Span>Belum ada pembayaran</Span>
)}
</Card>
</Box>
</Stack>
</FormProvider>
);
}

View File

@@ -194,10 +194,26 @@ export default function Router() {
path: 'master/doctors',
element: <MasterDoctors />,
},
{
path: 'master/doctors/create',
element: <MasterDoctorsCreate />,
},
{
path: 'master/doctors/:id/edit',
element: <MasterDoctorsCreate />,
},
{
path: 'master/hospitals',
element: <MasterHospitals />,
},
{
path: 'master/hospitals/create',
element: <MasterHospitalsCreate />,
},
{
path: 'master/hospitals/:id/edit',
element: <MasterHospitalsCreate />,
},
{
path: 'master/diagnosis',
element: <MasterDiagnosis />,
@@ -217,6 +233,39 @@ export default function Router() {
element: <MasterFormulariumCreate />,
},
{
path: 'report/appointments',
element: <Appointment />,
},
{
path: 'report/appointments/:id',
element: <AppointmentCreate />,
},
{
path: 'report/appointments/:id/show',
element: <AppointmentShow />,
},
{
path: 'report/appointments/:id/edit',
element: <AppointmentCreate />,
},
{
path: 'report/live-chat',
element: <Livechat />,
},
{
path: 'report/live-chat/:id',
element: <LivechatCreate />,
},
{
path: 'report/live-chat/:id/show',
element: <LivechatShow />,
},
{
path: 'report/live-chat/:id/edit',
element: <LivechatCreate />,
},
{
path: 'claims',
element: <Claims />,
@@ -320,7 +369,17 @@ const CorporateFormularium = Loadable(lazy(() => import('../pages/Corporates/For
const MasterDiagnosis = Loadable(lazy(() => import('../pages/Master/Diagnosis/Index')));
const MasterDoctors = Loadable(lazy(() => import('../pages/Master/Doctors/Index')));
const MasterDoctorsCreate = Loadable(lazy(() => import('../pages/Master/Doctors/Create')));
const MasterHospitals = Loadable(lazy(() => import('../pages/Master/Hospitals/Index')));
const MasterHospitalsCreate = Loadable(lazy(() => import('../pages/Master/Hospitals/Create')));
const Appointment = Loadable(lazy(() => import('../pages/Report/Appointments/Index')));
const AppointmentCreate = Loadable(lazy(() => import('../pages/Report/Appointments/Create')));
const AppointmentShow = Loadable(lazy(() => import('../pages/Report/Appointments/Show')));
const Livechat = Loadable(lazy(() => import('../pages/Report/Livechat/Index')));
const LivechatCreate = Loadable(lazy(() => import('../pages/Report/Livechat/Create')));
const LivechatShow = Loadable(lazy(() => import('../pages/Report/Livechat/Show')));
const MasterDrug = Loadable(lazy(() => import('../pages/Master/Drug/Index')));

View File

@@ -36,8 +36,8 @@ export const colorPresets = [
name: 'blue',
lighter: '#D1E9FC',
light: '#76B0F1',
main: '#2065D1',
dark: '#103996',
main: '#006a35',
dark: '#004422',
darker: '#061B64',
contrastText: '#fff',
},
@@ -63,7 +63,7 @@ export const colorPresets = [
},
];
export const defaultPreset = colorPresets[0];
export const defaultPreset = colorPresets[3];
export const purplePreset = colorPresets[1];
export const cyanPreset = colorPresets[2];
export const bluePreset = colorPresets[3];

View File

@@ -1 +1 @@
import{r,i as a,a as t}from"./jsx-runtime_commonjs-proxy.92370fb9.js";var e={},u=a.exports;Object.defineProperty(e,"__esModule",{value:!0});var v=e.default=void 0,d=u(r()),i=t,o=(0,d.default)((0,i.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");v=e.default=o;export{v as d};
import{r,i as a,a as t}from"./jsx-runtime_commonjs-proxy.20d2a437.js";var e={},u=a.exports;Object.defineProperty(e,"__esModule",{value:!0});var v=e.default=void 0,d=u(r()),i=t,o=(0,d.default)((0,i.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");v=e.default=o;export{v as d};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{w as G,v as T,t as W,z as t,V as y,r as R,x as E,y as L,f as C,bJ as O,D as P,O as a,E as M}from"./index.2830a4a3.js";function V(r){return T("MuiButtonGroup",r)}const H=G("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","fullWidth","vertical","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary"]),n=H,N=["children","className","color","component","disabled","disableElevation","disableFocusRipple","disableRipple","fullWidth","orientation","size","variant"],U=(r,o)=>{const{ownerState:i}=r;return[{[`& .${n.grouped}`]:o.grouped},{[`& .${n.grouped}`]:o[`grouped${a(i.orientation)}`]},{[`& .${n.grouped}`]:o[`grouped${a(i.variant)}`]},{[`& .${n.grouped}`]:o[`grouped${a(i.variant)}${a(i.orientation)}`]},{[`& .${n.grouped}`]:o[`grouped${a(i.variant)}${a(i.color)}`]},o.root,o[i.variant],i.disableElevation===!0&&o.disableElevation,i.fullWidth&&o.fullWidth,i.orientation==="vertical"&&o.vertical]},k=r=>{const{classes:o,color:i,disabled:l,disableElevation:u,fullWidth:p,orientation:e,variant:d}=r,s={root:["root",d,e==="vertical"&&"vertical",p&&"fullWidth",u&&"disableElevation"],grouped:["grouped",`grouped${a(e)}`,`grouped${a(d)}`,`grouped${a(d)}${a(e)}`,`grouped${a(d)}${a(i)}`,l&&"disabled"]};return M(s,V,o)},_=W("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:U})(({theme:r,ownerState:o})=>t({display:"inline-flex",borderRadius:(r.vars||r).shape.borderRadius},o.variant==="contained"&&{boxShadow:(r.vars||r).shadows[2]},o.disableElevation&&{boxShadow:"none"},o.fullWidth&&{width:"100%"},o.orientation==="vertical"&&{flexDirection:"column"},{[`& .${n.grouped}`]:t({minWidth:40,"&:not(:first-of-type)":t({},o.orientation==="horizontal"&&{borderTopLeftRadius:0,borderBottomLeftRadius:0},o.orientation==="vertical"&&{borderTopRightRadius:0,borderTopLeftRadius:0},o.variant==="outlined"&&o.orientation==="horizontal"&&{marginLeft:-1},o.variant==="outlined"&&o.orientation==="vertical"&&{marginTop:-1}),"&:not(:last-of-type)":t({},o.orientation==="horizontal"&&{borderTopRightRadius:0,borderBottomRightRadius:0},o.orientation==="vertical"&&{borderBottomRightRadius:0,borderBottomLeftRadius:0},o.variant==="text"&&o.orientation==="horizontal"&&{borderRight:r.vars?`1px solid rgba(${r.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${r.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`},o.variant==="text"&&o.orientation==="vertical"&&{borderBottom:r.vars?`1px solid rgba(${r.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${r.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`},o.variant==="text"&&o.color!=="inherit"&&{borderColor:r.vars?`rgba(${r.vars.palette[o.color].mainChannel} / 0.5)`:y(r.palette[o.color].main,.5)},o.variant==="outlined"&&o.orientation==="horizontal"&&{borderRightColor:"transparent"},o.variant==="outlined"&&o.orientation==="vertical"&&{borderBottomColor:"transparent"},o.variant==="contained"&&o.orientation==="horizontal"&&{borderRight:`1px solid ${(r.vars||r).palette.grey[400]}`,[`&.${n.disabled}`]:{borderRight:`1px solid ${(r.vars||r).palette.action.disabled}`}},o.variant==="contained"&&o.orientation==="vertical"&&{borderBottom:`1px solid ${(r.vars||r).palette.grey[400]}`,[`&.${n.disabled}`]:{borderBottom:`1px solid ${(r.vars||r).palette.action.disabled}`}},o.variant==="contained"&&o.color!=="inherit"&&{borderColor:(r.vars||r).palette[o.color].dark},{"&:hover":t({},o.variant==="outlined"&&o.orientation==="horizontal"&&{borderRightColor:"currentColor"},o.variant==="outlined"&&o.orientation==="vertical"&&{borderBottomColor:"currentColor"})}),"&:hover":t({},o.variant==="contained"&&{boxShadow:"none"})},o.variant==="contained"&&{boxShadow:"none"})})),j=R.exports.forwardRef(function(o,i){const l=E({props:o,name:"MuiButtonGroup"}),{children:u,className:p,color:e="primary",component:d="div",disabled:s=!1,disableElevation:c=!1,disableFocusRipple:g=!1,disableRipple:v=!1,fullWidth:b=!1,orientation:B="horizontal",size:x="medium",variant:$="outlined"}=l,m=L(l,N),h=t({},l,{color:e,component:d,disabled:s,disableElevation:c,disableFocusRipple:g,disableRipple:v,fullWidth:b,orientation:B,size:x,variant:$}),f=k(h),z=R.exports.useMemo(()=>({className:f.grouped,color:e,disabled:s,disableElevation:c,disableFocusRipple:g,disableRipple:v,fullWidth:b,size:x,variant:$}),[e,s,c,g,v,b,x,$,f.grouped]);return C(_,t({as:d,role:"group",className:P(f.root,p),ref:i,ownerState:h},m,{children:C(O.Provider,{value:z,children:u})}))}),F=j;export{F as B};
import{w as G,v as T,t as W,z as t,V as y,r as R,x as E,y as L,f as C,bJ as O,D as P,O as a,E as M}from"./index.eaf14aef.js";function V(r){return T("MuiButtonGroup",r)}const H=G("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","fullWidth","vertical","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary"]),n=H,N=["children","className","color","component","disabled","disableElevation","disableFocusRipple","disableRipple","fullWidth","orientation","size","variant"],U=(r,o)=>{const{ownerState:i}=r;return[{[`& .${n.grouped}`]:o.grouped},{[`& .${n.grouped}`]:o[`grouped${a(i.orientation)}`]},{[`& .${n.grouped}`]:o[`grouped${a(i.variant)}`]},{[`& .${n.grouped}`]:o[`grouped${a(i.variant)}${a(i.orientation)}`]},{[`& .${n.grouped}`]:o[`grouped${a(i.variant)}${a(i.color)}`]},o.root,o[i.variant],i.disableElevation===!0&&o.disableElevation,i.fullWidth&&o.fullWidth,i.orientation==="vertical"&&o.vertical]},k=r=>{const{classes:o,color:i,disabled:l,disableElevation:u,fullWidth:p,orientation:e,variant:d}=r,s={root:["root",d,e==="vertical"&&"vertical",p&&"fullWidth",u&&"disableElevation"],grouped:["grouped",`grouped${a(e)}`,`grouped${a(d)}`,`grouped${a(d)}${a(e)}`,`grouped${a(d)}${a(i)}`,l&&"disabled"]};return M(s,V,o)},_=W("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:U})(({theme:r,ownerState:o})=>t({display:"inline-flex",borderRadius:(r.vars||r).shape.borderRadius},o.variant==="contained"&&{boxShadow:(r.vars||r).shadows[2]},o.disableElevation&&{boxShadow:"none"},o.fullWidth&&{width:"100%"},o.orientation==="vertical"&&{flexDirection:"column"},{[`& .${n.grouped}`]:t({minWidth:40,"&:not(:first-of-type)":t({},o.orientation==="horizontal"&&{borderTopLeftRadius:0,borderBottomLeftRadius:0},o.orientation==="vertical"&&{borderTopRightRadius:0,borderTopLeftRadius:0},o.variant==="outlined"&&o.orientation==="horizontal"&&{marginLeft:-1},o.variant==="outlined"&&o.orientation==="vertical"&&{marginTop:-1}),"&:not(:last-of-type)":t({},o.orientation==="horizontal"&&{borderTopRightRadius:0,borderBottomRightRadius:0},o.orientation==="vertical"&&{borderBottomRightRadius:0,borderBottomLeftRadius:0},o.variant==="text"&&o.orientation==="horizontal"&&{borderRight:r.vars?`1px solid rgba(${r.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${r.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`},o.variant==="text"&&o.orientation==="vertical"&&{borderBottom:r.vars?`1px solid rgba(${r.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${r.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`},o.variant==="text"&&o.color!=="inherit"&&{borderColor:r.vars?`rgba(${r.vars.palette[o.color].mainChannel} / 0.5)`:y(r.palette[o.color].main,.5)},o.variant==="outlined"&&o.orientation==="horizontal"&&{borderRightColor:"transparent"},o.variant==="outlined"&&o.orientation==="vertical"&&{borderBottomColor:"transparent"},o.variant==="contained"&&o.orientation==="horizontal"&&{borderRight:`1px solid ${(r.vars||r).palette.grey[400]}`,[`&.${n.disabled}`]:{borderRight:`1px solid ${(r.vars||r).palette.action.disabled}`}},o.variant==="contained"&&o.orientation==="vertical"&&{borderBottom:`1px solid ${(r.vars||r).palette.grey[400]}`,[`&.${n.disabled}`]:{borderBottom:`1px solid ${(r.vars||r).palette.action.disabled}`}},o.variant==="contained"&&o.color!=="inherit"&&{borderColor:(r.vars||r).palette[o.color].dark},{"&:hover":t({},o.variant==="outlined"&&o.orientation==="horizontal"&&{borderRightColor:"currentColor"},o.variant==="outlined"&&o.orientation==="vertical"&&{borderBottomColor:"currentColor"})}),"&:hover":t({},o.variant==="contained"&&{boxShadow:"none"})},o.variant==="contained"&&{boxShadow:"none"})})),j=R.exports.forwardRef(function(o,i){const l=E({props:o,name:"MuiButtonGroup"}),{children:u,className:p,color:e="primary",component:d="div",disabled:s=!1,disableElevation:c=!1,disableFocusRipple:g=!1,disableRipple:v=!1,fullWidth:b=!1,orientation:B="horizontal",size:x="medium",variant:$="outlined"}=l,m=L(l,N),h=t({},l,{color:e,component:d,disabled:s,disableElevation:c,disableFocusRipple:g,disableRipple:v,fullWidth:b,orientation:B,size:x,variant:$}),f=k(h),z=R.exports.useMemo(()=>({className:f.grouped,color:e,disabled:s,disableElevation:c,disableFocusRipple:g,disableRipple:v,fullWidth:b,size:x,variant:$}),[e,s,c,g,v,b,x,$,f.grouped]);return C(_,t({as:d,role:"group",className:P(f.root,p),ref:i,ownerState:h},m,{children:C(O.Provider,{value:z,children:u})}))}),F=j;export{F as B};

View File

@@ -1 +1 @@
import{r as a,i as r,a as t}from"./jsx-runtime_commonjs-proxy.92370fb9.js";var e={},u=r.exports;Object.defineProperty(e,"__esModule",{value:!0});var i=e.default=void 0,l=u(a()),o=t,d=(0,l.default)((0,o.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),"Cancel");i=e.default=d;export{i as d};
import{r as a,i as r,a as t}from"./jsx-runtime_commonjs-proxy.20d2a437.js";var e={},u=r.exports;Object.defineProperty(e,"__esModule",{value:!0});var i=e.default=void 0,l=u(a()),o=t,d=(0,l.default)((0,o.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),"Cancel");i=e.default=d;export{i as d};

View File

@@ -1 +1 @@
import{v as d,w as u,t as C,P as p,r as f,x as m,y as x,z as n,f as y,D as v,E as w}from"./index.2830a4a3.js";function h(s){return d("MuiCard",s)}u("MuiCard",["root"]);const M=["className","raised"],P=s=>{const{classes:e}=s;return w({root:["root"]},h,e)},R=C(p,{name:"MuiCard",slot:"Root",overridesResolver:(s,e)=>e.root})(()=>({overflow:"hidden"})),U=f.exports.forwardRef(function(e,o){const t=m({props:e,name:"MuiCard"}),{className:l,raised:r=!1}=t,c=x(t,M),a=n({},t,{raised:r}),i=P(a);return y(R,n({className:v(i.root,l),elevation:r?8:void 0,ref:o,ownerState:a},c))}),N=U;export{N as C};
import{v as d,w as u,t as C,P as p,r as f,x as m,y as x,z as n,f as y,D as v,E as w}from"./index.eaf14aef.js";function h(s){return d("MuiCard",s)}u("MuiCard",["root"]);const M=["className","raised"],P=s=>{const{classes:e}=s;return w({root:["root"]},h,e)},R=C(p,{name:"MuiCard",slot:"Root",overridesResolver:(s,e)=>e.root})(()=>({overflow:"hidden"})),U=f.exports.forwardRef(function(e,o){const t=m({props:e,name:"MuiCard"}),{className:l,raised:r=!1}=t,c=x(t,M),a=n({},t,{raised:r}),i=P(a);return y(R,n({className:v(i.root,l),elevation:r?8:void 0,ref:o,ownerState:a},c))}),N=U;export{N as C};

View File

@@ -1 +1 @@
import{Q as h,f as c,w as P,v as B,t as S,U as g,O as v,z as a,V as M,r as d,x as H,y as O,D as R,E as U}from"./index.2830a4a3.js";import{S as V}from"./FormControlLabel.091f6f29.js";const _=h(c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),w=h(c("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),E=h(c("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function L(o){return B("MuiCheckbox",o)}const N=P("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary"]),p=N,j=["checkedIcon","color","icon","indeterminate","indeterminateIcon","inputProps","size","className"],F=o=>{const{classes:e,indeterminate:t,color:s}=o,r={root:["root",t&&"indeterminate",`color${v(s)}`]},n=U(r,L,e);return a({},e,n)},D=S(V,{shouldForwardProp:o=>g(o)||o==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,t.indeterminate&&e.indeterminate,t.color!=="default"&&e[`color${v(t.color)}`]]}})(({theme:o,ownerState:e})=>a({color:(o.vars||o).palette.text.secondary},!e.disableRipple&&{"&:hover":{backgroundColor:o.vars?`rgba(${e.color==="default"?o.vars.palette.action.activeChannel:o.vars.palette.primary.mainChannel} / ${o.vars.palette.action.hoverOpacity})`:M(e.color==="default"?o.palette.action.active:o.palette[e.color].main,o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},e.color!=="default"&&{[`&.${p.checked}, &.${p.indeterminate}`]:{color:(o.vars||o).palette[e.color].main},[`&.${p.disabled}`]:{color:(o.vars||o).palette.action.disabled}})),Q=c(w,{}),T=c(_,{}),W=c(E,{}),q=d.exports.forwardRef(function(e,t){var s,r;const n=H({props:e,name:"MuiCheckbox"}),{checkedIcon:f=Q,color:b="primary",icon:I=T,indeterminate:i=!1,indeterminateIcon:u=W,inputProps:z,size:l="medium",className:y}=n,$=O(n,j),m=i?u:I,C=i?u:f,k=a({},n,{color:b,indeterminate:i,size:l}),x=F(k);return c(D,a({type:"checkbox",inputProps:a({"data-indeterminate":i},z),icon:d.exports.cloneElement(m,{fontSize:(s=m.props.fontSize)!=null?s:l}),checkedIcon:d.exports.cloneElement(C,{fontSize:(r=C.props.fontSize)!=null?r:l}),ownerState:k,ref:t,className:R(x.root,y)},$,{classes:x}))}),J=q;export{J as C};
import{Q as h,f as c,w as P,v as B,t as S,U as g,O as v,z as a,V as M,r as d,x as H,y as O,D as R,E as U}from"./index.eaf14aef.js";import{S as V}from"./FormControlLabel.877bb59b.js";const _=h(c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),w=h(c("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),E=h(c("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function L(o){return B("MuiCheckbox",o)}const N=P("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary"]),p=N,j=["checkedIcon","color","icon","indeterminate","indeterminateIcon","inputProps","size","className"],F=o=>{const{classes:e,indeterminate:t,color:s}=o,r={root:["root",t&&"indeterminate",`color${v(s)}`]},n=U(r,L,e);return a({},e,n)},D=S(V,{shouldForwardProp:o=>g(o)||o==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,t.indeterminate&&e.indeterminate,t.color!=="default"&&e[`color${v(t.color)}`]]}})(({theme:o,ownerState:e})=>a({color:(o.vars||o).palette.text.secondary},!e.disableRipple&&{"&:hover":{backgroundColor:o.vars?`rgba(${e.color==="default"?o.vars.palette.action.activeChannel:o.vars.palette.primary.mainChannel} / ${o.vars.palette.action.hoverOpacity})`:M(e.color==="default"?o.palette.action.active:o.palette[e.color].main,o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},e.color!=="default"&&{[`&.${p.checked}, &.${p.indeterminate}`]:{color:(o.vars||o).palette[e.color].main},[`&.${p.disabled}`]:{color:(o.vars||o).palette.action.disabled}})),Q=c(w,{}),T=c(_,{}),W=c(E,{}),q=d.exports.forwardRef(function(e,t){var s,r;const n=H({props:e,name:"MuiCheckbox"}),{checkedIcon:f=Q,color:b="primary",icon:I=T,indeterminate:i=!1,indeterminateIcon:u=W,inputProps:z,size:l="medium",className:y}=n,$=O(n,j),m=i?u:I,C=i?u:f,k=a({},n,{color:b,indeterminate:i,size:l}),x=F(k);return c(D,a({type:"checkbox",inputProps:a({"data-indeterminate":i},z),icon:d.exports.cloneElement(m,{fontSize:(s=m.props.fontSize)!=null?s:l}),checkedIcon:d.exports.cloneElement(C,{fontSize:(r=C.props.fontSize)!=null?r:l}),ownerState:k,ref:t,className:R(x.root,y)},$,{classes:x}))}),J=q;export{J as C};

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
import{C as o}from"./ConfiguredCorporateContext.9c26b20c.js";import{f as r,S as t,aS as a}from"./index.2830a4a3.js";function f(){return r(t,{sx:{display:{lg:"flex"},minHeight:{lg:1}},children:r(o,{children:r(a,{})})})}export{f as default};

View File

@@ -0,0 +1 @@
import{C as o}from"./ConfiguredCorporateContext.f7fa099a.js";import{f as r,S as t,aS as a}from"./index.eaf14aef.js";function f(){return r(t,{sx:{display:{lg:"flex"},minHeight:{lg:1}},children:r(o,{children:r(a,{})})})}export{f as default};

View File

@@ -1 +1 @@
import{r,aT as n,Y as c,f as p}from"./index.2830a4a3.js";const i={currentCorporate:null},u=r.exports.createContext(i);function C({children:t}){const{corporate_id:o}=n(),[e,a]=r.exports.useState(null);return r.exports.useEffect(()=>{console.log("calling corporate"+o),c.get(`corporates/${o}`).then(s=>{a(s.data)})},[]),p(u.Provider,{value:{currentCorporate:e},children:t})}export{C,u as a};
import{r,aT as n,Y as c,f as p}from"./index.eaf14aef.js";const i={currentCorporate:null},u=r.exports.createContext(i);function C({children:t}){const{corporate_id:o}=n(),[e,a]=r.exports.useState(null);return r.exports.useEffect(()=>{console.log("calling corporate"+o),c.get(`corporates/${o}`).then(s=>{a(s.data)})},[]),p(u.Provider,{value:{currentCorporate:e},children:t})}export{C,u as a};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
import{a as j,r as k,b0 as H,c as R,d as U,e as V,f as d,F as q,S as A,j as m,B as T,bU as E,t as y,T as _,Y as F,o as I,ap as L,aT as G,C as J}from"./index.eaf14aef.js";import{P as K}from"./Page.c2cde06d.js";import{R as Y}from"./RHFSwitch.8d329605.js";import{C as o}from"./Card.4687a3ba.js";import{G as p}from"./Grid.dda358cb.js";import{C as $}from"./Chip.35ff2c8a.js";import{H as O}from"./HeaderBreadcrumbs.91259cd4.js";import"./FormControlLabel.877bb59b.js";y(_)(({theme:l})=>({...l.typography.subtitle2,color:l.palette.text.secondary,marginBottom:l.spacing(1)}));const Q=y("header")(({theme:l})=>({paddingBottom:l.spacing(5),display:"flex",alignItems:"center",justifyContent:"space-between"})),C=y(_)(({theme:l})=>({...l.typography.h4,boxShadow:"none",fontWeight:700,color:"#005B7F"})),f=y(_)(({theme:l})=>({boxShadow:"none",paddingBottom:l.spacing(1)})),a=y(_)(({theme:l})=>({boxShadow:"none",paddingBottom:l.spacing(3)}));function X({isEdit:l,currentPractitioner:s}){var W,D;j(),k.exports.useState([]);const{enqueueSnackbar:x}=H(),b=R().shape({name:U().required("Name is required")}),S=k.exports.useMemo(()=>({id:s==null?void 0:s.id,name:(s==null?void 0:s.name)||"",address:(s==null?void 0:s.address)||"",birth_date:(s==null?void 0:s.birth_date)||"",gender:(s==null?void 0:s.gender)||"",description:(s==null?void 0:s.description)||"",birth_place:(s==null?void 0:s.birth_place)||"",active:(s==null?void 0:s.active)===1,avatar_url:(s==null?void 0:s.avatar_url)||"",doctor_id:(s==null?void 0:s.doctor_id)||"",organizations:(s==null?void 0:s.organizations)||[],specialities:(s==null?void 0:s.specialities)||[]}),[s]);console.log("defaultValues",S);function v({value:h}){return d($,{label:h?"Aktif":"Tidak Aktif",size:"medium",sx:{backgroundColor:h?"rgba(84, 214, 44, 0.16)":"rgba(255, 72, 66, 0.16)",color:h?"#229A16":"#B72136",padding:"1 8 1 8 px",borderRadius:"4px",fontSize:"12px",fontWeight:"bold"}})}const w=V({resolver:I(b),defaultValues:S}),{reset:B,watch:z,control:Z,setValue:M,getValues:e,setError:u,handleSubmit:i,formState:{isSubmitting:n}}=w,N=z();return k.exports.useEffect(()=>{l&&s&&B(S),l||B(S)},[l,s]),d(q,{methods:w,children:d(A,{spacing:3,children:m(T,{sx:{width:"100%"},children:[m(o,{sx:{p:5},children:[m(Q,{children:[d(p,{item:!0,xs:6,md:6,children:d(C,{children:"Data Dokter"})}),m(p,{item:!0,xs:6,md:6,children:[d(Y,{name:"active",label:"",onClick:h=>{M("active",h.target.checked),console.log("event.target.checked",h.target.checked);const g=new FormData;g.append("active",h.target.checked?"1":"0"),g.append("_method","PUT"),F.post("/doctors/"+(s==null?void 0:s.id),g),x("active Updated Successfully!",{variant:"success"})}}),d(v,{value:N.active})]})]}),d(C,{variant:"h5",children:"Informasi Umum"}),d(E,{alt:"Remy Sharp",src:s==null?void 0:s.avatar_url,sx:{width:120,height:120,marginBottom:2}}),m(p,{container:!0,rowSpacing:1,columnSpacing:{xs:1,sm:2,md:3},children:[m(p,{item:!0,xs:7,children:[d(f,{style:{fontWeight:"bold"},children:"Nama Dokter"}),d(a,{children:s!=null&&s.name?s==null?void 0:s.name:"-"}),d(f,{style:{fontWeight:"bold"},children:"No Telp"}),d(a,{children:s!=null&&s.phone?s==null?void 0:s.phone:"-"}),d(f,{style:{fontWeight:"bold"},children:"Tempat Lahir"}),d(a,{children:s!=null&&s.birth_place?s==null?void 0:s.birth_place:"-"}),d(f,{style:{fontWeight:"bold"},children:"Alamat"}),d(a,{children:s!=null&&s.address?s==null?void 0:s.address:"-"})]}),m(p,{item:!0,xs:5,columnSpacing:{xs:1,sm:2,md:3},children:[d(f,{style:{fontWeight:"bold"},children:"Jenis Kelamin"}),d(a,{children:s!=null&&s.gender?s==null?void 0:s.gender:"-"}),d(f,{style:{fontWeight:"bold"},children:"Email"}),d(a,{children:s!=null&&s.email?s==null?void 0:s.email:"-"}),d(f,{style:{fontWeight:"bold"},children:"Tanggal Lahir"}),d(a,{children:s!=null&&s.birth_date?s==null?void 0:s.birth_date:"-"})]})]})]}),m(o,{sx:{p:5,marginTop:2},children:[d(C,{variant:"h5",children:"Tempat Praktik"}),(W=s==null?void 0:s.organizations)==null?void 0:W.map((h,g)=>d(T,{sx:{mt:3},children:d(p,{container:!0,rowSpacing:1,columnSpacing:{xs:1,sm:2,md:3},children:d(p,{item:!0,xs:7,children:d(a,{children:h.name})})})},g))]}),m(o,{sx:{p:5,marginTop:2},children:[d(C,{variant:"h5",children:"Spesialisasi"}),(D=s==null?void 0:s.specialities)==null?void 0:D.map((h,g)=>d(T,{sx:{mt:3},children:d(p,{container:!0,rowSpacing:1,columnSpacing:{xs:1,sm:2,md:3},children:d(p,{item:!0,xs:7,children:d(a,{children:h.name})})})},g))]})]})})})}function ps(){var v;const{themeStretch:l}=L(),{id:s}=G(),x=!!s,[b,S]=k.exports.useState();return k.exports.useEffect(()=>{x&&F.get("/doctors/"+s).then(w=>{S(w.data)})},[s]),d(K,{title:"Membership: Create a new Dokter",children:m(J,{maxWidth:l?!1:"xl",children:[d(A,{direction:"row",alignItems:"center",children:d(O,{heading:x?"Manage Dokter":"Manage a new Dokter",links:[{name:"Master",href:"/master"},{name:"Doctors",href:"/master/doctors"},{name:x?(v=b==null?void 0:b.name)!=null?v:"":"Create"}]})}),d(X,{isEdit:x,currentPractitioner:b})]})})}export{ps as default};

View File

@@ -1 +1 @@
import{ap as C,aT as D,c as v,d,bC as y,r as m,e as S,j as a,f as e,F as O,S as l,T as t,R as u,bK as h,aB as p,o as B}from"./index.2830a4a3.js";import{H as F}from"./HeaderBreadcrumbs.48c93fe3.js";import{R as i}from"./RHFCheckbox.c459a77a.js";import{P as E}from"./Page.1b52de0c.js";import{G as n}from"./Grid.f80372c7.js";import{C as I}from"./Card.86cb2364.js";import"./FormControlLabel.091f6f29.js";import"./Checkbox.08fcd00a.js";function w(){C(),D();const f=v().shape({name:d().required("Name is required"),code:d().required("Corporate Code is required"),active:y().required("Corporate Status is required")}),x=m.exports.useMemo(()=>({code:""}),[]),s=S({resolver:B(f),defaultValues:x}),{reset:q,watch:P,control:H,setValue:N,getValues:R,setError:T,handleSubmit:g,formState:{isSubmitting:V}}=s,b=async r=>{console.log(r)};m.exports.useState(!1);const c=[{category:"General Practitioner",childs:[{name:"External Doctor Online",code:"gp-external-doctor-online"},{name:"External Doctor Offline",code:"gp-external-doctor-offline"},{name:"Internal Doctor Online",code:"gp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"gp-internal-doctor-offline"}]},{category:"Specialist",childs:[{name:"External Doctor Online",code:"sp-external-doctor-online"},{name:"External Doctor Offline",code:"sp-external-doctor-offline"},{name:"Internal Doctor Online",code:"sp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"sp-internal-doctor-offline"}]},{category:"Medicines",childs:[{name:"Vitamins",code:"medicines-vitamins"},{name:"Delivery Fee",code:"medicines-delivery-fee"}]}];return a(E,{title:"Create Benefit",children:[e(F,{heading:"Create Benefit",links:[{name:"Dashboard",href:"/dashboard"},{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+id},{name:"Benefits",href:"/corporates/"+id+"/benefits"},{name:"Create",href:"/corporates/"+id+"/benefits/create"}]}),e(n,{container:!0,spacing:2,children:e(n,{item:!0,xs:12,children:e(I,{sx:{p:2},children:e(O,{methods:s,onSubmit:g(b),children:a(l,{spacing:3,children:[e(t,{variant:"h6",children:"Benefit Detail"}),e(u,{name:"name",label:"Benefit Name"}),e(u,{name:"code",label:"Benefit Code"}),e(t,{variant:"h6",children:"Benefit Configuration"}),e(h,{orientation:"horizontal",flexItem:!0}),a(l,{spacing:3,divider:e(h,{orientation:"horizontal",flexItem:!0}),children:[a(l,{spacing:2,children:[e(i,{name:"a",label:"Outpatient"}),c.map(r=>a(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:r.category}),e(n,{container:!0,children:r.childs.map(o=>e(n,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(n,{container:!0,children:c.map(r=>e(n,{item:!0,xs:4,children:e(i,{name:"cat",label:r.category})}))})]}),a(l,{spacing:2,children:[e(i,{name:"a",label:"Inpatient"}),c.map(r=>a(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:r.category}),e(n,{container:!0,children:r.childs.map(o=>e(n,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(n,{container:!0,children:c.map(r=>e(n,{item:!0,xs:4,children:e(i,{name:"cat",label:r.category})}))})]})]})]})})})})})]})}export{w as default};
import{ap as C,aT as D,c as v,d,b1 as y,r as m,e as S,j as a,f as e,F as O,S as l,T as t,R as u,bK as h,aB as p,o as B}from"./index.eaf14aef.js";import{H as F}from"./HeaderBreadcrumbs.91259cd4.js";import{R as i}from"./RHFCheckbox.eaa17da9.js";import{P as E}from"./Page.c2cde06d.js";import{G as n}from"./Grid.dda358cb.js";import{C as I}from"./Card.4687a3ba.js";import"./FormControlLabel.877bb59b.js";import"./Checkbox.114833ca.js";function w(){C(),D();const f=v().shape({name:d().required("Name is required"),code:d().required("Corporate Code is required"),active:y().required("Corporate Status is required")}),x=m.exports.useMemo(()=>({code:""}),[]),s=S({resolver:B(f),defaultValues:x}),{reset:q,watch:P,control:H,setValue:N,getValues:R,setError:T,handleSubmit:g,formState:{isSubmitting:V}}=s,b=async r=>{console.log(r)};m.exports.useState(!1);const c=[{category:"General Practitioner",childs:[{name:"External Doctor Online",code:"gp-external-doctor-online"},{name:"External Doctor Offline",code:"gp-external-doctor-offline"},{name:"Internal Doctor Online",code:"gp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"gp-internal-doctor-offline"}]},{category:"Specialist",childs:[{name:"External Doctor Online",code:"sp-external-doctor-online"},{name:"External Doctor Offline",code:"sp-external-doctor-offline"},{name:"Internal Doctor Online",code:"sp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"sp-internal-doctor-offline"}]},{category:"Medicines",childs:[{name:"Vitamins",code:"medicines-vitamins"},{name:"Delivery Fee",code:"medicines-delivery-fee"}]}];return a(E,{title:"Create Benefit",children:[e(F,{heading:"Create Benefit",links:[{name:"Dashboard",href:"/dashboard"},{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+id},{name:"Benefits",href:"/corporates/"+id+"/benefits"},{name:"Create",href:"/corporates/"+id+"/benefits/create"}]}),e(n,{container:!0,spacing:2,children:e(n,{item:!0,xs:12,children:e(I,{sx:{p:2},children:e(O,{methods:s,onSubmit:g(b),children:a(l,{spacing:3,children:[e(t,{variant:"h6",children:"Benefit Detail"}),e(u,{name:"name",label:"Benefit Name"}),e(u,{name:"code",label:"Benefit Code"}),e(t,{variant:"h6",children:"Benefit Configuration"}),e(h,{orientation:"horizontal",flexItem:!0}),a(l,{spacing:3,divider:e(h,{orientation:"horizontal",flexItem:!0}),children:[a(l,{spacing:2,children:[e(i,{name:"a",label:"Outpatient"}),c.map(r=>a(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:r.category}),e(n,{container:!0,children:r.childs.map(o=>e(n,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(n,{container:!0,children:c.map(r=>e(n,{item:!0,xs:4,children:e(i,{name:"cat",label:r.category})}))})]}),a(l,{spacing:2,children:[e(i,{name:"a",label:"Inpatient"}),c.map(r=>a(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:r.category}),e(n,{container:!0,children:r.childs.map(o=>e(n,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(n,{container:!0,children:c.map(r=>e(n,{item:!0,xs:4,children:e(i,{name:"cat",label:r.category})}))})]})]})]})})})})})]})}export{w as default};

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{a as $,bB as z,c as L,d as x,r as a,e as P,f as t,F as A,j as m,S as Y,T as h,R,$ as j,k as _,t as J,Y as V,o as T,ap as K,bC as Q}from"./index.2830a4a3.js";import{H as X}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as Z}from"./Page.1b52de0c.js";import{d as F}from"./Cancel.3d709ee0.js";import{B as ee}from"./ButtonGroup.8b7534ff.js";import{G as I}from"./Grid.f80372c7.js";import{C as te}from"./Card.86cb2364.js";import"./jsx-runtime_commonjs-proxy.92370fb9.js";J(h)(({theme:s})=>({...s.typography.subtitle2,color:s.palette.text.secondary,marginBottom:s.spacing(1)}));function se({isEdit:s,currentFormularium:e}){const g=$(),{enqueueSnackbar:c}=z(),v=L().shape({name:x().required("Name is required")}),i=a.exports.useMemo(()=>({code:(e==null?void 0:e.code)||"",name:(e==null?void 0:e.name)||""}),[e]),d=P({resolver:T(v),defaultValues:i}),{reset:p,watch:C,control:W,setValue:S,getValues:D,setError:y,handleSubmit:q,formState:{isSubmitting:b}}=d;C(),a.exports.useEffect(()=>{s&&e&&p(i),s||p(i)},[s,e]);const u=async r=>{var N,w;try{if(s){const n=await V.put("/master/formulariums/"+(e==null?void 0:e.id),r)}else{const n=await V.post("/master/formulariums",r)}p(),c(s?"Formularium Udpated Successfully!":"Formularium Created Successfully!",{variant:"success"}),g("/master/formularium")}catch(n){if(n&&n.response.status===422)for(const[O,B]of Object.entries(n.response.data.errors))y(O,{message:B[0]}),c((N=B[0])!=null?N:"Failed Processing Request",{variant:"error"});else c((w=n.message)!=null?w:"Failed Processing Request",{variant:"error"})}const l=document==null?void 0:document.querySelector("ascent");l!=null&&(l.innerHTML="")};a.exports.useCallback(r=>{S("logo",r.map(l=>Object.assign(l,{preview:URL.createObjectURL(l)})))},[S]);const o=a.exports.useRef(null),[ae,E]=a.exports.useState(null),[f,k]=a.exports.useState(null),H=()=>{E(null)},M=()=>{o!=null&&o.current?(H(),o.current?o.current.click():console.log("No File selected")):alert("No file selected")},U=()=>{o.current.value="",o.current.dispatchEvent(new Event("change",{bubbles:!0}))},G=r=>{r.target.files[0]?k(r.target.files[0].name):k(null)};return t(A,{methods:d,onSubmit:q(u),children:m(Y,{spacing:3,children:[t(h,{variant:"h6",children:"Formularium Detail"}),m("div",{children:[t(R,{name:"code",label:"Code"}),!(e!=null&&e.id)&&t(h,{variant:"caption",children:"Will be generated if empty"})]}),t(R,{name:"name",label:"Name"}),t(h,{variant:"h6",children:"Formularium Drug List Import"}),t("input",{type:"file",id:"file",ref:o,style:{display:"none"},onChange:G,accept:".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"}),m(ee,{variant:"outlined","aria-label":"outlined button group",fullWidth:!0,children:[t(j,{onClick:M,fullWidth:!0,children:f!=null?f:"No File Selected"}),f&&t(j,{onClick:U,size:"small",fullWidth:!1,sx:{p:1.8},children:t(F,{color:"error"})})]}),t(_,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:b,children:s?"Save Update":"Save New Corporate"})]})})}function ue(){K();const[s,e]=a.exports.useState(!1),[g,c]=a.exports.useState({}),v=L().shape({name:x().required("Name is required"),code:x().required("Corporate Code is required"),active:Q().required("Corporate Status is required")}),i=a.exports.useMemo(()=>({code:""}),[]),d=P({resolver:T(v),defaultValues:i}),{reset:p,watch:C,control:W,setValue:S,getValues:D,setError:y,handleSubmit:q,formState:{isSubmitting:b}}=d,u="Create Formularium";return m(Z,{title:u,children:[t(X,{heading:u,links:[{name:"Master",href:"/master"},{name:"Formularium",href:"/master/formularium/"},{name:"Create",href:"/master/formularium/create/"}]}),t(I,{container:!0,spacing:2,children:t(I,{item:!0,xs:12,children:t(te,{sx:{p:2},children:t(se,{isSubmitting:b,isEdit:s,currentFormularium:g})})})})]})}export{ue as default};
import{a as $,b0 as z,c as L,d as x,r as a,e as P,f as t,F as A,j as m,S as Y,T as h,R,$ as j,k as _,t as J,Y as V,o as T,ap as K,b1 as Q}from"./index.eaf14aef.js";import{H as X}from"./HeaderBreadcrumbs.91259cd4.js";import{P as Z}from"./Page.c2cde06d.js";import{d as F}from"./Cancel.f9f3a05e.js";import{B as ee}from"./ButtonGroup.227d2582.js";import{G as I}from"./Grid.dda358cb.js";import{C as te}from"./Card.4687a3ba.js";import"./jsx-runtime_commonjs-proxy.20d2a437.js";J(h)(({theme:s})=>({...s.typography.subtitle2,color:s.palette.text.secondary,marginBottom:s.spacing(1)}));function se({isEdit:s,currentFormularium:e}){const g=$(),{enqueueSnackbar:c}=z(),v=L().shape({name:x().required("Name is required")}),i=a.exports.useMemo(()=>({code:(e==null?void 0:e.code)||"",name:(e==null?void 0:e.name)||""}),[e]),d=P({resolver:T(v),defaultValues:i}),{reset:p,watch:C,control:W,setValue:S,getValues:D,setError:y,handleSubmit:q,formState:{isSubmitting:b}}=d;C(),a.exports.useEffect(()=>{s&&e&&p(i),s||p(i)},[s,e]);const u=async r=>{var N,w;try{if(s){const n=await V.put("/master/formulariums/"+(e==null?void 0:e.id),r)}else{const n=await V.post("/master/formulariums",r)}p(),c(s?"Formularium Udpated Successfully!":"Formularium Created Successfully!",{variant:"success"}),g("/master/formularium")}catch(n){if(n&&n.response.status===422)for(const[O,B]of Object.entries(n.response.data.errors))y(O,{message:B[0]}),c((N=B[0])!=null?N:"Failed Processing Request",{variant:"error"});else c((w=n.message)!=null?w:"Failed Processing Request",{variant:"error"})}const l=document==null?void 0:document.querySelector("ascent");l!=null&&(l.innerHTML="")};a.exports.useCallback(r=>{S("logo",r.map(l=>Object.assign(l,{preview:URL.createObjectURL(l)})))},[S]);const o=a.exports.useRef(null),[ae,E]=a.exports.useState(null),[f,k]=a.exports.useState(null),H=()=>{E(null)},M=()=>{o!=null&&o.current?(H(),o.current?o.current.click():console.log("No File selected")):alert("No file selected")},U=()=>{o.current.value="",o.current.dispatchEvent(new Event("change",{bubbles:!0}))},G=r=>{r.target.files[0]?k(r.target.files[0].name):k(null)};return t(A,{methods:d,onSubmit:q(u),children:m(Y,{spacing:3,children:[t(h,{variant:"h6",children:"Formularium Detail"}),m("div",{children:[t(R,{name:"code",label:"Code"}),!(e!=null&&e.id)&&t(h,{variant:"caption",children:"Will be generated if empty"})]}),t(R,{name:"name",label:"Name"}),t(h,{variant:"h6",children:"Formularium Drug List Import"}),t("input",{type:"file",id:"file",ref:o,style:{display:"none"},onChange:G,accept:".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"}),m(ee,{variant:"outlined","aria-label":"outlined button group",fullWidth:!0,children:[t(j,{onClick:M,fullWidth:!0,children:f!=null?f:"No File Selected"}),f&&t(j,{onClick:U,size:"small",fullWidth:!1,sx:{p:1.8},children:t(F,{color:"error"})})]}),t(_,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:b,children:s?"Save Update":"Save New Corporate"})]})})}function ue(){K();const[s,e]=a.exports.useState(!1),[g,c]=a.exports.useState({}),v=L().shape({name:x().required("Name is required"),code:x().required("Corporate Code is required"),active:Q().required("Corporate Status is required")}),i=a.exports.useMemo(()=>({code:""}),[]),d=P({resolver:T(v),defaultValues:i}),{reset:p,watch:C,control:W,setValue:S,getValues:D,setError:y,handleSubmit:q,formState:{isSubmitting:b}}=d,u="Create Formularium";return m(Z,{title:u,children:[t(X,{heading:u,links:[{name:"Master",href:"/master"},{name:"Formularium",href:"/master/formularium/"},{name:"Create",href:"/master/formularium/create/"}]}),t(I,{container:!0,spacing:2,children:t(I,{item:!0,xs:12,children:t(te,{sx:{p:2},children:t(se,{isSubmitting:b,isEdit:s,currentFormularium:g})})})})]})}export{ue as default};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
import{a as j,r as k,b0 as H,c as R,d as U,e as V,f as d,F as q,S as A,j as m,B as T,bU as E,t as y,T as _,Y as F,o as I,ap as L,aT as G,C as J}from"./index.eaf14aef.js";import{P as K}from"./Page.c2cde06d.js";import{R as Y}from"./RHFSwitch.8d329605.js";import{C as o}from"./Card.4687a3ba.js";import{G as p}from"./Grid.dda358cb.js";import{C as $}from"./Chip.35ff2c8a.js";import{H as O}from"./HeaderBreadcrumbs.91259cd4.js";import"./FormControlLabel.877bb59b.js";y(_)(({theme:l})=>({...l.typography.subtitle2,color:l.palette.text.secondary,marginBottom:l.spacing(1)}));const Q=y("header")(({theme:l})=>({paddingBottom:l.spacing(5),display:"flex",alignItems:"center",justifyContent:"space-between"})),C=y(_)(({theme:l})=>({...l.typography.h4,boxShadow:"none",fontWeight:700,color:"#005B7F"})),f=y(_)(({theme:l})=>({boxShadow:"none",paddingBottom:l.spacing(1)})),a=y(_)(({theme:l})=>({boxShadow:"none",paddingBottom:l.spacing(3)}));function X({isEdit:l,currentPractitioner:s}){var W,D;j(),k.exports.useState([]);const{enqueueSnackbar:x}=H(),b=R().shape({name:U().required("Name is required")}),S=k.exports.useMemo(()=>({id:s==null?void 0:s.id,name:(s==null?void 0:s.name)||"",address:(s==null?void 0:s.address)||"",birth_date:(s==null?void 0:s.birth_date)||"",gender:(s==null?void 0:s.gender)||"",description:(s==null?void 0:s.description)||"",birth_place:(s==null?void 0:s.birth_place)||"",active:(s==null?void 0:s.active)===1,avatar_url:(s==null?void 0:s.avatar_url)||"",doctor_id:(s==null?void 0:s.doctor_id)||"",organizations:(s==null?void 0:s.organizations)||[],specialities:(s==null?void 0:s.specialities)||[]}),[s]);console.log("defaultValues",S);function v({value:h}){return d($,{label:h?"Aktif":"Tidak Aktif",size:"medium",sx:{backgroundColor:h?"rgba(84, 214, 44, 0.16)":"rgba(255, 72, 66, 0.16)",color:h?"#229A16":"#B72136",padding:"1 8 1 8 px",borderRadius:"4px",fontSize:"12px",fontWeight:"bold"}})}const w=V({resolver:I(b),defaultValues:S}),{reset:B,watch:z,control:Z,setValue:M,getValues:e,setError:u,handleSubmit:i,formState:{isSubmitting:n}}=w,N=z();return k.exports.useEffect(()=>{l&&s&&B(S),l||B(S)},[l,s]),d(q,{methods:w,children:d(A,{spacing:3,children:m(T,{sx:{width:"100%"},children:[m(o,{sx:{p:5},children:[m(Q,{children:[d(p,{item:!0,xs:6,md:6,children:d(C,{children:"Data Dokter"})}),m(p,{item:!0,xs:6,md:6,children:[d(Y,{name:"active",label:"",onClick:h=>{M("active",h.target.checked),console.log("event.target.checked",h.target.checked);const g=new FormData;g.append("active",h.target.checked?"1":"0"),g.append("_method","PUT"),F.post("/doctors/"+(s==null?void 0:s.id),g),x("active Updated Successfully!",{variant:"success"})}}),d(v,{value:N.active})]})]}),d(C,{variant:"h5",children:"Informasi Umum"}),d(E,{alt:"Remy Sharp",src:s==null?void 0:s.avatar_url,sx:{width:120,height:120,marginBottom:2}}),m(p,{container:!0,rowSpacing:1,columnSpacing:{xs:1,sm:2,md:3},children:[m(p,{item:!0,xs:7,children:[d(f,{style:{fontWeight:"bold"},children:"Nama Dokter"}),d(a,{children:s!=null&&s.name?s==null?void 0:s.name:"-"}),d(f,{style:{fontWeight:"bold"},children:"No Telp"}),d(a,{children:s!=null&&s.phone?s==null?void 0:s.phone:"-"}),d(f,{style:{fontWeight:"bold"},children:"Tempat Lahir"}),d(a,{children:s!=null&&s.birth_place?s==null?void 0:s.birth_place:"-"}),d(f,{style:{fontWeight:"bold"},children:"Alamat"}),d(a,{children:s!=null&&s.address?s==null?void 0:s.address:"-"})]}),m(p,{item:!0,xs:5,columnSpacing:{xs:1,sm:2,md:3},children:[d(f,{style:{fontWeight:"bold"},children:"Jenis Kelamin"}),d(a,{children:s!=null&&s.gender?s==null?void 0:s.gender:"-"}),d(f,{style:{fontWeight:"bold"},children:"Email"}),d(a,{children:s!=null&&s.email?s==null?void 0:s.email:"-"}),d(f,{style:{fontWeight:"bold"},children:"Tanggal Lahir"}),d(a,{children:s!=null&&s.birth_date?s==null?void 0:s.birth_date:"-"})]})]})]}),m(o,{sx:{p:5,marginTop:2},children:[d(C,{variant:"h5",children:"Tempat Praktik"}),(W=s==null?void 0:s.organizations)==null?void 0:W.map((h,g)=>d(T,{sx:{mt:3},children:d(p,{container:!0,rowSpacing:1,columnSpacing:{xs:1,sm:2,md:3},children:d(p,{item:!0,xs:7,children:d(a,{children:h.name})})})},g))]}),m(o,{sx:{p:5,marginTop:2},children:[d(C,{variant:"h5",children:"Spesialisasi"}),(D=s==null?void 0:s.specialities)==null?void 0:D.map((h,g)=>d(T,{sx:{mt:3},children:d(p,{container:!0,rowSpacing:1,columnSpacing:{xs:1,sm:2,md:3},children:d(p,{item:!0,xs:7,children:d(a,{children:h.name})})})},g))]})]})})})}function ps(){var v;const{themeStretch:l}=L(),{id:s}=G(),x=!!s,[b,S]=k.exports.useState();return k.exports.useEffect(()=>{x&&F.get("/doctors/"+s).then(w=>{S(w.data)})},[s]),d(K,{title:"Membership: Create a new Dokter",children:m(J,{maxWidth:l?!1:"xl",children:[d(A,{direction:"row",alignItems:"center",children:d(O,{heading:x?"Manage Dokter":"Manage a new Dokter",links:[{name:"Master",href:"/master"},{name:"Doctors",href:"/master/doctors"},{name:x?(v=b==null?void 0:b.name)!=null?v:"":"Create"}]})}),d(X,{isEdit:x,currentPractitioner:b})]})})}export{ps as default};

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{ap as t,u as r,f as q,j as s,C as n,T as a}from"./index.2830a4a3.js";import{P as h}from"./Page.1b52de0c.js";function p(){const{themeStretch:e}=t();return r(),q(h,{title:"Create Obat",children:s(n,{maxWidth:e?!1:"xl",children:[q(a,{variant:"h3",component:"h1",paragraph:!0,children:"Create Obat"}),q(a,{children:"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"})]})})}export{p as default};
import{ap as t,u as r,f as q,j as s,C as n,T as a}from"./index.eaf14aef.js";import{P as h}from"./Page.c2cde06d.js";function p(){const{themeStretch:e}=t();return r(),q(h,{title:"Create Obat",children:s(n,{maxWidth:e?!1:"xl",children:[q(a,{variant:"h3",component:"h1",paragraph:!0,children:"Create Obat"}),q(a,{children:"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"})]})})}export{p as default};

View File

@@ -1 +1 @@
import{ap as D,aT as C,c as S,d as m,bC as y,r as u,e as v,j as n,f as e,F as O,S as s,T as t,R as l,bK as h,aB as p,o as P}from"./index.2830a4a3.js";import{H as F}from"./HeaderBreadcrumbs.48c93fe3.js";import{R as i}from"./RHFCheckbox.c459a77a.js";import{P as E}from"./Page.1b52de0c.js";import{G as r}from"./Grid.f80372c7.js";import{C as Y}from"./Card.86cb2364.js";import"./FormControlLabel.091f6f29.js";import"./Checkbox.08fcd00a.js";function K(){D(),C();const f=S().shape({name:m().required("Name is required"),code:m().required("Corporate Code is required"),active:y().required("Corporate Status is required")}),x=u.exports.useMemo(()=>({code:""}),[]),d=v({resolver:P(f),defaultValues:x}),{reset:I,watch:q,control:M,setValue:H,getValues:N,setError:R,handleSubmit:g,formState:{isSubmitting:T}}=d,b=async a=>{console.log(a)};u.exports.useState(!1);const c=[{category:"General Practitioner",childs:[{name:"External Doctor Online",code:"gp-external-doctor-online"},{name:"External Doctor Offline",code:"gp-external-doctor-offline"},{name:"Internal Doctor Online",code:"gp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"gp-internal-doctor-offline"}]},{category:"Specialist",childs:[{name:"External Doctor Online",code:"sp-external-doctor-online"},{name:"External Doctor Offline",code:"sp-external-doctor-offline"},{name:"Internal Doctor Online",code:"sp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"sp-internal-doctor-offline"}]},{category:"Medicines",childs:[{name:"Vitamins",code:"medicines-vitamins"},{name:"Delivery Fee",code:"medicines-delivery-fee"}]}];return n(E,{title:"Create Plan",children:[e(F,{heading:"Create Plan",links:[{name:"Dashboard",href:"/dashboard"},{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+id},{name:"Plans",href:"/corporates/"+id+"/plans"},{name:"Create",href:"/corporates/"+id+"/plans/create"}]}),e(r,{container:!0,spacing:2,children:e(r,{item:!0,xs:12,children:e(Y,{sx:{p:2},children:e(O,{methods:d,onSubmit:g(b),children:n(s,{spacing:3,children:[e(t,{variant:"h6",children:"Plan Detail"}),e(l,{name:"name",label:"Name"}),e(l,{name:"code",label:"Code"}),e(l,{name:"limit",label:"Limit"}),e(l,{name:"start",label:"Start (YYYY-MM-DD)"}),e(l,{name:"end",label:"End (YYYY-MM-DD)"}),e(t,{variant:"h6",children:"Benefit Configuration"}),e(h,{orientation:"horizontal",flexItem:!0}),n(s,{spacing:3,divider:e(h,{orientation:"horizontal",flexItem:!0}),children:[n(s,{spacing:2,children:[e(i,{name:"a",label:"Outpatient"}),c.map(a=>n(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:a.category}),e(r,{container:!0,children:a.childs.map(o=>e(r,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(r,{container:!0,children:c.map(a=>e(r,{item:!0,xs:4,children:e(i,{name:"cat",label:a.category})}))})]}),n(s,{spacing:2,children:[e(i,{name:"a",label:"Inpatient"}),c.map(a=>n(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:a.category}),e(r,{container:!0,children:a.childs.map(o=>e(r,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(r,{container:!0,children:c.map(a=>e(r,{item:!0,xs:4,children:e(i,{name:"cat",label:a.category})}))})]})]})]})})})})})]})}export{K as default};
import{ap as D,aT as C,c as S,d as m,b1 as y,r as u,e as v,j as n,f as e,F as O,S as s,T as t,R as l,bK as h,aB as p,o as P}from"./index.eaf14aef.js";import{H as F}from"./HeaderBreadcrumbs.91259cd4.js";import{R as i}from"./RHFCheckbox.eaa17da9.js";import{P as E}from"./Page.c2cde06d.js";import{G as r}from"./Grid.dda358cb.js";import{C as Y}from"./Card.4687a3ba.js";import"./FormControlLabel.877bb59b.js";import"./Checkbox.114833ca.js";function K(){D(),C();const f=S().shape({name:m().required("Name is required"),code:m().required("Corporate Code is required"),active:y().required("Corporate Status is required")}),x=u.exports.useMemo(()=>({code:""}),[]),d=v({resolver:P(f),defaultValues:x}),{reset:I,watch:q,control:M,setValue:H,getValues:N,setError:R,handleSubmit:g,formState:{isSubmitting:T}}=d,b=async a=>{console.log(a)};u.exports.useState(!1);const c=[{category:"General Practitioner",childs:[{name:"External Doctor Online",code:"gp-external-doctor-online"},{name:"External Doctor Offline",code:"gp-external-doctor-offline"},{name:"Internal Doctor Online",code:"gp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"gp-internal-doctor-offline"}]},{category:"Specialist",childs:[{name:"External Doctor Online",code:"sp-external-doctor-online"},{name:"External Doctor Offline",code:"sp-external-doctor-offline"},{name:"Internal Doctor Online",code:"sp-internal-doctor-online"},{name:"Internal Doctor Offline",code:"sp-internal-doctor-offline"}]},{category:"Medicines",childs:[{name:"Vitamins",code:"medicines-vitamins"},{name:"Delivery Fee",code:"medicines-delivery-fee"}]}];return n(E,{title:"Create Plan",children:[e(F,{heading:"Create Plan",links:[{name:"Dashboard",href:"/dashboard"},{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+id},{name:"Plans",href:"/corporates/"+id+"/plans"},{name:"Create",href:"/corporates/"+id+"/plans/create"}]}),e(r,{container:!0,spacing:2,children:e(r,{item:!0,xs:12,children:e(Y,{sx:{p:2},children:e(O,{methods:d,onSubmit:g(b),children:n(s,{spacing:3,children:[e(t,{variant:"h6",children:"Plan Detail"}),e(l,{name:"name",label:"Name"}),e(l,{name:"code",label:"Code"}),e(l,{name:"limit",label:"Limit"}),e(l,{name:"start",label:"Start (YYYY-MM-DD)"}),e(l,{name:"end",label:"End (YYYY-MM-DD)"}),e(t,{variant:"h6",children:"Benefit Configuration"}),e(h,{orientation:"horizontal",flexItem:!0}),n(s,{spacing:3,divider:e(h,{orientation:"horizontal",flexItem:!0}),children:[n(s,{spacing:2,children:[e(i,{name:"a",label:"Outpatient"}),c.map(a=>n(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:a.category}),e(r,{container:!0,children:a.childs.map(o=>e(r,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(r,{container:!0,children:c.map(a=>e(r,{item:!0,xs:4,children:e(i,{name:"cat",label:a.category})}))})]}),n(s,{spacing:2,children:[e(i,{name:"a",label:"Inpatient"}),c.map(a=>n(p,{in:!0,timeout:"auto",unmountOnExit:!0,children:[e(t,{children:a.category}),e(r,{container:!0,children:a.childs.map(o=>e(r,{item:!0,xs:6,children:e(i,{name:o.code,label:o.name})}))})]})),e(t,{children:"Admin Fee"}),e(r,{container:!0,children:c.map(a=>e(r,{item:!0,xs:4,children:e(i,{name:"cat",label:a.category})}))})]})]})]})})})})})]})}export{K as default};

View File

@@ -1 +1 @@
import{H as j}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as T}from"./Page.1b52de0c.js";import{bB as B,a as R,aT as k,c as E,d as b,r as m,e as V,f as a,F as D,j as n,S as x,T as S,R as F,k as G,Y as l,o as _,ap as z}from"./index.2830a4a3.js";import{R as A}from"./RHFSwitch.fe548aa3.js";import{R as L}from"./RHFEditor.8aa3b80b.js";import{G as p}from"./Grid.f80372c7.js";import{C as y}from"./Card.86cb2364.js";import"./FormControlLabel.091f6f29.js";function M({isEdit:s,currentCorporatePlan:e}){const{enqueueSnackbar:i}=B(),d=R(),{corporate_id:r}=k(),c=E().shape({name:b().required("Name is required"),code:b().required("Corporate Code is required")}),o=m.exports.useMemo(()=>({name:(e==null?void 0:e.name)||"",code:(e==null?void 0:e.code)||"",active:(e==null?void 0:e.active)||!0,description:(e==null?void 0:e.description)||""}),[e]);m.exports.useEffect(()=>{s&&e&&f(o),s||f(o)},[s,e]);const h=V({resolver:_(c),defaultValues:o}),{reset:f,watch:O,control:U,setValue:W,getValues:Y,setError:q,handleSubmit:w,formState:{isSubmitting:H}}=h;return a(D,{methods:h,onSubmit:w(async u=>{s?await l.put("/corporate/"+r+"/corporate-plans/"+(e==null?void 0:e.id),u).then(t=>{i("Corporate Plan updated successfully",{variant:"success"})}).then(t=>{d("/corporate/"+r+"/corporate-plans/",{replace:!0})}).catch(({response:t})=>{i("Update Failed : "+t.data.message,{variant:"error"})}):await l.post("/corporate/"+r+"/corporate-plans",u).then(t=>{i("Corporate Plan created successfully",{variant:"success"})}).then(t=>{d("/corporate/"+r+"/corporate-plans",{replace:!0})}).catch(({response:t})=>{var g;if(t.status===422)for(const[N,v]of Object.entries(t.data.errors))q(N,{message:v[0]}),i((g=v[0])!=null?g:"Failed Processing Request",{variant:"error"});else i("Create Failed : "+t.data.message,{variant:"error"})})}),children:n(p,{container:!0,spacing:2,children:[a(p,{item:!0,xs:8,children:a(y,{sx:{p:2},children:n(x,{spacing:3,children:[a(S,{variant:"h6",children:"Corporate Plan Detail"}),a(F,{name:"name",label:"Name"}),a(F,{name:"code",label:"Code"}),n(x,{spacing:1,children:[a(S,{variant:"subtitle2",sx:{color:"text.secondary"},children:"Description"}),a(L,{name:"description"})]}),a(G,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:H,children:"Create Corporate Plan"})]})})}),a(p,{item:!0,xs:4,children:a(y,{sx:{p:2},children:a(A,{name:"active",label:"Active"})})})]})})}function ee(){z();const{corporate_id:s,id:e}=k(),[i,d]=m.exports.useState(),r=R(),c=!!e;return m.exports.useEffect(()=>{c&&l.get("/corporates/"+s+"/corporate-plans/"+e+"/edit").then(o=>{d(o.data)}).catch(o=>{o.response.status===404&&r("/404")})},[s,e]),n(T,{title:"Create Corporate Plan",children:[a(j,{heading:"Create Corporate Plan",links:[{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+s},{name:"Corporate Plans",href:"/corporates/"+s+"/corporate-plans"},{name:c?"Edit":"Create",href:"/corporates/"+s+"/corporate-plans/"+e}]}),a(M,{isEdit:c,currentCorporatePlan:i})]})}export{ee as default};
import{H as j}from"./HeaderBreadcrumbs.91259cd4.js";import{P as T}from"./Page.c2cde06d.js";import{b0 as E,a as R,aT as k,c as V,d as b,r as m,e as B,f as a,F as D,j as n,S as x,T as S,R as F,k as G,Y as l,o as _,ap as z}from"./index.eaf14aef.js";import{R as A}from"./RHFSwitch.8d329605.js";import{R as L}from"./RHFEditor.3626228e.js";import{G as p}from"./Grid.dda358cb.js";import{C as y}from"./Card.4687a3ba.js";import"./FormControlLabel.877bb59b.js";function M({isEdit:s,currentCorporatePlan:e}){const{enqueueSnackbar:i}=E(),d=R(),{corporate_id:r}=k(),c=V().shape({name:b().required("Name is required"),code:b().required("Corporate Code is required")}),o=m.exports.useMemo(()=>({name:(e==null?void 0:e.name)||"",code:(e==null?void 0:e.code)||"",active:(e==null?void 0:e.active)||!0,description:(e==null?void 0:e.description)||""}),[e]);m.exports.useEffect(()=>{s&&e&&f(o),s||f(o)},[s,e]);const h=B({resolver:_(c),defaultValues:o}),{reset:f,watch:O,control:U,setValue:W,getValues:Y,setError:q,handleSubmit:w,formState:{isSubmitting:H}}=h;return a(D,{methods:h,onSubmit:w(async u=>{s?await l.put("/corporate/"+r+"/corporate-plans/"+(e==null?void 0:e.id),u).then(t=>{i("Corporate Plan updated successfully",{variant:"success"})}).then(t=>{d("/corporate/"+r+"/corporate-plans/",{replace:!0})}).catch(({response:t})=>{i("Update Failed : "+t.data.message,{variant:"error"})}):await l.post("/corporate/"+r+"/corporate-plans",u).then(t=>{i("Corporate Plan created successfully",{variant:"success"})}).then(t=>{d("/corporate/"+r+"/corporate-plans",{replace:!0})}).catch(({response:t})=>{var g;if(t.status===422)for(const[N,v]of Object.entries(t.data.errors))q(N,{message:v[0]}),i((g=v[0])!=null?g:"Failed Processing Request",{variant:"error"});else i("Create Failed : "+t.data.message,{variant:"error"})})}),children:n(p,{container:!0,spacing:2,children:[a(p,{item:!0,xs:8,children:a(y,{sx:{p:2},children:n(x,{spacing:3,children:[a(S,{variant:"h6",children:"Corporate Plan Detail"}),a(F,{name:"name",label:"Name"}),a(F,{name:"code",label:"Code"}),n(x,{spacing:1,children:[a(S,{variant:"subtitle2",sx:{color:"text.secondary"},children:"Description"}),a(L,{name:"description"})]}),a(G,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:H,children:"Create Corporate Plan"})]})})}),a(p,{item:!0,xs:4,children:a(y,{sx:{p:2},children:a(A,{name:"active",label:"Active"})})})]})})}function ee(){z();const{corporate_id:s,id:e}=k(),[i,d]=m.exports.useState(),r=R(),c=!!e;return m.exports.useEffect(()=>{c&&l.get("/corporates/"+s+"/corporate-plans/"+e+"/edit").then(o=>{d(o.data)}).catch(o=>{o.response.status===404&&r("/404")})},[s,e]),n(T,{title:"Create Corporate Plan",children:[a(j,{heading:"Create Corporate Plan",links:[{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+s},{name:"Corporate Plans",href:"/corporates/"+s+"/corporate-plans"},{name:c?"Edit":"Create",href:"/corporates/"+s+"/corporate-plans/"+e}]}),a(M,{isEdit:c,currentCorporatePlan:i})]})}export{ee as default};

View File

@@ -1 +1 @@
import{H as N}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as R}from"./Page.1b52de0c.js";import{bB as j,a as F,aT as P,c as H,d as v,r as d,e as T,f as a,F as V,j as m,S as C,T as G,R as S,k as U,Y as p,o as _,ap as z}from"./index.2830a4a3.js";import{R as A}from"./RHFSwitch.fe548aa3.js";import{G as l}from"./Grid.f80372c7.js";import{C as x}from"./Card.86cb2364.js";import"./FormControlLabel.091f6f29.js";function D({isEdit:s,currentCorporateBenefit:e}){const{enqueueSnackbar:r}=j(),n=F(),{corporate_id:i}=P(),c=H().shape({name:v().required("Name is required"),code:v().required("Corporate Code is required")}),o=d.exports.useMemo(()=>({name:(e==null?void 0:e.name)||"",code:(e==null?void 0:e.code)||"",active:(e==null?void 0:e.active)===1}),[e]);d.exports.useEffect(()=>{s&&e&&u(o),s||u(o)},[s,e]);const h=T({resolver:_(c),defaultValues:o}),{reset:u,watch:E,control:L,setValue:M,getValues:O,setError:y,handleSubmit:k,formState:{isSubmitting:q}}=h;return a(V,{methods:h,onSubmit:k(async f=>{s?await p.put("/corporate/"+i+"/corporate-benefits/"+(e==null?void 0:e.id),f).then(t=>{r("Corporate Benefit updated successfully",{variant:"success"})}).then(t=>{n("/corporate/"+i+"/corporate-benefits/",{replace:!0})}).catch(({response:t})=>{r("Update Failed : "+t.data.message,{variant:"error"})}):await p.post("/corporate/"+i+"/corporate-benefits",f).then(t=>{r("Corporate Plan created successfully",{variant:"success"})}).then(t=>{n("/corporate/"+i+"/corporate-benefits",{replace:!0})}).catch(({response:t})=>{var b;if(t.status===422)for(const[w,g]of Object.entries(t.data.errors))y(w,{message:g[0]}),r((b=g[0])!=null?b:"Failed Processing Request",{variant:"error"});else r("Create Failed : "+t.data.message,{variant:"error"})})}),children:m(l,{container:!0,spacing:2,children:[a(l,{item:!0,xs:8,children:a(x,{sx:{p:2},children:m(C,{spacing:3,children:[a(G,{variant:"h6",children:"Corporate Benefit Detail"}),a(S,{name:"name",label:"Name"}),a(S,{name:"code",label:"Code"}),a(U,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:q,children:s?"Update":"Create"})]})})}),a(l,{item:!0,xs:4,children:a(x,{sx:{p:2},children:a(A,{name:"active",label:"Active"})})})]})})}function Z(){z();const{corporate_id:s,id:e}=P(),[r,n]=d.exports.useState(),i=F(),c=!!e;return d.exports.useEffect(()=>{c&&p.get("/corporates/"+s+"/corporate-benefits/"+e+"/edit").then(o=>{n(o.data)}).catch(o=>{o.response.status===404&&i("/404")})},[s,e]),m(R,{title:"Create Corporate Benefit",children:[a(N,{heading:"Create Corporate Benefit",links:[{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+s},{name:"Corporate Benefits",href:"/corporates/"+s+"/corporate-benefits"},{name:c?"Edit":"Create",href:"/corporates/"+s+"/corporate-benefits/"+e}]}),a(D,{isEdit:c,currentCorporateBenefit:r})]})}export{Z as default};
import{H as N}from"./HeaderBreadcrumbs.91259cd4.js";import{P as R}from"./Page.c2cde06d.js";import{b0 as j,a as F,aT as P,c as H,d as v,r as d,e as T,f as a,F as V,j as m,S as C,T as G,R as S,k as U,Y as p,o as _,ap as z}from"./index.eaf14aef.js";import{R as A}from"./RHFSwitch.8d329605.js";import{G as l}from"./Grid.dda358cb.js";import{C as x}from"./Card.4687a3ba.js";import"./FormControlLabel.877bb59b.js";function D({isEdit:s,currentCorporateBenefit:e}){const{enqueueSnackbar:r}=j(),n=F(),{corporate_id:i}=P(),c=H().shape({name:v().required("Name is required"),code:v().required("Corporate Code is required")}),o=d.exports.useMemo(()=>({name:(e==null?void 0:e.name)||"",code:(e==null?void 0:e.code)||"",active:(e==null?void 0:e.active)===1}),[e]);d.exports.useEffect(()=>{s&&e&&u(o),s||u(o)},[s,e]);const h=T({resolver:_(c),defaultValues:o}),{reset:u,watch:E,control:L,setValue:M,getValues:O,setError:y,handleSubmit:k,formState:{isSubmitting:q}}=h;return a(V,{methods:h,onSubmit:k(async f=>{s?await p.put("/corporate/"+i+"/corporate-benefits/"+(e==null?void 0:e.id),f).then(t=>{r("Corporate Benefit updated successfully",{variant:"success"})}).then(t=>{n("/corporate/"+i+"/corporate-benefits/",{replace:!0})}).catch(({response:t})=>{r("Update Failed : "+t.data.message,{variant:"error"})}):await p.post("/corporate/"+i+"/corporate-benefits",f).then(t=>{r("Corporate Plan created successfully",{variant:"success"})}).then(t=>{n("/corporate/"+i+"/corporate-benefits",{replace:!0})}).catch(({response:t})=>{var b;if(t.status===422)for(const[w,g]of Object.entries(t.data.errors))y(w,{message:g[0]}),r((b=g[0])!=null?b:"Failed Processing Request",{variant:"error"});else r("Create Failed : "+t.data.message,{variant:"error"})})}),children:m(l,{container:!0,spacing:2,children:[a(l,{item:!0,xs:8,children:a(x,{sx:{p:2},children:m(C,{spacing:3,children:[a(G,{variant:"h6",children:"Corporate Benefit Detail"}),a(S,{name:"name",label:"Name"}),a(S,{name:"code",label:"Code"}),a(U,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:q,children:s?"Update":"Create"})]})})}),a(l,{item:!0,xs:4,children:a(x,{sx:{p:2},children:a(A,{name:"active",label:"Active"})})})]})})}function Z(){z();const{corporate_id:s,id:e}=P(),[r,n]=d.exports.useState(),i=F(),c=!!e;return d.exports.useEffect(()=>{c&&p.get("/corporates/"+s+"/corporate-benefits/"+e+"/edit").then(o=>{n(o.data)}).catch(o=>{o.response.status===404&&i("/404")})},[s,e]),m(R,{title:"Create Corporate Benefit",children:[a(N,{heading:"Create Corporate Benefit",links:[{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+s},{name:"Corporate Benefits",href:"/corporates/"+s+"/corporate-benefits"},{name:c?"Edit":"Create",href:"/corporates/"+s+"/corporate-benefits/"+e}]}),a(D,{isEdit:c,currentCorporateBenefit:r})]})}export{Z as default};

View File

@@ -1 +1 @@
import{H as N}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as R}from"./Page.1b52de0c.js";import{bB as j,a as F,aT as y,c as H,d as b,r as n,e as T,f as s,F as B,j as f,S as V,T as G,R as S,k as U,Y as h,o as _,ap as z}from"./index.2830a4a3.js";import{R as A}from"./RHFSwitch.fe548aa3.js";import{G as m}from"./Grid.f80372c7.js";import{C as x}from"./Card.86cb2364.js";import"./FormControlLabel.091f6f29.js";function E({isEdit:i,currentCorporatePlan:e}){const{enqueueSnackbar:t}=j(),d=F(),{corporate_id:r}=y(),c=H().shape({name:b().required("Name is required"),code:b().required("Corporate Code is required")}),o=n.exports.useMemo(()=>({name:(e==null?void 0:e.name)||"",code:(e==null?void 0:e.code)||"",active:(e==null?void 0:e.active)===1}),[e]);n.exports.useEffect(()=>{i&&e&&v(o),i||v(o)},[i,e]);const u=T({resolver:_(c),defaultValues:o}),{reset:v,watch:L,control:M,setValue:O,getValues:W,setError:D,handleSubmit:k,formState:{isSubmitting:q}}=u;return s(B,{methods:u,onSubmit:k(async l=>{i?await h.put("/corporate/"+r+"/divisions/"+(e==null?void 0:e.id),l).then(a=>{t("Division updated successfully",{variant:"success"})}).then(a=>{d("/corporate/"+r+"/divisions/",{replace:!0})}).catch(({response:a})=>{t("Update Failed : "+a.data.message,{variant:"error"})}):await h.post("/corporate/"+r+"/divisions",l).then(a=>{t("Division created successfully",{variant:"success"})}).then(a=>{d("/corporate/"+r+"/divisions",{replace:!0})}).catch(({response:a})=>{var p;if(a.status===422)for(const[w,g]of Object.entries(a.data.errors))D(w,{message:g[0]}),t((p=g[0])!=null?p:"Failed Processing Request",{variant:"error"});else t("Create Failed : "+a.data.message,{variant:"error"})})}),children:f(m,{container:!0,spacing:2,children:[s(m,{item:!0,xs:8,children:s(x,{sx:{p:2},children:f(V,{spacing:3,children:[s(G,{variant:"h6",children:"Division Detail"}),s(S,{name:"name",label:"Name"}),s(S,{name:"code",label:"Code"}),s(U,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:q,children:i?"Update":"Create"})]})})}),s(m,{item:!0,xs:4,children:s(x,{sx:{p:2},children:s(A,{name:"active",label:"Active"})})})]})})}function C(){z();const{corporate_id:i,id:e}=y(),[t,d]=n.exports.useState(),r=F(),c=!!e;return n.exports.useEffect(()=>{c&&h.get("/corporates/"+i+"/divisions/"+e+"/edit").then(o=>{d(o.data)}).catch(o=>{o.response.status===404&&r("/404")})},[i,e]),f(R,{title:"Create Corporate Division",children:[s(N,{heading:"Create Corporate Division",links:[{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+i},{name:"Division",href:"/corporates/"+i+"/divisions"},{name:c?"Edit":"Create",href:"/corporates/"+i+"/divisions/"+e}]}),s(E,{isEdit:c,currentCorporatePlan:t})]})}export{C as default};
import{H as N}from"./HeaderBreadcrumbs.91259cd4.js";import{P as R}from"./Page.c2cde06d.js";import{b0 as j,a as F,aT as y,c as H,d as b,r as n,e as T,f as s,F as V,j as f,S as B,T as G,R as S,k as U,Y as h,o as _,ap as z}from"./index.eaf14aef.js";import{R as A}from"./RHFSwitch.8d329605.js";import{G as m}from"./Grid.dda358cb.js";import{C as x}from"./Card.4687a3ba.js";import"./FormControlLabel.877bb59b.js";function E({isEdit:i,currentCorporatePlan:e}){const{enqueueSnackbar:t}=j(),d=F(),{corporate_id:r}=y(),c=H().shape({name:b().required("Name is required"),code:b().required("Corporate Code is required")}),o=n.exports.useMemo(()=>({name:(e==null?void 0:e.name)||"",code:(e==null?void 0:e.code)||"",active:(e==null?void 0:e.active)===1}),[e]);n.exports.useEffect(()=>{i&&e&&v(o),i||v(o)},[i,e]);const u=T({resolver:_(c),defaultValues:o}),{reset:v,watch:L,control:M,setValue:O,getValues:W,setError:D,handleSubmit:k,formState:{isSubmitting:q}}=u;return s(V,{methods:u,onSubmit:k(async l=>{i?await h.put("/corporate/"+r+"/divisions/"+(e==null?void 0:e.id),l).then(a=>{t("Division updated successfully",{variant:"success"})}).then(a=>{d("/corporate/"+r+"/divisions/",{replace:!0})}).catch(({response:a})=>{t("Update Failed : "+a.data.message,{variant:"error"})}):await h.post("/corporate/"+r+"/divisions",l).then(a=>{t("Division created successfully",{variant:"success"})}).then(a=>{d("/corporate/"+r+"/divisions",{replace:!0})}).catch(({response:a})=>{var p;if(a.status===422)for(const[w,g]of Object.entries(a.data.errors))D(w,{message:g[0]}),t((p=g[0])!=null?p:"Failed Processing Request",{variant:"error"});else t("Create Failed : "+a.data.message,{variant:"error"})})}),children:f(m,{container:!0,spacing:2,children:[s(m,{item:!0,xs:8,children:s(x,{sx:{p:2},children:f(B,{spacing:3,children:[s(G,{variant:"h6",children:"Division Detail"}),s(S,{name:"name",label:"Name"}),s(S,{name:"code",label:"Code"}),s(U,{type:"submit",variant:"contained",size:"large",fullWidth:!0,loading:q,children:i?"Update":"Create"})]})})}),s(m,{item:!0,xs:4,children:s(x,{sx:{p:2},children:s(A,{name:"active",label:"Active"})})})]})})}function C(){z();const{corporate_id:i,id:e}=y(),[t,d]=n.exports.useState(),r=F(),c=!!e;return n.exports.useEffect(()=>{c&&h.get("/corporates/"+i+"/divisions/"+e+"/edit").then(o=>{d(o.data)}).catch(o=>{o.response.status===404&&r("/404")})},[i,e]),f(R,{title:"Create Corporate Division",children:[s(N,{heading:"Create Corporate Division",links:[{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+i},{name:"Division",href:"/corporates/"+i+"/divisions"},{name:c?"Edit":"Create",href:"/corporates/"+i+"/divisions/"+e}]}),s(E,{isEdit:c,currentCorporatePlan:t})]})}export{C as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
import{a1 as Je,a2 as Ke,a3 as wi,a4 as ki,a5 as Se,a6 as Ai,a7 as Tt,a8 as Qe,a9 as It,aa as Si,ab as Ci,ac as Li,ad as Pi,ae as Ti,af as Ii,ag as Mi,ah as Xi,ai as zi,aj as Ei,ak as Mt,al as Yi,r as Ri,am as Fi,X as Oi,j as re,S as Xe,f as ee,T as le,an as je,h as Di,ao as Hi,t as Ue,ap as Ni,u as Wi,C as Bi}from"./index.2830a4a3.js";import{P as Gi}from"./Page.1b52de0c.js";import{C as qe}from"./Card.86cb2364.js";import{G as Ve}from"./Grid.f80372c7.js";var Vi=Je,_i=Ke;function ji(P,I,X){(X!==void 0&&!_i(P[I],X)||X===void 0&&!(I in P))&&Vi(P,I,X)}var Xt=ji,Ze={exports:{}};(function(P,I){var X=wi,M=I&&!I.nodeType&&I,H=M&&!0&&P&&!P.nodeType&&P,R=H&&H.exports===M,W=R?X.Buffer:void 0,z=W?W.allocUnsafe:void 0;function N(j,_){if(_)return j.slice();var ae=j.length,ce=z?z(ae):new j.constructor(ae);return j.copy(ce),ce}P.exports=N})(Ze,Ze.exports);var vt=ki;function Ui(P){var I=new P.constructor(P.byteLength);return new vt(I).set(new vt(P)),I}var qi=Ui,Zi=qi;function $i(P,I){var X=I?Zi(P.buffer):P.buffer;return new P.constructor(X,P.byteOffset,P.length)}var Ji=$i;function Ki(P,I){var X=-1,M=P.length;for(I||(I=Array(M));++X<M;)I[X]=P[X];return I}var Qi=Ki,ea=Se,yt=Object.create,ta=function(){function P(){}return function(I){if(!ea(I))return{};if(yt)return yt(I);P.prototype=I;var X=new P;return P.prototype=void 0,X}}(),ia=ta,aa=Ai,sa=aa(Object.getPrototypeOf,Object),zt=sa,ra=ia,na=zt,oa=Tt;function la(P){return typeof P.constructor=="function"&&!oa(P)?ra(na(P)):{}}var ha=la,ca=Qe,da=It;function ga(P){return da(P)&&ca(P)}var ua=ga,fa=Si,pa=zt,xa=It,ba="[object Object]",ma=Function.prototype,va=Object.prototype,Et=ma.toString,ya=va.hasOwnProperty,wa=Et.call(Object);function ka(P){if(!xa(P)||fa(P)!=ba)return!1;var I=pa(P);if(I===null)return!0;var X=ya.call(I,"constructor")&&I.constructor;return typeof X=="function"&&X instanceof X&&Et.call(X)==wa}var Aa=ka;function Sa(P,I){if(!(I==="constructor"&&typeof P[I]=="function")&&I!="__proto__")return P[I]}var Yt=Sa,Ca=Je,La=Ke,Pa=Object.prototype,Ta=Pa.hasOwnProperty;function Ia(P,I,X){var M=P[I];(!(Ta.call(P,I)&&La(M,X))||X===void 0&&!(I in P))&&Ca(P,I,X)}var Ma=Ia,Xa=Ma,za=Je;function Ea(P,I,X,M){var H=!X;X||(X={});for(var R=-1,W=I.length;++R<W;){var z=I[R],N=M?M(X[z],P[z],z,X,P):void 0;N===void 0&&(N=P[z]),H?za(X,z,N):Xa(X,z,N)}return X}var Ya=Ea;function Ra(P){var I=[];if(P!=null)for(var X in Object(P))I.push(X);return I}var Fa=Ra,Oa=Se,Da=Tt,Ha=Fa,Na=Object.prototype,Wa=Na.hasOwnProperty;function Ba(P){if(!Oa(P))return Ha(P);var I=Da(P),X=[];for(var M in P)M=="constructor"&&(I||!Wa.call(P,M))||X.push(M);return X}var Ga=Ba,Va=Ci,_a=Ga,ja=Qe;function Ua(P){return ja(P)?Va(P,!0):_a(P)}var Rt=Ua,qa=Ya,Za=Rt;function $a(P){return qa(P,Za(P))}var Ja=$a,wt=Xt,Ka=Ze.exports,Qa=Ji,es=Qi,ts=ha,kt=Li,At=Pi,is=ua,as=Ti.exports,ss=Ii,rs=Se,ns=Aa,os=Mi,St=Yt,ls=Ja;function hs(P,I,X,M,H,R,W){var z=St(P,X),N=St(I,X),j=W.get(N);if(j){wt(P,X,j);return}var _=R?R(z,N,X+"",P,I,W):void 0,ae=_===void 0;if(ae){var ce=At(N),he=!ce&&as(N),Ce=!ce&&!he&&os(N);_=N,ce||he||Ce?At(z)?_=z:is(z)?_=es(z):he?(ae=!1,_=Ka(N,!0)):Ce?(ae=!1,_=Qa(N,!0)):_=[]:ns(N)||kt(N)?(_=z,kt(z)?_=ls(z):(!rs(z)||ss(z))&&(_=ts(N))):ae=!1}ae&&(W.set(N,_),H(_,N,M,R,W),W.delete(N)),wt(P,X,_)}var cs=hs,ds=Xi,gs=Xt,us=zi,fs=cs,ps=Se,xs=Rt,bs=Yt;function Ft(P,I,X,M,H){P!==I&&us(I,function(R,W){if(H||(H=new ds),ps(R))fs(P,I,W,X,Ft,M,H);else{var z=M?M(bs(P,W),R,W+"",P,I,H):void 0;z===void 0&&(z=R),gs(P,W,z)}},xs)}var ms=Ft;function vs(P,I,X){switch(X.length){case 0:return P.call(I);case 1:return P.call(I,X[0]);case 2:return P.call(I,X[0],X[1]);case 3:return P.call(I,X[0],X[1],X[2])}return P.apply(I,X)}var ys=vs,ws=ys,Ct=Math.max;function ks(P,I,X){return I=Ct(I===void 0?P.length-1:I,0),function(){for(var M=arguments,H=-1,R=Ct(M.length-I,0),W=Array(R);++H<R;)W[H]=M[I+H];H=-1;for(var z=Array(I+1);++H<I;)z[H]=M[H];return z[I]=X(W),ws(P,this,z)}}var As=ks;function Ss(P){return function(){return P}}var Cs=Ss,Ls=Cs,Lt=Ei,Ps=Mt,Ts=Lt?function(P,I){return Lt(P,"toString",{configurable:!0,enumerable:!1,value:Ls(I),writable:!0})}:Ps,Is=Ts,Ms=800,Xs=16,zs=Date.now;function Es(P){var I=0,X=0;return function(){var M=zs(),H=Xs-(M-X);if(X=M,H>0){if(++I>=Ms)return arguments[0]}else I=0;return P.apply(void 0,arguments)}}var Ys=Es,Rs=Is,Fs=Ys,Os=Fs(Rs),Ds=Os,Hs=Mt,Ns=As,Ws=Ds;function Bs(P,I){return Ws(Ns(P,I,Hs),P+"")}var Gs=Bs,Vs=Ke,_s=Qe,js=Yi,Us=Se;function qs(P,I,X){if(!Us(X))return!1;var M=typeof I;return(M=="number"?_s(X)&&js(I,X.length):M=="string"&&I in X)?Vs(X[I],P):!1}var Zs=qs,$s=Gs,Js=Zs;function Ks(P){return $s(function(I,X){var M=-1,H=X.length,R=H>1?X[H-1]:void 0,W=H>2?X[2]:void 0;for(R=P.length>3&&typeof R=="function"?(H--,R):void 0,W&&Js(X[0],X[1],W)&&(R=H<3?void 0:R,H=1),I=Object(I);++M<H;){var z=X[M];z&&P(I,z,M,R)}return I})}var Qs=Ks,er=ms,tr=Qs,ir=tr(function(P,I,X){er(P,I,X)}),ar=ir;const sr=ar;var Ot={},$e={exports:{}};/*!
import{a1 as Je,a2 as Ke,a3 as wi,a4 as ki,a5 as Se,a6 as Ai,a7 as Tt,a8 as Qe,a9 as It,aa as Si,ab as Ci,ac as Li,ad as Pi,ae as Ti,af as Ii,ag as Mi,ah as Xi,ai as zi,aj as Ei,ak as Mt,al as Yi,r as Ri,am as Fi,X as Oi,j as re,S as Xe,f as ee,T as le,an as je,h as Di,ao as Hi,t as Ue,ap as Ni,u as Wi,C as Bi}from"./index.eaf14aef.js";import{P as Gi}from"./Page.c2cde06d.js";import{C as qe}from"./Card.4687a3ba.js";import{G as Ve}from"./Grid.dda358cb.js";var Vi=Je,_i=Ke;function ji(P,I,X){(X!==void 0&&!_i(P[I],X)||X===void 0&&!(I in P))&&Vi(P,I,X)}var Xt=ji,Ze={exports:{}};(function(P,I){var X=wi,M=I&&!I.nodeType&&I,H=M&&!0&&P&&!P.nodeType&&P,R=H&&H.exports===M,W=R?X.Buffer:void 0,z=W?W.allocUnsafe:void 0;function N(j,_){if(_)return j.slice();var ae=j.length,ce=z?z(ae):new j.constructor(ae);return j.copy(ce),ce}P.exports=N})(Ze,Ze.exports);var vt=ki;function Ui(P){var I=new P.constructor(P.byteLength);return new vt(I).set(new vt(P)),I}var qi=Ui,Zi=qi;function $i(P,I){var X=I?Zi(P.buffer):P.buffer;return new P.constructor(X,P.byteOffset,P.length)}var Ji=$i;function Ki(P,I){var X=-1,M=P.length;for(I||(I=Array(M));++X<M;)I[X]=P[X];return I}var Qi=Ki,ea=Se,yt=Object.create,ta=function(){function P(){}return function(I){if(!ea(I))return{};if(yt)return yt(I);P.prototype=I;var X=new P;return P.prototype=void 0,X}}(),ia=ta,aa=Ai,sa=aa(Object.getPrototypeOf,Object),zt=sa,ra=ia,na=zt,oa=Tt;function la(P){return typeof P.constructor=="function"&&!oa(P)?ra(na(P)):{}}var ha=la,ca=Qe,da=It;function ga(P){return da(P)&&ca(P)}var ua=ga,fa=Si,pa=zt,xa=It,ba="[object Object]",ma=Function.prototype,va=Object.prototype,Et=ma.toString,ya=va.hasOwnProperty,wa=Et.call(Object);function ka(P){if(!xa(P)||fa(P)!=ba)return!1;var I=pa(P);if(I===null)return!0;var X=ya.call(I,"constructor")&&I.constructor;return typeof X=="function"&&X instanceof X&&Et.call(X)==wa}var Aa=ka;function Sa(P,I){if(!(I==="constructor"&&typeof P[I]=="function")&&I!="__proto__")return P[I]}var Yt=Sa,Ca=Je,La=Ke,Pa=Object.prototype,Ta=Pa.hasOwnProperty;function Ia(P,I,X){var M=P[I];(!(Ta.call(P,I)&&La(M,X))||X===void 0&&!(I in P))&&Ca(P,I,X)}var Ma=Ia,Xa=Ma,za=Je;function Ea(P,I,X,M){var H=!X;X||(X={});for(var R=-1,W=I.length;++R<W;){var z=I[R],N=M?M(X[z],P[z],z,X,P):void 0;N===void 0&&(N=P[z]),H?za(X,z,N):Xa(X,z,N)}return X}var Ya=Ea;function Ra(P){var I=[];if(P!=null)for(var X in Object(P))I.push(X);return I}var Fa=Ra,Oa=Se,Da=Tt,Ha=Fa,Na=Object.prototype,Wa=Na.hasOwnProperty;function Ba(P){if(!Oa(P))return Ha(P);var I=Da(P),X=[];for(var M in P)M=="constructor"&&(I||!Wa.call(P,M))||X.push(M);return X}var Ga=Ba,Va=Ci,_a=Ga,ja=Qe;function Ua(P){return ja(P)?Va(P,!0):_a(P)}var Rt=Ua,qa=Ya,Za=Rt;function $a(P){return qa(P,Za(P))}var Ja=$a,wt=Xt,Ka=Ze.exports,Qa=Ji,es=Qi,ts=ha,kt=Li,At=Pi,is=ua,as=Ti.exports,ss=Ii,rs=Se,ns=Aa,os=Mi,St=Yt,ls=Ja;function hs(P,I,X,M,H,R,W){var z=St(P,X),N=St(I,X),j=W.get(N);if(j){wt(P,X,j);return}var _=R?R(z,N,X+"",P,I,W):void 0,ae=_===void 0;if(ae){var ce=At(N),he=!ce&&as(N),Ce=!ce&&!he&&os(N);_=N,ce||he||Ce?At(z)?_=z:is(z)?_=es(z):he?(ae=!1,_=Ka(N,!0)):Ce?(ae=!1,_=Qa(N,!0)):_=[]:ns(N)||kt(N)?(_=z,kt(z)?_=ls(z):(!rs(z)||ss(z))&&(_=ts(N))):ae=!1}ae&&(W.set(N,_),H(_,N,M,R,W),W.delete(N)),wt(P,X,_)}var cs=hs,ds=Xi,gs=Xt,us=zi,fs=cs,ps=Se,xs=Rt,bs=Yt;function Ft(P,I,X,M,H){P!==I&&us(I,function(R,W){if(H||(H=new ds),ps(R))fs(P,I,W,X,Ft,M,H);else{var z=M?M(bs(P,W),R,W+"",P,I,H):void 0;z===void 0&&(z=R),gs(P,W,z)}},xs)}var ms=Ft;function vs(P,I,X){switch(X.length){case 0:return P.call(I);case 1:return P.call(I,X[0]);case 2:return P.call(I,X[0],X[1]);case 3:return P.call(I,X[0],X[1],X[2])}return P.apply(I,X)}var ys=vs,ws=ys,Ct=Math.max;function ks(P,I,X){return I=Ct(I===void 0?P.length-1:I,0),function(){for(var M=arguments,H=-1,R=Ct(M.length-I,0),W=Array(R);++H<R;)W[H]=M[I+H];H=-1;for(var z=Array(I+1);++H<I;)z[H]=M[H];return z[I]=X(W),ws(P,this,z)}}var As=ks;function Ss(P){return function(){return P}}var Cs=Ss,Ls=Cs,Lt=Ei,Ps=Mt,Ts=Lt?function(P,I){return Lt(P,"toString",{configurable:!0,enumerable:!1,value:Ls(I),writable:!0})}:Ps,Is=Ts,Ms=800,Xs=16,zs=Date.now;function Es(P){var I=0,X=0;return function(){var M=zs(),H=Xs-(M-X);if(X=M,H>0){if(++I>=Ms)return arguments[0]}else I=0;return P.apply(void 0,arguments)}}var Ys=Es,Rs=Is,Fs=Ys,Os=Fs(Rs),Ds=Os,Hs=Mt,Ns=As,Ws=Ds;function Bs(P,I){return Ws(Ns(P,I,Hs),P+"")}var Gs=Bs,Vs=Ke,_s=Qe,js=Yi,Us=Se;function qs(P,I,X){if(!Us(X))return!1;var M=typeof I;return(M=="number"?_s(X)&&js(I,X.length):M=="string"&&I in X)?Vs(X[I],P):!1}var Zs=qs,$s=Gs,Js=Zs;function Ks(P){return $s(function(I,X){var M=-1,H=X.length,R=H>1?X[H-1]:void 0,W=H>2?X[2]:void 0;for(R=P.length>3&&typeof R=="function"?(H--,R):void 0,W&&Js(X[0],X[1],W)&&(R=H<3?void 0:R,H=1),I=Object(I);++M<H;){var z=X[M];z&&P(I,z,M,R)}return I})}var Qs=Ks,er=ms,tr=Qs,ir=tr(function(P,I,X){er(P,I,X)}),ar=ir;const sr=ar;var Ot={},$e={exports:{}};/*!
* ApexCharts v3.36.2
* (c) 2018-2022 ApexCharts
* Released under the MIT License.

View File

@@ -1 +1 @@
import{v as g,w as p,t as d,z as a,r as u,x as f,y as m,f as D,D as x,E as A}from"./index.2830a4a3.js";function y(s){return g("MuiDialogActions",s)}p("MuiDialogActions",["root","spacing"]);const S=["className","disableSpacing"],b=s=>{const{classes:t,disableSpacing:o}=s;return A({root:["root",!o&&"spacing"]},y,t)},C=d("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(s,t)=>{const{ownerState:o}=s;return[t.root,!o.disableSpacing&&t.spacing]}})(({ownerState:s})=>a({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!s.disableSpacing&&{"& > :not(:first-of-type)":{marginLeft:8}})),w=u.exports.forwardRef(function(t,o){const e=f({props:t,name:"MuiDialogActions"}),{className:n,disableSpacing:c=!1}=e,l=m(e,S),i=a({},e,{disableSpacing:c}),r=b(i);return D(C,a({className:x(r.root,n),ownerState:i,ref:o},l))}),M=w;export{M as D};
import{v as g,w as p,t as d,z as a,r as u,x as f,y as m,f as D,D as x,E as A}from"./index.eaf14aef.js";function y(s){return g("MuiDialogActions",s)}p("MuiDialogActions",["root","spacing"]);const S=["className","disableSpacing"],b=s=>{const{classes:t,disableSpacing:o}=s;return A({root:["root",!o&&"spacing"]},y,t)},C=d("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(s,t)=>{const{ownerState:o}=s;return[t.root,!o.disableSpacing&&t.spacing]}})(({ownerState:s})=>a({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!s.disableSpacing&&{"& > :not(:first-of-type)":{marginLeft:8}})),w=u.exports.forwardRef(function(t,o){const e=f({props:t,name:"MuiDialogActions"}),{className:n,disableSpacing:c=!1}=e,l=m(e,S),i=a({},e,{disableSpacing:c}),r=b(i);return D(C,a({className:x(r.root,n),ownerState:i,ref:o},l))}),M=w;export{M as D};

View File

@@ -1 +1 @@
import{v as c,w as i,t as p,T as x,U as u,r as C,x as d,y as g,f as T,z as r,D as m,E as D}from"./index.2830a4a3.js";function y(o){return c("MuiDialogContentText",o)}i("MuiDialogContentText",["root"]);const f=["children","className"],h=o=>{const{classes:t}=o,s=D({root:["root"]},y,t);return r({},t,s)},w=p(x,{shouldForwardProp:o=>u(o)||o==="classes",name:"MuiDialogContentText",slot:"Root",overridesResolver:(o,t)=>t.root})({}),U=C.exports.forwardRef(function(t,e){const s=d({props:t,name:"MuiDialogContentText"}),{className:l}=s,a=g(s,f),n=h(a);return T(w,r({component:"p",variant:"body1",color:"text.secondary",ref:e,ownerState:a,className:m(n.root,l)},s,{classes:n}))}),M=U;export{M as D};
import{v as c,w as i,t as p,T as x,U as u,r as C,x as d,y as g,f as T,z as r,D as m,E as D}from"./index.eaf14aef.js";function y(o){return c("MuiDialogContentText",o)}i("MuiDialogContentText",["root"]);const f=["children","className"],h=o=>{const{classes:t}=o,s=D({root:["root"]},y,t);return r({},t,s)},w=p(x,{shouldForwardProp:o=>u(o)||o==="classes",name:"MuiDialogContentText",slot:"Root",overridesResolver:(o,t)=>t.root})({}),U=C.exports.forwardRef(function(t,e){const s=d({props:t,name:"MuiDialogContentText"}),{className:l}=s,a=g(s,f),n=h(a);return T(w,r({component:"p",variant:"body1",color:"text.secondary",ref:e,ownerState:a,className:m(n.root,l)},s,{classes:n}))}),M=U;export{M as D};

View File

@@ -1 +1 @@
import{t as d,T as x,r as i,x as g,y as m,f as u,z as D,D as T,E as f}from"./index.2830a4a3.js";import{b as h,g as y}from"./DialogContent.417e0630.js";const C=["className","id"],R=s=>{const{classes:o}=s;return f({root:["root"]},y,o)},v=d(x,{name:"MuiDialogTitle",slot:"Root",overridesResolver:(s,o)=>o.root})({padding:"16px 24px",flex:"0 0 auto"}),w=i.exports.forwardRef(function(o,e){const t=g({props:o,name:"MuiDialogTitle"}),{className:r,id:l}=t,n=m(t,C),a=t,c=R(a),{titleId:p=l}=i.exports.useContext(h);return u(v,D({component:"h2",className:T(c.root,r),ownerState:a,ref:e,variant:"h6",id:p},n))}),_=w;export{_ as D};
import{t as d,T as x,r as i,x as g,y as m,f as u,z as D,D as T,E as f}from"./index.eaf14aef.js";import{b as h,g as y}from"./DialogContent.9d59da83.js";const C=["className","id"],R=s=>{const{classes:o}=s;return f({root:["root"]},y,o)},v=d(x,{name:"MuiDialogTitle",slot:"Root",overridesResolver:(s,o)=>o.root})({padding:"16px 24px",flex:"0 0 auto"}),w=i.exports.forwardRef(function(o,e){const t=g({props:o,name:"MuiDialogTitle"}),{className:r,id:l}=t,n=m(t,C),a=t,c=R(a),{titleId:p=l}=i.exports.useContext(h);return u(v,D({component:"h2",className:T(c.root,r),ownerState:a,ref:e,variant:"h6",id:p},n))}),_=w;export{_ as D};

View File

@@ -1 +1 @@
import{b as k,a as I,r as u,c as B,e as F,f as e,F as A,j as d,S as R,A as C,T as t,R as f,I as p,g,h as c,k as K,Y as T,o as N,a0 as L,Z as _,C as j,B as w,$ as H,i as z,t as M}from"./index.2830a4a3.js";import{P as W}from"./paths.3971dbe6.js";import{P as E}from"./Page.1b52de0c.js";function O({token:s}){const o=k(),r=I(),[n,S]=u.exports.useState(!1),[i,y]=u.exports.useState(!1),P=B().shape({}),l=F({resolver:N(P)}),{handleSubmit:x,setError:b,formState:{errors:m,isSubmitting:v}}=l;return e(A,{methods:l,onSubmit:x(async h=>{try{await T.post("/forget-password",{...h,token:s}),console.log(h),await new Promise(a=>setTimeout(a,500)),o.current&&r("/auth/login",{replace:!0})}catch(a){console.log(a.response.data),o.current&&b("afterSubmit",{...a,message:a.response.data.message})}}),children:d(R,{spacing:3,children:[!!m.afterSubmit&&e(C,{severity:"error",children:m.afterSubmit.message}),e(t,{children:"Kata Sandi Baru"}),e(f,{name:"new_password",label:"Kata Sandi Baru",type:n?"text":"password",InputProps:{endAdornment:e(p,{position:"end",children:e(g,{onClick:()=>S(!n),edge:"end",children:e(c,{icon:n?"eva:eye-fill":"eva:eye-off-fill"})})})}}),e(t,{children:"Konfirmasi Kata Sandi "}),e(f,{name:"confirm_new_password",label:"Konfirmasi Kata Sandi",type:i?"text":"password",InputProps:{endAdornment:e(p,{position:"end",children:e(g,{onClick:()=>y(!i),edge:"end",children:e(c,{icon:i?"eva:eye-fill":"eva:eye-off-fill"})})})}}),e(K,{fullWidth:!0,size:"large",type:"submit",variant:"contained",loading:v,children:"Reset Password"})]})})}const U=M("div")(({theme:s})=>({display:"flex",height:"100%",alignItems:"center",padding:s.spacing(12,0)}));function q(){const[s,o]=L(),r=s.get("token");return e(E,{title:"Verify",sx:{height:1},children:d(U,{children:[e(_,{}),e(j,{children:d(w,{sx:{maxWidth:480,mx:"auto"},children:[e(H,{size:"small",component:z,to:W.login,startIcon:e(c,{icon:"eva:arrow-ios-back-fill",width:20,height:20}),sx:{mb:3},children:"Back"}),e(t,{variant:"h3",paragraph:!0}),e(t,{sx:{color:"text.secondary"},children:"Please enter your new password."}),e(w,{sx:{mt:5,mb:3},children:e(O,{token:r})})]})})]})})}export{q as default};
import{b as k,a as I,r as u,c as B,e as F,f as e,F as A,j as d,S as R,A as C,T as t,R as f,I as p,g,h as c,k as K,Y as T,o as N,a0 as L,Z as _,C as j,B as w,$ as H,i as z,t as M}from"./index.eaf14aef.js";import{P as W}from"./paths.3971dbe6.js";import{P as E}from"./Page.c2cde06d.js";function O({token:s}){const o=k(),r=I(),[n,S]=u.exports.useState(!1),[i,y]=u.exports.useState(!1),P=B().shape({}),l=F({resolver:N(P)}),{handleSubmit:x,setError:b,formState:{errors:m,isSubmitting:v}}=l;return e(A,{methods:l,onSubmit:x(async h=>{try{await T.post("/forget-password",{...h,token:s}),console.log(h),await new Promise(a=>setTimeout(a,500)),o.current&&r("/auth/login",{replace:!0})}catch(a){console.log(a.response.data),o.current&&b("afterSubmit",{...a,message:a.response.data.message})}}),children:d(R,{spacing:3,children:[!!m.afterSubmit&&e(C,{severity:"error",children:m.afterSubmit.message}),e(t,{children:"Kata Sandi Baru"}),e(f,{name:"new_password",label:"Kata Sandi Baru",type:n?"text":"password",InputProps:{endAdornment:e(p,{position:"end",children:e(g,{onClick:()=>S(!n),edge:"end",children:e(c,{icon:n?"eva:eye-fill":"eva:eye-off-fill"})})})}}),e(t,{children:"Konfirmasi Kata Sandi "}),e(f,{name:"confirm_new_password",label:"Konfirmasi Kata Sandi",type:i?"text":"password",InputProps:{endAdornment:e(p,{position:"end",children:e(g,{onClick:()=>y(!i),edge:"end",children:e(c,{icon:i?"eva:eye-fill":"eva:eye-off-fill"})})})}}),e(K,{fullWidth:!0,size:"large",type:"submit",variant:"contained",loading:v,children:"Reset Password"})]})})}const U=M("div")(({theme:s})=>({display:"flex",height:"100%",alignItems:"center",padding:s.spacing(12,0)}));function q(){const[s,o]=L(),r=s.get("token");return e(E,{title:"Verify",sx:{height:1},children:d(U,{children:[e(_,{}),e(j,{children:d(w,{sx:{maxWidth:480,mx:"auto"},children:[e(H,{size:"small",component:z,to:W.login,startIcon:e(c,{icon:"eva:arrow-ios-back-fill",width:20,height:20}),sx:{mb:3},children:"Back"}),e(t,{variant:"h3",paragraph:!0}),e(t,{sx:{color:"text.secondary"},children:"Please enter your new password."}),e(w,{sx:{mt:5,mb:3},children:e(O,{token:r})})]})})]})})}export{q as default};

View File

@@ -1 +1 @@
import{v as _,w as j,t as I,M as X,z as i,r as v,y as D,N as Y,G as O,j as q,f as H,D as $,O as N,E as W,x as Z,H as ee,T as M}from"./index.2830a4a3.js";function oe(e){return _("PrivateSwitchBase",e)}j("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const te=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],ae=e=>{const{classes:o,checked:a,disabled:n,edge:t}=e,d={root:["root",a&&"checked",n&&"disabled",t&&`edge${N(t)}`],input:["input"]};return W(d,oe,o)},le=I(X)(({ownerState:e})=>i({padding:9,borderRadius:"50%"},e.edge==="start"&&{marginLeft:e.size==="small"?-3:-12},e.edge==="end"&&{marginRight:e.size==="small"?-3:-12})),se=I("input")({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),ne=v.exports.forwardRef(function(o,a){const{autoFocus:n,checked:t,checkedIcon:d,className:x,defaultChecked:u,disabled:k,disableFocusRipple:C=!1,edge:B=!1,icon:L,id:R,inputProps:w,inputRef:b,name:r,onBlur:m,onChange:y,onFocus:f,readOnly:P,required:h,tabIndex:p,type:l,value:T}=o,A=D(o,te),[U,G]=Y({controlled:t,default:Boolean(u),name:"SwitchBase",state:"checked"}),c=O(),J=s=>{f&&f(s),c&&c.onFocus&&c.onFocus(s)},K=s=>{m&&m(s),c&&c.onBlur&&c.onBlur(s)},Q=s=>{if(s.nativeEvent.defaultPrevented)return;const E=s.target.checked;G(E),y&&y(s,E)};let g=k;c&&typeof g>"u"&&(g=c.disabled);const V=l==="checkbox"||l==="radio",S=i({},o,{checked:U,disabled:g,disableFocusRipple:C,edge:B}),z=ae(S);return q(le,i({component:"span",className:$(z.root,x),centerRipple:!0,focusRipple:!C,disabled:g,tabIndex:null,role:void 0,onFocus:J,onBlur:K,ownerState:S,ref:a},A,{children:[H(se,i({autoFocus:n,checked:t,defaultChecked:u,className:z.input,disabled:g,id:V&&R,name:r,onChange:Q,readOnly:P,ref:b,required:h,ownerState:S,tabIndex:p,type:l},l==="checkbox"&&T===void 0?{}:{value:T},w)),U?d:L]}))}),me=ne;function re(e){return _("MuiFormControlLabel",e)}const ce=j("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error"]),F=ce,ie=["checked","className","componentsProps","control","disabled","disableTypography","inputRef","label","labelPlacement","name","onChange","slotProps","value"],de=e=>{const{classes:o,disabled:a,labelPlacement:n,error:t}=e,d={root:["root",a&&"disabled",`labelPlacement${N(n)}`,t&&"error"],label:["label",a&&"disabled"]};return W(d,re,o)},ue=I("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,o)=>{const{ownerState:a}=e;return[{[`& .${F.label}`]:o.label},o.root,o[`labelPlacement${N(a.labelPlacement)}`]]}})(({theme:e,ownerState:o})=>i({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${F.disabled}`]:{cursor:"default"}},o.labelPlacement==="start"&&{flexDirection:"row-reverse",marginLeft:16,marginRight:-11},o.labelPlacement==="top"&&{flexDirection:"column-reverse",marginLeft:16},o.labelPlacement==="bottom"&&{flexDirection:"column",marginLeft:16},{[`& .${F.label}`]:{[`&.${F.disabled}`]:{color:(e.vars||e).palette.text.disabled}}})),pe=v.exports.forwardRef(function(o,a){var n;const t=Z({props:o,name:"MuiFormControlLabel"}),{className:d,componentsProps:x={},control:u,disabled:k,disableTypography:C,label:B,labelPlacement:L="end",slotProps:R={}}=t,w=D(t,ie),b=O();let r=k;typeof r>"u"&&typeof u.props.disabled<"u"&&(r=u.props.disabled),typeof r>"u"&&b&&(r=b.disabled);const m={disabled:r};["checked","name","onChange","value","inputRef"].forEach(l=>{typeof u.props[l]>"u"&&typeof t[l]<"u"&&(m[l]=t[l])});const y=ee({props:t,muiFormControl:b,states:["error"]}),f=i({},t,{disabled:r,labelPlacement:L,error:y.error}),P=de(f),h=(n=R.typography)!=null?n:x.typography;let p=B;return p!=null&&p.type!==M&&!C&&(p=H(M,i({component:"span"},h,{className:$(P.label,h==null?void 0:h.className),children:p}))),q(ue,i({className:$(P.root,d),ownerState:f,ref:a},w,{children:[v.exports.cloneElement(u,m),p]}))}),fe=pe;export{fe as F,me as S};
import{v as _,w as j,t as I,M as X,z as i,r as v,y as D,N as Y,G as O,j as q,f as H,D as $,O as N,E as W,x as Z,H as ee,T as M}from"./index.eaf14aef.js";function oe(e){return _("PrivateSwitchBase",e)}j("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const te=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],ae=e=>{const{classes:o,checked:a,disabled:n,edge:t}=e,d={root:["root",a&&"checked",n&&"disabled",t&&`edge${N(t)}`],input:["input"]};return W(d,oe,o)},le=I(X)(({ownerState:e})=>i({padding:9,borderRadius:"50%"},e.edge==="start"&&{marginLeft:e.size==="small"?-3:-12},e.edge==="end"&&{marginRight:e.size==="small"?-3:-12})),se=I("input")({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),ne=v.exports.forwardRef(function(o,a){const{autoFocus:n,checked:t,checkedIcon:d,className:x,defaultChecked:u,disabled:k,disableFocusRipple:C=!1,edge:B=!1,icon:L,id:R,inputProps:w,inputRef:b,name:r,onBlur:m,onChange:y,onFocus:f,readOnly:P,required:h,tabIndex:p,type:l,value:T}=o,A=D(o,te),[U,G]=Y({controlled:t,default:Boolean(u),name:"SwitchBase",state:"checked"}),c=O(),J=s=>{f&&f(s),c&&c.onFocus&&c.onFocus(s)},K=s=>{m&&m(s),c&&c.onBlur&&c.onBlur(s)},Q=s=>{if(s.nativeEvent.defaultPrevented)return;const E=s.target.checked;G(E),y&&y(s,E)};let g=k;c&&typeof g>"u"&&(g=c.disabled);const V=l==="checkbox"||l==="radio",S=i({},o,{checked:U,disabled:g,disableFocusRipple:C,edge:B}),z=ae(S);return q(le,i({component:"span",className:$(z.root,x),centerRipple:!0,focusRipple:!C,disabled:g,tabIndex:null,role:void 0,onFocus:J,onBlur:K,ownerState:S,ref:a},A,{children:[H(se,i({autoFocus:n,checked:t,defaultChecked:u,className:z.input,disabled:g,id:V&&R,name:r,onChange:Q,readOnly:P,ref:b,required:h,ownerState:S,tabIndex:p,type:l},l==="checkbox"&&T===void 0?{}:{value:T},w)),U?d:L]}))}),me=ne;function re(e){return _("MuiFormControlLabel",e)}const ce=j("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error"]),F=ce,ie=["checked","className","componentsProps","control","disabled","disableTypography","inputRef","label","labelPlacement","name","onChange","slotProps","value"],de=e=>{const{classes:o,disabled:a,labelPlacement:n,error:t}=e,d={root:["root",a&&"disabled",`labelPlacement${N(n)}`,t&&"error"],label:["label",a&&"disabled"]};return W(d,re,o)},ue=I("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,o)=>{const{ownerState:a}=e;return[{[`& .${F.label}`]:o.label},o.root,o[`labelPlacement${N(a.labelPlacement)}`]]}})(({theme:e,ownerState:o})=>i({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${F.disabled}`]:{cursor:"default"}},o.labelPlacement==="start"&&{flexDirection:"row-reverse",marginLeft:16,marginRight:-11},o.labelPlacement==="top"&&{flexDirection:"column-reverse",marginLeft:16},o.labelPlacement==="bottom"&&{flexDirection:"column",marginLeft:16},{[`& .${F.label}`]:{[`&.${F.disabled}`]:{color:(e.vars||e).palette.text.disabled}}})),pe=v.exports.forwardRef(function(o,a){var n;const t=Z({props:o,name:"MuiFormControlLabel"}),{className:d,componentsProps:x={},control:u,disabled:k,disableTypography:C,label:B,labelPlacement:L="end",slotProps:R={}}=t,w=D(t,ie),b=O();let r=k;typeof r>"u"&&typeof u.props.disabled<"u"&&(r=u.props.disabled),typeof r>"u"&&b&&(r=b.disabled);const m={disabled:r};["checked","name","onChange","value","inputRef"].forEach(l=>{typeof u.props[l]>"u"&&typeof t[l]<"u"&&(m[l]=t[l])});const y=ee({props:t,muiFormControl:b,states:["error"]}),f=i({},t,{disabled:r,labelPlacement:L,error:y.error}),P=de(f),h=(n=R.typography)!=null?n:x.typography;let p=B;return p!=null&&p.type!==M&&!C&&(p=H(M,i({component:"span"},h,{className:$(P.label,h==null?void 0:h.className),children:p}))),q(ue,i({className:$(P.root,d),ownerState:f,ref:a},w,{children:[v.exports.cloneElement(u,m),p]}))}),fe=pe;export{fe as F,me as S};

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
import{Q as g_,f as q,t as ge,M as p_,z as Gt,aV as _o,w as __,v as d_,T as Pi,r as ce,x as v_,y as x_,D as w_,E as A_,aW as he,B as St,j as ar,L as Wi,i as m_}from"./index.2830a4a3.js";const y_=g_(q("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz"),S_=ge(p_)(({theme:I})=>Gt({display:"flex",marginLeft:`calc(${I.spacing(1)} * 0.5)`,marginRight:`calc(${I.spacing(1)} * 0.5)`},I.palette.mode==="light"?{backgroundColor:I.palette.grey[100],color:I.palette.grey[700]}:{backgroundColor:I.palette.grey[700],color:I.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":Gt({},I.palette.mode==="light"?{backgroundColor:I.palette.grey[200]}:{backgroundColor:I.palette.grey[600]}),"&:active":Gt({boxShadow:I.shadows[0]},I.palette.mode==="light"?{backgroundColor:_o(I.palette.grey[200],.12)}:{backgroundColor:_o(I.palette.grey[600],.12)})})),R_=ge(y_)({width:24,height:16});function I_(I){const F=I;return q("li",{children:q(S_,Gt({focusRipple:!0},I,{ownerState:F,children:q(R_,{ownerState:F})}))})}function C_(I){return d_("MuiBreadcrumbs",I)}const T_=__("MuiBreadcrumbs",["root","ol","li","separator"]),E_=T_,L_=["children","className","component","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],b_=I=>{const{classes:F}=I;return A_({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},C_,F)},O_=ge(Pi,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(I,F)=>[{[`& .${E_.li}`]:F.li},F.root]})({}),B_=ge("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(I,F)=>F.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),W_=ge("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(I,F)=>F.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function M_(I,F,o,X){return I.reduce((fn,Mn,M)=>(M<I.length-1?fn=fn.concat(Mn,q(W_,{"aria-hidden":!0,className:F,ownerState:X,children:o},`separator-${M}`)):fn.push(Mn),fn),[])}const P_=ce.exports.forwardRef(function(F,o){const X=v_({props:F,name:"MuiBreadcrumbs"}),{children:fn,className:Mn,component:M="nav",expandText:pe="Show path",itemsAfterCollapse:ht=1,itemsBeforeCollapse:Ht=1,maxItems:nt=8,separator:Tn="/"}=X,_e=x_(X,L_),[Gn,tt]=ce.exports.useState(!1),Hn=Gt({},X,{component:M,expanded:Gn,expandText:pe,itemsAfterCollapse:ht,itemsBeforeCollapse:Ht,maxItems:nt,separator:Tn}),Q=b_(Hn),Pn=ce.exports.useRef(null),de=V=>{const ln=()=>{tt(!0);const $n=Pn.current.querySelector("a[href],button,[tabindex]");$n&&$n.focus()};return Ht+ht>=V.length?V:[...V.slice(0,Ht),q(I_,{"aria-label":pe,onClick:ln},"ellipsis"),...V.slice(V.length-ht,V.length)]},on=ce.exports.Children.toArray(fn).filter(V=>ce.exports.isValidElement(V)).map((V,ln)=>q("li",{className:Q.li,children:V},`child-${ln}`));return q(O_,Gt({ref:o,component:M,color:"text.secondary",className:w_(Q.root,Mn),ownerState:Hn},_e,{children:q(B_,{className:Q.ol,ref:Pn,ownerState:Hn,children:M_(Gn||nt&&on.length<=nt?on:de(on),Q.separator,Tn,Hn)})}))}),U_=P_;var Mi={exports:{}};/**
import{Q as g_,f as q,t as ge,M as p_,z as Gt,aV as _o,w as __,v as d_,T as Pi,r as ce,x as v_,y as x_,D as w_,E as A_,aW as he,B as St,j as ar,L as Wi,i as m_}from"./index.eaf14aef.js";const y_=g_(q("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz"),S_=ge(p_)(({theme:I})=>Gt({display:"flex",marginLeft:`calc(${I.spacing(1)} * 0.5)`,marginRight:`calc(${I.spacing(1)} * 0.5)`},I.palette.mode==="light"?{backgroundColor:I.palette.grey[100],color:I.palette.grey[700]}:{backgroundColor:I.palette.grey[700],color:I.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":Gt({},I.palette.mode==="light"?{backgroundColor:I.palette.grey[200]}:{backgroundColor:I.palette.grey[600]}),"&:active":Gt({boxShadow:I.shadows[0]},I.palette.mode==="light"?{backgroundColor:_o(I.palette.grey[200],.12)}:{backgroundColor:_o(I.palette.grey[600],.12)})})),R_=ge(y_)({width:24,height:16});function I_(I){const F=I;return q("li",{children:q(S_,Gt({focusRipple:!0},I,{ownerState:F,children:q(R_,{ownerState:F})}))})}function C_(I){return d_("MuiBreadcrumbs",I)}const T_=__("MuiBreadcrumbs",["root","ol","li","separator"]),E_=T_,L_=["children","className","component","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],b_=I=>{const{classes:F}=I;return A_({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},C_,F)},O_=ge(Pi,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(I,F)=>[{[`& .${E_.li}`]:F.li},F.root]})({}),B_=ge("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(I,F)=>F.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),W_=ge("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(I,F)=>F.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function M_(I,F,o,X){return I.reduce((fn,Mn,M)=>(M<I.length-1?fn=fn.concat(Mn,q(W_,{"aria-hidden":!0,className:F,ownerState:X,children:o},`separator-${M}`)):fn.push(Mn),fn),[])}const P_=ce.exports.forwardRef(function(F,o){const X=v_({props:F,name:"MuiBreadcrumbs"}),{children:fn,className:Mn,component:M="nav",expandText:pe="Show path",itemsAfterCollapse:ht=1,itemsBeforeCollapse:Ht=1,maxItems:nt=8,separator:Tn="/"}=X,_e=x_(X,L_),[Gn,tt]=ce.exports.useState(!1),Hn=Gt({},X,{component:M,expanded:Gn,expandText:pe,itemsAfterCollapse:ht,itemsBeforeCollapse:Ht,maxItems:nt,separator:Tn}),Q=b_(Hn),Pn=ce.exports.useRef(null),de=V=>{const ln=()=>{tt(!0);const $n=Pn.current.querySelector("a[href],button,[tabindex]");$n&&$n.focus()};return Ht+ht>=V.length?V:[...V.slice(0,Ht),q(I_,{"aria-label":pe,onClick:ln},"ellipsis"),...V.slice(V.length-ht,V.length)]},on=ce.exports.Children.toArray(fn).filter(V=>ce.exports.isValidElement(V)).map((V,ln)=>q("li",{className:Q.li,children:V},`child-${ln}`));return q(O_,Gt({ref:o,component:M,color:"text.secondary",className:w_(Q.root,Mn),ownerState:Hn},_e,{children:q(B_,{className:Q.ol,ref:Pn,ownerState:Hn,children:M_(Gn||nt&&on.length<=nt?on:de(on),Q.separator,Tn,Hn)})}))}),U_=P_;var Mi={exports:{}};/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{H as j}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as z}from"./Page.1b52de0c.js";import{ap as B,aT as w,a0 as R,a as G,au as m,r as l,j as s,S,f as e,i as y,$ as g,P as H,av as O,g as A,aB as W,B as F,T as Y,Y as q}from"./index.2830a4a3.js";import{C as J}from"./CorporateTabNavigations.5ad764ec.js";import{d as K,a as M}from"./KeyboardArrowRight.833db889.js";import{d as Q}from"./Add.27052fd0.js";import{C as T}from"./Card.86cb2364.js";import{T as U}from"./TableContainer.07a91927.js";import{T as V,a as x,b as p,c as t}from"./TableRow.678d5f59.js";import{a as X}from"./ConfiguredCorporateContext.9c26b20c.js";import{G as C}from"./Grid.f80372c7.js";import"./jsx-runtime_commonjs-proxy.92370fb9.js";function Z(a){return a==null?void 0:a.replace(/(<([^>]+)>)/gi,"")}function ee(a,o=50){return a==null?void 0:a.substring(0,o)}function ae(a,o=50){return ee(Z(a!=null?a:""),o)}function te(){B();const{corporate_id:a}=w(),[o,b]=R();G();function u(r){const n=l.exports.useRef(null),[i,f]=l.exports.useState(""),k=c=>{var P;const N=(P=c.target.value)!=null?P:"";f(N)},L=c=>{c.preventDefault(),r.onSearch(i)};return l.exports.useEffect(()=>{var c;f((c=o.get("search"))!=null?c:"")},[o]),e("form",{onSubmit:L,style:{width:"100%"},children:e(O,{id:"search-input",ref:n,label:"Search",variant:"outlined",fullWidth:!0,onChange:k,value:i})})}function h(r){const{row:n}=r,[i,f]=m.useState(!1);return s(m.Fragment,{children:[s(p,{sx:{"& > *":{borderBottom:"unset"}},children:[e(t,{children:e(A,{"aria-label":"expand row",size:"small",onClick:()=>f(!i),children:i?e(K,{}):e(M,{})})}),e(t,{align:"left",children:n.id}),e(t,{align:"left",children:n.code}),e(t,{align:"left",children:n.name}),e(t,{align:"left",children:ae(n.description)}),n.active?e(t,{align:"right",children:e(g,{variant:"outlined",color:"success",size:"small",children:"Active"})}):e(t,{align:"right",children:e(g,{variant:"outlined",color:"error",size:"small",children:"Inactive"})}),e(t,{align:"right",children:e(y,{to:`/corporates/${n.corporate_id}/corporate-plans/${n.id}/edit`,children:e(g,{variant:"outlined",color:"success",size:"small",children:"Edit"})})})]}),e(p,{children:e(t,{style:{paddingBottom:0,paddingTop:0},colSpan:10,children:s(W,{in:i,timeout:"auto",unmountOnExit:!0,children:[e(F,{sx:{borderBottom:1},children:e(Y,{variant:"body2",gutterBottom:!0,component:"div",children:"No Extra Data"})}),!1]})})})]})}const[E,v]=m.useState(!0),[_,I]=m.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0}),D=async(r=null)=>{v(!0);const n=r||Object.fromEntries([...o.entries()]),i=await q.get("/corporates/"+a+"/corporate-plans",{params:n});v(!1),I(i.data)},d={fontWeight:"bold"},$=async r=>{await D({search:r}),b({search:r})};return l.exports.useEffect(()=>{D()},[]),s(S,{children:[s(S,{direction:"row",spacing:2,sx:{p:2},children:[e(u,{onSearch:$}),e(y,{to:`/corporates/${a}/corporate-plans/create`,children:e(g,{component:"button",id:"upload-button",variant:"outlined",startIcon:e(Q,{}),sx:{p:1.8},children:"Create"})})]}),e(T,{children:e(U,{component:H,children:s(V,{"aria-label":"collapsible table",children:[e(x,{children:s(p,{children:[e(t,{style:d,align:"left"}),e(t,{style:d,align:"left",children:"ID"}),e(t,{style:d,align:"left",children:"Code"}),e(t,{style:d,align:"left",children:"Name"}),e(t,{style:d,align:"left",children:"Description"})]})}),E?e(x,{children:e(p,{children:e(t,{colSpan:8,align:"center",children:"Loading"})})}):_.data.length==0?e(x,{children:e(p,{children:e(t,{colSpan:8,align:"center",children:"No Data"})})}):e(x,{children:_.data.map(r=>e(h,{row:r},r.code))})]})})})]})}function me(){var h;B();const{corporate_id:a}=w(),[o,b]=l.exports.useState(),u=l.exports.useContext(X);return l.exports.useEffect(()=>{b(u.currentCorporate)},[u]),s(z,{title:"Corporate Plan",children:[e(j,{heading:"Corporate Plan",links:[{name:"Corporates",href:"/corporates"},{name:(h=o==null?void 0:o.name)!=null?h:"-",href:"/corporate/"+a},{name:"Corporate Plan",href:"/corporate/"+a+"/corporate-plans"}]}),s(C,{container:!0,spacing:2,children:[e(C,{item:!0,xs:8,children:s(T,{children:[e(J,{position:"corporate-plans"}),e(te,{})]})}),e(C,{item:!0,xs:4,children:e(T,{sx:{p:2},children:"Corporate Detail Goes Here \xA0"})})]})]})}export{me as default};
import{H as j}from"./HeaderBreadcrumbs.91259cd4.js";import{P as z}from"./Page.c2cde06d.js";import{ap as B,aT as w,a0 as R,a as G,au as m,r as l,j as s,S,f as e,i as y,$ as g,P as H,av as O,g as A,aB as W,B as F,T as Y,Y as q}from"./index.eaf14aef.js";import{C as J}from"./CorporateTabNavigations.425fcfca.js";import{d as K,a as M}from"./KeyboardArrowRight.f797f999.js";import{d as Q}from"./Add.abe475ec.js";import{C as T}from"./Card.4687a3ba.js";import{T as U}from"./TableContainer.cdb185b9.js";import{T as V,a as x,b as p,c as t}from"./TableRow.9c0fd6dd.js";import{a as X}from"./ConfiguredCorporateContext.f7fa099a.js";import{G as C}from"./Grid.dda358cb.js";import"./jsx-runtime_commonjs-proxy.20d2a437.js";function Z(a){return a==null?void 0:a.replace(/(<([^>]+)>)/gi,"")}function ee(a,o=50){return a==null?void 0:a.substring(0,o)}function ae(a,o=50){return ee(Z(a!=null?a:""),o)}function te(){B();const{corporate_id:a}=w(),[o,b]=R();G();function u(r){const n=l.exports.useRef(null),[i,f]=l.exports.useState(""),k=c=>{var P;const N=(P=c.target.value)!=null?P:"";f(N)},L=c=>{c.preventDefault(),r.onSearch(i)};return l.exports.useEffect(()=>{var c;f((c=o.get("search"))!=null?c:"")},[o]),e("form",{onSubmit:L,style:{width:"100%"},children:e(O,{id:"search-input",ref:n,label:"Search",variant:"outlined",fullWidth:!0,onChange:k,value:i})})}function h(r){const{row:n}=r,[i,f]=m.useState(!1);return s(m.Fragment,{children:[s(p,{sx:{"& > *":{borderBottom:"unset"}},children:[e(t,{children:e(A,{"aria-label":"expand row",size:"small",onClick:()=>f(!i),children:i?e(K,{}):e(M,{})})}),e(t,{align:"left",children:n.id}),e(t,{align:"left",children:n.code}),e(t,{align:"left",children:n.name}),e(t,{align:"left",children:ae(n.description)}),n.active?e(t,{align:"right",children:e(g,{variant:"outlined",color:"success",size:"small",children:"Active"})}):e(t,{align:"right",children:e(g,{variant:"outlined",color:"error",size:"small",children:"Inactive"})}),e(t,{align:"right",children:e(y,{to:`/corporates/${n.corporate_id}/corporate-plans/${n.id}/edit`,children:e(g,{variant:"outlined",color:"success",size:"small",children:"Edit"})})})]}),e(p,{children:e(t,{style:{paddingBottom:0,paddingTop:0},colSpan:10,children:s(W,{in:i,timeout:"auto",unmountOnExit:!0,children:[e(F,{sx:{borderBottom:1},children:e(Y,{variant:"body2",gutterBottom:!0,component:"div",children:"No Extra Data"})}),!1]})})})]})}const[E,v]=m.useState(!0),[_,I]=m.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0}),D=async(r=null)=>{v(!0);const n=r||Object.fromEntries([...o.entries()]),i=await q.get("/corporates/"+a+"/corporate-plans",{params:n});v(!1),I(i.data)},d={fontWeight:"bold"},$=async r=>{await D({search:r}),b({search:r})};return l.exports.useEffect(()=>{D()},[]),s(S,{children:[s(S,{direction:"row",spacing:2,sx:{p:2},children:[e(u,{onSearch:$}),e(y,{to:`/corporates/${a}/corporate-plans/create`,children:e(g,{component:"button",id:"upload-button",variant:"outlined",startIcon:e(Q,{}),sx:{p:1.8},children:"Create"})})]}),e(T,{children:e(U,{component:H,children:s(V,{"aria-label":"collapsible table",children:[e(x,{children:s(p,{children:[e(t,{style:d,align:"left"}),e(t,{style:d,align:"left",children:"ID"}),e(t,{style:d,align:"left",children:"Code"}),e(t,{style:d,align:"left",children:"Name"}),e(t,{style:d,align:"left",children:"Description"})]})}),E?e(x,{children:e(p,{children:e(t,{colSpan:8,align:"center",children:"Loading"})})}):_.data.length==0?e(x,{children:e(p,{children:e(t,{colSpan:8,align:"center",children:"No Data"})})}):e(x,{children:_.data.map(r=>e(h,{row:r},r.code))})]})})})]})}function me(){var h;B();const{corporate_id:a}=w(),[o,b]=l.exports.useState(),u=l.exports.useContext(X);return l.exports.useEffect(()=>{b(u.currentCorporate)},[u]),s(z,{title:"Corporate Plan",children:[e(j,{heading:"Corporate Plan",links:[{name:"Corporates",href:"/corporates"},{name:(h=o==null?void 0:o.name)!=null?h:"-",href:"/corporate/"+a},{name:"Corporate Plan",href:"/corporate/"+a+"/corporate-plans"}]}),s(C,{container:!0,spacing:2,children:[e(C,{item:!0,xs:8,children:s(T,{children:[e(J,{position:"corporate-plans"}),e(te,{})]})}),e(C,{item:!0,xs:4,children:e(T,{sx:{p:2},children:"Corporate Detail Goes Here \xA0"})})]})]})}export{me as default};

View File

@@ -1 +1 @@
import{H as M}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as U}from"./Page.1b52de0c.js";import{ap as E,aT as I,a0 as Y,a as $,r as l,j as i,S as k,f as e,P as J,av as K,ay as Q,aA as y,$ as P,au as A,aB as V,B as X,T as Z,Y as _,aU as B}from"./index.2830a4a3.js";import{C as ee}from"./CorporateTabNavigations.5ad764ec.js";import{B as ae}from"./BasePagination.a0790cbf.js";import{C as R}from"./Card.86cb2364.js";import{T as te}from"./TableContainer.07a91927.js";import{T as re,a as b,b as S,c as n}from"./TableRow.678d5f59.js";import{G as D}from"./Grid.f80372c7.js";import{a as ne}from"./ConfiguredCorporateContext.9c26b20c.js";function se(){E();const{corporate_id:h}=I(),[c,x]=Y();$();const[v,g]=l.exports.useState(!0),[d,C]=l.exports.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0});function j(t){const a=l.exports.useRef(null),[r,p]=l.exports.useState(""),[m,w]=l.exports.useState("active"),G=s=>{var u;const o=(u=s.target.value)!=null?u:"";p(o)},H=s=>{var F;const o=(F=s.target.value)!=null?F:"";console.log("changing to",o),w(o);const u={search:r,status:o};t.onSearch(u)},W=s=>{s==null||s.preventDefault();const o={search:r,status:m};t.onSearch(o)};return l.exports.useEffect(()=>{var s,o,u;p((s=c.get("search"))!=null?s:""),w((u=(o=c.get("status"))!=null?o:m)!=null?u:"active")},[c]),e("form",{id:"search-form",onSubmit:W,style:{width:"100%"},children:i(D,{container:!0,spacing:2,children:[e(D,{item:!0,xs:9,children:e(K,{id:"search-input",ref:a,label:"Search",variant:"outlined",fullWidth:!0,onChange:G,value:r})}),e(D,{item:!0,xs:3,children:i(Q,{label:"Status",value:m,onChange:H,sx:{width:"100%"},children:[e(y,{value:"active",children:"Active"}),e(y,{value:"inactive",children:"Inactive"}),e(y,{value:"all",children:"All"})]})}),e(P,{type:"submit",variant:"outlined",sx:{p:1.8,display:"none"},children:"Search"})]})})}const N=t=>{B("Fuck yuo"),_.put("/corporates/"+h+"/formulariums/"+t.id+"/activate").then(()=>{C({...d,data:d.data.map(a=>a.id===t.id?{...a,status:"active"}:a)})}).catch(a=>{var r,p,m;console.log(a),B((m=(p=(r=a.data)==null?void 0:r.message)!=null?p:a.message)!=null?m:"Failed Processing Request",{variant:"error"})})},L=t=>{_.put("/corporates/"+h+"/formulariums/"+t.id+"/deactivate").then(()=>{C({...d,data:d.data.map(a=>a.id===t.id?{...a,status:"inactive"}:a)})}).catch(a=>{var r;B((r=a.message)!=null?r:"Failed Processing Request",{variant:"error"})})};function O(t){const{row:a}=t,[r,p]=A.useState(!1);return i(A.Fragment,{children:[i(S,{sx:{"& > *":{borderBottom:"unset"}},children:[e(n,{align:"left",children:a.id}),e(n,{align:"left",children:a.code}),e(n,{align:"left",children:a.name}),e(n,{align:"left",children:a.items_count}),e(n,{align:"right",children:a.status=="active"?e(P,{variant:"outlined",onClick:()=>{L(a)},color:"success",size:"small",children:"Active"}):e(P,{variant:"outlined",onClick:()=>{N(a)},color:"error",size:"small",children:"Tidak Digunakan"})})]}),e(S,{children:e(n,{style:{paddingBottom:0,paddingTop:0},colSpan:10,children:e(V,{in:r,timeout:"auto",unmountOnExit:!0,children:e(X,{sx:{borderBottom:1},children:e(Z,{variant:"body2",gutterBottom:!0,component:"div",children:"No Extra Data"})})})})})]})}const T=async(t=null)=>{g(!0);const a=t||Object.fromEntries([...c.entries()]),r=await _.get("/corporates/"+h+"/formulariums",{params:a});g(!1),C(r.data)},f={fontWeight:"bold"},q=async t=>{await T(t),x(t)},z=(t,a)=>{const r=Object.fromEntries([...c.entries(),["page",a]]);T(r),x(r)};return l.exports.useEffect(()=>{T()},[]),i(k,{children:[e(k,{direction:"row",spacing:2,sx:{p:2},children:e(j,{onSearch:q})}),i(R,{children:[e(te,{component:J,children:i(re,{"aria-label":"collapsible table",children:[e(b,{children:i(S,{children:[e(n,{style:f,align:"left",width:50,children:"#"}),e(n,{style:f,align:"left",children:"Code"}),e(n,{style:f,align:"left",children:"Name"}),e(n,{style:f,align:"left",children:"Total Item"}),e(n,{style:f,align:"right",children:"Status"})]})}),v?e(b,{children:e(S,{children:e(n,{colSpan:8,align:"center",children:"Loading"})})}):d.data.length==0?e(b,{children:e(S,{children:e(n,{colSpan:8,align:"center",children:"No Data"})})}):e(b,{children:d.data.map(t=>e(O,{row:t},t.code))})]})}),e(ae,{paginationData:d,onPageChange:z})]})]})}function fe(){var g;E();const{corporate_id:h}=I(),[c,x]=l.exports.useState(),v=l.exports.useContext(ne);return l.exports.useEffect(()=>{x(v.currentCorporate)},[v]),i(U,{title:"Formularium",children:[e(M,{heading:"Formularium",links:[{name:"Corporates",href:"/corporates"},{name:(g=c==null?void 0:c.name)!=null?g:"-",href:"/corporate/"+h},{name:"Formularium",href:"/corporate/"+h+"/formularium"}]}),i(R,{children:[e(ee,{position:"formularium"}),e(se,{})]})]})}export{fe as default};
import{H as M}from"./HeaderBreadcrumbs.91259cd4.js";import{P as U}from"./Page.c2cde06d.js";import{ap as E,aT as I,a0 as Y,a as $,r as l,j as i,S as k,f as e,P as J,av as K,ay as Q,aA as y,$ as P,au as A,aB as V,B as X,T as Z,Y as _,aU as B}from"./index.eaf14aef.js";import{C as ee}from"./CorporateTabNavigations.425fcfca.js";import{B as ae}from"./BasePagination.48b4da63.js";import{C as R}from"./Card.4687a3ba.js";import{T as te}from"./TableContainer.cdb185b9.js";import{T as re,a as b,b as S,c as n}from"./TableRow.9c0fd6dd.js";import{G as D}from"./Grid.dda358cb.js";import{a as ne}from"./ConfiguredCorporateContext.f7fa099a.js";function se(){E();const{corporate_id:h}=I(),[c,x]=Y();$();const[v,g]=l.exports.useState(!0),[d,C]=l.exports.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0});function j(t){const a=l.exports.useRef(null),[r,p]=l.exports.useState(""),[m,w]=l.exports.useState("active"),G=s=>{var u;const o=(u=s.target.value)!=null?u:"";p(o)},H=s=>{var F;const o=(F=s.target.value)!=null?F:"";console.log("changing to",o),w(o);const u={search:r,status:o};t.onSearch(u)},W=s=>{s==null||s.preventDefault();const o={search:r,status:m};t.onSearch(o)};return l.exports.useEffect(()=>{var s,o,u;p((s=c.get("search"))!=null?s:""),w((u=(o=c.get("status"))!=null?o:m)!=null?u:"active")},[c]),e("form",{id:"search-form",onSubmit:W,style:{width:"100%"},children:i(D,{container:!0,spacing:2,children:[e(D,{item:!0,xs:9,children:e(K,{id:"search-input",ref:a,label:"Search",variant:"outlined",fullWidth:!0,onChange:G,value:r})}),e(D,{item:!0,xs:3,children:i(Q,{label:"Status",value:m,onChange:H,sx:{width:"100%"},children:[e(y,{value:"active",children:"Active"}),e(y,{value:"inactive",children:"Inactive"}),e(y,{value:"all",children:"All"})]})}),e(P,{type:"submit",variant:"outlined",sx:{p:1.8,display:"none"},children:"Search"})]})})}const N=t=>{B("Fuck yuo"),_.put("/corporates/"+h+"/formulariums/"+t.id+"/activate").then(()=>{C({...d,data:d.data.map(a=>a.id===t.id?{...a,status:"active"}:a)})}).catch(a=>{var r,p,m;console.log(a),B((m=(p=(r=a.data)==null?void 0:r.message)!=null?p:a.message)!=null?m:"Failed Processing Request",{variant:"error"})})},L=t=>{_.put("/corporates/"+h+"/formulariums/"+t.id+"/deactivate").then(()=>{C({...d,data:d.data.map(a=>a.id===t.id?{...a,status:"inactive"}:a)})}).catch(a=>{var r;B((r=a.message)!=null?r:"Failed Processing Request",{variant:"error"})})};function O(t){const{row:a}=t,[r,p]=A.useState(!1);return i(A.Fragment,{children:[i(S,{sx:{"& > *":{borderBottom:"unset"}},children:[e(n,{align:"left",children:a.id}),e(n,{align:"left",children:a.code}),e(n,{align:"left",children:a.name}),e(n,{align:"left",children:a.items_count}),e(n,{align:"right",children:a.status=="active"?e(P,{variant:"outlined",onClick:()=>{L(a)},color:"success",size:"small",children:"Active"}):e(P,{variant:"outlined",onClick:()=>{N(a)},color:"error",size:"small",children:"Tidak Digunakan"})})]}),e(S,{children:e(n,{style:{paddingBottom:0,paddingTop:0},colSpan:10,children:e(V,{in:r,timeout:"auto",unmountOnExit:!0,children:e(X,{sx:{borderBottom:1},children:e(Z,{variant:"body2",gutterBottom:!0,component:"div",children:"No Extra Data"})})})})})]})}const T=async(t=null)=>{g(!0);const a=t||Object.fromEntries([...c.entries()]),r=await _.get("/corporates/"+h+"/formulariums",{params:a});g(!1),C(r.data)},f={fontWeight:"bold"},q=async t=>{await T(t),x(t)},z=(t,a)=>{const r=Object.fromEntries([...c.entries(),["page",a]]);T(r),x(r)};return l.exports.useEffect(()=>{T()},[]),i(k,{children:[e(k,{direction:"row",spacing:2,sx:{p:2},children:e(j,{onSearch:q})}),i(R,{children:[e(te,{component:J,children:i(re,{"aria-label":"collapsible table",children:[e(b,{children:i(S,{children:[e(n,{style:f,align:"left",width:50,children:"#"}),e(n,{style:f,align:"left",children:"Code"}),e(n,{style:f,align:"left",children:"Name"}),e(n,{style:f,align:"left",children:"Total Item"}),e(n,{style:f,align:"right",children:"Status"})]})}),v?e(b,{children:e(S,{children:e(n,{colSpan:8,align:"center",children:"Loading"})})}):d.data.length==0?e(b,{children:e(S,{children:e(n,{colSpan:8,align:"center",children:"No Data"})})}):e(b,{children:d.data.map(t=>e(O,{row:t},t.code))})]})}),e(ae,{paginationData:d,onPageChange:z})]})]})}function fe(){var g;E();const{corporate_id:h}=I(),[c,x]=l.exports.useState(),v=l.exports.useContext(ne);return l.exports.useEffect(()=>{x(v.currentCorporate)},[v]),i(U,{title:"Formularium",children:[e(M,{heading:"Formularium",links:[{name:"Corporates",href:"/corporates"},{name:(g=c==null?void 0:c.name)!=null?g:"-",href:"/corporate/"+h},{name:"Formularium",href:"/corporate/"+h+"/formularium"}]}),i(R,{children:[e(ee,{position:"formularium"}),e(se,{})]})]})}export{fe as default};

View File

@@ -1 +1 @@
import{a as k}from"./ConfiguredCorporateContext.9c26b20c.js";import{ap as y,aT as B,a0 as O,a as R,au as g,r as s,j as o,S as _,f as e,i as D,$ as C,P as z,av as H,g as W,aB as A,B as F,T as Y,Y as q}from"./index.2830a4a3.js";import{H as G}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as J}from"./Page.1b52de0c.js";import{C as K}from"./CorporateTabNavigations.5ad764ec.js";import{d as M,a as Q}from"./KeyboardArrowRight.833db889.js";import{d as U}from"./Add.27052fd0.js";import{B as V}from"./BasePagination.a0790cbf.js";import{C as P}from"./Card.86cb2364.js";import{T as X}from"./TableContainer.07a91927.js";import{T as Z,a as b,b as p,c as a}from"./TableRow.678d5f59.js";import"./jsx-runtime_commonjs-proxy.92370fb9.js";function ee(){y();const{corporate_id:c}=B(),[i,h]=O();R();function u(t){const r=s.exports.useRef(null),[n,m]=s.exports.useState(""),j=l=>{var T;const N=(T=l.target.value)!=null?T:"";m(N)},L=l=>{l.preventDefault(),t.onSearch(n)};return s.exports.useEffect(()=>{var l;m((l=i.get("search"))!=null?l:"")},[i]),e("form",{onSubmit:L,style:{width:"100%"},children:e(H,{id:"search-input",ref:r,label:"Search",variant:"outlined",fullWidth:!0,onChange:j,value:n})})}function f(t){const{row:r}=t,[n,m]=g.useState(!1);return o(g.Fragment,{children:[o(p,{sx:{"& > *":{borderBottom:"unset"}},children:[e(a,{children:e(W,{"aria-label":"expand row",size:"small",onClick:()=>m(!n),children:n?e(M,{}):e(Q,{})})}),e(a,{align:"left",children:r.id}),e(a,{align:"left",children:r.code}),e(a,{align:"left",children:r.name}),e(a,{align:"left",children:r.description}),e(a,{align:"right",children:e(C,{variant:"outlined",color:"success",size:"small",children:"Active"})}),e(a,{align:"right",children:e(D,{to:`/corporate/${r.corporate_id}/divisions/${r.id}/edit`,children:e(C,{variant:"outlined",color:"success",size:"small",children:"Edit"})})})]}),e(p,{children:e(a,{style:{paddingBottom:0,paddingTop:0},colSpan:10,children:o(A,{in:n,timeout:"auto",unmountOnExit:!0,children:[e(F,{sx:{borderBottom:1},children:e(Y,{variant:"body2",gutterBottom:!0,component:"div",children:"No Extra Data"})}),!1]})})})]})}const[w,S]=g.useState(!0),[x,E]=g.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0}),v=async(t=null)=>{S(!0);const r=t||Object.fromEntries([...i.entries()]),n=await q.get("/corporates/"+c+"/divisions",{params:r});S(!1),E(n.data)},d={fontWeight:"bold"},I=async t=>{await v({search:t}),h({search:t})},$=(t,r)=>{const n=Object.fromEntries([...i.entries(),["page",r]]);v(n),h(n)};return s.exports.useEffect(()=>{v()},[]),o(_,{children:[o(_,{direction:"row",spacing:2,sx:{p:2},children:[e(u,{onSearch:I}),e(D,{to:`/corporate/${c}/divisions/create`,children:e(C,{component:"button",id:"upload-button",variant:"outlined",startIcon:e(U,{}),sx:{p:1.8},children:"Create"})})]}),o(P,{children:[e(X,{component:z,children:o(Z,{"aria-label":"collapsible table",children:[e(b,{children:o(p,{children:[e(a,{style:d,align:"left"}),e(a,{style:d,align:"left",children:"ID"}),e(a,{style:d,align:"left",children:"Code"}),e(a,{style:d,align:"left",children:"Name"}),e(a,{style:d,align:"left",children:"Description"})]})}),w?e(b,{children:e(p,{children:e(a,{colSpan:8,align:"center",children:"Loading"})})}):x.data.length==0?e(b,{children:e(p,{children:e(a,{colSpan:8,align:"center",children:"No Data"})})}):e(b,{children:x.data.map(t=>e(f,{row:t},t.code))})]})}),e(V,{paginationData:x,onPageChange:$})]})]})}function ue(){var f;y();const{corporate_id:c}=B(),[i,h]=s.exports.useState(),u=s.exports.useContext(k);return s.exports.useEffect(()=>{h(u.currentCorporate)},[u]),o(J,{title:"Division",children:[e(G,{heading:"Division",links:[{name:"Corporates",href:"/corporates"},{name:(f=i==null?void 0:i.name)!=null?f:"-",href:"/corporate/"+c},{name:"Division",href:"/corporate/"+c+"/divisions"}]}),o(P,{children:[e(K,{position:"divisions"}),e(ee,{})]})]})}export{ue as default};
import{a as k}from"./ConfiguredCorporateContext.f7fa099a.js";import{ap as y,aT as B,a0 as O,a as R,au as g,r as s,j as o,S as _,f as e,i as D,$ as C,P as z,av as H,g as W,aB as A,B as F,T as Y,Y as q}from"./index.eaf14aef.js";import{H as G}from"./HeaderBreadcrumbs.91259cd4.js";import{P as J}from"./Page.c2cde06d.js";import{C as K}from"./CorporateTabNavigations.425fcfca.js";import{d as M,a as Q}from"./KeyboardArrowRight.f797f999.js";import{d as U}from"./Add.abe475ec.js";import{B as V}from"./BasePagination.48b4da63.js";import{C as P}from"./Card.4687a3ba.js";import{T as X}from"./TableContainer.cdb185b9.js";import{T as Z,a as b,b as p,c as a}from"./TableRow.9c0fd6dd.js";import"./jsx-runtime_commonjs-proxy.20d2a437.js";function ee(){y();const{corporate_id:c}=B(),[i,h]=O();R();function u(t){const r=s.exports.useRef(null),[n,m]=s.exports.useState(""),j=l=>{var T;const N=(T=l.target.value)!=null?T:"";m(N)},L=l=>{l.preventDefault(),t.onSearch(n)};return s.exports.useEffect(()=>{var l;m((l=i.get("search"))!=null?l:"")},[i]),e("form",{onSubmit:L,style:{width:"100%"},children:e(H,{id:"search-input",ref:r,label:"Search",variant:"outlined",fullWidth:!0,onChange:j,value:n})})}function f(t){const{row:r}=t,[n,m]=g.useState(!1);return o(g.Fragment,{children:[o(p,{sx:{"& > *":{borderBottom:"unset"}},children:[e(a,{children:e(W,{"aria-label":"expand row",size:"small",onClick:()=>m(!n),children:n?e(M,{}):e(Q,{})})}),e(a,{align:"left",children:r.id}),e(a,{align:"left",children:r.code}),e(a,{align:"left",children:r.name}),e(a,{align:"left",children:r.description}),e(a,{align:"right",children:e(C,{variant:"outlined",color:"success",size:"small",children:"Active"})}),e(a,{align:"right",children:e(D,{to:`/corporate/${r.corporate_id}/divisions/${r.id}/edit`,children:e(C,{variant:"outlined",color:"success",size:"small",children:"Edit"})})})]}),e(p,{children:e(a,{style:{paddingBottom:0,paddingTop:0},colSpan:10,children:o(A,{in:n,timeout:"auto",unmountOnExit:!0,children:[e(F,{sx:{borderBottom:1},children:e(Y,{variant:"body2",gutterBottom:!0,component:"div",children:"No Extra Data"})}),!1]})})})]})}const[w,S]=g.useState(!0),[x,E]=g.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0}),v=async(t=null)=>{S(!0);const r=t||Object.fromEntries([...i.entries()]),n=await q.get("/corporates/"+c+"/divisions",{params:r});S(!1),E(n.data)},d={fontWeight:"bold"},I=async t=>{await v({search:t}),h({search:t})},$=(t,r)=>{const n=Object.fromEntries([...i.entries(),["page",r]]);v(n),h(n)};return s.exports.useEffect(()=>{v()},[]),o(_,{children:[o(_,{direction:"row",spacing:2,sx:{p:2},children:[e(u,{onSearch:I}),e(D,{to:`/corporate/${c}/divisions/create`,children:e(C,{component:"button",id:"upload-button",variant:"outlined",startIcon:e(U,{}),sx:{p:1.8},children:"Create"})})]}),o(P,{children:[e(X,{component:z,children:o(Z,{"aria-label":"collapsible table",children:[e(b,{children:o(p,{children:[e(a,{style:d,align:"left"}),e(a,{style:d,align:"left",children:"ID"}),e(a,{style:d,align:"left",children:"Code"}),e(a,{style:d,align:"left",children:"Name"}),e(a,{style:d,align:"left",children:"Description"})]})}),w?e(b,{children:e(p,{children:e(a,{colSpan:8,align:"center",children:"Loading"})})}):x.data.length==0?e(b,{children:e(p,{children:e(a,{colSpan:8,align:"center",children:"No Data"})})}):e(b,{children:x.data.map(t=>e(f,{row:t},t.code))})]})}),e(V,{paginationData:x,onPageChange:$})]})]})}function ue(){var f;y();const{corporate_id:c}=B(),[i,h]=s.exports.useState(),u=s.exports.useContext(k);return s.exports.useEffect(()=>{h(u.currentCorporate)},[u]),o(J,{title:"Division",children:[e(G,{heading:"Division",links:[{name:"Corporates",href:"/corporates"},{name:(f=i==null?void 0:i.name)!=null?f:"-",href:"/corporate/"+c},{name:"Division",href:"/corporate/"+c+"/divisions"}]}),o(P,{children:[e(K,{position:"divisions"}),e(ee,{})]})]})}export{ue as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{H as n}from"./HeaderBreadcrumbs.48c93fe3.js";import{P as p}from"./Page.1b52de0c.js";import{ap as c,aT as f,r as e,j as i,f as o,T as C}from"./index.2830a4a3.js";import{C as u}from"./CorporateTabNavigations.5ad764ec.js";import{a as d}from"./ConfiguredCorporateContext.9c26b20c.js";import{C as l}from"./Card.86cb2364.js";function j(){var s;c();const{corporate_id:t}=f(),[r,m]=e.exports.useState(),a=e.exports.useContext(d);return e.exports.useEffect(()=>{m(a.currentCorporate)},[a]),i(p,{title:"Claim History",children:[o(n,{heading:"Claim History",links:[{name:"Corporates",href:"/corporates"},{name:(s=r==null?void 0:r.name)!=null?s:"-",href:"/corporate/"+t},{name:"Claim History",href:"/corporate/"+t+"/claim-histories"}]}),i(l,{children:[o(u,{position:"claim-histories"}),o(C,{sx:{m:4},children:"Feature Not Implemented Yet"})]})]})}export{j as default};
import{H as n}from"./HeaderBreadcrumbs.91259cd4.js";import{P as p}from"./Page.c2cde06d.js";import{ap as c,aT as f,r as e,j as i,f as o,T as C}from"./index.eaf14aef.js";import{C as u}from"./CorporateTabNavigations.425fcfca.js";import{a as d}from"./ConfiguredCorporateContext.f7fa099a.js";import{C as l}from"./Card.4687a3ba.js";function j(){var s;c();const{corporate_id:t}=f(),[r,m]=e.exports.useState(),a=e.exports.useContext(d);return e.exports.useEffect(()=>{m(a.currentCorporate)},[a]),i(p,{title:"Claim History",children:[o(n,{heading:"Claim History",links:[{name:"Corporates",href:"/corporates"},{name:(s=r==null?void 0:r.name)!=null?s:"-",href:"/corporate/"+t},{name:"Claim History",href:"/corporate/"+t+"/claim-histories"}]}),i(l,{children:[o(u,{position:"claim-histories"}),o(C,{sx:{m:4},children:"Feature Not Implemented Yet"})]})]})}export{j as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More