Update WTD - Add jana simulasi feature 2024

This commit is contained in:
aiman
2025-09-25 11:59:19 +08:00
parent 457ff93fda
commit f97393ec7e
17 changed files with 851 additions and 36 deletions
+70
View File
@@ -0,0 +1,70 @@
APP_NAME=Laravel
APP_ENV=production
#APP_KEY=base64:x3sTPftRy/BL+DsI7+jXtiiCtUxO9Bei0OcjM15I1rQ=
APP_KEY=WbPGkYNmXZ6ZQplGlvl0iZ7zyW1b09xa
APP_DEBUG=false
APP_URL=http://admin.arrahn
API_ARRAHN_PORTAL_URL=https://pay.arrahn.com.my
API_URL=http://apiujrah.arrahn
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=172.16.4.102
DB_PORT=3306
DB_DATABASE=kaunterpkb
DB_USERNAME=zone2
DB_PASSWORD=G0dz!ll4@2020
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=480
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
#PUSHER_APP_ID=1132716
#PUSHER_APP_KEY=27b70f118373dcb31ab3
#PUSHER_APP_SECRET=ef2e62ddbc1647979bf4
#PUSHER_APP_ID=1220266
#PUSHER_APP_KEY=3fb52a0bf6cc1363c736
#PUSHER_APP_SECRET=0a27feb7c4b2f0177467
#PUSHER_APP_ID=4163674
#PUSHER_APP_KEY=3nqb1ss0jlhi9w9vpi8v
#PUSHER_APP_SECRET=7dfx03w2i7ue0z6qoit3
PUSHER_APP_ID=1220266
PUSHER_APP_KEY=da67a7e1a3a138b9b28e
PUSHER_APP_SECRET=114c38f6edcf085e4d7f
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# MIX_API_URL=http://api.arrahn
MIX_API_URL=http://apiujrah.arrahn
MIX_API_URL_ZONE1=http://apiujrah.arrahn
MIX_API_URL_ZONE2=http://apiujrah.arrahn
MIX_API_URL_ZONE3=http://apiujrah.arrahn
#TWILIO_WHATSAPP_NUMBER="+14155238886"
#TWILIO_SID="AC0b21863a1f21c39f153f9f7ce2551479"
#TWILIO_AUTH_TOKEN="ce474f07f586b3b150bf15a560e6d3b3"
+1
View File
@@ -0,0 +1 @@
10
+124 -24
View File
@@ -19,8 +19,8 @@ class WTDController extends Controller
// $this->middleware('auth');
// }
public function index(){
public function index()
{
return view('wtd.index');
}
@@ -30,10 +30,10 @@ class WTDController extends Controller
$norujukan = json_decode($request->norujukan);
$tuntutbaki = Http::get(config('api.url').'/admin/wtd/senarai',['norujukan' => $norujukan,'kodcaw' => $request->cawangan])->json();
$tuntutbaki = Http::get(config('api.url') . '/admin/wtd/senarai', ['norujukan' => $norujukan, 'kodcaw' => $request->cawangan])->json();
$cawangan=Http::get(config('api.url').'/api/cawangan/detail/'. $request->cawangan)->json();
$cawangan_detail=$cawangan[0];
$cawangan = Http::get(config('api.url') . '/api/cawangan/detail/' . $request->cawangan)->json();
$cawangan_detail = $cawangan[0];
$current = Carbon::now();
$tarikh_cetak = $current->toDateString();
@@ -43,14 +43,12 @@ class WTDController extends Controller
// $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
// $tarikhcetakan = $myDateTime->format('d-m-Y');
if(isset($request->jenis))
{
if($request->jenis == 'pdf')
{
$pdf = PDF::loadView('wtd.cetakan', compact('tuntutbaki','cawangan_detail','tarikh_cetak','api_url','mula','hingga'))->setPaper('a4', 'potrait');
return $pdf->download('wtd_' . $request->cawangan .'_'. $tarikh_cetak . '.pdf');
}else{
return view('wtd.cetakanexcel', compact('tuntutbaki','cawangan_detail','tarikh_cetak','api_url','mula','hingga'));
if (isset($request->jenis)) {
if ($request->jenis == 'pdf') {
$pdf = PDF::loadView('wtd.cetakan', compact('tuntutbaki', 'cawangan_detail', 'tarikh_cetak', 'api_url', 'mula', 'hingga'))->setPaper('a4', 'potrait');
return $pdf->download('wtd_' . $request->cawangan . '_' . $tarikh_cetak . '.pdf');
} else {
return view('wtd.cetakanexcel', compact('tuntutbaki', 'cawangan_detail', 'tarikh_cetak', 'api_url', 'mula', 'hingga'));
}
}
}
@@ -61,21 +59,123 @@ class WTDController extends Controller
$current = Carbon::now();
$tarikh_cetak = $current->toDateString();
$cawangan=Http::get(config('api.url').'/api/cawangan/detail/'. $request->cawangan)->json();
$cawangan_detail=$cawangan[0];
$cawangan = Http::get(config('api.url') . '/api/cawangan/detail/' . $request->cawangan)->json();
$cawangan_detail = $cawangan[0];
$wtdDalamProses = Http::get(config('api.url'). '/admin/wtd/dalamproses' ,['batchno' => $request->batchno,'kodcaw' => $request->cawangan])->json();
if(isset($request->jenis))
{
if($request->jenis == 'pdf')
{
$pdf = PDF::loadView('wtd.dalamprosespdf', compact('tarikh_cetak','cawangan_detail','wtdDalamProses','api_url'))->setPaper('a4', 'landscape');
return $pdf->download('wtd_' . $request->cawangan .'_'. $tarikh_cetak . '.pdf');
}else{
$wtdDalamProses = Http::get(config('api.url') . '/admin/wtd/dalamproses', ['batchno' => $request->batchno, 'kodcaw' => $request->cawangan])->json();
if (isset($request->jenis)) {
if ($request->jenis == 'pdf') {
$pdf = PDF::loadView('wtd.dalamprosespdf', compact('tarikh_cetak', 'cawangan_detail', 'wtdDalamProses', 'api_url'))->setPaper('a4', 'landscape');
return $pdf->download('wtd_' . $request->cawangan . '_' . $tarikh_cetak . '.pdf');
} else {
return view('wtd.dalamprosesexcel', compact('tarikh_cetak','cawangan_detail','wtdDalamProses','api_url'));
return view('wtd.dalamprosesexcel', compact('tarikh_cetak', 'cawangan_detail', 'wtdDalamProses', 'api_url'));
}
}
}
public function janaSimulasi(Request $request)
{
$cawangan = Http::get(config('api.url') . '/api/cawangan/')->json();
return view('wtd.simulasi.janaSimulasi', compact('cawangan'));
}
public function showSimulasi(Request $request)
{
$request->validate([
'kodcaw' => 'required',
'tahun' => 'required',
], [
'kodcaw.required' => 'Sila Pilih Cawangan Terlebih Dahulu.',
'tahun.required' => 'Sila Masukkan Tahun Terlebih Dahulu.',
]);
$senaraiSimulasi = Http::get(config('api.url') . '/admin/wtd/janaSimulasi', ['kodcaw' => $request->kodcaw, 'tahun' => $request->tahun])->json();
$year = $request->tahun;
// dd($senaraiSimulasi, $request->kodcaw, $request->tahun);
return view('wtd.simulasi.show', compact('senaraiSimulasi', 'year'));
}
public function showRekod(Request $request)
{
$bulan = $request->input('month');
$bulanNumber = date('n', strtotime($bulan));
$rekod = Http::get(config('api.url') . '/admin/wtd/rekodSimulasi', ['kodcaw' => $request->kodcaw, 'month' => $bulanNumber, 'year' => $request->year])->json();
$totalBaki = collect($rekod)->sum('baki');
// dd($rekod, $bulanNumber, $totalBaki, $bulan);
return view('wtd.simulasi.rekod', compact('bulan', 'rekod', 'totalBaki'));
}
public function prosesWTD(Request $request)
{
// dd($request->input());
$request->validate([
'data.*.bulan' => 'required|string',
'data.*.jumlah_norujukan' => 'required|numeric',
'data.*.pembiayaan' => 'required|numeric',
'data.*.baki' => 'required|numeric',
'data.*.selected' => 'nullable',
]);
// Process the selected data
$data = $request->input('data', []);
$insertedRecords = [];
$kodcaw = $request->data[0]['kodcaw'];
foreach ($data as $item) {
if (isset($item['selected'])) {
$insertedRecords[] = [
'bulan' => $item['bulan'],
'tahun' => $request->tahun,
'kodcaw' => $kodcaw,
'jumlah_sag' => $item['jumlah_norujukan'],
'pembiayaan' => $item['pembiayaan'],
'baki' => $item['baki'],
'created_at' => now(),
'updated_at' => now(),
];
}
}
$response = Http::post(config('api.url') . '/admin/wtd/prosesSimulasi', [
'input' => $insertedRecords
])->json();
// dd($data, $insertedRecords, $kodcaw, $response);
return view('wtd.simulasi.pengesahan', compact('insertedRecords', 'response', 'kodcaw'));
}
public function pengesahanSimulasi(Request $request)
{
$response = Http::post(config('api.url') . '/admin/wtd/pengesahanSimulasi', [
'records' => $request->records,
'kodcaw' => $request->kodcaw,
])->json();
return view('wtd.index');
}
public function serahbaki()
{
return view('wtd.simulasi.serahbaki');
}
public function simulasiToDraft(Request $request)
{
$response = Http::post(config('api.url') . '/admin/wtd/simulasiToDraft', [
'bulan' => $request->bulan,
])->json();
dd($response);
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class JanaSimulasi extends Component
{
/**
* Create a new component instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.jana-simulasi');
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class SenaraiSimulasi extends Component
{
/**
* Create a new component instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.senarai-simulasi');
}
}
+153
View File
@@ -0,0 +1,153 @@
/*!
* Bootstrap v4.6.2 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* ApexCharts v3.35.4
* (c) 2018-2022 ApexCharts
* Released under the MIT License.
*/
/*!
* Pusher JavaScript Library v5.1.1
* https://pusher.com/
*
* Copyright 2017, Pusher
* Released under the MIT licence.
*/
/*!
* Pusher JavaScript Library v7.3.0
* https://pusher.com/
*
* Copyright 2020, Pusher
* Released under the MIT licence.
*/
/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
/*!
* Vue.js v2.7.8
* (c) 2014-2022 Evan You
* Released under the MIT License.
*/
/*!
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2021-03-02T17:08Z
*/
/*!
* vue-friendly-iframe v0.20.0 (https://github.com/officert/vue-friendly-iframe)
* (c) 2021 Tim Officer
* Released under the MIT License.
*/
/*!
* vuex v3.6.2
* (c) 2021 Evan You
* @license MIT
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! svg.draggable.js - v2.2.2 - 2019-01-08
* https://github.com/svgdotjs/svg.draggable.js
* Copyright (c) 2019 Wout Fierens; Licensed MIT */
/*! svg.filter.js - v2.0.2 - 2016-02-24
* https://github.com/wout/svg.filter.js
* Copyright (c) 2016 Wout Fierens; Licensed MIT */
/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.1
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//! moment.js
+2 -2
View File
@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=41f31e4c4d0a3f1615de3f2a5b78988c",
"/css/app.css": "/css/app.css?id=9cdabf7932d415c4f5598da3580b0fa1"
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}
+7 -2
View File
@@ -2,12 +2,17 @@
<div>
<div class="mx-auto mt-10 mb-10 flex justify-center">
<a href="/wtd/simulasi/janaSimulasi">
<button class="bg-yellow-500 p-4 rounded text-white mr-4">Jana Simulasi</button>
</a>
<router-link to="/wtd/rekod">
<button class="bg-yellow-500 p-4 rounded text-white mr-4">Rekod WTD</button>
</router-link>
<router-link to="/wtd/tambah">
<!-- <router-link to="/wtd/tambah">
<button class="bg-yellow-500 p-4 rounded text-white">Tambah WTD</button>
</router-link>
</router-link> -->
</div>
</div>
</template>
+9 -1
View File
@@ -1,5 +1,5 @@
<template>
<div class="mx-auto">
<div id="cawangan_selector" class="mx-auto">
<a v-if="route === 'ada'" class="text-yellow-200 rounded bg-gray-400 px-6 py-3 font-bold mr-4 uppercase sm:invisible lg:visible xl:visible">
CAWANGAN :
<select v-model="caw" @change="tukarcawangan" class="rounded-md border bg-gray-400 font-bold border-gray-400 focus:outline-none rounded-md focus:ring-1 ring-cyan-500 uppercase">
@@ -40,11 +40,19 @@
this.cawangan = response.data;
});
this.$on('updateCawangan', (newCaw) => {
this.caw = newCaw; // Update the header branch
});
fetch('/api/check/cawangan')
.then(response => response.json()).then(response => this.cawangan = response);
},
methods:{
getText: function(){
alert('emit triggered');
},
tukarcawangan: function(){
this.setkodcaw(this.caw)
@@ -0,0 +1,7 @@
<div>
<button type="button"
onclick="window.location.href='{{ route('simulate.generate') }}'"
class="bg-yellow-500 p-4 rounded text-white mr-4">
Jana Simulasi
</button>
</div>
@@ -0,0 +1,15 @@
{{-- <div class="bg-white p-6 shadow rounded-lg">
<button type="button"
onclick="window.location.href='{{ route('simulate.list') }}'"
class="focus:outline-none text-white bg-yellow-400 hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:focus:ring-yellow-900">
Senarai Simulasi
</button>
</div> --}}
<div>
<button type="button"
onclick="window.location.href='{{ route('simulate.list') }}'"
class="bg-yellow-500 p-4 rounded text-white">
Senarai Simulasi
</button>
</div>
+7 -5
View File
@@ -24,7 +24,7 @@
<link href="{{ asset('css/all.min.css') }}" rel="stylesheet">
<!-- Scripts -->
<script src="{{asset(mix('js/app.js')), true}}" defer></script>
<script src="{{ asset(mix('js/app.js')), true }}" defer></script>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.gstatic.com">
@@ -151,13 +151,15 @@
@auth
<clock-component></clock-component>
<cawangan-component roles={{ Auth::user()->roles }}
<cawangan-component @clickEvent_="getText()" roles={{ Auth::user()->roles }}
route={{ Route::is('home') || Route::is('akaun.home') || Route::is('audit.index') ? 'ada' : 'tiada' }}
akaun={{ Route::is('akaun.home') || Route::is('audit.index') ? 'yes' : 'no' }}>
akaun={{ Route::is('akaun.home') || Route::is('audit.index') ? 'yes' : 'no' }}
>
</cawangan-component>
<div class="mx-auto">
<a class="text-yellow-200 rounded bg-gray-400 px-6 py-3 font-bold mr-4 uppercase sm:invisible lg:visible xl:visible">
{{Auth::user()->roles}} : {{Auth::user()->name}}
<a
class="text-yellow-200 rounded bg-gray-400 px-6 py-3 font-bold mr-4 uppercase sm:invisible lg:visible xl:visible">
{{ Auth::user()->roles }} : {{ Auth::user()->name }}
</a>
</div>
@@ -0,0 +1,105 @@
@extends('layouts.app')
@section('content')
<div class="flex justify-center mt-10">
<div class="p-6 bg-white border border-gray-200 rounded-lg shadow-lg max-w-md w-full">
<h5 class="mb-6 text-2xl font-bold tracking-tight text-gray-900 text-center">Jana Simulasi</h5>
<form method="GET" action="{{ route('wtd.simulasi.show') }}">
@csrf
<div class="mb-4">
<label for="branch" class="block mb-2 text-sm font-medium text-gray-900">Sila Pilih Cawangan</label>
<select id="branch" name="kodcaw" required
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option disabled {{ old('kodcaw') ? '' : 'selected' }}>Pilih Cawangan</option>
@foreach ($cawangan as $cawanganItem)
<option value="{{ $cawanganItem['kodcaw'] }}"
{{ old('kodcaw') == $cawanganItem['kodcaw'] ? 'selected' : '' }}>
{{ $cawanganItem['details_caw'] }}
</option>
@endforeach
</select>
@error('kodcaw')
<p class="text-sm text-red-600 mt-1">{{ $message }}</p>
@enderror
</div>
<div class="mb-4">
<label for="year" class="block mb-2 text-sm font-medium text-gray-900">Sila Pilih Tahun</label>
<select id="year" name="tahun" required
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option disabled {{ old('tahun') ? '' : 'selected' }}>Pilih Tahun</option>
@for ($year = 2020; $year <= now()->year; $year++)
<option value="{{ $year }}" {{ old('tahun') == $year ? 'selected' : '' }}>
{{ $year }}</option>
@endfor
</select>
@error('tahun')
<p class="text-sm text-red-600 mt-1">{{ $message }}</p>
@enderror
</div>
<button type="submit"
class="w-full px-4 py-2 text-white bg-yellow-600 rounded-lg hover:bg-yellow-700 focus:ring-4 focus:ring-yellow-300">
Submit
</button>
</form>
</div>
</div>
<script>
// let branch = document.getElementById('branch');
// // alert(branch);
// branch.addEventListener('change',function(){
// alert('Hello');
// } )
// Ensure the DOM is fully loaded before accessing elements
// document.addEventListener('DOMContentLoaded', function() {
// let branch = document.getElementById('branch');
// // Check if the element exists
// if (branch) {
// branch.addEventListener('change', function(e) {
// alert('Hello');
// alert(branch.value);
// let q = document.getElementById('cawangan_selector')
// console.log(e);
// q.innerText = branch.value;
// });
// } else {
// console.error('Element with ID "branch" not found.');
// }
// });
// function updateHeaderCawangan(selectedCawangan) {
// alert('hello');
// let componentElement = document.querySelector('cawangan-component');
// // Create a custom event
// let event = new CustomEvent('clickEvent_', {
// detail: 'Some data', // Pass any data you need
// });
// // Dispatch the event on the component's DOM element
// componentElement.dispatchEvent(event);
// axios.post('/update-cawangan', {
// kodcaw: selectedCawangan
// }).then(response => {
// console.log('Cawangan updated successfully');
// }).catch(error => {
// console.error('Error updating cawangan:', error);
// });
// }
</script>
@include('layouts.footer')
@endsection
@@ -0,0 +1,89 @@
@extends('layouts.app')
@section('content')
<div class="container mx-auto mt-10">
<h1 class="text-2xl font-bold text-center my-4">Pengesahan Simulasi WTD</h1>
{{-- Display success or error messages --}}
@if (session('success'))
<div class="bg-green-500 text-white px-4 py-2 rounded mb-4">
{{ session('success') }}
</div>
@elseif (session('error'))
<div class="bg-red-500 text-white px-4 py-2 rounded mb-4">
{{ session('error') }}
</div>
@endif
<div class="overflow-x-auto">
<div>
<h5 class="text-lg font-semibold">Maklumat Simulasi yang Dipilih</h5>
</div>
<div class="py-2">
<a href="{{ url()->previous() }}"
class="inline-block bg-gray-500 hover:bg-gray-600 text-white px-4 py-2 rounded">
Kembali
</a>
</div>
@if (!empty($insertedRecords) && count($insertedRecords) > 0)
@php
// Calculate total baki
$totalBakiLelong = array_reduce(
$insertedRecords,
function ($sum, $record) {
return $sum + $record['baki'];
},
0,
);
@endphp
<table class="table-auto w-full border-collapse border border-gray-300">
<thead>
<tr class="bg-yellow-600 text-white">
<th class="border border-gray-200 px-4 py-2">Bulan</th>
<th class="border border-gray-200 px-4 py-2">Jumlah No Rujukan</th>
<th class="border border-gray-200 px-4 py-2">Pembiayaan</th>
<th class="border border-gray-200 px-4 py-2">Baki</th>
</tr>
</thead>
<tbody>
@foreach ($insertedRecords as $index => $record)
<tr class="{{ $index % 2 == 0 ? 'bg-gray-100' : 'bg-white' }}">
<td class="border border-gray-300 px-4 py-2 text-center">{{ $record['bulan'] }}</td>
<td class="border border-gray-300 px-4 py-2 text-center">{{ $record['jumlah_sag'] }}</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ number_format($record['pembiayaan'], 2) }}
</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ number_format($record['baki'], 2) }}
</td>
</tr>
@endforeach
<!-- Add the total row -->
<tr class="bg-gray-200 font-bold">
<td class="border border-gray-300 px-4 py-2 text-center" colspan="3">Jumlah Baki Lelong</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ number_format($totalBakiLelong, 2) }}
</td>
</tr>
</tbody>
</table>
@else
<p class="text-center text-gray-600 mt-4">Tiada data yang dipilih untuk pengesahan.</p>
@endif
</div>
<div class="flex justify-center mt-6">
<form action="{{ route('wtd.simulasi.proses-pengesahan') }}" method="POST">
@csrf
<input type="hidden" name="records" value="{{ json_encode($insertedRecords) }}">
<input type="hidden" name="kodcaw" value="{{ json_encode($kodcaw) }}">
<button type="submit" class="bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700">
Sahkan
</button>
</form>
</div>
</div>
@include('layouts.footer')
@endsection
@@ -0,0 +1,54 @@
@extends('layouts.app')
@section('content')
<div class="container mx-auto mt-10">
<h1 class="text2xl font-bold">
Senarai Surat Akuan Gadaian: <span class="underline hover:underline-offset-auto 2xl: uppercase font-extrabold">{{ $bulan }}</span>
</h1>
<div class="flex justify-end">
<h3 class="text-lg font-semibold">Jumlah Baki Lelong:
<span id="total-baki" class="text-yellow-600">
RM {{ number_format($totalBaki, 2) }}
</span>
</h3>
</div>
<div class="overflow-x-auto">
<table class="table-auto w-full border-collapse border border-gray-300">
<thead>
<tr class="bg-yellow-600 text-white">
<th class="border border-gray-200 px-4 py-2">#</th>
<th class="border border-gray-200 px-4 py-2">No Rujukan</th>
<th class="border border-gray-200 px-4 py-2">Tarikh Lelong</th>
<th class="border border-gray-200 px-4 py-2">Pembiayaan</th>
<th class="border border-gray-200 px-4 py-2">Baki Lelong</th>
</tr>
</thead>
<tbody>
@foreach ($rekod as $index => $item)
<tr class="{{ $index % 2 == 0 ? 'bg-gray-100' : 'bg-white' }}">
<td class="border border-gray-300 px-4 py-2 text-center">{{ $index + 1 }}</td>
<td class="px-4 py-2 border">{{ $item['norujukan'] }}</td>
<td class="px-4 py-2 border">{{ $item['t_lelong'] }}</td>
<td class="px-4 py-2 border">{{ number_format($item['pinjaman'], 2) }}</td>
<td class="px-4 py-2 border">{{ number_format($item['baki'], 2) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="mt-6">
<a href="{{ url()->previous() }}" class="inline-block bg-gray-500 hover:bg-gray-600 text-white px-4 py-2 rounded">
Kembali
</a>
</div>
</div>
@include('layouts.footer');
@endsection
+131
View File
@@ -0,0 +1,131 @@
@extends('layouts.app')
@section('content')
<div class="container mx-auto mt-10">
@if (session('success'))
<div class="bg-green-100 text-green-800 px-4 py-3 rounded mb-4">
{{ session('success') }}
</div>
@endif
<h2 class="text-2xl font-bold mb-6">Senarai Batch Simulasi Untuk Tahun: {{ $year }}</h2>
<div class="flex justify-end items-center mb-4">
<h3 class="text-lg font-semibold">Jumlah Baki Lelong:
<span id="total-baki" class="text-yellow-600">RM 0.00</span>
</h3>
</div>
<form id="proses-wtd-form" method="POST" action="{{ route('wtd.simulasi.pengesahan') }}">
@csrf
<div class="overflow-x-auto">
<table class="table-auto w-full border-collapse border border-gray-300">
<thead>
<tr class="bg-yellow-600 text-white">
<th class="border border-gray-200 px-4 py-2">#</th>
<th class="border border-gray-200 px-4 py-2">Bulan</th>
<th class="border border-gray-200 px-4 py-2">Jumlah SAG</th>
<th class="border border-gray-200 px-4 py-2">Pembiayaan</th>
<th class="border border-gray-200 px-4 py-2">Baki</th>
<th class="border border-gray-200 px-4 py-2 text-center">
<input id="select-all" type="checkbox" class="cursor-pointer">
</th>
</tr>
</thead>
<tbody>
@dd($senaraiSimulasi);
@foreach ($senaraiSimulasi as $index => $item)
<input type="hidden" name="tahun" value="{{ $year }}"/>
<tr class="{{ $index % 2 == 0 ? 'bg-gray-100' : 'bg-white' }}">
<td class="border border-gray-300 px-4 py-2 text-center">{{ $index + 1 }}</td>
<td class="border border-gray-300 px-4 py-2">
<a href="{{ route('wtd.simulasi.rekod', [
'month' => $item['bulan'],
'year' => $year,
'kodcaw' => $item['kodcaw'],
]) }}"
class="text-yellow-600 hover:underline">
{{ $item['bulan'] }}
</a>
<input type="hidden" name="data[{{ $index }}][kodcaw]"
value="{{ $item['kodcaw'] }}">
<input type="hidden" name="data[{{ $index }}][bulan]"
value="{{ $item['bulan'] }}">
</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ $item['jumlah_norujukan'] ?? 0 }}
<input type="hidden" name="data[{{ $index }}][jumlah_norujukan]"
value="{{ $item['jumlah_norujukan'] }}">
</td>
<td class="border border-gray-300 px-4 py-2">
{{ number_format($item['pembiayaan'], 2) }}
<input type="hidden" name="data[{{ $index }}][pembiayaan]"
value="{{ $item['pembiayaan'] }}">
</td>
<td class="border border-gray-300 px-4 py-2" data-baki="{{ $item['baki'] }}">
{{ number_format($item['baki'], 2) }}
<input type="hidden" name="data[{{ $index }}][baki]"
value="{{ $item['baki'] }}">
</td>
<td class="border border-gray-300 px-4 py-2 text-center">
<input type="checkbox" class="row-checkbox" data-baki="{{ $item['baki'] }}"
name="data[{{ $index }}][selected]">
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="flex justify-end mt-4">
<button type="submit" id="proses-wtd-btn"
class="bg-yellow-600 text-white px-6 py-2 rounded cursor-pointer hover:bg-yellow-700">
Jana Simulasi
</button>
</div>
</form>
</div>
@include('layouts.footer')
@endsection
<script>
document.addEventListener('DOMContentLoaded', function() {
const selectAllCheckbox = document.getElementById('select-all');
const rowCheckboxes = document.querySelectorAll('.row-checkbox');
const totalBakiElement = document.getElementById('total-baki');
function formatCurrency(amount) {
return `RM ${amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')}`;
}
function calculateTotalBaki() {
let total = 0;
rowCheckboxes.forEach(checkbox => {
if (checkbox.checked) {
total += parseFloat(checkbox.dataset.baki);
}
});
totalBakiElement.textContent = formatCurrency(total);
}
selectAllCheckbox.addEventListener('change', function() {
rowCheckboxes.forEach(checkbox => {
checkbox.checked = this.checked;
});
calculateTotalBaki();
});
rowCheckboxes.forEach(checkbox => {
checkbox.addEventListener('change', function() {
if (!this.checked) {
selectAllCheckbox.checked = false;
}
if (Array.from(rowCheckboxes).every(cb => cb.checked)) {
selectAllCheckbox.checked = true;
}
calculateTotalBaki();
});
});
});
</script>
+19
View File
@@ -7,6 +7,8 @@ use App\Http\Controllers\OnlineTransactionGadaianController;
use App\Http\Controllers\OnlineTransactionLogController;
use App\Http\Controllers\OnlineTransactionTrailController;
use App\Http\Controllers\AutoSerahanController;
use App\Http\Controllers\SimulasiWTDController;
use App\Http\Controllers\WTDController;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Http;
@@ -161,6 +163,23 @@ Route::get('/wtd',['as'=>'wtd.index','uses'=>'App\Http\Controllers\WTDController
Route::get('/wtd/cetakan', ['as'=>'wtd.cetak','uses'=>'App\Http\Controllers\WTDController@CetakSenarai']);
Route::get('/wtd/dalamproses', ['as'=>'wtd.dalamproses','uses'=>'App\Http\Controllers\WTDController@CetakWtdDalamProses']);
//Aiman WTD
Route::get('/wtd/simulasi/janaSimulasi', [WTDController::class, 'janaSimulasi'])->name('wtd.simulasi.janaSimulasi');
Route::get('/wtd/simulasi/show', [WTDController::class, 'showSimulasi'])->name('wtd.simulasi.show');
Route::get('/wtd/simulasi/rekod', [WTDController::class, 'showRekod'])->name('wtd.simulasi.rekod');
// Route::post('/wtd/simulasi/proses', [WTDController::class, 'prosesWTD'])->name('wtd.simulasi.proses');
Route::post('/wtd/simulasi/pengesahan', [WTDController::class, 'prosesWTD'])->name('wtd.simulasi.pengesahan');
Route::post('/wtd/rekod', [WTDController::class, 'pengesahanSimulasi'])->name('wtd.simulasi.proses-pengesahan');
Route::post('/wtd/simulasi/simulasiToDraft', [WTDController::class, 'simulasiToDraft']);
Route::get('/wtd/simulasi/serahbaki', [WTDController::class, 'serahbaki']);
//Audit
Route::get('/audit',['as'=>'audit.index','uses'=>'App\Http\Controllers\AkaunController@AuditGenerator']);