DONE: request online modal from pc to operasi, operasi can edit amount; WIP: customer detail confirmation form, retest pembiayaan online, notification if required
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
@extends('layouts.app_operasi')
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb pb-3">
|
||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('pembiayaan.online.operasi') }}">Pembiayaan Online</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">Tambah Modal Online</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">{{ session('message') }}</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">{{ session('error') }}</div>
|
||||
@endif
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<form method="get" action="{{ route('pembiayaan.online.operasi.topup') }}" class="form-inline">
|
||||
<label class="mr-2">Status</label>
|
||||
<select name="status" class="form-control mr-3">
|
||||
<option value="PENDING" {{ ($status ?? 'PENDING') === 'PENDING' ? 'selected' : '' }}>PENDING</option>
|
||||
<option value="APPROVED" {{ ($status ?? '') === 'APPROVED' ? 'selected' : '' }}>APPROVED</option>
|
||||
<option value="REJECTED" {{ ($status ?? '') === 'REJECTED' ? 'selected' : '' }}>REJECTED</option>
|
||||
<option value="all" {{ ($status ?? '') === 'all' ? 'selected' : '' }}>Semua</option>
|
||||
</select>
|
||||
<label class="mr-2">Tarikh</label>
|
||||
<input type="date" name="tarikh" class="form-control mr-3" value="{{ $tarikh ?? '' }}">
|
||||
<button type="submit" class="btn btn-primary">Tapis</button>
|
||||
<a href="{{ route('pembiayaan.online.operasi.topup') }}" class="btn btn-secondary ml-2">Reset</a>
|
||||
<a href="{{ route('pembiayaan.online.operasi') }}" class="btn btn-outline-secondary ml-2">Batch Online</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">Permohonan Had / Tambah Modal Online</h5>
|
||||
<span class="text-muted">{{ count($requests) }} rekod</span>
|
||||
</div>
|
||||
<div class="card-body table-responsive">
|
||||
<table class="table table-striped table-hover table-sm text-center">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Cawangan</th>
|
||||
<th>Tarikh</th>
|
||||
<th>Amaun (RM)</th>
|
||||
<th>Dimohon Oleh</th>
|
||||
<th>Status</th>
|
||||
<th>Nota</th>
|
||||
<th>Tindakan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($requests as $req)
|
||||
@php
|
||||
$st = $req['status'] ?? '';
|
||||
$badge = 'badge-secondary';
|
||||
if ($st === 'PENDING') $badge = 'badge-warning';
|
||||
elseif ($st === 'APPROVED') $badge = 'badge-success';
|
||||
elseif ($st === 'REJECTED') $badge = 'badge-danger';
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $req['id'] ?? '-' }}</td>
|
||||
<td class="text-left">
|
||||
<div>{{ $req['cawangan_nama'] ?? '-' }}</div>
|
||||
<small class="text-muted">{{ $req['kodcaw'] ?? '' }}</small>
|
||||
</td>
|
||||
<td>{{ $req['tarikh'] ?? '-' }}</td>
|
||||
<td class="text-right">{{ number_format((float)($req['amaun'] ?? 0), 2) }}</td>
|
||||
<td>{{ $req['dimohon_oleh'] ?? '-' }}</td>
|
||||
<td><span class="badge {{ $badge }}">{{ $st ?: '-' }}</span></td>
|
||||
<td class="text-left small">{{ $req['nota'] ?? '-' }}</td>
|
||||
<td class="text-nowrap">
|
||||
@if($st === 'PENDING')
|
||||
<button type="button"
|
||||
class="btn btn-success btn-sm btn-approve-topup"
|
||||
data-id="{{ $req['id'] }}"
|
||||
data-kodcaw="{{ $req['kodcaw'] ?? '' }}"
|
||||
data-cawangan="{{ $req['cawangan_nama'] ?? ($req['kodcaw'] ?? '') }}"
|
||||
data-amaun="{{ number_format((float)($req['amaun'] ?? 0), 2, '.', '') }}">
|
||||
Lulus
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn btn-danger btn-sm btn-reject-topup"
|
||||
data-id="{{ $req['id'] }}"
|
||||
data-kodcaw="{{ $req['kodcaw'] ?? '' }}"
|
||||
data-amaun="{{ number_format((float)($req['amaun'] ?? 0), 2) }}">
|
||||
Tolak
|
||||
</button>
|
||||
@else
|
||||
<small class="text-muted">{{ $req['diluluskan_oleh'] ?? '-' }}</small>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="8">Tiada permohonan untuk tapisan ini.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="approveTopupModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form method="post" id="approveTopupForm" action="">
|
||||
@csrf
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Lulus Permohonan Modal</h5>
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="mb-3">
|
||||
Cawangan: <b id="approveCawangan"></b>
|
||||
(<span id="approveKodcaw"></span>)<br>
|
||||
Amaun dimohon: RM <b id="approveAmaunDimohon"></b>
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label>Amaun diluluskan (RM) <span class="text-danger">*</span></label>
|
||||
<input type="number" name="amaun" id="approveAmaun" class="form-control"
|
||||
min="0.01" step="0.01" required>
|
||||
<small class="form-text text-muted">Boleh tukar amaun sebelum lulus.</small>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<label>Nota (pilihan)</label>
|
||||
<textarea name="nota" class="form-control" rows="3" placeholder="Catatan kelulusan"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-success">Lulus</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="rejectTopupModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form method="post" id="rejectTopupForm" action="">
|
||||
@csrf
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Tolak Permohonan Modal</h5>
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="mb-2">
|
||||
Cawangan: <b id="rejectKodcaw"></b><br>
|
||||
Amaun: RM <b id="rejectAmaun"></b>
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label>Nota (pilihan)</label>
|
||||
<textarea name="nota" class="form-control" rows="3" placeholder="Sebab tolak"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-danger">Tolak</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('.btn-approve-topup').on('click', function () {
|
||||
var id = $(this).data('id');
|
||||
var amaun = $(this).data('amaun');
|
||||
$('#approveTopupForm').attr('action', "{{ url('/pembiayaan-online/operasi/topup') }}/" + id + "/approve");
|
||||
$('#approveCawangan').text($(this).data('cawangan'));
|
||||
$('#approveKodcaw').text($(this).data('kodcaw'));
|
||||
$('#approveAmaunDimohon').text(Number(amaun).toLocaleString('en-MY', { minimumFractionDigits: 2, maximumFractionDigits: 2 }));
|
||||
$('#approveAmaun').val(amaun);
|
||||
$('#approveTopupForm textarea[name="nota"]').val('');
|
||||
$('#approveTopupModal').modal('show');
|
||||
});
|
||||
|
||||
$('.btn-reject-topup').on('click', function () {
|
||||
var id = $(this).data('id');
|
||||
$('#rejectTopupForm').attr('action', "{{ url('/pembiayaan-online/operasi/topup') }}/" + id + "/reject");
|
||||
$('#rejectKodcaw').text($(this).data('kodcaw'));
|
||||
$('#rejectAmaun').text($(this).data('amaun'));
|
||||
$('#rejectTopupModal').modal('show');
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user