This commit is contained in:
Zakwan Hamdan
2020-10-27 23:17:13 +08:00
parent 29b6272c5f
commit 5f104396e6
5 changed files with 26 additions and 17 deletions
+1 -7
View File
@@ -47,16 +47,10 @@ class CustomersController extends Controller
$customers_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
$customer_info = $customers_info[0];
$belum_tebus = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/belum_tebus')->json();
$sudah_tebus = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/sudah_tebus')->json();
$lelong = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/lelong')->json();
// dd($belum_tebus);
$search = true;
if($customer_info){
Session::put('customer_info',$customer_info);
Session::put('belum_tebus',$belum_tebus);
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'belum_tebus'=>$belum_tebus,'sudah_tebus'=>$sudah_tebus,'lelong'=>$lelong]);
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info]);
}else{
return view('customers.index',compact('customer_info','search','noic','cawangan_info'));
}
+13 -2
View File
@@ -7,6 +7,7 @@ use App\Services\CustomerService;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Auth;
use Carbon\Carbon;
class GadaianController extends Controller
{
@@ -18,12 +19,22 @@ class GadaianController extends Controller
public function index(Request $request)
{
$current = Carbon::now();
$current = new Carbon();
$curent_year = substr($current->year,2,2);
$curent_month = sprintf("%02d", $current->month);
$current_day = sprintf("%02d", $current->day);
// dd($current_day);
$noic = $request->noic;
$customer_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
$customers_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
$customer_info = $customers_info[0];
// $limit_pinjaman_semasa = $customer_info['limit_pinjaman'] - $customer_info['pinjaman_semasa'];
$limit_pinjaman_semasa = 0;
$auth_user = Auth::user();
$gadai_transaction = sizeof(Http::get(config('api.url') . '/api/gadai/'. $auth_user['cawangan'] . '/' . $current->toDateString())->json());
$new_transaction = sprintf("%04d",$gadai_transaction+1);
$norujukan = strtoupper($auth_user['cawangan']) . $curent_year . $curent_month . $current_day . '-' .$new_transaction;
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info'));
return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info','norujukan'));
}
}
+6 -1
View File
@@ -3,6 +3,9 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Auth;
class MarhunController extends Controller
{
@@ -12,6 +15,8 @@ class MarhunController extends Controller
}
public function index(){
return view('marhun.index');
$auth_user = Auth::user();
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('marhun.index',compact('cawangan_info'));
}
}
+3 -4
View File
@@ -3,7 +3,6 @@
@section('content')
<?php
$customer_info = Session::get('customer_info');
$belum_tebus = Session::get('belum_tebus');
?>
<div class="container">
<div class="row justify-content-center">
@@ -104,7 +103,7 @@
var tablegadai = $('#myTable').DataTable();
function gadaiTable(data){
var counter = 1;
tablegadai.clear();
tablegadai.clear().draw();
$.each(data,function(index,gadai){
$.each(gadai, function(index,gadai_detail){
tablegadai.row.add([
@@ -114,7 +113,7 @@
'RM '+ gadai_detail['pinjaman'].toLocaleString("en-GB"),
'RM '+ gadai_detail['nilaimarhun'].toLocaleString("en-GB"),
'0',
'RM '+ ((gadai_detail['kadarupah']/100)*gadai_detail['pinjaman']*gadai_detail['tempoh'])
'RM '+ parseFloat(((gadai_detail['kadarupah']/100)*gadai_detail['pinjaman']*gadai_detail['tempoh']).toLocaleString("en-GB")).toFixed(2)
]).draw();
counter = counter + 1;
@@ -136,7 +135,7 @@
} );
function gadaiOptionButton(noic){
tablegadai.clear();
tablegadai.clear().draw();
if($("input[name='options']:checked").val() == 'belum_tebus'){
// console.log(noic);
$.ajax({
+3 -3
View File
@@ -6,13 +6,13 @@
<div class="col-md-12">
<h3 class="text-center text-uppercase">gadaian</h3>
<div class="form-group row col-12">
<div class="col-6">
<div class="col-6">
<div class="form-group row">
<div class="col-4">
Nama
</div>
<div class="col-8">
<input type="text" name="name" id="name" readonly value="{{ $customer_info['nama'] }}">
<input type="text" name="name" id="name" readonly value="{{ $customer_info['nama'] }}">
</div>
</div>
</div>
@@ -32,7 +32,7 @@
No Rujukan
</div>
<div class="col-8">
<input type="text" name="no_rujukan" id="no_rujukan" readonly value="">
<input type="text" name="no_rujukan" id="no_rujukan" readonly value="{{ $norujukan }}">
</div>
</div>
</div>