From 6ae5062c2266b0443e6dc1cfb5a7d70e2a905c40 Mon Sep 17 00:00:00 2001 From: Azfar Arsyad <45238748+Arpax17@users.noreply.github.com> Date: Wed, 22 Dec 2021 16:14:00 +0800 Subject: [PATCH] update --- app/Http/Controllers/LelongController.php | 6 + app/Http/Controllers/MarhunController.php | 34 ++++- ...21_12_14_041545_create_simulasis_table.php | 6 + ...2021_12_14_041557_create_lelongs_table.php | 9 ++ .../views/lelong/senarailelong.blade.php | 1 + .../views/marhun/kemaskinimarhun.blade.php | 127 ++++++++++++++++++ resources/views/marhun/marhun.blade.php | 95 ++++++++++++- .../views/marhun/semakanmarhun.blade.php | 118 ++++++++++++++++ routes/web.php | 19 ++- 9 files changed, 402 insertions(+), 13 deletions(-) create mode 100644 resources/views/marhun/kemaskinimarhun.blade.php create mode 100644 resources/views/marhun/semakanmarhun.blade.php diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 195b8e7c..7eb974c3 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -326,6 +326,12 @@ class LelongController extends Controller return redirect()->route('lelong.senarailelong') ->with('success','Lelongan bermula'); } + + public function refresh() + { + return redirect()->route('lelong.senarailelong') + ->with('success','Kemaskini Berjaya'); + } } \ No newline at end of file diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index 4ddf9d19..ba3cbac6 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -39,19 +39,49 @@ class MarhunController extends Controller public function index() { $user = Auth::user(); - + $lelong = Lelong::join('cawangan_lelong','cawangan_lelong.lelong_id','=','lelong.id') + ->join('cawangan','cawangan.id','=','cawangan_lelong.caw_id') + ->where('cawangan.caw_code','=',$user->kodcaw)->get(); + dd($lelong->all()); $caw = Cawangan::where('caw_code','=',$user->kodcaw)->first(); $lelongbid = LelongBid::where('caw_id','=',$caw->id)->get(); return view('marhun.senaraimarhun',compact('lelongbid')); } + + public function kemaskini(Request $request) + { + dd($request->all()); + + + $marhun = LelongBidMarhun::where('lelongbid_id','=',$request->idmarhun)->first(); + $lelongbid = LelongBid::where('id','=',$marhun->lelong_bid)->first(); + $caw = CawanganLelong::where('id','=',$lelongbid->caw_id)-first(); + $lelong = Lelong::where('id','=',$caw->caw_id)->first(); + + $simkarat = SimKarat::where('simulasi_id','=',$simulasi->id)->get(); + $marhun->marhun = $request->marhun; + $marhun->karat = $request->karat; + $marhun->berat = $request->berat; + $marhun->harga = $request->harga; + $marhun->n_marhun = $request->n_marhun; + $marhun->hargaasas = $request->hargaasas; + $marhun->save(); + + return redirect()->route('marhun.senaraimarhun') + ->with('success','Kemaskini Marhun Berjaya'); + } + public function show($id) { $lelongbid = LelongBid::where('id','=',$id)->first(); $marhun = LelongBidMarhun::where('lelongbid_id','=',$id)->get(); - return view('marhun.marhun',compact('marhun','lelongbid')); + $karatall = JenisKarat::all(); + $emasall = JenisEmas::all(); + + return view('marhun.marhun',compact('marhun','lelongbid','karatall','emasall')); } } diff --git a/database/migrations/2021_12_14_041545_create_simulasis_table.php b/database/migrations/2021_12_14_041545_create_simulasis_table.php index f3de9a9f..1c000fb0 100644 --- a/database/migrations/2021_12_14_041545_create_simulasis_table.php +++ b/database/migrations/2021_12_14_041545_create_simulasis_table.php @@ -17,6 +17,7 @@ class CreateSimulasisTable extends Migration $table->bigIncrements('id'); $table->string('tarikh_lelong'); $table->time('masatamat_lelong')->nullable(); + $table->dateTime('masakemaskini_data')->nullable(); $table->string('kali')->nullable(); $table->string('harga_emas_asas'); $table->string('jbg'); @@ -47,6 +48,7 @@ class CreateSimulasisTable extends Migration Schema::create('simulasibid', function (Blueprint $table) { $table->bigIncrements('id'); + $table->unsignedBigInteger('simulasi_id')->unsigned(); $table->unsignedBigInteger('caw_id')->unsigned(); $table->string('kodcaw'); $table->string('norujukan'); @@ -78,6 +80,10 @@ class CreateSimulasisTable extends Migration $table->foreign('caw_id') ->references('id')->on('cawangan') ->onDelete('cascade'); + + $table->foreign('simulasi_id') + ->references('id')->on('simulasi') + ->onDelete('cascade'); }); Schema::create('simulasibidmarhun', function (Blueprint $table) { diff --git a/database/migrations/2021_12_14_041557_create_lelongs_table.php b/database/migrations/2021_12_14_041557_create_lelongs_table.php index 8a31b48c..65e50f3b 100644 --- a/database/migrations/2021_12_14_041557_create_lelongs_table.php +++ b/database/migrations/2021_12_14_041557_create_lelongs_table.php @@ -16,7 +16,9 @@ class CreateLelongsTable extends Migration Schema::create('lelong', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('tarikh_lelong'); + $table->time('masamula_lelong')->nullable(); $table->time('masatamat_lelong')->nullable(); + $table->dateTime('masakemaskini_data')->nullable(); $table->string('kali')->nullable(); $table->string('harga_emas_asas'); $table->string('jbg'); @@ -47,6 +49,7 @@ class CreateLelongsTable extends Migration Schema::create('lelongbid', function (Blueprint $table) { $table->bigIncrements('id'); + $table->unsignedBigInteger('lelong_id')->unsigned(); $table->unsignedBigInteger('caw_id')->unsigned(); $table->string('kodcaw'); $table->string('norujukan'); @@ -72,12 +75,17 @@ class CreateLelongsTable extends Migration $table->decimal('percent', $precision = 7, $scale = 2); $table->string('status_jual'); $table->string('status_payment'); + $table->integer('status_semak')->default(0); $table->string('mora_upah'); $table->timestamps(); $table->foreign('caw_id') ->references('id')->on('cawangan') ->onDelete('cascade'); + + $table->foreign('lelong_id') + ->references('id')->on('lelong') + ->onDelete('cascade'); }); Schema::create('lelongbidmarhun', function (Blueprint $table) { @@ -91,6 +99,7 @@ class CreateLelongsTable extends Migration $table->decimal('harga', $precision = 5, $scale = 2); $table->decimal('n_marhun', $precision = 9, $scale = 2); $table->decimal('hargaasas', $precision = 11, $scale = 2); + $table->integer('status_semak')->default(0); $table->timestamps(); $table->foreign('lelongbid_id') diff --git a/resources/views/lelong/senarailelong.blade.php b/resources/views/lelong/senarailelong.blade.php index 0209fc14..1bee7d00 100644 --- a/resources/views/lelong/senarailelong.blade.php +++ b/resources/views/lelong/senarailelong.blade.php @@ -35,6 +35,7 @@
{{ $message }}
+{{ $message }}
+