tangguh lelong
edit add delete siappppp
This commit is contained in:
@@ -32,9 +32,6 @@ use App\Models\LelKarat_temp;
|
||||
use App\Models\Resit;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
|
||||
|
||||
class LelongController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -349,9 +346,10 @@ class LelongController extends Controller
|
||||
public function delete($id)
|
||||
{
|
||||
$lelong = Lelong::where('id','=',$id)->first();
|
||||
|
||||
// dd($role);
|
||||
$lelong->delete();
|
||||
|
||||
// $gadai = Gadai::
|
||||
return redirect()->route('lelong.senarailelong')
|
||||
->with('success','Padam Lelong Berjaya');
|
||||
}
|
||||
|
||||
@@ -347,7 +347,6 @@ class MarhunController extends Controller
|
||||
$pengesahan->disahkan_oleh = $user->id;
|
||||
$pengesahan->disahkan_pada = $currentdate;
|
||||
$pengesahan->update();
|
||||
// dd($pengesahan);
|
||||
|
||||
$gadaimarhun = GadaiMarhun::where('norujukan', $pengesahan->norujukan)->delete();
|
||||
$lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $pengesahan->lelongbid_id)->get();
|
||||
@@ -401,61 +400,93 @@ class MarhunController extends Controller
|
||||
$tangguhlelong->nota = 'Ditangguh Kerana Perubahan Mutu/Karat Marhun';
|
||||
$tangguhlelong->save();
|
||||
|
||||
$lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $pengesahan->lelongbid_id)->delete();
|
||||
// $lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $pengesahan->lelongbid_id)->delete();
|
||||
}
|
||||
|
||||
$this->pcdelete($request->pengesahan_id);
|
||||
$this->pcdelete($request->pengesahan_id, $pengesahan->lelongbid_id);
|
||||
|
||||
// $lelongbidmarhunlast = LelongBidMarhun::where('lelongbid_id', $pengesahan->lelongbid_id)->get();
|
||||
|
||||
// $pengesahanlast = Pengesahan::join('lelongbidmarhun', 'pengesahan.lelongbid_id', '=', 'lelongbidmarhun.lelongbid_id')
|
||||
// ->where('lelongbidmarhun.id', $lelongbidmarhunlast->id)
|
||||
// ->where('lelongbid_id', $pengesahan->lelongbid_id)
|
||||
// ->where('pengesahan.id', $request->pengesahan_id)
|
||||
// ->first();
|
||||
|
||||
// $marhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
// ->where('lelongbid_id','=', $pengesahan->lelongbid_id)
|
||||
// ->get();
|
||||
|
||||
// $lelongbid = LelongBid::where('lelongbid_id', $lelongbidmarhunlast->lelongbid_id)->first();
|
||||
// $txtmarhun = ",1 " . $lelongbidmarhunlast->marhun ;
|
||||
// $lelongbid->marhun = str_replace( $txtmarhun,"",$lelongbid->marhun);
|
||||
// $lelongbid->berat = $lelongbid->berat - $lelongbidmarhunlast->berat_emastambahan;
|
||||
// $lelongbid->hargaasas = $lelongbid->hargaasas - $lelongbidmarhunlast->harga_asastambahan;
|
||||
// $lelongbid->save();
|
||||
|
||||
return redirect()->route('pengesahan.senarailelongubahmutu')->with('success','Pengesahan Mutu Marhun Berjaya');
|
||||
}
|
||||
|
||||
public function submitdeletes($id, $lelong_id){
|
||||
public function submitdelete(Request $request){
|
||||
|
||||
// dd($request->all());
|
||||
$user = Auth::user();
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
|
||||
$marhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid_id','=',$id)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbidmarhun.id','=',$request->lelongbidmarhun_id)
|
||||
->where('lelongbid.id', $request->lelongbid_id)
|
||||
->first();
|
||||
|
||||
$id = $request->lelongbid_id;
|
||||
$lelong_id = $marhun->lelong_id;
|
||||
|
||||
$pengesahan = new Pengesahan;
|
||||
$pengesahan->lelong_id = $lelong_id;
|
||||
$pengesahan->lelongbid_id = $id;
|
||||
$pengesahan->lelongbidmarhun_id = $marhun->lelongbidmarhun_id;
|
||||
$pengesahan->lelong_id = $marhun->lelong_id;
|
||||
$pengesahan->lelongbid_id = $request->lelongbid_id;
|
||||
$pengesahan->lelongbidmarhun_id = $request->lelongbidmarhun_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',[$id, $lelong_id])
|
||||
return redirect()->route('marhun.show', compact('id', 'lelong_id'))
|
||||
->with('success','Permohonan Pengesahan Padam Marhun Telah Berjaya Dihantar');
|
||||
|
||||
}
|
||||
|
||||
public function pcdelete($id)
|
||||
public function pcdelete($id, $lelongbid_id)
|
||||
{
|
||||
$lelongbidmarhun = LelongBidMarhun::where('id', $id)->first();
|
||||
|
||||
//save in table pengesahan first
|
||||
$lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $lelongbid_id)->first();
|
||||
|
||||
$pengesahan = Pengesahan::join('lelongbidmarhun', 'pengesahan.lelongbid_id', '=', 'lelongbidmarhun.lelongbid_id')
|
||||
->where('lelongbidmarhun.id', $id)
|
||||
->where('lelongbid_id', $lelongbid_id)
|
||||
->where('pengesahan.lelongbidmarhun_id', $lelongbidmarhun->id)
|
||||
->where('pengesahan.lelongbid_id', $lelongbid_id)
|
||||
->select('pengesahan.id as pengesahan_id')
|
||||
->first();
|
||||
|
||||
$lelongbid = LelongBid::where('id', $lelongbidmarhun->lelongbid_id)->first();
|
||||
// dd($lelongbid);
|
||||
if($pengesahan != null)
|
||||
{
|
||||
$lelongbidmarhun->delete();
|
||||
}
|
||||
|
||||
$marhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid_id','=',$lelongbid_id)
|
||||
->get();
|
||||
|
||||
$lelongbid = LelongBid::where('id', $lelongbid_id)->first();
|
||||
$txtmarhun = ",1 " . $lelongbidmarhun->marhun ;
|
||||
$lelongbid->marhun = str_replace( $txtmarhun,"",$lelongbid->marhun);
|
||||
// $lelongbid->marhun = $lelongbid->marhun ."1 " . $request->marhuntambahan . "," ;
|
||||
$lelongbid->berat = $lelongbid->berat - $lelongbidmarhun->berat_emastambahan;
|
||||
$lelongbid->hargaasas = $lelongbid->hargaasas - $lelongbidmarhun->harga_asastambahan;
|
||||
$lelongbid->save();
|
||||
|
||||
$marhundelete = LelongBidMarhun::where('lelongbid_id', $pengesahan->lelongbid_id)->delete();
|
||||
|
||||
// return redirect()->route('pengesahan.perubahanmutumarhun')
|
||||
// ->with('success','Pengesahan Padam Marhun Telah Berjaya');
|
||||
}
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
@endif
|
||||
<form id="exportform" method="POST">
|
||||
<form id="formdelete" action="{{ route('marhun.submitdelete') }}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="type" value="User">
|
||||
<input type="hidden" name="lelongbid" value="{{ $lelongbid->id }}">
|
||||
<input type="hidden" name="lelongbidmarhun_id" id="lelongbidmarhun_id">
|
||||
<input type="hidden" name="lelongbid_id" id="lelongbid_id">
|
||||
<table class="table table-striped table-xl" id="marhun" style="width:100%">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
@@ -44,7 +45,7 @@
|
||||
<td>{{ $item->nota }}</td>
|
||||
<td class="text-center">
|
||||
<a onclick="kemaskini(this)" data-idmarhun="{{ $item->id }}" data-marhun="{{ $item->marhun }}" data-karat="{{ $item->karat }}" data-berat="{{ $item->berat }}" data-harga="{{ $item->harga }}" data-nmarhun="{{ $item->n_marhun }}" data-hargaasas="{{ $item->hargaasas }}" data-nota="{{ $item->nota }}" data-toggle="tooltip" data-placement="top" title="Kemaskini Marhun" style="margin-right:30px"><i class="far fa-edit"></i></a>
|
||||
<a class="confirmdel" href="{{ route('marhun.submitdelete',[$item->id, $lelong_id]) }}" data-toggle="tooltip" data-placement="top" title="Padam Marhun"><i class="far fa-trash-alt"></i></a>
|
||||
<a class="confirmdel" id="btndelete" data-lelongbidmarhun="{{ $item->id }}" data-lelongbid="{{ $item->lelongbid_id }}" data-toggle="tooltip" data-placement="top" title="Padam Marhun"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -192,8 +193,14 @@
|
||||
buttons: {
|
||||
Delete: {
|
||||
btnClass: 'btn-warning',
|
||||
action: function () {
|
||||
location.href = this.$target.attr('href');
|
||||
action: function (e) {
|
||||
// location.href = this.$target.attr('href');
|
||||
let lelongbidmarhun = $(this)[0].$target[0].dataset.lelongbidmarhun;
|
||||
let lelongbid = $(this)[0].$target[0].dataset.lelongbid;
|
||||
$('#lelongbid_id').val(lelongbid);
|
||||
$('#lelongbidmarhun_id').val(lelongbidmarhun);
|
||||
$("#formdelete").submit();
|
||||
|
||||
}
|
||||
},
|
||||
Batal: {
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim
|
||||
Route::get('/senarailelongmarhun',['as'=>'marhun.senarailelongmarhun','uses'=>'MarhunController@senarailelongmarhun']);
|
||||
Route::get('/senaraimarhun/{lelong_id}',['as'=>'marhun.senaraimarhun','uses'=>'MarhunController@index']);
|
||||
Route::get('/marhun/{id}/{lelong_id}',['as'=>'marhun.show','uses'=>'MarhunController@show']);
|
||||
Route::post('/submitdelete/{id}/{lelong_id}',['as'=>'marhun.submitdelete','uses'=>'MarhunController@submitdelete']);
|
||||
Route::post('/submitdelete',['as'=>'marhun.submitdelete','uses'=>'MarhunController@submitdelete']);
|
||||
|
||||
Route::post('/kemaskini',['as'=>'marhun.kemaskini','uses'=>'MarhunController@kemaskini']);
|
||||
Route::get('/semakan',['as'=>'marhun.semakan','uses'=>'MarhunController@semakan']);
|
||||
|
||||
Reference in New Issue
Block a user