Merge branch 'faiqahzaman' into 'main'
update 21/6 See merge request online-sistem1/lelong!85
This commit is contained in:
@@ -52,6 +52,7 @@ class MarhunController extends Controller
|
||||
$lelongbid = LelongBid::where('lelong_id', '=', $lelong_id) //keseluruhan
|
||||
->where('caw_id','=', $caw->id)
|
||||
->get();
|
||||
// dd($lelongbid->toArray());
|
||||
|
||||
$sag = LelongBid::where('lelong_id', $lelong_id) //belum disemak
|
||||
->where('caw_id', $caw->id)
|
||||
|
||||
@@ -15,6 +15,7 @@ use App\Models\Cart;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\Resit;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LelongMobileController extends Controller
|
||||
{
|
||||
@@ -274,6 +275,55 @@ class LelongMobileController extends Controller
|
||||
// dd($winner);
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function bidresults($user_id, $lelong_id)
|
||||
{
|
||||
$sag = LelongBid::join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbidder.user_id',$user_id)
|
||||
->where('lelongbidder.status_bidder',1)
|
||||
->whereNull('lelongbidder.status_payment')
|
||||
->select(
|
||||
'lelongbid.kodcaw'
|
||||
)
|
||||
->groupBy('lelongbid.kodcaw')
|
||||
->get();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach($sag as $index1=>$kodcaw)
|
||||
{
|
||||
// dd($kodcaw);
|
||||
$groupBycaw = LelongBid::join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbidder.user_id',$user_id)
|
||||
->where('lelongbidder.status_bidder',1)
|
||||
->whereNull('lelongbidder.status_payment')
|
||||
->where('lelongbid.kodcaw', $kodcaw['kodcaw'])
|
||||
->get();
|
||||
|
||||
$sag[$index1]['kodcaw'] = $groupBycaw;
|
||||
|
||||
$total_hargabida = 0;
|
||||
foreach($groupBycaw as $hargabida)
|
||||
{
|
||||
$totalbida = Lelongbidder::where('id', $hargabida['id'])
|
||||
->select('hargabida')
|
||||
->first();
|
||||
|
||||
$total_hargabida = $total_hargabida + $totalbida['hargabida'];
|
||||
}
|
||||
|
||||
array_push($data,[
|
||||
'sag'=> $kodcaw,
|
||||
'total_hargabida'=> $total_hargabida
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
// dd($winner);
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function updatebiditem(Request $request)
|
||||
{
|
||||
@@ -437,4 +487,120 @@ class LelongMobileController extends Controller
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function bayarCdm(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'lelong_id' => 'required|string',
|
||||
'lelongbid_id' => 'required|string|unique:users',
|
||||
'user_id' => 'required|string|unique:users'
|
||||
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$errors = [
|
||||
'success' => "error",
|
||||
'message' => $validator->errors()
|
||||
];
|
||||
return response($errors, 201);
|
||||
}
|
||||
|
||||
$paymentexist = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
->where('payment.lelong_id', $request->lelong_id)
|
||||
->where('payment.user_id', $request->user_id)
|
||||
->first();
|
||||
|
||||
if($paymentexist)
|
||||
{
|
||||
$getpayment = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
->where('payment.lelong_id', $request->lelong_id)
|
||||
->where('payment.user_id', $request->user_id)
|
||||
->select('payment.id as payment_id',
|
||||
'payment.lelong_id',
|
||||
'payment.user_id',
|
||||
'fileresit.id as fileresit_id',
|
||||
'fileresit.file_type',
|
||||
'fileresit.filename'
|
||||
)
|
||||
->first();
|
||||
|
||||
$updatepayment = FileResit::where('payment_id', $getpayment['payment_id'])
|
||||
->where('id', $getpayment['fileresit_id'])
|
||||
->first();
|
||||
$updatepayment->id;
|
||||
$updatepayment->user_id = $request->user_id;
|
||||
$updatepayment->payment_id = $updatepayment->payment_id;
|
||||
$updatepayment->file_type = $request->file_type;
|
||||
$updatepayment->filename = $request->filename;
|
||||
$updatepayment->update();
|
||||
|
||||
return response($response, 201);
|
||||
}
|
||||
else
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
// $imageName = time().'.'.$request->resit->extension();
|
||||
$data = base64_encode($request->resit->get());
|
||||
$file_type = $request->resit->extension();
|
||||
|
||||
$resit = Resit::where('lelong_id', $request->lelong_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->where('resit_type', 2)
|
||||
->first();
|
||||
|
||||
$payment = new Payment;
|
||||
$payment->user_id = $request->user_id;
|
||||
$payment->lelong_id = $request->lelong_id;
|
||||
$payment->kodcaw = $user->kodcaw;
|
||||
$payment->status_payment_opt = 3;
|
||||
$payment->status = 2;
|
||||
$payment->remark = 'BAYARAN CDM';
|
||||
$payment->resit_id = $resit->id;
|
||||
$payment->total_payment = $request->total_payment;
|
||||
$payment->diminta_pada = $currentdate;
|
||||
$payment->diminta_oleh = $user->id;
|
||||
// $payment->save();
|
||||
|
||||
$addfile = new FileResit;
|
||||
$addfile->user_id = $request->user_id;
|
||||
$addfile->payment_id = $payment->id;
|
||||
$addfile->file_type = $file_type;
|
||||
$addfile->filename = $data;
|
||||
// $addfile->save();
|
||||
|
||||
foreach($bid_id as $bid)
|
||||
{
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.lelongbid_id', $bid)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
|
||||
$updatelelbidbidder = LelongBidder::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->first();
|
||||
$updatelelbidbidder->status_payment = 2;
|
||||
$updatelelbidbidder->payment_id = $payment->id;
|
||||
// $updatelelbidbidder->save();
|
||||
|
||||
$eachbidupdate = LelongBid::where('id',$bid)->first();
|
||||
$eachbidupdate->hargajual = $eachbid->hargabida;
|
||||
// $eachbidupdate->save();
|
||||
|
||||
}
|
||||
|
||||
return response($response, 201);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,8 +174,10 @@ class PaymentController extends Controller
|
||||
$user = Auth::user();
|
||||
|
||||
// $bid_id = implode(",", $request->eachbid);
|
||||
$bid_id = $request->eachbid;
|
||||
// dd($bid_id);
|
||||
// $bid_id = $request->eachbid;
|
||||
$bidid = implode(",", $request->eachbid);
|
||||
$bid_id = explode(",", $bidid);
|
||||
|
||||
|
||||
$resit = Resit::where('lelong_id', $request->lelong_id)
|
||||
->where('user_id',$request->user_id)
|
||||
@@ -276,7 +278,7 @@ class PaymentController extends Controller
|
||||
{
|
||||
// dd($request->all());
|
||||
//eachbid = lelongbid_id
|
||||
$bid_id = implode(",", $request->eachbid);
|
||||
// $bid_id = implode(",", $request->eachbid);
|
||||
// dd($bid_id);
|
||||
|
||||
$paymentexist = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
@@ -316,7 +318,9 @@ class PaymentController extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$bid_id = $request->eachbid;
|
||||
// $bid_id = $request->eachbid;
|
||||
$bidid = implode(",", $request->eachbid);
|
||||
$bid_id = explode(",", $bidid);
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
|
||||
@@ -835,7 +835,7 @@ class SimulasiController extends Controller
|
||||
}
|
||||
|
||||
|
||||
return view('simulasi.senaraimarhunlel',compact('marhuns','simulasi_id','cawid','keuntungan','cal'));
|
||||
return view('simulasi.senaraimarhunlel',compact('marhuns','simulasi_id','cawid','keuntungan'));
|
||||
}
|
||||
|
||||
public function deletemarhunlel(Request $request){
|
||||
|
||||
@@ -172,6 +172,8 @@ class TangguhLelongController extends Controller
|
||||
$lelbidmarhun = $request->checkboxdata;
|
||||
|
||||
$lelong = Lelong::where('id', $request->lelong_id)->get()->toArray();
|
||||
|
||||
$arraynorujukan = [];
|
||||
|
||||
foreach($lelbidmarhun as $bidmarhun)
|
||||
{
|
||||
@@ -240,9 +242,14 @@ class TangguhLelongController extends Controller
|
||||
$tangguhlelong->ditangguh_pada = $currentdate;
|
||||
$tangguhlelong->nota = $request->remark;
|
||||
$tangguhlelong->save();
|
||||
|
||||
array_push($arraynorujukan,['norujukan'=>$tangguhlelong['norujukan']]);
|
||||
// $norujukan = implode(",", $arraynorujukan);
|
||||
|
||||
}
|
||||
return redirect()->route('tangguhlelong.carian', $request->lelong_id)->with('success','Pengesahan Tangguh Lelong Berjaya');
|
||||
|
||||
return redirect()->route('tangguhlelong.carian', $request->lelong_id)->with('success','Pengesahan Tangguh Lelong Berjaya, Norujukan:')
|
||||
->with('norujukan', $arraynorujukan );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
<input type="hidden" name="lelongbidmarhun_id" id="lelongbidmarhun_id">
|
||||
<input type="hidden" name="lelongbid_id" id="lelongbid_id">
|
||||
</form>
|
||||
|
||||
<br>
|
||||
<h4> No Rujukan : <td>{{ $lelongbid->norujukan }}</td></h4>
|
||||
<br>
|
||||
<table class="table table-striped table-xl" id="marhun" style="width:100%">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
|
||||
<th>No. Rujukan</th>
|
||||
<th class="text-center">Barang</th>
|
||||
<th>Marhun</th>
|
||||
<th>Karat</th>
|
||||
<th>Berat</th>
|
||||
@@ -42,8 +43,7 @@
|
||||
|
||||
@foreach ($marhun as $item)
|
||||
<tr>
|
||||
<td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $item->id }}"></td>
|
||||
<td>{{ $lelongbid->norujukan }}</td>
|
||||
<td class="text-center"> {{ $loop->iteration }} </td>
|
||||
<td>{{ $item->marhun }}</td>
|
||||
<td>
|
||||
@if($item->karat != null)
|
||||
|
||||
@@ -11,20 +11,21 @@
|
||||
</div>
|
||||
@endif
|
||||
<div class="container">
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-12 mx-auto card p-4" style="margin-top:2%; margin-bottom:2%;">
|
||||
<p><u><b>Bilangan SAG {{ $caw['caw_name'] }}</b></u><p>
|
||||
<p><b>Keseluruhan : {{ sizeof($lelongbid) }}</b> </p>
|
||||
<p><b>Belum Disemak : {{ sizeof($sag) }}</b></p>
|
||||
<p><b>Dalam Proses : {{ sizeof($dalamproses) }}</b></p>
|
||||
<p><b>Sudah Disemak : {{ sizeof($sdhdisemak) }}</b></p>
|
||||
<p><b>Sudah Disahkan Oleh Operasi : {{ sizeof($sdhdisahkan) }}</b></p>
|
||||
<br>
|
||||
<p><b><u> Tangguh Lelong Oleh Pengurus Cawangan </u></b></p>
|
||||
<p><b>Sudah Disemak : {{ sizeof($sdhdisemaktangguhlel) }}</b></p>
|
||||
<p><b>Dalam Proses : {{ sizeof($dalamprosestangguhlel) }}</b></p>
|
||||
<p><b>Sudah Disahkan Oleh Operasi : {{ sizeof($sdhdisahkantangguhlel) }}</b></p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6 col-sm-4">
|
||||
<p><u><b>Bilangan SAG : </b></u><p>
|
||||
<p><b>Keseluruhan : {{ sizeof($lelongbid) }}</b> </p>
|
||||
<p><b>Belum Disemak : {{ sizeof($sag) }}</b></p>
|
||||
<p><b>Dalam Proses : {{ sizeof($dalamproses) }}</b></p>
|
||||
<p><b>Sudah Disemak : {{ sizeof($sdhdisemak) }}</b></p>
|
||||
<p><b>Sudah Disahkan Oleh Operasi : {{ sizeof($sdhdisahkan) }}</b></p>
|
||||
</div>
|
||||
<div class="col-6 col-sm-4">
|
||||
<p><b><u> Tangguh Lelong Oleh Pengurus Cawangan </u></b></p>
|
||||
<p><b>Sudah Disemak : {{ sizeof($sdhdisemaktangguhlel) }}</b></p>
|
||||
<p><b>Dalam Proses : {{ sizeof($dalamprosestangguhlel) }}</b></p>
|
||||
<p><b>Sudah Disahkan Oleh Operasi : {{ sizeof($sdhdisahkantangguhlel) }}</b></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="exportform" action="" method="POST">
|
||||
@@ -48,18 +49,14 @@
|
||||
<td>{{ $bid->t_lelong }}</td>
|
||||
<td>
|
||||
@if($bid->status_semak == 0)
|
||||
@if($bid['pengesahan'] !== null)
|
||||
<button class="btn btn-warning btn-sm hovernone-warning" disabled>DALAM PROSES</button>
|
||||
@else
|
||||
<button class="btn btn-danger btn-sm hovernone-danger" disabled>BELUM DISEMAK</button>
|
||||
@endif
|
||||
@elseif($bid['pengesahan'] !== null && $bid->status_semak == 1)
|
||||
<button class="btn btn-danger btn-sm hovernone-danger" disabled>BELUM DISEMAK</button>
|
||||
@elseif(($bid['pengesahan'] !== null) && ($bid->status_semak == 1))
|
||||
@if($bid['pengesahan']['disahkan_oleh'] !== null)
|
||||
<button class="btn btn-success btn-sm hovernone-success" disabled>SUDAH DISAHKAN</button>
|
||||
@else
|
||||
<button class="btn btn-warning btn-sm hovernone-warning" disabled>DALAM PROSES</button>
|
||||
@endif
|
||||
@elseif($bid->status_semak == 1 && $bid['pengesahan'] === null)
|
||||
@elseif(($bid->status_semak == 1) && ($bid['pengesahan'] === null))
|
||||
<button class="btn btn-outline-success btn-sm" disabled>SUDAH DISEMAK</button>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
@csrf
|
||||
<input type="hidden" name="user_id" value="{{ $user_id }}" />
|
||||
<input type="hidden" name="lelong_id" value="{{ $lelong_id }}" />
|
||||
<input type="hidden" name="eachbid" id="eachbid" value="" />
|
||||
<input type="hidden" name="eachbid[]" id="eachbid" value="" />
|
||||
<table class="table table-border table-hover table-xl" style="width:100%">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
<th>Marhun</th>
|
||||
<th>Karat</th>
|
||||
<th>Berat</th>
|
||||
<th>Harga Gadaian (RM)</th>
|
||||
<th>Harga Asal (RM)</th>
|
||||
<th>Harga Lelong (RM)</th>
|
||||
<th>Nilai Marhun Gadaian</th>
|
||||
<th>Nilai Marhun Lelong</th>
|
||||
<th>N. Marhun Asal</th>
|
||||
<th>N. Marhun Lelong</th>
|
||||
<th>Harga Asas</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
@@ -133,7 +133,7 @@
|
||||
<input type="hidden" name="lelongbid_id" value="{{ $lelongbid->id }}" />
|
||||
<input type="hidden" name="jenis_button" value="tangguhlelong" id="jenis_button" />
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="col-form-label"><b>Sila Pilih Sebab Tangguh Lelong:</b></label>
|
||||
<label for="message-text" class="col-form-label" style="font-color:red;* "><b>Sila Pilih Sebab Tangguh Lelong:</b></label>
|
||||
<br>
|
||||
<br>
|
||||
<input type="radio" id="mutu" name="nota" value="Perubahan Mutu Tinggi">
|
||||
@@ -148,7 +148,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" style="width:15%;" data-dismiss="modal">Tutup</button>
|
||||
<button type="button" class="btn btn-danger" style="width:15%;" data-dismiss="modal">Batal</button>
|
||||
<button type="button" class="btn btn-primary" style="width:15%;" onclick="submit(this)">Sahkan</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
@if ($message = Session::get('success'))
|
||||
<div class="alert alert-success" style="margin-top:1%;">
|
||||
<p>{{ $message }}</p>
|
||||
@php
|
||||
$declarez = Session::get('norujukan');
|
||||
|
||||
foreach($declarez as $index=>$dec)
|
||||
{
|
||||
echo '<p>' . $dec['norujukan'] . '</p>';
|
||||
}
|
||||
@endphp
|
||||
</div>
|
||||
@elseif ($message = Session::get('failed'))
|
||||
<div class="alert alert-danger" style="margin-top:1%;">
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
@endif
|
||||
<div class="d-flex">
|
||||
<button type="button" class="btn btn-light" onclick="window.history.go(-1);" ><h3><i class="fas fa-arrow-alt-circle-left"></i></h3></a></button>
|
||||
<div class="container">
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-12 mx-auto card p-4" style="margin-top:2%; margin-bottom:2%;">
|
||||
@@ -29,6 +31,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="formtangguhlel" action="{{route('tangguhlelong.tangguhlelong')}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="lelong_id" value="{{ $lelong_id }}">
|
||||
@@ -37,7 +40,7 @@
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>JBG</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Narhun</th>
|
||||
<th>Nilai Marhun (RM)</th>
|
||||
<th>Pembiayaan (RM)</th>
|
||||
|
||||
@@ -59,9 +59,11 @@ Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
Route::get('/lelongDetails/cawangan', [LelongMobileController::class, 'searchLelByCaw']);
|
||||
Route::get('/karat', [LelongMobileController::class, 'getListKarat']);
|
||||
Route::get('/result/{user_id}', [LelongMobileController::class, 'bidresult']);
|
||||
Route::get('/bayar/{user_id}/{lelong_id}', [LelongMobileController::class, 'bidresults']);
|
||||
Route::get('/history/{user_id}', [LelongMobileController::class, 'history']);
|
||||
Route::get('/listcawlelongtoday', [LelongMobileController::class, 'listCawLelongToday']);
|
||||
Route::get('/listcawlelongnext', [LelongMobileController::class, 'listCawLelongNext']);
|
||||
Route::post('/bayarcdm', [LelongMobileController::class, 'bayarCdm']);
|
||||
|
||||
// Lelong => Bidder
|
||||
Route::post('/bidder/biditem', [LelongMobileController::class, 'bidderSelectBidItem']);
|
||||
|
||||
Reference in New Issue
Block a user