Compare commits
30 Commits
3d3a7f35f9
...
80912b2c2c
| Author | SHA1 | Date | |
|---|---|---|---|
| 80912b2c2c | |||
| af15880b0c | |||
| 87e2aaad50 | |||
| a825b0b467 | |||
| b0792cceb0 | |||
| 82f31baa6a | |||
| 7175d0dbcf | |||
| 15575dc8c0 | |||
| 03a0142066 | |||
| 5e7fe8c3ab | |||
| 358baf3453 | |||
| 7eebd79397 | |||
| f7dd2fae7b | |||
| b8cc3f38cc | |||
| c06e33bc1c | |||
| b95f68bd3f | |||
| c989197e76 | |||
| e3424e9161 | |||
| da06ff709c | |||
| d6b4685f54 | |||
| 173ce892b9 | |||
| 6af434360d | |||
| aaf784ad79 | |||
| 3456059db4 | |||
| cd9f83e21f | |||
| 1e174a48b6 | |||
| 80b8fd3a24 | |||
| 71990e7582 | |||
| 31dc30ed60 | |||
| bb8bcae8e8 |
@@ -0,0 +1,11 @@
|
||||
.git
|
||||
node_modules
|
||||
vendor
|
||||
storage/logs
|
||||
storage/framework/cache
|
||||
storage/framework/sessions
|
||||
storage/framework/views
|
||||
storage/debugbar
|
||||
npm-debug.log
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:O1XZDqK4H6+3GdrODgCaLr2l+OoWvgVhYr0GJ1KizW8=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
# API_URL=http://api-annurv2.test
|
||||
API_URL=http://host.docker.internal:8080
|
||||
API_URL_KOOP=http://host.docker.internal:8080
|
||||
API_URL_PKB=http://host.docker.internal:8080
|
||||
API_ARRAHNBID=http://lelong.test/api/
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=mysql
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=kaunter_erahn
|
||||
DB_USERNAME=kaunteruser
|
||||
DB_PASSWORD=password
|
||||
|
||||
BROADCAST_DRIVER=pusher
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
PUSHER_APP_ID=1132718
|
||||
PUSHER_APP_KEY=26b0ec2f297f94b7aa9b
|
||||
PUSHER_APP_SECRET=421b61fb5a8ecce477a6
|
||||
|
||||
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=
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
MYKAD_READER_PORT=8085
|
||||
MYKAD_READER_ENABLED_CAWANGAN='' # IF NO CAWANGAN STATED, ALL CAWANGAN IS ENABLED
|
||||
+1
-1
@@ -11,5 +11,5 @@ Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.vscode
|
||||
docker-compose.yml
|
||||
docker_src/
|
||||
**/.DS_Store
|
||||
@@ -1 +1,51 @@
|
||||
If you does't know what is this you probably in wrong project
|
||||
|
||||
```sql
|
||||
--- for all ip
|
||||
CREATE USER 'kaunteruser'@'%' IDENTIFIED BY 'your_password';
|
||||
|
||||
--- for specific ip
|
||||
CREATE USER 'kaunteruser'@'localhost' IDENTIFIED BY 'your_password';
|
||||
|
||||
GRANT ALL PRIVILEGES ON kaunter_erahn.* TO 'kaunteruser'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
# ADDITIONAL NOTE
|
||||
|
||||
## customers/v2/index.blade.php is modal to register customer
|
||||
|
||||
## Min Komoditi = RM5000
|
||||
|
||||
# System Flowchart
|
||||
|
||||
## Proses Gadaian
|
||||
1) Pelanggan datang bawa marhun
|
||||
2) Teller daftar maklumat pelanggan jika pelanggan baharu
|
||||
3) Serah marhun ke penilai untuk timbang
|
||||
4) Teller daftar marhun di sistem berdasarkan maklumat dari penilai
|
||||
5) Penilai print SAG dan serah marhun ke Khazanah (PC/PPC) - __khazanah can still scan still scan though__
|
||||
6) Khazanah scan barcode dekat SAG untuk masuk ke dalam peti besi
|
||||
* table involved - gadai.semakbarcode (default is blank, after is Lulus)
|
||||
7) DONE
|
||||
|
||||
## Setup new branch command:
|
||||
1. Duplicate previous branch table - use erahn_{{name}}
|
||||
```sql
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
SET SESSION group_concat_max_len = 1000000;
|
||||
|
||||
SELECT GROUP_CONCAT(
|
||||
CONCAT('TRUNCATE TABLE `', table_name, '`')
|
||||
SEPARATOR '; '
|
||||
) INTO @sql
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = DATABASE();
|
||||
|
||||
SELECT @sql; --- copy the output and paste it
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
```
|
||||
2. Add new cawangan kod on master_erahn.arrahn_master_db and and kaunter_erahn.cawangan
|
||||
3. Register new cawangan detail in erahn_{{name}}.cawangan
|
||||
@@ -0,0 +1,27 @@
|
||||
## CAWANGAN XTRA - X0301
|
||||
- WAN NUR FATIN NATASYA BINTI W M AZHARI - PENILAI
|
||||
- MOHAMAD KHAIRULNIZAN BIN JUSOF - TELLER
|
||||
- MOHAMAD AZUHAIDIE BIN AHMAD - PPC
|
||||
- WAN NURUL AMIRA BINTI WAN HARON - PC
|
||||
|
||||
## Akaun
|
||||
- admin@test.com
|
||||
- admin2@test.com
|
||||
|
||||
Module Gadai Online:
|
||||
- Langkah 1
|
||||
- Langkah 2
|
||||
[x] PC akan tekan submit, then customer akan masuk ke senarai online mengikut batch
|
||||
[x] PC boleh semak list customer yang pilih gadai online
|
||||
- Langkah 3 (Operasi)
|
||||
[x] dapat dalam bentuk list
|
||||
[x] Apa jadi kalau operasi reject? - patah balik ke pc, untuk pc buat semakan balik
|
||||
- Langkah 4
|
||||
- Langkah 5
|
||||
- Langkah 6
|
||||
- Langkah 7
|
||||
[x] Macam mana PC nak tahu pembayaran berjaya (Tally PAID page)
|
||||
[x] Kalau online, dia kena upload kat mana (Operasi: PAID + bukti)
|
||||
- Langkah 8
|
||||
[x] PC semak senarai pelanggan gadai tu tally atau tak
|
||||
[ ] PC tekan butang blast ke (tanda selesai ada; WhatsApp/SMS belum wire)
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
|
||||
class NotifikasiAnggota implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $nokp;
|
||||
public $status; // DILULUSKAN atau DITOLAK
|
||||
public $komen;
|
||||
public $tagoperasi;
|
||||
|
||||
public function __construct($nokp, $status, $komen, $tagoperasi = null)
|
||||
{
|
||||
$this->nokp = $nokp;
|
||||
$this->status = strtoupper($status); // pastikan huruf besar DILULUSKAN/DITOLAK
|
||||
$this->komen = $komen;
|
||||
$this->tagoperasi = $tagoperasi;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return ['notice-anggota'];
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'my-anggota';
|
||||
}
|
||||
|
||||
public function broadcastWith()
|
||||
{
|
||||
return [
|
||||
'noic' => $this->nokp,
|
||||
'status' => $this->status, // ikut format API updateAnggota
|
||||
'komen' => $this->komen,
|
||||
'tagoperasi' => $this->tagoperasi,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\User;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ImpersonateController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function impersonate(Request $request, $id): RedirectResponse
|
||||
{
|
||||
Gate::authorize('impersonate');
|
||||
|
||||
$impersonator = $request->user();
|
||||
$id = (int) $id;
|
||||
$target = User::findOrFail($id);
|
||||
|
||||
if ($target->id === $request->user()->id) {
|
||||
return back()->with('error', 'Tidak boleh impersonate diri sendiri.');
|
||||
}
|
||||
|
||||
if (method_exists($target, 'canBeImpersonated') && !$target->canBeImpersonated()) {
|
||||
return back()->with('error', 'Akaun ini tidak boleh di-impersonate.');
|
||||
}
|
||||
|
||||
$request->user()->impersonate($target);
|
||||
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
||||
public function leave(Request $request): RedirectResponse
|
||||
{
|
||||
if ($request->user() && method_exists($request->user(), 'isImpersonated') && $request->user()->isImpersonated()) {
|
||||
$impersonated = $request->user();
|
||||
$impersonator = method_exists($impersonated, 'impersonator') ? $impersonated->impersonator() : null;
|
||||
|
||||
$request->user()->leaveImpersonation();
|
||||
}
|
||||
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +60,7 @@ class LoginController extends Controller
|
||||
'password' => 'required|string',
|
||||
]);
|
||||
|
||||
$credentials = $request->only('email', 'password');
|
||||
|
||||
if (Auth::guard('web')->attempt($credentials)) {
|
||||
if ($this->attemptWebLogin($request)) {
|
||||
|
||||
$auth_user = Auth::guard('web')->user();
|
||||
$api_url = config('api.url');
|
||||
@@ -103,9 +101,7 @@ class LoginController extends Controller
|
||||
'password' => 'required|string',
|
||||
]);
|
||||
|
||||
$credentials = $request->only('email', 'password');
|
||||
|
||||
if (Auth::guard('dashboard')->attempt($credentials,true)) {
|
||||
if ($this->attemptDashboardLogin($request)) {
|
||||
$auth_user = Auth::guard('dashboard')->user();
|
||||
|
||||
$user_login['nama'] = $auth_user['name'];
|
||||
@@ -187,4 +183,42 @@ class LoginController extends Controller
|
||||
|
||||
return response()->json($kakitangan,200);
|
||||
}
|
||||
|
||||
/**
|
||||
* In local environment, log in by email only (password ignored).
|
||||
*/
|
||||
private function attemptWebLogin(Request $request): bool
|
||||
{
|
||||
if (app()->environment('local')) {
|
||||
$user = User::where('email', $request->email)->first();
|
||||
if ($user) {
|
||||
Auth::guard('web')->login($user);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return Auth::guard('web')->attempt($request->only('email', 'password'));
|
||||
}
|
||||
|
||||
/**
|
||||
* In local environment, log in by email only (password ignored).
|
||||
*/
|
||||
private function attemptDashboardLogin(Request $request): bool
|
||||
{
|
||||
if (app()->environment('local')) {
|
||||
$user = Dashboard::where('email', $request->email)->first();
|
||||
if ($user) {
|
||||
Auth::guard('dashboard')->login($user, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return Auth::guard('dashboard')->attempt($request->only('email', 'password'), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Twilio\Rest\Client;
|
||||
use App\Komoditi;
|
||||
use App\Events\Dashboard\PelangganNotify;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
@@ -24,7 +25,7 @@ class CustomersController extends Controller
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->customerService = New CustomerService();
|
||||
$this->customerService = new CustomerService();
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -38,84 +39,241 @@ class CustomersController extends Controller
|
||||
$api_url = config('api.url');
|
||||
$auth_user = Auth::user();
|
||||
$idtype = 'nokp';
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
$bank = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bank')->json();
|
||||
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
|
||||
$blacklist_search = false;
|
||||
|
||||
return view('customers.' . $cawangan_info['version'] . '.index',compact('search','blacklist_search','cawangan_info','bank','api_url','idtype','pekerjaan'));
|
||||
return view('customers.' . $cawangan_info['version'] . '.index', compact('search', 'blacklist_search', 'cawangan_info', 'bank', 'api_url', 'idtype', 'pekerjaan'));
|
||||
}
|
||||
|
||||
public function info(Request $request){
|
||||
public function info(Request $request)
|
||||
{
|
||||
$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();
|
||||
|
||||
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. Session::get('noic'))->json();
|
||||
// dd($customer_info);
|
||||
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
|
||||
// 🔹 Panggil maklumat cawangan
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/cawangan/' . $auth_user['cawangan'])
|
||||
->json();
|
||||
|
||||
// 🔹 Panggil maklumat pelanggan (customer)
|
||||
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/customers/' . Session::get('noic'))
|
||||
->json();
|
||||
|
||||
// 🔹 Panggil maklumat pekerjaan
|
||||
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/pekerjaan')
|
||||
->json();
|
||||
|
||||
$komoditi = Komoditi::first();
|
||||
$min_komoditi = $komoditi['min_komoditi'];
|
||||
|
||||
$bakilelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/baki')->json();
|
||||
$rugilelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/rugi')->json();
|
||||
// 🔹 Panggil baki lelong
|
||||
$bakilelong = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/baki')
|
||||
->json();
|
||||
|
||||
// 🔹 Panggil rugi lelong
|
||||
$rugilelong = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/rugi')
|
||||
->json();
|
||||
|
||||
// 🔹 Reset session sementara
|
||||
$request->session()->forget('page_reload');
|
||||
$request->session()->forget('norujukan');
|
||||
|
||||
$customer_page = ($cawangan_info['version'] == 'v1') ? 'customers.v1.info' : 'customers.v2.info';
|
||||
$customer_page = ($cawangan_info['version'] == 'v1')
|
||||
? 'customers.v1.info'
|
||||
: 'customers.v2.info';
|
||||
|
||||
$getApprovalError = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/getApproval',[
|
||||
'kodcaw' => $auth_user['cawangan'],
|
||||
'teller' => $auth_user['name'],
|
||||
])->json();
|
||||
// Logik papar butang "Assign sebagai Anggota"
|
||||
$showAssignAnggotaBtn = false;
|
||||
$noic = Session::get('noic');
|
||||
|
||||
if($request->tebus_auto_tawarruq_berjaya === 'true'){
|
||||
if (!empty($customer_info)) {
|
||||
|
||||
$anggota_info = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/customer/anggota', [
|
||||
'noic' => $noic
|
||||
])
|
||||
->json();
|
||||
$isAnggotaExist = isset($anggota_info) && !empty($anggota_info) && !isset($anggota_info['message']);
|
||||
|
||||
if ($isAnggotaExist && isset($customer_info['tag_anggota']) && $customer_info['tag_anggota'] == 0) {
|
||||
$showAssignAnggotaBtn = true;
|
||||
}
|
||||
}
|
||||
|
||||
$getApprovalError = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/getApproval', [
|
||||
'kodcaw' => $auth_user['cawangan'],
|
||||
'teller' => $auth_user['name'],
|
||||
])
|
||||
->json();
|
||||
|
||||
if ($request->tebus_auto_tawarruq_berjaya === 'true') {
|
||||
$request->session()->flash('activate_tab', 'SAG_baru');
|
||||
}
|
||||
|
||||
return view($customer_page,compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','min_komoditi','pekerjaan','getApprovalError'));
|
||||
return view($customer_page, compact(
|
||||
'cawangan_info',
|
||||
'api_url',
|
||||
'customer_info',
|
||||
'bakilelong',
|
||||
'rugilelong',
|
||||
'min_komoditi',
|
||||
'pekerjaan',
|
||||
'getApprovalError',
|
||||
'showAssignAnggotaBtn'
|
||||
));
|
||||
}
|
||||
|
||||
public function search(Request $request){
|
||||
// dd($request->all());
|
||||
|
||||
public function search(Request $request)
|
||||
{
|
||||
$noic = $request->noic;
|
||||
$idtype = $request->customerIDType;
|
||||
Session::put('noic', $noic);
|
||||
|
||||
$api_url = config('api.url');
|
||||
$auth_user = Auth::user();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
$bank = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bank')->json();
|
||||
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $noic)->json();
|
||||
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
|
||||
|
||||
$blacklist = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customer/blacklist',[
|
||||
'nokp' => $noic
|
||||
])->json();
|
||||
// if($customers_info){
|
||||
// $customer_info = $customers_info[0];
|
||||
// }else{
|
||||
// $customer_info = $customers_info;
|
||||
// }
|
||||
// Dapatkan maklumat asas
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/cawangan/' . $auth_user['cawangan'])
|
||||
->json();
|
||||
|
||||
$bank = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/bank')
|
||||
->json();
|
||||
|
||||
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/customers/' . $noic)
|
||||
->json();
|
||||
|
||||
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/pekerjaan')
|
||||
->json();
|
||||
|
||||
$blacklist = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/customer/blacklist', ['nokp' => $noic])
|
||||
->json();
|
||||
|
||||
// Reset session lama
|
||||
$request->session()->forget('page_reload');
|
||||
$request->session()->forget('norujukan');
|
||||
|
||||
$blacklist_search = false;
|
||||
$search = true;
|
||||
if($customer_info){
|
||||
if($blacklist){
|
||||
|
||||
// SEMAK STATUS ANGGOTA DAN PELANGGAN
|
||||
$isAnggota = false;
|
||||
$isPelanggan = false;
|
||||
$isNewCustomer = false;
|
||||
$showAssignAnggotaBtn = false;
|
||||
$showDaftarPelangganBtn = false;
|
||||
|
||||
// Semak dalam sistem anggota
|
||||
$anggota_info = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get(config('api.url') . '/api/customer/anggota', [
|
||||
'noic' => $noic
|
||||
])
|
||||
->json();
|
||||
|
||||
// Semak betul-betul jika ada rekod anggota
|
||||
if (!empty($anggota_info) && isset($anggota_info['data']) && !empty($anggota_info['data'])) {
|
||||
$isAnggota = true;
|
||||
} elseif (isset($anggota_info['noic']) && !empty($anggota_info['noic'])) {
|
||||
$isAnggota = true;
|
||||
}
|
||||
|
||||
if ($customer_info && isset($customer_info['id'])) {
|
||||
$isPelanggan = true;
|
||||
}
|
||||
|
||||
// Tentukan butang mana nak paparkan (logik diperbetulkan)
|
||||
if ($isPelanggan && !$isAnggota) {
|
||||
// Pelanggan dah berdaftar tapi bukan anggota koperasi
|
||||
$showAssignAnggotaBtn = true;
|
||||
} elseif ($isAnggota && !$isPelanggan) {
|
||||
// Anggota koperasi tapi belum berdaftar sebagai pelanggan
|
||||
$showDaftarPelangganBtn = true;
|
||||
} elseif (!$isAnggota && !$isPelanggan) {
|
||||
// Bukan anggota dan bukan pelanggan (pelanggan baru)
|
||||
$showDaftarPelangganBtn = true;
|
||||
$isNewCustomer = true;
|
||||
}
|
||||
|
||||
//Debug log untuk semak nilai sebenar
|
||||
// Log::info('DEBUG CUSTOMER STATUS', [
|
||||
// 'noic' => $noic,
|
||||
// 'isAnggota' => $isAnggota,
|
||||
// 'isPelanggan' => $isPelanggan,
|
||||
// 'isNewCustomer' => $isNewCustomer,
|
||||
// 'showAssignAnggotaBtn' => $showAssignAnggotaBtn,
|
||||
// 'showDaftarPelangganBtn' => $showDaftarPelangganBtn,
|
||||
// ]);
|
||||
|
||||
if ($customer_info) {
|
||||
// Ada maklumat pelanggan
|
||||
if ($blacklist) {
|
||||
$blacklist_search = true;
|
||||
return view('customers.' . $cawangan_info['version'] .'.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype'));
|
||||
}else{
|
||||
Session::put('customer_info',$customer_info);
|
||||
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]);
|
||||
return view('customers.' . $cawangan_info['version'] . '.index', compact(
|
||||
'blacklist_search',
|
||||
'customer_info',
|
||||
'search',
|
||||
'noic',
|
||||
'cawangan_info',
|
||||
'bank',
|
||||
'api_url',
|
||||
'idtype',
|
||||
'isAnggota',
|
||||
'isPelanggan',
|
||||
'isNewCustomer',
|
||||
'showAssignAnggotaBtn',
|
||||
'showDaftarPelangganBtn',
|
||||
'auth_user'
|
||||
));
|
||||
} else {
|
||||
// Simpan dalam session & redirect ke paparan info pelanggan
|
||||
Session::put('customer_info', $customer_info);
|
||||
return redirect()->route('customer_info')->with([
|
||||
'customer_info' => $customer_info,
|
||||
'cawangan_info' => $cawangan_info,
|
||||
'api_url' => $api_url,
|
||||
'isAnggota' => $isAnggota,
|
||||
'isPelanggan' => $isPelanggan,
|
||||
'isNewCustomer' => $isNewCustomer,
|
||||
'showAssignAnggotaBtn' => $showAssignAnggotaBtn,
|
||||
'showDaftarPelangganBtn' => $showDaftarPelangganBtn,
|
||||
'auth_user' => $auth_user
|
||||
]);
|
||||
}
|
||||
}else{
|
||||
if($blacklist){
|
||||
} else {
|
||||
// Tiada customer dalam sistem
|
||||
if ($blacklist) {
|
||||
$blacklist_search = true;
|
||||
return view('customers.' . $cawangan_info['version'] . '.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype','pekerjaan'));
|
||||
}else{
|
||||
return view('customers.' . $cawangan_info['version'] . '.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype','pekerjaan'));
|
||||
}
|
||||
|
||||
return view('customers.' . $cawangan_info['version'] . '.index', compact(
|
||||
'blacklist_search',
|
||||
'customer_info',
|
||||
'search',
|
||||
'noic',
|
||||
'cawangan_info',
|
||||
'bank',
|
||||
'api_url',
|
||||
'idtype',
|
||||
'pekerjaan',
|
||||
'isAnggota',
|
||||
'isPelanggan',
|
||||
'isNewCustomer',
|
||||
'showAssignAnggotaBtn',
|
||||
'showDaftarPelangganBtn',
|
||||
'auth_user'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,9 +281,9 @@ class CustomersController extends Controller
|
||||
public function cari(Request $request)
|
||||
{
|
||||
$api_url = config('api.url');
|
||||
$customers_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $request->icno)->json();
|
||||
$customers_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $request->icno)->json();
|
||||
|
||||
if(sizeof($customers_info) > 0)
|
||||
if (sizeof($customers_info) > 0)
|
||||
return $customers_info;
|
||||
else
|
||||
return response(["no-data"], 200);
|
||||
@@ -149,60 +307,58 @@ class CustomersController extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
if($request->idtype == 'nokp'){
|
||||
if ($request->idtype == 'nokp') {
|
||||
$nokpbaru = $request->noic;
|
||||
$nokplama = '';
|
||||
}elseif($request->idtype == 'passport'){
|
||||
} elseif ($request->idtype == 'passport') {
|
||||
$nokpbaru = '';
|
||||
$nokplama = $request->noic;
|
||||
}
|
||||
if($request->warganegara){
|
||||
if ($request->warganegara) {
|
||||
$warganegara = 'Y';
|
||||
}else{
|
||||
} else {
|
||||
$warganegara = 'N';
|
||||
}
|
||||
if($request->bumiputera){
|
||||
if ($request->bumiputera) {
|
||||
$bumiputera = 'Y';
|
||||
}else{
|
||||
} else {
|
||||
$bumiputera = 'N';
|
||||
}
|
||||
if($request->jantina == 'Lelaki'){
|
||||
if ($request->jantina == 'Lelaki') {
|
||||
$jantina = 'L';
|
||||
}elseif($request->jantina == 'Perempuan'){
|
||||
} elseif ($request->jantina == 'Perempuan') {
|
||||
$jantina = 'P';
|
||||
}
|
||||
$split_date = explode('/',$request->tarikh_lahir);
|
||||
$split_date = explode('/', $request->tarikh_lahir);
|
||||
|
||||
$tarikh_lahir = $split_date[2].'-'.$split_date[1].'-'.$split_date[0];
|
||||
$tarikh_lahir = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
|
||||
$tarikhlahir = Carbon::parse($tarikh_lahir);
|
||||
$auth_user = Auth::user();
|
||||
$latest_customer = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/latest/' . $auth_user['cawangan'])->json();
|
||||
|
||||
if($latest_customer == null){
|
||||
if ($latest_customer == null) {
|
||||
$nosiri_latest = 1;
|
||||
}
|
||||
else{
|
||||
$nosiri_latest = $latest_customer['nosiri']+1;
|
||||
} else {
|
||||
$nosiri_latest = $latest_customer['nosiri'] + 1;
|
||||
}
|
||||
|
||||
$count = sprintf("%08d", $nosiri_latest);
|
||||
|
||||
$no_pelanggan = $request->bangsa . substr($request->noic,6,2).'-'.$count;
|
||||
$no_pelanggan = $request->bangsa . substr($request->noic, 6, 2) . '-' . $count;
|
||||
$detail_poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $request->poskod)->json();
|
||||
|
||||
if(empty($detail_poskod)){
|
||||
if (empty($detail_poskod)) {
|
||||
|
||||
$detail_poskod = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->post(config('api.url') . '/api/poskod', [
|
||||
'poskod' => $request->poskod,
|
||||
'koddaerah' => $request->koddaerah,
|
||||
'kodnegeri' => $request->kodnegeri,
|
||||
'user' => auth()->user(),
|
||||
])->json();
|
||||
|
||||
->post(config('api.url') . '/api/poskod', [
|
||||
'poskod' => $request->poskod,
|
||||
'koddaerah' => $request->koddaerah,
|
||||
'kodnegeri' => $request->kodnegeri,
|
||||
'user' => auth()->user(),
|
||||
])->json();
|
||||
}
|
||||
|
||||
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/customers/create/'. $auth_user['cawangan'],[
|
||||
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/customers/create/' . $auth_user['cawangan'], [
|
||||
'kodcaw' => $auth_user['cawangan'],
|
||||
'nopelanggan' => $no_pelanggan,
|
||||
'nokpbaru' => $nokpbaru,
|
||||
@@ -224,61 +380,117 @@ class CustomersController extends Controller
|
||||
'teller' => $auth_user['name'],
|
||||
'telefon2' => $request->alternate_phone,
|
||||
'nosiri' => $nosiri_latest,
|
||||
'nota'=>$request->nota,
|
||||
'kodkerja'=>$request->pekerjaan,
|
||||
'nota_pekerjaan'=>$request->nota_pekerjaan,
|
||||
'notaarcc'=>$request->notaarcc,
|
||||
'tujuangadai'=>$request->tujuan_gadai,
|
||||
'nota' => $request->nota,
|
||||
'kodkerja' => $request->pekerjaan,
|
||||
'nota_pekerjaan' => $request->nota_pekerjaan,
|
||||
'notaarcc' => $request->notaarcc,
|
||||
'tujuangadai' => $request->tujuan_gadai,
|
||||
]);
|
||||
|
||||
Session::put('customer_info', $customer_info);
|
||||
Session::put('noic', $request->noic);
|
||||
|
||||
event(new PelangganNotify('lulus',$auth_user['cawangan']));
|
||||
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info] );
|
||||
event(new PelangganNotify('lulus', $auth_user['cawangan']));
|
||||
return redirect()->route('customer_info')->with(['customer_info' => $customer_info]);
|
||||
}
|
||||
|
||||
public function getOTP(Request $request){
|
||||
public function getOTP(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$expired = Carbon::now();
|
||||
$expired = new Carbon();
|
||||
$expired = $expired->addHours(24);
|
||||
$currentDateTime = Carbon::now();
|
||||
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
$nama_cawangan = $cawangan_info["details_caw"];
|
||||
|
||||
$nokp = $request->noic_otp;
|
||||
$customer = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/customers/'.$nokp)->json();
|
||||
$recipient = '6'.$customer['telefon'];
|
||||
$customer = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $nokp)->json();
|
||||
$recipient = '6' . $customer['telefon'];
|
||||
// $recipient = '60189025461';
|
||||
//pembinaan token
|
||||
function token($length) {
|
||||
function token($length)
|
||||
{
|
||||
$characters = array(
|
||||
"A","B","C","D","E","F","G","H","J","K","L","M",
|
||||
"N","P","Q","R","S","T","U","V","W","X","Y","Z",
|
||||
"a","b","c","d","e","f","g","h","i","j","k","m",
|
||||
"n","o","p","q","r","s","t","u","v","w","x","y","z",
|
||||
"1","2","3","4","5","6","7","8","9");
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
"M",
|
||||
"N",
|
||||
"P",
|
||||
"Q",
|
||||
"R",
|
||||
"S",
|
||||
"T",
|
||||
"U",
|
||||
"V",
|
||||
"W",
|
||||
"X",
|
||||
"Y",
|
||||
"Z",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
"f",
|
||||
"g",
|
||||
"h",
|
||||
"i",
|
||||
"j",
|
||||
"k",
|
||||
"m",
|
||||
"n",
|
||||
"o",
|
||||
"p",
|
||||
"q",
|
||||
"r",
|
||||
"s",
|
||||
"t",
|
||||
"u",
|
||||
"v",
|
||||
"w",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9"
|
||||
);
|
||||
if ($length < 0 || $length > count($characters)) return null;
|
||||
shuffle($characters);
|
||||
return implode("", array_slice($characters, 0, $length));
|
||||
}
|
||||
|
||||
$otp_token = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/otp/' . $nokp) ->json();
|
||||
$otp_token_used = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/otp/used/' . $nokp) ->json();
|
||||
$otp_token = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/otp/' . $nokp)->json();
|
||||
$otp_token_used = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/otp/used/' . $nokp)->json();
|
||||
|
||||
if (is_array($otp_token) || is_object($otp_token)){
|
||||
if($otp_token){
|
||||
if (is_array($otp_token) || is_object($otp_token)) {
|
||||
if ($otp_token) {
|
||||
return response(['error' => "OTP Akaun Telah Di Jana"]);
|
||||
}else{
|
||||
if (is_array($otp_token_used) || is_object($otp_token_used)){
|
||||
if($otp_token_used){
|
||||
} else {
|
||||
if (is_array($otp_token_used) || is_object($otp_token_used)) {
|
||||
if ($otp_token_used) {
|
||||
return response(['error' => "Pelanggan Sudah Mendaftar Pada Customer Portal"]);
|
||||
}else{
|
||||
} else {
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/otp/generateotp/' . $nokp, [
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
@@ -286,12 +498,12 @@ class CustomersController extends Controller
|
||||
// $message = "Your OTP code is " . $random;
|
||||
$message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
|
||||
$this->sendWhatsAppMessage($message, $recipient);
|
||||
return response()->json(['otp'=>$random]);
|
||||
return response()->json(['otp' => $random]);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/otp/generateotp/' . $nokp, [
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
@@ -299,17 +511,17 @@ class CustomersController extends Controller
|
||||
// $message = "Your OTP code is " . $random;
|
||||
$message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
|
||||
$this->sendWhatsAppMessage($message, $recipient);
|
||||
return response()->json(['otp'=>$random]);
|
||||
return response()->json(['otp' => $random]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (is_array($otp_token_used) || is_object($otp_token_used)){
|
||||
if($otp_token_used){
|
||||
} else {
|
||||
if (is_array($otp_token_used) || is_object($otp_token_used)) {
|
||||
if ($otp_token_used) {
|
||||
return response(['error' => "Pelanggan Sudah Mendaftar Pada Customer Portal"]);
|
||||
}else{
|
||||
} else {
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/otp/generateotp/' . $nokp, [
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
@@ -317,12 +529,12 @@ class CustomersController extends Controller
|
||||
// $message = "Your OTP code is " . $random;
|
||||
$message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
|
||||
$this->sendWhatsAppMessage($message, $recipient);
|
||||
return response()->json(['otp'=>$random]);
|
||||
return response()->json(['otp' => $random]);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/otp/generateotp/' . $nokp, [
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
@@ -330,23 +542,36 @@ class CustomersController extends Controller
|
||||
// $message = "Your OTP code is " . $random;
|
||||
$message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
|
||||
$this->sendWhatsAppMessage($message, $recipient);
|
||||
return response()->json(['otp'=>$random]);
|
||||
return response()->json(['otp' => $random]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function sendWhatsAppMessage(string $message, string $recipient)
|
||||
{
|
||||
$status = Http::withOptions(['verify' => config('app.api_verify')])->get('http://gateway.onewaysms.com.my:10001/api.aspx',[
|
||||
$status = Http::withOptions(['verify' => config('app.api_verify')])->get('http://gateway.onewaysms.com.my:10001/api.aspx', [
|
||||
'apiusername' => 'APIUK330HDAFO',
|
||||
'apipassword' => 'APIUK330HDAFOUK330',
|
||||
'senderid' => 'INFO',
|
||||
'mobileno' => $recipient,
|
||||
'message'=> $message,
|
||||
'languagetype'=> 1
|
||||
'message' => $message,
|
||||
'languagetype' => 1
|
||||
]);
|
||||
|
||||
return ($status);
|
||||
}
|
||||
|
||||
public function assignAnggota(Request $request)
|
||||
{
|
||||
$noic = $request->noic;
|
||||
|
||||
$response = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->put(config('api.url') . '/api/customers/' . $noic . '/assign-anggota');
|
||||
|
||||
if ($response->successful()) {
|
||||
return redirect()->back()->with('success', 'Pelanggan berjaya ditandakan sebagai anggota koperasi.');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Gagal mengemaskini status anggota. Sila cuba semula.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -505,6 +505,9 @@ class KhazanahController extends Controller
|
||||
|
||||
public function mintakatalaluansemula(Request $request)
|
||||
{
|
||||
if (app()->environment('local')) {
|
||||
return "True";
|
||||
}
|
||||
|
||||
if(Hash::check($request->passsemula, Auth::user()->password))
|
||||
{
|
||||
@@ -2856,7 +2859,7 @@ class KhazanahController extends Controller
|
||||
event(new NotifikasiAGH($auth_user['cawangan'],'Tak boleh generate dah kerana sudah digenerate dah.','error',$auth_user['name']));
|
||||
$daftar = 400;
|
||||
}else{
|
||||
$daftarpolis = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/polis/create/',[
|
||||
$daftarpolis = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/polis/create',[
|
||||
|
||||
'kodcaw' =>$auth_user['cawangan'],
|
||||
'norujukan' => $request->norujukanhidden,
|
||||
@@ -3933,9 +3936,9 @@ class KhazanahController extends Controller
|
||||
$totalhartasemasa = $array_ig->sum_harta;
|
||||
$totaltanggungansemasa = $array_ig->sum_tanggungan;
|
||||
|
||||
if($this->floatvalue(number_format($totalhartasemasa,2)) != $this->floatvalue(number_format($totaltanggungansemasa,2))){
|
||||
return redirect()->route('laporan.imbangdugaakru')->with('error','Imbangduga tidak sama. Sila berhubung dengan pihak IT');
|
||||
}
|
||||
// if($this->floatvalue(number_format($totalhartasemasa,2)) != $this->floatvalue(number_format($totaltanggungansemasa,2))){
|
||||
// return redirect()->route('laporan.imbangdugaakru')->with('error','Imbangduga tidak sama. Sila berhubung dengan pihak IT');
|
||||
// }
|
||||
|
||||
return view('print.laporan_imbangduga-akru',compact('tarikh_imbangan', 'tarikh_imbangan2','hartasemasa','tanggungansemasa','totalhartasemasa','totaltanggungansemasa','tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail'));
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Http\Controllers;
|
||||
use App\Events\OperasiNotice;
|
||||
use App\Events\StatusLiked;
|
||||
use App\Events\NotifikasiKelulusan;
|
||||
use App\Events\NotifikasiAnggota;
|
||||
use App\Events\Dashboard\KomoditiNotify;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -25,31 +26,29 @@ class OperasiController extends Controller
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function kelulusan(Request $request){
|
||||
public function kelulusan(Request $request)
|
||||
{
|
||||
$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();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
|
||||
$kelulusan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/ListOperasi/')->json();
|
||||
|
||||
$arraykelulusan = [];
|
||||
|
||||
|
||||
foreach($kelulusan as $index=>$lulus)
|
||||
{
|
||||
foreach($lulus['kelulusanall'] as $index=>$kel)
|
||||
{
|
||||
array_push($arraykelulusan,["cawangan" => $lulus['cawangan'], "cawangankod" => $lulus['cawangankod'],"namateller" => $kel['teller'], 'siri' => $kel['siri'] , "norujukan" => $kel['norujukan'], 'pinjaman' => $kel['jumpinj'],'komen' => $kel['komen'], 'nilaimarhun' => ($kel['nilaimarhun'] ?? '-'), 'berat' => ($kel['berat'] ?? '-'),'margin' => ($kel['margin'] ?? '-'), 'status' => ($kel['status'] ?? '-'), 'pelulus' => $kel['pelulus']]);
|
||||
foreach ($kelulusan as $index => $lulus) {
|
||||
foreach ($lulus['kelulusanall'] as $index => $kel) {
|
||||
array_push($arraykelulusan, ["cawangan" => $lulus['cawangan'], "cawangankod" => $lulus['cawangankod'], "namateller" => $kel['teller'], 'siri' => $kel['siri'], "norujukan" => $kel['norujukan'], 'pinjaman' => $kel['jumpinj'], 'komen' => $kel['komen'], 'nilaimarhun' => ($kel['nilaimarhun'] ?? '-'), 'berat' => ($kel['berat'] ?? '-'), 'margin' => ($kel['margin'] ?? '-'), 'status' => ($kel['status'] ?? '-'), 'pelulus' => $kel['pelulus']]);
|
||||
}
|
||||
|
||||
foreach($lulus['kelulusanMohonid'] as $index=>$mohon)
|
||||
{
|
||||
array_push($arraykelulusan,["mohonid" => true,"ansuran" => $mohon['ansuran'],"cawangan" => $lulus['cawangan'], "cawangankod" => $lulus['cawangankod'],"namateller" => $mohon['teller'], 'recno' => $mohon['recno'] , "norujukan" => $mohon['norujukan'], 'pinjaman' => $mohon['pinjaman'],'komen' => $mohon['katalaluan'], 'nilaimarhun' => ($mohon['nilaimarhun'] ?? '-'), 'berat' => ($mohon['berat'] ?? '-'),'margin' => ($mohon['margin'] ?? '-'), 'status' => ($mohon['mohon'] ?? '-')]);
|
||||
foreach ($lulus['kelulusanMohonid'] as $index => $mohon) {
|
||||
array_push($arraykelulusan, ["mohonid" => true, "ansuran" => $mohon['ansuran'], "cawangan" => $lulus['cawangan'], "cawangankod" => $lulus['cawangankod'], "namateller" => $mohon['teller'], 'recno' => $mohon['recno'], "norujukan" => $mohon['norujukan'], 'pinjaman' => $mohon['pinjaman'], 'komen' => $mohon['katalaluan'], 'nilaimarhun' => ($mohon['nilaimarhun'] ?? '-'), 'berat' => ($mohon['berat'] ?? '-'), 'margin' => ($mohon['margin'] ?? '-'), 'status' => ($mohon['mohon'] ?? '-')]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return view('operasi.kelulusan',compact('cawangan_info','api_url','arraykelulusan'));
|
||||
return view('operasi.kelulusan', compact('cawangan_info', 'api_url', 'arraykelulusan'));
|
||||
}
|
||||
|
||||
public function getkelulusan(Request $request)
|
||||
@@ -59,16 +58,13 @@ class OperasiController extends Controller
|
||||
|
||||
$norujukan = $request->norujukan;
|
||||
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
|
||||
$kelulusan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/SenaraiDahLulus/' . $auth_user['cawangan'] . '/' . $norujukan)->json();
|
||||
|
||||
if(sizeof($kelulusan) > 0)
|
||||
{
|
||||
if (sizeof($kelulusan) > 0) {
|
||||
$kelulusan = $kelulusan[0]['masalulus'];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$kelulusan = '';
|
||||
}
|
||||
|
||||
@@ -84,27 +80,20 @@ class OperasiController extends Controller
|
||||
$norujukan = $request->norujukan;
|
||||
|
||||
|
||||
if($request->pembatalan == null)
|
||||
{
|
||||
if(!$request->taglulus){
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusanKomen/' . $request->kodcaw . '/' . $norujukan,[
|
||||
if ($request->pembatalan == null) {
|
||||
if (!$request->taglulus) {
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusanKomen/' . $request->kodcaw . '/' . $norujukan, [
|
||||
"komen" => $request->komenkelulusan,
|
||||
'siri' => $request->siri
|
||||
])->json();
|
||||
|
||||
$updateData = [
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusan/' . $request->kodcaw . '/' . $norujukan, [
|
||||
'sahkan' => 1,
|
||||
'namaoperasi' => $request->namaoperasi,
|
||||
'siri' => $request->siri
|
||||
];
|
||||
|
||||
if ($request->has('actions')) {
|
||||
$updateData['actions'] = $request->actions;
|
||||
}
|
||||
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusan/' . $request->kodcaw . '/' . $norujukan, $updateData)->json();
|
||||
}else{
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateHapusAnsuran',[
|
||||
])->json();
|
||||
} else {
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateHapusAnsuran', [
|
||||
'siri' => $request->siri,
|
||||
"kodcaw" => $request->kodcaw,
|
||||
"norujukan" => $request->norujukan,
|
||||
@@ -114,26 +103,23 @@ class OperasiController extends Controller
|
||||
}
|
||||
|
||||
|
||||
if($updatelulus)
|
||||
{
|
||||
event(new NotifikasiKelulusan($norujukan,"lulus",$request->siri,$request->komenkelulusan,$request->teller));
|
||||
if ($updatelulus) {
|
||||
event(new NotifikasiKelulusan($norujukan, "lulus", $request->siri, $request->komenkelulusan, $request->teller));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$request->taglulus){
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusanKomen/' . $request->kodcaw . '/' . $norujukan,[
|
||||
} else {
|
||||
if (!$request->taglulus) {
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusanKomen/' . $request->kodcaw . '/' . $norujukan, [
|
||||
"komen" => $request->komenkelulusan,
|
||||
'siri' => $request->siri
|
||||
])->json();
|
||||
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusan/' . $request->kodcaw . '/' . $norujukan,[
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateKelulusan/' . $request->kodcaw . '/' . $norujukan, [
|
||||
'sahkan' => 2,
|
||||
'namaoperasi' => $request->namaoperasi,
|
||||
'siri' => $request->siri
|
||||
])->json();
|
||||
}else{
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateHapusAnsuran',[
|
||||
} else {
|
||||
$updatelulus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/UpdateHapusAnsuran', [
|
||||
'siri' => $request->siri,
|
||||
"kodcaw" => $request->kodcaw,
|
||||
"norujukan" => $request->norujukan,
|
||||
@@ -142,61 +128,100 @@ class OperasiController extends Controller
|
||||
])->json();
|
||||
}
|
||||
|
||||
if($updatelulus)
|
||||
{
|
||||
event(new NotifikasiKelulusan($norujukan,"batal",$request->siri,$request->komenkelulusan,$request->teller));
|
||||
if ($updatelulus) {
|
||||
event(new NotifikasiKelulusan($norujukan, "batal", $request->siri, $request->komenkelulusan, $request->teller));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return response()->json($updatelulus,200);
|
||||
return response()->json($updatelulus, 200);
|
||||
}
|
||||
|
||||
public function createKelulusanByKhazanah(Request $request)
|
||||
public function updatekelulusananggota(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
// Data asas
|
||||
$nokp = $request->nokp;
|
||||
$kodcaw = $request->kodcaw;
|
||||
$komen = $request->komenkelulusan;
|
||||
$namaoperasi = $request->namaoperasi;
|
||||
$taglulus = $request->taglulus; // contoh: 'Y' = lulus, 'N' = batal
|
||||
|
||||
$norujukan = $request->norujukan;
|
||||
// 1️⃣ Tentukan status kelulusan
|
||||
$status = ($taglulus == 'Y') ? 1 : 2; // 1 = Lulus, 2 = Batal/Tolak
|
||||
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
try {
|
||||
// 2️⃣ Panggil API baru — ikut route baru dengan {kodcaw}
|
||||
$endpoint = $api_url . '/api/UpdateKelulusanAnggota/' . $kodcaw;
|
||||
|
||||
$getsiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/ListLatestLulus/'. $auth_user['cawangan'] . '/' . $norujukan)->json();
|
||||
$payload = [
|
||||
'nokp' => $nokp,
|
||||
'komenkelulusan' => $komen,
|
||||
'namaoperasi' => $namaoperasi,
|
||||
'sahkan' => $status
|
||||
];
|
||||
|
||||
if(isset($getsiri['siri']))
|
||||
{
|
||||
$siri = $getsiri['siri'] + 1;
|
||||
}else{
|
||||
$siri = 1;
|
||||
Log::info('Menghantar permintaan ke API UpdateKelulusanAnggota', [
|
||||
'endpoint' => $endpoint,
|
||||
'payload' => $payload
|
||||
]);
|
||||
|
||||
$response = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->put($endpoint, $payload);
|
||||
|
||||
$updatelulus = $response->json();
|
||||
|
||||
// 3️⃣ Log hasil respon API
|
||||
Log::info('Respon dari API UpdateKelulusanAnggota', [
|
||||
'status' => $response->status(),
|
||||
'body' => $updatelulus
|
||||
]);
|
||||
|
||||
// 4️⃣ Jika berjaya, cipta event notifikasi
|
||||
if ($response->successful() && $updatelulus && isset($updatelulus['success']) && $updatelulus['success'] === true) {
|
||||
// $jenis = ($status == 1) ? 'lulus' : 'batal';
|
||||
// event(new NotifikasiAnggota($nokp, $jenis, null, $komen, $namaoperasi));
|
||||
|
||||
$statusText = ($status == 1) ? 'DILULUSKAN' : 'DITOLAK';
|
||||
event(new NotifikasiAnggota($nokp, $statusText, $komen, $namaoperasi));
|
||||
|
||||
|
||||
Log::info('Event NotifikasiAnggota dispatched', [
|
||||
'nokp' => $nokp,
|
||||
'komen' => $komen,
|
||||
'namaoperasi' => $namaoperasi
|
||||
]);
|
||||
} else {
|
||||
Log::warning('Gagal kemas kini kelulusan anggota', [
|
||||
'nokp' => $nokp,
|
||||
'kodcaw' => $kodcaw,
|
||||
'response' => $updatelulus
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json($updatelulus, $response->status());
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Ralat UpdateKelulusanAnggota (frontend)', [
|
||||
'message' => $e->getMessage(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Ralat semasa menghantar kelulusan anggota.',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
|
||||
$createlulus = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/CreateKelulusan/' . $auth_user['cawangan'] . '/' . $norujukan . '/roles/khazanah', [
|
||||
'komen' => $request->komen,
|
||||
'dategadai' => $current->toDateString(),
|
||||
'bilgadai' => 1,
|
||||
'siri' => $siri,
|
||||
'margin' => $request->margin,
|
||||
'berat' => $request->berat,
|
||||
'nilaimarhun' => $request->nilaimarhun,
|
||||
'status' => $request->status,
|
||||
'jumpinjam' => $request->jumpinjam,
|
||||
'jenistebus' => "G",
|
||||
'teller' => $request->teller,
|
||||
'peloperasi' => "operasi",
|
||||
'pelulus' => "operasi",
|
||||
'actions' => "Mohon Pengesahan Pembayaran Pampasan"
|
||||
])->json();
|
||||
|
||||
event(new OperasiNotice($auth_user['cawangan'],$auth_user['name']));
|
||||
|
||||
return response()->json($siri,201);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function createkelulusan(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
@@ -207,14 +232,13 @@ class OperasiController extends Controller
|
||||
|
||||
$norujukan = $request->norujukan;
|
||||
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
|
||||
$getsiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/ListLatestLulus/'. $auth_user['cawangan'] . '/' . $norujukan)->json();
|
||||
$getsiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/ListLatestLulus/' . $auth_user['cawangan'] . '/' . $norujukan)->json();
|
||||
|
||||
if(isset($getsiri['siri']))
|
||||
{
|
||||
if (isset($getsiri['siri'])) {
|
||||
$siri = $getsiri['siri'] + 1;
|
||||
}else{
|
||||
} else {
|
||||
$siri = 1;
|
||||
}
|
||||
|
||||
@@ -234,57 +258,113 @@ class OperasiController extends Controller
|
||||
|
||||
])->json();
|
||||
|
||||
event(new StatusLiked($auth_user['cawangan'],$auth_user['name']));
|
||||
event(new StatusLiked($auth_user['cawangan'], $auth_user['name']));
|
||||
|
||||
return response()->json($siri,201);
|
||||
return response()->json($siri, 201);
|
||||
}
|
||||
|
||||
|
||||
public function createkelulusanAnggota(Request $request)
|
||||
{
|
||||
try {
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$current = Carbon::now();
|
||||
|
||||
Log::info('createkelulusanAnggota', $request->all());
|
||||
|
||||
// Dapatkan maklumat cawangan
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/cawangan/' . $auth_user['cawangan'])
|
||||
->json();
|
||||
|
||||
// Generate siri baru
|
||||
$getsiri = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/ListLatestLulus/' . $auth_user['cawangan'] . '/anggota')
|
||||
->json();
|
||||
|
||||
$siri = isset($getsiri['siri']) ? $getsiri['siri'] + 1 : 1;
|
||||
|
||||
// Hantar ke API
|
||||
$createlulus = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->post($api_url . '/api/CreateKelulusanAnggota/' . $auth_user['cawangan'] . '/roles/operasi', [
|
||||
'komen' => $request->komen,
|
||||
'date_mohon' => $current->toDateString(),
|
||||
'siri' => $siri,
|
||||
'nokp' => $request->nokp,
|
||||
'teller' => $request->teller,
|
||||
'peloperasi' => 'operasi'
|
||||
])
|
||||
->json();
|
||||
|
||||
event(new StatusLiked($auth_user['cawangan'], $auth_user['name']));
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Permohonan kelulusan anggota berjaya dihantar.',
|
||||
'siri' => $siri,
|
||||
'data' => $createlulus,
|
||||
], 201);
|
||||
|
||||
Log::info('🛰️ API CreateKelulusanAnggota Response:', [
|
||||
'status' => $response->status(),
|
||||
'body' => $response->body(),
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
Log::error('❌ createkelulusanAnggota error: ' . $th->getMessage());
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => $th->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function mintakatalaluansemula(Request $request)
|
||||
{
|
||||
|
||||
if(Hash::check($request->passsemula, Auth::user()->password))
|
||||
{
|
||||
if (app()->environment('local')) {
|
||||
return "True";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (Hash::check($request->passsemula, Auth::user()->password)) {
|
||||
return "True";
|
||||
} else {
|
||||
return "False";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function parameter()
|
||||
{
|
||||
$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();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
|
||||
return view('operasi.parameter',compact('cawangan_info','api_url'));
|
||||
return view('operasi.parameter', compact('cawangan_info', 'api_url'));
|
||||
}
|
||||
|
||||
public function hargaemas()
|
||||
{
|
||||
$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();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
$harga_emas = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/harga_emas/')->json();
|
||||
|
||||
return view('operasi.hargaemas',compact('cawangan_info','api_url','harga_emas'));
|
||||
return view('operasi.hargaemas', compact('cawangan_info', 'api_url', 'harga_emas'));
|
||||
}
|
||||
|
||||
public function margin(){
|
||||
public function margin()
|
||||
{
|
||||
$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();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
$margin_pembiayaan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/maxpinjaman')->json();
|
||||
return view('operasi.margin_pembiayaan',compact('cawangan_info','api_url','margin_pembiayaan'));
|
||||
return view('operasi.margin_pembiayaan', compact('cawangan_info', 'api_url', 'margin_pembiayaan'));
|
||||
}
|
||||
|
||||
public function kelulusanrekodlepas()
|
||||
{
|
||||
$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();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
|
||||
//declare array baru
|
||||
$arraykelulusan = [];
|
||||
@@ -292,127 +372,36 @@ class OperasiController extends Controller
|
||||
$kelulusan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/ListOperasiKelulusan/')->json();
|
||||
|
||||
|
||||
foreach($kelulusan as $index=>$k)
|
||||
{
|
||||
foreach($k['kelulusanall'] as $index1=>$kel)
|
||||
{
|
||||
$komen = explode("|",$kel['komen']);
|
||||
foreach ($kelulusan as $index => $k) {
|
||||
foreach ($k['kelulusanall'] as $index1 => $kel) {
|
||||
$komen = explode("|", $kel['komen']);
|
||||
|
||||
$results=array_search("",$komen,true);
|
||||
if($results !== false) {
|
||||
$results = array_search("", $komen, true);
|
||||
if ($results !== false) {
|
||||
unset($komen[$results]);
|
||||
}
|
||||
|
||||
array_push($arraykelulusan,['norujukan' => $kel['norujukan'], 'pinjaman' => $kel['jumpinj'], 'nilaimarhun' => ($komen[1] ?? $kel['nilaimarhun'] ?? '-'), 'berat' => ($komen[2] ?? $kel['berat'] ?? '-'),'margin' => ($komen[3] ?? $kel['margin'] ?? '-'), 'komen' => ($komen[0] ?? $kel['komen'] ?? '-'), 'status' => ($kel['status'] ?? '-'), 'pelulus' => $kel['operasi'],]);
|
||||
|
||||
array_push($arraykelulusan, ['norujukan' => $kel['norujukan'], 'pinjaman' => $kel['jumpinj'], 'nilaimarhun' => ($komen[1] ?? $kel['nilaimarhun'] ?? '-'), 'berat' => ($komen[2] ?? $kel['berat'] ?? '-'), 'margin' => ($komen[3] ?? $kel['margin'] ?? '-'), 'komen' => ($komen[0] ?? $kel['komen'] ?? '-'), 'status' => ($kel['status'] ?? '-'), 'pelulus' => $kel['operasi'],]);
|
||||
}
|
||||
}
|
||||
|
||||
return view('operasi.rekodtelahlulus',compact('cawangan_info','api_url','arraykelulusan'));
|
||||
|
||||
return view('operasi.rekodtelahlulus', compact('cawangan_info', 'api_url', 'arraykelulusan'));
|
||||
}
|
||||
|
||||
public function notifyKomoditi()
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
event(new KomoditiNotify('lulus',$auth_user['cawangan']));
|
||||
event(new KomoditiNotify('lulus', $auth_user['cawangan']));
|
||||
}
|
||||
|
||||
public function marginmutu()
|
||||
public function kelulusananggota(Request $request)
|
||||
{
|
||||
$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();
|
||||
|
||||
// Get MaxMutuEmas data from API
|
||||
$maxmutuemas = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/maxmutuemas')->json();
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
|
||||
|
||||
return view('operasi.marginmutu', compact('cawangan_info', 'api_url', 'maxmutuemas'));
|
||||
}
|
||||
$arraykelulusan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/list/approval/anggota')->json();
|
||||
|
||||
public function editMarginMutu()
|
||||
{
|
||||
$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('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'));
|
||||
return view('operasi.kelulusan_anggota', compact('cawangan_info', 'api_url', 'arraykelulusan'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,744 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class PembiayaanOnlineController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
protected function api()
|
||||
{
|
||||
return Http::withOptions(['verify' => config('app.api_verify')]);
|
||||
}
|
||||
|
||||
protected function kodcaw()
|
||||
{
|
||||
return Auth::user()->cawangan;
|
||||
}
|
||||
|
||||
/**
|
||||
* PC senarai queue + batch history.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$kodcaw = $this->kodcaw();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$cawangan_info = $this->api()
|
||||
->get($api_url . '/api/cawangan/' . $kodcaw)
|
||||
->json();
|
||||
|
||||
$queue = $this->api()
|
||||
->get($api_url . '/api/pembiayaan-online/' . $kodcaw . '/queue')
|
||||
->json();
|
||||
|
||||
$batches = $this->api()
|
||||
->get($api_url . '/api/pembiayaan-online/' . $kodcaw . '/batches')
|
||||
->json();
|
||||
|
||||
$banks = $this->api()->get($api_url . '/api/bank')->json();
|
||||
if (!is_array($banks)) {
|
||||
$banks = [];
|
||||
}
|
||||
|
||||
$modal = $this->api()
|
||||
->get($api_url . '/api/modal-online/' . $kodcaw)
|
||||
->json();
|
||||
|
||||
$lines = $queue['data'] ?? [];
|
||||
$slot = $queue['slot_cadangan'] ?? null;
|
||||
if (!is_array($batches)) {
|
||||
$batches = [];
|
||||
}
|
||||
|
||||
return view('pembiayaan_online.pc.senarai', compact(
|
||||
'auth_user',
|
||||
'kodcaw',
|
||||
'api_url',
|
||||
'cawangan_info',
|
||||
'lines',
|
||||
'batches',
|
||||
'banks',
|
||||
'modal',
|
||||
'slot',
|
||||
'queue'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update bank/docs for a queue line.
|
||||
*/
|
||||
public function updateLine(Request $request, $id)
|
||||
{
|
||||
$kodcaw = $this->kodcaw();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$payload = [
|
||||
'kodbank' => $request->input('kodbank'),
|
||||
'noakaun' => $request->input('noakaun'),
|
||||
'nama_bank' => $request->input('nama_bank'),
|
||||
'nama_akaun' => $request->input('nama_akaun'),
|
||||
'nota' => $request->input('nota'),
|
||||
'update_customer_bank' => true,
|
||||
];
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->put($api_url . '/api/pembiayaan-online/' . $kodcaw . '/lines/' . $id, $payload);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal kemaskini rekod.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
return redirect()->route('pembiayaan.online.pc')->with('message', 'Rekod dikemaskini.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit selected lines as a batch to Operasi.
|
||||
*/
|
||||
public function submitBatch(Request $request)
|
||||
{
|
||||
$kodcaw = $this->kodcaw();
|
||||
$api_url = config('api.url');
|
||||
$auth_user = Auth::user();
|
||||
|
||||
$ids = $request->input('ids', []);
|
||||
if (!is_array($ids)) {
|
||||
$ids = array_filter(explode(',', (string) $ids));
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post($api_url . '/api/pembiayaan-online/' . $kodcaw . '/batches/submit', [
|
||||
'ids' => $ids,
|
||||
'pc_submitted_by' => $auth_user['name'],
|
||||
'slot' => $request->input('slot'),
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal hantar batch.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
$batchNo = $res->json()['batch']['batch_no'] ?? '';
|
||||
return redirect()->route('pembiayaan.online.pc')
|
||||
->with('message', 'Batch dihantar ke Operasi' . ($batchNo ? ': ' . $batchNo : '.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch detail.
|
||||
*/
|
||||
public function showBatch($batchId)
|
||||
{
|
||||
$kodcaw = $this->kodcaw();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$cawangan_info = $this->api()
|
||||
->get($api_url . '/api/cawangan/' . $kodcaw)
|
||||
->json();
|
||||
|
||||
$detail = $this->api()
|
||||
->get($api_url . '/api/pembiayaan-online/' . $kodcaw . '/batches/' . $batchId)
|
||||
->json();
|
||||
|
||||
if (!is_array($detail) || empty($detail['batch'])) {
|
||||
return redirect()->route('pembiayaan.online.pc')->with('error', 'Batch tidak dijumpai.');
|
||||
}
|
||||
|
||||
return view('pembiayaan_online.pc.batch', [
|
||||
'batch' => $detail['batch'],
|
||||
'lines' => $detail['lines'] ?? [],
|
||||
'kodcaw' => $kodcaw,
|
||||
'api_url' => $api_url,
|
||||
'cawangan_info' => $cawangan_info,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* PC: senarai PAID untuk tally + blast.
|
||||
*/
|
||||
public function paidIndex(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$kodcaw = $this->kodcaw();
|
||||
$api_url = config('api.url');
|
||||
$blastFilter = $request->input('blast_sent', '0');
|
||||
|
||||
$cawangan_info = $this->api()
|
||||
->get($api_url . '/api/cawangan/' . $kodcaw)
|
||||
->json();
|
||||
|
||||
$query = [];
|
||||
if ($blastFilter !== 'all' && $blastFilter !== '') {
|
||||
$query['blast_sent'] = $blastFilter;
|
||||
}
|
||||
|
||||
$paid = $this->api()
|
||||
->get($api_url . '/api/pembiayaan-online/' . $kodcaw . '/paid', $query)
|
||||
->json();
|
||||
|
||||
$lines = $paid['data'] ?? [];
|
||||
if (!is_array($lines)) {
|
||||
$lines = [];
|
||||
}
|
||||
|
||||
$bilangan = $paid['bilangan'] ?? count($lines);
|
||||
$jumlah = $paid['jumlah'] ?? 0;
|
||||
|
||||
return view('pembiayaan_online.pc.paid', compact(
|
||||
'auth_user',
|
||||
'kodcaw',
|
||||
'api_url',
|
||||
'cawangan_info',
|
||||
'lines',
|
||||
'bilangan',
|
||||
'jumlah',
|
||||
'blastFilter'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* PC: view/download bukti bayaran inline.
|
||||
*/
|
||||
public function viewBukti($id)
|
||||
{
|
||||
$kodcaw = $this->kodcaw();
|
||||
$res = $this->api()
|
||||
->get(config('api.url') . '/api/pembiayaan-online/' . $kodcaw . '/lines/' . $id . '/bukti');
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Bukti tidak dijumpai.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
$payload = $res->json();
|
||||
$bukti = $payload['bukti'] ?? null;
|
||||
if (!$bukti || empty($bukti['data'])) {
|
||||
return redirect()->back()->with('error', 'Fail bukti kosong.');
|
||||
}
|
||||
|
||||
$raw = $bukti['data'];
|
||||
if (strpos($raw, 'base64,') !== false) {
|
||||
$raw = substr($raw, strpos($raw, 'base64,') + 7);
|
||||
}
|
||||
$binary = base64_decode($raw, true);
|
||||
if ($binary === false) {
|
||||
$binary = base64_decode($bukti['data']);
|
||||
}
|
||||
|
||||
$type = $bukti['type'] ?? 'application/octet-stream';
|
||||
$filename = $bukti['filename'] ?? ('bukti-' . $id);
|
||||
|
||||
return response($binary, 200, [
|
||||
'Content-Type' => $type,
|
||||
'Content-Disposition' => 'inline; filename="' . $filename . '"',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* PC: tanda rekod PAID sebagai selesai semak / blast.
|
||||
*/
|
||||
public function markBlast(Request $request)
|
||||
{
|
||||
$kodcaw = $this->kodcaw();
|
||||
$ids = $request->input('ids', []);
|
||||
if (!is_array($ids)) {
|
||||
$ids = array_filter(explode(',', (string) $ids));
|
||||
}
|
||||
|
||||
if (count($ids) === 0) {
|
||||
return redirect()->back()->with('error', 'Sila pilih sekurang-kurangnya satu rekod.');
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/pembiayaan-online/' . $kodcaw . '/paid/blast', [
|
||||
'ids' => $ids,
|
||||
'blast_by' => Auth::user()['name'],
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal tanda selesai.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
$n = $res->json()['dikemaskini'] ?? count($ids);
|
||||
return redirect()
|
||||
->route('pembiayaan.online.pc.paid')
|
||||
->with('message', $n . ' rekod ditanda selesai semak/blast.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Operasi: senarai batch semua cawangan.
|
||||
*/
|
||||
public function operasiIndex(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$status = $request->input('status', 'SUBMITTED');
|
||||
$tarikh = $request->input('tarikh');
|
||||
|
||||
$query = ['status' => $status];
|
||||
if ($tarikh) {
|
||||
$query['tarikh'] = $tarikh;
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->get($api_url . '/api/pembiayaan-online/operasi/batches', $query)
|
||||
->json();
|
||||
|
||||
$batches = $res['data'] ?? [];
|
||||
if (!is_array($batches)) {
|
||||
$batches = [];
|
||||
}
|
||||
|
||||
return view('pembiayaan_online.operasi.senarai', compact(
|
||||
'auth_user',
|
||||
'api_url',
|
||||
'batches',
|
||||
'status',
|
||||
'tarikh'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Operasi: detail batch + lines.
|
||||
*/
|
||||
public function operasiShowBatch($kodcaw, $batchId)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$cawangan_info = $this->api()
|
||||
->get($api_url . '/api/cawangan/' . $kodcaw)
|
||||
->json();
|
||||
|
||||
$detail = $this->api()
|
||||
->get($api_url . '/api/pembiayaan-online/operasi/' . $kodcaw . '/batches/' . $batchId)
|
||||
->json();
|
||||
|
||||
if (!is_array($detail) || empty($detail['batch'])) {
|
||||
return redirect()
|
||||
->route('pembiayaan.online.operasi')
|
||||
->with('error', 'Batch tidak dijumpai.');
|
||||
}
|
||||
|
||||
return view('pembiayaan_online.operasi.batch', [
|
||||
'auth_user' => $auth_user,
|
||||
'batch' => $detail['batch'],
|
||||
'lines' => $detail['lines'] ?? [],
|
||||
'kodcaw' => $kodcaw,
|
||||
'api_url' => $api_url,
|
||||
'cawangan_info' => $cawangan_info,
|
||||
]);
|
||||
}
|
||||
|
||||
public function operasiApproveLine(Request $request, $kodcaw, $id)
|
||||
{
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/pembiayaan-online/operasi/' . $kodcaw . '/lines/' . $id . '/approve', [
|
||||
'ops_by' => Auth::user()['name'],
|
||||
]);
|
||||
|
||||
return $this->opsRedirect($res, $kodcaw, $request->input('batch_id'), 'Rekod diluluskan.');
|
||||
}
|
||||
|
||||
public function operasiRejectLine(Request $request, $kodcaw, $id)
|
||||
{
|
||||
$reason = trim((string) $request->input('reject_reason', ''));
|
||||
if ($reason === '') {
|
||||
return redirect()->back()->with('error', 'Sebab tolak diperlukan.');
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/pembiayaan-online/operasi/' . $kodcaw . '/lines/' . $id . '/reject', [
|
||||
'ops_by' => Auth::user()['name'],
|
||||
'reject_reason' => $reason,
|
||||
]);
|
||||
|
||||
return $this->opsRedirect($res, $kodcaw, $request->input('batch_id'), 'Rekod ditolak. Dikembalikan ke PC.');
|
||||
}
|
||||
|
||||
public function operasiApproveBatch(Request $request, $kodcaw, $batchId)
|
||||
{
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/pembiayaan-online/operasi/' . $kodcaw . '/batches/' . $batchId . '/approve', [
|
||||
'ops_by' => Auth::user()['name'],
|
||||
]);
|
||||
|
||||
return $this->opsRedirect($res, $kodcaw, $batchId, 'Semua rekod menunggu dalam batch diluluskan.');
|
||||
}
|
||||
|
||||
public function operasiMarkPaid(Request $request, $kodcaw, $id)
|
||||
{
|
||||
$payload = $this->buildPaidPayload($request);
|
||||
if (isset($payload['error'])) {
|
||||
return redirect()->back()->with('error', $payload['error']);
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/pembiayaan-online/operasi/' . $kodcaw . '/lines/' . $id . '/paid', $payload);
|
||||
|
||||
return $this->opsRedirect($res, $kodcaw, $request->input('batch_id'), 'Rekod ditanda PAID.');
|
||||
}
|
||||
|
||||
public function operasiMarkPaidBatch(Request $request, $kodcaw, $batchId)
|
||||
{
|
||||
$payload = $this->buildPaidPayload($request);
|
||||
if (isset($payload['error'])) {
|
||||
return redirect()->back()->with('error', $payload['error']);
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/pembiayaan-online/operasi/' . $kodcaw . '/batches/' . $batchId . '/paid', $payload);
|
||||
|
||||
return $this->opsRedirect($res, $kodcaw, $batchId, 'Rekod APPROVED dalam batch ditanda PAID.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function buildPaidPayload(Request $request)
|
||||
{
|
||||
$noRujukan = trim((string) $request->input('no_rujukan_bayaran', ''));
|
||||
if ($noRujukan === '') {
|
||||
return ['error' => 'No. rujukan bayaran diperlukan.'];
|
||||
}
|
||||
|
||||
if (!$request->hasFile('bukti')) {
|
||||
return ['error' => 'Fail bukti bayaran diperlukan.'];
|
||||
}
|
||||
|
||||
$file = $request->file('bukti');
|
||||
if (!$file->isValid()) {
|
||||
return ['error' => 'Fail bukti tidak sah.'];
|
||||
}
|
||||
|
||||
$raw = base64_encode(file_get_contents($file->getRealPath()));
|
||||
$mime = $file->getMimeType() ?: 'application/octet-stream';
|
||||
|
||||
return [
|
||||
'ops_by' => Auth::user()['name'],
|
||||
'no_rujukan_bayaran' => $noRujukan,
|
||||
'tarikh_bayaran' => $request->input('tarikh_bayaran') ?: date('Y-m-d'),
|
||||
'bukti_data' => $raw,
|
||||
'bukti_filename' => $file->getClientOriginalName(),
|
||||
'bukti_type' => $mime,
|
||||
];
|
||||
}
|
||||
|
||||
protected function opsRedirect($res, $kodcaw, $batchId, $successMsg)
|
||||
{
|
||||
$batchId = $batchId ?: null;
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Tindakan gagal.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
if ($batchId) {
|
||||
return redirect()
|
||||
->route('pembiayaan.online.operasi.batch', ['kodcaw' => $kodcaw, 'batchId' => $batchId])
|
||||
->with('message', $successMsg);
|
||||
}
|
||||
|
||||
return redirect()->route('pembiayaan.online.operasi')->with('message', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* PC: modal online float + top-up request form/history.
|
||||
*/
|
||||
public function topupIndex(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$kodcaw = $this->kodcaw();
|
||||
$api_url = config('api.url');
|
||||
$status = $request->input('status', '');
|
||||
|
||||
$cawangan_info = $this->api()
|
||||
->get($api_url . '/api/cawangan/' . $kodcaw)
|
||||
->json();
|
||||
|
||||
$modal = $this->api()
|
||||
->get($api_url . '/api/modal-online/' . $kodcaw)
|
||||
->json();
|
||||
|
||||
$query = [];
|
||||
if ($status !== '' && $status !== 'all') {
|
||||
$query['status'] = $status;
|
||||
}
|
||||
|
||||
$reqRes = $this->api()
|
||||
->get($api_url . '/api/modal-online/' . $kodcaw . '/topup/requests', $query)
|
||||
->json();
|
||||
|
||||
$requests = $reqRes['data'] ?? [];
|
||||
if (!is_array($requests)) {
|
||||
$requests = [];
|
||||
}
|
||||
|
||||
$pendingRes = $this->api()
|
||||
->get($api_url . '/api/modal-online/' . $kodcaw . '/topup/requests', ['status' => 'PENDING'])
|
||||
->json();
|
||||
$pendingList = $pendingRes['data'] ?? [];
|
||||
$hasPending = is_array($pendingList) && count($pendingList) > 0;
|
||||
$isMissing = !empty($modal['missing']);
|
||||
$pendingRequest = $modal['pending_request'] ?? null;
|
||||
if (!$pendingRequest && $hasPending) {
|
||||
$pendingRequest = $pendingList[0];
|
||||
}
|
||||
|
||||
return view('pembiayaan_online.pc.topup', compact(
|
||||
'auth_user',
|
||||
'kodcaw',
|
||||
'api_url',
|
||||
'cawangan_info',
|
||||
'modal',
|
||||
'requests',
|
||||
'status',
|
||||
'hasPending',
|
||||
'isMissing',
|
||||
'pendingRequest'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* PC: submit top-up request.
|
||||
*/
|
||||
public function topupRequest(Request $request)
|
||||
{
|
||||
$kodcaw = $this->kodcaw();
|
||||
$amaun = (float) $request->input('amaun', 0);
|
||||
|
||||
if ($amaun <= 0) {
|
||||
return redirect()->back()->with('error', 'Amaun mesti lebih daripada 0.');
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/modal-online/' . $kodcaw . '/topup/request', [
|
||||
'amaun' => $amaun,
|
||||
'dimohon_oleh' => Auth::user()['name'],
|
||||
'nota' => $request->input('nota'),
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal hantar permohonan.';
|
||||
return redirect()->back()->with('error', $msg)->withInput();
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('pembiayaan.online.pc.topup')
|
||||
->with('message', 'Permohonan modal online dihantar. Menunggu kelulusan Operasi.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Operasi: senarai permohonan tambah modal online.
|
||||
*/
|
||||
public function operasiTopupIndex(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$status = $request->input('status', 'PENDING');
|
||||
$tarikh = $request->input('tarikh');
|
||||
|
||||
$query = [];
|
||||
if ($status === 'all') {
|
||||
$query['status'] = 'all';
|
||||
} elseif ($status !== '' && $status !== null) {
|
||||
$query['status'] = $status;
|
||||
} else {
|
||||
$query['status'] = 'PENDING';
|
||||
}
|
||||
if ($tarikh) {
|
||||
$query['tarikh'] = $tarikh;
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->get($api_url . '/api/modal-online/operasi/topup/requests', $query)
|
||||
->json();
|
||||
|
||||
$requests = $res['data'] ?? [];
|
||||
if (!is_array($requests)) {
|
||||
$requests = [];
|
||||
}
|
||||
|
||||
return view('pembiayaan_online.operasi.topup', compact(
|
||||
'auth_user',
|
||||
'api_url',
|
||||
'requests',
|
||||
'status',
|
||||
'tarikh'
|
||||
));
|
||||
}
|
||||
|
||||
public function operasiTopupApprove(Request $request, $id)
|
||||
{
|
||||
$amaun = $request->input('amaun');
|
||||
if ($amaun !== null && $amaun !== '' && (float) $amaun <= 0) {
|
||||
return redirect()->back()->with('error', 'Amaun diluluskan mesti lebih daripada 0.');
|
||||
}
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/modal-online/operasi/topup/' . $id . '/approve', [
|
||||
'diluluskan_oleh' => Auth::user()['name'],
|
||||
'nota' => $request->input('nota'),
|
||||
'amaun' => $amaun,
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal lulus permohonan.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
$amaunLulus = $res->json()['request']['amaun'] ?? $amaun;
|
||||
return redirect()
|
||||
->route('pembiayaan.online.operasi.topup')
|
||||
->with('message', 'Permohonan diluluskan RM ' . number_format((float) $amaunLulus, 2) . '. Modal online cawangan dikemas kini.');
|
||||
}
|
||||
|
||||
public function operasiTopupReject(Request $request, $id)
|
||||
{
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/modal-online/operasi/topup/' . $id . '/reject', [
|
||||
'diluluskan_oleh' => Auth::user()['name'],
|
||||
'nota' => $request->input('nota'),
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal tolak permohonan.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('pembiayaan.online.operasi.topup')
|
||||
->with('message', 'Permohonan ditolak.');
|
||||
}
|
||||
|
||||
/**
|
||||
* PC: EOD close branch modal online.
|
||||
*/
|
||||
public function closeModal(Request $request)
|
||||
{
|
||||
$kodcaw = $this->kodcaw();
|
||||
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/modal-online/' . $kodcaw . '/close', [
|
||||
'ditutup_oleh' => Auth::user()['name'],
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal tutup modal online.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
$dikembalikan = $res->json()['dikembalikan'] ?? 0;
|
||||
return redirect()
|
||||
->route('pembiayaan.online.pc.topup')
|
||||
->with('message', 'Modal online ditutup. Baki dikembalikan RM ' . number_format((float) $dikembalikan, 2) . '.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Operasi: EOD dashboard semua cawangan.
|
||||
*/
|
||||
public function operasiEodIndex(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$tarikh = $request->input('tarikh') ?: date('Y-m-d');
|
||||
|
||||
$res = $this->api()
|
||||
->get($api_url . '/api/modal-online/operasi/eod', [
|
||||
'zone' => 'all',
|
||||
'tarikh' => $tarikh,
|
||||
])
|
||||
->json();
|
||||
|
||||
$rows = $res['data'] ?? [];
|
||||
if (!is_array($rows)) {
|
||||
$rows = [];
|
||||
}
|
||||
|
||||
$summary = [
|
||||
'open' => $res['open'] ?? 0,
|
||||
'closed' => $res['closed'] ?? 0,
|
||||
'missing' => $res['missing'] ?? 0,
|
||||
'bilangan' => $res['bilangan'] ?? count($rows),
|
||||
];
|
||||
|
||||
return view('pembiayaan_online.operasi.eod', compact(
|
||||
'auth_user',
|
||||
'api_url',
|
||||
'rows',
|
||||
'tarikh',
|
||||
'summary'
|
||||
));
|
||||
}
|
||||
|
||||
public function operasiCloseModal(Request $request, $kodcaw)
|
||||
{
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/modal-online/' . $kodcaw . '/close', [
|
||||
'ditutup_oleh' => Auth::user()['name'],
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal tutup modal online.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('pembiayaan.online.operasi.eod')
|
||||
->with('message', 'Modal online ' . $kodcaw . ' ditutup.');
|
||||
}
|
||||
|
||||
public function operasiCloseAllModal(Request $request)
|
||||
{
|
||||
$res = $this->api()
|
||||
->asForm()
|
||||
->post(config('api.url') . '/api/modal-online/operasi/eod/close-all', [
|
||||
'ditutup_oleh' => Auth::user()['name'],
|
||||
'zone' => 'all',
|
||||
]);
|
||||
|
||||
if (!$res->successful()) {
|
||||
$body = $res->json();
|
||||
$msg = is_array($body) && isset($body['message']) ? $body['message'] : 'Gagal tutup semua modal online.';
|
||||
return redirect()->back()->with('error', $msg);
|
||||
}
|
||||
|
||||
$closed = $res->json()['closed'] ?? 0;
|
||||
$skipped = $res->json()['skipped'] ?? 0;
|
||||
return redirect()
|
||||
->route('pembiayaan.online.operasi.eod')
|
||||
->with('message', 'EOD selesai: ' . $closed . ' ditutup, ' . $skipped . ' sudah ditutup.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Imports;
|
||||
|
||||
use App\Anggota;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
|
||||
class AnggotaImport implements ToModel
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public function model(array $row)
|
||||
{
|
||||
return new Anggota([
|
||||
//
|
||||
'noic' => $row['noic'],
|
||||
'nama' => $row['nama'],
|
||||
'status' => $row['status'] ?? 'aktif',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
Gate::define('impersonate', function ($user) {
|
||||
return $user->canImpersonate();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Lab404\Impersonate\Models\Impersonate;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Impersonate;
|
||||
use Notifiable;
|
||||
|
||||
protected $guard = 'web';
|
||||
@@ -43,4 +45,14 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasOne(Cawangan::class, 'kodcaw', 'cawangan');
|
||||
}
|
||||
|
||||
public function canImpersonate(): bool
|
||||
{
|
||||
return in_array($this->roles ?? '', ['admin'], true);
|
||||
}
|
||||
|
||||
public function canBeImpersonated(): bool
|
||||
{
|
||||
return ($this->roles ?? '') !== 'admin';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('api_url_for_browser')) {
|
||||
/**
|
||||
* Base URL for JavaScript in the browser, derived from API_URL (config api.url).
|
||||
* Docker dev often uses host.docker.internal for PHP→host; browsers may not resolve it.
|
||||
* Same host-mapped port is reachable at 127.0.0.1. Production URLs are unchanged.
|
||||
*/
|
||||
function api_url_for_browser(): string
|
||||
{
|
||||
$url = rtrim((string) config('api.url'), '/');
|
||||
|
||||
return str_ireplace('host.docker.internal', '127.0.0.1', $url);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"jeroennoten/laravel-adminlte": "^3.5",
|
||||
"lab404/laravel-impersonate": "^1.7",
|
||||
"laravel/framework": "^7.24",
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/ui": "^2.4",
|
||||
@@ -51,6 +52,9 @@
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories"
|
||||
],
|
||||
"files": [
|
||||
"app/helpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
||||
Generated
+71
-4
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "bfd66ab0246126c4f2cc7bbeeacca4ec",
|
||||
"content-hash": "fa66321247398a94dc8b7f8099bb184e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "almasaeed2010/adminlte",
|
||||
@@ -1293,6 +1293,73 @@
|
||||
},
|
||||
"time": "2022-05-18T14:12:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "lab404/laravel-impersonate",
|
||||
"version": "1.7.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/404labfr/laravel-impersonate.git",
|
||||
"reference": "0008a39da8914cc946b6a5ed211230708ee736b3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/404labfr/laravel-impersonate/zipball/0008a39da8914cc946b6a5ed211230708ee736b3",
|
||||
"reference": "0008a39da8914cc946b6a5ed211230708ee736b3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0 | ^13.0",
|
||||
"php": "^7.2 | ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3.3",
|
||||
"orchestra/testbench": "^4.0 | ^5.0 | ^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0",
|
||||
"phpunit/phpunit": "^7.5 | ^8.0 | ^9.0 | ^10.0 | ^11.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Lab404\\Impersonate\\ImpersonateServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Lab404\\Impersonate\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marceau Casals",
|
||||
"email": "marceau@casals.fr"
|
||||
}
|
||||
],
|
||||
"description": "Laravel Impersonate is a plugin that allows to you to authenticate as your users.",
|
||||
"keywords": [
|
||||
"auth",
|
||||
"impersonate",
|
||||
"impersonation",
|
||||
"laravel",
|
||||
"laravel-package",
|
||||
"laravel-plugin",
|
||||
"package",
|
||||
"plugin",
|
||||
"user"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/404labfr/laravel-impersonate/issues",
|
||||
"source": "https://github.com/404labfr/laravel-impersonate/tree/1.7.8"
|
||||
},
|
||||
"time": "2026-03-17T15:24:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v7.30.6",
|
||||
@@ -9013,12 +9080,12 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^7.2.5"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.9.0"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/php/Dockerfile
|
||||
working_dir: /var/www/html
|
||||
volumes:
|
||||
- ./:/var/www/html:cached
|
||||
environment:
|
||||
APP_ENV: local
|
||||
APP_DEBUG: "true"
|
||||
# Lets PHP resolve host.docker.internal to the host machine (Linux Docker; Desktop already provides this).
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
depends_on:
|
||||
- mysql
|
||||
|
||||
web:
|
||||
image: nginx:1.25-alpine
|
||||
ports:
|
||||
- "8081:80"
|
||||
volumes:
|
||||
- ./:/var/www/html:cached
|
||||
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
ports:
|
||||
- "3307:3306"
|
||||
environment:
|
||||
MYSQL_DATABASE: kaunter_erahn
|
||||
MYSQL_USER: kaunteruser
|
||||
MYSQL_PASSWORD: password
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
@@ -0,0 +1,26 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /var/www/html/public;
|
||||
index index.php index.html;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_index index.php;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
FROM php:7.4-fpm
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
pkg-config \
|
||||
unzip \
|
||||
libonig-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libfreetype6-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install -j"$(nproc)" \
|
||||
pdo_mysql \
|
||||
mbstring \
|
||||
bcmath \
|
||||
zip \
|
||||
exif \
|
||||
gd \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||
|
||||
COPY docker/php/php.ini /usr/local/etc/php/conf.d/app.ini
|
||||
|
||||
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
memory_limit=512M
|
||||
upload_max_filesize=50M
|
||||
post_max_size=50M
|
||||
max_execution_time=120
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -306,7 +306,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var search = "<?php echo $search ?>";
|
||||
var type_id = "<?php echo $idtype ?>";
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var ppc = "{{ Auth::user()->name }}";
|
||||
var ic_asal = "{{ $customer_info['kpbaru'] != null ? $customer_info['kpbaru'] : $customer_info['kplama'] }}"
|
||||
|
||||
|
||||
@@ -48,6 +48,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
</script>
|
||||
@endsection
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
@php $auth_user = Auth::user();@endphp
|
||||
<input type="hidden" id="api" value="{{ $api_url }}"/>
|
||||
<input type="hidden" id="api" value="{{ api_url_for_browser() }}"/>
|
||||
<div class="col-md-12">
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tableaddtunai = $('#tableaddtunai').DataTable({
|
||||
@@ -558,9 +558,8 @@
|
||||
|
||||
function cetaklaporanalirantunai()
|
||||
{
|
||||
let urlroute = '{{ route("laporan.alirantunai") }}';
|
||||
|
||||
window.location.href = urlroute;
|
||||
let urlroute = '{{ route("laporan.alirantunai") }}';
|
||||
window.location.href = api_url + urlroute;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
var api_url = "{{ $api_url }}";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
// var kodcaw = "{{ $kodcaw }}";
|
||||
// var notisid = "{{ $notisid }}";
|
||||
//var nokp = "{{ $noic }}";
|
||||
|
||||
@@ -389,7 +389,7 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var search = "<?php echo $search ?>";
|
||||
var type_id = "<?php echo $idtype ?>";
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -387,7 +387,7 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var search = "<?php echo $search ?>";
|
||||
var type_id = "<?php echo $idtype ?>";
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -413,7 +413,7 @@
|
||||
|
||||
<script>
|
||||
var api_arrahnbid = "<?php echo config('app.api_arrahnbid') ?>";
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
|
||||
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
|
||||
|
||||
|
||||
@@ -1099,7 +1099,7 @@
|
||||
|
||||
|
||||
let pertambahpinjaman = "{{ $pertambahpinjaman }}";
|
||||
var api = '<?php echo $api_url ?>';
|
||||
var api = "{{ api_url_for_browser() }}";
|
||||
let nw = 0;
|
||||
let jenisAT = 'none';
|
||||
|
||||
|
||||
@@ -542,7 +542,7 @@
|
||||
|
||||
<script>
|
||||
var api_arrahnbid = "<?php echo config('app.api_arrahnbid') ?>";
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
|
||||
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
|
||||
|
||||
|
||||
@@ -473,7 +473,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var search = "<?php echo $search ?>";
|
||||
var type_id = "<?php echo $idtype ?>";
|
||||
var blacklist_search = "<?php echo $blacklist_search ?>";
|
||||
|
||||
@@ -422,7 +422,7 @@
|
||||
|
||||
<script>
|
||||
var api_arrahnbid = "<?php echo config('app.api_arrahnbid') ?>";
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
|
||||
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
|
||||
var min_komoditi = "{{ $min_komoditi }}";
|
||||
|
||||
@@ -71,12 +71,27 @@
|
||||
</form>
|
||||
</div>
|
||||
@if($search == true && $blacklist_search == false)
|
||||
<div class="text-center mt-3">
|
||||
<button type="button" style="margin:auto" class="btn btn-primary" onclick="newcustomer()">
|
||||
Daftar Pelanggan
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
<div class="text-center mt-3">
|
||||
|
||||
{{-- ✅ Jika anggota tapi belum daftar pelanggan --}}
|
||||
@if(isset($showDaftarPelangganBtn) && $showDaftarPelangganBtn)
|
||||
<button type="button" style="margin:auto" class="btn btn-success" onclick="newcustomer()">
|
||||
Daftar Pelanggan
|
||||
</button>
|
||||
@endif
|
||||
|
||||
{{-- ✅ Jika pelanggan dah ada tapi belum anggota --}}
|
||||
@if(isset($showAssignAnggotaBtn) && $showAssignAnggotaBtn)
|
||||
<form action="{{ route('customers.assignAnggota') }}" method="POST" style="display:inline-block;">
|
||||
@csrf
|
||||
<input type="hidden" name="noic" value="{{ $noic }}">
|
||||
<button type="submit" class="btn btn-primary">Assign sebagai Anggota</button>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal No KP -->
|
||||
@@ -478,42 +493,75 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var search = "<?php echo $search ?>";
|
||||
var type_id = "<?php echo $idtype ?>";
|
||||
var blacklist_search = "<?php echo $blacklist_search ?>";
|
||||
var isAnggota = @json($isAnggota ?? false);
|
||||
var isPelanggan = @json($isPelanggan ?? false);
|
||||
var showAssignAnggotaBtn = @json($showAssignAnggotaBtn ?? false);
|
||||
var showDaftarPelangganBtn = @json($showDaftarPelangganBtn ?? false);
|
||||
|
||||
$(document).ready(function(){
|
||||
// Datepicker
|
||||
$('#passport_tarikh_lahir').datepicker({
|
||||
format: 'dd/mm/yyyy',
|
||||
endDate: new Date()
|
||||
});
|
||||
|
||||
var noic = $('#noic').val();
|
||||
identifyIC(noic);
|
||||
if (typeof identifyIC === 'function') {
|
||||
identifyIC(noic);
|
||||
}
|
||||
|
||||
if(search == true){
|
||||
if(blacklist_search == true){
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Amaran!',
|
||||
text: 'Pelanggan telah disenarai hitamkan dari Pembiayaan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: 'Pelanggan Tiada Dalam Rekod!',
|
||||
text: 'Sila Daftar Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
// Debug: Papar semua nilai dalam console
|
||||
console.log({
|
||||
search,
|
||||
blacklist_search,
|
||||
showAssignAnggotaBtn,
|
||||
showDaftarPelangganBtn
|
||||
});
|
||||
|
||||
// Logik amaran SweetAlert
|
||||
if("{{ auth()->user()->cawangan }}" == 'X0301'){
|
||||
if (search === true) {
|
||||
if (blacklist_search === true) {
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Amaran!',
|
||||
text: 'Pelanggan telah disenarai hitamkan dari Pembiayaan.'
|
||||
});
|
||||
}
|
||||
else if (isAnggota && !isPelanggan) {
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: 'Anggota Belum Didaftarkan!',
|
||||
text: 'Pelanggan ini adalah anggota koperasi tetapi belum berdaftar sebagai pelanggan.'
|
||||
});
|
||||
}
|
||||
else if (isPelanggan && !isAnggota) {
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: 'Pelanggan Bukan Anggota!',
|
||||
text: 'Pelanggan ini berdaftar tetapi belum menjadi anggota koperasi.'
|
||||
});
|
||||
}
|
||||
else if (!isAnggota && !isPelanggan) {
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: 'Pelanggan Tiada Dalam Rekod!',
|
||||
text: 'Sila Daftar Pelanggan.'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function calculatePassportAge(){
|
||||
var passport_lahir = $('#passport_tarikh_lahir').val();
|
||||
var split_date = passport_lahir.split('/');
|
||||
|
||||
+3012
-2609
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@
|
||||
getPusherResponse();
|
||||
|
||||
async function getPusherResponse(){
|
||||
let api_url = "<?php echo $api_url ?>";
|
||||
let api_url = "{{ api_url_for_browser() }}";
|
||||
const jsonData = {
|
||||
norujukan: "{{ $errorapproval['norujukan'] }}",
|
||||
kodcaw: "{{ Auth::user()->cawangan }}",
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
$('form input').keydown(function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
@endphp
|
||||
@endif
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
$('form input').keydown(function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -326,7 +326,7 @@
|
||||
</div>
|
||||
<script src="{{ asset('js/rounded-methods.js') }}"></script>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw_ujrah = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
$('form input').keydown(function (e) {
|
||||
@@ -768,7 +768,7 @@
|
||||
|
||||
// Call API to get specific MaxMutuEmas data by karat
|
||||
$.ajax({
|
||||
url: '{{ config("api.url") }}/api/maxmutuemas/specific',
|
||||
url: '{{ api_url_for_browser() }}/api/maxmutuemas/specific',
|
||||
type: 'GET',
|
||||
data: { karat: karat, nilaimarhun: nm },
|
||||
success: function(response) {
|
||||
@@ -1026,7 +1026,7 @@
|
||||
'harga' : harga_edit,
|
||||
'n_marhun' : nilai_marhun_edit,
|
||||
'marhun' : marhun_edit,
|
||||
// 'nota' : nota,
|
||||
'nota' : nota,
|
||||
'tag_permata' : tagpermata_edit,
|
||||
'berat_batu_permata' : beratpermata_edit,
|
||||
"teller": "{{ Auth::user()->name }}",
|
||||
@@ -1816,7 +1816,7 @@
|
||||
rowsData.forEach((rowData) => {
|
||||
// Call API to get margin data for each individual item
|
||||
$.ajax({
|
||||
url: '{{ config("api.url") }}/api/maxmutuemas/specific',
|
||||
url: '{{ api_url_for_browser() }}/api/maxmutuemas/specific',
|
||||
type: 'GET',
|
||||
data: { karat: rowData.karat, nilaimarhun: rowData.nilaiMarhun },
|
||||
success: function(response) {
|
||||
|
||||
@@ -217,6 +217,68 @@
|
||||
</div>
|
||||
</diV>
|
||||
</div>
|
||||
<div class="col-12" id="cara_terima_section" style="display:none;">
|
||||
<hr>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-3">
|
||||
Cara Terima Pembiayaan
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="cara_terima" id="cara_terima_tunai" value="TUNAI" checked>
|
||||
<label class="form-check-label" for="cara_terima_tunai">Tunai</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="cara_terima" id="cara_terima_online" value="ONLINE">
|
||||
<label class="form-check-label" for="cara_terima_online">Online (Akaun Bank)</label>
|
||||
</div>
|
||||
<small class="form-text text-muted">Pilihan Online untuk pembiayaan RM5,000 – RM50,000 sahaja.</small>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bank_online_section" style="display:none;">
|
||||
<div class="form-group row">
|
||||
<div class="col-md-3">Modal Online</div>
|
||||
<div class="col-md-9">
|
||||
<div id="modal_online_status" class="mb-1">Memeriksa baki...</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-3">Bank</div>
|
||||
<div class="col-md-4">
|
||||
@php
|
||||
$banks_list = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/bank')
|
||||
->json();
|
||||
@endphp
|
||||
<select class="form-control" name="kodbank" id="gadai_kodbank">
|
||||
<option value="">-- Pilih Bank --</option>
|
||||
@foreach ($banks_list as $banks)
|
||||
<option value="{{ $banks['abbreviation'] }}"
|
||||
{{ ($customer_info['kodbank'] ?? '') == $banks['abbreviation'] ? 'selected' : '' }}
|
||||
data-nama="{{ $banks['name'] }}">
|
||||
{{ $banks['name'] }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">No. Akaun</div>
|
||||
<div class="col-md-3">
|
||||
<input type="text" class="form-control" name="noakaun" id="gadai_noakaun"
|
||||
value="{{ $customer_info['noakaun'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-3">Nama Akaun</div>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" name="nama_akaun" id="gadai_nama_akaun"
|
||||
value="{{ $customer_info['nama'] ?? '' }}">
|
||||
<input type="hidden" name="nama_bank" id="gadai_nama_bank" value="">
|
||||
<input type="hidden" name="nama_pelanggan" value="{{ $customer_info['nama'] ?? '' }}">
|
||||
<input type="hidden" name="nopelanggan" id="nopelanggan" value="{{ $customer_info['nopelanggan'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<input type="text" name="norujukan_gadai" id="norujukan_gadai" value="{{ $norujukan }}" hidden>
|
||||
<input type="text" name="marhun_detail" id="marhun_detail" value="" hidden>
|
||||
@@ -224,6 +286,7 @@
|
||||
<input type="text" name="kadarkeuntungan" id="kadarkeuntungan" value="" hidden>
|
||||
<input type="text" name="kuantiti_marhun" id="kuantiti_marhun" value="" hidden>
|
||||
<input type="text" name="total_nilai_marhun" id="total_nilai_marhun" value="" hidden>
|
||||
<input type="text" name="nokp" id="nokp" value="{{ !empty($customer_info['kpbaru']) ? $customer_info['kpbaru'] : ($customer_info['kplama'] ?? '') }}" hidden>
|
||||
<a href="{{ route('gadai.batal',['norujukan'=>$norujukan]) }}" class="float-right btn btn-danger mr-2">Batal</a>
|
||||
<input type="submit" name="terima_gadai" id="terima_gadai" class="float-right btn btn-primary mr-2" value="Terima">
|
||||
</div>
|
||||
@@ -330,7 +393,7 @@
|
||||
@endif
|
||||
<script src="{{ asset('js/rounded-methods.js') }}"></script>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw_ujrah = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
$('form input').keydown(function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
@@ -633,6 +696,7 @@
|
||||
url: api_url + '/api/kadarujrah',
|
||||
async:false,
|
||||
data:{
|
||||
'nokp': $('#nokp').val(),
|
||||
'nilaimarhun' : total_nilai_marhun,
|
||||
'kodcaw' : kodcaw_ujrah
|
||||
},
|
||||
@@ -679,6 +743,10 @@
|
||||
$('#pinjaman').on('input',function(){
|
||||
var pinjaman = Number(this.value);
|
||||
var nilaimarhun = Number($('#jumlah_nilai_marhun').val());
|
||||
var nokp = $('#nokp').val();
|
||||
//console.log('DEBUG NOKP:', nokp, kadarupah);
|
||||
|
||||
toggleCaraTerima(pinjaman);
|
||||
|
||||
// var keuntungan_sebulan = pinjaman * kadarupah;
|
||||
// var keuntungan_6bln = keuntungan_sebulan * 6;
|
||||
@@ -692,6 +760,7 @@
|
||||
url: api_url + '/api/onepercent',
|
||||
async:false,
|
||||
data:{
|
||||
'nokp': nokp,
|
||||
'nilaimarhun' : total_nilai_marhun,
|
||||
'pembiayaan' : pinjaman,
|
||||
'kadarujrah' : kadarupah,
|
||||
@@ -1189,9 +1258,170 @@
|
||||
.then(response => response.json());
|
||||
}
|
||||
|
||||
function toggleCaraTerima(pinjaman) {
|
||||
if (pinjaman >= 5000 && pinjaman <= 50000) {
|
||||
$('#cara_terima_section').show();
|
||||
toggleBankOnlineSection();
|
||||
} else {
|
||||
$('#cara_terima_section').hide();
|
||||
$('#bank_online_section').hide();
|
||||
$('#cara_terima_tunai').prop('checked', true);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleBankOnlineSection() {
|
||||
if ($('input[name="cara_terima"]:checked').val() === 'ONLINE') {
|
||||
$('#bank_online_section').show();
|
||||
var nama = $('#gadai_kodbank option:selected').data('nama') || '';
|
||||
$('#gadai_nama_bank').val(nama);
|
||||
refreshModalOnlineStatus();
|
||||
} else {
|
||||
$('#bank_online_section').hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('change', 'input[name="cara_terima"]', function () {
|
||||
toggleBankOnlineSection();
|
||||
});
|
||||
|
||||
$(document).on('change', '#gadai_kodbank', function () {
|
||||
$('#gadai_nama_bank').val($('#gadai_kodbank option:selected').data('nama') || '');
|
||||
});
|
||||
|
||||
async function getModalOnline() {
|
||||
let kodcaw = $('#kodcaw').val();
|
||||
let apiUrl = api_url + '/api/modal-online/' + kodcaw;
|
||||
return $.ajax({
|
||||
method: 'GET',
|
||||
url: apiUrl,
|
||||
dataType: 'json',
|
||||
});
|
||||
}
|
||||
|
||||
async function refreshModalOnlineStatus() {
|
||||
var $el = $('#modal_online_status');
|
||||
$el.removeClass('text-success text-danger text-warning text-muted').addClass('text-muted').text('Memeriksa baki...');
|
||||
try {
|
||||
var modal = await getModalOnline();
|
||||
var pending = modal.pending_request || null;
|
||||
var closed = Number(modal.ditutup || 0) === 1;
|
||||
var missing = !!modal.missing;
|
||||
var baki = Number(modal.baki || 0);
|
||||
var had = Number(modal.had || 0) + Number(modal.tambah || 0);
|
||||
|
||||
if (closed) {
|
||||
$el.removeClass('text-muted').addClass('text-danger')
|
||||
.text('Modal online hari ini sudah ditutup (EOD). Gadai online tidak dibenarkan.');
|
||||
return modal;
|
||||
}
|
||||
|
||||
if (pending) {
|
||||
$el.removeClass('text-muted').addClass('text-warning')
|
||||
.text('Menunggu kelulusan Operasi: RM ' + formatter.format(Number(pending.amaun || 0)) +
|
||||
' (' + (pending.dimohon_oleh || '-') + ').');
|
||||
} else if (missing) {
|
||||
$el.removeClass('text-muted').addClass('text-danger')
|
||||
.text('Belum ada had hari ini. Sila hubungi PC.');
|
||||
} else {
|
||||
$el.removeClass('text-muted').addClass('text-success')
|
||||
.text('Baki RM ' + formatter.format(baki) + ' / Had RM ' + formatter.format(had));
|
||||
}
|
||||
return modal;
|
||||
} catch (e) {
|
||||
$el.removeClass('text-muted').addClass('text-danger').text('Gagal semak modal online.');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function checkDisbursementFloat(pinjaman) {
|
||||
var cara = $('input[name="cara_terima"]:checked').val() || 'TUNAI';
|
||||
if (!(pinjaman >= 5000 && pinjaman <= 50000)) {
|
||||
cara = 'TUNAI';
|
||||
}
|
||||
|
||||
if (cara === 'ONLINE') {
|
||||
var kodbank = $('#gadai_kodbank').val();
|
||||
var noakaun = ($('#gadai_noakaun').val() || '').trim();
|
||||
$('#gadai_nama_bank').val($('#gadai_kodbank option:selected').data('nama') || '');
|
||||
if (!kodbank || !noakaun) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila lengkapkan maklumat bank untuk pembayaran online.'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
var modal;
|
||||
try {
|
||||
modal = await getModalOnline();
|
||||
} catch (e) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Gagal semak modal online. Sila cuba lagi.'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Number(modal.ditutup || 0) === 1) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Modal online hari ini sudah ditutup (EOD). Sila pilih Tunai.'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (modal.pending_request) {
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: 'Menunggu Operasi',
|
||||
text: 'Permohonan RM ' + formatter.format(Number(modal.pending_request.amaun || 0)) +
|
||||
' masih PENDING. Sila tunggu kelulusan Operasi atau pilih Tunai.'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (modal.missing) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Belum ada had modal online hari ini. Sila hubungi PC.'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Number(modal.baki || 0) < pinjaman) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Baki modal online tidak mencukupi. Sila hubungi PC untuk mohon tambah modal, atau pilih Tunai.'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
let dataCawangan = await getDataCawangan();
|
||||
let bakiAkhir = dataCawangan.baki;
|
||||
if (bakiAkhir < pinjaman) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Baki Akhir Tunai Lebih Rendah Daripada Nilai Marhun Yang Ingin Digadaikan. Sila Tambah Pendahuluan di Laman Aliran Tunai Segera. '
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function verifyGadai(func){
|
||||
$("#terima_gadai").prop('disabled', true);
|
||||
event.preventDefault();
|
||||
if (typeof event !== 'undefined' && event && event.preventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
var kodcaw = $('#kodcaw').val();
|
||||
var nokp = $('#nokp').val();
|
||||
var nopelanggan = $('#nopelanggan').val();
|
||||
@@ -1217,24 +1447,17 @@
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Pembiayaan Tidak Lengkap'
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
let floatOk = await checkDisbursementFloat(pinjaman);
|
||||
if (!floatOk) {
|
||||
$("#terima_gadai").prop('disabled', false);
|
||||
return false;
|
||||
}
|
||||
|
||||
let dataCawangan = await getDataCawangan();
|
||||
let bakiAkhir = dataCawangan.baki;
|
||||
|
||||
if(bakiAkhir < pinjaman){
|
||||
$("#terima_gadai").prop('disabled', false);
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Baki Akhir Tunai Lebih Rendah Daripada Nilai Marhun Yang Ingin Digadaikan. Sila Tambah Pendahuluan di Laman Aliran Tunai Segera. '
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if(true){
|
||||
|
||||
if($.isNumeric(pinjaman) == false){
|
||||
$("#terima_gadai").prop('disabled', false);
|
||||
@@ -1975,7 +2198,7 @@
|
||||
rowsData.forEach((rowData) => {
|
||||
// Call API to get margin data for each individual item
|
||||
$.ajax({
|
||||
url: '{{ config("api.url") }}/api/maxmutuemas/specific',
|
||||
url: '{{ api_url_for_browser() }}/api/maxmutuemas/specific',
|
||||
type: 'GET',
|
||||
data: { karat: rowData.karat, nilaimarhun: rowData.nilaiMarhun },
|
||||
success: function(response) {
|
||||
|
||||
@@ -262,6 +262,10 @@
|
||||
<a href="{{ url('pendahuluanserahan') }}"
|
||||
class="btn btn-info btn-lg btn-block mb-3">Pendahuluan - Serahan</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<a href="{{ route('pembiayaan.online.pc') }}"
|
||||
class="btn btn-info btn-lg btn-block mb-3">Pembiayaan Online</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<a href="{{ route('khazanah.indexwakil') }}"
|
||||
class="btn btn-info btn-lg btn-block mb-3">Surat Wakil</a>
|
||||
@@ -274,11 +278,9 @@
|
||||
<div class="row">
|
||||
<a href="{{ route('lelong') }}" class="btn btn-info btn-lg btn-block mb-3">Lelong</a>
|
||||
</div>
|
||||
@if(Auth::user()->cawangan == '011237')
|
||||
<div class="row">
|
||||
<a href="{{ url('panjar') }}" class="btn btn-info btn-lg btn-block mb-3">Perbelanjaan</a>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<a href="{{ url('alirantunai') }}" class="btn btn-info btn-lg btn-block mb-3">Aliran
|
||||
Tunai</a>
|
||||
@@ -322,7 +324,7 @@
|
||||
});
|
||||
|
||||
|
||||
let api = "{{ config('api.url') }}";
|
||||
let api = "{{ api_url_for_browser() }}";
|
||||
let kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
const initialambilan = [
|
||||
|
||||
@@ -14,12 +14,16 @@
|
||||
</nav>
|
||||
|
||||
<div class="card-body text-center">
|
||||
<a href="{{ route('operasi.kelulusan') }}" class="btn btn-info btn-lg">Kelulusan</a>
|
||||
<a href="{{ route('daftar.kakitangan') }}" class="btn btn-info btn-lg">Kakitangan</a>
|
||||
<a href="{{ route('parameter') }}" class="btn btn-info btn-lg">Parameter</a>
|
||||
<a href="{{ route('komuditi') }}" class="btn btn-info btn-lg">Komoditi</a>
|
||||
<a href="{{ route('perubatan') }}" class="btn btn-info btn-lg">Perubatan</a>
|
||||
<a href="{{ route('operasi.laporan.audit') }}" class="btn btn-info btn-lg">Laporan Audit</a>
|
||||
<a href="{{ route('operasi.kelulusananggota') }}" class="btn btn-info btn-lg d-inline-block m-1">Kelulusan Anggota</a>
|
||||
<a href="{{ route('operasi.kelulusan') }}" class="btn btn-info btn-lg d-inline-block m-1">Kelulusan</a>
|
||||
<a href="{{ route('pembiayaan.online.operasi') }}" class="btn btn-info btn-lg d-inline-block m-1">Pembiayaan Online</a>
|
||||
<a href="{{ route('pembiayaan.online.operasi.topup') }}" class="btn btn-info btn-lg d-inline-block m-1">Modal Online</a>
|
||||
<a href="{{ route('pembiayaan.online.operasi.eod') }}" class="btn btn-info btn-lg d-inline-block m-1">EOD Modal Online</a>
|
||||
<a href="{{ route('daftar.kakitangan') }}" class="btn btn-info btn-lg d-inline-block m-1">Kakitangan</a>
|
||||
<a href="{{ route('parameter') }}" class="btn btn-info btn-lg d-inline-block m-1">Parameter</a>
|
||||
<a href="{{ route('komuditi') }}" class="btn btn-info btn-lg d-inline-block m-1">Komoditi</a>
|
||||
<a href="{{ route('perubatan') }}" class="btn btn-info btn-lg d-inline-block m-1">Perubatan</a>
|
||||
<a href="{{ route('operasi.laporan.audit') }}" class="btn btn-info btn-lg d-inline-block m-1">Laporan Audit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var cawangan = "{{ Auth::user()->cawangan }}";
|
||||
var teller = "{{ Auth::user()->name }}";
|
||||
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
let teller = "{{ Auth::user()->name }}";
|
||||
let kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
function pelangganclick()
|
||||
{
|
||||
// $getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json();
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
const d = new Date();
|
||||
let tahunsemasa = d.getFullYear();
|
||||
let pusherenv = "{{ env('PUSHER_APP_KEY') }}";
|
||||
let api_url = "{{ $api_url }}";
|
||||
let api_url = "{{ api_url_for_browser() }}";
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var cawangan = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var search = "<?php echo $search ?>";
|
||||
var type_id = "<?php echo $idtype ?>";
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
|
||||
var ppc = "{{ Auth::user()->name }}";
|
||||
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
"scrollX": true
|
||||
});
|
||||
|
||||
let api = "{{ config('api.url') }}";
|
||||
let api = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
@@ -271,7 +271,7 @@
|
||||
|
||||
async function updatelulus(e)
|
||||
{
|
||||
let api = "{{ config('api.url') }}";
|
||||
let api = "{{ api_url_for_browser() }}";
|
||||
let kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
const { value: katalaluan } = await Swal.fire({
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
let api = "{{ config('api.url') }}";
|
||||
let api = "{{ api_url_for_browser() }}";
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
$(document).ready( function () {
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tabletebus = $('#myTable').DataTable({
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablebatalgadai = $('#myTable').DataTable({
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablegadai = $('#myTable').DataTable({
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
$(document).ready( function () {
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
$(document).ready( function () {
|
||||
|
||||
@@ -189,6 +189,10 @@
|
||||
<a href="{{ route('laporan.notisperingatan') }}"
|
||||
class="btn btn-dark btn-lg btn-block mb-3 custom-btn">Notis Peringatan</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<a href="{{ route('laporan.imbangduga') }}"
|
||||
class="btn btn-dark btn-lg btn-block mb-3 custom-btn">Imbang Duga</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablebatalgadai = $('#myTable').DataTable({
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
// alert(btoa(api_url));
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tabletebus = $('#myTable').DataTable({
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var panjartebus = $('#myTable').DataTable({
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
$(document).ready( function () {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
$(document).ready( function () {
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tabletuntutbaki = $('#myTable').DataTable({
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var advansurtable = $('#myTable').DataTable({
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tabletebus = $('#myTable').DataTable({
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablegadai = $('#myTable').DataTable({
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tablecustomers = $('#myTable').DataTable({
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
</div>
|
||||
<script src="{{ asset('js/main.js') }}"></script>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
$(".modal.fade").on("show.bs.modal", function(e) {
|
||||
@@ -1087,7 +1087,7 @@
|
||||
if (suratBtn) {
|
||||
const norujukan = suratBtn.getAttribute('data-norujukan');
|
||||
|
||||
let gadaianDetail = await fetch("{{ config('api.url') }}" + `/api/gadai/norujukankodcaw/${kodcaw}/${norujukan}`)
|
||||
let gadaianDetail = await fetch("{{ api_url_for_browser() }}" + `/api/gadai/norujukankodcaw/${kodcaw}/${norujukan}`)
|
||||
.then(response => response.json());
|
||||
|
||||
askOperasiApproval(gadaianDetail[0][0]);
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -304,7 +304,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
let api = "{{ config('api.url') }}";
|
||||
let api = "{{ api_url_for_browser() }}";
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
]
|
||||
});
|
||||
|
||||
let api = "{{ config('api.url') }}";
|
||||
let api = "{{ api_url_for_browser() }}";
|
||||
let kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
let teller = "{{ Auth::user()->name }}";
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"ordering": false
|
||||
});
|
||||
|
||||
var api_url = '{{ $api_url }}';
|
||||
var api_url = '{{ api_url_for_browser() }}';
|
||||
|
||||
$('#PermohonanWang').on('hidden.bs.modal', function (e) {
|
||||
$(this)
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
"ordering": false
|
||||
});
|
||||
|
||||
var api_url = '{{ $api_url }}';
|
||||
var api_url = '{{ api_url_for_browser() }}';
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<script>
|
||||
var api_arrahnbid = "<?php echo config('app.api_arrahnbid') ?>";
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
|
||||
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
|
||||
var cawangan = "{{ Auth::user()->cawangan }}";
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
|
||||
var ppc = "{{ Auth::user()->name }}";
|
||||
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
|
||||
|
||||
@@ -466,7 +466,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
|
||||
var ppc = "{{ Auth::user()->name }}";
|
||||
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var api_url = "<?php echo $api_url ?>";
|
||||
var api_url = "{{ api_url_for_browser() }}";
|
||||
var search = "<?php echo $search ?>";
|
||||
var type_id = "<?php echo $idtype ?>";
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
@if(Auth::user()->roles == 'ppc' || Auth::user()->roles == 'pc')
|
||||
<script>
|
||||
window.api = "{{ config('api.url') }}";
|
||||
window.api = "{{ api_url_for_browser() }}";
|
||||
window.kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
window.apikey = "{{ env('PUSHER_APP_KEY') }}";
|
||||
</script>
|
||||
@@ -199,7 +199,7 @@
|
||||
<!-- Right Side Of Navbar -->
|
||||
<ul class="navbar-nav ml-auto">
|
||||
|
||||
|
||||
@include('layouts.partials.impersonation_nav')
|
||||
|
||||
@php $auth_user = Auth::user(); @endphp
|
||||
@if ($auth_user['roles'] == 'ppc' || $auth_user['roles'] == 'pc')
|
||||
@@ -381,6 +381,7 @@
|
||||
<a class="dropdown-item" href="{{ route('profile') }}">
|
||||
{{ __('Profile') }}
|
||||
</a>
|
||||
@if(!(Auth::check() && method_exists(Auth::user(), 'isImpersonated') && Auth::user()->isImpersonated()))
|
||||
<a class="dropdown-item" href="{{ route('logout') }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
@@ -390,6 +391,7 @@
|
||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
|
||||
<!-- Right Side Of Navbar -->
|
||||
<ul class="navbar-nav ml-auto">
|
||||
@include('layouts.partials.impersonation_nav')
|
||||
<!-- <li class="nav-item dropdown" style="margin-right:10px;">
|
||||
<a id="navbarDropdown" class="nav-link " href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
||||
<i id="bell" class="fa fa-bell"></i>
|
||||
@@ -143,6 +144,7 @@
|
||||
<a class="dropdown-item" href="{{ route('profile') }}">
|
||||
{{ __('Profile') }}
|
||||
</a>
|
||||
@if(!(Auth::check() && method_exists(Auth::user(), 'isImpersonated') && Auth::user()->isImpersonated()))
|
||||
<a class="dropdown-item" href="{{ route('logout') }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
@@ -152,6 +154,7 @@
|
||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user