Merge branch 'staging' of itcorp.primaya.id:rajif/aso into staging

This commit is contained in:
Linksehat Staging Server
2023-10-20 10:54:41 +07:00
47 changed files with 3886 additions and 1775 deletions

View File

@@ -108,18 +108,15 @@ class CorporateBenefitController extends Controller
{
$corporateBenefit = CorporateBenefit::findOrFail($id);
$request->validate([
'code' => [
'budget' => [
'required',
Rule::unique('corporate_plans')->where('corporate_id', $corporate_id)->ignore($corporateBenefit->id)
],
'name' => 'required'
]);
$corporateBenefit->fill([
'code' => $request->code,
'name' => $request->name,
'active' => $request->active,
'budget' => $request->budget,
])->save();
return $corporateBenefit;

View File

@@ -381,13 +381,15 @@ class CorporateController extends Controller
public function activation(Request $request, $corporate_id)
{
$request->validate([
'active' => 'required'
'active' => 'required',
'reason' => 'required'
]);
// abort(404);
$corporate = Corporate::findOrFail($corporate_id);
$corporate->active = $request->active == '1';
$corporate->reason = $request->reason;
if ($corporate->save()) {
return response()->json([

View File

@@ -6,6 +6,7 @@ use App\Exceptions\ImportRowException;
use App\Helpers\Helper;
use App\Models\CorporateFormularium;
use App\Models\Formularium;
use App\Models\FormulariumTemplate;
use App\Services\ImportService;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
@@ -52,9 +53,16 @@ class CorporateFormulariumController extends Controller
* Show the form for creating a new resource.
* @return Renderable
*/
public function create()
public function create(Request $request, $corporate_id)
{
return view('internal::create');
$data = CorporateFormularium::where('corporate_id', $corporate_id)->pluck('formularium_template_id')->toArray(); // agar tidak dobel
$formularium_template = FormulariumTemplate::whereNotIn('id', $data)->get();
$respone = [
"status" => 200,
"message" => 'data berhasil diambil',
"data" => $formularium_template
];
return $respone;
}
/**
@@ -62,9 +70,36 @@ class CorporateFormulariumController extends Controller
* @param Request $request
* @return Renderable
*/
public function store(Request $request)
public function store(Request $request, $corporate_id)
{
//
$request->validate([
'id' => 'required'
]);
$checkFormularium = FormulariumTemplate::find($request->id);
if (!$checkFormularium){
$respone = [
"status" => 404,
"message" => "data master formularium tidak ditemukan",
"data" => []
];
return $respone;
}
$newCorporateFormularium = CorporateFormularium::create([
'corporate_id' => $corporate_id,
'formularium_template_id' => $request->id,
'active' => 1
]);
if ($newCorporateFormularium){
$respone = [
"status" => 200,
"message" => "data berhasil disimpan"
];
return $respone;
}
return $newCorporatePlan;
}
/**
@@ -72,9 +107,15 @@ class CorporateFormulariumController extends Controller
* @param int $id
* @return Renderable
*/
public function show($id)
public function show(Request $request, $corporate_id, $id)
{
return view('internal::show');
$data = Formularium::where('formularium_template_id', $id)->get();
$respone = [
"status" => 200,
"message" => 'data berhasil diambil',
"data" => $data
];
return $respone;
}
/**
@@ -82,9 +123,16 @@ class CorporateFormulariumController extends Controller
* @param int $id
* @return Renderable
*/
public function edit($id)
public function edit(Request $request, $corporate_id)
{
return view('internal::edit');
$data = CorporateFormularium::where('corporate_id', $corporate_id)->pluck('formularium_template_id')->toArray(); // agar tidak dobel
$formularium_template = FormulariumTemplate::whereNotIn('id', $data)->get();
$respone = [
"status" => 200,
"message" => 'data berhasil diambil',
"data" => $formularium_template
];
return $respone;
}
/**
@@ -139,6 +187,22 @@ class CorporateFormulariumController extends Controller
}
}
public function active(Request $request, $corporate_id, $id)
{
$corporateFormularium = CorporateFormularium::find($id);
$corporateFormularium->fill([
'active' => $request->active,
])->save();
$respone = [
"status" => 200,
"message" => 'data berhasil diedit',
"data" => $corporateFormularium
];
return $respone;
}
public function import(Request $request, $id)
{
$request->validate([

View File

@@ -34,7 +34,7 @@ class CorporatePlanController extends Controller
// abort(404);
$plan = CorporatePlan::findOrFail($plan_id);
$plan->active = $request->active == '1';
$plan->active = $request->active == 1 ? 0 : 1;
$plan->reason = $request->reason;
if ($plan->save()) {
@@ -110,21 +110,21 @@ class CorporatePlanController extends Controller
public function update(Request $request, $corporate_id, $id)
{
$corporatePlan = CorporatePlan::findOrFail($id);
$request->validate([
'code' => [
'required',
Rule::unique('corporate_plans')->where('corporate_id', $corporate_id)->ignore($corporatePlan->id)
// Rule::unique('corporate_plans')->where('corporate_id', $corporate_id)->ignore($corporatePlan->id)
],
'name' => 'required'
]);
$corporatePlan->fill([
'code' => $request->code,
'name' => $request->name,
'active' => $request->active,
'description' => $request->description
'corporate_plan_id' => $request->plan,
'service_code' => $request->service,
'type' => $request->type,
'limit_rules' => $request->limit
])->save();
return $corporatePlan;
}

View File

@@ -144,7 +144,7 @@ class CorporateServiceController extends Controller
// ->with('configs', 'service')
->first();
$corporateService->fill([
'status' => $request->status == 'active' ? 'active' : 'inactive',
'status' => $request->status == 'active' ? 'inactive' : 'active',
'reason' => $request->reason
]);
$corporateService->save();

View File

@@ -18,6 +18,8 @@ use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
use Modules\Internal\Services\ExclusionService;
use Modules\Internal\Transformers\DiagnosisExclusionResource;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class DiagnosisExclusionController extends Controller
{
@@ -327,4 +329,19 @@ class DiagnosisExclusionController extends Controller
// return $exclusions;
return Helper::paginateResources(DiagnosisExclusionResource::collection($exclusions));
}
public function updateActivation(Request $request)
{
// validation rule
$validator = Validator::make($request->all(),[
'id' => 'required|exists:exclusions',
'active' => 'required|in:0,1',
],$this->messages());
// validation error
if ($validator->fails()) {
return response()->json($validator->getMessageBag(),400);
}
}
}

View File

@@ -19,6 +19,7 @@ class DivisionController extends Controller
$benefits = CorporateDivision::query()
->filter($request->all())
->where('corporate_id', $corporate_id)
->orderBy('id', 'DESC')
->paginate(0)
->appends($request->all());
@@ -52,6 +53,7 @@ class DivisionController extends Controller
'corporate_id' => $corporate_id,
'code' => $request->code,
'name' => $request->name,
'description' => $request->description ? $request->description : null,
]);
return $newCorporatePlan;
@@ -91,8 +93,6 @@ class DivisionController extends Controller
$request->validate([
'code' => [
'required',
// Rule::unique('corporate_plans')->where('corporate_id', $corporate_id)->ignore($corporatePlan->id)
// Rule::unique('corporate_divisions')->where('corporate_id', $corporate_id)
],
'name' => 'required'
]);
@@ -100,7 +100,7 @@ class DivisionController extends Controller
$corporatePlan->fill([
'code' => $request->code,
'name' => $request->name,
'active' => $request->active,
'description' => $request->description,
])->save();
return $corporatePlan;

View File

@@ -0,0 +1,86 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Models\Service;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class ServiceController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index(Request $request)
{
$service = Service::orderBy('name', 'ASC')->get();
if (empty($service)) {
return response(['message' => 'Tidak ada data'], 404);
} else {
return response(['message' => 'Data ditemukan', "status" => 200, 'data' => $service]);
}
}
/**
* Show the form for creating a new resource.
* @return Renderable
*/
public function create()
{
return view('internal::create');
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @return Renderable
*/
public function store(Request $request)
{
//
}
/**
* Show the specified resource.
* @param int $id
* @return Renderable
*/
public function show($id)
{
return view('internal::show');
}
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -31,6 +31,7 @@ use Modules\Internal\Http\Controllers\Api\OptionController;
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\ServiceController;
use Modules\Internal\Http\Controllers\Api\PrescriptionController;
use Modules\Internal\Http\Controllers\Api\SpecialityController;
use Modules\Internal\Http\Controllers\Api\VillageController;
@@ -106,6 +107,7 @@ Route::prefix('internal')->group(function () {
Route::get('corporates/{corporate_id}/diagnosis-exclusions', [DiagnosisExclusionController::class, 'index']);
Route::post('corporates/{corporate_id}/diagnosis-exclusions/store', [DiagnosisExclusionController::class, 'storeExclusion']);
Route::put('corporates/diagnosis-exclusions/update_activation', [DiagnosisExclusionController::class, 'updateActivation']);
Route::delete('diagnosis-exclusions/{id}', [DiagnosisExclusionController::class, 'destroy']);
Route::post('corporates/{corporate_id}/diagnosis-exclusions/import', [DiagnosisExclusionController::class, 'import']);
@@ -117,8 +119,12 @@ Route::prefix('internal')->group(function () {
Route::post('corporates/{corporate_id}/services/{service_code}/specialities/exclusion', [CorporateServiceController::class, 'storeExclusion']);
Route::get('corporates/{corporate_id}/formulariums', [CorporateFormulariumController::class, 'index']);
Route::get('corporates/{corporate_id}/formulariums/{formularium_id}', [CorporateFormulariumController::class, 'show']);
Route::get('corporates/{corporate_id}/formulariums/create', [CorporateFormulariumController::class, 'create']);
Route::post('corporates/{corporate_id}/formulariums', [CorporateFormulariumController::class, 'store']);
Route::get('corporates/{corporate_id}/formulariums/list', [CorporateFormulariumController::class, 'generateFormulariumList']);
Route::post('corporates/{corporate_id}/formulariums/import', [CorporateFormulariumController::class, 'import']);
Route::put('corporates/{corporate_id}/formulariums-update-status/{id}', [CorporateFormulariumController::class, 'active']);
Route::put('corporates/{corporate_id}/formulariums/{formularium_id}/{action}', [CorporateFormulariumController::class, 'updateStatus']);
Route::controller(CorporateController::class)->group(function () {
Route::post('add-files-doc', 'addFilesDoc');
@@ -131,7 +137,7 @@ Route::prefix('internal')->group(function () {
// Audittrail
Route::get('audittrail/{corporate_id}', [AuditTrailController::class, 'index']);
Route::get('master/diagnosis-template', [DiagnosisTemplateController::class, 'index']);
Route::get('master/diagnosis-template/search', [DiagnosisTemplateController::class, 'search']);
Route::post('master/diagnosis-template/store', [DiagnosisTemplateController::class, 'store']);
@@ -156,10 +162,10 @@ Route::prefix('internal')->group(function () {
Route::post('master/diagnosis/{diagnosis_template_id}/import', [DiagnosisController::class, 'import']);
Route::get('master/diagnosis/{diagnosis_template_id}/list', [DiagnosisController::class, 'generateIcdList']);
Route::put('master/diagnosis/{diagnosis_template_id}/activation', [DiagnosisController::class, 'activation']);
Route::get('master/drugs', [DrugController::class, 'index']);
Route::get('members', [MemberController::class, 'index']);
Route::get('members/{member_id}/benefits', [MemberController::class, 'benefits']);
@@ -201,6 +207,7 @@ Route::prefix('internal')->group(function () {
});
Route::get('province', [ProvinceController::class, 'index']);
Route::get('service', [ServiceController::class, 'index']);
Route::get('city', [CityController::class, 'index']);
Route::get('district', [DistrictController::class, 'index']);
Route::get('village', [VillageController::class, 'index']);

View File

@@ -14,27 +14,11 @@ class CorporateFormulariumResource extends JsonResource
*/
public function toArray($request)
{
return [
'id' => $this->formularium->id,
'code' => $this->formularium->code,
'name' => $this->formularium->name,
'description' => $this->formularium->description,
'manufacturer' => $this->formularium->manufacturer,
'category_name' => $this->formularium->category_name,
'kategori_obat' => $this->formularium->kategori_obat,
'uom' => $this->formularium->uom,
'general_indication' => $this->formularium->general_indication,
'composition' => $this->formularium->composition,
'atc_code' => $this->formularium->atc_code,
'class' => $this->formularium->class,
'bpom_registration' => $this->formularium->bpom_registration,
'classifications' => $this->formularium->classifications,
'cat_for' => $this->formularium->cat_for,
'items_count' => $this->formularium->items_count,
'status' => $this->active ? 'active' : 'inactive',
// 'corporate_formulariums' => $this->formua,
'id' => $this->id,
'formulaurium_category_id' => $this->formularium_template->id,
'category' => $this->formularium_template->name,
'description' => $this->formularium_template->description,
'active' => $this->active == 1 ? 'Active' : 'Inactive',
];
}

View File

@@ -41,38 +41,97 @@ class CorporateServiceConfigResource extends JsonResource
];
$list_msc = $this->corporateServiceSpecialities->map(function ($speciality) {
return explode(',', $speciality->exclusions->first()->rules->where('name', 'msc')->first()->values ?? '');
})->map(function ($item) {
$exclusions = $speciality->exclusions->first();
if ($exclusions) {
$rules = $exclusions->rules->where('name', 'msc')->first();
if ($rules) {
$values = $rules->values ?? '';
$item = explode(',', $values);
} else {
// Handle case where 'rules' with name 'msc' is not found
$item = [];
}
} else {
// Handle case where 'exclusions' is not found
$item = [];
}
return [
'm' => in_array('m', $item),
's' => in_array('s', $item),
'c' => in_array('c', $item),
];
});
$list_gender = $this->corporateServiceSpecialities->map(function ($speciality) {
// dd($speciality->exclusions->first()->rules);
return explode(',', $speciality->exclusions->first()->rules->where('name', 'gender')->first()->values ?? '');
})->map(function ($item) {
$exclusions = $speciality->exclusions->first();
if ($exclusions) {
$rules = $exclusions->rules->where('name', 'gender')->first();
if ($rules) {
$values = $rules->values ?? '';
$item = explode(',', $values);
} else {
// Handle case where 'rules' with name 'gender' is not found
$item = [];
}
} else {
// Handle case where 'exclusions' is not found
$item = [];
}
return [
'male' => in_array('male', $item),
'female' => in_array('female', $item),
];
});
$min_age = $this->corporateServiceSpecialities->map(function ($speciality) {
return $speciality->exclusions->first()->rules->where('name', 'min_age')->first()->values ?? '';
$exclusions = $speciality->exclusions->first();
if ($exclusions) {
$rules = $exclusions->rules->where('name', 'min_age')->first();
if ($rules) {
return $rules->values ?? '';
}
}
return '';
});
$max_age = $this->corporateServiceSpecialities->map(function ($speciality) {
return $speciality->exclusions->first()->rules->where('name', 'max_age')->first()->values ?? '';
$exclusions = $speciality->exclusions->first();
if ($exclusions) {
$rules = $exclusions->rules->where('name', 'max_age')->first();
if ($rules) {
return $rules->values ?? '';
}
}
return '';
});
$plan = $this->corporateServiceSpecialities->map(function ($speciality) {
return $speciality->exclusions->first()->rules->where('name', 'plan')->first()->values ?? null;
$exclusions = $speciality->exclusions->first();
if ($exclusions) {
$rules = $exclusions->rules->where('name', 'plan')->first();
if ($rules) {
return $rules->values ?? null;
}
}
return null;
});
$data['exclusions'] = $data['exclusions']->map(function ($item, $key) use (
$list_msc,
$list_gender,

View File

@@ -6,6 +6,7 @@ use App\Traits\Blameable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Altek\Accountant\Contracts\Recordable;
class CorporateFormularium extends Model
{
@@ -15,7 +16,7 @@ class CorporateFormularium extends Model
protected $fillable = [
'corporate_id',
'formularium_id',
'formularium_template_id',
'active'
];
@@ -24,8 +25,8 @@ class CorporateFormularium extends Model
return $this->belongsTo(Corporate::class);
}
public function formularium()
public function formularium_template()
{
return $this->belongsTo(Formularium::class);
return $this->belongsTo(FormulariumTemplate::class);
}
}

View File

@@ -18,6 +18,10 @@ class CorporatePlan extends Model
'code',
'name',
'description',
'corporate_plan_id',
'service_code',
'type',
'limit_rules',
'active',
'reason'
];

View File

@@ -37,11 +37,6 @@ class Formularium extends Model
$this->attributes['code'] = !empty($value) ? $value : Str::upper(Str::random('6'));
}
public function corporateFormulariums()
{
return $this->hasMany(CorporateFormularium::class, 'formularium_id', 'id');
}
public function items()
{
return $this->belongsToMany(Drug::class, 'formularium_items', 'formularium_id', 'item_id');

View File

@@ -23,4 +23,9 @@ class FormulariumTemplate extends Model
'updated_by',
// 'deleted_by',
];
// public function corporateFormulariums()
// {
// return $this->hasMany(CorporateFormularium::class, 'formularium_template_id', 'id');
// }
}

View File

@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
use App\Models\Corporate;
use App\Models\CorporateFormularium;
use App\Models\CorporateService;
use App\Models\CorporatePlan;
use App\Models\CorporateBenefit;
@@ -144,6 +145,14 @@ class AppServiceProvider extends ServiceProvider
$this->logAuditTrail($model, 'deleted');
});
// Formualrium Template
CorporateFormularium::updated(function ($model) {
$this->logAuditTrail($model, 'updated');
});
CorporateFormularium::deleted(function ($model) {
$this->logAuditTrail($model, 'deleted');
});
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('corporate_formulariums', function (Blueprint $table) {
$table->renameColumn('formularium_id', 'formularium_template_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('corporate_formulariums', function (Blueprint $table) {
$table->renameColumn('formularium_template_id', 'formularium_id');
});
}
};

View File

@@ -105,24 +105,7 @@ export default function List() {
setSearchText: setSearchText,
handleSearchSubmit: handleSearchSubmit,
};
/* ------------------------------------------------------------------------- */
/*-------------------------------- handlle checkbox ------------------------ */
const handleCheckboxChange = async (event: React.FormEvent<HTMLFormElement>) => {
// Anda bisa menambahkan logika di sini
if (event.target.checked) {
// Checkbox dicentang
console.log('Checkbox dicentang');
// Tambahkan kode lain yang ingin Anda jalankan saat checkbox dicentang
} else {
// Checkbox tidak dicentang
console.log('Checkbox tidak dicentang');
// Tambahkan kode lain yang ingin Anda jalankan saat checkbox tidak dicentang
}
};
/* -------------------------------- headCell -------------------------------- */
return (
<Stack>
<CardClaimSubmit rows={data} loadings={loadings} params={params} searchs={searchs} />

View File

@@ -202,11 +202,19 @@
}
},
"node_modules/@babel/generator": {
<<<<<<< HEAD
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz",
"integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==",
"dependencies": {
"@babel/types": "^7.23.0",
=======
"version": "7.22.10",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.10.tgz",
"integrity": "sha512-79KIf7YiWjjdZ81JnLujDRApWtl7BxTqWD88+FFdQEIOG8LJ0etDOM7CXuIgGJa55sGOwZVwuEsaLEm0PJ5/+A==",
"dependencies": {
"@babel/types": "^7.22.10",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"@jridgewell/gen-mapping": "^0.3.2",
"@jridgewell/trace-mapping": "^0.3.17",
"jsesc": "^2.5.1"
@@ -240,9 +248,15 @@
}
},
"node_modules/@babel/helper-compilation-targets": {
<<<<<<< HEAD
"version": "7.22.15",
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz",
"integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==",
=======
"version": "7.22.10",
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.10.tgz",
"integrity": "sha512-JMSwHD4J7SLod0idLq5PKgI+6g/hLD/iuWBq08ZX49xE14VpVEojJ5rHWptpirV2j020MvypRLAXAO50igCJ5Q==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dependencies": {
"@babel/compat-data": "^7.22.9",
"@babel/helper-validator-option": "^7.22.15",
@@ -531,6 +545,7 @@
}
},
"node_modules/@babel/helpers": {
<<<<<<< HEAD
"version": "7.23.1",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.1.tgz",
"integrity": "sha512-chNpneuK18yW5Oxsr+t553UZzzAs3aZnFm4bxhebsNTeshrC95yA7l5yl7GBAG+JG1rF0F7zzD2EixK9mWSDoA==",
@@ -538,15 +553,30 @@
"@babel/template": "^7.22.15",
"@babel/traverse": "^7.23.0",
"@babel/types": "^7.23.0"
=======
"version": "7.22.11",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.11.tgz",
"integrity": "sha512-vyOXC8PBWaGc5h7GMsNx68OH33cypkEDJCHvYVVgVbbxJDROYVtexSk0gK5iCF1xNjRIN2s8ai7hwkWDq5szWg==",
"dependencies": {
"@babel/template": "^7.22.5",
"@babel/traverse": "^7.22.11",
"@babel/types": "^7.22.11"
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/highlight": {
<<<<<<< HEAD
"version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz",
"integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==",
=======
"version": "7.22.10",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz",
"integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dependencies": {
"@babel/helper-validator-identifier": "^7.22.20",
"chalk": "^2.4.2",
@@ -557,9 +587,15 @@
}
},
"node_modules/@babel/parser": {
<<<<<<< HEAD
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz",
"integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==",
=======
"version": "7.22.11",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.11.tgz",
"integrity": "sha512-R5zb8eJIBPJriQtbH/htEQy4k7E2dHWlD2Y2VT07JCzwYZHBxV5ZYtM0UhXSNMT74LyxuM+b1jdL7pSesXbC/g==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"bin": {
"parser": "bin/babel-parser.js"
},
@@ -1894,9 +1930,15 @@
}
},
"node_modules/@babel/runtime": {
<<<<<<< HEAD
"version": "7.23.1",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.1.tgz",
"integrity": "sha512-hC2v6p8ZSI/W0HUzh3V8C5g+NwSKzKPtJwSpTjwl0o297GP9+ZLQSkdvHz46CM3LqyoXxq+5G9komY+eSqSO0g==",
=======
"version": "7.22.11",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.11.tgz",
"integrity": "sha512-ee7jVNlWN09+KftVOu9n7S8gQzD/Z6hN/I8VBRXW4P1+Xe7kJGXMwu8vds4aGIMHZnNbdpSWCfZZtinytpcAvA==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
@@ -1936,6 +1978,7 @@
}
},
"node_modules/@babel/traverse": {
<<<<<<< HEAD
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz",
"integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==",
@@ -1948,6 +1991,20 @@
"@babel/helper-split-export-declaration": "^7.22.6",
"@babel/parser": "^7.23.0",
"@babel/types": "^7.23.0",
=======
"version": "7.22.11",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.11.tgz",
"integrity": "sha512-mzAenteTfomcB7mfPtyi+4oe5BZ6MXxWcn4CX+h4IRJ+OOGXBrWU6jDQavkQI9Vuc5P+donFabBfFCcmWka9lQ==",
"dependencies": {
"@babel/code-frame": "^7.22.10",
"@babel/generator": "^7.22.10",
"@babel/helper-environment-visitor": "^7.22.5",
"@babel/helper-function-name": "^7.22.5",
"@babel/helper-hoist-variables": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6",
"@babel/parser": "^7.22.11",
"@babel/types": "^7.22.11",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"debug": "^4.1.0",
"globals": "^11.1.0"
},
@@ -1956,9 +2013,15 @@
}
},
"node_modules/@babel/types": {
<<<<<<< HEAD
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz",
"integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==",
=======
"version": "7.22.11",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.11.tgz",
"integrity": "sha512-siazHiGuZRz9aB9NpHy9GOs9xiQPKnMzgdr493iI1M67vRXpnEq8ZOOKzezC5q7zwuQ6sDhdSp4SD9ixKSqKZg==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dependencies": {
"@babel/helper-string-parser": "^7.22.5",
"@babel/helper-validator-identifier": "^7.22.20",
@@ -2216,9 +2279,15 @@
}
},
"node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {
<<<<<<< HEAD
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
"integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==",
=======
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -2228,9 +2297,15 @@
}
},
"node_modules/@eslint-community/regexpp": {
<<<<<<< HEAD
"version": "4.8.2",
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.2.tgz",
"integrity": "sha512-0MGxAVt1m/ZK+LTJp/j0qF7Hz97D9O/FH9Ms3ltnyIdDD57cbb1ACIQTkbHvNXtWDv5TPq7w5Kq56+cNukbo7g==",
=======
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.0.tgz",
"integrity": "sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"engines": {
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
@@ -2276,9 +2351,15 @@
}
},
"node_modules/@eslint/eslintrc/node_modules/globals": {
<<<<<<< HEAD
"version": "13.22.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.22.0.tgz",
"integrity": "sha512-H1Ddc/PbZHTDVJSnj8kWptIRSD6AM3pK+mKytuIVF4uoBV7rshFlhhvA58ceJ5wp3Er58w6zj7bykMpYXt3ETw==",
=======
"version": "13.21.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz",
"integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -2297,9 +2378,15 @@
"dev": true
},
"node_modules/@eslint/js": {
<<<<<<< HEAD
"version": "8.50.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
=======
"version": "8.48.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz",
"integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -2530,20 +2617,34 @@
}
},
"node_modules/@mui/core-downloads-tracker": {
<<<<<<< HEAD
"version": "5.14.10",
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.10.tgz",
"integrity": "sha512-kPHu/NhZq1k+vSZR5wq3AyUfD4bnfWAeuKpps0+8PS7ZHQ2Lyv1cXJh+PlFdCIOa0PK98rk3JPwMzS8BMhdHwQ==",
=======
"version": "5.14.6",
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.14.6.tgz",
"integrity": "sha512-QZEU3pyGWLuaHbxvOlShol7U1FVgzWBR0OH9H8D7L8w4/vto5N5jJVvlqFQS3T0zbR6YGHxFaiL6Ky87jQg7aw==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mui"
}
},
"node_modules/@mui/icons-material": {
<<<<<<< HEAD
"version": "5.14.9",
"resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.14.9.tgz",
"integrity": "sha512-xTRQbDsogsJo7tY5Og8R9zbuG2q+KIPVIM6JQoKxtJlz9DPOw1u0T2fGrvwD+XAOVifQf6epNMcGCDLfJAz4Nw==",
"dependencies": {
"@babel/runtime": "^7.22.15"
=======
"version": "5.14.6",
"resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.14.6.tgz",
"integrity": "sha512-7Cujy7lRGTj2T3SvY9C9ZOTFDtrXJogeNnRcU/ODyNoxwskMNPFOcc15F+98MAdJenBVLJPYu+vPP6DUvEpNrA==",
"dependencies": {
"@babel/runtime": "^7.22.10"
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
},
"engines": {
"node": ">=12.0.0"
@@ -2661,9 +2762,15 @@
}
},
"node_modules/@mui/material": {
<<<<<<< HEAD
"version": "5.14.10",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.14.10.tgz",
"integrity": "sha512-ejFMppnO+lzBXpzju+N4SSz0Mhmi5sihXUGcr5FxpgB6bfUP0Lpe32O0Sw/3s8xlmLEvG1fqVT0rRyAVMlCA+A==",
=======
"version": "5.14.6",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.14.6.tgz",
"integrity": "sha512-C3UgGrmtvcGkQkm0ONBU7bTdapTjQc2Se3b2354xMmU7lgSgW7VM6EP9wIH5XqqoJ60m9l/s9kbTWX0Y+EaWvA==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dependencies": {
"@babel/runtime": "^7.22.15",
"@mui/base": "5.0.0-beta.16",
@@ -2705,9 +2812,15 @@
}
},
"node_modules/@mui/material/node_modules/@mui/base": {
<<<<<<< HEAD
"version": "5.0.0-beta.16",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.16.tgz",
"integrity": "sha512-OYxhC81c9bO0wobGcM8rrY5bRwpCXAI21BL0P2wz/2vTv4ek7ALz9+U5M8wgdmtRNUhmCmAB4L2WRwFRf5Cd8Q==",
=======
"version": "5.0.0-beta.12",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.12.tgz",
"integrity": "sha512-tZjjXNAyUpwSDT1uRliZMhRQkWYzELJ8Qi61EuOMRpi36HIwnK2T7Nr4RI423Sv8G2EEikDAZj7je33eNd73NQ==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dependencies": {
"@babel/runtime": "^7.22.15",
"@floating-ui/react-dom": "^2.0.2",
@@ -2715,7 +2828,12 @@
"@mui/utils": "^5.14.10",
"@popperjs/core": "^2.11.8",
"clsx": "^2.0.0",
<<<<<<< HEAD
"prop-types": "^15.8.1"
=======
"prop-types": "^15.8.1",
"react-is": "^18.2.0"
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
},
"engines": {
"node": ">=12.0.0"
@@ -2749,12 +2867,21 @@
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
},
"node_modules/@mui/private-theming": {
<<<<<<< HEAD
"version": "5.14.10",
"resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.14.10.tgz",
"integrity": "sha512-f67xOj3H06wWDT9xBg7hVL/HSKNF+HG1Kx0Pm23skkbEqD2Ef2Lif64e5nPdmWVv+7cISCYtSuE2aeuzrZe78w==",
"dependencies": {
"@babel/runtime": "^7.22.15",
"@mui/utils": "^5.14.10",
=======
"version": "5.14.6",
"resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.14.6.tgz",
"integrity": "sha512-3VBLFGizBXfofyk33bwRg6t9L648aKnLmOKPfY1wFuiXq3AEYwobK65iDci/tHKxm/VKbZ6A7PFjLejvB3EvRQ==",
"dependencies": {
"@babel/runtime": "^7.22.10",
"@mui/utils": "^5.14.6",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"prop-types": "^15.8.1"
},
"engines": {
@@ -2775,11 +2902,19 @@
}
},
"node_modules/@mui/styled-engine": {
<<<<<<< HEAD
"version": "5.14.10",
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.14.10.tgz",
"integrity": "sha512-EJckxmQHrsBvDbFu1trJkvjNw/1R7jfNarnqPSnL+jEQawCkQIqVELWLrlOa611TFtxSJGkdUfCFXeJC203HVg==",
"dependencies": {
"@babel/runtime": "^7.22.15",
=======
"version": "5.14.6",
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.14.6.tgz",
"integrity": "sha512-I6zeu/OP1Hk4NsX1Oj85TiYl1dER0JMsLJVn76J1Ihl24A5EbiZQKJp3Mn+ufA79ypkdAvM9aQCAQyiVBFcUHg==",
"dependencies": {
"@babel/runtime": "^7.22.10",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"@emotion/cache": "^11.11.0",
"csstype": "^3.1.2",
"prop-types": "^15.8.1"
@@ -2806,9 +2941,15 @@
}
},
"node_modules/@mui/system": {
<<<<<<< HEAD
"version": "5.14.10",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.14.10.tgz",
"integrity": "sha512-QQmtTG/R4gjmLiL5ECQ7kRxLKDm8aKKD7seGZfbINtRVJDyFhKChA1a+K2bfqIAaBo1EMDv+6FWNT1Q5cRKjFA==",
=======
"version": "5.14.6",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.14.6.tgz",
"integrity": "sha512-/n0ae1MegWjiV1BpRU8jgg4E0zBjeB2VYsT/68ag/xaDuq3/TaDKJeT9REIvyBvwlG3CI3S2O+tRELktxCD1kg==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dependencies": {
"@babel/runtime": "^7.22.15",
"@mui/private-theming": "^5.14.10",
@@ -2866,11 +3007,19 @@
}
},
"node_modules/@mui/utils": {
<<<<<<< HEAD
"version": "5.14.10",
"resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.14.10.tgz",
"integrity": "sha512-Rn+vYQX7FxkcW0riDX/clNUwKuOJFH45HiULxwmpgnzQoQr3A0lb+QYwaZ+FAkZrR7qLoHKmLQlcItu6LT0y/Q==",
"dependencies": {
"@babel/runtime": "^7.22.15",
=======
"version": "5.14.6",
"resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.14.6.tgz",
"integrity": "sha512-AznpqLu6hrFnpHgcvsSSMCG+cDbkcCYfo+daUwBVReNYv4l+NQ8+wvBAF4aUMi155N7xWbbgh0cyKs6Wdsm3aA==",
"dependencies": {
"@babel/runtime": "^7.22.10",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"@types/prop-types": "^15.7.5",
"prop-types": "^15.8.1",
"react-is": "^18.2.0"
@@ -3056,9 +3205,15 @@
}
},
"node_modules/@remix-run/router": {
<<<<<<< HEAD
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.9.0.tgz",
"integrity": "sha512-bV63itrKBC0zdT27qYm6SDZHlkXwFL1xMBuhkn+X7l0+IIhNaH5wuuvZKp6eKhCD4KFhujhfhCT1YxXW6esUIA==",
=======
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.8.0.tgz",
"integrity": "sha512-mrfKqIHnSZRyIzBcanNJmVQELTnX+qagEDlcKO90RgRBVOZGSGvZKeDihTRfWcqoDn5N/NkUcwWTccnpN18Tfg==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"engines": {
"node": ">=14.0.0"
}
@@ -3255,9 +3410,15 @@
"dev": true
},
"node_modules/@types/lodash": {
<<<<<<< HEAD
"version": "4.14.199",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz",
"integrity": "sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg=="
=======
"version": "4.14.197",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.197.tgz",
"integrity": "sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g=="
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
},
"node_modules/@types/node": {
"version": "17.0.21",
@@ -3498,9 +3659,15 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/eslint-visitor-keys": {
<<<<<<< HEAD
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
"integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==",
=======
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -3645,9 +3812,15 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/eslint-visitor-keys": {
<<<<<<< HEAD
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
"integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==",
=======
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -3816,9 +3989,15 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/eslint-visitor-keys": {
<<<<<<< HEAD
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
"integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==",
=======
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -4127,6 +4306,7 @@
}
},
"node_modules/array.prototype.findlastindex": {
<<<<<<< HEAD
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz",
"integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==",
@@ -4135,6 +4315,16 @@
"call-bind": "^1.0.2",
"define-properties": "^1.2.0",
"es-abstract": "^1.22.1",
=======
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.2.tgz",
"integrity": "sha512-tb5thFFlUcp7NdNF6/MpDk/1r/4awWG1FIz3YqDf+/zJSTezBb+/5WViH41obXULHVpDzoiCLpJ/ZO9YbJMsdw==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.4",
"es-abstract": "^1.20.4",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"es-shim-unscopables": "^1.0.0",
"get-intrinsic": "^1.2.1"
},
@@ -4437,9 +4627,15 @@
}
},
"node_modules/browserslist": {
<<<<<<< HEAD
"version": "4.21.9",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz",
"integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==",
=======
"version": "4.21.10",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz",
"integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"funding": [
{
"type": "opencollective",
@@ -4455,9 +4651,15 @@
}
],
"dependencies": {
<<<<<<< HEAD
"caniuse-lite": "^1.0.30001503",
"electron-to-chromium": "^1.4.431",
"node-releases": "^2.0.12",
=======
"caniuse-lite": "^1.0.30001517",
"electron-to-chromium": "^1.4.477",
"node-releases": "^2.0.13",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"update-browserslist-db": "^1.0.11"
},
"bin": {
@@ -4531,9 +4733,15 @@
"integrity": "sha1-IsxKNKCrxDlQ9CxkEQJKP2NmtFo="
},
"node_modules/caniuse-lite": {
<<<<<<< HEAD
"version": "1.0.30001517",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz",
"integrity": "sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==",
=======
"version": "1.0.30001524",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001524.tgz",
"integrity": "sha512-Jj917pJtYg9HSJBF95HVX3Cdr89JUyLT4IZ8SvM5aDRni95swKgYi3TgYLH5hnGfPE/U1dg6IfZ50UsIlLkwSA==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"funding": [
{
"type": "opencollective",
@@ -4927,9 +5135,15 @@
}
},
"node_modules/electron-to-chromium": {
<<<<<<< HEAD
"version": "1.4.467",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.467.tgz",
"integrity": "sha512-2qI70O+rR4poYeF2grcuS/bCps5KJh6y1jtZMDDEteyKJQrzLOEhFyXCLcHW6DTBjKjWkk26JhWoAi+Ux9A0fg=="
=======
"version": "1.4.503",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.503.tgz",
"integrity": "sha512-LF2IQit4B0VrUHFeQkWhZm97KuJSGF2WJqq1InpY+ECpFRkXd8yTIaTtJxsO0OKDmiBYwWqcrNaXOurn2T2wiA=="
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
},
"node_modules/emoji-regex": {
"version": "9.2.2",
@@ -5131,16 +5345,27 @@
}
},
"node_modules/eslint": {
<<<<<<< HEAD
"version": "8.50.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
"integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
=======
"version": "8.48.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz",
"integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
<<<<<<< HEAD
"@eslint/js": "8.50.0",
"@humanwhocodes/config-array": "^0.11.11",
=======
"@eslint/js": "8.48.0",
"@humanwhocodes/config-array": "^0.11.10",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.12.4",
@@ -5280,6 +5505,7 @@
}
},
"node_modules/eslint-import-resolver-node": {
<<<<<<< HEAD
"version": "0.3.7",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz",
"integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==",
@@ -5288,6 +5514,16 @@
"debug": "^3.2.7",
"is-core-module": "^2.11.0",
"resolve": "^1.22.1"
=======
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
"integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==",
"dev": true,
"dependencies": {
"debug": "^3.2.7",
"is-core-module": "^2.13.0",
"resolve": "^1.22.4"
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
}
},
"node_modules/eslint-import-resolver-node/node_modules/debug": {
@@ -5415,6 +5651,18 @@
"node": ">=0.10.0"
}
},
<<<<<<< HEAD
=======
"node_modules/eslint-plugin-import/node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"node_modules/eslint-plugin-jest": {
"version": "25.7.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-25.7.0.tgz",
@@ -5732,9 +5980,15 @@
}
},
"node_modules/eslint/node_modules/globals": {
<<<<<<< HEAD
"version": "13.20.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz",
"integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==",
=======
"version": "13.21.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz",
"integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -7796,9 +8050,15 @@
}
},
"node_modules/react-hook-form": {
<<<<<<< HEAD
"version": "7.46.2",
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.46.2.tgz",
"integrity": "sha512-x1DWmHQchV7x2Rq9l99M/cQHC8JGchAnw9Z0uTz5KrPa0bTl/Inm1NR7ceOARfIrkNuQNAhuSuZPYa6k7QYn3Q==",
=======
"version": "7.45.4",
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.45.4.tgz",
"integrity": "sha512-HGDV1JOOBPZj10LB3+OZgfDBTn+IeEsNOKiq/cxbQAIbKaiJUe/KV8DBUzsx0Gx/7IG/orWqRRm736JwOfUSWQ==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"engines": {
"node": ">=12.22.0"
},
@@ -7894,11 +8154,19 @@
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
},
"node_modules/react-router": {
<<<<<<< HEAD
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.16.0.tgz",
"integrity": "sha512-VT4Mmc4jj5YyjpOi5jOf0I+TYzGpvzERy4ckNSvSh2RArv8LLoCxlsZ2D+tc7zgjxcY34oTz2hZaeX5RVprKqA==",
"dependencies": {
"@remix-run/router": "1.9.0"
=======
"version": "6.15.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.15.0.tgz",
"integrity": "sha512-NIytlzvzLwJkCQj2HLefmeakxxWHWAP+02EGqWEZy+DgfHHKQMUoBBjUQLOtFInBMhWtb3hiUy6MfFgwLjXhqg==",
"dependencies": {
"@remix-run/router": "1.8.0"
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
},
"engines": {
"node": ">=14.0.0"
@@ -7908,12 +8176,21 @@
}
},
"node_modules/react-router-dom": {
<<<<<<< HEAD
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.16.0.tgz",
"integrity": "sha512-aTfBLv3mk/gaKLxgRDUPbPw+s4Y/O+ma3rEN1u8EgEpLpPe6gNjIsWt9rxushMHHMb7mSwxRGdGlGdvmFsyPIg==",
"dependencies": {
"@remix-run/router": "1.9.0",
"react-router": "6.16.0"
=======
"version": "6.15.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.15.0.tgz",
"integrity": "sha512-aR42t0fs7brintwBGAv2+mGlCtgtFQeOzK0BM1/OiqEzRejOZtpMZepvgkscpMUnKb8YO84G7s3LsHnnDNonbQ==",
"dependencies": {
"@remix-run/router": "1.8.0",
"react-router": "6.15.0"
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
},
"engines": {
"node": ">=14.0.0"
@@ -7993,9 +8270,15 @@
}
},
"node_modules/regenerator-runtime": {
<<<<<<< HEAD
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
=======
"version": "0.13.10",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz",
"integrity": "sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==",
>>>>>>> 03afed696e270d782cc5a3e8f600f823bd2fa562
"dev": true
},
"node_modules/regenerator-transform": {

View File

@@ -12,6 +12,10 @@ export type Corporate = {
divisions?: Division[];
employees?: Employee[];
current_policy?: Policy;
corporate_plans_count: number;
corporate_benefits_count: number;
employees_count: number;
};
export type Division = {
@@ -39,14 +43,19 @@ export type Policy = {
minimal_stop_service_net: number;
start: string | Date;
end: string | Date;
limit_balance: number;
}
export type CorporatePlan = {
id: number;
corporate_id: number;
code: string;
service_code: string;
limit_rules: number;
corporate_plan_id: number;
name: string;
description: string | null;
type: number;
active: boolean | number;
}
@@ -101,6 +110,7 @@ export type Plan = {
currency: string;
max_surgery_reinstatement_days: string;
max_surgery_periode_days: string;
active: number
}
export type CorporateBenefit = {
@@ -113,6 +123,7 @@ export type CorporateBenefit = {
}
export type Benefit = {
id : number;
service_code : string;
plan_code : string;
benefit_code : string;
@@ -170,6 +181,11 @@ export type Benefit = {
currency : string;
show_benefit_item : string;
show_benefit_value : string;
plan : Plan;
benefit: Benefit;
corporate_benefit_code: string;
active: number;
limit_free_tc: number;
}
export type CorporateService = {
@@ -189,3 +205,7 @@ export type MasterExclusion = {
code: string;
description?: string;
}
export type CorporateId = {
corporate_id?: number
}

View File

@@ -0,0 +1,208 @@
import * as Yup from 'yup';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Dialog, DialogTitle, DialogContent, Stack, Typography, IconButton, Grid } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
import { ReactElement } from 'react';
import Iconify from './Iconify';
import { Card } from '@mui/material';
import { FormProvider, RHFTextField, RHFSwitch, RHFSelect } from './hook-form';
import { Button } from '@mui/material';
import { LoadingButton } from '@mui/lab';
import axios from '@/utils/axios';
import { enqueueSnackbar } from 'notistack';
// ----------------------------------------------------------------------
type DataContent = {
code: string;
name: string;
id: number;
status: string
};
type MuiDialogProps = {
title?: {
name?: string;
icon?: string;
};
openDialog: boolean;
setOpenDialog: Function;
content?: ReactElement;
maxWidth?: string;
data?: DataContent | undefined;
description: string;
};
type FormValuesProps = {
value: string;
active: boolean;
};
// ----------------------------------------------------------------------
const DialogUpdateStatus = ({ title, openDialog, setOpenDialog, data, maxWidth, content }: MuiDialogProps) => {
const NewCorporateSchema = Yup.object().shape({
reason: Yup.string().required('Corporate Status is required'),
});
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
});
const {
reset,
handleSubmit,
formState: { isSubmitting },
} = methods;
useEffect(() => {
if (openDialog === false) {
reset();
}
}, [openDialog, reset]);
const handleClose = () => {
setOpenDialog(false);
};
const handleUpdate = (id: number, status: number) => {
axios
.put(`/corporates/${id}/activation`, {
// service_code: service.service_code,
active: status,
})
.then((res) => {
handleClose()
window.location.reload();
})
.catch((error) => {
// console.log('asdasd', error.response.data.message)
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
}
let maxWidthDialog = 'md';
if (maxWidth) {
maxWidthDialog = maxWidth;
}
const onSubmit = async (row : any) => {
console.log('test')
};
return (
<Dialog open={openDialog} onClose={handleClose} fullWidth={true} maxWidth={'sm'}>
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
<Stack direction="row" alignItems="center" justifyContent="space-between">
{title?.icon ? (
<Stack direction="row">
<Iconify icon={title?.icon} width={25} height={25} sx={{ marginRight: '10px' }} />
<Typography variant="h6">{title?.name}</Typography>
</Stack>
) : (
<Typography variant="h6">{title?.name ? title?.name : ''}</Typography>
)}
<IconButton sx={{ color: '#FFF' }} onClick={handleClose}>
<CloseIcon />
</IconButton>
</Stack>
</DialogTitle>
<DialogContent sx={{ backgroundColor: '#F9FAFB' }}>
{/* <Stack paddingX={2} paddingY={2}>
<Typography variant='subtitle1'>{description}</Typography>
</Stack>
<Card>
<Grid container paddingX={2} paddingY={2}>
<Grid item xs={4} md={4}>
<Typography variant='inherit'>Code</Typography>
</Grid>
<Grid item xs={8}>
<Typography variant='subtitle1'>{data?.code}</Typography>
</Grid>
<Grid item xs={4} md={4} marginTop={2}>
<Typography variant='inherit'>Corporate Name</Typography>
</Grid>
<Grid item xs={8} marginTop={2}>
<Typography variant='subtitle1'>{data?.name}</Typography>
</Grid>
</Grid>
</Card>
<Typography marginTop={5} marginBottom={3} variant='subtitle1'>
Reason for update*
</Typography>
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<RHFSelect
name="reason"
label="Reason for update"
>
<option value=""></option>
<option value="Agreement changed">Agreement changed</option>
<option value="Endorsement">Endorsement</option>
<option value="Renewal">Renewal</option>
<option value="Worng Setting">Worng Setting</option>
</RHFSelect>
</FormProvider>
<Stack
alignItems="center"
justifyContent="flex-end"
direction={{ xs: 'column', md: 'row' }}
spacing={2}
marginTop={5}
>
<Stack direction="row" spacing={1}>
<Button
sx={{
boxShadow: 'none',
}}
variant="outlined"
size="medium"
fullWidth={true}
onClick={() => setOpenDialog(false)}
>
Cancel
</Button>
{data?.status == 1 ?
<Button
sx={{
boxShadow: 'none',
}}
variant="contained"
size="medium"
fullWidth={true}
color='error'
onClick={() => handleUpdate(data?.id, 0)}
>
Inactive
</Button>
: <Button
sx={{
boxShadow: 'none',
}}
variant="contained"
size="medium"
fullWidth={true}
color='success'
onClick={() => handleUpdate(data?.id, 1)}
>
Active
</Button> }
</Stack>
</Stack> */}
{content}
</DialogContent>
</Dialog>
);
};
export default DialogUpdateStatus;

View File

@@ -0,0 +1,98 @@
// @mui
import { alpha, Theme, useTheme, styled } from '@mui/material/styles';
import { BoxProps } from '@mui/material';
// theme
import { ColorSchema } from '../theme/palette';
// ----------------------------------------------------------------------
type LabelColor = 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error';
type LabelVariant = 'filled' | 'outlined' | 'ghost';
const RootStyle = styled('span')(
({
theme,
ownerState,
}: {
theme: Theme;
ownerState: {
color: LabelColor;
variant: LabelVariant;
};
}) => {
const isLight = theme.palette.mode === 'light';
const { color, variant } = ownerState;
const styleFilled = (color: ColorSchema) => ({
color: theme.palette[color].contrastText,
backgroundColor: theme.palette[color].main,
});
const styleOutlined = (color: ColorSchema) => ({
color: theme.palette[color].main,
backgroundColor: 'transparent',
border: `1px solid ${theme.palette[color].main}`,
});
const styleGhost = (color: ColorSchema) => ({
color: theme.palette[color][isLight ? 'dark' : 'light'],
backgroundColor: alpha(theme.palette[color].main, 0.16),
});
return {
height: 22,
minWidth: 22,
lineHeight: 0,
borderRadius: 6,
// cursor: 'default',
alignItems: 'center',
whiteSpace: 'nowrap',
display: 'inline-flex',
justifyContent: 'center',
padding: theme.spacing(0, 1),
color: theme.palette.grey[800],
fontSize: theme.typography.pxToRem(12),
fontFamily: theme.typography.fontFamily,
backgroundColor: theme.palette.grey[300],
fontWeight: theme.typography.fontWeightBold,
...(color !== 'default'
? {
...(variant === 'filled' && { ...styleFilled(color) }),
...(variant === 'outlined' && { ...styleOutlined(color) }),
...(variant === 'ghost' && { ...styleGhost(color) }),
}
: {
...(variant === 'outlined' && {
backgroundColor: 'transparent',
color: theme.palette.text.primary,
border: `1px solid ${theme.palette.grey[500_32]}`,
}),
...(variant === 'ghost' && {
color: isLight ? theme.palette.text.secondary : theme.palette.common.white,
backgroundColor: theme.palette.grey[500_16],
}),
}),
};
}
);
// ----------------------------------------------------------------------
interface Props extends BoxProps {
color?: LabelColor;
variant?: LabelVariant;
}
export default function Label({ color = 'default', variant = 'ghost', children, sx }: Props) {
const theme = useTheme();
return (
<RootStyle ownerState={{ color, variant }} sx={sx} theme={theme}>
{children}
</RootStyle>
);
}

View File

@@ -21,7 +21,7 @@ export default function ThemeColorPresets({ children }: Props) {
...defaultTheme,
palette: {
...defaultTheme.palette,
primary: setColor,
// primary: setColor,
},
customShadows: {
...defaultTheme.customShadows,

View File

@@ -2,21 +2,43 @@ import * as Yup from 'yup';
import { yupResolver } from "@hookform/resolvers/yup";
import { Card, Collapse, Divider, Grid, Stack, Typography } from "@mui/material";
import { useForm } from "react-hook-form";
import { useParams } from "react-router-dom";
import { useNavigate, useParams } 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 CorporateTabNavigations from "../CorporateTabNavigations";
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
import DivisionsList from "./List";
import { useMemo, useState } from 'react';
import FormEdit from "./Form";
import { useEffect, useMemo, useState } from 'react';
import { Benefit } from '@/@types/corporates';
import axios from '@/utils/axios';
export default function Divisions() {
const { themeStretch } = useSettings();
const { corporate_id } = useParams();
const { corporate_id, benefit_id } = useParams();
const [ currentCorporateBenefit, setCurrentCorporateBenefit ] = useState<Benefit>();
const navigate = useNavigate();
const isEdit = !!benefit_id;
useEffect(() => {
console.log(benefit_id);
if (isEdit) {
axios.get('/corporates/'+corporate_id+'/corporate-benefits/'+benefit_id+'/edit')
.then((res) => {
setCurrentCorporateBenefit(res.data);
})
.catch((err) => {
if (err.response.status === 404) {
navigate('/404');
}
})
}
}, [corporate_id, benefit_id]);
const NewDivisionSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
@@ -51,97 +73,12 @@ export default function Divisions() {
console.log(data);
};
const [open, setOpen] = useState(false);
const benefits = [
{
'category' : 'General Practitioner',
'childs' : [
{
'name' : 'External Doctor Online',
'code' : 'gp-external-doctor-online'
},
{
'name' : 'External Doctor Offline',
'code' : 'gp-external-doctor-offline'
},
{
'name' : 'Internal Doctor Online',
'code' : 'gp-internal-doctor-online'
},
{
'name' : 'Internal Doctor Offline',
'code' : 'gp-internal-doctor-offline'
},
]
},
{
'category' : 'Specialist',
'childs' : [
{
'name' : 'External Doctor Online',
'code' : 'sp-external-doctor-online'
},
{
'name' : 'External Doctor Offline',
'code' : 'sp-external-doctor-offline'
},
{
'name' : 'Internal Doctor Online',
'code' : 'sp-internal-doctor-online'
},
{
'name' : 'Internal Doctor Offline',
'code' : 'sp-internal-doctor-offline'
},
]
},
{
'category' : 'Medicines',
'childs' : [
{
'name' : 'Vitamins',
'code' : 'medicines-vitamins'
},
{
'name' : 'Delivery Fee',
'code' : 'medicines-delivery-fee'
},
]
},
];
const products = [
{
'name' : 'Inpatient',
'code' : 'IP',
},
{
'name' : 'Outpatient',
'code' : 'OP',
},
{
'name' : 'Dental',
'code' : 'DT',
},
{
'name' : 'Dental',
'code' : 'DTL',
},
{
'name' : 'Matternity',
'code' : 'MT',
},
{
'name' : 'Special Benefit',
'code' : 'SB',
},
];
return (
<Page title="Create Benefit">
<HeaderBreadcrumbs
{/* <HeaderBreadcrumbs
heading={'Create Benefit'}
links={[
{ name: 'Dashboard', href: '/dashboard' },
@@ -162,9 +99,9 @@ export default function Divisions() {
href: '/corporates/'+id+'/benefits/create',
},
]}
/>
/> */}
{/*
<Grid container spacing={2}>
<Grid item xs={12}>
<Card sx={{ p: 2 }}>
@@ -235,7 +172,17 @@ export default function Divisions() {
</FormProvider>
</Card>
</Grid>
</Grid>
</Grid> */}
<Stack direction="row" alignItems="center">
<ArrowBackIosIcon
onClick={() => navigate(`/corporates/${corporate_id}/benefit`)}
sx={{ cursor: 'pointer' }}
/>
<Typography variant="h5" sx={{ marginRight:2, flexGrow: 1 }}>
Edit Plan
</Typography>
</Stack>
<FormEdit isEdit={true} currentCorporateBenefit={currentCorporateBenefit}/>
</Page>
);
}

View File

@@ -1,7 +1,7 @@
import * as Yup from 'yup';
import { LoadingButton } from '@mui/lab';
import { Box, Card, Grid, Stack, Typography } from '@mui/material';
import { CorporatePlan } from '../../../@types/corporates';
import { Box, Button, Card, Grid, Stack, Typography } from '@mui/material';
import { Benefit } from '../../../@types/corporates';
import { FormProvider, RHFSwitch, RHFTextField } from '../../../components/hook-form';
import { useEffect, useMemo } from 'react';
import { useForm } from 'react-hook-form';
@@ -12,39 +12,36 @@ import axios from '../../../utils/axios';
type Props = {
isEdit: boolean;
currentCorporatePlan?: CorporatePlan;
currentCorporateBenefit?: Benefit;
};
export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Props) {
export default function CorporateBenefitForm({ isEdit, currentCorporateBenefit }: Props) {
const { enqueueSnackbar } = useSnackbar();
const navigate = useNavigate();
const { corporate_id } = useParams();
const { corporate_id, benefit_id } = useParams();
const NewCorporatePlanSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
code: Yup.string().required('Corporate Code is required'),
const NewCorporateBenefitSchema = Yup.object().shape({
budget: Yup.string().required('Budget is required'),
});
const defaultValues = useMemo(
() => ({
name: currentCorporatePlan?.name || '',
code: currentCorporatePlan?.code || '',
active: currentCorporatePlan?.active === 1 ? true : false,
budget: currentCorporateBenefit?.budget || '',
}),
[currentCorporatePlan]
[currentCorporateBenefit]
);
useEffect(() => {
if (isEdit && currentCorporatePlan) {
if (isEdit && currentCorporateBenefit) {
reset(defaultValues);
}
if (!isEdit) {
reset(defaultValues);
}
}, [isEdit, currentCorporatePlan]);
}, [isEdit, currentCorporateBenefit]);
const methods = useForm({
resolver: yupResolver(NewCorporatePlanSchema),
resolver: yupResolver(NewCorporateBenefitSchema),
defaultValues,
});
@@ -81,12 +78,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
});
} else {
await axios
.put('/corporate/' + corporate_id + '/divisions/' + currentCorporatePlan?.id, data)
.put('/corporates/' + corporate_id + '/corporate-benefits/' + benefit_id, data)
.then((res) => {
enqueueSnackbar('Division updated successfully', { variant: 'success' });
})
.then((res) => {
navigate('/corporate/' + corporate_id + '/divisions/', { replace: true });
navigate('/corporates/' + corporate_id + '/benefits', { replace: true });
})
.catch(({ response }) => {
enqueueSnackbar('Update Failed : ' + response.data.message, { variant: 'error' });
@@ -95,30 +92,44 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
};
return (
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<Box sx={{ margin: 1, pb: 2, pl: 4 }}>
<Grid container>
<Grid item xs={6} sx={{ padding: 2 }}>
<Grid item xs={12} sx={{ padding: 2 }}>
<Grid container>
<Stack direction="row" alignItems="center" sx={{ width: '100%' }}>
<Typography variant="subtitle2" sx={{ mr: 2 }}>
ASO/Budget
</Typography>
<RHFTextField name="budget" />
</Stack>
</Grid>
</Grid>
<Grid item xs={6} sx={{ padding: 2 }}>
<Grid container>
<Stack direction="row" alignItems="center" sx={{ width: '100%' }}>
<Typography variant="subtitle2" sx={{ mr: 2 }}>
ASO/Budget
</Typography>
<RHFTextField name="budget" />
<RHFTextField name="budget" type='number'/>
</Stack>
</Grid>
</Grid>
</Grid>
<Stack direction="row" alignItems="center" justifyContent="flex-end">
<Button
sx={{marginTop:2}}
type="submit"
variant="contained"
size="large"
color='inherit'
onClick={() => navigate(`/corporates/${corporate_id}/benefits`)}
>
Cancel
</Button>
<LoadingButton
type="submit"
variant="contained"
size="large"
// fullWidth={true}
loading={isSubmitting}
sx={{marginTop:2, marginLeft:2}}
>
Save
</LoadingButton>
</Stack>
</Box>
</FormProvider>
);

View File

@@ -44,10 +44,10 @@ export default function Divisions() {
]}
/>
<Card>
{/* <Card> */}
<CorporateTabNavigations position={'benefits'} />
<DivisionsList />
</Card>
{/* </Card> */}
</Page>
);
}

File diff suppressed because it is too large Load Diff

View File

@@ -85,7 +85,7 @@ export default function CustomizedAccordions() {
(panel: string) => (event: React.SyntheticEvent, newExpanded: boolean) => {
setExpanded(newExpanded ? panel : false);
};
const pageTitle = 'Audittrail Corporate';
const pageTitle = 'Corporate Dashboard';
const { themeStretch } = useSettings();
@@ -121,11 +121,11 @@ export default function CustomizedAccordions() {
},
{
name: corporate?.name ?? '-',
href: '/corporate/' + corporate_id + '/plans',
href: '/corporates/' + corporate_id + '/benefits',
},
{
name: 'Audittrail Corporate',
href: '/corporate/' + corporate_id + '/plans',
name: 'Benefit',
href: '/corporates/' + corporate_id + '/benefits',
},
]}
/>

View File

@@ -8,6 +8,9 @@ import axios from '../../../utils/axios';
import { useSnackbar } from 'notistack';
import CorporatePlanForm from './Form';
import { CorporatePlan } from '../../../@types/corporates';
import { Stack } from "@mui/system";
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
import { Typography } from "@mui/material";
@@ -36,8 +39,8 @@ export default function PlanCreate() {
return (
<Page title="Create Corporate Plan">
<HeaderBreadcrumbs
heading={'Create Corporate Plan'}
{/* <HeaderBreadcrumbs
heading={ 'Edit Plan'}
links={[
{
name: 'Corporates',
@@ -56,7 +59,16 @@ export default function PlanCreate() {
href: '/corporates/'+corporate_id+'/corporate-plans/'+id,
},
]}
/>
/> */}
<Stack direction="row" alignItems="center">
<ArrowBackIosIcon
onClick={() => navigate(`/corporates/${corporate_id}/plans`)}
sx={{ cursor: 'pointer' }}
/>
<Typography variant="h5" sx={{ marginRight:2, flexGrow: 1 }}>
Edit Plan
</Typography>
</Stack>
<CorporatePlanForm isEdit={isEdit} currentCorporatePlan={currentCorporatePlan}/>
</Page>

View File

@@ -1,6 +1,6 @@
import * as Yup from 'yup';
import { LoadingButton } from '@mui/lab';
import { Card, Grid, Stack, Typography } from '@mui/material';
import { Card, Grid, Stack, Typography, Button } from '@mui/material';
import { CorporatePlan } from '../../../@types/corporates';
import { FormProvider, RHFEditor, RHFSwitch, RHFTextField } from '../../../components/hook-form';
import { useEffect, useMemo, useState } from 'react';
@@ -22,16 +22,22 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
const { corporate_id } = useParams();
const NewCorporatePlanSchema = Yup.object().shape({
name: Yup.string().required('Name is required'),
code: Yup.string().required('Corporate Code is required'),
service: Yup.string().required('Corporate Service is required'),
plan: Yup.string().required('Corporate Plan is required'),
type: Yup.string().required('Corporate Type is required'),
limit: Yup.string().required('Corporate Limit is required'),
});
const defaultValues = useMemo(
() => ({
name: currentCorporatePlan?.name || '',
// name: currentCorporatePlan?.name || '',
code: currentCorporatePlan?.code || '',
active: currentCorporatePlan?.active || true,
description: currentCorporatePlan?.description || '',
// active: currentCorporatePlan?.active || true,
type: currentCorporatePlan?.type || '',
limit: currentCorporatePlan?.limit_rules || '',
service: currentCorporatePlan?.service_code || '',
plan: currentCorporatePlan?.corporate_plan_id || '',
}),
[currentCorporatePlan]
);
@@ -62,14 +68,15 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
} = methods;
const onSubmit = async (data: any) => {
console.log(data);
if (!isEdit) {
await axios
.post('/corporate/' + corporate_id + '/corporate-plans', data)
.post('/corporates/' + corporate_id + '/corporate-plans', data)
.then((res) => {
enqueueSnackbar('Corporate Plan created successfully', { variant: 'success' });
})
.then((res) => {
navigate('/corporate/' + corporate_id + '/corporate-plans', { replace: true });
navigate(`/corporates/${corporate_id}/plans`, { replace: true });
})
.catch(({ response }) => {
if (response.status === 422) {
@@ -83,12 +90,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
});
} else {
await axios
.put('/corporate/' + corporate_id + '/corporate-plans/' + currentCorporatePlan?.id, data)
.put('/corporates/' + corporate_id + '/corporate-plans/' + currentCorporatePlan?.id, data)
.then((res) => {
enqueueSnackbar('Corporate Plan updated successfully', { variant: 'success' });
})
.then((res) => {
navigate('/corporate/' + corporate_id + '/corporate-plans/', { replace: true });
navigate('/corporates/' + corporate_id + '/plans', { replace: true });
})
.catch(({ response }) => {
enqueueSnackbar('Update Failed : ' + response.data.message, { variant: 'error' });
@@ -98,12 +105,34 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
return (
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<Grid container spacing={2}>
<Grid item xs={8}>
<Card sx={{ p: 2 }}>
<Card sx={{ p: 2, marginTop: 2 }}>
<Grid container spacing={4} paddingX={2} paddingY={2}>
<Grid item xs={3}>
<Typography variant="subtitle1">Service*</Typography>
<RHFTextField name="service" label="service" sx={{marginTop:2}}/>
</Grid>
<Grid item xs={3}>
<Typography variant="subtitle1">Plan*</Typography>
<RHFTextField name="plan" label="plan" sx={{marginTop:2}} />
</Grid>
<Grid item xs={3}>
<Typography variant="subtitle1">Code*</Typography>
<RHFTextField name="code" label="code" sx={{marginTop:2}} />
</Grid>
<Grid item xs={3}>
<Typography variant="subtitle1">Type*</Typography>
<RHFTextField name="type" label="type" sx={{marginTop:2}} />
</Grid>
<Grid item xs={6}>
<Typography variant="subtitle1">Plan Limit*</Typography>
<RHFTextField name="limit" label="limit" sx={{marginTop:2}} />
</Grid>
{/* <Grid item xs={3}>
<Stack spacing={3}>
<Typography variant="h6">Corporate Plan Detail</Typography>
<RHFTextField name="name" label="Name" />
<RHFTextField name="code" label="Code" />
@@ -122,17 +151,35 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
fullWidth={true}
loading={isSubmitting}
>
Create Corporate Plan
{ isEdit ? 'Update' : 'Create'} Corporate Plan
</LoadingButton>
</Stack>
</Card>
</Grid> */}
</Grid>
<Grid item xs={4}>
<Card sx={{ p: 2 }}>
<RHFSwitch name="active" label="Active" />
</Card>
</Grid>
</Grid>
</Card>
<Stack direction="row" alignItems="center" justifyContent="flex-end">
<Button
sx={{marginTop:2}}
type="submit"
variant="contained"
size="large"
color='inherit'
onClick={() => navigate(`/corporates/${corporate_id}/plans`)}
>
Cancel
</Button>
<LoadingButton
type="submit"
variant="contained"
size="large"
// fullWidth={true}
loading={isSubmitting}
sx={{marginTop:2, marginLeft:2}}
>
Save
</LoadingButton>
</Stack>
</FormProvider>
);
}

View File

@@ -44,10 +44,10 @@ export default function CorporateTabNavigations({ position }: Props) {
path: 'benefits',
label: 'Benefit',
},
{
path: 'divisions',
label: 'Division',
},
// {
// path: 'divisions',
// label: 'Division',
// },
{
path: 'members',
label: 'Member List',

View File

@@ -38,13 +38,13 @@ import {
} 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 GetApp from '@mui/icons-material/GetApp';
import UploadIcon from '@mui/icons-material/Upload';
import CancelIcon from '@mui/icons-material/Cancel';
// hooks
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
import useSettings from '../../../hooks/useSettings';
import { Link, useParams, useSearchParams } from 'react-router-dom';
import { Link, useParams, useSearchParams, useNavigate } from 'react-router-dom';
// components
import axios from '../../../utils/axios';
import { LaravelPaginatedData } from '../../../@types/paginated-data';
@@ -54,6 +54,11 @@ import { enqueueSnackbar } from 'notistack';
import { Icon } from '@iconify/react';
import { LoadingButton } from '@mui/lab';
import HistoryIcon from '@mui/icons-material/History';
import CachedIcon from '@mui/icons-material/Cached';
import TableMoreMenu from '@/components/table/TableMoreMenu';
import { EditOutlined, FindInPageOutlined } from '@mui/icons-material';
import Label from '@/components/Label';
import { display } from '@mui/system';
export default function List(props: any) {
const { themeStretch } = useSettings();
@@ -82,7 +87,7 @@ export default function List(props: any) {
}, [searchParams]);
return (
<form onSubmit={handleSearchSubmit} style={{ width: '100%' }}>
<form onSubmit={handleSearchSubmit} style={{ width: '90%' }}>
<TextField
id="search-input"
ref={searchInput}
@@ -146,7 +151,7 @@ export default function List(props: any) {
handleCancelImportButton();
loadDataTableData();
setImportResult(response.data);
setImportLoading(false);
// alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows');
})
@@ -156,14 +161,14 @@ export default function List(props: any) {
response.message,
{ variant: 'error' }
);
setImportLoading(false);
})
} else {
enqueueSnackbar('No File Selected', { variant: 'warning' });
}
};
const handleGetTemplate = (type :string) => {
axios.get('corporates/import-document-example/' + type)
.then((response) => {
@@ -191,17 +196,19 @@ export default function List(props: any) {
<SearchInput onSearch={applyFilter} />
{/* <h1>kjasndkjandskjasndkjansdkjansd</h1> */}
<Button
id="import-button"
variant="outlined"
startIcon={<AddIcon />}
sx={{ p: 1.8 }}
aria-controls={createMenu ? 'basic-menu' : undefined}
aria-haspopup="true"
aria-expanded={createMenu ? 'true' : undefined}
onClick={handleClick}
id="import-button"
variant="contained"
startIcon={<GetApp />}
sx={{ p: 1.8,width: '200px' }}
aria-controls={createMenu ? 'basic-menu' : undefined}
aria-haspopup="true"
aria-expanded={createMenu ? 'true' : undefined}
onClick={handleClick}
color='primary'
>
Import
Import
</Button>
<Menu
id="import-button"
anchorEl={anchorEl}
@@ -462,80 +469,171 @@ export default function List(props: any) {
console.log('exclusions', exclusions);
const handleActivate = (row: any) => {
axios
.put(`/corporates/diagnosis-exclusions/update_activation`, {
id: row.id,
active: row.active == 1 ? 0 : 1,
})
.then((res) => {
// setDataTableData({
// ...dataTableData,
// data: dataTableData.data.map((model) => {
// let updatedModel = model;
// if (row.id == model.id) {
// updatedModel.active = res.data.corporate.active;
// }
// return updatedModel;
// }),
// });
})
.catch((error) => {
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
};
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.service_code}</TableCell>
<TableCell align="left">{row.code}</TableCell>
<TableCell align="left">{row.name}</TableCell>
<TableCell align="left">{Object.keys(row.rules).length ? 'With Rules' : 'All'}</TableCell>
<TableCell align="left">{row.active ? 'Active' : 'Inactive'}</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}/>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.service_code}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.code}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.name}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{Object.keys(row.rules).length ? 'With Rules' : 'All'}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.active == 1 && (
<Label
variant="outlined"
color="success"
size="small"
>
Active
</Label>
)}
{row.active != 1 && (
<Label
variant="outlined"
color="error"
size="small"
>
Inactive
</Label>
)}
</TableCell>
<TableCell align="center">
<Stack direction={'row'} spacing={1} sx={{ mb: 1 }}>
{openEdit ? (
<Button
variant="contained"
color="success"
size="small"
sx={{
color: '#fff',
}}
onClick={(event) => {
setOpenEdit(!openEdit);
if (open == false) {
setOpen(true);
}
handleConfigExclusion(event, row, '', 'one_row');
}}
>
Save
</Button>
) : (
<Button
variant="outlined"
color="success"
size="small"
onClick={() => {
setOpenEdit(true);
setOpen(true);
}}
>
Edit
</Button>
)}
{/* <Button
variant="outlined"
color="error"
size="small"
sx={{ ml: 2 }}
onClick={() => {
setOpenDelete(true);
}}
>
Delete
</Button> */}
{/* <Link to={`/corporate/${corporate_id}/diagnosis-exclusions/${row.id}/history`}>
<HistoryIcon />
</Link> */}
</Stack>
<TableCell align="left">
<TableMoreMenu actions={
<>
<MenuItem onClick={() => setOpen(!open)}>
<FindInPageOutlined />
Detail
</MenuItem>
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions/history`)} >
<EditOutlined />
Edit
</MenuItem>
<MenuItem onClick={() => handleActivate(row)}>
<CachedIcon />
Update Status
</MenuItem>
</>
} />
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={99}>
<Collapse in={open} timeout="auto" unmountOnExit>
{open == true ? (
{open == true ? (
<Box sx={{ padding: '24px' }}>
<Card sx={{ padding: '24px' }}>
<Grid container spacing={6}>
<Grid item xs={8}>
<Typography variant="body1" sx={{ fontWeight: 'bold'}}>
Excluded Only for :
</Typography>
</Grid>
<Grid item xs={12}>
<Grid container spacing={2}>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
MSC :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
{row?.rules?.msc && row?.rules?.msc[0] ? (
row?.rules?.msc[0].split(',').map((text,i) => {
return (
<Typography key={i} component="div">
<Label>{text}</Label>
</Typography>
)
})
) : '-'}
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Gender :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
{row?.rules?.gender && row?.rules?.gender[0] ? (
<Typography component="div">
<Label>{row?.rules?.gender[0]}</Label>
</Typography>
) : '-'}
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Min Age :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
<Typography component="div">
{row?.rules?.min_age && row?.rules?.min_age[0] ? row?.rules?.min_age[0] : '-'}
</Typography>
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Max Age :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
<Typography component="div">
{row?.rules?.max_age && row?.rules?.max_age[0] ? row?.rules?.max_age[0] : '-'}
</Typography>
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Play :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
<Typography component="div">
{row?.rules?.plan && row?.rules?.plan[0] ? row?.rules?.plan[0] : '-'}
</Typography>
</Grid>
</Grid>
</Grid>
</Grid>
</Card>
</Box>
) : null }
{/* {open == true ? (
openEdit == false ? (
<Box sx={{ borderBottom: 1 }}>
{Object.keys(row.rules).length ? (
<div>
<div>
<Typography variant="body" sx={{ fontWeight: 'bold' }}>
Excluded Only for :
</Typography>
@@ -560,12 +658,7 @@ export default function List(props: any) {
Plan : {row.rules.plan.join(', ') ?? '-'}
</Typography>
)}
</div>
) : (
<Typography variant="body2" gutterBottom component="div">
Excluded for All
</Typography>
)}
</div>
</Box>
) : (
// <CollapseEdit row={row} index={index} plans={plans} />
@@ -752,7 +845,7 @@ export default function List(props: any) {
</Stack>
</Box>
)
) : null}
) : null} */}
</Collapse>
</TableCell>
</TableRow>
@@ -866,6 +959,8 @@ export default function List(props: any) {
loadDataTableData();
}, []);
const navigate = useNavigate()
return (
<Stack>
<ImportForm />
@@ -874,9 +969,9 @@ export default function List(props: any) {
{/* The Main Table */}
<TableContainer component={Paper}>
<Table aria-label="collapsible table">
<TableBody>
<TableHead>
<TableRow>
<TableCell style={headStyle} align="left" />
<TableCell align="left" width={50} />
<TableCell style={headStyle} align="left">
Service
</TableCell>
@@ -893,15 +988,17 @@ export default function List(props: any) {
Status
</TableCell>
<TableCell style={headStyle} align="left">
Action
</TableCell>
<TableCell style={headStyle} align="left">
<Link to={`/corporate/${corporate_id}/diagnosis-exclusions/history`}>
<HistoryIcon />
</Link>
<TableMoreMenu actions={
<>
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions/history`)}>
<HistoryIcon />
History
</MenuItem>
</>
} />
</TableCell>
</TableRow>
</TableBody>
</TableHead>
{dataTableIsLoading ? (
<TableBody>
<TableRow>

View File

@@ -0,0 +1,189 @@
import * as Yup from 'yup';
import { enqueueSnackbar, useSnackbar } from 'notistack';
import { useNavigate } from 'react-router-dom';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
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, Button, Grid, Stack, Typography, Chip, Autocomplete } from '@mui/material';
import { CorporateService } from '../../@types/corporates';
// components
import { FormProvider, RHFTextField, RHFSwitch, RHFSelect } from '../../components/hook-form';
import axios from '../../utils/axios';
import { LaravelPaginatedData } from '../../@types/paginated-data';
// import { Contact } from '../../../../@types/contact';
import { Link, useParams, useSearchParams } from 'react-router-dom';
// @mui
// components
import MuiDialog from '../../components/MuiDialog';
// React
import { ReactElement } from 'react';
// ----------------------------------------------------------------------
const HeaderStyle = styled('header')(({ theme }) => ({
display: 'flex',
alignItems: 'center',
padding: theme.spacing(2),
justifyContent: 'space-between',
}));
type DataContent = {
info: string;
date: string;
time: string;
};
type MuiDialogProps = {
title?: {
name?: string;
icon?: string;
};
openDialog: boolean;
setOpenDialog: Function;
content?: ReactElement;
id: number;
};
type FormValuesProps = {
value: string;
active: boolean;
};
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
const DialogUpdateStatus = ({ title, openDialog, setOpenDialog, id }: MuiDialogProps) => {
const NewCorporateSchema = Yup.object().shape({
reason: Yup.string().required('Corporate Status is required'),
});
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
});
const {
reset,
handleSubmit,
formState: { isSubmitting },
} = methods;
useEffect(() => {
if (openDialog === false) {
reset();
}
}, [openDialog, reset]);
const handleActivate = (id: number, status: string) => {
axios
.put(`/corporates/${id}/activation`, {
active: status == 'active',
})
.then((res) => {
console.log(res)
enqueueSnackbar(
'Succes',
{ variant: 'success' }
);
})
.catch((error) => {
// console.log('asdasd', error.response.data.message)
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
};
const onSubmit = async (row : ReturnType<typeof createData>) => {
try {
handleActivate(1, 'active')
} catch (error: any) {
}
const ascent = document?.querySelector('ascent');
if (ascent != null) {
ascent.innerHTML = '';
}
};
function createData(corporateService: CorporateService): CorporateService {
return {
...corporateService,
};
}
const getContent = (props: { row: ReturnType<typeof createData> }) => (
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<Stack spacing={3}>
<Box sx={{ width: '100%', typography: 'body1', p: 2, mt: 1 }}>
<Grid item xs={12}>
<RHFSelect
name="reason"
label="Reason for update"
>
<option value=""></option>
<option value="Agreement changed">Agreement changed</option>
<option value="Endorsement">Endorsement</option>
<option value="Renewal">Renewal</option>
<option value="Worng Setting">Worng Setting</option>
</RHFSelect>
</Grid>
<Box sx={{ pt: 5 }}>
<Stack
alignItems="center"
justifyContent="flex-end"
direction={{ xs: 'column', md: 'row' }}
// sx={{ textAlign: { xs: 'center', md: 'left' } }}
spacing={2}
>
<Stack direction="row" spacing={1}>
<Button
sx={{
boxShadow: 'none',
}}
variant="outlined"
size="medium"
fullWidth={true}
onClick={() => setOpenDialog(false)}
>
Cancel
</Button>
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)' }}
type="submit"
variant="contained"
size="medium"
fullWidth={true}
loading={isSubmitting}
>
Save
</LoadingButton>
</Stack>
</Stack>
</Box>
</Box>
</Stack>
</FormProvider>
);
return (
<MuiDialog
title={title}
openDialog={openDialog}
setOpenDialog={setOpenDialog}
content={getContent()}
maxWidth="sm"
/>
);
};
export default DialogUpdateStatus;

View File

@@ -41,6 +41,14 @@ import axios from '../../../utils/axios';
import { CorporatePlan } from '../../../@types/corporates';
import { LaravelPaginatedData } from '../../../@types/paginated-data';
import BasePagination from '../../../components/BasePagination';
import TableMoreMenu from '@/components/table/TableMoreMenu';
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
import HistoryIcon from '@mui/icons-material/History';
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
import { enqueueSnackbar } from 'notistack';
export default function PlanList() {
const { themeStretch } = useSettings();
@@ -97,74 +105,33 @@ export default function PlanList() {
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.id}</TableCell>
<TableCell align="left">{row.code}</TableCell>
<TableCell align="left">{row.name}</TableCell>
<TableCell align="left">{row.description}</TableCell>
<TableCell align="right">
<Button variant="outlined" color="success" size="small">
Active
</Button>
</TableCell>
<TableCell align="right">
<Link to={`/corporate/${row.corporate_id}/divisions/${row.id}/edit`}>
<Button variant="outlined" color="success" size="small">
Edit
</Button>
</Link>
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={10}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box sx={{ borderBottom: 1 }}>
<Typography variant="body2" gutterBottom component="div">
No Extra Data
</Typography>
</Box>
{false && (
<Box sx={{ margin: 1 }}>
<Typography variant="h6" gutterBottom component="div">
Rules
</Typography>
<Table size="small" aria-label="purchases">
<TableHead>
<TableRow>
<TableCell>Date</TableCell>
<TableCell>Customer</TableCell>
<TableCell align="right">Amount</TableCell>
<TableCell align="right">Total price ($)</TableCell>
</TableRow>
</TableHead>
<TableBody>
{/* {row.history ? row.history.map((historyRow) => ( */}
<TableRow key={row.id}>
<TableCell component="th" scope="row">
{row.start} - {row.end}
</TableCell>
<TableCell>{row.start}</TableCell>
<TableCell align="right">{row.start}</TableCell>
<TableCell align="right">{row.start}</TableCell>
</TableRow>
{/* ))
: (
<TableRow>
<TableCell colSpan={8}>No Data</TableCell>
</TableRow>
)
} */}
</TableBody>
</Table>
</Box>
)}
</Collapse>
<TableCell align="center">{row.id ? row.id : '-'}</TableCell>
<TableCell align="left">{row.code ? row.code : '-'}</TableCell>
<TableCell align="left">{row.name ? row.name : '-'}</TableCell>
<TableCell align="left">{row.description ? row.description : '-'}</TableCell>
<TableCell align="left">
<TableMoreMenu actions={
<>
<MenuItem onClick={() => navigate ('')}>
<FindInPageOutlinedIcon />
Details
</MenuItem>
<MenuItem onClick={() => handleEditData(row)}>
<EditOutlinedIcon />
Edit
</MenuItem>
<MenuItem onClick={() => handleEditDataStatus(row)}>
<CachedOutlinedIcon />
Update Status
</MenuItem>
<MenuItem onClick={() => navigate ('')}>
<HistoryIcon />
History
</MenuItem>
</>
}
/>
</TableCell>
</TableRow>
</React.Fragment>
@@ -194,7 +161,6 @@ export default function PlanList() {
const response = await axios.get('/corporates/' + corporate_id + '/divisions', {
params: filter,
});
// console.log(response.data);
setDataTableLoading(false);
setDataTableData(response.data);
@@ -219,48 +185,147 @@ export default function PlanList() {
loadDataTableData();
}, []);
// Dialog for devisions
const [openDialog, setOpenDialog] = useState(false);
//validation dialog
const [nameField, setNameField] = useState('');
const [nameFieldError, setNameFieldError] = useState('');
const [codeField, setCodeField] = useState('');
const [codeFieldError, setCodeFieldError] = useState('');
const [descriptionField, setDescriptionField] = useState('');
// ID for edit data
const [idField, setIdField] = useState('');
const isRequiredFieldsFilled = () => {
return nameField.trim() !== '' && codeField.trim() !== '';
};
const handleAddData = () => {
setOpenDialog(true);
}
const handleCloseDialog = () => {
setOpenDialog(false);
setNameField('');
setCodeField('');
setDescriptionField('');
setIdField('');
}
const handleSaveData = () => {
const addData = {
code: codeField,
name: nameField,
description: descriptionField,
};
// Check conditions add or update data
if(idField)
{
// Update data
axios
.put('/corporates/'+corporate_id+'/divisions/'+idField+'', addData)
.then((response) => {
enqueueSnackbar('Data saved successfully', { variant: 'success' });
loadDataTableData();
handleCloseDialog();
})
.catch((error) => {
enqueueSnackbar('Failed to add data', { variant: 'error' });
});
}
else{
// Save data
axios
.post('/corporates/'+corporate_id+'/divisions', addData)
.then((response) => {
enqueueSnackbar('Data saved successfully', { variant: 'success' });
loadDataTableData();
handleCloseDialog();
})
.catch((error) => {
enqueueSnackbar('Failed to add data', { variant: 'error' });
});
}
}
//Edit data
const handleEditData = (data) => {
setIdField(data.id)
setNameField(data.name);
setCodeField(data.code);
setDescriptionField(data.description);
setOpenDialog(true);
}
// End dialog for devisions
// Dialog for update status devisions
const [openDialogStatus, setOpenDialogStatus] = useState(false);
// Active for update status
const [activeField, setActiveField] = useState('');
const handleCloseDialogStatus = () => {
setOpenDialogStatus(false);
setNameField('');
setCodeField('');
setDescriptionField('');
setIdField('');
setActiveField('');
}
const handleSaveDataStatus = () => {
}
const handleEditDataStatus = (data) => {
setIdField(data.id)
setNameField(data.name);
setCodeField(data.code);
setDescriptionField(data.description);
setActiveField(data.active);
setOpenDialogStatus(true);
}
// End dialog for update status devisions
return (
<Stack>
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
<SearchInput onSearch={applyFilter} />
<Link to={`/corporate/${corporate_id}/divisions/create`}>
<Button
component="button"
id="upload-button"
variant="outlined"
startIcon={<AddIcon />}
sx={{ p: 1.8 }}
>
Create
</Button>
</Link>
<Button
component="button"
id="upload-button"
startIcon={<AddIcon />}
sx={{ p: 1.8, color: '#FFFFFF', backgroundColor: '#19BBBB', width: '125px', height: '48px' }}
onClick={handleAddData}
>
Create
</Button>
</Stack>
<Card>
{/* The Main Table */}
<TableContainer component={Paper}>
<Table aria-label="collapsible table">
<TableBody>
<TableHead>
<TableRow>
<TableCell style={headStyle} align="left" />
<TableCell style={headStyle} align="left">
ID
<TableCell sx={{width: '10%'}} align="center">
<Typography variant='subtitle2'>ID</Typography>
</TableCell>
<TableCell style={headStyle} align="left">
Code
<TableCell sx={{width: '10%'}} align="left">
<Typography variant='subtitle2'>Code</Typography>
</TableCell>
<TableCell style={headStyle} align="left">
Name
<TableCell sx={{width: '20%'}} align="left">
<Typography variant='subtitle2'>Name</Typography>
</TableCell>
<TableCell style={headStyle} align="left">
Description
<TableCell sx={{width: '50%'}} align="left">
<Typography variant='subtitle2'>Description</Typography>
</TableCell>
<TableCell sx={{width: '10%'}} align="left">
</TableCell>
</TableRow>
</TableBody>
</TableHead>
{dataTableIsLoading ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align="center">
<TableCell colSpan={4} align="center">
Loading
</TableCell>
</TableRow>
@@ -268,7 +333,7 @@ export default function PlanList() {
) : dataTableData.data.length == 0 ? (
<TableBody>
<TableRow>
<TableCell colSpan={8} align="center">
<TableCell colSpan={4} align="center">
No Data
</TableCell>
</TableRow>
@@ -284,6 +349,101 @@ export default function PlanList() {
</TableContainer>
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
</Card>
{/* Dialog */}
<Dialog open={openDialog} onClose={handleCloseDialog} fullWidth={true}>
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
<Stack direction="row" alignItems="center" justifyContent="space-between">
<Stack direction="row" alignItems='center' spacing={1}>
{idField ? (
<>
<Typography variant="h6">Edit Data</Typography>
</>
): (
<>
<Typography variant="h6">Create Data</Typography>
</>
)}
</Stack>
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialog}>
<CloseIcon />
</IconButton>
</Stack>
</DialogTitle>
<DialogContent>
<Stack spacing={2} sx={{marginTop: 2}}>
<TextField
label="Code"
required
value={codeField ? codeField : ''}
onChange={(e) =>{
setCodeField(e.target.value);
setCodeFieldError(e.target.value.trim() === '' ? 'This field is required' : '');
}}
fullWidth
inputProps={{ maxLength: 50 }}
error={!!codeFieldError}
helperText={codeFieldError}
/>
<TextField
label="Name"
required
value={nameField ? nameField : ''}
onChange={(e) =>{
setNameField(e.target.value);
setNameFieldError(e.target.value.trim() === '' ? 'This field is required' : '');
}}
fullWidth
inputProps={{ maxLength: 50 }}
error={!!nameFieldError}
helperText={nameFieldError}
/>
<TextField
label="Description"
value={descriptionField ? descriptionField : ''}
onChange={(e) =>{
setDescriptionField(e.target.value);
}}
fullWidth
inputProps={{ maxLength: 255 }}
/>
</Stack>
</DialogContent>
<DialogActions>
<Button onClick={handleCloseDialog}>Cancel</Button>
<Button onClick={handleSaveData} variant="contained" color="primary" disabled={!isRequiredFieldsFilled()}>Save</Button>
</DialogActions>
</Dialog>
{/* Dialog Update Status */}
<Dialog open={openDialogStatus} onClose={handleCloseDialogStatus} fullWidth={true}>
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
<Stack direction="row" alignItems="center" justifyContent="space-between">
<Stack direction="row" alignItems='center' spacing={1}>
<Typography variant="h6">Update Status</Typography>
</Stack>
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogStatus}>
<CloseIcon />
</IconButton>
</Stack>
</DialogTitle>
<DialogContent>
<Stack spacing={2} padding={2}>
<Typography variant='body1'>Are you sure to inactive this division ?</Typography>
<Card>
<Stack direction='row' spacing={2}>
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Code</Typography>
<Typography variant='subtitle2' sx={{width: '70%'}}>{codeField}</Typography>
</Stack>
</Card>
</Stack>
</DialogContent>
<DialogActions>
<Button onClick={handleCloseDialogStatus}>Cancel</Button>
<Button onClick={handleSaveDataStatus} variant="contained" color="error">Inactive</Button>
</DialogActions>
</Dialog>
</Stack>
);
}

View File

@@ -496,7 +496,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
<Card sx={{ p: 3 }}>
<Stack spacing={3}>
<Grid item xs={12}>
<Typography variant="h5" color="#19BBBB">Corporate Profile</Typography>
<Typography variant="h5" color={'primary'}>Corporate Profile</Typography>
</Grid>
<Typography variant='subtitle1' color="#637381">Corporate Profile*</Typography>
@@ -627,7 +627,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
{/* <Card sx={{ p:3, mb:3, background: 'gray', color: 'white' }}><Typography>Policy Detail</Typography></Card> */}
<Card sx={{ p: 3 }}>
<Stack spacing={3} mt={2}>
<Typography variant="h5" color="#19BBBB">Policy Detail</Typography>
<Typography variant="h5" color={'primary'}>Policy Detail</Typography>
<input type="hidden" name="policy_id" />
@@ -733,7 +733,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
)}
{/* Type contrack */}
<Grid item xs={12} md={12}>
{/* <Grid item xs={12} md={12}>
<Card sx={{ p: 3 }}>
<Stack direction="row" spacing={2}>
<Grid item xs={12} md={6}>
@@ -806,18 +806,32 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
</Grid>
</Stack>
</Card>
</Grid>
</Grid> */}
<Grid item xs={12} md={4}>
<LoadingButton
type="submit"
variant="contained"
size="large"
fullWidth={true}
loading={isSubmitting}
>
{!isEdit ? 'Save New Corporate' : 'Save Corporate'}
</LoadingButton>
<Grid item xs={12} md={12} >
<Stack direction="row" alignItems="center" justifyContent="flex-end">
<Button
sx={{
margin: 1
}}
type="submit"
variant="contained"
size="large"
color='inherit'
onClick={() => navigate(`/corporates`)}
>
Cancel
</Button>
<LoadingButton
type="submit"
variant="contained"
size="large"
// fullWidth={true}
loading={isSubmitting}
>
Save
</LoadingButton>
</Stack>
</Grid>
</Grid>
</FormProvider>

View File

@@ -139,7 +139,7 @@ export default function CustomizedAccordions() {
aria-controls={`panel${index}d-content`}
id={`panel${index}d-header`}
>
<Typography>{`Data has ${item.action} by ${item.user_id} on ${fDateTime(item.updated_at)}`}</Typography>
<Typography variant='subtitle1'>{`Data has ${item.action} by ${item.user_id} on ${fDateTime(item.updated_at)}`}</Typography>
</AccordionSummary>
<AccordionDetails>
<TableHead>

View File

@@ -24,24 +24,33 @@ import {
Typography,
Badge,
Stack,
Dialog,
} from '@mui/material';
import * as Yup from 'yup';
// icon
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import PublishIcon from '@mui/icons-material/Publish';
import AddIcon from '@mui/icons-material/Add';
import HistoryIcon from '@mui/icons-material/History';
import MoreVertIcon from '@mui/icons-material/MoreVert';
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
// hooks
import useSettings from '../../hooks/useSettings';
// components
import Page from '../../components/Page';
import DialogUpdateStatus from '../../components/DialogUpdateStatus';
import axios from '../../utils/axios';
import useAuth from '../../hooks/useAuth';
import { useForm } from 'react-hook-form'
import { Link, NavLink as RouterLink, useNavigate, useSearchParams } from 'react-router-dom';
import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
import React, { ChangeEvent, ReactElement, useEffect, useRef, useState } from 'react';
import { Theme, useTheme } from '@mui/material/styles';
import { Corporate } from '../../@types/corporates';
import { LaravelPaginatedData } from '../../@types/paginated-data';
@@ -51,11 +60,14 @@ import { fCurrency } from '../../utils/formatNumber';
import { enqueueSnackbar } from 'notistack';
import { fDate } from '@/utils/formatTime';
import Popover from '@mui/material/Popover';
import PopupState, { bindTrigger, bindPopover } from 'material-ui-popup-state';
import ButtonStyles from '../../theme/overrides/Button';
import TableMoreMenu from '@/components/table/TableMoreMenu';
import Iconify from '@/components/Iconify';
import Label from '@/components/Label';
import { FormProvider, RHFSelect } from '@/components/hook-form';
import { LoadingButton } from '@mui/lab';
import { yupResolver } from '@hookform/resolvers/yup';
export default function Corporates() {
@@ -63,12 +75,37 @@ export default function Corporates() {
const [searchParams, setSearchParams] = useSearchParams();
const navigate = useNavigate()
// Type
type DataContent = {
code: string;
name: string;
id: string;
status: string|number;
};
type MuiDialogProps = {
title?: {
name?: string;
icon?: string;
};
openDialog: boolean;
setOpenDialog: Function;
content?: ReactElement;
data?: DataContent[];
};
type FormValuesProps = {
value: string;
active: boolean;
};
// Called on every row to map the data to the columns
function createData(corporate: Corporate): Corporate {
return {
...corporate,
};
}
// Dummy Default Data
const [dataTableIsLoading, setDataTableLoading] = React.useState(true);
@@ -161,6 +198,8 @@ export default function Corporates() {
typeof value === 'string' ? value.split(',') : value
);
};
// END FILTER SELECT
// Component Search Input
@@ -258,7 +297,11 @@ export default function Corporates() {
Import
</Button> */}
<Link to={'/corporates/create'}>
<Button variant="contained" startIcon={<AddIcon sx={{}} />} sx={{ p: 1.8, typography: 'subtitle2', backgroundColor: '#19BBBB' }}>
<<<<<<< HEAD
<Button variant="contained" startIcon={<AddIcon sx={{}} />} sx={{ p: 1.8, typography: 'subtitle2' }}>
=======
<Button variant="contained" startIcon={<AddIcon sx={{}} />} sx={{ p: 1.8, typography: 'subtitle2', backgroundColor: '#19BBBB' }}>
>>>>>>> 8a3b0f3d1185955685128bc197a50193b837ddc1
New Corporate
</Button>
</Link>
@@ -274,36 +317,154 @@ export default function Corporates() {
// Component Row
// Generate the every row of the table
const [isDialogOpen, setDialogOpen] = useState(false)
let titles = {
name: 'Update Status',
icon: '-'
}
const [dataValue, setDataValue] = useState();
const [dataDescription, setDescriptionValue] = useState('');
const NewCorporateSchema = Yup.object().shape({
reason: Yup.string().required('Reason Edit is required'),
});
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
});
const {
reset,
handleSubmit,
formState: { isSubmitting },
} = methods;
const onSubmit = async (row : any) => {
try {
console.log(dataValue)
handleUpdate(dataValue.id, dataValue.status, row.reason)
} catch (error: any) {
console.log('data gagal');
}
const ascent = document?.querySelector('ascent');
if (ascent != null) {
ascent.innerHTML = '';
}
};
const handleUpdate = (id: string, active: number, reason: string) => {
axios
.put(`/corporates/${id}/activation`, {
active: active,
reason: reason
})
.then((res) => {
window.location.reload();
});
}
const getContent = () => (
<>
<Stack paddingX={2} paddingY={2}>
<Typography variant='subtitle1'>Are you sure to {dataValue?.status == 1 ? 'inactive' : 'active'} this service ?</Typography>
</Stack>
<Card>
<Grid container paddingX={2} paddingY={2}>
<Grid item xs={4} md={4}>
<Typography variant='inherit'>Code</Typography>
</Grid>
<Grid item xs={8}>
<Typography variant='subtitle1'>{dataValue?.code}</Typography>
</Grid>
<Grid item xs={4} md={4} marginTop={2}>
<Typography variant='inherit'>Corporate Name</Typography>
</Grid>
<Grid item xs={8} marginTop={2}>
<Typography variant='subtitle1'>{dataValue?.name}</Typography>
</Grid>
</Grid>
</Card>
<Typography marginTop={5} marginBottom={3} variant='subtitle1'>
Reason for update*
</Typography>
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<RHFSelect
name="reason"
label="Reason for update"
>
<option value=""></option>
<option value="Agreement changed">Agreement changed</option>
<option value="Endorsement">Endorsement</option>
<option value="Renewal">Renewal</option>
<option value="Worng Setting">Worng Setting</option>
</RHFSelect>
<Stack
alignItems="center"
justifyContent="flex-end"
direction={{ xs: 'column', md: 'row' }}
spacing={2}
marginTop={5}
>
<Stack direction="row" spacing={1}>
<Button
sx={{
boxShadow: 'none',
}}
variant="outlined"
size="medium"
fullWidth={true}
onClick={() => setDialogOpen(false)}
>
Cancel
</Button>
{dataValue?.status == 1 ?
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
type="submit"
variant="contained"
size="medium"
fullWidth={true}
loading={isSubmitting}
color='error'
>
Inactive
</LoadingButton>
:
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
type="submit"
variant="contained"
size="medium"
fullWidth={true}
loading={isSubmitting}
color='success'
>
Active
</LoadingButton>
}
</Stack>
</Stack>
</FormProvider>
</>
);
function Row(props: { row: ReturnType<typeof createData> }) {
const { row } = props;
const [open, setOpen] = React.useState(false);
const navigate = useNavigate()
const handleActivate = (model: any, status: string) => {
axios
.put(`/corporates/${row.id}/activation`, {
// service_code: service.service_code,
active: status == 'active',
})
.then((res) => {
setDataTableData({
...dataTableData,
data: dataTableData.data.map((model) => {
let updatedModel = model;
if (row.id == model.id) {
updatedModel.active = res.data.corporate.active;
}
return updatedModel;
}),
});
})
.catch((error) => {
// console.log('asdasd', error.response.data.message)
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
const handleActivate = (isOpen: boolean, dataValue: DataContent) => {
setDialogOpen(isOpen)
setDataValue(dataValue)
setDescriptionValue('Are you sure to inactive this coporate ?')
};
return (
@@ -318,31 +479,37 @@ export default function Corporates() {
<TableCell align="left">{row.name}</TableCell>
<TableCell align="left">
{row.active == 1 && (
<Button
variant="outlined"
color="success"
size="small"
onClick={() => {
handleActivate(row, 'inactive');
}}
>
<Label color='success'>
Active
</Button>
</Label>
// <Button
// variant="outlined"
// color="success"
// size="small"
// onClick={() => {
// handleActivate(row, 'inactive');
// }}
// >
// Active
// </Button>
)}
{row.active != 1 && (
<Button
variant="outlined"
color="error"
size="small"
onClick={() => {
handleActivate(row, 'active');
}}
>
<Label color='error'>
Inactive
</Button>
</Label>
// <Button
// variant="outlined"
// color="error"
// size="small"
// onClick={() => {
// handleActivate(row, 'active');
// }}
// >
// Inactive
// </Button>
)}
</TableCell>
<TableCell align="right">
<TableCell align="right" sx={{borderBottom: 'unset'}}>
{/* <Stack direction="row" justifyContent="flex-end" spacing={1}>
<Link to={`/corporates/${row.id}/edit`}>
<Button variant="outlined" color="primary" size="small">
@@ -360,10 +527,10 @@ export default function Corporates() {
</Stack> */}
<TableMoreMenu actions={
<>
{/* <MenuItem onClick={() => navigate(`/corporates/${row.id}/edit`)}>
<EditOutlinedIcon />
View
</MenuItem> */}
<MenuItem onClick={() => setOpen(!open)}>
<FindInPageOutlinedIcon />
Detail
</MenuItem>
<MenuItem onClick={() => navigate(`/corporates/${row.id}/edit`)}>
<EditOutlinedIcon />
Edit
@@ -376,148 +543,132 @@ export default function Corporates() {
<HistoryIcon />
History
</MenuItem>
<MenuItem onClick={() => handleActivate(true, {code: row.code, name: row.name, id:row.id, status: row.active})}>
<CachedOutlinedIcon />
Update Status
</MenuItem>
</>
} />
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
{/* COLLAPSIBLE Detail ROW */}
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={9999}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box sx={{ margin: 1, borderBottom: 1, pb: 2 }}>
<Typography sx={{ fontWeight: '600', mb: 1 }}>Current Policy Detail</Typography>
<Grid container>
<Grid item xs={6}>
<Grid container>
<Grid item xs={6}>
Policy Code
</Grid>
<Grid item xs={6}>
: {row.current_policy?.code}
</Grid>
<Card sx={{paddingX: 2, paddingY: 2, marginBottom:3}}>
<Box sx={{ margin: 1, pb: 2 }}>
<Grid container>
<Grid item xs={6}>
<Typography sx={{ fontWeight: '600', mb: 1 }}>Current Policy Detail</Typography>
<Grid container>
<Grid item xs={4}>
Policy Code :
</Grid>
<Grid item xs={6}>
{row.current_policy?.code}
</Grid>
<Grid item xs={6}>
Number of Plan
</Grid>
<Grid item xs={6}>
: {row.corporate_plans_count}
</Grid>
<Grid item xs={4}>
Number of Plan :
</Grid>
<Grid item xs={6}>
{row.corporate_plans_count}
</Grid>
<Grid item xs={6}>
Number of Benefit
</Grid>
<Grid item xs={6}>
: {row.corporate_benefits_count}
</Grid>
</Grid>
</Grid>
<Grid item xs={4}>
Number of Benefit :
</Grid>
<Grid item xs={6}>
{row.corporate_benefits_count}
</Grid>
<Grid item xs={6}>
<Grid container>
<Grid item xs={6}>
Period
</Grid>
<Grid item xs={6}>
<Box sx={{ display: 'flex', placeContent: 'space-between' }}>
{/* <span>: {fDate(row.current_policy?.start)}</span>- */}
{/* <span>{fDate(row.current_policy?.end)}</span> */}
</Box>
</Grid>
<Grid item xs={6}>
Total Premi
</Grid>
<Grid item xs={6}>
{row.current_policy ? (
<Grid item xs={4}>
Period :
</Grid>
<Grid item xs={6}>
<Box sx={{ display: 'flex', placeContent: 'space-between' }}>
<span>
: {fCurrency(row.current_policy?.total_premi).split(' ')[0]}
</span>
<span>{fCurrency(row.current_policy?.total_premi).split(' ')[1]}</span>
{/* <span>: {fDate(row.current_policy?.start)}</span>- */}
{/* <span>{fDate(row.current_policy?.end)}</span> */}
</Box>
) : (
'-'
)}
</Grid>
</Grid>
<Grid item xs={6}>
Minimal Deposit
</Grid>
<Grid item xs={6}>
{row.current_policy ? (
<Box sx={{ display: 'flex', placeContent: 'space-between' }}>
<span>
: {fCurrency(row.current_policy?.minimal_deposit_net).split(' ')[0]}
</span>
<span>
{fCurrency(row.current_policy?.minimal_deposit_net).split(' ')[1]}
</span>
</Box>
) : (
'-'
)}
</Grid>
<Grid item xs={4}>
Total Premi :
</Grid>
<Grid item xs={6}>
{row.current_policy ? (
<Box sx={{ display: 'flex', placeContent: 'space-between' }}>
<span>
{fCurrency(row.current_policy?.total_premi).split(' ')[0]}
</span>
<span>{fCurrency(row.current_policy?.total_premi).split(' ')[1]}</span>
</Box>
) : (
'-'
)}
</Grid>
<Grid item xs={6}>
Corporate Limit
</Grid>
<Grid item xs={6}>
{row.current_policy ? (
<Box sx={{ display: 'flex', placeContent: 'space-between' }}>
<span>
: {fCurrency(row.current_policy?.limit_balance).split(' ')[0]}
</span>
<span>
{fCurrency(row.current_policy?.limit_balance).split(' ')[1]}
</span>
</Box>
) : (
'-'
)}
<Grid item xs={4}>
Minimal Deposit :
</Grid>
<Grid item xs={6}>
{row.current_policy ? (
<Box sx={{ display: 'flex', placeContent: 'space-between' }}>
<span>
{fCurrency(row.current_policy?.minimal_deposit_net).split(' ')[0]}
</span>
<span>
{fCurrency(row.current_policy?.minimal_deposit_net).split(' ')[1]}
</span>
</Box>
) : (
'-'
)}
</Grid>
<Grid item xs={4}>
Corporate Limit :
</Grid>
<Grid item xs={6}>
{row.current_policy ? (
<Box sx={{ display: 'flex', placeContent: 'space-between' }}>
<span>
{fCurrency(row.current_policy?.limit_balance).split(' ')[0]}
</span>
<span>
{fCurrency(row.current_policy?.limit_balance).split(' ')[1]}
</span>
</Box>
) : (
'-'
)}
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
<Typography sx={{ fontWeight: '600', mb: 1, mt: 2 }}>Member Detail</Typography>
<Grid container>
<Grid item xs={6}>
<Grid container>
<Grid item xs={6}>
Total Member
</Grid>
<Grid item xs={6}>
: {row.employees_count}
<Grid item xs={6}>
<Typography sx={{ fontWeight: '600', mb: 1 }}>Member Detail</Typography>
<Grid container>
<Grid item xs={6}>
Total Member :
</Grid>
<Grid item xs={6}>
{row.employees_count}
</Grid>
<Grid item xs={6}>
Total Claim This Month :
</Grid>
<Grid item xs={6}>
0
</Grid>
</Grid>
</Grid>
</Grid>
<Grid item xs={6}>
<Grid Grid container>
<Grid item xs={6}>
Total Claim This Month
</Grid>
<Grid item xs={6}>
: 0
</Grid>
</Grid>
</Grid>
</Grid>
{/* <Typography sx={{ fontWeight: '600', mb: 1, mt: 2 }}>Sub Corporate</Typography>
<Grid container>
<Grid item xs={12}>
<Grid container>
<Grid item xs={6}>
Sub Corporates ({row.sub_corporates.length})
</Grid>
<Grid item xs={6}>
: {row.sub_corporates?.map((corp) => corp.name).join(', ')}
</Grid>
</Grid>
</Grid>
</Grid> */}
</Box>
</Box>
</Card>
</Collapse>
</TableCell>
</TableRow>
@@ -594,6 +745,15 @@ export default function Corporates() {
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
{/* </Card> */}
</Container>
<DialogUpdateStatus
openDialog={isDialogOpen}
setOpenDialog={setDialogOpen}
title={titles}
data={dataValue}
description={dataDescription}
content={getContent()}
/>
</Page>
);
}

View File

@@ -1,4 +1,5 @@
// @mui
import * as Yup from 'yup';
import {
Box,
Button,
@@ -28,17 +29,22 @@ import {
ButtonGroup,
Grid,
Tooltip,
Autocomplete,
} 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';
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import HistoryIcon from '@mui/icons-material/History';
// hooks
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
import useSettings from '../../../hooks/useSettings';
import { Link, useParams, useSearchParams } from 'react-router-dom';
import { Form, useNavigate, Link, useParams, useSearchParams } from 'react-router-dom';
// components
import axios from '../../../utils/axios';
import { Plan } from '../../../@types/corporates';
@@ -47,6 +53,11 @@ import BasePagination from '../../../components/BasePagination';
import { enqueueSnackbar } from 'notistack';
import { LoadingButton } from '@mui/lab';
import DialogLog from './sections/DialogLog';
import { FormProvider, RHFSelect } from '@/components/hook-form';
import { Download, Edit } from '@mui/icons-material';
import TableMoreMenu from '@/components/table/TableMoreMenu';
import Label from '@/components/Label';
import DialogUpdateStatus from '@/components/DialogUpdateStatus';
export default function CorporatePlanList() {
const { themeStretch } = useSettings();
@@ -54,6 +65,7 @@ export default function CorporatePlanList() {
const [searchParams, setSearchParams] = useSearchParams();
const [importResult, setImportResult] = useState(null);
const navigate = useNavigate()
const [openDialog, setOpenDialog] = useState(false);
const [dialogTitle, setDialogTitle] = useState('');
const [isDialog, setIsDialog] = useState('');
@@ -207,33 +219,142 @@ export default function CorporatePlanList() {
/>
{!currentImportFileName && (
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
<SearchInput onSearch={applyFilter} />
<Grid container spacing={2}>
<Grid item xs={3.5}>
<SearchInput onSearch={applyFilter} />
</Grid>
<Grid item xs={2}>
<Autocomplete
id="combo-box-demo"
options={[
{
value: 'IP',
label: 'Inpatient'
},
{
value: 'OP',
label: 'Outpatient'
},
]}
multiple
limitTags={1}
fullWidth
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) =>
option.value === value.value
}
renderInput={(params) => (
<TextField {...params} label="Service" variant="outlined" />
)}
/>
</Grid>
<Grid item xs={1.5}>
<Autocomplete
id="combo-box-demo"
options={[
{
value: 'IP',
label: 'IP-001'
},
{
value: 'OP',
label: 'OP-001'
},
]}
multiple
limitTags={1}
fullWidth
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) =>
option.value === value.value
}
renderInput={(params) => (
<TextField {...params} label="Plan" variant="outlined" />
)}
/>
</Grid>
<Grid item xs={1.5}>
<Autocomplete
id="combo-box-demo"
options={[
{
value: 'IP',
label: 'IP-001'
},
{
value: 'OP',
label: 'OP-001'
},
]}
multiple
limitTags={1}
fullWidth
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) =>
option.value === value.value
}
renderInput={(params) => (
<TextField {...params} label="Code" variant="outlined" />
)}
/>
</Grid>
<Grid item xs={1.5}>
<Autocomplete
id="combo-box-demo"
options={[
{
value: 'IP',
label: 'IP-001'
},
{
value: 'OP',
label: 'OP-001'
},
]}
multiple
limitTags={1}
fullWidth
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) =>
option.value === value.value
}
renderInput={(params) => (
<TextField {...params} label="Type" variant="outlined" />
)}
/>
</Grid>
<Grid item xs={1.5}>
<Button
id="import-button"
variant="contained"
startIcon={<Download />}
fullWidth={true}
sx={{ p: 1.8 }}
aria-controls={createMenu ? 'basic-menu' : undefined}
aria-haspopup="true"
aria-expanded={createMenu ? 'true' : undefined}
onClick={handleClick}
>
Import
</Button>
<Menu
id="import-button"
anchorEl={anchorEl}
open={createMenu}
onClose={handleClose}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
<MenuItem onClick={handleImportButton}>Import</MenuItem>
<MenuItem onClick={() => {handleGetTemplate('plan-benefit')}}>Download Template</MenuItem>
<MenuItem onClick={() => {handleGetData('data-plan-benefit')}}>Download Plans & Benefit</MenuItem>
</Menu>
</Grid>
</Grid>
{/* <h1>kjasndkjandskjasndkjansdkjansd</h1> */}
<Button
id="import-button"
variant="outlined"
startIcon={<AddIcon />}
sx={{ p: 1.8 }}
aria-controls={createMenu ? 'basic-menu' : undefined}
aria-haspopup="true"
aria-expanded={createMenu ? 'true' : undefined}
onClick={handleClick}
>
Import
</Button>
<Menu
id="import-button"
anchorEl={anchorEl}
open={createMenu}
onClose={handleClose}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
<MenuItem onClick={handleImportButton}>Import</MenuItem>
<MenuItem onClick={() => {handleGetTemplate('plan-benefit')}}>Download Template</MenuItem>
<MenuItem onClick={() => {handleGetData('data-plan-benefit')}}>Download Plans & Benefit</MenuItem>
</Menu>
</Stack>
)}
@@ -286,47 +407,51 @@ export default function CorporatePlanList() {
};
}
type DataContent = {
code: string;
name: string;
id: number;
status: string|number;
};
type FormValuesProps = {
value: string;
active: boolean;
};
// Generate the every row of the table
const [isDialogOpen, setDialogOpen] = useState(false)
let titles = {
name: 'Update Status',
icon: '-'
}
const [dataValue, setDataValue] = useState('');
const [dataDescription, setDescriptionValue] = useState('');
const [url, setUrl] = useState('');
function Row(props: { row: ReturnType<typeof createData> }) {
const { row } = props;
const [open, setOpen] = React.useState(false);
const handleActivate = (model: any, status: string) => {
axios
.put(`/plans/${row.id}/activation`, {
// service_code: service.service_code,
active: status == 'active',
})
.then((res) => {
setDataTableData({
...dataTableData,
data: dataTableData.data.map((model) => {
let updatedModel = model;
if (row.id == model.id) {
updatedModel.active = res.data.plan.active;
}
return updatedModel;
}),
});
})
.catch((error) => {
// console.log('asdasd', error.response.data.message)
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
const handleActivate = (isOpen: boolean, dataValue: DataContent) => {
setDialogOpen(isOpen)
setDataValue(dataValue)
setDescriptionValue('Are you sure to inactive this service ?')
setUrl(url)
};
return (
<React.Fragment>
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
<TableCell>
<IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)}>
<TableRow>
{/* <TableCell> */}
{/* <IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)}>
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
</IconButton> */}
{/* </TableCell> */}
<TableCell sx={{ borderBottom: '1px solid rgba(145, 158, 171, 0.24)' }} align="left">
{row.service_code}
</TableCell>
<TableCell align="left">{row.service_code}</TableCell>
<TableCell align="left">{row.corporate_plan_id}</TableCell>
<TableCell align="left">{row.code}</TableCell>
<TableCell align="left">{row.type}</TableCell>
@@ -334,41 +459,27 @@ export default function CorporatePlanList() {
<TableCell align="left">{row.limit_rules}</TableCell>
<TableCell align="center">
{row.active == 1 && (
<Button
variant="outlined"
color="success"
size="small"
onClick={() => {
// handleActivate(row, 'inactive');
clickHandler('edit');
setEdit({id: row.id, service_code: row.service_code, status: 'inactive'});
}}
>
Active
</Button>
)}
{row.active != 1 && (
<Button
variant="outlined"
color="error"
size="small"
onClick={() => {
// handleActivate(row, 'active');
clickHandler('edit');
setEdit({id: row.id, service_code: row.service_code, status: 'active'});
}}
>
Inactive
</Button>
)}
{row.active == 1 ?
<Label color='success'>Active</Label> :
<Label color='error'>Inactive</Label>}
</TableCell>
<TableCell align="center">
<Tooltip title="History">
<Link to={`/corporate/${corporate_id}/plans/${row.id}/history`}>
<HistoryIcon />
</Link>
</Tooltip>
<TableMoreMenu actions={
<>
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/corporate-plans/${row.id}/edit`)}>
<Edit />
Edit
</MenuItem>
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/plans/${row.id}/history`)}>
<HistoryIcon />
History
</MenuItem>
<MenuItem onClick={() => handleActivate(true, {code: row.code, name: row.service_code, id:row.id, status: row.active})}>
<CachedOutlinedIcon />
Update Status
</MenuItem>
</>
} />
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
@@ -689,6 +800,20 @@ export default function CorporatePlanList() {
fontWeight: 'bold',
};
const onSubmit = async (row : any) => {
try {
handleUpdate(dataValue.status, dataValue.id, row.reason)
} catch (error: any) {
console.log('data gagal');
}
const ascent = document?.querySelector('ascent');
if (ascent != null) {
ascent.innerHTML = '';
}
};
const applyFilter = async (searchFilter: string) => {
await loadDataTableData({ search: searchFilter });
setSearchParams({ search: searchFilter });
@@ -704,17 +829,134 @@ export default function CorporatePlanList() {
loadDataTableData();
}, []);
const NewCorporateSchema = Yup.object().shape({
reason: Yup.string().required('Reason Edit is required'),
});
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
});
const {
reset,
handleSubmit,
formState: { isSubmitting },
} = methods;
const handleUpdate = (active: number, id: number, reason:string) => {
console.log(active)
axios
.put(`/plans/${id}/activation`, {
active: active,
reason: reason
})
.then((res) => {
window.location.reload();
});
}
const getContent = () => (
<>
<Stack paddingX={2} paddingY={2}>
<Typography variant='subtitle1'>Are you sure to {dataValue?.status == 1 ? 'inactive' : 'active'} this service ?</Typography>
</Stack>
<Card>
<Grid container paddingX={2} paddingY={2}>
<Grid item xs={4} md={4}>
<Typography variant='inherit'>Code</Typography>
</Grid>
<Grid item xs={8}>
<Typography variant='subtitle1'>{dataValue?.code}</Typography>
</Grid>
<Grid item xs={4} md={4} marginTop={2}>
<Typography variant='inherit'>Service Name</Typography>
</Grid>
<Grid item xs={8} marginTop={2}>
<Typography variant='subtitle1'>{dataValue?.name}</Typography>
</Grid>
</Grid>
</Card>
<Typography marginTop={5} marginBottom={3} variant='subtitle1'>
Reason for update*
</Typography>
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<RHFSelect
name="reason"
label="Reason for update"
>
<option value=""></option>
<option value="Agreement changed">Agreement changed</option>
<option value="Endorsement">Endorsement</option>
<option value="Renewal">Renewal</option>
<option value="Worng Setting">Worng Setting</option>
</RHFSelect>
<Stack
alignItems="center"
justifyContent="flex-end"
direction={{ xs: 'column', md: 'row' }}
spacing={2}
marginTop={5}
>
<Stack direction="row" spacing={1}>
<Button
sx={{
boxShadow: 'none',
}}
variant="outlined"
size="medium"
fullWidth={true}
onClick={() => setDialogOpen(false)}
>
Cancel
</Button>
{dataValue?.status == 1?
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
type="submit"
variant="contained"
size="medium"
fullWidth={true}
loading={isSubmitting}
color='error'
>
Inactive
</LoadingButton>
:
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
type="submit"
variant="contained"
size="medium"
fullWidth={true}
loading={isSubmitting}
color='success'
>
Active
</LoadingButton>
}
</Stack>
</Stack>
</FormProvider>
</>
);
return (
<Stack>
<ImportForm />
<Card>
{/* <Card> */}
{/* The Main Table */}
<TableContainer component={Paper}>
<TableContainer>
<Table aria-label="collapsible table">
<TableBody>
<TableHead>
<TableRow>
<TableCell style={headStyle} align="left" />
{/* <TableCell style={headStyle} align="left" /> */}
<TableCell style={headStyle} align="left">
Service
</TableCell>
@@ -737,7 +979,7 @@ export default function CorporatePlanList() {
Action
</TableCell>
</TableRow>
</TableBody>
</TableHead>
{dataTableIsLoading ? (
<TableBody>
<TableRow>
@@ -765,7 +1007,7 @@ export default function CorporatePlanList() {
</TableContainer>
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
</Card>
{/* </Card> */}
{isDialog === 'edit' && (
<DialogLog
@@ -775,6 +1017,16 @@ export default function CorporatePlanList() {
title={{ name: 'Reason For Update' }}
/>
)}
<DialogUpdateStatus
openDialog={isDialogOpen}
setOpenDialog={setDialogOpen}
title={titles}
data={dataValue}
description={dataDescription}
content={getContent()}
// maxWidth='50px'
/>
</Stack>
);
}

View File

@@ -121,11 +121,11 @@ export default function CustomizedAccordions() {
},
{
name: corporate?.name ?? '-',
href: '/corporate/' + corporate_id + '/plans',
href: '/corporates/' + corporate_id + '/plans',
},
{
name: 'Audittrail Corporate',
href: '/corporate/' + corporate_id + '/plans',
name: 'Corporate Dashboard',
href: '/corporates/' + corporate_id + '/plans',
},
]}
/>

File diff suppressed because it is too large Load Diff

View File

@@ -30,17 +30,21 @@ import {
Checkbox,
FormControlLabel,
Tooltip,
Divider,
Grid,
} 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';
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
import HistoryIcon from '@mui/icons-material/History';
// hooks
import React, { ChangeEvent, Component, useEffect, useMemo, useRef, useState } from 'react';
import useSettings from '../../../hooks/useSettings';
import { Link, useParams, useSearchParams } from 'react-router-dom';
import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom';
// components
import axios from '../../../utils/axios';
import { LaravelPaginatedData } from '../../../@types/paginated-data';
@@ -48,11 +52,17 @@ import { Icd } from '../../../@types/diagnosis';
import BasePagination from '../../../components/BasePagination';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import { RHFCheckbox } from '../../../components/hook-form';
import { CheckBox } from '@mui/icons-material';
import { FormProvider, RHFTextField, RHFSwitch, RHFSelect } from '../../../components/hook-form';
import { Add, CheckBox } from '@mui/icons-material';
import { CorporateService } from '../../../@types/corporates';
import { number } from 'yup/lib/locale';
import DialogLog from './sections/DialogLog';
import TableMoreMenu from '@/components/table/TableMoreMenu';
import Label from '@/components/Label';
import DialogUpdateStatus from '@/components/DialogUpdateStatus';
import palette from '@/theme/palette';
import { enqueueSnackbar } from 'notistack';
import { LoadingButton } from '@mui/lab';
export default function List() {
const { themeStretch } = useSettings();
@@ -154,9 +164,39 @@ export default function List() {
}
// Generate the every row of the table
type DataContent = {
code: string;
name: string;
id: string;
status: string|number;
};
type DataType = {
code: string;
name: string;
id: string;
}
type FormValuesProps = {
value: string;
active: boolean;
};
const [isDialogOpen, setDialogOpen] = useState(false)
let titles = {
name: 'Update Status',
icon: '-'
}
const [dataValue, setDataValue] = useState('');
const [dataDescription, setDescriptionValue] = useState('');
const [url, setUrl] = useState('');
// const { id, service_code, status } = data;
function Row(props: { row: ReturnType<typeof createData> }) {
const { row } = props;
const [open, setOpen] = React.useState(false);
const navigate = useNavigate()
const handleConfigChange = (event: ChangeEvent<HTMLInputElement>, service: any) => {
console.log(event.target.name, event.target.checked, service);
@@ -168,85 +208,67 @@ export default function List() {
});
};
const handleActivate = (service: any, status: string) => {
axios
.put(`/corporates/${corporate_id}/services/${service.service_code}`, {
service_code: service.service_code,
status,
reason:service.reason
})
.then((res) => {
setDataTableData({
...dataTableData,
data: dataTableData.data.map((service) => {
let updatedService = service;
if (row.id == service.id) {
updatedService.status = res.data.status;
}
return updatedService;
}),
});
});
// const handleActivate = (service: any, status: string) => {
// axios
// .put(`/corporates/${corporate_id}/services/${service.service_code}`, {
// service_code: service.service_code,
// status,
// reason:service.reason
// })
// .then((res) => {
// setDataTableData({
// ...dataTableData,
// data: dataTableData.data.map((service) => {
// let updatedService = service;
// if (row.id == service.id) {
// updatedService.status = res.data.status;
// }
// return updatedService;
// }),
// });
// });
// };
const handleActivate = (isOpen: boolean, dataValue: DataContent) => {
setDialogOpen(isOpen)
setDataValue(dataValue)
setDescriptionValue('Are you sure to inactive this service ?')
setUrl(url)
};
return (
<React.Fragment>
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
{/* <TableCell>
<IconButton
aria-label="expand row"
size="small"
onClick={() => setOpen(!open)}
>
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
</TableCell> */}
<TableRow>
<TableCell>
</TableCell>
<TableCell align="left">{row.service_code}</TableCell>
<TableCell align="left">{row.name}</TableCell>
<TableCell align="left">
{row.status == 'active' ?
<Label color='success'>{row.status}</Label> :
<Label color='error'>{row.status}</Label>}
</TableCell>
<TableCell align="right">
{row.status == 'active' && (
<Button
variant="outlined"
color="success"
size="small"
onClick={() => {
// handleActivate(row, 'inactive', 'test');
clickHandler('edit');
setEdit({id: row.id, service_code: row.service_code, status: 'inactive'});
}}
>
Active
</Button>
)}
{row.status == 'inactive' && (
<Button
variant="outlined"
color="error"
size="small"
onClick={() => {
clickHandler('edit');
setEdit({id: row.id, service_code: row.service_code, status: 'active'});
}}
>
Inactive
</Button>
)}
</TableCell>
<TableCell align="right" width='10%'>
<Link to={`/corporate/${corporate_id}/services/${row.service_code}`}>
<Button variant="outlined" color="primary" size="small">
Config
</Button>
</Link>
</TableCell>
<TableCell width='1%'>
<Tooltip title="History">
<Link to={`/corporate/${corporate_id}/services/${row.id}/history`} >
<HistoryIcon/>
</Link>
</Tooltip>
<TableCell align="right" sx={{borderBottom: 'unset'}}>
<TableMoreMenu actions={
<>
<MenuItem onClick={() => navigate(`/corporates/${row.corporate_id}/services/${row.service_code}`)}>
<SettingsOutlinedIcon />
Config
</MenuItem>
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/services/${row.id}/history`)}>
<HistoryIcon />
History
</MenuItem>
<MenuItem onClick={() => handleActivate(true, {code: row.service_code, name: row.name, id:corporate_id, status: row.status})}>
<CachedOutlinedIcon />
Update Status
</MenuItem>
</>
} />
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
{false && (
@@ -682,6 +704,20 @@ export default function List() {
fontWeight: 'bold',
};
const onSubmit = async (row : any) => {
try {
handleUpdate(dataValue.status, dataValue.code, row.reason)
} catch (error: any) {
console.log('data gagal');
}
const ascent = document?.querySelector('ascent');
if (ascent != null) {
ascent.innerHTML = '';
}
};
const applyFilter = async (searchFilter: any) => {
await loadDataTableData({ search: searchFilter });
setSearchParams({ search: searchFilter });
@@ -697,32 +733,146 @@ export default function List() {
loadDataTableData();
}, []);
const NewCorporateSchema = Yup.object().shape({
reason: Yup.string().required('Reason Edit is required'),
});
const methods = useForm<FormValuesProps>({
resolver: yupResolver(NewCorporateSchema),
});
const {
reset,
handleSubmit,
formState: { isSubmitting },
} = methods;
const handleUpdate = (active: string, service_code: string, reason:string) => {
console.log(active)
axios
.put(`/corporates/${corporate_id}/services/${service_code}`, {
service_code: service_code,
status: active,
reason: reason
})
.then((res) => {
window.location.reload();
});
}
const getContent = () => (
<>
<Stack paddingX={2} paddingY={2}>
<Typography variant='subtitle1'>Are you sure to {dataValue?.status == 'active' ? 'inactive' : 'active'} this service ?</Typography>
</Stack>
<Card>
<Grid container paddingX={2} paddingY={2}>
<Grid item xs={4} md={4}>
<Typography variant='inherit'>Code</Typography>
</Grid>
<Grid item xs={8}>
<Typography variant='subtitle1'>{dataValue?.code}</Typography>
</Grid>
<Grid item xs={4} md={4} marginTop={2}>
<Typography variant='inherit'>Service Name</Typography>
</Grid>
<Grid item xs={8} marginTop={2}>
<Typography variant='subtitle1'>{dataValue?.name}</Typography>
</Grid>
</Grid>
</Card>
<Typography marginTop={5} marginBottom={3} variant='subtitle1'>
Reason for update*
</Typography>
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<RHFSelect
name="reason"
label="Reason for update"
>
<option value=""></option>
<option value="Agreement changed">Agreement changed</option>
<option value="Endorsement">Endorsement</option>
<option value="Renewal">Renewal</option>
<option value="Worng Setting">Worng Setting</option>
</RHFSelect>
<Stack
alignItems="center"
justifyContent="flex-end"
direction={{ xs: 'column', md: 'row' }}
spacing={2}
marginTop={5}
>
<Stack direction="row" spacing={1}>
<Button
sx={{
boxShadow: 'none',
}}
variant="outlined"
size="medium"
fullWidth={true}
onClick={() => setDialogOpen(false)}
>
Cancel
</Button>
{dataValue?.status == 'active' ?
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
type="submit"
variant="contained"
size="medium"
fullWidth={true}
loading={isSubmitting}
color='error'
>
Inactive
</LoadingButton>
:
<LoadingButton
sx={{ boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)'}}
type="submit"
variant="contained"
size="medium"
fullWidth={true}
loading={isSubmitting}
color='success'
>
Active
</LoadingButton>
}
</Stack>
</Stack>
</FormProvider>
</>
);
return (
<Stack>
<SearchForm />
<Card>
{/* The Main Table */}
<TableContainer component={Paper}>
<Table aria-label="collapsible table">
<TableBody>
<TableHead>
<TableRow>
{/* <TableCell style={headStyle} align="left" width={10}/> */}
<TableCell style={headStyle} align="left">
<TableCell align="left" width={50} />
<TableCell align="left">
Code
</TableCell>
<TableCell style={headStyle} align="left">
<TableCell align="left">
Service
</TableCell>
<TableCell style={headStyle} align="right" width={30}>
<TableCell align="left" width={100}>
Status
</TableCell>
<TableCell style={headStyle} align="center" width={30} colSpan={2}>
Action
<TableCell align="center" width={100}>
{/* Action */}
</TableCell>
</TableRow>
</TableBody>
</TableHead>
{dataTableIsLoading ? (
<TableBody>
<TableRow>
@@ -750,16 +900,27 @@ export default function List() {
</TableContainer>
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
</Card>
{isDialog === 'edit' && (
{/* {isDialog === 'edit' && (
<DialogLog
data={edit}
openDialog={openDialog}
setOpenDialog={setOpenDialog}
title={{ name: 'Reason For Update' }}
/>
)}
)} */}
<DialogUpdateStatus
openDialog={isDialogOpen}
setOpenDialog={setDialogOpen}
title={titles}
data={dataValue}
description={dataDescription}
content={getContent()}
// maxWidth='50px'
/>
</Stack>
);
}

View File

@@ -121,11 +121,11 @@ export default function CustomizedAccordions() {
},
{
name: corporate?.name ?? '-',
href: '/corporate/' + corporate_id + '/services',
href: '/corporates/' + corporate_id + '/services',
},
{
name: 'Audittrail Corporate',
href: '/corporate/' + corporate_id + '/benefits',
href: '/corporates/' + corporate_id + '/benefits',
},
]}
/>

View File

@@ -38,7 +38,7 @@ export default function Corporates() {
const headStyle = {
fontWeight: 'bold',
};
};
// Upload Docs
const fileDocsInput = useRef<HTMLInputElement>(null);
const [fileDocs, setFileDocs] = useState([]);
@@ -109,7 +109,7 @@ export default function Corporates() {
}
axios
.post('/update-status-files-doc', {status_download : statusDownload, corporate_id : corporate_id})
.then((response) => {
.then((response) => {
enqueueSnackbar(response.data.message, { variant: 'success' });
})
.catch((error) => {
@@ -138,7 +138,7 @@ export default function Corporates() {
},
]}
/>
{/* <Container maxWidth={themeStretch ? false : 'xl'}> */}
<Card>
<Stack spacing="2">
@@ -204,7 +204,7 @@ export default function Corporates() {
accept="application/pdf"
multiple
/>
<Button
variant="outlined"
onClick={() => {

View File

@@ -135,6 +135,10 @@ export default function Router() {
path: ':corporate_id/benefits/:benefit_id/history',
element: <CorporateBenefitsHistory />,
},
{
path: ':corporate_id/benefits/:benefit_id/edit',
element: <CorporateBenefitsEdit />,
},
{
path: ':corporate_id/members',
element: <CorporateMembers />,
@@ -256,7 +260,7 @@ export default function Router() {
path: 'master/diagnosis-template/:id/edit',
element: <MasterDiagnosisTemplateCreate />,
},
{
path: 'master/diagnosis/:diagnosis_template_id',
element: <MasterDiagnosis />,
@@ -440,6 +444,9 @@ const CorporateBenefits = Loadable(
const CorporateBenefitsHistory = Loadable(
lazy(() => import('../pages/Corporates/Benefit/sections/History'))
);
const CorporateBenefitsEdit = Loadable(
lazy(() => import('../pages/Corporates/Benefit/Create'))
);
const CorporatePlanCreate = Loadable(
lazy(() => import('../pages/Corporates/CorporatePlan/CreateUpdate'))
@@ -515,4 +522,4 @@ const ClaimShow = Loadable(lazy(() => import('../pages/Claims/Show')));
const ClaimRequests = Loadable(lazy(() => import('../pages/ClaimRequests/Index')));
const Membership = Loadable(lazy(() => import('../pages/Service/Membership/index')));
const Membership = Loadable(lazy(() => import('../pages/Service/Membership/index')));

View File

@@ -25,7 +25,7 @@ export default function Table(theme: Theme) {
color: theme.palette.text.secondary,
backgroundColor: theme.palette.background.neutral,
'&:first-of-type': {
// paddingLeft: theme.spacing(3),
paddingLeft: theme.spacing(3),
borderTopLeftRadius: theme.shape.borderRadius,
borderBottomLeftRadius: theme.shape.borderRadius,
boxShadow: `inset 8px 0 0 ${theme.palette.background.paper}`,
@@ -44,6 +44,7 @@ export default function Table(theme: Theme) {
body: {
'&:first-of-type': {
paddingLeft: theme.spacing(3),
// borderBottom: 'none',
},
'&:last-of-type': {
paddingRight: theme.spacing(3),

View File

@@ -62,11 +62,11 @@ declare module '@mui/material' {
// SETUP COLORS
const PRIMARY = {
lighter: '#C8FACD',
light: '#5BE584',
main: '#00AB55',
dark: '#007B55',
darker: '#005249',
lighter: '#D0FBEC',
light: '#70EAD5',
main: '#19BBBB',
dark: '#0C7186',
darker: '#043C59',
};
const SECONDARY = {
lighter: '#D6E4FF',

View File

@@ -21,7 +21,7 @@ export default function ThemeColorPresets({ children }: Props) {
...defaultTheme,
palette: {
...defaultTheme.palette,
primary: setColor,
// primary: setColor,
},
customShadows: {
...defaultTheme.customShadows,