diff --git a/app/Http/Controllers/OperasiController.php b/app/Http/Controllers/OperasiController.php
index 001324f..4cad65d 100644
--- a/app/Http/Controllers/OperasiController.php
+++ b/app/Http/Controllers/OperasiController.php
@@ -338,4 +338,81 @@ class OperasiController extends Controller
return view('operasi.edit_marginmutu', compact('cawangan_info', 'api_url'));
}
+
+ public function laporanAudit()
+ {
+ $auth_user = Auth::user();
+ $api_url = config('api.url');
+ $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
+
+ return view('homepage.operasi.laporan-audit', compact('cawangan_info', 'api_url'));
+ }
+
+ public function cetakLaporanAuditTrail(Request $request)
+ {
+ $api_url = config('api.url');
+ $auth_user = Auth::user();
+ $current = Carbon::now();
+ $current = new Carbon();
+ $tarikh_cetak = $current->toDateString();
+
+ if($request->dateaudit == null){
+ $date = $current->toDateString();
+ }else{
+ $split_date = explode('-', $request->dateaudit);
+ $date = $split_date[0] . '-' . $split_date[1] . '-' . $split_date[2];
+ }
+
+ if($request->dateaudit_till == null){
+ $date_till = $current->toDateString();
+ }else{
+ $split_date_till = explode('-', $request->dateaudit_till);
+ $date_till = $split_date_till[0] . '-' . $split_date_till[1] . '-' . $split_date_till[2];
+ }
+
+ $audittrail_raw = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/reports/audittrail/operasi',['date' => $date,'date_till' => $date_till])->json();
+ if(!$audittrail_raw){
+ return redirect()->back()->with('errormessage', 'Tiada data pada tarikh tersebut.');
+ }
+
+ // Transform the data to match view format
+ $audittrail = [];
+ foreach($audittrail_raw as $item) {
+ $created_at = \Carbon\Carbon::parse($item['created_at']);
+
+ // Format differences for display
+ $differences_text = '-';
+ if (isset($item['differences']) && !empty($item['differences'])) {
+ $diff_parts = [];
+ foreach ($item['differences'] as $field => $changes) {
+ $old = $changes['old'] ?? 'null';
+ $new = $changes['new'] ?? 'null';
+ $diff_parts[] = "{$field}: {$old} → {$new}";
+ }
+ $differences_text = implode('; ', $diff_parts);
+ }
+
+ $audittrail[] = [
+ 'tarikh' => $created_at->format('d/m/Y'),
+ 'masa' => $created_at->format('H:i:s'),
+ 'users' => $item['users'],
+ 'actions' => $item['actions'],
+ 'differ' => $differences_text
+ ];
+ }
+
+ $cawangan_detail = [
+ 'kodcaw' => 'operasi',
+ 'namacaw' => 'Operasi Ar-Rahn',
+ 'alamat1' => 'Lot 107, Jalan Parit Dalam,',
+ 'alamat2' => 'Seksyen 8',
+ 'poskod' => '15000',
+ 'bandar' => 'Kota Bahru',
+ 'negeri' => 'Kelantan',
+ 'notel' => '03-12345678',
+ 'nofaks' => '03-12345678',
+ ];
+
+ return view('print.laporan_audittrail_operasi', compact('audittrail','cawangan_detail','tarikh_cetak','date','date_till','api_url'));
+ }
}
diff --git a/resources/views/gadaian/v2/index.blade.php b/resources/views/gadaian/v2/index.blade.php
index ce1d84f..3cf5f94 100644
--- a/resources/views/gadaian/v2/index.blade.php
+++ b/resources/views/gadaian/v2/index.blade.php
@@ -107,8 +107,8 @@
Nilai Marhun
Margin Teller (%)
Margin PC (%)
- Nilai Marhun Teller
- Nilai Marhun PC
+ Pembiayaan Teller
+ Pembiayaan PC
@@ -1915,18 +1915,35 @@
$('#toggleTableBtn').on('click', function() {
if (!isMarginTableVisible) {
+ // Check if main table has data before showing margin table
+ let tableData = $('#myTable').DataTable().data();
+ if (tableData.length === 0) {
+ Swal.fire({
+ icon: 'warning',
+ title: 'Amaran!',
+ text: 'Tiada data marhun untuk papar margin. Sila daftar marhun terlebih dahulu.'
+ });
+ return;
+ }
+
// Show margin table, hide main table
$('#myTable_wrapper').hide();
$('#marginTable').show();
$(this).html(' Papar Marhun');
loadMarginData();
isMarginTableVisible = true;
+
+ // Disable Daftar Marhun button when margin table is visible
+ $('button[data-target="#daftar_marhun"]').prop('disabled', true);
} else {
// Show main table, hide margin table
$('#marginTable_wrapper').hide();
$('#myTable_wrapper').show();
$(this).html(' Papar Margin');
isMarginTableVisible = false;
+
+ // Enable Daftar Marhun button when main table is visible
+ $('button[data-target="#daftar_marhun"]').prop('disabled', false);
}
});
diff --git a/resources/views/homepage/operasi/home.blade.php b/resources/views/homepage/operasi/home.blade.php
index a86275b..b327950 100644
--- a/resources/views/homepage/operasi/home.blade.php
+++ b/resources/views/homepage/operasi/home.blade.php
@@ -3,7 +3,7 @@
@section('content')
diff --git a/resources/views/homepage/operasi/laporan-audit.blade.php b/resources/views/homepage/operasi/laporan-audit.blade.php
new file mode 100644
index 0000000..afffb68
--- /dev/null
+++ b/resources/views/homepage/operasi/laporan-audit.blade.php
@@ -0,0 +1,46 @@
+@extends('layouts.app_operasi')
+
+@section('content')
+
+
+
+
+
+
+ Home
+ Laporan Audit
+
+
+
+
+
+
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/resources/views/modal/editmarhun.blade.php b/resources/views/modal/editmarhun.blade.php
index a40407c..5b95402 100644
--- a/resources/views/modal/editmarhun.blade.php
+++ b/resources/views/modal/editmarhun.blade.php
@@ -63,7 +63,7 @@
@endforeach
- Berat
+ Berat Bersih
Harga
diff --git a/resources/views/print/laporan_audittrail_operasi.blade.php b/resources/views/print/laporan_audittrail_operasi.blade.php
new file mode 100644
index 0000000..bb19ab3
--- /dev/null
+++ b/resources/views/print/laporan_audittrail_operasi.blade.php
@@ -0,0 +1,261 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LAPORAN AUDIT TRAIL OPERASI (arOS V3)
+
+
+
+
+
+ TARIKH CETAK:
+ @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
+ $formattedweddingdate = $myDateTime->format('d-m-Y');
+ echo($formattedweddingdate);
+ @endphp
+
+
+
+
+
+
+
+
+
+ TARIKH MULA:
+ @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $date);
+ $formattedweddingdate = $myDateTime->format('d-m-Y');
+ echo($formattedweddingdate);
+ @endphp
+ HINGGA:
+ @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $date_till);
+ $formattedweddingdate = $myDateTime->format('d-m-Y');
+ echo($formattedweddingdate);
+ @endphp
+
+
+
+
+
+
+
+
+
+
+ Bil
+ Tarikh
+ Masa
+ Pengguna
+ Tindakan
+ Perbezaan
+
+ @php $counter = 1; @endphp
+ @foreach($audittrail as $index=>$item)
+
+ {{ $counter }}
+ {{ $item['tarikh'] }}
+ {{ $item['masa'] }}
+ {{ $item['users'] }}
+ {{ $item['actions'] }}
+ {{ $item['differ'] }}
+
+ @php $counter++;@endphp
+ @endforeach
+
+
+
+
+
+
+
+
+ ..................................................................
+
+ ..................................................................
+
+ ..................................................................
+
+
+
+
+ Disediakan
+
+ Disemak
+
+ Disahkan
+
+
+
diff --git a/routes/web.php b/routes/web.php
index b29ec1d..423f3a7 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -269,6 +269,8 @@ Route::post('laporan/saghilang/cetak',['as'=>'saghilang.laporancetak','uses'=>'K
// Route::get('/laporan/agingbulanan', [ 'as'=>'laporan.agingbulanan', 'uses'=>'KhazanahController@laporanAging_Bulanan'])->middleware('auth','khazanah');
// Route::post('/laporan/agingbulanan/cetak', ['as'=>'agingbulan.cetaklaporan', 'uses'=>'KhazanahController@cetaklaporang_Aging'])->middleware('auth','khazanah');
+Route::get('laporan/operasi/audittrail/cetak',['as'=>'operasi.audittrail.laporancetak','uses'=>'OperasiController@cetakLaporanAuditTrail'])->middleware('auth','operasi');
+
Route::get('/laporan/stokauditbackdate',['as'=>'laporan.stokauditbackdate','uses'=>'KhazanahController@laporanStokAuditBackdate'])->middleware('auth','khazanah');
Route::get('laporan/stokauditbackdate/cetak',['as'=>'stokauditbackdate.laporancetak','uses'=>'KhazanahController@cetakLaporanStokAuditBackdate'])->middleware('auth','khazanah');
@@ -344,6 +346,7 @@ Route::post('/operasi/createkelulusan-by-khazanah',['as'=>'operasi.createkelulus
Route::get('/operasi/getkelulusan',['as'=>'operasi.getkelulusan','uses'=>'OperasiController@getkelulusan'])->middleware('auth','teller');
Route::put('/operasi/updatekelulusan',['as'=>'operasi.updatekelulusan','uses'=>'OperasiController@updatekelulusan'])->middleware('auth','operasi');
Route::get('/operasi/parameter','OperasiController@parameter')->name('parameter')->middleware('auth','operasi');
+Route::get('/operasi/laporan-audit','OperasiController@laporanAudit')->name('operasi.laporan.audit')->middleware('auth','operasi');
Route::get('/operasi/hargaemas',['as'=>'operasi.hargaemas','uses'=>'OperasiController@hargaemas'])->middleware('auth','operasi');
Route::post('/operasi/hargaemas/update',['as'=>'hargaemas.update','uses'=>'OperasiController@updatehargaemas'])->middleware('auth','operasi');
Route::post('/operasi/hargaemas',['as'=>'hargaemas.create','uses'=>'OperasiController@createhargaemas'])->middleware('auth','operasi');