Merged in feature/nisha/checking-wtd (pull request #149)

nisha-checking-wtd
This commit is contained in:
nurulnisha muhammad
2026-01-15 07:06:54 +00:00
5 changed files with 295 additions and 6 deletions
+33 -6
View File
@@ -192,15 +192,10 @@ class WTDController extends Controller
$startDate = $getReportDate($request->startDate);
$endDate = $getReportDate($request->endDate);
// $summarywtd = Http::get($request->hostname . '/admin/wtd/summaryWtd', [
// 'startDate' => $startDate,
// 'endDate' => $endDate,
// ])->effectiveUri()->__toString();
// dd($summarywtd);
// ])->effectiveUri()->__toString();
$summarywtd = Http::get($request->hostname . '/admin/wtd/summaryWtd', [
'startDate' => $startDate,
@@ -224,4 +219,36 @@ class WTDController extends Controller
$request->endDate
),"Detail_Laporan_WTD_{$kodcaw}.xlsx");
}
public function home()
{
return view('wtd.debug.home');
}
public function trail(Request $request)
{
$current = Carbon::now();
$getReportDate = function ($date_string) use ($current) {
return $date_string ? $date_string : $current->toDateString();
};
$request->hostname = config('api.url');
$startDate = $getReportDate($request->startDate);
$endDate = $getReportDate($request->endDate);
$debugwtd = Http::get($request->hostname . '/admin/wtd/debugWtd', [
'startDate' => $startDate,
'endDate' => $endDate,
])->json();
if (!is_array($debugwtd)) {
$debugwtd = [];
}
return view('wtd.debug.index', compact('debugwtd', 'startDate', 'endDate'));
}
}
+12
View File
@@ -129,6 +129,18 @@
</div>
</li>
</a>
<a href="{{ route('wtd.debugWTD.home') }}" class="rounded mb-2 mr-2 {{ Route::is('wtd.debugWTD') || Route::is('wtd.debugWTD.home') ? 'bg-gray-200 rounded text-white-500' : 'hover:bg-yellow-300 ' }}">
<li class="flex w-full justify-between text-gray-600 hover:text-gray-500 cursor-pointer items-center ">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
</svg>
<span class="ml-2 text-lg">Debug Proses WTD</span>
</div>
</li>
</a>
{{-- <a href="#" class="rounded mb-2 mr-2 {{ Route::is('online') || Route::is('online.*') ? 'bg-gray-200 rounded text-white-500' : 'hover:bg-yellow-300 ' }}">
<li class="flex w-full justify-between text-gray-600 hover:text-gray-500 cursor-pointer items-center ">
<div class="flex items-center">
+48
View File
@@ -0,0 +1,48 @@
@extends('layouts.app')
@section('content')
<div class="fixed inset-0 z-10 hidden bg-gray-900 opacity-50" id="sidebarBackdrop"></div>
<div id="main-content" class="relative w-full h-full overflow-y-auto bg-gray-50">
<main>
<div class="px-4 pt-6">
<breadcrumb :items="[{'title' : 'Debug Proses WTD', 'icon' : 'fas fa-file-invoice','url' : {{ json_encode(route('wtd.debugWTD.home')) }}}]"></breadcrumb>
@if (Session::has('type'))
<div class="@if(Session::get('type') == 'error') bg-red-100 border-red-500 text-red-900 @else bg-yellow-100 border-green-500 text-green-900 @endif border-t-4 rounded-b px-4 py-3 shadow-md w-96 mx-auto mb-5" role="alert">
<div class="flex">
<div class="py-1">
@if(Session::get('type') == 'error')
<svg class="w-6 h-6 mr-4 text-red-500 fill-current" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 11V9h2v6H9v-4zm0-6h2v2H9V5z"/></svg>
@else
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 mr-4 text-green-500 fill-current" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z" />
</svg>
@endif
</div>
<div>
<p class="font-bold">{{ Session::get('message') }}</p>
<p class="text-sm">{{ Session::get('title') }}</p>
</div>
</div>
</div>
@endif
<div class="flex items-center justify-center pt-5 mx-auto mr-3 ">
<a href="{{ route('wtd.debugWTD.trail', ['startDate' => \Carbon\Carbon::yesterday()->format('Y-m-d'), 'endDate' => \Carbon\Carbon::yesterday()->format('Y-m-d')]) }}" class="w-1/6 px-6 py-4 mr-3 transition transform bg-white border border-solid rounded-lg shadow cursor-pointer hover:bg-yellow-300 hover:transition-all hover:-translate-y-1 ">
<div class="flex items-center justify-center">
<svg fill="#000000" width="128px" height="128px" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M208,72V184a7.99989,7.99989,0,0,1-8,8H176V104L136,64H80V40.00006a7.99989,7.99989,0,0,1,8-8L168,32Z" opacity="0.2"></path> <path d="M213.65723,66.34326l-40-40A8.00076,8.00076,0,0,0,168,24H88A16.01833,16.01833,0,0,0,72,40V56H56A16.01833,16.01833,0,0,0,40,72V216a16.01833,16.01833,0,0,0,16,16H168a16.01833,16.01833,0,0,0,16-16V200h16a16.01833,16.01833,0,0,0,16-16V72A8.00035,8.00035,0,0,0,213.65723,66.34326ZM168,216H56V72h76.68652L168,107.314l.00781,84.53083c-.001.05212-.00781.10284-.00781.15521,0,.05255.00684.10345.00781.15576l.002,23.84375Zm32-32H184V104a8.00035,8.00035,0,0,0-2.34277-5.65674l-40-40A8.00076,8.00076,0,0,0,136,56H88V40h76.68652L200,75.314Zm-56-32a8.00008,8.00008,0,0,1-8,8H88a8,8,0,0,1,0-16h48A8.00008,8.00008,0,0,1,144,152Zm0,32a8.00008,8.00008,0,0,1-8,8H88a8,8,0,0,1,0-16h48A8.00008,8.00008,0,0,1,144,184Z"></path> </g></svg>
</div>
<h2 class="mx-auto mt-4 text-2xl font-bold text-center uppercase">Trail Proses WTD</h2>
</a>
</div>
</div>
</main>
@include('layouts.footer')
@endsection
+198
View File
@@ -0,0 +1,198 @@
@extends('layouts.app')
@section('content')
<div class="bg-gray-900 opacity-50 hidden fixed inset-0 z-10" id="sidebarBackdrop"></div>
<div id="main-content" class="h-full w-full bg-gray-50 relative overflow-y-auto">
<main>
<div class="pt-6 px-4">
<breadcrumb
:items="[{ 'title': 'Debug Proses WTD', 'icon': 'fas fa-users', 'url': '{{ route('wtd.debugWTD.home') }}' },
{ 'title': 'Data WTD', 'icon': 'fas fa-users' }
]">
</breadcrumb>
<div class="container">
<div class="flex w-full">
<div class="xl:w-2/3 2xl:w-1/2 p-8 mx-auto">
<div class="bg-yellow-600 text-gray-200 text-lg px-6 py-4 rounded-t-lg"><a href=""
class="router-link-active"><i class="fas fa-backspace text-white"></i></a> <span
class="text-center mx-auto text-white font-bold">Selesai WTD</span>
</div>
<form method="get" id="formwtd" action="{{ route('wtd.debugWTD.trail') }}">
<div class="rounded bg-white shadow p-6">
<div class="pb-6"><label for="username"
class="font-semibold text-gray-700 block pb-1">Tarikh</label>
<div class="flex">
<span
class="text-gray-600 border border-2 rounded-l px-4 py-2 whitespace-no-wrap"
style="background-color: rgb(249, 250, 251);">Mula</span>
<input id="tarikhmula" name="startDate" type="date"
value="{{ request()->startDate ?? $startDate }}"
class="border border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2">
<span
class="text-gray-600 border border-2 rounded-l px-4 py-2 whitespace-no-wrap"
style="background-color: rgb(249, 250, 251);">Hingga</span>
<input id="tarikhhingga" name="endDate" type="date"
value="{{ request()->endDate ?? $endDate }}"
class="border border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2">
<button
class="border border-yellow-600 text-yellow-600 font-montserrat py-2 px-8 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300 ml-5">
<i class="fas fa-magnifying-glass mr-2"></i>Search
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div kodcaw="operasi">
<div>
<!---->
<!---->
</div>
<div>
<!---->
<!---->
</div>
<div class="flex justify-between mb-2">
</div>
<table class="min-w-full leading-normal">
<thead class="text-center">
<tr>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
No
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Kod Cawangan
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Cawangan
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
Table Serahbaki
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
Table Tuntutbaki
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
Table WTD
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
Action
</th>
</tr>
</thead>
@php
$totalserahbaki = 0;
$totaltuntutbaki = 0;
$totalwtd = 0;
@endphp
<tbody>
@forelse ($debugwtd ?? [] as $dwtd)
@php
// Total
$totalserahbaki += $dwtd['serahb'] ?? 0;
$totaltuntutbaki += $dwtd['tuntutb'] ?? 0;
$totalwtd += $dwtd['twtd'] ?? 0;
@endphp
<tr>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="ml-3">{{ $loop->iteration }}</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="ml-3">{{ $dwtd['kodcaw'] }}</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="ml-3">{{ $dwtd['details_caw'] }}</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="ml-3 text-right">{{ number_format($dwtd['serahb'], 2) }}
@if($dwtd['serahb'] == $dwtd['tuntutb'] && $dwtd['serahb'] == $dwtd['twtd'])
<span class="inline-block w-3 h-3 bg-green-500 rounded-full"></span>
@else
<span class="inline-block w-3 h-3 bg-red-500 rounded-full"></span>
@endif
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="ml-3 text-right">{{ number_format($dwtd['tuntutb'], 2) }}
@if($dwtd['serahb'] == $dwtd['tuntutb'] && $dwtd['serahb'] == $dwtd['twtd'])
<span class="inline-block w-3 h-3 bg-green-500 rounded-full"></span>
@else
<span class="inline-block w-3 h-3 bg-red-500 rounded-full"></span>
@endif
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="ml-3 text-right">{{ number_format($dwtd['twtd'], 2) }}
@if($dwtd['serahb'] == $dwtd['tuntutb'] && $dwtd['serahb'] == $dwtd['twtd'])
<span class="inline-block w-3 h-3 bg-green-500 rounded-full"></span>
@else
<span class="inline-block w-3 h-3 bg-red-500 rounded-full"></span>
@endif
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="ml-3 text-center">
@if($dwtd['serahb'] == $dwtd['tuntutb'] && $dwtd['serahb'] == $dwtd['twtd'])
<span class="inline-block w-3 h-3"></span>
@else
<span style="color: red;">Perlu Semakan</span>
@endif
</div>
</td>
</tr>
@empty
<tr>
<td colspan="11"
class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">
Data not available
</td>
</tr>
@endforelse
<tr>
<td colspan="3" class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
Jumlah Keseluruhan
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-right">
{{ number_format($totalserahbaki, 2) }}
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-right">
{{ number_format($totaltuntutbaki, 2) }}
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-right">
{{ number_format($totalwtd, 2) }}
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-right"></td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
@include('layouts.footer')
</div>
@endsection
+4
View File
@@ -186,6 +186,10 @@ Route::post('/wtd/simulasi/simulasiToDraft', [WTDController::class, 'simulasiToD
Route::get('/wtd/simulasi/serahbaki', [WTDController::class, 'serahbaki']);
//debug proses wtd
Route::get('/wtd/debugWTD/home', [WTDController::class, 'home'])->name('wtd.debugWTD.home');
Route::get('/wtd/debugWTD/trail', [WTDController::class, 'trail'])->name('wtd.debugWTD.trail');
//Audit
Route::get('/audit',['as'=>'audit.index','uses'=>'App\Http\Controllers\AkaunController@AuditGenerator']);