fix terima/serah marhun penilai
This commit is contained in:
@@ -360,24 +360,43 @@ class MarhunController extends Controller
|
||||
$lelongbid = LelongBid::where('id','=',$lelongBidMarhun->lelongbid_id)->first();
|
||||
$lelong = Lelong::where('id','=',$lelongbid->lelong_id)->first();
|
||||
|
||||
$perluPengesahan = false;
|
||||
$parameterBezaBerat = 0.3;
|
||||
// $perluPengesahan = false;
|
||||
$parameterBezaBerat = 0.3; //parameterBezaBerat = (berat sebelum) - (berat selepas)
|
||||
$bezaBerat = $lelongBidMarhun->berat - $request->berat_emas;
|
||||
|
||||
if ($bezaBerat > $parameterBezaBerat) {
|
||||
$perluPengesahan = true;
|
||||
$lelongBidMarhun->berat = $request->berat_emas;
|
||||
$lelongBidMarhun->update();
|
||||
$pengesahan = new Pengesahan;
|
||||
$pengesahan->lelong_id = $lelong->id;
|
||||
$pengesahan->lelongbid_id = $lelongbid->id;
|
||||
$pengesahan->lelongbidmarhun_id = $lelongBidMarhun->id;
|
||||
$pengesahan->norujukan = $lelongbid->norujukan;
|
||||
$pengesahan->diminta_oleh = $user->id;
|
||||
$pengesahan->diminta_pada = $currentdate;
|
||||
$pengesahan->status_ubah = 4;
|
||||
$pengesahan->request_data = $request->berat_emas;
|
||||
$pengesahan->save();
|
||||
}
|
||||
else if ($lelongBidMarhun->karat > $request->karat) {
|
||||
$perluPengesahan = true;
|
||||
$lelongBidMarhun->karat = $request->karat;
|
||||
$lelongBidMarhun->update();
|
||||
} else {
|
||||
$lelongBidMarhun->id;
|
||||
$pengesahan = new Pengesahan;
|
||||
$pengesahan->lelong_id = $lelong->id;
|
||||
$pengesahan->lelongbid_id = $lelongbid->id;
|
||||
$pengesahan->lelongbidmarhun_id = $lelongBidMarhun->id;
|
||||
$pengesahan->norujukan = $lelongbid->norujukan;
|
||||
$pengesahan->diminta_oleh = $user->id;
|
||||
$pengesahan->diminta_pada = $currentdate;
|
||||
$pengesahan->status_ubah = 1;
|
||||
$pengesahan->request_data = $request->karat;
|
||||
$pengesahan->save();
|
||||
}
|
||||
else {
|
||||
// $lelongBidMarhun->id;
|
||||
$lelongBidMarhun->marhun = $request->marhun;
|
||||
$lelongBidMarhun->old_berat = $lelongBidMarhun->berat;
|
||||
$lelongBidMarhun->old_karat = $lelongBidMarhun->karat;
|
||||
$lelongBidMarhun->old_nmarhun = $lelongBidMarhun->n_marhun;
|
||||
$lelongBidMarhun->berat = $request->berat_emas;
|
||||
$lelongBidMarhun->karat = $request->karat;
|
||||
$lelongBidMarhun->n_marhun = $request->berat_emas * $lelongBidMarhun->harga;
|
||||
$lelongBidMarhun->update();
|
||||
|
||||
// $existingPengesahan = Pengesahan::where('lelongbidmarhun_id', '=', $request->idmarhun)
|
||||
@@ -385,34 +404,37 @@ class MarhunController extends Controller
|
||||
// ->delete();
|
||||
}
|
||||
|
||||
if ($perluPengesahan == true) {
|
||||
$pengesahan = Pengesahan::where('lelongbidmarhun_id', $request->idmarhun)
|
||||
->where('lelongbid_id', $lelongBidMarhun->lelongbid_id)
|
||||
->first();
|
||||
// if ($perluPengesahan == true) {
|
||||
// $pengesahan = Pengesahan::where('lelongbidmarhun_id', $request->idmarhun)
|
||||
// ->where('lelongbid_id', $lelongBidMarhun->lelongbid_id)
|
||||
// ->first();
|
||||
|
||||
if(!$pengesahan)
|
||||
{
|
||||
$pengesahan = new Pengesahan;
|
||||
$pengesahan->lelong_id = $lelong->id;
|
||||
$pengesahan->lelongbid_id = $lelongbid->id;
|
||||
$pengesahan->lelongbidmarhun_id = $lelongBidMarhun->id;
|
||||
$pengesahan->norujukan = $lelongbid->norujukan;
|
||||
$pengesahan->diminta_oleh = $user->id;
|
||||
$pengesahan->diminta_pada = $currentdate;
|
||||
$pengesahan->status_ubah = 1;
|
||||
$pengesahan->save();
|
||||
} else {
|
||||
$pengesahan->id;
|
||||
$pengesahan->lelong_id = $lelong->id;
|
||||
$pengesahan->lelongbid_id = $lelongbid->id;
|
||||
$pengesahan->lelongbidmarhun_id = $lelongBidMarhun->id;
|
||||
$pengesahan->norujukan = $lelongbid->norujukan;
|
||||
$pengesahan->diminta_oleh = $user->id;
|
||||
$pengesahan->diminta_pada = $currentdate;
|
||||
$pengesahan->status_ubah = 1;
|
||||
$pengesahan->update();
|
||||
}
|
||||
}
|
||||
// if(!$pengesahan)
|
||||
// {
|
||||
|
||||
// $pengesahan = new Pengesahan;
|
||||
// $pengesahan->lelong_id = $lelong->id;
|
||||
// $pengesahan->lelongbid_id = $lelongbid->id;
|
||||
// $pengesahan->lelongbidmarhun_id = $lelongBidMarhun->id;
|
||||
// $pengesahan->norujukan = $lelongbid->norujukan;
|
||||
// $pengesahan->diminta_oleh = $user->id;
|
||||
// $pengesahan->diminta_pada = $currentdate;
|
||||
// $pengesahan->status_ubah = 1;
|
||||
// $pengesahan->save();
|
||||
|
||||
// } else {
|
||||
// $pengesahan->id;
|
||||
// $pengesahan->lelong_id = $lelong->id;
|
||||
// $pengesahan->lelongbid_id = $lelongbid->id;
|
||||
// $pengesahan->lelongbidmarhun_id = $lelongBidMarhun->id;
|
||||
// $pengesahan->norujukan = $lelongbid->norujukan;
|
||||
// $pengesahan->diminta_oleh = $user->id;
|
||||
// $pengesahan->diminta_pada = $currentdate;
|
||||
// $pengesahan->status_ubah = 1;
|
||||
// $pengesahan->update();
|
||||
// }
|
||||
// }
|
||||
// dd($lelongBidMarhun);
|
||||
|
||||
// $totallelbid = LelongBid::where('id', $lelongBidMarhun->lelongbid_id)->first();
|
||||
// dd($totallelbid);
|
||||
@@ -472,6 +494,15 @@ class MarhunController extends Controller
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function senaraiLelongTerimaSerah()
|
||||
{
|
||||
|
||||
$lelong = Lelong::orderBy('id', 'desc')->get();
|
||||
|
||||
return view('marhun.senarailelongterimaserah', compact('lelong'));
|
||||
}
|
||||
|
||||
public function senarailelongscan(Request $request){
|
||||
|
||||
$user = Auth::user();
|
||||
@@ -1176,25 +1207,34 @@ class MarhunController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function terimaserahmarhun()
|
||||
public function terimaserahmarhun($lelong_id)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first();
|
||||
|
||||
$senaraiScanKeluar = ScanMarhun::where('kodcaw', '=', $caw->caw_code)
|
||||
->where('lelong_id', $lelong_id)
|
||||
->whereNull('masa_terima')
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
|
||||
$sedangDinilai = ScanMarhun::whereNull('masa_serah')
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
$sedangDinilai = ScanMarhun::where('kodcaw', '=', $caw->caw_code)
|
||||
->whereNull('masa_serah')
|
||||
->where('lelong_id', $lelong_id)
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
|
||||
$sudahSerah = ScanMarhun::whereNotNull('masa_serah')
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
$sudahSerah = ScanMarhun::where('kodcaw', '=', $caw->caw_code)
|
||||
->whereNotNull('masa_serah')
|
||||
->where('lelong_id', $lelong_id)
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
|
||||
return view('marhun.terimaserahmarhun', compact('senaraiScanKeluar', 'sedangDinilai', 'sudahSerah'));
|
||||
if ($senaraiScanKeluar || $sedangDinilai || $sudahSerah) {
|
||||
return view('marhun.terimaserahmarhun', compact('senaraiScanKeluar', 'sedangDinilai', 'sudahSerah'));
|
||||
} else {
|
||||
return redirect()->route('marhun.senarailelongterimaserah')->with('failed', 'Tiada Surat Untuk Dilelong Pada Tarikh Ini.');
|
||||
}
|
||||
}
|
||||
|
||||
public function terimaMarhun(Request $request)
|
||||
@@ -1208,7 +1248,7 @@ class MarhunController extends Controller
|
||||
$terimaMarhun->masa_terima = $current->toTimeString();
|
||||
$terimaMarhun->update();
|
||||
}
|
||||
return redirect()->route('marhun.terimaserahmarhun')->with('success', 'Terima Marhun Berjaya Direkodkan');
|
||||
return redirect()->route('marhun.terimaserahmarhun', $terimaMarhun->lelong_id)->with('success', 'Terima Marhun Berjaya Direkodkan');
|
||||
}
|
||||
|
||||
public function serahMarhun(Request $request)
|
||||
@@ -1221,7 +1261,7 @@ class MarhunController extends Controller
|
||||
$serahMarhun->masa_serah = $current->toTimeString();
|
||||
$serahMarhun->update();
|
||||
}
|
||||
return redirect()->route('marhun.terimaserahmarhun')->with('success', 'Serah Marhun Berjaya Direkodkan');
|
||||
return redirect()->route('marhun.terimaserahmarhun', $serahMarhun->lelong_id)->with('success', 'Serah Marhun Berjaya Direkodkan');
|
||||
}
|
||||
|
||||
public function listScanBarcode($lelong_id)
|
||||
|
||||
@@ -1014,7 +1014,7 @@ class LelongMobileController extends Controller
|
||||
$lelong[$index]['status'] = $status;
|
||||
}
|
||||
|
||||
if (empty($lelong)) {
|
||||
if (!empty($lelong)) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'lelong' => $lelong,
|
||||
|
||||
@@ -26,7 +26,13 @@ class CawanganLelong extends Model
|
||||
'lokasi'
|
||||
];
|
||||
|
||||
public function lelongBid(){
|
||||
public function lelongBid()
|
||||
{
|
||||
return $this->hasMany(LelongBid::class, 'caw_id', 'caw_id');
|
||||
}
|
||||
|
||||
public function cawangan()
|
||||
{
|
||||
return $this->hasOne(Cawangan::class, 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,9 @@ class Lelong extends Model
|
||||
'cajlelong',
|
||||
'sts_lelong'
|
||||
];
|
||||
|
||||
public function cawanganLelong()
|
||||
{
|
||||
return $this->hasMany(CawanganLelong::class, 'lelong_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
</li>
|
||||
@endhasrole
|
||||
@hasrole('penilai')
|
||||
<li class="{{ (request()->is('marhun/terimaserahmarhun') || request()->is('marhun/terimaserahmarhun/*')) ? 'active' : '' }}">
|
||||
<a href="{{url('marhun/terimaserahmarhun')}}">Terima/Serah Marhun</a>
|
||||
<li class="{{ (request()->is('marhun/senarailelongterimaserah') || request()->is('marhun/senarailelongterimaserah/*')) ? 'active' : '' }}">
|
||||
<a href="{{url('marhun/senarailelongterimaserah')}}">Terima/Serah Marhun</a>
|
||||
</li>
|
||||
<li class="{{ (request()->is('marhun/senarailelongmarhun') || request()->is('marhun/senarailelongmarhun/*')) ? 'active' : '' }}">
|
||||
<a href="{{url('marhun/senarailelongmarhun')}}">Semakan Marhun</a>
|
||||
|
||||
@@ -126,11 +126,6 @@
|
||||
</table>
|
||||
<div class="modal-footer" style="margin-top:2%;">
|
||||
@if($lelongbid->status_semak == 0)
|
||||
|
||||
@else
|
||||
<a href="{{ route('marhun.senaraimarhun', $lelong_id) }}" style="width:7%;" class="btn btn-primary">Kembali</a>
|
||||
@endif
|
||||
@if($lelongbid->status_semak == 0)
|
||||
<button style="width:7%;" class="btn btn-success" onclick="confirm()">Semak</button>
|
||||
@elseif($lelongbid->status_semak == 1)
|
||||
<button class="btn btn-success btn-sm hovernone-success" disabled>SUDAH DISEMAK</button>
|
||||
@@ -250,8 +245,12 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@if($lelongbid->status_semak == 0)
|
||||
<button type="button" class="btn btn-secondary" style="width:15%;" data-dismiss="modal">Kembali</button>
|
||||
<button type="button" class="btn btn-primary" style="width:15%;" onclick="tambahanmarhun()">Simpan</button>
|
||||
@elseif($lelongbid->status_semak == 1)
|
||||
<p class="text-danger font-italic">Marhun telah disemak. Tidak dibenarkan untuk tambah.</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -286,8 +285,12 @@
|
||||
@endif
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@if($lelongbid->status_semak == 0)
|
||||
<button type="button" class="btn btn-secondary" style="width:15%;" onclick="clearData()" data-dismiss="modal">Kembali</button>
|
||||
<button type="submit" class="btn btn-primary" style="width:15%;">Simpan</button>
|
||||
@elseif($lelongbid->status_semak == 1)
|
||||
<p class="text-danger font-italic">Marhun telah disemak. Tidak dibenarkan untuk kemaskini.</p>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -319,8 +322,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@if($lelongbid->status_semak == 0)
|
||||
<button type="button" class="btn btn-secondary" onclick="clearData()" tyle="width:15%;" data-dismiss="modal">Kembali</button>
|
||||
<button type="submit" class="btn btn-primary" style="width:15%;">Simpan</button>
|
||||
@elseif($lelongbid->status_semak == 1)
|
||||
<p class="text-danger font-italic">Marhun telah disemak. Tidak dibenarkan untuk kemaskini.</p>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -349,8 +356,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@if($lelongbid->status_semak == 0)
|
||||
<button type="button" class="btn btn-secondary" onclick="clearData()" tyle="width:15%;" data-dismiss="modal">Kembali</button>
|
||||
<button type="submit" class="btn btn-primary" style="width:15%;">Simpan</button>
|
||||
@elseif($lelongbid->status_semak == 1)
|
||||
<p class="text-danger font-italic">Marhun telah disemak. Tidak dibenarkan untuk kemaskini.</p>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-11 mx-auto p-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4> Terima Serah Marhun </h4>
|
||||
@if ($message = Session::get('success'))
|
||||
<div class="alert mt-2 alert-success">
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
@elseif ($message = Session::get('failed'))
|
||||
<div class="alert mt-2 alert-danger">
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
@endif
|
||||
<table class="table table-striped text-center" id="table-lelong">
|
||||
<thead class="bg-primary text-white">
|
||||
<th>Bil</th>
|
||||
<th>Batch Lelong</th>
|
||||
<th>Tarikh Lelong</th>
|
||||
<th>Status Lelong</th>
|
||||
<th>Tindakan</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($lelong as $index)
|
||||
<tr>
|
||||
<td>{{$loop->iteration}}</td>
|
||||
<td>{{$index->id}}</td>
|
||||
<td>{{$index->tarikh_lelong}}</td>
|
||||
@if($index->sts_lelong == 0)
|
||||
<td>
|
||||
<button class="btn btn-warning btn-sm" disabled>LELONG BELUM BERMULA</button>
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
<a href="{{route('marhun.terimaserahmarhun', ['lelong_id'=>$index->id])}}" data-toggle="tooltip" data-placement="top" title="Muat Turun Senarai Marhun"><i class="far fa-edit"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var tableLelong = $('#table-lelong').DataTable({});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@@ -17,6 +17,7 @@
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
@endif
|
||||
<a href="{{route('marhun.senarailelongterimaserah')}}" class="btn mb-2 btn-secondary">Kembali</a>
|
||||
<ul class="nav mb-2 nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="belum-diterima-tab" data-toggle="tab" href="#belum-diterima" role="tab" aria-controls="belum-diterima" aria-selected="true">Belum Diterima</a>
|
||||
|
||||
@@ -116,8 +116,7 @@
|
||||
</table>
|
||||
<div class="modal-footer" style="margin-top:2%;">
|
||||
<a href="{{ route('pengesahan.perubahanmutumarhun', $id) }}" class="btn btn-primary">Kembali</a>
|
||||
<button type="button" class="btn btn-warning">Batal Permohonan</button>
|
||||
<button type="button" class="btn btn-danger" onclick="functerima(this)" data-idmarhun="{{ $lelongbid->id }}" data-norujukan="{{ $lelongbid->norujukan }}" data-kodcaw="{{ $lelongbid->kodcaw }}" id="tangguhlelong" >Tangguh Lelong</button>
|
||||
<button type="button" class="btn btn-danger">Batal Permohonan</button>
|
||||
<button type="button" class="btn btn-success" onclick="functerima(this)" id="terima" >Sahkan</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
+2
-1
@@ -224,7 +224,8 @@ Route::group(['prefix'=>'lelong'], function () {
|
||||
|
||||
//Khazanah
|
||||
Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinimarhun'],'prefix'=>'marhun'], function () {
|
||||
Route::get('/terimaserahmarhun',['as'=>'marhun.terimaserahmarhun','uses'=>'MarhunController@terimaserahmarhun']);
|
||||
Route::get('/senarailelongterimaserah',['as'=>'marhun.senarailelongterimaserah','uses'=>'MarhunController@senaraiLelongTerimaSerah']);
|
||||
Route::get('/terimaserahmarhun/{lelong_id}',['as'=>'marhun.terimaserahmarhun','uses'=>'MarhunController@terimaserahmarhun']);
|
||||
Route::get('/senarailelongmarhun',['as'=>'marhun.senarailelongmarhun','uses'=>'MarhunController@senarailelongmarhun']);
|
||||
Route::get('/senarailelongscan',['as'=>'marhun.senarailelongscan','uses'=>'MarhunController@senarailelongscan']);
|
||||
Route::get('/scanbarcode/{lelong_id}',['as'=>'marhun.scanbarcode','uses'=>'MarhunController@listScanBarcode']);
|
||||
|
||||
Reference in New Issue
Block a user