Compare commits
11 Commits
feature/as
...
feature/do
| Author | SHA1 | Date | |
|---|---|---|---|
| a5db01bd25 | |||
| 5d4033a9ca | |||
| 27523b8cce | |||
| f6117743ad | |||
| 8c97df9fc4 | |||
| 4f2bb19d8a | |||
| 13764a3766 | |||
| ed273fdafa | |||
| d706bf0623 | |||
| 13542cd3c0 | |||
|
|
a7e688a52c |
0
Modules/HospitalPortal/Config/.gitkeep
Normal file
0
Modules/HospitalPortal/Config/.gitkeep
Normal file
5
Modules/HospitalPortal/Config/config.php
Normal file
5
Modules/HospitalPortal/Config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'HospitalPortal'
|
||||
];
|
||||
0
Modules/HospitalPortal/Console/.gitkeep
Normal file
0
Modules/HospitalPortal/Console/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Migrations/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Migrations/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Seeders/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Seeders/.gitkeep
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\HospitalPortal\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HospitalPortalDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
||||
0
Modules/HospitalPortal/Database/factories/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/factories/.gitkeep
Normal file
0
Modules/HospitalPortal/Entities/.gitkeep
Normal file
0
Modules/HospitalPortal/Entities/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Controllers/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Controllers/.gitkeep
Normal file
128
Modules/HospitalPortal/Http/Controllers/Api/AuthController.php
Executable file
128
Modules/HospitalPortal/Http/Controllers/Api/AuthController.php
Executable file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\HospitalPortal\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Crypt;
|
||||
use Error;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Modules\Internal\Emails\SendVerifyEmail;
|
||||
use Modules\Internal\Events\ForgetPassword;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function login(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email',
|
||||
'password' => 'required'
|
||||
]);
|
||||
|
||||
$user = User::query()
|
||||
->where('email', $request->email)
|
||||
->first();
|
||||
|
||||
if (!$user) {
|
||||
return response(['message' => 'User Tidak Ditemukan'], 404);
|
||||
}
|
||||
|
||||
if (!Hash::check($request->password, $user->password)) {
|
||||
return response(['message' => 'Password Salah'], 403);
|
||||
}
|
||||
|
||||
return response([
|
||||
'message' => 'Selamat Datang',
|
||||
'user' => $user,
|
||||
'token' => $user->createToken('app')->plainTextToken
|
||||
]);
|
||||
}
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
$token = $request->bearerToken();
|
||||
Auth::user()->tokens()->where('id', $token)->delete();
|
||||
|
||||
return response(['message' => 'Berhasil Logout.']);
|
||||
}
|
||||
|
||||
public function resetPassword(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$request->validate([
|
||||
'old_password' => 'required',
|
||||
'new_password' => 'required',
|
||||
'confirm_new_password' => 'required'
|
||||
]);
|
||||
|
||||
if (!Hash::check($request['old_password'], $user->password)) {
|
||||
return response(['message' => 'Password Salah'], 403);
|
||||
}
|
||||
|
||||
if ($request["new_password"] != $request["confirm_new_password"]) {
|
||||
return response([
|
||||
'message' => "Password Tidak Sama"
|
||||
]);
|
||||
}
|
||||
|
||||
$user->update([
|
||||
'password' => Hash::make($request->confirm_new_password),
|
||||
]);
|
||||
return response()->json($user);
|
||||
}
|
||||
|
||||
public function verifyEmail(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email',
|
||||
]);
|
||||
|
||||
$user = User::query()
|
||||
->where('email', $request->email)
|
||||
->first();
|
||||
|
||||
if (!$user) {
|
||||
return response(['message' => 'User Tidak Ditemukan'], 404);
|
||||
}
|
||||
|
||||
Event(new ForgetPassword($user));
|
||||
|
||||
// Mail::to($user->email)->send(new SendVerifyEmail($user));
|
||||
|
||||
return response()->json($user);
|
||||
}
|
||||
|
||||
public function forgetPassword(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'new_password' => 'required',
|
||||
'confirm_new_password' => 'required'
|
||||
]);
|
||||
|
||||
$token = Crypt::decryptString($request->token);
|
||||
$email = explode('|', $token)[0];
|
||||
|
||||
$user = User::query()
|
||||
->where('email', $email)
|
||||
->first();
|
||||
|
||||
if (!$user) {
|
||||
return response(['message' => 'User Tidak Ditemukan'], 404);
|
||||
}
|
||||
|
||||
if ($request["new_password"] != $request["confirm_new_password"]) {
|
||||
return response([
|
||||
'message' => "Password Tidak Sama"
|
||||
], 404);
|
||||
}
|
||||
|
||||
$user->update([
|
||||
'password' => Hash::make($request->confirm_new_password),
|
||||
]);
|
||||
return response()->json($user);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\HospitalPortal\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\ClaimRequest;
|
||||
use App\Models\File;
|
||||
use App\Models\Member;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use PDF;
|
||||
|
||||
class ClaimRequestController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index(request $request)
|
||||
{
|
||||
$claimRequests = ClaimRequest::query()
|
||||
->when($request->search, function ($q, $search) {
|
||||
$q->where('code', 'LIKE', "%".$search."%");
|
||||
})
|
||||
->when($request->orderBy, function ($q, $orderBy) use ($request) {
|
||||
if (in_array($orderBy, ['submission_date', 'code'])) {
|
||||
$q->orderBy($orderBy, $request->order);
|
||||
}
|
||||
})
|
||||
->when($request->status, function($q, $status) {
|
||||
$q->where('status', $status);
|
||||
})
|
||||
->with(['member'])
|
||||
->paginate();
|
||||
|
||||
return Helper::responseJson($claimRequests);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('hospitalportal::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
* @return Renderable
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
// 'submission_date' => 'required',
|
||||
'member_id' => 'required',
|
||||
// 'files' => ''
|
||||
]);
|
||||
|
||||
$newClaimRequest = ClaimRequest::create([
|
||||
'member_id' => $request->member_id,
|
||||
'submission_date' => now(),
|
||||
'status' => 'requested'
|
||||
]);
|
||||
|
||||
if ($request->hasFile('result_files')) {
|
||||
foreach ($request->result_files as $file) {
|
||||
$pathFile = File::storeFile('claim', $newClaimRequest->id, $file);
|
||||
$newClaimRequest->files()->updateOrCreate([
|
||||
'type' => 'result',
|
||||
'name' => File::getFileName('claim', $newClaimRequest->id, $file),
|
||||
'original_name' => $file->getClientOriginalName(),
|
||||
'extension' => $file->getClientOriginalExtension(),
|
||||
'path' => $pathFile,
|
||||
'created_by' => auth()->user()->id,
|
||||
'updated_by' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
return ($request->result_files[0]->getClientOriginalName());
|
||||
|
||||
return Helper::responseJson(data: $request->toArray(), message: 'Claim Request berhasil ajukan!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('hospitalportal::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('hospitalportal::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)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function generateLog($claim_request_id)
|
||||
{
|
||||
$claimRequest = ClaimRequest::findOrFail($claim_request_id);
|
||||
|
||||
if ($claimRequest->status != 'approved') {
|
||||
throw new Exception("Belum Teverifikasi", 1);
|
||||
}
|
||||
|
||||
$member = Member::findOrFail($claimRequest->member_id)
|
||||
->load(['currentPlan', 'currentPolicy', 'currentPlan.corporateBenefits', 'currentPlan.corporateBenefits.benefit']);
|
||||
|
||||
$pdf = PDF::loadView('pdf.guaranted_leter', compact('member', 'claimRequest'));
|
||||
return $pdf->download('Guaranted Letter - '.$member->full_name.'.pdf');
|
||||
|
||||
return $claimRequest;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\HospitalPortal\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Member;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class MemberController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function search(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'no_polis' => 'required',
|
||||
'birth_date' => 'required'
|
||||
]);
|
||||
|
||||
$member = Member::query()
|
||||
->where('member_id', $request->no_polis)
|
||||
->where('birth_date', $request->birth_date)
|
||||
->with(['person', 'currentCorporate',
|
||||
// 'currentCorporate.corporateServices' => function ($corporateService) {
|
||||
// $corporateService->where('status', 'active');
|
||||
// },
|
||||
// 'currentCorporate.corporateServices.service'
|
||||
// 'currentPlan.benefits',
|
||||
// 'currentPlan.corporateBenefit.plan',
|
||||
'currentPlan.corporateBenefits.benefit'
|
||||
])
|
||||
->firstOrFail();
|
||||
|
||||
|
||||
return Helper::responseJson($member);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
namespace Modules\HospitalPortal\Http\Controllers;
|
||||
|
||||
use App\Models\Province;
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Claim;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class ProvinceController extends Controller
|
||||
class ClaimController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index()
|
||||
{
|
||||
$province = Province::orderBy('name', 'ASC')->get();
|
||||
$claims = Claim::where('deleted_at', 'ASD')->paginate(5);
|
||||
|
||||
if (empty($province)) {
|
||||
return response(['message' => 'Tidak ada data'], 404);
|
||||
} else {
|
||||
return response(['message' => 'Data ditemukan', 'data' => $province]);
|
||||
}
|
||||
return Helper::responseJson($claims);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +27,7 @@ class ProvinceController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('internal::create');
|
||||
return view('hospitalportal::create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +47,7 @@ class ProvinceController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('internal::show');
|
||||
return view('hospitalportal::show');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +57,7 @@ class ProvinceController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('internal::edit');
|
||||
return view('hospitalportal::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,27 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
namespace Modules\HospitalPortal\Http\Controllers;
|
||||
|
||||
use App\Models\City;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class CityController extends Controller
|
||||
class HospitalPortalController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index()
|
||||
{
|
||||
$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]);
|
||||
}
|
||||
return view('hospitalportal::index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +23,7 @@ class CityController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('internal::create');
|
||||
return view('hospitalportal::create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +43,7 @@ class CityController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('internal::show');
|
||||
return view('hospitalportal::show');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +53,7 @@ class CityController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('internal::edit');
|
||||
return view('hospitalportal::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
0
Modules/HospitalPortal/Http/Middleware/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Middleware/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Requests/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Requests/.gitkeep
Normal file
0
Modules/HospitalPortal/Providers/.gitkeep
Normal file
0
Modules/HospitalPortal/Providers/.gitkeep
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\HospitalPortal\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class HospitalPortalServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'HospitalPortal';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'hospitalportal';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
69
Modules/HospitalPortal/Providers/RouteServiceProvider.php
Normal file
69
Modules/HospitalPortal/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\HospitalPortal\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = 'Modules\HospitalPortal\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('HospitalPortal', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('HospitalPortal', '/Routes/api.php'));
|
||||
}
|
||||
}
|
||||
0
Modules/HospitalPortal/Resources/assets/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/assets/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/assets/js/app.js
Normal file
0
Modules/HospitalPortal/Resources/assets/js/app.js
Normal file
0
Modules/HospitalPortal/Resources/lang/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/lang/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/views/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/views/.gitkeep
Normal file
9
Modules/HospitalPortal/Resources/views/index.blade.php
Normal file
9
Modules/HospitalPortal/Resources/views/index.blade.php
Normal file
@@ -0,0 +1,9 @@
|
||||
@extends('hospitalportal::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>
|
||||
This view is loaded from module: {!! config('hospitalportal.name') !!}
|
||||
</p>
|
||||
@endsection
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Module HospitalPortal</title>
|
||||
|
||||
{{-- Laravel Mix - CSS File --}}
|
||||
{{-- <link rel="stylesheet" href="{{ mix('css/hospitalportal.css') }}"> --}}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Laravel Mix - JS File --}}
|
||||
{{-- <script src="{{ mix('js/hospitalportal.js') }}"></script> --}}
|
||||
</body>
|
||||
</html>
|
||||
0
Modules/HospitalPortal/Routes/.gitkeep
Normal file
0
Modules/HospitalPortal/Routes/.gitkeep
Normal file
43
Modules/HospitalPortal/Routes/api.php
Normal file
43
Modules/HospitalPortal/Routes/api.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\HospitalPortal\Http\Controllers\Api\AuthController;
|
||||
use Modules\HospitalPortal\Http\Controllers\Api\ClaimRequestController;
|
||||
use Modules\HospitalPortal\Http\Controllers\Api\MemberController;
|
||||
use Modules\HospitalPortal\Http\Controllers\ClaimController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::prefix('hospitalportal')->group(function () {
|
||||
|
||||
Route::post('login', [AuthController::class, 'login'])->name('login');
|
||||
Route::post('forget-password', [AuthController::class, 'forgetPassword'])->name('forget-password');
|
||||
Route::post('verify-email', [AuthController::class, 'verifyEmail'])->name('verify-email');
|
||||
|
||||
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
|
||||
Route::post('logout', [AuthController::class, 'logout'])->name('logout');
|
||||
Route::get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
Route::put('reset-password', [AuthController::class, 'resetPassword'])->name('resetPassword');
|
||||
|
||||
Route::get('claims', [ClaimController::class, 'index']);
|
||||
|
||||
Route::post('search-member', [MemberController::class, 'search']);
|
||||
|
||||
Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
|
||||
Route::post('claim-requests', [ClaimRequestController::class, 'store'])->name('claim-requests.store');
|
||||
Route::get('claim-requests/{claim_request_id}/log', [ClaimRequestController::class, 'generateLog'])->name('claim-requests.generate-log');
|
||||
});
|
||||
});
|
||||
16
Modules/HospitalPortal/Routes/web.php
Normal file
16
Modules/HospitalPortal/Routes/web.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::prefix('hospitalportal')->group(function() {
|
||||
Route::get('/', 'HospitalPortalController@index');
|
||||
});
|
||||
0
Modules/HospitalPortal/Tests/Feature/.gitkeep
Normal file
0
Modules/HospitalPortal/Tests/Feature/.gitkeep
Normal file
0
Modules/HospitalPortal/Tests/Unit/.gitkeep
Normal file
0
Modules/HospitalPortal/Tests/Unit/.gitkeep
Normal file
23
Modules/HospitalPortal/composer.json
Normal file
23
Modules/HospitalPortal/composer.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "nwidart/hospitalportal",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\HospitalPortal\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Modules/HospitalPortal/module.json
Normal file
13
Modules/HospitalPortal/module.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "HospitalPortal",
|
||||
"alias": "hospitalportal",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\HospitalPortal\\Providers\\HospitalPortalServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
||||
21
Modules/HospitalPortal/package.json
Normal file
21
Modules/HospitalPortal/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "mix",
|
||||
"watch": "mix watch",
|
||||
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||
"hot": "mix watch --hot",
|
||||
"prod": "npm run production",
|
||||
"production": "mix --production"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.4",
|
||||
"dotenv": "^10.0.0",
|
||||
"dotenv-expand": "^5.1.0",
|
||||
"laravel-mix": "^6.0.31",
|
||||
"laravel-mix-merge-manifest": "^2.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"postcss": "^8.3.7"
|
||||
}
|
||||
}
|
||||
14
Modules/HospitalPortal/webpack.mix.js
Normal file
14
Modules/HospitalPortal/webpack.mix.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const dotenvExpand = require('dotenv-expand');
|
||||
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||
|
||||
const mix = require('laravel-mix');
|
||||
require('laravel-mix-merge-manifest');
|
||||
|
||||
mix.setPublicPath('../../public').mergeManifest();
|
||||
|
||||
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/hospitalportal.js')
|
||||
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/hospitalportal.css');
|
||||
|
||||
if (mix.inProduction()) {
|
||||
mix.version();
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
<?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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
113
Modules/Internal/Http/Controllers/Api/ClaimRequestController.php
Normal file
113
Modules/Internal/Http/Controllers/Api/ClaimRequestController.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\ClaimRequest;
|
||||
use App\Models\Member;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Knp\Snappy\Pdf;
|
||||
use Modules\Internal\Transformers\ClaimRequestResource;
|
||||
|
||||
class ClaimRequestController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$claimRequests = ClaimRequest::query()
|
||||
->when($request->search, function ($q, $search) {
|
||||
$q->where('code', 'LIKE', "%".$search."%");
|
||||
})
|
||||
->when($request->orderBy, function ($q, $orderBy) use ($request) {
|
||||
if (in_array($orderBy, ['submission_date', 'code'])) {
|
||||
$q->orderBy($orderBy, $request->order);
|
||||
}
|
||||
})
|
||||
->when(empty($request->orderBy), function ($q) {
|
||||
$q->orderBy('created_at', 'desc');
|
||||
})
|
||||
->when($request->status, function($q, $status) {
|
||||
$q->where('status', $status);
|
||||
})
|
||||
->with(['member', 'files'])
|
||||
->paginate();
|
||||
|
||||
return Helper::paginateResources(ClaimRequestResource::collection($claimRequests));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function approve($id)
|
||||
{
|
||||
$claimRequest = ClaimRequest::findOrFail($id);
|
||||
|
||||
$claimRequest->status = 'approved';
|
||||
$claimRequest->save();
|
||||
|
||||
return $claimRequest;
|
||||
}
|
||||
}
|
||||
@@ -234,17 +234,9 @@ class CorporateMemberController extends Controller
|
||||
public function generateLog($member_id)
|
||||
{
|
||||
$member = Member::findOrFail($member_id)
|
||||
->load([
|
||||
'currentPlan',
|
||||
'currentPolicy',
|
||||
'currentPlan.corporateBenefits' => function ($benefit) use ($request) {
|
||||
return $benefit->when($request->benefit_ids, function ($q, $ids) {
|
||||
return $q->whereIn('benefit_id', $ids);
|
||||
});
|
||||
},
|
||||
'currentPlan.corporateBenefits.benefit']);
|
||||
->load(['currentPlan', 'currentPolicy', 'currentPlan.corporateBenefits', 'currentPlan.corporateBenefits.benefit']);
|
||||
|
||||
$dateOfAdmission = $request->date_of_admission ? Carbon::parse($request->date_of_admission) : now();
|
||||
// dd($member->currentPlan->corporateBenefits->toArray());
|
||||
|
||||
// return view('pdf.guaranted_leter', compact('member'));
|
||||
$pdf = PDF::loadView('pdf.guaranted_leter', compact('member'));
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<?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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
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;
|
||||
@@ -19,6 +18,12 @@ 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) {
|
||||
@@ -26,9 +31,6 @@ 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);
|
||||
@@ -63,58 +65,7 @@ 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',
|
||||
]);
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,8 +75,7 @@ class DoctorController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$practitioner = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')->find($id);
|
||||
return response()->json(DoctorResource::make($practitioner));
|
||||
return view('internal::show');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,8 +85,7 @@ class DoctorController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$practitioner = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')->find($id);
|
||||
return response()->json(DoctorResource::make($practitioner));
|
||||
return view('internal::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,81 +96,7 @@ 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',
|
||||
]);
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,14 +106,6 @@ 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',
|
||||
]);
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
<?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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -47,44 +47,7 @@ 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)
|
||||
]);
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +57,7 @@ class OrganizationController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return response()->json(OrganizationResource::make(Organization::find($id)));
|
||||
return view('internal::show');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +67,7 @@ class OrganizationController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return response()->json(OrganizationResource::make(Organization::find($id)));
|
||||
return view('internal::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,46 +78,7 @@ 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)
|
||||
]);
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,12 +88,6 @@ 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)
|
||||
]);
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<?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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -3,10 +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\ClaimRequestController;
|
||||
use Modules\Internal\Http\Controllers\Api\CorporateBenefitController;
|
||||
use Modules\Internal\Http\Controllers\Api\CorporateController;
|
||||
use Modules\Internal\Http\Controllers\Api\CorporateFormulariumController;
|
||||
@@ -15,18 +14,14 @@ 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;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -125,17 +120,16 @@ 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::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::get('province', [ProvinceController::class, 'index']);
|
||||
Route::get('city', [CityController::class, 'index']);
|
||||
Route::get('district', [DistrictController::class, 'index']);
|
||||
Route::get('village', [VillageController::class, 'index']);
|
||||
// Route::resource('organizations', OrganizationController::class);
|
||||
// Route::resource('doctors', DoctorController::class);
|
||||
|
||||
// Route::get('something', [DiagnosisExclusionController::class, 'index']);
|
||||
});
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
33
Modules/Internal/Transformers/ClaimRequestResource.php
Normal file
33
Modules/Internal/Transformers/ClaimRequestResource.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ClaimRequestResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$filesGroupByType = $this->files->mapToGroups(function($file) {
|
||||
return [$file->type => $file];
|
||||
});
|
||||
|
||||
$data = [
|
||||
'id' => $this->id,
|
||||
'code' => $this->code,
|
||||
'submission_date' => $this->submission_date,
|
||||
'member' => $this->member,
|
||||
'status' => $this->status ?? 'unknown',
|
||||
'service_type' => $this->service_type,
|
||||
'files_by_type' => $filesGroupByType
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ namespace Modules\Internal\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
use function PHPSTORM_META\map;
|
||||
|
||||
class DoctorResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
@@ -21,51 +19,35 @@ class DoctorResource extends JsonResource
|
||||
// 'his_dokter_id' => $this->practitionerRoles->meta,
|
||||
'name' => $this->person->name,
|
||||
'person_id' => $this->person->id,
|
||||
'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,
|
||||
'phone' => $this->person->phone,
|
||||
'email' => $this->person->email,
|
||||
'gender' => $this->person->gender == "L" ? 'Laki-laki' : 'Perempuan',
|
||||
'address' => $this->person->currentAddress->text,
|
||||
'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 ?? 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,
|
||||
"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,
|
||||
|
||||
];
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -14,24 +14,17 @@ 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->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,
|
||||
'address' => $this->currentAddress ?? null,
|
||||
];
|
||||
|
||||
return $organization;
|
||||
|
||||
@@ -4,10 +4,7 @@ namespace App\Http\Controllers\Api\OLDLMS;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\OLDLMS\MemberResource;
|
||||
use App\Models\Corporate;
|
||||
use App\Models\Member;
|
||||
use App\Rules\NikRule;
|
||||
use App\Services\ClaimService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -172,91 +169,4 @@ class MembershipController extends Controller
|
||||
|
||||
return Helper::responseJson(data: $limits);
|
||||
}
|
||||
|
||||
public function linkingRules(Request $request)
|
||||
{
|
||||
$corporates = Corporate::query()
|
||||
->when($request->search, function ($q, $search) {
|
||||
$q->where('name', 'LIKE', '%'.$search.'%');
|
||||
})
|
||||
->get();
|
||||
|
||||
return Helper::responseJson(data: $corporates);
|
||||
}
|
||||
|
||||
public function linkingValidate(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'corporate_id' => 'required'
|
||||
]);
|
||||
|
||||
$corporate = Corporate::findOrFail($request->corporate_id);
|
||||
|
||||
// Make Validation from Linking Rules
|
||||
$linkingRulesArr = $corporate->linking_rules->toArray();
|
||||
$validationRules = [];
|
||||
foreach ($linkingRulesArr as $field) {
|
||||
$rules = ['required']; // Default is required if in the linking_rules
|
||||
if ($field == 'email') {
|
||||
$rules[] = 'email';
|
||||
}
|
||||
|
||||
if ($field == 'nric') {
|
||||
$rules[] = new NikRule;
|
||||
}
|
||||
|
||||
$validationRules[$field] = $rules;
|
||||
}
|
||||
$request->validate($validationRules);
|
||||
|
||||
$member = Member::query()
|
||||
->when(in_array('nric', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('nric', $request->nric);
|
||||
})
|
||||
->when(in_array('member_id', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('member_id', $request->member_id);
|
||||
})
|
||||
->when(in_array('name', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('name', $request->name);
|
||||
})
|
||||
->when(in_array('dob', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('birth_date', $request->dob);
|
||||
})
|
||||
->when(in_array('phone', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->whereHas('person', function ($person) use ($request) {
|
||||
$person->where('phone', $request->phone);
|
||||
});
|
||||
})
|
||||
->when(in_array('email', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('email', $request->email);
|
||||
})
|
||||
->when(in_array('nik', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->whereHas('employeds', function ($employed) use ($request) {
|
||||
$employed->where('corporate_id', $request->corporate_id)
|
||||
->where('nik', $request->nik);
|
||||
});
|
||||
})
|
||||
|
||||
->with([
|
||||
'memberPlans' => function ($memberPlan) {
|
||||
$memberPlan->latest();
|
||||
},
|
||||
])
|
||||
|
||||
->first();
|
||||
|
||||
if ($member) {
|
||||
return Helper::responseJson(data: MemberResource::make($member), message: 'Data Member ditemukan!');
|
||||
}
|
||||
|
||||
return Helper::responseJson(data: [], message: 'Member Tidak ditemukan', statusCode: 404, status: 'error');
|
||||
}
|
||||
|
||||
public function show($member_id)
|
||||
{
|
||||
$member = Member::where('member_id', $member_id)->firstOrFail();
|
||||
$member->load(['currentPlan', 'memberPlans']);
|
||||
|
||||
return Helper::responseJson(data: MemberResource::make($member));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,30 +14,6 @@ class MemberResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
// $data = parent::toArray($request);
|
||||
$currentMemberPlan = $this->memberPlans?->first();
|
||||
|
||||
$data = [
|
||||
'member_id' => $this->member_id,
|
||||
'birth_date' => $this->birth_date,
|
||||
'email' => $this->email,
|
||||
'phone' => $this->person->phone ?? null,
|
||||
'full_name' => $this->full_name,
|
||||
'nric' => $this->nric,
|
||||
'plan' => $currentMemberPlan ? [
|
||||
'code' => $currentMemberPlan->plan->code ?? null,
|
||||
'start' => $currentMemberPlan->start,
|
||||
'end' => $currentMemberPlan->end
|
||||
] : null,
|
||||
'policy_code' => $this->currentPolicy->code,
|
||||
'corporate' => [
|
||||
'code' => $this->currentPolicy->corporate->code,
|
||||
'name' => $this->currentPolicy->corporate->name,
|
||||
'welcome_message' => $this->currentPolicy->corporate->welcome_message,
|
||||
'help_text' => $this->currentPolicy->corporate->help_text,
|
||||
'avatar_url' => $this->currentpolicy->corporate->avatar_url
|
||||
]
|
||||
];
|
||||
return $data;
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,15 @@ class Benefit extends Model
|
||||
'active'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"deleted_at",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"deleted_by",
|
||||
];
|
||||
|
||||
public function scopeFilter($query, array $filters)
|
||||
{
|
||||
$query->when($filters['search'] ?? false, function ($query, $search) {
|
||||
|
||||
57
app/Models/ClaimRequest.php
Normal file
57
app/Models/ClaimRequest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Blameable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ClaimRequest extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes, Blameable;
|
||||
|
||||
protected static $code_prefix = 'CRQ';
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
try {
|
||||
$model->code = self::getNextCode();
|
||||
} catch (\Exception $e) {
|
||||
abort(500, $e->getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static function getNextCode()
|
||||
{
|
||||
$last_number = self::withTrashed()->max('code');
|
||||
$next_number = empty($last_number) ? 1 : ((int) explode('-', $last_number)[1] + 1);
|
||||
|
||||
return self::makeCode($next_number);
|
||||
}
|
||||
|
||||
public static function makeCode($next_number)
|
||||
{
|
||||
return (string) self::$code_prefix .'-'. str_pad($next_number, 5, 0, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public $fillable = [
|
||||
'submission_date',
|
||||
'member_id',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
|
||||
public function member()
|
||||
{
|
||||
return $this->belongsTo(Member::class, 'member_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Blameable;
|
||||
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@@ -24,7 +23,7 @@ class Corporate extends Model
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'linking_rules' => AsArrayObject::class,
|
||||
'linking_rules' => 'array',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
|
||||
@@ -16,10 +16,20 @@ class File extends Model
|
||||
'fileable_id',
|
||||
'type',
|
||||
'name',
|
||||
'original_name',
|
||||
'extension',
|
||||
'path',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_by',
|
||||
];
|
||||
|
||||
public $appends = [
|
||||
'url'
|
||||
];
|
||||
@@ -27,7 +37,8 @@ class File extends Model
|
||||
public static $file_directories = [
|
||||
'import-temp' => 'import-temp/',
|
||||
'avatar' => 'user-avatar/',
|
||||
'dataDiri' => 'data-diri/'
|
||||
'dataDiri' => 'data-diri/',
|
||||
'claim' => 'claim/'
|
||||
];
|
||||
|
||||
public function fileable()
|
||||
@@ -45,6 +56,11 @@ class File extends Model
|
||||
return $type . '-' . $id . '-' . Str::random(10);
|
||||
}
|
||||
|
||||
public function getNameAttribute($value)
|
||||
{
|
||||
return !empty($this->original_name) ? $this->original_name : ($value . '.' . $this->extension);
|
||||
}
|
||||
|
||||
public function getUrlAttribute()
|
||||
{
|
||||
return url(Storage::url($this->path));
|
||||
|
||||
@@ -141,8 +141,7 @@ class Member extends Model
|
||||
|
||||
public function currentPlan()
|
||||
{
|
||||
return $this->hasOneThrough(Plan::class, MemberPlan::class, 'member_id', 'id', 'id', 'plan_id')
|
||||
->latest(); // TODO Fix This
|
||||
return $this->hasOneThrough(Plan::class, MemberPlan::class, 'member_id', 'id', 'id', 'plan_id')->latest();
|
||||
}
|
||||
|
||||
public function policies()
|
||||
@@ -193,12 +192,13 @@ class Member extends Model
|
||||
|
||||
public function getNameAttribute()
|
||||
{
|
||||
return $this->person->name ?? null;
|
||||
return $this->person->name ?? ($this->name ?? null);
|
||||
}
|
||||
|
||||
public function getBirthDateAttribute()
|
||||
{
|
||||
return Carbon::parse($this->person->birth_date ?? null)->format('Y-m-d') ?? null;
|
||||
$date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
return !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null;
|
||||
}
|
||||
|
||||
public function getGenderAttribute()
|
||||
|
||||
@@ -31,17 +31,4 @@ class MemberPlan extends Model
|
||||
{
|
||||
return $this->belongsTo(CorporatePlan::class, 'plan_id', 'code');
|
||||
}
|
||||
|
||||
public function plan()
|
||||
{
|
||||
return $this->belongsTo(Plan::class, 'plan_id');
|
||||
}
|
||||
|
||||
public function scopeActive($q)
|
||||
{
|
||||
return $q
|
||||
->where('start', '<', now())
|
||||
->where('end', '>', now())
|
||||
->latest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
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;
|
||||
@@ -15,99 +14,12 @@ 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';
|
||||
|
||||
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
|
||||
public function detail()
|
||||
{
|
||||
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');
|
||||
return $this->hasOne(AppointmentDetail::class, '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,19 +8,4 @@ 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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,14 +24,4 @@ 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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
@@ -2,46 +2,10 @@
|
||||
|
||||
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, 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');
|
||||
}
|
||||
use HasFactory;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,4 @@ 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';
|
||||
|
||||
}
|
||||
|
||||
@@ -114,11 +114,6 @@ 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');
|
||||
|
||||
@@ -182,7 +182,63 @@ class Plan extends Model
|
||||
return $this->belongsToMany(Benefit::class, 'corporate_benefits', 'plan_id', 'benefit_id')
|
||||
->withTimestamps()
|
||||
->withPivot([
|
||||
// TODO corporate_benefits pivot
|
||||
'corporate_id',
|
||||
'plan_id',
|
||||
'benefit_id',
|
||||
'corporate_benefit_code',
|
||||
'budget',
|
||||
'budget_conditions',
|
||||
'budget_code',
|
||||
'primary_benefit_code',
|
||||
'benefit_mode',
|
||||
'room_class_coverage',
|
||||
'max_bed_coverage',
|
||||
'tolerance_parameter',
|
||||
'max_room_class',
|
||||
'limit_amount',
|
||||
'area_limit',
|
||||
'shared_benefit',
|
||||
'shared_benefit_type',
|
||||
'msc',
|
||||
'genders',
|
||||
'min_age',
|
||||
'max_age',
|
||||
'max_frequency_period',
|
||||
'daily_frequency',
|
||||
'weekly_frequency',
|
||||
'monthly_frequency',
|
||||
'yearly_frequency',
|
||||
'custom_frequency_days',
|
||||
'custom_duration_value',
|
||||
'allowed_transaction_types',
|
||||
'high_plan_factor',
|
||||
'pre_post_treatment',
|
||||
'pre_treatment_days',
|
||||
'post_treatment_days',
|
||||
'layer_type_1',
|
||||
'layer_value_1',
|
||||
'layer_type_2',
|
||||
'layer_value_2',
|
||||
'cashless_percentage',
|
||||
'reimbursement_percentage',
|
||||
'digital_percentage',
|
||||
'co_share_m_percentage',
|
||||
'co_share_s_percentage',
|
||||
'co_share_c_percentage',
|
||||
'cashless_deductible',
|
||||
'reimbursement_deductible',
|
||||
'digital_deductible',
|
||||
'co_share_m_deductible',
|
||||
'co_share_s_deductible',
|
||||
'co_share_c_deductible',
|
||||
'prorate_type',
|
||||
'prorate_lookup',
|
||||
'max_days_for_disability',
|
||||
'max_period_for_disability',
|
||||
'currency',
|
||||
'show_benefit_item',
|
||||
'show_benefit_value',
|
||||
'active'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -190,4 +246,9 @@ class Plan extends Model
|
||||
{
|
||||
return $this->hasMany(CorporateBenefit::class, 'plan_id', 'id');
|
||||
}
|
||||
|
||||
public function service()
|
||||
{
|
||||
return $this->belongsTo(Service::class, 'service_code', 'code');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,9 @@ class Service extends Model
|
||||
'name',
|
||||
'description',
|
||||
];
|
||||
|
||||
public function corporateService()
|
||||
{
|
||||
return $this->hasMany(CorporateService::class, 'service_code', 'code');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
use HasApiTokens, HasFactory, Notifiable, HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Rules\NikRule;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Str;
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class NikRule implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
// The NIK is a 16-digit number
|
||||
if (!preg_match('/^[0-9]{16}$/', $value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// // The first 6 digits represent the person's birth date in the format of YYMMDD
|
||||
// $year = substr($value, 6, 2);
|
||||
// $month = substr($value, 8, 2);
|
||||
// $day = substr($value, 10, 2);
|
||||
|
||||
// // dd($year, $month, $day);
|
||||
// // dd(checkdate($month, $day, "19{$year}"));
|
||||
|
||||
// if (!checkdate($month, $day, "19{$year}")) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// // The next 2 digits represent the place of birth (province/city code)
|
||||
// $provinceCode = substr($value, 6, 2);
|
||||
|
||||
// // The next 2 digits represent the person's gender (odd for male, even for female)
|
||||
// $genderCode = substr($value, 14, 1);
|
||||
|
||||
// // The last 4 digits represent the sequence number of the person's birth in that day
|
||||
// $sequenceNumber = substr($value, 12, 4);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return ':attribute bukan valid NIK Indonesia.';
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,8 @@
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"nwidart/laravel-modules": "^9.0",
|
||||
"psr/simple-cache": "^1.0",
|
||||
"pusher/pusher-php-server": "^7.2"
|
||||
"pusher/pusher-php-server": "^7.2",
|
||||
"spatie/laravel-permission": "^5.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.7",
|
||||
|
||||
1092
composer.lock
generated
Executable file → Normal file
1092
composer.lock
generated
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -188,6 +188,7 @@ return [
|
||||
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
|
||||
Maatwebsite\Excel\ExcelServiceProvider::class,
|
||||
Barryvdh\Snappy\ServiceProvider::class,
|
||||
Spatie\Permission\PermissionServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
|
||||
161
config/permission.php
Normal file
161
config/permission.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Spatie\Permission\Models\Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Spatie\Permission\Models\Role::class,
|
||||
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, //default 'role_id',
|
||||
'permission_pivot_key' => null, //default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false, if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true the package implements teams using the 'team_foreign_key'. If you want
|
||||
* the migrations to register the 'team_foreign_key', you must set this to true
|
||||
* before doing the migration. If you already did the migration then you must make a new
|
||||
* migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
|
||||
* 'model_has_permissions'(view the latest version of package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('claim_requests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code')->index();
|
||||
$table->dateTime('submission_date')->nullable();
|
||||
$table->foreignId('member_id');
|
||||
$table->string('status')->nullable();
|
||||
$table->foreignId('claim_id')->nullable()->comment('After Claim is Created');
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->unsignedBigInteger('created_by')->nullable()->index();
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->index();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable()->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('claim_requests');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
|
||||
class CreatePermissionTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$teams = config('permission.teams');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('files', function (Blueprint $table) {
|
||||
$table->string('original_name')->nullable()->after('name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('files', function (Blueprint $table) {
|
||||
$table->dropColumn('original_name');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -17,18 +17,23 @@ class DummyMemberSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$userEmails = [
|
||||
'admin@linksehat.dev',
|
||||
'manager+one@gmail.com',
|
||||
'manager+two@gmail.com'
|
||||
'admin@linksehat.dev' => ['administrator'],
|
||||
'manager+one@gmail.com' => ['corporate-manager'],
|
||||
'manager+two@gmail.com' => ['corporate-manager'],
|
||||
'hospitaladmin@gmail.com' => ['hospital-admin']
|
||||
];
|
||||
|
||||
foreach ($userEmails as $email) {
|
||||
User::updateOrCreate([
|
||||
foreach ($userEmails as $email => $roles) {
|
||||
$user = User::updateOrCreate([
|
||||
'email' => $email
|
||||
], [
|
||||
'email' => $email,
|
||||
'password' => Hash::make('password')
|
||||
]);
|
||||
|
||||
if (isset($roles) && count($roles)) {
|
||||
$user->syncRoles($roles);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
30
database/seeders/RoleSeeder.php
Normal file
30
database/seeders/RoleSeeder.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$roles = [
|
||||
'administrator',
|
||||
'corporate-manager',
|
||||
'hospital-admin'
|
||||
];
|
||||
|
||||
foreach ($roles as $name) {
|
||||
Role::create([
|
||||
'name' => $name
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
GENERATE_SOURCEMAP=false
|
||||
|
||||
PORT=8083
|
||||
|
||||
REACT_APP_HOST_API_URL="http://localhost:8000"
|
||||
|
||||
VITE_API_URL="http://localhost:8000/api/internal"
|
||||
@@ -58,6 +58,13 @@ const navConfig = [
|
||||
{ title: 'Hospitals', path: '/hospitals' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'LOG REQUEST',
|
||||
path: '/claim-requests',
|
||||
// children: [
|
||||
// { title: 'Request', path: '/case-request' },
|
||||
// ],
|
||||
},
|
||||
{
|
||||
title: 'CASE MANAGEMENT',
|
||||
path: '/claims',
|
||||
@@ -69,13 +76,6 @@ 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',
|
||||
|
||||
64
frontend/dashboard/src/pages/ClaimRequests/CreateUpdate.tsx
Executable file
64
frontend/dashboard/src/pages/ClaimRequests/CreateUpdate.tsx
Executable file
@@ -0,0 +1,64 @@
|
||||
import * as Yup from 'yup';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { Autocomplete, Button, Card, Collapse, Container, Divider, Grid, Stack, Table, TableBody, TableCell, TableRow, TextField, Typography } from '@mui/material';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs';
|
||||
import { FormProvider, RHFCheckbox, RHFSelect, RHFTextField } from '../../components/hook-form';
|
||||
import Page from '../../components/Page';
|
||||
import useSettings from '../../hooks/useSettings';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import MemberSelectDialog from '../../components/dialogs/MemberSelectDialog';
|
||||
import { styled } from '@mui/system';
|
||||
import axios from '../../utils/axios';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import { fCurrency } from '../../utils/formatNumber';
|
||||
import Iconify from '../../components/Iconify';
|
||||
import Form from './Form';
|
||||
|
||||
export default function ClaimsCreateUpdate() {
|
||||
|
||||
const { themeStretch } = useSettings();
|
||||
const { id } = useParams();
|
||||
|
||||
const isEdit = id ? true : false;
|
||||
|
||||
const [currentClaim, setCurrentClaim] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
if (isEdit) {
|
||||
axios.get('/claims/' + id).then((res) => {
|
||||
// console.log('Yeet', res.data);
|
||||
setCurrentClaim(res.data);
|
||||
});
|
||||
}
|
||||
}, [id]);
|
||||
|
||||
|
||||
return (
|
||||
<Page title={isEdit ? `Edit Claim : ${currentClaim?.id}` : "Create New Claim"}>
|
||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||
<Stack direction="row" alignItems="center">
|
||||
<HeaderBreadcrumbs
|
||||
heading={
|
||||
!isEdit
|
||||
? 'Create New Claim'
|
||||
: `Edit Claim : ${currentClaim?.code}`
|
||||
}
|
||||
links={[
|
||||
{ name: 'Dashboard', href: '/dashboard' },
|
||||
{
|
||||
name: 'Claim',
|
||||
href: '/claims',
|
||||
},
|
||||
{ name: !isEdit ? 'Create' : currentClaim?.id ?? '' },
|
||||
]}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
<Form isEdit={isEdit} currentClaim={currentClaim} />
|
||||
</Container>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
596
frontend/dashboard/src/pages/ClaimRequests/Form.tsx
Normal file
596
frontend/dashboard/src/pages/ClaimRequests/Form.tsx
Normal file
@@ -0,0 +1,596 @@
|
||||
import * as Yup from 'yup';
|
||||
import { useSnackbar } from 'notistack';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import axios from '../../utils/axios';
|
||||
import { FormProvider, RHFTextField } from '../../components/hook-form';
|
||||
import {
|
||||
Autocomplete,
|
||||
Button,
|
||||
Grid,
|
||||
Stack,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableRow,
|
||||
TextField,
|
||||
Typography,
|
||||
useTheme,
|
||||
List,
|
||||
ListItem,
|
||||
IconButton,
|
||||
ListItemAvatar,
|
||||
Avatar,
|
||||
ListItemText,
|
||||
} from '@mui/material';
|
||||
import Iconify from '../../components/Iconify';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import { fCurrency } from '../../utils/formatNumber';
|
||||
import MemberSelectDialog from '../../components/dialogs/MemberSelectDialog';
|
||||
import { Add, DeleteOutline } from '@mui/icons-material';
|
||||
|
||||
type Props = {
|
||||
isEdit: boolean;
|
||||
currentClaim?: any;
|
||||
};
|
||||
|
||||
export default function ClaimForm({ isEdit, currentClaim }: Props) {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
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'),
|
||||
// file: Yup.boolean().required('Corporate Status is required'),
|
||||
});
|
||||
|
||||
const defaultValues = useMemo(
|
||||
() => ({
|
||||
member: currentClaim?.member || {},
|
||||
member_id: currentClaim?.member_id || null,
|
||||
diagnosis_id: currentClaim?.diagnosis_id || null,
|
||||
total_claim: currentClaim?.total_claim || 0,
|
||||
}),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[currentClaim]
|
||||
);
|
||||
|
||||
const methods = useForm<any>({
|
||||
resolver: yupResolver(NewCorporateSchema),
|
||||
defaultValues,
|
||||
});
|
||||
const {
|
||||
reset,
|
||||
watch,
|
||||
control,
|
||||
setValue,
|
||||
getValues,
|
||||
setError,
|
||||
handleSubmit,
|
||||
formState: { isSubmitting },
|
||||
} = methods;
|
||||
|
||||
const values = watch();
|
||||
|
||||
const [isCheckingLimit, setIsCheckingLimit] = useState(false);
|
||||
const [isEligible, setIsEligible] = useState(false);
|
||||
const [memberBenefits, setMemberBenefits] = useState([]);
|
||||
const [diagnosisOption, setDiagnosisOption] = useState([]);
|
||||
const [isMemberDialogOpen, setIsMemberDialogOpen] = useState(false);
|
||||
const [member, setMember] = useState({})
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log('defaultValues', defaultValues);
|
||||
if (isEdit && currentClaim) {
|
||||
reset(defaultValues);
|
||||
setMember(defaultValues.member)
|
||||
}
|
||||
if (!isEdit) {
|
||||
reset(defaultValues);
|
||||
setMember(defaultValues.member)
|
||||
}
|
||||
}, [isEdit, currentClaim]);
|
||||
|
||||
const fileSelected = (event, type) => {
|
||||
const files = event.target.files;
|
||||
const currentFiles = getValues(`uploaded_files.${type}`) ?? [];
|
||||
|
||||
setValue(`uploaded_files.${type}`, [...currentFiles, ...files]);
|
||||
|
||||
console.log('currentFiles', getValues('uploaded_files'));
|
||||
};
|
||||
|
||||
const memberSelected = (member) => {
|
||||
setMember(member)
|
||||
};
|
||||
|
||||
const checkLimit = async () => {
|
||||
console.log('CHECKING LIMIT');
|
||||
};
|
||||
|
||||
const onSubmit = async (data: any) => {
|
||||
try {
|
||||
if (!isEdit) {
|
||||
const response = await axios.post('/claims', data);
|
||||
} else {
|
||||
const response = await axios.put('/claims/' + currentClaim?.id ?? '', data);
|
||||
}
|
||||
reset();
|
||||
enqueueSnackbar(
|
||||
!isEdit ? 'Organizations Created Successfully!' : 'Organizations Udpated Successfully!',
|
||||
{ variant: 'success' }
|
||||
);
|
||||
navigate('/claims');
|
||||
} catch (error: any) {
|
||||
if (error && error.response.status === 422) {
|
||||
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 ascent = document?.querySelector('ascent');
|
||||
if (ascent != null) {
|
||||
ascent.innerHTML = '';
|
||||
}
|
||||
};
|
||||
|
||||
function generate(files, element: React.ReactElement) {
|
||||
return files.map((value) =>
|
||||
React.cloneElement(element, {
|
||||
key: value,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const headStyle = {};
|
||||
return (
|
||||
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||
<Stack spacing={3}>
|
||||
<Typography variant="h6">Member</Typography>
|
||||
|
||||
<Stack spacing={2} direction="row">
|
||||
<Grid item xs={12}>
|
||||
<RHFTextField
|
||||
name="member_id"
|
||||
label="Member"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
value={member?.name || ''}
|
||||
InputProps={{
|
||||
readOnly: true,
|
||||
}}
|
||||
onClick={() => {
|
||||
if (!isEdit) setIsMemberDialogOpen(true);
|
||||
if (isEdit) enqueueSnackbar('Cannot Change Member', { variant: 'error' });
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
{/* <Grid item xs={2}>
|
||||
<Button variant="outlined" fullWidth sx={{ p: 1.8 }} onClick={() => {
|
||||
setIsMemberDialogOpen(true)
|
||||
}}>
|
||||
{member ? 'Change' : 'Search'}
|
||||
</Button>
|
||||
</Grid> */}
|
||||
</Stack>
|
||||
|
||||
{member?.id && (
|
||||
<Stack>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12} md={6}>
|
||||
<Table border="light-700">
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Name
|
||||
</TableCell>
|
||||
<TableCell align="left">{member?.full_name}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
DOB
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{member?.birth_date} ({member?.age + ' years'})
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Marital Status
|
||||
</TableCell>
|
||||
<TableCell align="left">{member?.marital_status}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Record Type
|
||||
</TableCell>
|
||||
<TableCell align="left">{member?.record_type}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Principal ID
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{member?.principal_id} (
|
||||
{member?.relation_with_principal})
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Grid>
|
||||
<Grid item xs={12} md={6}>
|
||||
<Table border="light-700">
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Plan
|
||||
</TableCell>
|
||||
<TableCell align="left">{member?.current_plan?.code}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Active
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{member?.current_plan?.start} -{' '}
|
||||
{member?.current_plan?.end} (Active)
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Corporate Limit
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{fCurrency(0)} / {fCurrency(member?.current_plan?.limit_rules)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Plan Usage
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{fCurrency(0)} / {fCurrency(member?.current_plan?.limit_rules)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
<Controller
|
||||
name="benefit"
|
||||
control={control}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<Autocomplete
|
||||
options={memberBenefits}
|
||||
getOptionLabel={(option) =>
|
||||
option ? `#${option.id} (${option.code}) ${option.description}` : ''
|
||||
}
|
||||
value={value || ''}
|
||||
onChange={(event: any, newValue: any) => {
|
||||
setValue('benefit_id', newValue?.id);
|
||||
onChange(newValue);
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
name="benefit"
|
||||
{...params}
|
||||
label="Benefit"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
// onKeyPress={(event) => {
|
||||
// if (event.key === 'Enter')
|
||||
// searchDiagnosis(event.target.value)
|
||||
// }}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="diagnosis"
|
||||
control={control}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<Autocomplete
|
||||
options={diagnosisOption}
|
||||
getOptionLabel={(option) => (option ? `(${option.code}) ${option.name}` : '')}
|
||||
value={value || ''}
|
||||
onChange={(event: any, newValue: any) => {
|
||||
setValue('diagnosis_id', newValue?.id);
|
||||
// setValue('diagnosis', newValue)
|
||||
onChange(newValue);
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
name="diagnosis"
|
||||
{...params}
|
||||
label="Diagnosis"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
onKeyPress={(event) => {
|
||||
if (event.key === 'Enter') searchDiagnosis(event.target.value);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
{isCheckingLimit && (
|
||||
<Stack
|
||||
sx={{
|
||||
backgroundColor: 'gray',
|
||||
paddingY: 1,
|
||||
paddingX: 1.5,
|
||||
mb: 2,
|
||||
borderRadius: '3-xl',
|
||||
}}
|
||||
>
|
||||
{/* Checking */}
|
||||
<Typography sx={{ typography: 'caption', display: 'flex', alignItems: 'center' }}>
|
||||
<Iconify
|
||||
icon="bxs:info-circle"
|
||||
width={12}
|
||||
height={13}
|
||||
sx={{ color: '#424242', marginRight: '6px' }}
|
||||
/>
|
||||
<Typography variant="caption" component="span">
|
||||
Please Wait, Checking Eligibilty
|
||||
</Typography>
|
||||
</Typography>
|
||||
</Stack>
|
||||
)}
|
||||
{false && isCheckingLimit == false && isEligible == null && (
|
||||
<Stack
|
||||
sx={{
|
||||
backgroundColor: 'gray',
|
||||
paddingY: 1,
|
||||
paddingX: 1.5,
|
||||
mb: 2,
|
||||
borderRadius: '3-xl',
|
||||
}}
|
||||
>
|
||||
{/* No Data Selected */}
|
||||
<Typography sx={{ typography: 'caption', display: 'flex', alignItems: 'center' }}>
|
||||
<Iconify
|
||||
icon="bxs:info-circle"
|
||||
width={12}
|
||||
height={13}
|
||||
sx={{ color: '#424242', marginRight: '6px' }}
|
||||
/>
|
||||
<Typography variant="caption" component="span">
|
||||
Please Select Diagnosis !
|
||||
</Typography>
|
||||
</Typography>
|
||||
</Stack>
|
||||
)}
|
||||
{!isCheckingLimit && isEligible !== null && isEligible && (
|
||||
<Stack
|
||||
sx={{
|
||||
backgroundColor: '#B2E8E8',
|
||||
paddingY: 1,
|
||||
paddingX: 1.5,
|
||||
mb: 2,
|
||||
borderRadius: '3-xl',
|
||||
}}
|
||||
>
|
||||
{/* Eligible */}
|
||||
<Typography sx={{ typography: 'caption', display: 'flex', alignItems: 'center' }}>
|
||||
<Iconify
|
||||
icon="bxs:lock-alt"
|
||||
width={12}
|
||||
height={13}
|
||||
sx={{ color: '#424242', marginRight: '6px' }}
|
||||
/>
|
||||
<Typography variant="caption" component="span">
|
||||
Diagnosis is Eligible
|
||||
</Typography>
|
||||
</Typography>
|
||||
<Typography sx={{ typography: 'caption', color: '#637381' }}>
|
||||
125.000.000 / 125.000.000
|
||||
</Typography>
|
||||
</Stack>
|
||||
)}
|
||||
{!isCheckingLimit && isEligible !== null && !isEligible && (
|
||||
<Stack
|
||||
sx={{
|
||||
backgroundColor: '#B2E8E8',
|
||||
paddingY: 1,
|
||||
paddingX: 1.5,
|
||||
mb: 2,
|
||||
borderRadius: '3-xl',
|
||||
}}
|
||||
>
|
||||
{/* Not Eligible */}
|
||||
{/* <Typography sx={{ typography: 'caption', display: 'flex', alignItems: 'center' }}>
|
||||
<Iconify
|
||||
icon="bxs:lock-alt"
|
||||
width={12}
|
||||
height={13}
|
||||
sx={{ color: '#424242', marginRight: '6px' }}
|
||||
/>
|
||||
<Typography variant="caption" component="span">
|
||||
Not Eligible
|
||||
</Typography>
|
||||
</Typography>
|
||||
<Typography sx={{ typography: 'caption', color: '#637381' }}>
|
||||
125.000.000 / 125.000.000
|
||||
</Typography> */}
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
<RHFTextField type="number" name="total_claim" label="Total Claim" />
|
||||
|
||||
{isEdit && (
|
||||
<React.Fragment>
|
||||
<Typography variant="h6">Documents</Typography>
|
||||
|
||||
<List>
|
||||
{(getValues('uploaded_files.invoice') && getValues('uploaded_files.invoice').length
|
||||
? getValues('uploaded_files.invoice')
|
||||
: []
|
||||
).map((file, index) => (
|
||||
<ListItem
|
||||
secondaryAction={
|
||||
<IconButton edge="end" aria-label="delete">
|
||||
<DeleteOutline />
|
||||
</IconButton>
|
||||
}
|
||||
>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
{/* <FileIcon /> */}
|
||||
I
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary={file.name} secondary={file.type} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<Add />}
|
||||
component="label"
|
||||
sx={{ paddingY: 2, width: '100%', ':hover': { border: 'none' } }}
|
||||
>
|
||||
Invoice
|
||||
<input
|
||||
name="invoice"
|
||||
hidden
|
||||
accept="image/*,application/pdf"
|
||||
multiple
|
||||
type="file"
|
||||
onChange={(event) => {
|
||||
fileSelected(event, 'invoice');
|
||||
}}
|
||||
/>
|
||||
</Button>
|
||||
<List>
|
||||
{(getValues('uploaded_files.prescription') && getValues('uploaded_files.prescription').length
|
||||
? getValues('uploaded_files.prescription')
|
||||
: []
|
||||
).map((file, index) => (
|
||||
<ListItem
|
||||
secondaryAction={
|
||||
<IconButton edge="end" aria-label="delete">
|
||||
<DeleteOutline />
|
||||
</IconButton>
|
||||
}
|
||||
>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
{/* <FileIcon /> */}
|
||||
P
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary={file.name} secondary={file.type} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<Add />}
|
||||
component="label"
|
||||
sx={{ paddingY: 2, width: '100%', ':hover': { border: 'none' } }}
|
||||
>
|
||||
Prescription
|
||||
<input
|
||||
name="prescription"
|
||||
hidden
|
||||
accept="image/*,application/pdf"
|
||||
multiple
|
||||
type="file"
|
||||
onChange={(event) => {
|
||||
fileSelected(event, 'prescription');
|
||||
}}
|
||||
/>
|
||||
</Button>
|
||||
|
||||
<List>
|
||||
{(getValues('uploaded_files.diagnosis') && getValues('uploaded_files.diagnosis').length
|
||||
? getValues('uploaded_files.diagnosis')
|
||||
: []
|
||||
).map((file, index) => (
|
||||
<ListItem
|
||||
secondaryAction={
|
||||
<IconButton edge="end" aria-label="delete">
|
||||
<DeleteOutline />
|
||||
</IconButton>
|
||||
}
|
||||
>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
{/* <FileIcon /> */}
|
||||
DR
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary={file.name} secondary={file.type} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<Add />}
|
||||
component="label"
|
||||
sx={{ paddingY: 2, width: '100%', ':hover': { border: 'none' } }}
|
||||
>
|
||||
Doctor Result
|
||||
<input
|
||||
name="invoice"
|
||||
hidden
|
||||
accept="image/*,application/pdf"
|
||||
multiple
|
||||
type="file"
|
||||
onChange={(event) => {
|
||||
fileSelected(event, 'diagnosis');
|
||||
}}
|
||||
/>
|
||||
</Button>
|
||||
</React.Fragment>
|
||||
)}
|
||||
|
||||
{isEligible === true ? (
|
||||
<LoadingButton
|
||||
onClick={handleSubmit(onSubmit)}
|
||||
variant="contained"
|
||||
color="success"
|
||||
style={{ color: '#ffffff' }}
|
||||
size="large"
|
||||
fullWidth={true}
|
||||
loading={isCheckingLimit}
|
||||
>
|
||||
Create Claim
|
||||
</LoadingButton>
|
||||
) : (
|
||||
<LoadingButton
|
||||
onClick={checkLimit}
|
||||
variant="outlined"
|
||||
size="large"
|
||||
fullWidth={true}
|
||||
loading={isCheckingLimit}
|
||||
>
|
||||
Check Limit
|
||||
</LoadingButton>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
<MemberSelectDialog
|
||||
openDialog={isMemberDialogOpen}
|
||||
setOpenDialog={setIsMemberDialogOpen}
|
||||
onSelect={memberSelected}
|
||||
></MemberSelectDialog>
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
30
frontend/dashboard/src/pages/ClaimRequests/Index.tsx
Executable file
30
frontend/dashboard/src/pages/ClaimRequests/Index.tsx
Executable file
@@ -0,0 +1,30 @@
|
||||
import { Card, Stack } from "@mui/material";
|
||||
import HeaderBreadcrumbs from "../../components/HeaderBreadcrumbs";
|
||||
import Page from "../../components/Page";
|
||||
import List from "./List";
|
||||
|
||||
|
||||
|
||||
export default function Claims() {
|
||||
|
||||
const pageTitle = 'Claim Request';
|
||||
return (
|
||||
<Page title={ pageTitle } sx={{ mx: 2}}>
|
||||
|
||||
<HeaderBreadcrumbs
|
||||
heading={ pageTitle }
|
||||
links={[
|
||||
{ name: 'Dashboard', href: '/dashboard' },
|
||||
{
|
||||
name: 'Claim Request',
|
||||
href: '/claim-requests',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
{/* <Stack> */}
|
||||
<List />
|
||||
{/* </Stack> */}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
294
frontend/dashboard/src/pages/ClaimRequests/List.tsx
Executable file
294
frontend/dashboard/src/pages/ClaimRequests/List.tsx
Executable file
@@ -0,0 +1,294 @@
|
||||
// @mui
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
Collapse,
|
||||
IconButton,
|
||||
MenuItem,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableRow,
|
||||
TextField,
|
||||
Typography,
|
||||
Stack,
|
||||
Menu,
|
||||
ButtonGroup,
|
||||
Link,
|
||||
Chip,
|
||||
} from '@mui/material';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import UploadIcon from '@mui/icons-material/Upload';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
// hooks
|
||||
import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
|
||||
import { Navigate, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
// components
|
||||
import axios from '../../utils/axios';
|
||||
import { LaravelPaginatedData, LaravelPaginatedDataDefault } from '../../@types/paginated-data';
|
||||
import DataTable from '../../components/LaravelTable';
|
||||
import { fCurrency } from '../../utils/formatNumber';
|
||||
import EditRoundedIcon from '@mui/icons-material/EditRounded';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import { Divider } from '@mui/material';
|
||||
import Iconify from '@/components/Iconify';
|
||||
// import LoadingButton from '@/theme/overrides/LoadingButton';
|
||||
|
||||
export default function List() {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const [importResult, setImportResult] = useState(null);
|
||||
const navigate = useNavigate();
|
||||
|
||||
function SearchInput(props: any) {
|
||||
// SEARCH
|
||||
const searchInput = useRef<HTMLInputElement>(null);
|
||||
const [searchText, setSearchText] = useState('');
|
||||
|
||||
const handleSearchChange = (event: any) => {
|
||||
const newSearchText = event.target.value ?? '';
|
||||
setSearchText(newSearchText);
|
||||
};
|
||||
|
||||
const handleSearchSubmit = (event: any) => {
|
||||
event.preventDefault();
|
||||
props.onSearch({ search: searchText }); // Trigger to Parent
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// Trigger First Search
|
||||
setSearchText(searchParams.get('search') ?? '');
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSearchSubmit} style={{ width: '100%' }}>
|
||||
<TextField
|
||||
id="search-input"
|
||||
ref={searchInput}
|
||||
label="Search"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
onChange={handleSearchChange}
|
||||
value={searchText}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function ImportForm(props: any) {
|
||||
// IMPORT
|
||||
// Create Button Menu
|
||||
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
||||
const createMenu = Boolean(anchorEl);
|
||||
const importForm = useRef<HTMLInputElement>(null);
|
||||
const [currentImportFileName, setCurrentImportFileName] = useState(null);
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||
<SearchInput onSearch={applyFilter} />
|
||||
{/* <Button
|
||||
variant="outlined"
|
||||
startIcon={<AddIcon />}
|
||||
sx={{ p: 1.8 }}
|
||||
onClick={() => {
|
||||
navigate('/claims/create');
|
||||
}}
|
||||
>
|
||||
Create
|
||||
</Button> */}
|
||||
</Stack>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Dummy Default Data
|
||||
const [dataTableIsLoading, setDataTableLoading] = useState(true);
|
||||
const [dataTableData, setDataTableData] = useState<LaravelPaginatedData>(
|
||||
LaravelPaginatedDataDefault
|
||||
);
|
||||
|
||||
const loadDataTableData = async (appliedFilter: any | null = null) => {
|
||||
setDataTableLoading(true);
|
||||
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
||||
const response = await axios.get('/claim-requests', { params: filter });
|
||||
// console.log(response.data);
|
||||
setDataTableLoading(false);
|
||||
|
||||
setDataTableData(response.data);
|
||||
};
|
||||
|
||||
const applyFilter = async (searchFilter: { search: string }) => {
|
||||
await loadDataTableData(searchFilter);
|
||||
setSearchParams(searchFilter);
|
||||
};
|
||||
|
||||
const handlePageChange = (event: ChangeEvent, value: number): void => {
|
||||
const filter = Object.fromEntries([...searchParams.entries(), ['page', value]]);
|
||||
loadDataTableData(filter);
|
||||
setSearchParams(filter);
|
||||
};
|
||||
|
||||
const handleApprove = (claimRequest) => {
|
||||
axios.post(`claim-requests/${claimRequest.id}/approve`)
|
||||
.then((response) => {
|
||||
enqueueSnackbar('Success Approve', {variant: 'success'})
|
||||
loadDataTableData()
|
||||
})
|
||||
.catch(({response}) => {
|
||||
enqueueSnackbar(response.data.message ?? 'Something went wrong!', {variant : "error"})
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
loadDataTableData();
|
||||
}, []);
|
||||
|
||||
const headStyle = {
|
||||
fontWeight: 'bold',
|
||||
};
|
||||
|
||||
// Called on every row to map the data to the columns
|
||||
function createData(data: any): any {
|
||||
return {
|
||||
...data,
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
/* ------------------ TABLE ROW ------------------ */
|
||||
}
|
||||
function Row(props: { row: ReturnType<typeof createData> }) {
|
||||
const { row } = props;
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const [loadingApprove, setLoadingApprove] = React.useState(false);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
|
||||
<TableCell>
|
||||
<IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)}>
|
||||
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
|
||||
</IconButton>
|
||||
</TableCell>
|
||||
<TableCell align="left">{row.code}</TableCell>
|
||||
<TableCell align="left">{row.member?.full_name}</TableCell>
|
||||
<TableCell align="left">{row.submission_date}</TableCell>
|
||||
<TableCell align="left">{row.service_type}</TableCell>
|
||||
<TableCell align="right"><Chip label={row.status}/></TableCell>
|
||||
<TableCell align="right">{ row.status == 'requested' && (<LoadingButton loading={loadingApprove} variant="outlined" onClick={() => {handleApprove(row)}}>Approve</LoadingButton> )}</TableCell>
|
||||
</TableRow>
|
||||
{/* COLLAPSIBLE ROW */}
|
||||
<TableRow>
|
||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={99}>
|
||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||
<Box sx={{ borderBottom: 1 }}>
|
||||
<Stack
|
||||
divider={<Divider orientation="horizontal" flexItem />}
|
||||
spacing={1}
|
||||
sx={{ marginY: 2 }}
|
||||
>
|
||||
<Box>
|
||||
<Typography fontWeight={600}>Berkas Hasil Penunjang</Typography>
|
||||
{row.files_by_type?.result &&
|
||||
row.files_by_type?.result.map((file, index) => (
|
||||
<Stack direction="row" key={index}>
|
||||
<Typography sx={{marginRight: 2}}>-</Typography> <a href={file.url} target="_blank">{file.name}</a>
|
||||
</Stack>
|
||||
))}
|
||||
|
||||
{ !row.files_by_type?.result && (
|
||||
<Typography>Tidak ada berkas</Typography>
|
||||
)}
|
||||
</Box>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Collapse>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
{
|
||||
/* ------------------ END TABLE ROW ------------------ */
|
||||
}
|
||||
|
||||
function TableContent() {
|
||||
return (
|
||||
<Table aria-label="collapsible table">
|
||||
{/* ------------------ TABLE HEADER ------------------ */}
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableCell style={headStyle} align="left" />
|
||||
<TableCell style={headStyle} align="left">
|
||||
Code
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Member Name
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Submission Date
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Jenis Layanan
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Status
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="right">
|
||||
Action
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
{/* ------------------ END TABLE HEADER ------------------ */}
|
||||
|
||||
{/* ------------------ TABLE ROW ------------------ */}
|
||||
{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>
|
||||
)}
|
||||
{/* ------------------ END TABLE ROW ------------------ */}
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<ImportForm />
|
||||
|
||||
<DataTable
|
||||
isLoading={dataTableIsLoading}
|
||||
lastRequest={0}
|
||||
data={dataTableData}
|
||||
handlePageChange={handlePageChange}
|
||||
TableContent={<TableContent />}
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
policy_stop_service_net: currentCorporate?.current_policy?.minimal_stop_service_net || 0,
|
||||
policy_start: currentCorporate?.current_policy?.start || '',
|
||||
policy_end: currentCorporate?.current_policy?.end || '',
|
||||
linking_rules: currentCorporate?.linking_rules || ['nric', 'nik', 'member_id'],
|
||||
linking_rules: currentCorporate?.linking_rules || ['nrik', 'nik', 'member_id'],
|
||||
type: currentCorporate?.type || 'corporate',
|
||||
logo: currentCorporate?.logo || '',
|
||||
}),
|
||||
@@ -174,8 +174,6 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
formData.append('policy_end', data.policy_end);
|
||||
formData.append('linking_rules', data.linking_rules);
|
||||
|
||||
console.log('MOTHERFUCKER', data.linking_rules)
|
||||
|
||||
if (!isEdit) {
|
||||
const response = await axios.post('/corporates', formData);
|
||||
} else {
|
||||
@@ -271,7 +269,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
const linking_rules_checkbox_name = 'linking_rules';
|
||||
const linking_tools = [
|
||||
{
|
||||
value: 'nric',
|
||||
value: 'nrik',
|
||||
label: 'No. KTP',
|
||||
},
|
||||
{
|
||||
@@ -427,7 +425,6 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
Linking Rules
|
||||
</Typography>
|
||||
<Stack>
|
||||
{JSON.stringify(getValues('linking_rules'))}
|
||||
<RHFCustomMultiCheckbox name="linking_rules" options={linking_tools} />
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
@@ -9,6 +9,7 @@ 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();
|
||||
@@ -30,6 +31,7 @@ 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={[
|
||||
@@ -52,3 +54,40 @@ 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>
|
||||
// );
|
||||
// }
|
||||
|
||||
@@ -8,7 +8,7 @@ import Select, { SelectChangeEvent } from '@mui/material/Select';
|
||||
import * as React from 'react';
|
||||
|
||||
// form
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
// @mui
|
||||
import { styled } from '@mui/material/styles';
|
||||
@@ -25,7 +25,6 @@ import {
|
||||
Typography,
|
||||
TextField,
|
||||
Chip,
|
||||
Autocomplete,
|
||||
} from '@mui/material';
|
||||
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
@@ -42,20 +41,17 @@ 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.h6,
|
||||
marginBottom: theme.spacing(2),
|
||||
marginTop: theme.spacing(2),
|
||||
...theme.typography.subtitle2,
|
||||
color: theme.palette.text.secondary,
|
||||
marginBottom: theme.spacing(1),
|
||||
}));
|
||||
|
||||
const HeaderStyle = styled('header')(({ theme }) => ({
|
||||
@@ -70,6 +66,7 @@ const Title = styled(Typography)(({ theme }) => ({
|
||||
boxShadow: 'none',
|
||||
// paddingBottom: theme.spacing(3),
|
||||
fontWeight: 700,
|
||||
color: '#005B7F',
|
||||
}));
|
||||
|
||||
interface FormValuesProps extends Partial<Practitioner> {
|
||||
@@ -109,8 +106,6 @@ 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 || '',
|
||||
@@ -126,8 +121,6 @@ export default function PractitionerForm({ isEdit, currentPractitioner }: Props)
|
||||
[currentPractitioner]
|
||||
);
|
||||
|
||||
console.log('currentPractitioner', currentPractitioner);
|
||||
|
||||
console.log('defaultValues', defaultValues);
|
||||
|
||||
function StatusLabel({ value }: { value: boolean }) {
|
||||
@@ -175,391 +168,91 @@ export default function PractitionerForm({ isEdit, currentPractitioner }: Props)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isEdit, currentPractitioner]);
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
const handleActivate = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setValue('active', 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' });
|
||||
}
|
||||
}
|
||||
console.log('event.target.checked', event.target.checked);
|
||||
|
||||
const ascent = document?.querySelector('ascent');
|
||||
if (ascent != null) {
|
||||
ascent.innerHTML = '';
|
||||
}
|
||||
};
|
||||
const formData = new FormData();
|
||||
formData.append('active', event.target.checked ? '1' : '0');
|
||||
formData.append('_method', 'PUT');
|
||||
axios.post('/doctors/' + currentPractitioner?.id ?? '', formData);
|
||||
|
||||
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);
|
||||
enqueueSnackbar('active Updated Successfully!', { variant: 'success' });
|
||||
};
|
||||
|
||||
return (
|
||||
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||
<FormProvider methods={methods}>
|
||||
<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}>
|
||||
<RHFSwitch name="active" label="" />
|
||||
{/* <Typography>Status Rumah Sakit</Typography> */}
|
||||
<RHFSwitch name="active" label="" onClick={handleActivate} />
|
||||
<StatusLabel value={values.active} />
|
||||
</Grid>
|
||||
</HeaderStyle> */}
|
||||
</HeaderStyle>
|
||||
<Title variant="h5">Informasi Umum</Title>
|
||||
<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>
|
||||
<Avatar
|
||||
alt="Remy Sharp"
|
||||
src={currentPractitioner?.avatar_url}
|
||||
sx={{ width: 120, height: 120, marginBottom: 2 }}
|
||||
/>
|
||||
|
||||
<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 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={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 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 }}>
|
||||
<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>
|
||||
<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>
|
||||
</Box>
|
||||
</div>
|
||||
</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 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>
|
||||
|
||||
@@ -57,7 +57,6 @@ 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';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -206,16 +205,9 @@ export default function List() {
|
||||
spacing={2}
|
||||
sx={{ p: 2, justifyContent: 'space-between', alignItems: 'center' }}
|
||||
>
|
||||
<Grid item xs={12} md={10} lg={10}>
|
||||
<Grid item xs={12} md={12} lg={12}>
|
||||
<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>
|
||||
);
|
||||
}
|
||||
@@ -305,22 +297,15 @@ 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 + '/edit'}>
|
||||
<Link to={'/master/doctors/' + row.id}>
|
||||
<Button>
|
||||
<Icon icon="ph:pencil-simple-fill" style={{ width: '24px', height: '24px' }} />
|
||||
<Icon icon="ph:eye-bold" 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>
|
||||
@@ -351,12 +336,7 @@ export default function List() {
|
||||
Jenis Kelamin
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
:{' '}
|
||||
{row.gender == 'male'
|
||||
? 'Laki-Laki'
|
||||
: row.gender == 'female'
|
||||
? 'Perempuan'
|
||||
: '-'}
|
||||
: {row.gender ? row.gender : '-'}
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -154,7 +154,7 @@ export default function FormulariumForm({ isEdit, currentFormularium }: Props) {
|
||||
const linking_rules_checkbox_name = "linking_rules"
|
||||
const linking_tools = [
|
||||
{
|
||||
"value" : "nric",
|
||||
"value" : "nrik",
|
||||
"label" : "No. KTP"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ 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();
|
||||
@@ -30,20 +31,25 @@ 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/hospitals',
|
||||
href: '/master/organizations',
|
||||
},
|
||||
{ name: !isEdit ? 'Create' : currentOrganizations?.name ?? '' },
|
||||
]}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
<Form isEdit={isEdit} currentOrganizations={currentOrganizations} />
|
||||
<Form
|
||||
// isSubmitting={isSubmitting}
|
||||
isEdit={isEdit}
|
||||
currentOrganizations={currentOrganizations}
|
||||
/>
|
||||
</Container>
|
||||
</Page>
|
||||
);
|
||||
|
||||
@@ -65,6 +65,7 @@ const LabelStyle = styled(Typography)(({ theme }) => ({
|
||||
}));
|
||||
|
||||
const HeaderStyle = styled('header')(({ theme }) => ({
|
||||
padding: theme.spacing(5),
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
@@ -75,6 +76,7 @@ const Title = styled(Typography)(({ theme }) => ({
|
||||
boxShadow: 'none',
|
||||
// paddingBottom: theme.spacing(3),
|
||||
fontWeight: 700,
|
||||
color: '#005B7F',
|
||||
}));
|
||||
|
||||
// const [timezone, setTimezone] = React.useState('');
|
||||
@@ -108,6 +110,10 @@ 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'),
|
||||
});
|
||||
|
||||
@@ -127,6 +133,12 @@ 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]
|
||||
@@ -180,15 +192,25 @@ 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);
|
||||
@@ -213,12 +235,21 @@ 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');
|
||||
@@ -232,10 +263,9 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
!isEdit ? 'Organizations Created Successfully!' : 'Organizations Udpated Successfully!',
|
||||
{ variant: 'success' }
|
||||
);
|
||||
navigate('/master/hospitals');
|
||||
navigate('/master/organizations');
|
||||
} 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' });
|
||||
@@ -251,10 +281,34 @@ 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) => {
|
||||
@@ -281,15 +335,17 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
}
|
||||
};
|
||||
|
||||
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) {
|
||||
// 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 })));
|
||||
// });
|
||||
// }
|
||||
|
||||
if (values.province_id) {
|
||||
loadCity();
|
||||
@@ -298,11 +354,12 @@ 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]);
|
||||
|
||||
if (values.district_id) {
|
||||
loadVillage();
|
||||
}
|
||||
}, [values.province_id, values.city_id, values.district_id, values.village_id]);
|
||||
console.log('province', values.province_id);
|
||||
console.log('city', values.city_id);
|
||||
console.log('district', values.district_id);
|
||||
|
||||
const findValueProvince = province.find(
|
||||
(item: any) => item.value === currentOrganizations?.province_id
|
||||
@@ -311,8 +368,53 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
const findValueDistrict = district.find(
|
||||
(item: any) => item.value === currentOrganizations?.district_id
|
||||
);
|
||||
const findValueVillage = village.find(
|
||||
(item: any) => item.value === currentOrganizations?.village_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
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -329,147 +431,326 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
<StatusLabel value={values.active} />
|
||||
</Grid>
|
||||
</HeaderStyle>
|
||||
<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>
|
||||
<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>
|
||||
)}
|
||||
/> */}
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<Grid item xs={12} md={6}>
|
||||
<LabelStyle>Kecamatan</LabelStyle>
|
||||
|
||||
<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 } }) => (
|
||||
<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>
|
||||
)}
|
||||
/> */}
|
||||
|
||||
<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>
|
||||
<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>
|
||||
</Box>
|
||||
|
||||
<Box sx={{ width: '100%', mt: 5 }}>
|
||||
<Box sx={{ width: '100%', p: 5 }}>
|
||||
<Stack
|
||||
alignItems="center"
|
||||
justifyContent="end"
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function Organizations() {
|
||||
},
|
||||
{
|
||||
name: 'Rumah Sakit',
|
||||
href: '/master/hospitals',
|
||||
href: '/master/organizations',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -147,11 +147,9 @@ export default function List() {
|
||||
>
|
||||
<SearchInput onSearch={applyFilter} />
|
||||
|
||||
<Link to="/master/hospitals/create" style={{ textDecoration: 'none' }}>
|
||||
<Button variant="outlined" startIcon={<AddIcon />} sx={{ p: 1.8 }}>
|
||||
Create
|
||||
</Button>
|
||||
</Link>
|
||||
{/* <Link to="/master/organizations/create/" style={{ textDecoration: 'none' }}>
|
||||
<ButtonCreate />
|
||||
</Link> */}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -261,26 +259,26 @@ export default function List() {
|
||||
</TableCell>
|
||||
<TableCell align="left">{row.name}</TableCell>
|
||||
<TableCell align="left">{row.phone}</TableCell>
|
||||
<TableCell align="left">{row.address}</TableCell>
|
||||
<TableCell align="left">{row.address?.text}</TableCell>
|
||||
|
||||
<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' }} />
|
||||
{/* <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' }} />
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setOpenDialog(true);
|
||||
}}
|
||||
>
|
||||
<Icon icon="eva:trash-2-outline" style={{ width: '24px', height: '24px' }} />
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
{/* </Stack> */}
|
||||
</TableCell>
|
||||
</ButtonGroup>
|
||||
</Stack>
|
||||
</TableCell> */}
|
||||
</TableRow>
|
||||
|
||||
{/* COLLAPSIBLE ROW */}
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
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>
|
||||
// );
|
||||
// }
|
||||
@@ -1,260 +0,0 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -1,416 +0,0 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user