update history corporate
This commit is contained in:
@@ -17,10 +17,6 @@ class AuditTrailController extends Controller {
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request, $id)
|
public function index(Request $request, $id)
|
||||||
{
|
{
|
||||||
$exlusionId = null;
|
|
||||||
if ($request->model == 'App\Models\ExclusionRules'){
|
|
||||||
$exlusionId = ExclusionRules::where('exclusion_id', $id)->get();
|
|
||||||
}
|
|
||||||
$audittrails = AuditTrail::query()
|
$audittrails = AuditTrail::query()
|
||||||
->where('model', '=', $request->model)
|
->where('model', '=', $request->model)
|
||||||
->where('model_id', '=', $id)
|
->where('model_id', '=', $id)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Helpers\Helper;
|
|||||||
use App\Models\Corporate;
|
use App\Models\Corporate;
|
||||||
use App\Models\CorporateService;
|
use App\Models\CorporateService;
|
||||||
use App\Models\Exclusion;
|
use App\Models\Exclusion;
|
||||||
|
use App\Models\ExclusionImport;
|
||||||
use App\Models\Icd;
|
use App\Models\Icd;
|
||||||
use App\Models\ImportLog;
|
use App\Models\ImportLog;
|
||||||
use App\Services\ImportService;
|
use App\Services\ImportService;
|
||||||
@@ -216,7 +217,13 @@ class DiagnosisExclusionController extends Controller
|
|||||||
$import->reader->close();
|
$import->reader->close();
|
||||||
Storage::delete('temp/' . $file_name);
|
Storage::delete('temp/' . $file_name);
|
||||||
$import->writer->close();
|
$import->writer->close();
|
||||||
|
ExclusionImport::updateOrCreate([
|
||||||
|
'corporate_id' => $corporate_id
|
||||||
|
],[
|
||||||
|
'file_name' => $file_name,
|
||||||
|
'file_path' => 'temp/result-' . $file_name,
|
||||||
|
|
||||||
|
]);
|
||||||
return [
|
return [
|
||||||
// 'total_successed_row' => $imported_plan_data,
|
// 'total_successed_row' => $imported_plan_data,
|
||||||
// 'total_failed_row' => count($failed_plan_data),
|
// 'total_failed_row' => count($failed_plan_data),
|
||||||
|
|||||||
24
app/Models/ExclusionImport.php
Normal file
24
app/Models/ExclusionImport.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Altek\Accountant\Contracts\Recordable;
|
||||||
|
|
||||||
|
class ExclusionImport extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'corporate_id',
|
||||||
|
'file_name',
|
||||||
|
'file_path',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ use App\Models\CorporatePlan;
|
|||||||
use App\Models\CorporateBenefit;
|
use App\Models\CorporateBenefit;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\ExclusionRules;
|
use App\Models\ExclusionRules;
|
||||||
|
use App\Models\ExclusionImport;
|
||||||
use App\Models\Icd;
|
use App\Models\Icd;
|
||||||
use App\Models\IcdTemplate;
|
use App\Models\IcdTemplate;
|
||||||
use App\Models\AuditTrail;
|
use App\Models\AuditTrail;
|
||||||
@@ -108,6 +109,15 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->logAuditTrailExclusion($model, 'deleted');
|
$this->logAuditTrailExclusion($model, 'deleted');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ExclusionImport::updated(function ($model) {
|
||||||
|
|
||||||
|
$this->logAuditTrailExclusion($model, 'updated');
|
||||||
|
});
|
||||||
|
|
||||||
|
ExclusionImport::deleted(function ($model) {
|
||||||
|
$this->logAuditTrailExclusion($model, 'deleted');
|
||||||
|
});
|
||||||
|
|
||||||
// ICD or exlusion
|
// ICD or exlusion
|
||||||
Icd::updated(function ($model) {
|
Icd::updated(function ($model) {
|
||||||
$this->logAuditTrail($model, 'updated');
|
$this->logAuditTrail($model, 'updated');
|
||||||
@@ -149,7 +159,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
// Membuat jejak audit baru
|
// Membuat jejak audit baru
|
||||||
$auditTrail = new AuditTrail([
|
$auditTrail = new AuditTrail([
|
||||||
'model' => get_class($model),
|
'model' => get_class($model),
|
||||||
'model_id' => $model->exclusion_id,
|
'model_id' => $model->corporate_id,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'old_values' => json_encode($model->getOriginal()),
|
'old_values' => json_encode($model->getOriginal()),
|
||||||
'new_values' => json_encode($model->getAttributes()),
|
'new_values' => json_encode($model->getAttributes()),
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?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('exclusion_imports', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->integer('corporate_id');
|
||||||
|
$table->string('file_name');
|
||||||
|
$table->string('file_path');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('exclusion_imports');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -98,8 +98,8 @@ export default function CustomizedAccordions() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCorporate(configuredCorporateContext.currentCorporate);
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
const model = 'App\\Models\\ExclusionRules';
|
const model = 'App\\Models\\ExclusionImport';
|
||||||
const url = `/audittrail/${id}?model=${model}`;
|
const url = `/audittrail/${corporate_id}?model=${model}`;
|
||||||
axios.get(url)
|
axios.get(url)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
setCurrentCorporate(res.data);
|
setCurrentCorporate(res.data);
|
||||||
@@ -153,7 +153,7 @@ export default function CustomizedAccordions() {
|
|||||||
<TableBody>
|
<TableBody>
|
||||||
{Object.entries(item.old_values).map(([key, value]) => {
|
{Object.entries(item.old_values).map(([key, value]) => {
|
||||||
let renderedValue;
|
let renderedValue;
|
||||||
if (key === 'deleted_by' || key === 'created_by' || key === 'updated_by') {
|
if (key === 'deleted_by' || key === 'created_by' || key === 'updated_by' || key === 'file_path') {
|
||||||
return null; // Melewati iterasi saat key adalah 'deleted_by'
|
return null; // Melewati iterasi saat key adalah 'deleted_by'
|
||||||
}
|
}
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|||||||
@@ -520,9 +520,9 @@ export default function List(props: any) {
|
|||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</Button> */}
|
</Button> */}
|
||||||
<Link to={`/corporate/${corporate_id}/diagnosis-exclusions/${row.id}/history`}>
|
{/* <Link to={`/corporate/${corporate_id}/diagnosis-exclusions/${row.id}/history`}>
|
||||||
<HistoryIcon />
|
<HistoryIcon />
|
||||||
</Link>
|
</Link> */}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@@ -895,6 +895,11 @@ export default function List(props: any) {
|
|||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Action
|
Action
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell style={headStyle} align="left">
|
||||||
|
<Link to={`/corporate/${corporate_id}/diagnosis-exclusions/history`}>
|
||||||
|
<HistoryIcon />
|
||||||
|
</Link>
|
||||||
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableBody>
|
</TableBody>
|
||||||
{dataTableIsLoading ? (
|
{dataTableIsLoading ? (
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export default function Router() {
|
|||||||
element: <DiagnosisExclusions />,
|
element: <DiagnosisExclusions />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':corporate_id/diagnosis-exclusions/:id/history',
|
path: ':corporate_id/diagnosis-exclusions/history',
|
||||||
element: <DiagnosisExclusionsHistory />,
|
element: <DiagnosisExclusionsHistory />,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user