This commit is contained in:
R
2023-03-01 12:07:03 +07:00
parent ce0fde18dc
commit 89cd2a9d37
36 changed files with 1366 additions and 206 deletions

View File

@@ -2,14 +2,19 @@
namespace Modules\HospitalPortal\Http\Controllers\Api;
use App\Events\ClaimRequested;
use App\Helpers\Helper;
use App\Models\ClaimRequest;
use App\Models\File;
use App\Models\Member;
use App\Services\ClaimRequestService;
use App\Services\ClaimService;
use Exception;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\HospitalPortal\Transformers\ClaimRequestResource;
use Modules\HospitalPortal\Transformers\ClaimRequestShowResource;
use PDF;
class ClaimRequestController extends Controller
@@ -56,15 +61,20 @@ class ClaimRequestController extends Controller
public function store(Request $request)
{
$request->validate([
// 'submission_date' => 'required',
'member_id' => 'required',
// 'files' => ''
]);
$newClaimRequest = ClaimRequest::create([
'member_id' => $request->member_id,
'submission_date' => now(),
'status' => 'requested'
$member = Member::find($request->member_id);
$newClaimRequest = ClaimRequestService::storeClaimRequest(member: $member);
ClaimRequested::dispatch($newClaimRequest);
// Log History
$newClaimRequest->histories()->create([
'title' => 'New Claim Requested',
'description' => "Claim Requested for Member : {$member->member_id} - ({$member->full_name})",
'type' => 'info',
'system_origin' => 'hospital-portal'
]);
if ($request->hasFile('result_files')) {
@@ -111,7 +121,6 @@ class ClaimRequestController extends Controller
]);
}
}
// return ($request->result_files[0]->getClientOriginalName());
return Helper::responseJson(data: $request->toArray(), message: 'Claim Request berhasil ajukan!');
}
@@ -123,7 +132,14 @@ class ClaimRequestController extends Controller
*/
public function show($id)
{
return view('hospitalportal::show');
$claimRequest = ClaimRequest::findOrFail($id);
$claimRequest->load([
'histories' => function ($history) {
$history->latest();
}
]);
return Helper::responseJson(data: ClaimRequestShowResource::make($claimRequest));
}
/**

View File

@@ -39,5 +39,6 @@ Route::prefix('hospitalportal')->group(function () {
Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
Route::post('claim-requests', [ClaimRequestController::class, 'store'])->name('claim-requests.store');
Route::get('claim-requests/{claim_request_id}/log', [ClaimRequestController::class, 'generateLog'])->name('claim-requests.generate-log');
Route::get('claim-requests/{id}', [ClaimRequestController::class, 'show'])->name('claim-requests.show');
});
});

View File

@@ -0,0 +1,31 @@
<?php
namespace Modules\HospitalPortal\Transformers;
use Illuminate\Http\Resources\Json\JsonResource;
class ClaimRequestResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
$data = parent::toArray($request);
$historiesGroupByDate = $this->histories->mapToGroups(function($history) {
return [$history->created_at->format('Y-m-d') => $history];
});
$data['histories_by_date'] = [];
foreach ($historiesGroupByDate as $date => $histories) {
$data['histories_by_date'][] = [
'date' => $date,
'histories' => $histories
];
}
return $data; //parent::toArray($request);
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Modules\HospitalPortal\Transformers;
use Illuminate\Http\Resources\Json\JsonResource;
class ClaimRequestShowResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
$data = parent::toArray($request);
$historiesGroupByDate = $this->histories->mapToGroups(function($history) {
return [$history->created_at->format('Y-m-d') => $history];
});
$data['histories_by_date'] = [];
foreach ($historiesGroupByDate as $date => $histories) {
$data['histories_by_date'][] = [
'date' => $date,
'histories' => $histories
];
}
return $data;
}
}

View File

@@ -11,6 +11,7 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Knp\Snappy\Pdf;
use Modules\Internal\Transformers\ClaimRequestResource;
use Modules\Internal\Transformers\ClaimRequestShowResource;
class ClaimRequestController extends Controller
{
@@ -67,7 +68,15 @@ class ClaimRequestController extends Controller
*/
public function show($id)
{
return view('internal::show');
$claimRequest = ClaimRequest::findOrFail($id);
$claimRequest->load([
'histories' => function ($history) {
$history->latest();
},
'files'
]);
return Helper::responseJson(data: ClaimRequestShowResource::make($claimRequest));
}
/**
@@ -104,9 +113,20 @@ class ClaimRequestController extends Controller
public function approve($id)
{
$claimRequest = ClaimRequest::findOrFail($id);
$member = $claimRequest->member;
$claimRequest->status = 'approved';
$claimRequest->save();
// Store Generated Documents
$logContent = view('pdf.guaranted_leter', compact('member', 'claimRequest'));
$claimRequest->generatedDocuments()->create([
'type' => 'guarantee_letter',
'title' => 'Guarantee Letter for '. $member->full_name,
'document_type' => 'type',
'html_content' => $logContent,
'system_origin' => 'primecenter'
]);
return $claimRequest;
}

View File

@@ -135,6 +135,7 @@ Route::prefix('internal')->group(function () {
Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
Route::post('claim-requests/{id}/approve', [ClaimRequestController::class, 'approve'])->name('claim-requests.approve');
Route::get('claim-requests/{id}', [ClaimRequestController::class, 'show'])->name('claim-requests.show');
});
Route::get('province', [ProvinceController::class, 'index']);

View File

@@ -0,0 +1,40 @@
<?php
namespace Modules\Internal\Transformers;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Str;
class ClaimRequestShowResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
$data = parent::toArray($request);
// Map Histories to Group by Dates
$historiesGroupByDate = $this->histories->mapToGroups(function($history) {
return [$history->created_at->format('Y-m-d') => $history];
});
$data['histories_by_date'] = [];
foreach ($historiesGroupByDate as $date => $histories) {
$data['histories_by_date'][] = [
'date' => $date,
'histories' => $histories
];
}
// Map Files by type
$filesGroupByType = $this->files->mapToGroups(function($file) {
return [Str::slug($file->type, '_') => $file];
});
$data['files_by_type'] = $filesGroupByType;
return $data;
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use App\Models\ClaimRequest;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
@@ -14,14 +15,16 @@ class ClaimRequested
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $claim_request;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
public function __construct(ClaimRequest $claimRequest)
{
//
$this->claim_request = $claimRequest;
}
/**

View File

@@ -0,0 +1,92 @@
<?php
namespace App\Http\Controllers;
use App;
use App\Models\GeneratedDocument;
use Illuminate\Http\Request;
use PDF;
use Response;
class GeneratedDocumentController extends Controller
{
// Display Content from generated_documents to used by pdf generator (wkhtmltopdf)
public function show($id)
{
$document = GeneratedDocument::findOrFail($id);
return $document->html_content.$document->html_content.$document->html_content.$document->html_content.$document->html_content;
}
public function header(Request $request)
{
return '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<pre>'.json_encode($request->toArray()).'
<table>
<tbody>
<tr>
<td style="width: 200px; background-color: #00be67;"> asdkjasnd </td>
<td style="width: 500px; background-color: #0a94e3;" align="center"> asjdkadsn </td>
<td style="width: 200px; background-color: #7b3f25" align="right"> qkjwenkqwjenkqwjen </td>
</tr>
</tbody>
</table>
</body>
</html>';
}
public function footer()
{
return "<h2>Footer Fatherfucker</h2>";
}
public function pdf($id)
{
// return 'fuck';
// $document = GeneratedDocument::findOrFail($id);
// $pdf = PDF::loadFile('http://localhost:8000/');
// $pdf = PDF::loadFile('http://aso-linksehat.local/');
// return $pdf->inline();
// dd(route('generated-document.show', $id));
// $pdf = PDF::loadFile(route('generated-document.show', $id));
// return $pdf->inline();
// $snappy = App::make('snappy.pdf');
// $html = '<h1>Bill</h1><p>You owe me money, dude.</p>';
// // $snappy->generateFromHtml($html, '/tmp/bill-123.pdf');
// // $snappy->generate('http://www.github.com', '/tmp/github.pdf');
// //Or output:
// return new Response(
// $snappy->getOutputFromHtml($html),
// 200,
// array(
// 'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'attachment; filename="file.pdf"'
// )
// );
$pdf = PDF::loadFile(route('generated-document.show', $id));
// $pdf->loadFile(route('generated-document.show', $id));
// $pdf->loadFile(route('generated-document.show', $id));
// $pdf->loadFile(route('generated-document.show', $id));
// $pdf->loadFile(route('generated-document.show', $id));
// $pdf->setPaper('a4')->setOrientation('landscape')->setOption('margin-bottom', 0);
// $pdf->setOption('header-html', route('pdf.header'));
// $pdf->setOption('footer-html', route('pdf.header'));
// $pdf->setOption('footer-center', 'asdasdasd');
// $pdf->setOption('footer-html', route('pdf.footer'));
// $pdf->loadHtml('asdasdasd');
return $pdf->inline();
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Listeners;
use App\Events\ClaimRequested;
use App\Models\User;
use App\Notifications\ClaimRequestedNotification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class NotifyClaimRequested
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param \App\Events\ClaimRequested $event
* @return void
*/
public function handle(ClaimRequested $event)
{
// TODO List Of User that should be notified about Claim that Requested
$user = User::first();
$user->notify(new ClaimRequestedNotification());
}
}

