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'));
}
}