pengesahan tambah, ubah, delete marhun
This commit is contained in:
@@ -100,6 +100,7 @@ class MarhunController extends Controller
|
||||
$karat->norujukan = $lelongbid->norujukan;
|
||||
$karat->diminta_oleh = $user->id;
|
||||
$karat->diminta_pada = $currentdate;
|
||||
$karat->status_ubah = 1;
|
||||
$karat->save();
|
||||
}
|
||||
}
|
||||
@@ -124,19 +125,22 @@ class MarhunController extends Controller
|
||||
// }
|
||||
|
||||
|
||||
return redirect()->route('marhun.show',$lelongbid->id)
|
||||
return redirect()->route('marhun.show', [$lelongbid->id, $lelong->id])
|
||||
->with('success','Kemaskini Marhun Berjaya');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
public function show($id, $lelong_id)
|
||||
{
|
||||
$lelongbid = LelongBid::where('id','=',$id)->first();
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$id)->get();
|
||||
$marhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid.id','=',$id)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
$lelkarat = LelKarat::where('lelong_id','=',$lelongbid->lelong_id)->get();
|
||||
$karatall = JenisKarat::all();
|
||||
$emasall = JenisEmas::all();
|
||||
// dd($lelkarat);
|
||||
return view('marhun.marhun',compact('marhun','lelongbid','karatall','emasall','lelkarat'));
|
||||
return view('marhun.marhun',compact('marhun','lelongbid','karatall','emasall','lelkarat', 'lelong_id'));
|
||||
}
|
||||
|
||||
|
||||
@@ -203,14 +207,12 @@ class MarhunController extends Controller
|
||||
$karat->norujukan = $lelongbid->norujukan;
|
||||
$karat->diminta_oleh = $user->id;
|
||||
$karat->diminta_pada = $currentdate;
|
||||
$karat->status_ubah = 2;
|
||||
$karat->save();
|
||||
|
||||
return redirect()->route('marhun.show',$lelongbid->id)
|
||||
->with('success','Marhun Berjaya Ditambah');
|
||||
}
|
||||
|
||||
//Operasi
|
||||
|
||||
|
||||
public function exportmarhundetails($lelong_id)
|
||||
{
|
||||
@@ -261,37 +263,56 @@ class MarhunController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function senarailelongubahmutu()
|
||||
{
|
||||
$lelong = Lelong::where('sts_lelong', 0)
|
||||
->get();
|
||||
|
||||
public function sahubahmutu(Request $request)
|
||||
return view('pengesahan.senarailelongubahmutu',compact('lelong'));
|
||||
}
|
||||
|
||||
public function sahubahmutu($id)
|
||||
{
|
||||
// dd($request->all());
|
||||
$mutumarhun = Pengesahan::join('lelong', 'pengesahan.lelong_id', '=', 'lelong.id')
|
||||
$mutumarhun = Lelong::join('pengesahan', 'lelong.id', '=', 'pengesahan.lelong_id')
|
||||
->where('lelong.id', $id)
|
||||
->whereNull('disahkan_oleh')
|
||||
->select(
|
||||
'pengesahan.disahkan_oleh',
|
||||
'pengesahan.id as pengesahan_id',
|
||||
'pengesahan.norujukan',
|
||||
'lelong.id',
|
||||
'lelong.tarikh_lelong',
|
||||
'pengesahan.norujukan'
|
||||
'lelong.harga_emas_asas',
|
||||
'lelong.jbg',
|
||||
'lelong.cajlelong'
|
||||
)
|
||||
->get();
|
||||
|
||||
return view('pengesahan.perubahanmutumarhun', compact('mutumarhun'));
|
||||
return view('pengesahan.perubahanmutumarhun', compact('mutumarhun', 'id'));
|
||||
}
|
||||
|
||||
public function mutumarhun($pengesahan_id, $norujukan)
|
||||
public function mutumarhun($pengesahan_id, $norujukan, $id)
|
||||
{
|
||||
$pengesahan = Pengesahan::where('id', $pengesahan_id)
|
||||
->where('lelong_id', $id)
|
||||
->where('norujukan', $norujukan)
|
||||
->first();
|
||||
|
||||
$marhuns = LelongBidMarhun::where('lelongbid_id', $pengesahan->lelongbid_id)
|
||||
->where('id', $pengesahan->lelongbidmarhun_id)
|
||||
->get()->toArray();
|
||||
|
||||
$lelongbid = LelongBid::where('id', $pengesahan->lelongbid_id)->first();
|
||||
$karat = Lelkarat::where('lelong_id', $pengesahan->lelong_id)->get();
|
||||
$karat = Lelkarat::where('lelong_id', $id)->get();
|
||||
|
||||
foreach($marhuns as $index1=>$marhun)
|
||||
{
|
||||
{
|
||||
$status = Pengesahan::where('id', $pengesahan_id)
|
||||
->where('lelongbid_id', $marhun['lelongbid_id'])
|
||||
->select('status_ubah')
|
||||
->value('status_ubah');
|
||||
|
||||
$gadaimarhun = GadaiMarhun::where('marhun', $marhun['marhun'])
|
||||
->where('norujukan', $lelongbid->norujukan)
|
||||
->first();
|
||||
@@ -300,23 +321,16 @@ class MarhunController extends Controller
|
||||
|
||||
$total = $karat->harga * $gadaimarhun->berat;
|
||||
$hargaasas = round($total);
|
||||
// if($gadaimarhun->karat == $marhun['karat'])
|
||||
// {
|
||||
// $status = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $status = 1;
|
||||
// }
|
||||
|
||||
$marhuns[$index1]['old_marhun'] = $gadaimarhun->marhun;
|
||||
$marhuns[$index1]['old_karat'] = $gadaimarhun->karat;
|
||||
// $marhun[$index1]['status_perubahan'] = $status;
|
||||
$marhuns[$index1]['old_berat'] = $gadaimarhun->berat;
|
||||
$marhuns[$index1]['old_harga'] = $karat->harga;
|
||||
$marhuns[$index1]['old_nilaimarhun'] = $total;
|
||||
$marhuns[$index1]['old_hargaasas'] = $hargaasas;
|
||||
$marhuns[$index1]['status_ubah'] = $status;
|
||||
}
|
||||
return view('pengesahan.mutumarhun', compact('marhuns', 'lelongbid', 'pengesahan_id', 'norujukan'));
|
||||
return view('pengesahan.mutumarhun', compact('marhuns', 'lelongbid', 'pengesahan_id', 'norujukan', 'id'));
|
||||
}
|
||||
|
||||
public function terimaperubahan(Request $request)
|
||||
@@ -362,26 +376,28 @@ class MarhunController extends Controller
|
||||
return redirect()->route('pengesahan.perubahanmutumarhun')->with('success','Pengesahan Mutu Marhun Berjaya');
|
||||
}
|
||||
|
||||
public function submitdelete($id){
|
||||
public function submitdelete($id, $lelong_id){
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
|
||||
$marhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid_id','=',$id)
|
||||
->get();
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->first();
|
||||
|
||||
$pengesahan = new Pengesahan;
|
||||
$pengesahan->lelong_id = $marhun->lelong_id;
|
||||
$pengesahan->lelongbid = $id;
|
||||
$pengesahan->lelong_id = $lelong_id;
|
||||
$pengesahan->lelongbid_id = $id;
|
||||
$pengesahan->norujukan = $marhun->norujukan;
|
||||
$pengesahan->diminta_oleh = $user->id;
|
||||
$pengesahan->diminta_pada = $currentdate;
|
||||
$pengesahan->status_ubah = 3;
|
||||
$pengesahan->save();
|
||||
|
||||
return redirect()->route('pengesahan.pcdelete',$lelongbid->id)
|
||||
return redirect()->route('pengesahan.pcdelete',[$id, $lelong_id])
|
||||
->with('success','Permohonan Pengesahan Padam Marhun Telah Berjaya Dihantar');
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user