This commit is contained in:
LAPTOP-DGCU80CH\user1
2020-11-26 16:53:16 +08:00
parent 9fcbcae462
commit 3eb90e2c89
7 changed files with 228 additions and 26 deletions
@@ -64,7 +64,9 @@ class LoginController extends Controller
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info'));
}elseif($auth_user['roles'] == 'penilai'){
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info'));
$gadaian_semasa = Http::get(config('api.url') . '/api/gadaiansemasa/'. $auth_user['cawangan'])->json();
$gadaian_belumserah = Http::get(config('api.url') . '/api/gadaiansemasa/belum_serah/'. $auth_user['cawangan'])->json();
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info','gadaian_semasa','gadaian_belumserah'));
}
elseif($auth_user['roles'] == 'khazanah'){
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
+3 -1
View File
@@ -33,7 +33,9 @@ class HomeController extends Controller
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info'));
}elseif($auth_user['roles'] == 'penilai'){
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info'));
$gadaian_semasa = Http::get(config('api.url') . '/api/gadaiansemasa/'. $auth_user['cawangan'])->json();
$gadaian_belumserah = Http::get(config('api.url') . '/api/gadaiansemasa/belum_serah/'. $auth_user['cawangan'])->json();
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info','gadaian_semasa','gadaian_belumserah'));
}
elseif($auth_user['roles'] == 'khazanah'){
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
+5 -5
View File
@@ -61,20 +61,20 @@
</div>
</div>
</div>
<div class="col-12 mt-3 form-group row">
<div class="col-12 mt-3 justify-content-between form-group row">
<div class="btn-group btn-group-toggle col-6" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="options" id="option1" value="belum_tebus" autocomplete="off" checked> BELUM TEBUS
<input type="radio" name="options" id="option1" value="belum_tebus" autocomplete="off" checked>Belum Tebus
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option2" value="sudah_tebus" autocomplete="off"> SUDAH TEBUS
<input type="radio" name="options" id="option2" value="sudah_tebus" autocomplete="off">Sudah Tebus
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option3" value="lelong" autocomplete="off"> LELONG
<input type="radio" name="options" id="option3" value="lelong" autocomplete="off">Lelong
</label>
</div>
<div class="col-6 text-right">
<a class="button btn btn-primary" href="{{ route('gadaian',['noic'=>$customer_info['kpbaru'] ]) }}">DAFTAR GADAI</a>
<a class="button btn btn-primary" style="margin-right:-50px" href="{{ route('gadaian',['noic'=>$customer_info['kpbaru'] ]) }}">Daftar Gadai</a>
</div>
</div>
</div>
+12 -13
View File
@@ -149,9 +149,9 @@
</diV>
</div>
<div class="col-12">
<input type="button" class="float-right btn btn-danger mr-2" value="BATAL">
<input type="button" name="terima_gadai" id="terima_gadai" class="float-right btn btn-primary mr-2" value="TERIMA">
<input type="button" class="float-right btn btn-primary mr-2" value="TAMBAH GADAI">
<a href="{{ url('/pelanggan') }}" class="float-right btn btn-danger mr-2">Batal</a>
<input type="button" name="terima_gadai" id="terima_gadai" class="float-right btn btn-primary mr-2" value="Terima">
<input type="button" class="float-right btn btn-primary mr-2" value="Tambah Gadai">
</div>
</div>
</form>
@@ -283,7 +283,7 @@
getHargaEmas(karat,berat)
});
$('#berat_emas').change(function(){
$('#berat_emas').on('input',function(){
var berat = this.value;
var karat = $('#karat').val();
karat = karat.replace(/\./g,'-');
@@ -353,12 +353,13 @@
counter = counter + 1;
});
});
var pinjaman_pelulus = 0;
var pinjaman_teller = 0;
$.ajax({
method:'GET',
url:'http://localhost:8000/api/maxpinjaman',
success:function(data){
var pinjaman_pelulus = 0;
var pinjaman_teller = 0;
$.each(data,function(index,pinjaman){
if(pinjaman['user_type'] == 'teller'){
pinjaman_teller = Number(pinjaman['max']);
@@ -369,16 +370,15 @@
});
$('.span-pinjaman-max-pelulus').text(pinjaman_pelulus + ' %');
$('.span-pinjaman-max').text(pinjaman_teller + ' %');
var max_teller = total_nilai_marhun * (pinjaman_teller/100);
var max_pelulus = total_nilai_marhun * (pinjaman_pelulus/100);
$('#pinjaman_max_teller').val(formatter.format(max_teller));
$('#pinjaman_max_pelulus').val(formatter.format(max_pelulus));
}
});
var max_teller = total_nilai_marhun * (pinjaman_teller/100);
var max_pelulus = total_nilai_marhun * (pinjaman_pelulus/100);
$('#pinjaman_max_teller').val(max_teller.toFixed(2));
$('#pinjaman_max_pelulus').val(max_pelulus.toFixed(2));
}
$('#pinjaman').change(function(){
$('#pinjaman').on('input',function(){
var pinjaman = Number(this.value);
if(pinjaman > 0 && pinjaman < 401){
@@ -511,7 +511,6 @@
var pinjaman = Number($('#pinjaman').val());
var percentpinj = Number(pinjaman)/Number(total_nilai_marhun);
// console.log(kodcaw,nokp,jantina,bangsa,nopelanggan,norujukan,pinjaman,percentpinj);
$.ajax({
method:'PUT',
url: 'http://localhost:8000/api/gadai/norujukan/'+kodcaw+'/'+norujukan,
+198 -3
View File
@@ -1,17 +1,212 @@
@extends('layouts.app')
<!-- The Modal -->
<div class="modal fade" id="marhunModal">
<div class="modal-dialog modal-xl modal-dialog-centered">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<h4>Marhun</h4>
<table id="biasa" class="table table-striped table-bordered text-center" style="width:100%">
<thead>
<tr>
<th>Bil</th>
<th>Jenis Marhun</th>
<th>Berat</th>
<th>Karat</th>
<th>Nilai Marhun</th>
</tr>
</thead>
<tbody id="tablemarhun">
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-center">
<a href="" class="btn btn-primary disabled">Cetak SAG</a>
<a href="" class="btn btn-primary">Pembelian Komuditi</a>
</div>
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
<div class="card-header">{{ __('Dashboard') }}</div>
<input type="hidden" name="kodcaw" id="kodcaw" value="{{$cawangan_info['kodcaw']}}">
<div class="card-body text-center">
Penilai
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="gadaian-semasa-tab" data-toggle="tab" href="#gadaian-semasa" role="tab" aria-controls="gadaian-semasa" aria-selected="true">Gadaian Semasa</a>
</li>
<li class="nav-item">
<a class="nav-link" id="gadaian-belum-serah-tab" data-toggle="tab" href="#gadaian-belum-serah" role="tab" aria-controls="gadaian-belum-serah" aria-selected="false">Gadaian Belum Serah</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="gadaian-semasa" role="tabpanel" aria-labelledby="gadaian-semasa-tab">
<h4>Gadaian Semasa</h4>
<table class='table' id='table-gadaian-semasa'>
<thead>
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Pembiayaan (RM)</th>
<th>Nilai Marhun (RM)</th>
<th>Berat (g)</th>
</tr>
</thead>
<tbody>
@php $count=1; @endphp
@if (is_array($gadaian_semasa) || is_object($gadaian_semasa))
@foreach($gadaian_semasa as $index=>$gadaian)
<tr>
<td>{{ $count }}</td>
<td>
@php
$marhun = Http::get('http://localhost:8000/api/marhun/' . $gadaian['norujukan'] )->json();
@endphp
<a href="#" data-toggle="modal" data-marhun="{{ json_encode($marhun) }}" data-norujukan="{{$gadaian['norujukan']}}" data-hargajualan="{{$gadaian['hargajualan']}}" data-kodcaw="{{ $gadaian['kodcaw'] }}" data-target="#marhunModal"> {{$gadaian['norujukan']}}</a>
</td>
<td>{{ $gadaian['pinjaman'] }}</td>
<td>{{ $gadaian['nilaimarhun'] }}</td>
<td>{{ $gadaian['berat'] }}</td>
</tr>
@php $count++; @endphp
@endforeach
@endif
</tbody>
</table>
</div>
<div class="tab-pane fade" id="gadaian-belum-serah" role="tabpanel" aria-labelledby="gadaian-belum-serah-tab">
<h4>Gadaian Belum Serah</h4>
<table class='table' id='table-gadaian-belum-serah'>
<thead>
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Pembiayaan (RM)</th>
<th>Nilai Marhun (RM)</th>
<th>Berat (g)</th>
</tr>
</thead>
<tbody>
@php $count=1; @endphp
@if (is_array($gadaian_belumserah) || is_object($gadaian_belumserah))
@foreach($gadaian_belumserah as $index=>$gadaian)
<tr>
<td><input type="checkbox" id="checkgadai" autocomplete="off" data-norujukan="{{$gadaian['norujukan']}}" data-kodcaw="{{ $gadaian['kodcaw'] }}" data-marhun="{{$gadaian['nilaimarhun']}}"></input></td>
<td>
@php
$marhun = Http::get('http://localhost:8000/api/marhun/' . $gadaian['norujukan'] )->json();
@endphp
<a href="#" data-toggle="modal" data-marhun="{{ json_encode($marhun) }}" data-norujukan="{{$gadaian['norujukan']}}" data-hargajualan="{{$gadaian['hargajualan']}}" data-kodcaw="{{ $gadaian['kodcaw'] }}" data-target="#marhunModal"> {{$gadaian['norujukan']}}</a>
</td>
<td>{{ $gadaian['pinjaman'] }}</td>
<td>{{ $gadaian['nilaimarhun'] }}</td>
<td>{{ $gadaian['berat'] }}</td>
</tr>
@php $count++; @endphp
@endforeach
@endif
</tbody>
</table>
<div class='row mt-md-3'>
<div class='col-md-12 d-flex justify-content-end form-group'>
Jumlah Nilai Marhun Dipilih
<div class='col-md-3'>
<input type="text" name="marhunpilih" id="marhunpilih" readonly class='form-control'>
</div>
<a href="" class='btn btn-primary'>Serah Marhun</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
window.onload = timedRefresh(60000);
var table_gadaian_semasa = $('#table-gadaian-semasa').DataTable({
"ordering": false
});
var table_gadaian_belum_serah = $('#table-gadaian-belum-serah').DataTable({
"ordering": false
});
const formatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2
});
//modal
$('#marhunModal').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget); // button yg trigger
var arraymarhun = button.data('marhun');
var norujukan = button.data('norujukan');
var kodcaw = button.data('kodcaw');
var hargajualan = button.data('hargajualan');
$('#tablemarhun').empty();
$.each(arraymarhun,function(index,marhun){
$.each(marhun, function(index,marhun_detail){
var marhun_name;
$.ajax({
method:'GET',
url:'http://localhost:8000/api/jemas/nama_marhun',
dataType: 'json',
data:{
marhun:marhun_detail['marhun']
},
success:function(marhun_ajax){
$("#tablemarhun").append("<tr><td>" + marhun_detail['bil'] + "</td><td>" + marhun_ajax['descpt'] +"</td><td>" + marhun_detail['berat'] +"</td><td>" + marhun_detail['karat'] +"</td><td>RM " + marhun_detail['n_marhun'].toLocaleString(undefined,{minimumFractionDigits:2}) +"</td></tr>");
}
});
});
});
});
var total_marhun_pilih = 0;
$(document).on('click', '#checkgadai', function(e) {
if ($(this).is(':checked')) {
var norujukan = $(this).data("norujukan");
var kodcaw = $(this).data("kodcaw");
var marhun = $(this).data("marhun");
total_marhun_pilih += Number(marhun);
$('#marhunpilih').val(total_marhun_pilih.toFixed(2));
}else {
var norujukan = $(this).data("norujukan");
var kodcaw = $(this).data("kodcaw");
var marhun = $(this).data("marhun");
total_marhun_pilih -= Number(marhun);
$('#marhunpilih').val(total_marhun_pilih.toFixed(2));
}
});
</script>
@endsection
+2 -2
View File
@@ -39,7 +39,7 @@
function startTime() {
var today = new Date();
var d = today.getDate();
var mon = today.getMonth();
var mon = today.getMonth()+1;
var y = today.getFullYear()
var h = today.getHours();
var m = today.getMinutes();
@@ -62,7 +62,7 @@
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="{{ url('/') }}">
<img src="{{ asset('img/logo_arrahn_baru.png') }}" class="logo-arrahn-header" alt="Logo Ar Rahn" /> AR-RAHN
<img src="{{ asset('img/logo_arrahn_baru.png') }}" class="logo-arrahn-header" alt="Logo Ar Rahn" /> ar-rahn
</a>
<div id="displaytime"></div>
<div class="navbar-brand ml-md-3">
+5 -1
View File
@@ -27,6 +27,8 @@ Route::post('login', 'Auth\LoginController@authenticate');
Route::get('/', 'HomeController@index')->name('home');
Route::get('/home', 'HomeController@index')->name('home');
//Teller
Route::get('/pelanggan','CustomersController@index')->middleware('auth','teller');
Route::get('/customer_info',['as'=>'customer_info','uses'=>'CustomersController@info'])->middleware('auth','teller');
Route::get('/gadaian',['as'=>'gadaian','uses'=>'GadaianController@index'])->middleware('auth','teller');
@@ -37,4 +39,6 @@ Route::get('/harga_emas','HargaEmasController@index')->middleware('auth','teller
Route::get('/profile',['as'=>'profile','uses'=>'UserController@index'])->middleware('auth','teller');
Route::get('{user_type}/customer/search',['as'=>'customer.search','uses'=>'CustomersController@search'])->middleware('auth','teller');
Route::post('{user_type}/customer/store',['as'=>'customer.store','uses'=>'CustomersController@store'])->middleware('auth','teller');
Route::get('/test',['as'=>'test','uses'=>'CustomersController@test']);
//Penilai
Route::get('/gadaiansemasa',['as'=>'gadaian.semasa','uses'=>'GadaianController@gadaiansemasa'])->middleware('auth','penilai');