View File

@@ -18,8 +18,11 @@ use Illuminate\Support\Str;
class Claim extends Model
{
use HasFactory, Blameable, SoftDeletes;
protected static $code_prefix = 'CLM';
protected $fillable = [
'claim_request_id',
'code',
'member_id',
'total_claim',
@@ -54,7 +57,8 @@ class Claim extends Model
static::creating(function ($model) {
try {
$model->code = (string) Str::orderedUuid(); // generate uuid
$model->uuid = (string) Str::orderedUuid(); // generate uuid
$model->code = self::getNextCode();
} catch (\Exception $e) {
abort(500, $e->getMessage());
}
@@ -78,9 +82,9 @@ class Claim extends Model
'status' => $model->status
]);
if ($model->status == 'requested') {
ClaimRequested::dispatch($model);
}
// if ($model->status == 'requested') {
// ClaimRequested::dispatch($model);
// }
if ($model->status == 'received') {
ClaimReceived::dispatch($model);
@@ -104,6 +108,20 @@ class Claim extends Model
}
});
}
public static function getNextCode()
{
$last_number = self::withTrashed()->max('code');
$next_number = empty($last_number) ? 1 : ((int) explode('-', $last_number)[1] + 1);
return self::makeCode($next_number);
}
public static function makeCode($next_number)
{
return (string) self::$code_prefix .'-'. str_pad($next_number, 5, 0, STR_PAD_LEFT);
}
public function files()
{

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
use App\Traits\Blameable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ClaimHistory extends Model
{
use HasFactory, Blameable;
public $fillable = [
'claim_id',
'title',
'description',
'type',
'parent_id',
'data',
'system_origin'
];
public static $types = [
'info',
'document-request',
'document-submit'
];
public function parent()
{
return $this->belongsTo(ClaimHistory::class, 'parent_id');
}
public function childs()
{
return $this->hasMany(Claimhistory::class, 'parent_id');
}
public function claim()
{
return $this->belongsTo(Claim::class, 'claim_id');
}
public function historiable()
{
return $this->morphTo();
}
}

View File

@@ -2,10 +2,13 @@
namespace App\Models;
use App\Events\ClaimReceived;
use App\Events\ClaimRequested;
use App\Traits\Blameable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Str;
class ClaimRequest extends Model
{
@@ -13,17 +16,91 @@ class ClaimRequest extends Model
protected static $code_prefix = 'CRQ';
public $fillable = [
'submission_date',
'member_id',
'status',
'claim_id'
];
protected $hidden = [
// 'created_at',
'updated_at',
'deleted_at',
'created_by',
'updated_by',
'deleted_by',
];
public static $status = [
'draft' => 'Draft',
'requested' => 'Requested',
'received' => 'Received',
'approved' => 'Approved',
'postpone' => 'Postpone',
'paid' => 'Paid',
'declined' => 'Declined'
];
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
try {
$model->uuid = (string) Str::orderedUuid(); // generate uuid
$model->code = self::getNextCode();
} catch (\Exception $e) {
abort(500, $e->getMessage());
}
});
static::created(function ($model) {
// try {
// if (!empty($model->status) && $model->status == 'requested') {
// $model->histories()->create([
// 'title' => 'New Claim Requested',
// 'description' => "Claim Requested for Member : {$model->member->member_id} - ({$model->member->full_name})",
// 'type' => 'info'
// ]);
// }
// } catch (\Exception $e) {
// abort(500, $e->getMessage());
// }
});
static::updated(function ($model) {
if ($model->hasChanges(['status'])) {
// if ($model->status == 'requested') {
// $model->histories()->create([
// 'title' => 'New Claim Requested',
// 'description' => "Claim Requested for Member : {$model->member->member_id} - ({$model->member->full_name})",
// 'type' => 'info'
// ]);
// }
// if ($model->status == 'received') {
// ClaimReceived::dispatch($model);
// }
// if ($model->status == 'approved') {
// ClaimApproved::dispatch($model);
// }
// if ($model->status == 'postpone') {
// ClaimPostpone::dispatch($model);
// }
// if ($model->status == 'paid') {
// ClaimPaid::dispatch($model);
// }
// if ($model->status == 'declined') {
// ClaimDeclined::dispatch($model);
// }
}
});
}
public static function getNextCode()
@@ -39,17 +116,26 @@ class ClaimRequest extends Model
return (string) self::$code_prefix .'-'. str_pad($next_number, 5, 0, STR_PAD_LEFT);
}
public $fillable = [
'submission_date',
'member_id',
'status'
];
public function claims()
{
return $this->hasMany(Claim::class, 'claim_request_id');
}
public function files()
{
return $this->morphMany(File::class, 'fileable');
}
public function generatedDocuments()
{
return $this->morphMany(GeneratedDocument::class, 'generated_documentable');
}
public function histories()
{
return $this->morphMany(ClaimHistory::class, 'historiable');
}
public function member()
{
return $this->belongsTo(Member::class, 'member_id', 'id');

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use PDF;
class GeneratedDocument extends Model
{
use HasFactory;
public $fillable = [
'type',
'title',
'document_type',
'html_content',
'system_origin',
'parent_id'
];
public function parent()
{
return $this->belongsTo(GeneratedDocument::class, 'parent_id');
}
public function childs()
{
return $this->hasMany(GeneratedDocument::class, 'parent_id');
}
public function generated_documentable()
{
return $this->morphTo();
}
public function makePdf()
{
return PDF::loadFile(route('generated-document.show', $this->id));
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Kota extends Model
{
use HasFactory, SoftDeletes;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tm_kota';
protected $primaryKey = 'nID';
public function provinsi()
{
return $this->belongsTo(Provinsi::class, 'nIDProvinsi', 'nID');
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Provinsi extends Model
{
use HasFactory, SoftDeletes;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tm_provinsi';
protected $primaryKey = 'nID';
}

View File

@@ -0,0 +1,61 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ClaimRequestedNotification extends Notification implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'asdasd' => 'asdasdsd'
];
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Providers;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ClaimRequested
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Providers;
use App\Events\ClaimApproved;
use App\Listeners\LogClaimJournal;
use App\Listeners\NotifyClaimRequested;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
@@ -21,9 +22,14 @@ class EventServiceProvider extends ServiceProvider
SendEmailVerificationNotification::class,
],
ClaimRequested::class => [
NotifyClaimRequested::class,
],
ClaimApproved::class => [
LogClaimJournal::class,
]
],
];
/**
@@ -43,6 +49,6 @@ class EventServiceProvider extends ServiceProvider
*/
public function shouldDiscoverEvents()
{
return false;
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Services;
use App\Events\ClaimApproved;
use App\Events\ClaimRequested;
use App\Models\Claim;
use App\Models\ClaimRequest;
use App\Models\Icd;
use App\Models\Member;
use Carbon\Carbon;
use DB;
use Str;
class ClaimRequestService{
public static function storeClaimRequest($member, $submissionDate = null, $status = 'requested')
{
try {
DB::beginTransaction();
$claimRequestData = [
'member_id' => $member->id,
'submission_date' => $submissionDate ?? now(),
'status' => $status
];
$claimRequest = ClaimRequest::create($claimRequestData);
DB::commit();
return $claimRequest;
} catch (\Exception $error) {
DB::rollBack();
throw new \Exception($error);
}
}
}

View File

@@ -119,8 +119,6 @@ class ClaimService{
->active()
->first();
// dd($benefit->toArray());
// dd(compact(['plan', 'policy', 'corporate', 'benefit']));
$limits = [
'total_limit' => $corporateBenefit ? $corporateBenefit->limit_amount : 0,
'frequency_limit_name' => $corporateBenefit ? $corporateBenefit->max_frequency_period_name : null,
@@ -163,22 +161,21 @@ class ClaimService{
return $limits;
}
public static function storeClaim($member, $diagnosis, $totalClaim, $benefit, $status)
public static function storeClaim($member, $diagnosis = null, $totalClaim = null, $benefit = null, $status = 'requested', $claimRequest = null)
{
try {
DB::beginTransaction();
$claimData = [
'member_id' => $member->id,
'claim_request_id' => $claimRequest->id ?? null,
'diagnosis_id' => $diagnosis->id ?? null,
'total_claim' => $totalClaim,
'total_claim' => $totalClaim ?? null,
'currency' => 'IDR',
'plan_id' => $member->currentPlan->id,
'benefit_id' => $benefit->id,
'plan_id' => $member->currentPlan->id ?? null,
'benefit_id' => $benefit->id ?? null,
'status' => $status
];
// $claimData[$status.'_at'] = now();
// $claimData[$status.'_by'] = auth()->user()->id ?? null;
$claim = Claim::create($claimData);

View File

@@ -15,7 +15,9 @@ return new class extends Migration
{
Schema::create('claims', function (Blueprint $table) {
$table->id();
$table->uuid('uuid');
$table->string('code')->index();
$table->foreignId('claim_request_id')->nullable()->index();
$table->foreignId('member_id')->index();
// $table->foreignId('diagnosis_id')->index()->nullable();
$table->string('currency');

View File

@@ -15,6 +15,7 @@ return new class extends Migration
{
Schema::create('claim_requests', function (Blueprint $table) {
$table->id();
$table->uuid('uuid');
$table->string('code')->index();
$table->dateTime('submission_date')->nullable();
$table->foreignId('member_id');

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('claim_histories', function (Blueprint $table) {
$table->id();
$table->morphs('historiable');
$table->string('title')->nullable();
$table->string('description')->nullable();
$table->string('type');
$table->foreignId('parent_id')->nullable();
$table->text('data')->nullable();
$table->string('system_origin')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable()->index();
$table->unsignedBigInteger('updated_by')->nullable()->index();
$table->unsignedBigInteger('deleted_by')->nullable()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('claim_histories');
}
};

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('generated_documents', function (Blueprint $table) {
$table->id();
$table->morphs('generated_documentable', 'generated_document_index');
$table->string('type');
$table->string('title');
$table->string('document_type')->nullable();
$table->string('system_origin');
$table->text('html_content')->nullable();
$table->text('data')->nullable();
$table->foreignId('parent_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable()->index();
$table->unsignedBigInteger('updated_by')->nullable()->index();
$table->unsignedBigInteger('deleted_by')->nullable()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('generated_documents');
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
};

View File

@@ -0,0 +1,296 @@
// @mui
import {
Button,
Box,
Stepper,
Step,
StepLabel,
Card,
Typography,
Divider,
Stack,
CircularProgress,
} from '@mui/material';
import { Add } from '@mui/icons-material';
// components
import MuiDialog from '@/components/MuiDialog';
// theme
import palette from '@/theme/palette';
// React
import { ReactElement, useEffect, useState } from 'react';
import { fDate } from '@/utils/formatTime';
import { addMinutes, format } from 'date-fns';
import { LoadingButton } from '@mui/lab';
import { enqueueSnackbar } from 'notistack';
import Iconify from '../Iconify';
type DataContent = {
claim: object;
isLoading: boolean;
handleDownloadLog: void;
};
type MuiDialogProps = {
title?: {
name?: string;
icon?: string;
};
openDialog: boolean;
setOpenDialog: Function;
content?: ReactElement;
data?: DataContent[];
};
const steps = ['Review', 'Approval', 'Disbursement'];
const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialogProps) => {
const claim = data.claim ?? null;
// ---------------------------------------------
// Step
const [currentStep, setCurrentStep] = useState(0);
useEffect(
function () {
if (claim?.status == 'requested') {
setCurrentStep(0);
}
if (claim?.status == 'approved') {
setCurrentStep(1);
}
if (claim?.status == 'closed') {
setCurrentStep(2);
}
},
[data]
);
// ----------------------------------------------------
// Date Stamp
let currentDate = null;
// ----------------------------------------------------
// Download LOG
const [loadingDownloadLog, setLoadingDownloadLog] = useState(false);
const handleDownloadLog = async (claimRequest) => {
setLoadingDownloadLog(true);
await data.handleDownloadLog(claimRequest).then(() => {
setLoadingDownloadLog(false);
});
};
// ----------------------------------------------------
// Handle Upload Invoice
const handleUploadInvoice = () => {
enqueueSnackbar('Something went wrong, please contact Link Medis Sehat', { variant: 'error' });
};
const getContent = () => (
<>
{data.isLoading && (
<Stack alignItems="center" justifyContent="space-between" sx={{ p: 4 }}>
<CircularProgress />
</Stack>
)}
{!data.isLoading && (
<>
<Stack
alignItems="center"
justifyContent="space-between"
direction="row"
sx={{ marginTop: 1 }}
>
<Typography variant="subtitle1" sx={{ height: 'max-content' }}>
Claim Request
</Typography>
<Stack>
<Typography variant="caption">Submission date</Typography>
{/* {JSON.stringify(data)} */}
<Typography variant="caption">
{claim.created_at && fDate(claim.created_at)}
</Typography>
</Stack>
</Stack>
<Box sx={{ width: '100%', marginTop: 2 }}>
<Stepper alternativeLabel activeStep={currentStep ?? 0}>
{steps.map((label) => (
<Step key={label}>
<StepLabel>{label}</StepLabel>
</Step>
))}
</Stepper>
</Box>
{/* { claim.status == 'approved' && (
<Stack sx={{ marginTop: 4}}>
<LoadingButton loading={false}
variant="contained"
startIcon={<Add />}
fullWidth
// sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }}
onClick={() => {handleUploadInvoice()}}
>
Upload Invoice
</LoadingButton>
</Stack>
)} */}
{claim.histories_by_date &&
claim.histories_by_date.map((historiesByDate) => (
<Stack key={historiesByDate.date}>
<Stack marginTop={2}>
<Typography variant="subtitle1" paddingY={2}>
{fDate(historiesByDate.date)}
</Typography>
</Stack>
<Stack direction="row" spacing={2}>
<Divider orientation="vertical" flexItem sx={{ borderStyle: 'dashed' }} />
<Stack spacing={2} sx={{ flex: 1, maxWidth: '100%' }}>
{historiesByDate.histories &&
historiesByDate.histories.map((history) => (
<Stack key={history.id}>
{/* ---------------------------------TYPE INFO------------------------------------ */}
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack
direction="row"
justifyContent="space-between"
alignItems="center"
>
<Typography variant="body1">
{fDate(history.created_at, 'HH:mm')} WIB
</Typography>
<Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
borderColor: palette.light.warning.dark,
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Request
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<Typography variant="subtitle2" color="#404040">
{history.title}
</Typography>
<Typography
variant="caption"
color="#757575"
sx={{ marginTop: 2, marginBottom: 1 }}
>
{history.description}
</Typography>
</Stack>
</Card>
</Stack>
))}
</Stack>
</Stack>
</Stack>
))}
<Stack direction="row" spacing={2} sx={{ marginTop: 2 }}>
<Divider orientation="vertical" flexItem sx={{ borderStyle: 'dashed' }} />
<Stack spacing={2} sx={{ flex: 1, maxWidth: '100%' }}>
{/* ---------------------------------TYPE INFO------------------------------------ */}
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1" fontWeight={600}>
<Iconify icon="eva:file-text-fill"></Iconify> Dokumen Kelengkapan
</Typography>
{/* <Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
borderColor: palette.light.warning.dark,
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Dokumen
</Typography> */}
</Stack>
<Divider sx={{ marginY: 2 }} />
<Typography fontWeight="600">Kondisi</Typography>
<Stack>
<Stack
// divider={<Divider orientation="horizontal" flexItem />}
spacing={1}
sx={{ marginY: 2 }}
>
{claim.files_by_type?.claim_kondisi &&
claim.files_by_type.claim_kondisi.map((file, index) => (
<Stack direction="row" justifyContent={'space-between'} key={index}>
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
- {file.name}
</Typography>
</a>
</Stack>
))}
</Stack>
<Typography fontWeight="600">Diagnosa</Typography>
<Stack
// divider={<Divider orientation="horizontal" flexItem />}
spacing={1}
sx={{ marginY: 2 }}
>
{claim.files_by_type?.claim_diagnosis &&
claim.files_by_type.claim_diagnosis.map((file, index) => (
<Stack direction="row" justifyContent={'space-between'} key={index}>
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
- {file.name}
</Typography>
</a>
</Stack>
))}
</Stack>
<Typography fontWeight="600">Hasil</Typography>
<Stack
divider={<Divider orientation="horizontal" flexItem />}
spacing={1}
sx={{ marginY: 2 }}
>
{claim.files_by_type?.result &&
claim.files_by_type.result.map((file, index) => (
<Stack direction="row" justifyContent={'space-between'} key={index}>
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
- {file.name}
</Typography>
</a>
</Stack>
))}
</Stack>
</Stack>
</Card>
</Stack>
</Stack>
</>
)}
</>
);
return (
<MuiDialog
title={title}
openDialog={openDialog}
setOpenDialog={setOpenDialog}
content={getContent()}
/>
);
};
export default DialogDetailClaim;

View File

@@ -36,12 +36,12 @@ import { LoadingButton } from '@mui/lab';
import { enqueueSnackbar } from 'notistack';
import { Divider } from '@mui/material';
import Iconify from '@/components/Iconify';
import DialogDetailClaim from '@/components/dialogs/DialogDetailClaim';
// import LoadingButton from '@/theme/overrides/LoadingButton';
export default function List() {
const [searchParams, setSearchParams] = useSearchParams();
const [importResult, setImportResult] = useState(null);
const navigate = useNavigate();
function SearchInput(props: any) {
// SEARCH
@@ -184,6 +184,16 @@ export default function List() {
<TableCell align="left">{row.service_type}</TableCell>
<TableCell align="right"><Chip label={row.status}/></TableCell>
<TableCell align="right">{ row.status == 'requested' && (<LoadingButton loading={loadingApprove} variant="outlined" onClick={() => {handleApprove(row)}}>Approve</LoadingButton> )}</TableCell>
<TableCell>
<IconButton
onClick={() => {
handleShowClaim(row);
}}
>
<Iconify icon="eva:eye-fill" />
</IconButton>
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
<TableRow>
@@ -278,6 +288,33 @@ export default function List() {
);
}
// ---------------------------------------------------------
// Dialog Detail Claim Request
const [openDialogDetailClaim, setOpenDialogDetailClaim] = useState(false);
const [loadingClaimDetail, setLoadingClaimDetail] = useState(true);
const [currentClaim, setCurrentClaim] = useState(null);
function handleShowClaim(claimRequest) {
setLoadingClaimDetail(true);
setOpenDialogDetailClaim(true);
axios.get(`/claim-requests/${claimRequest.id}`)
.then(({data}) => {
setCurrentClaim(data.data);
setLoadingClaimDetail(false);
})
.catch((err) => {
enqueueSnackbar(err.message, {variant: 'error'})
})
}
function handleDownloadLog() {
}
return (
<Card>
<ImportForm />
@@ -289,6 +326,14 @@ export default function List() {
handlePageChange={handlePageChange}
TableContent={<TableContent />}
/>
<DialogDetailClaim
openDialog={openDialogDetailClaim}
setOpenDialog={setOpenDialogDetailClaim}
title={{ name: 'Claim Request Detail' }}
data={{ claim: currentClaim, isLoading: loadingClaimDetail, handleDownloadLog }}
></DialogDetailClaim>
</Card>
);
}

View File

@@ -22,6 +22,7 @@ import { fDate } from '@/utils/formatTime';
import { addMinutes, format } from 'date-fns';
import { LoadingButton } from '@mui/lab';
import { enqueueSnackbar } from 'notistack';
import Iconify from '../Iconify';
type DataContent = {
claim: object;
@@ -63,22 +64,25 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
[data]
);
// ----------------------------------------------------
// Date Stamp
let currentDate = null;
// ----------------------------------------------------
// Download LOG
const [loadingDownloadLog, setLoadingDownloadLog] = useState(false)
const [loadingDownloadLog, setLoadingDownloadLog] = useState(false);
const handleDownloadLog = async (claimRequest) => {
setLoadingDownloadLog(true)
setLoadingDownloadLog(true);
await data.handleDownloadLog(claimRequest).then(() => {
setLoadingDownloadLog(false)
})
}
setLoadingDownloadLog(false);
});
};
// ----------------------------------------------------
// Handle Upload Invoice
const handleUploadInvoice = () => {
enqueueSnackbar('Something went wrong, please contact Link Medis Sehat', {variant: 'error'})
}
enqueueSnackbar('Something went wrong, please contact Link Medis Sehat', { variant: 'error' });
};
const getContent = () => (
<>
@@ -102,9 +106,13 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
<Stack>
<Typography variant="caption">Submission date</Typography>
{/* {JSON.stringify(data)} */}
<Typography variant="caption">{claim && fDate(claim.created_at)}</Typography>
<Typography variant="caption">
{claim.created_at && fDate(claim.created_at)}
</Typography>
</Stack>
</Stack>
{/* ----------------STEP---------------- */}
<Box sx={{ width: '100%', marginTop: 2 }}>
<Stepper alternativeLabel activeStep={currentStep ?? 0}>
{steps.map((label) => (
@@ -115,129 +123,117 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
</Stepper>
</Box>
{ claim.status == 'approved' && (
<Stack sx={{ marginTop: 4}}>
<LoadingButton loading={false}
variant="contained"
startIcon={<Add />}
fullWidth
// sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }}
onClick={() => {handleUploadInvoice()}}
>
Upload Invoice
</LoadingButton>
</Stack>)}
<Stack marginTop={2}>
<Typography variant="subtitle1" paddingY={2}>
{fDate(claim.created_at)}
</Typography>
</Stack>
<Stack direction="row" spacing={2}>
{/* { claim.status == 'approved' && (
<Stack sx={{ marginTop: 4}}>
<LoadingButton loading={false}
variant="contained"
startIcon={<Add />}
fullWidth
// sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }}
onClick={() => {handleUploadInvoice()}}
>
Upload Invoice
</LoadingButton>
</Stack>
)} */}
<Stack direction="row" spacing={2} sx={{ marginTop: 2 }}>
<Divider orientation="vertical" flexItem sx={{ borderStyle: 'dashed' }} />
<Stack spacing={2} sx={{ flex: 1, maxWidth: '100%' }}>
{/* Download LOG */}
{claim.status == 'approved' && (
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1">
{format(
addMinutes(
new Date(claim.created_at),
15 //Math.floor(Math.random() * (20 - 15 + 1)) + 15
),
'HH:mm'
)}{' '}
WIB</Typography>
<Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
borderColor: palette.light.warning.dark,
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Approved
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<LoadingButton loading={loadingDownloadLog}
variant="outlined"
startIcon={<Add />}
fullWidth
// sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }}
onClick={() => {handleDownloadLog(claim)}}
>
Download Guarantee Letter
</LoadingButton>
</Stack>
</Card>
)}
{/* Item 1 */}
{claim.status == 'requested' && (
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1">09:10 WIB</Typography>
<Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
borderColor: palette.light.warning.dark,
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Approval
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<Typography variant="subtitle2" color="#404040">
Details : mohon melengkapi kekurangan dokumen
</Typography>
<Typography
variant="caption"
color="#757575"
sx={{ marginTop: 2, marginBottom: 1 }}
>
Lab pemeriksaan darah
</Typography>
<Button
variant="outlined"
startIcon={<Add />}
fullWidth
sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }}
>
Hasil Pemeriksaan Laboratorium
</Button>
</Stack>
</Card>
)}
{/* Item 2 */}
<Card sx={{ flex: 1, maxWidth: '100%', paddingY: 2, paddingX: 3 }}>
{/* ---------------------------------TYPE INFO------------------------------------ */}
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
{/* // TODO sementara tanggal random */}
<Typography variant="body1">
{format(
addMinutes(
new Date(claim.created_at),
10// Math.floor(Math.random() * (15 - 5 + 1)) + 5
),
'HH:mm'
)}{' '}
WIB
<Typography variant="body1" fontWeight={600}>
<Iconify icon="eva:file-text-fill"></Iconify> Pengajuan Penjaminan
</Typography>
<Typography
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<LoadingButton loading={false}
variant="contained"
startIcon={<Add />}
fullWidth
// sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }}
onClick={() => {}}
>
Upload Invoice
</LoadingButton>
</Stack>
</Card>
</Stack>
</Stack>
{claim.histories_by_date &&
claim.histories_by_date.map((historiesByDate) => (
<Stack key={historiesByDate.date}>
<Stack marginTop={2}>
<Typography variant="subtitle1" paddingY={2}>
{fDate(historiesByDate.date)}
</Typography>
</Stack>
<Stack direction="row" spacing={2}>
<Divider orientation="vertical" flexItem sx={{ borderStyle: 'dashed' }} />
<Stack spacing={2} sx={{ flex: 1, maxWidth: '100%' }}>
{historiesByDate.histories &&
historiesByDate.histories.map((history) => (
<Stack key={history.id}>
{/* ---------------------------------TYPE INFO------------------------------------ */}
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack
direction="row"
justifyContent="space-between"
alignItems="center"
>
<Typography variant="body1">
{fDate(history.created_at, 'HH:mm')} WIB
</Typography>
<Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
borderColor: palette.light.warning.dark,
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Request
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<Typography variant="subtitle2" color="#404040">
{history.title}
</Typography>
<Typography
variant="caption"
color="#757575"
sx={{ marginTop: 2, marginBottom: 1 }}
>
{history.description}
</Typography>
</Stack>
</Card>
</Stack>
))}
</Stack>
</Stack>
</Stack>
))}
<Stack direction="row" spacing={2} sx={{ marginTop: 2 }}>
<Divider orientation="vertical" flexItem sx={{ borderStyle: 'dashed' }} />
<Stack spacing={2} sx={{ flex: 1, maxWidth: '100%' }}>
{/* ---------------------------------TYPE INFO------------------------------------ */}
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1" fontWeight={600}>
<Iconify icon="eva:file-text-fill"></Iconify> Dokumen Kelengkapan
</Typography>
{/* <Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
@@ -248,39 +244,65 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
}}
variant="caption"
>
Approval
</Typography>
Dokumen
</Typography> */}
</Stack>
<Divider sx={{ marginY: 2 }} />
<Typography fontWeight="600">Kondisi</Typography>
<Stack>
<Typography variant="subtitle2" color="#404040">
Details : Penilaian Dokter
</Typography>
</Stack>
</Card>
{/* Item 3 */}
<Card sx={{ flex: 1, maxWidth: '100%', paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1">{fDate(claim.created_at, 'HH:mm')} WIB</Typography>
<Typography
sx={{
backgroundColor: '#F5F5F5',
color: '#757575',
borderColor: '#757575',
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
<Stack
// divider={<Divider orientation="horizontal" flexItem />}
spacing={1}
sx={{ marginY: 2 }}
>
Review
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<Typography variant="subtitle2" color="#404040">
Details : Klaim Diajukan
</Typography>
{claim.files_by_type?.claim_kondisi &&
claim.files_by_type.claim_kondisi.map((file, index) => (
<Stack direction="row" justifyContent={'space-between'} key={index}>
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
- {file.name}
</Typography>
</a>
</Stack>
))}
</Stack>
<Typography fontWeight="600">Diagnosa</Typography>
<Stack
// divider={<Divider orientation="horizontal" flexItem />}
spacing={1}
sx={{ marginY: 2 }}
>
{claim.files_by_type?.claim_diagnosis &&
claim.files_by_type.claim_diagnosis.map((file, index) => (
<Stack direction="row" justifyContent={'space-between'} key={index}>
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
- {file.name}
</Typography>
</a>
</Stack>
))}
</Stack>
<Typography fontWeight="600">Hasil</Typography>
<Stack
divider={<Divider orientation="horizontal" flexItem />}
spacing={1}
sx={{ marginY: 2 }}
>
{claim.files_by_type?.result &&
claim.files_by_type.result.map((file, index) => (
<Stack direction="row" justifyContent={'space-between'} key={index}>
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
- {file.name}
</Typography>
</a>
</Stack>
))}
</Stack>
</Stack>
</Card>
</Stack>

View File

@@ -14,6 +14,7 @@ import { Input } from '@mui/material';
//sections
import TableList from '@/sections/dashboard/TableList';
import { fDate } from '@/utils/formatTime';
import DialogDetailClaim from '@/components/dialogs/DialogDetailClaim';
// ----------------------------------------------------------------------
@@ -96,6 +97,7 @@ export default function Dashboard() {
</Grid>
</Grid>
</Container>
</Page>
);
}

View File

@@ -7,7 +7,7 @@ import Iconify from '@/components/Iconify';
// React
import { useState } from 'react';
import DialogNotification from './DialogNotification';
import DialogDetailClaim from './DialogDetailClaim';
import DialogDetailClaim from '@/components/dialogs/DialogDetailClaim';
// ----------------------------------------------------------------------

View File

@@ -5,8 +5,8 @@ import { Card, Divider, Link, Stack, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
// Component
import MuiDialog from '../../components/MuiDialog';
import DialogDetailClaim from '@/components/dialogs/DialogDetailClaim';
// Sections
import DialogDetailClaim from './DialogDetailClaim';
type DataContent = {
info: string;

View File

@@ -313,6 +313,27 @@ export default function TableList(props: any) {
})();
}, [appliedParams, searchParams, order, orderBy, setSearchParams]);
// ---------------------------------------------------------
// Dialog Detail Claim
const [openDialogDetailClaim, setOpenDialogDetailClaim] = useState(false);
const [loadingClaimDetail, setLoadingClaimDetail] = useState(true);
const [currentClaim, setCurrentClaim] = useState(null);
function handleShowClaim(claimRequest) {
setLoadingClaimDetail(true);
setOpenDialogDetailClaim(true);
axios.get(`/claim-requests/${claimRequest.id}`)
.then(({data}) => {
console.log(data.data);
setCurrentClaim(data.data);
setLoadingClaimDetail(false);
})
.catch((err) => {
enqueueSnackbar(err.message, {variant: 'error'})
})
}
// -----------------------------------------------------------------
// Download LOG
async function handleDownloadLog(claimRequest) {
@@ -334,21 +355,6 @@ export default function TableList(props: any) {
});
}
// ---------------------------------------------------------
// Dialog Detail Claim
const [openDialogDetailClaim, setOpenDialogDetailClaim] = useState(false);
const [loadingClaimDetail, setLoadingClaimDetail] = useState(true);
const [currentClaim, setCurrentClaim] = useState(null);
function handleShowClaim(claimRequest) {
setLoadingClaimDetail(true);
setOpenDialogDetailClaim(true);
setTimeout(function () {
setCurrentClaim(claimRequest);
setLoadingClaimDetail(false);
}, 300);
}
return (
<Card>
<Grid container>
@@ -513,12 +519,15 @@ export default function TableList(props: any) {
{/* End Field 2 */}
</Grid>
<DialogDetailClaim
openDialog={openDialogDetailClaim}
setOpenDialog={setOpenDialogDetailClaim}
title={{ name: 'Claim Request Detail' }}
data={{ claim: currentClaim, isLoading: loadingClaimDetail, handleDownloadLog }}
></DialogDetailClaim>
</Card>
);
}

View File

@@ -0,0 +1,4 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://docs.google.com/
HostUrl=https://doc-0g-9k-sheets.googleusercontent.com/export/36l11cvnhaccqmms6c85sbeosg/4je7nlqn7u5a74q5t8end74f28/1677645605000/106328900561681991688/114852934422671877320/1ZAov4ChGcV8LSn_2NVJT9sXneZCn9UKABvSXo8gkJeY?format=csv&id=1ZAov4ChGcV8LSn_2NVJT9sXneZCn9UKABvSXo8gkJeY&gid=0&dat=AP36HMUCq80X-P4ovM8wnZWhyaZAwfeMUSZjzSDLtxiRu-U-HKLyptb3Vn7NLxgzHGDj_wJGYjOx3kjxhcZdakeaTvUvwmpzgNI9sX1IDd6S0ohIn5YqmLA-_TqClPlWfpXoQHNeqcoTofr7KR0Iq1cpd5vvPH1OywrhxwV5z_333pXpsRUt3PU3pjAb4nQry85CtovhYGAhQOXH2u5b2HVSpR249DlF7fPghEbu0qKdDuTiAdySlTAu-p0p2MZlEZKbS19PYS-oerxtKoyg45ZsGXajCBuHKq1vMO9wQ56xRuFQQ9l-pTinl8GQdZAqSsDDfO0NntfIsv_Ijq35MLWIx0NjwR4NymWPB-fTCPq5lrgSK0q_tonWBLsscJrEttK2Lh1dBDqTdqC4bQb1Fe5ssUQrZL7_XFDKBaIvaW5oH5nrgpcw0WwnezY_QrHS52rb-wY1LUyk1fEUQl8znuVySnchKJrczVU1GXMWHLYUlyNyV1aEyQWYp0BHg-Iee0wG8HClnMbNMaiVpruWcEvH5tTrJ2CkjRQSjIK-08TAJB02cbHsWgOlV9TswWnsvo_Rsd7aCuZsGXFxaw644s0NmUp445s1-0Jidf10v0Ki1n3C2rO9asezai2ppWEN453GbKYf1mCnwhlzGCsYpCAvk-306KdMVDQB7KnNKrRJdlAMUkGAoV2YTU4Y_ADwAtuh8YenWgPTEUZqlWNbStyPpByzZIojn9mLYgScML4daDETGBzaI2KjO5IbAKBceXJl9kdxA9EfRnyTkDUXTphNA2baI6PiIIBeO0U6dX3zWt-rH0TOY2a3CznzB5bVcbHVmOLzSVyax-936E7S55_c18JzEG_5HbdnyDu4k8tUwj63p2sAwpswDd2CdpWnSkvG45ntPDvuUflSzNxILiISeWJxRcUjZ0XBjxLOqCYIS3f-Usgi

View File

@@ -1,6 +1,7 @@
<?php
use App\Http\Controllers\Api\OLDLMS\PaymentController;
use App\Http\Controllers\GeneratedDocumentController;
use Illuminate\Support\Facades\Route;
/*
@@ -18,4 +19,9 @@ Route::get('/', function () {
return view('welcome');
});
Route::get('postpone-pay/{member_id}', [PaymentController::class, 'postponePay'])->name('postpone-pay');
Route::get('postpone-pay/{member_id}', [PaymentController::class, 'postponePay'])->name('postpone-pay');
Route::get('c1in24b6ct1c279489u12nc89b7cb4y890uj12iub3yd/{id}', [GeneratedDocumentController::class, 'show'])->name('generated-document.show');
Route::get('pdf/header', [GeneratedDocumentController::class, 'header'])->name('pdf.header');
Route::get('pdf/footer', [GeneratedDocumentController::class, 'footer'])->name('pdf.footer');
Route::get('pdf/{id}', [GeneratedDocumentController::class, 'pdf']);