This commit is contained in:
Azfar Arsyad
2021-12-22 16:14:00 +08:00
parent d95346c2dd
commit 6ae5062c22
9 changed files with 402 additions and 13 deletions
@@ -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');
}
}
+32 -2
View File
@@ -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'));
}
}
@@ -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) {
@@ -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')
@@ -35,6 +35,7 @@
<td>{{ $lel->jbg }}</td>
<td>{{ $lel->cajlelong }}</td>
<td class="text-center">
<a href="{{ route('lelong.refresh') }}"><i class="fas fa-sync-alt"></i></a>
<a href="{{ route('lelong.show',$lel->id) }}"><i class="far fa-edit"></i></a>
<a class="confirmdel" href="{{ route('lelong.delete',$lel->id) }}"><i class="far fa-trash-alt"></i></a>
@if(!$lel->masatamat_lelong)
@@ -0,0 +1,127 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col-md-11 mx-auto card p-4">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<form id="exportform" action="" method="POST">
<input type="hidden" name="type" value="User">
<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>Marhun</th>
<th>Nota</th>
<th>Karat</th>
<th>Berat</th>
<th>Harga</th>
<th>Nilai Marhun</th>
<th>Harga Asas</th>
</tr>
</thead>
<tbody>
<tr>
{{-- <td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $marhun->id }}"></td> --}}
<td>{{ $lelongbid->norujukan }}</td>
<td>{{ $marhun->marhun }}</td>
<td>{{ $marhun->nota }}</td>
<td>{{ $marhun->karat }}</td>
<td>{{ $marhun->berat }}</td>
<td>{{ $marhun->harga }}</td>
<td>{{ $marhun->n_marhun }}</td>
<td>{{ $marhun->hargaasas }}</td>
</tr>
</tbody>
</table>
</form>
<div class="row pl-3">
<button class="btn btn-primary">Simpan</button>
</div>
</div>
</div>
</div>
<script>
$('a.confirmdel').confirm({
title: 'Confirmation',
content: 'Anda pasti?',
type: 'orange',
typeAnimated: true,
buttons: {
Delete: {
btnClass: 'btn-warning',
action: function () {
location.href = this.$target.attr('href');
}
},
Batal: {
btnClass: 'btn-default',
action: function () {}
}
}
});
var tablemarhun = $('#marhun').DataTable( {
"columnDefs": [
{
"targets": 0,
"orderable": false
},
{
"targets": 5,
"orderable": false
}
],
order: [[1, 'asc']],
// "ordering": false,
"searching": false,
"paging": false,
"info": false,
"lengthChange": false,
"pageLength": 15,
dom: 'Bfrtip',
// buttons: [
// // 'copy', 'excel', 'pdf'
// // { text: 'copy', className: 'btn btn-primary' },
// {
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm addsim',
// text: '<i class="fas fa-plus" id="test"></i>',
// titleAttr: 'Tambah Marhun',
// action: function ( e, dt, node, config ) {
// alert( 'Button activated' );
// }
// },
// {
// className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
// titleAttr: 'Export to CSV',
// text: '<i class="fas fa-download"></i>',
// action: function ( e, dt, node, config ) {
// $("#exportform").submit();
// }
// }
// ]
});
$('.addsim').tooltip();
$('.export').tooltip();
// $( '.dt-buttons').addClass('btn-group');
$( '.addsim').removeClass('dt-button');
$( '.export').removeClass('dt-button');
function selectall(cb) {
tablemarhun.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
$(this).prop('checked', cb.checked);
})
}
</script>
@endsection
+91 -4
View File
@@ -18,12 +18,12 @@
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
<th>No. Rujukan</th>
<th>Marhun</th>
<th>Nota</th>
<th>Karat</th>
<th>Berat</th>
<th>Harga</th>
<th>Harga(RM)</th>
<th>Nilai Marhun</th>
<th>Harga Asas</th>
<th>Nota</th>
<th class="text-center">Action</th>
</tr>
</thead>
@@ -34,14 +34,14 @@
<td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $item->id }}"></td>
<td>{{ $lelongbid->norujukan }}</td>
<td>{{ $item->marhun }}</td>
<td>{{ $item->nota }}</td>
<td>{{ $item->karat }}</td>
<td>{{ $item->berat }}</td>
<td>{{ $item->harga }}</td>
<td>{{ $item->n_marhun }}</td>
<td>{{ $item->hargaasas }}</td>
<td>{{ $item->nota }}</td>
<td class="text-center">
<a href="{{ route('marhun.show',$item->id) }}"><i class="far fa-edit"></i></a>
<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 }}"><i class="far fa-edit"></i></a>
<a class="confirmdel" href="{{ route('marhun.delete',$item->id) }}"><i class="far fa-trash-alt"></i></a>
</td>
</tr>
@@ -53,6 +53,64 @@
</div>
</div>
<div class="modal fade" tabindex="-1" id="modalkemaskini">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Kemaskini Marhun</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('marhun.kemaskini') }}" method="POST" id="formkemaskini">
@csrf
<div class="row justify-content-center">
<div class="col-md-8">
<div class="form-group row">
<input type="hidden" name="idmarhun" id="idmarhun" >
<div class="col-md-4">No Rujukan</div>
<div class="col-md-8"><input class="form-control" type="text" name="norujukan_marhun" id="norujukan_marhun" value="{{ $lelongbid->norujukan }}" readonly></div>
<div class="col-md-4">Marhun</div>
<div class="col-md-8">
<select class="form-control" name="marhun" id="selectmarhun">
<option disabled selected value> -- Pilih Jenis Marhun -- </option>
@foreach ($emasall as $emas)
<option value="{{$emas->marhun}}"> {{ $emas->descpt}}</option>
@endforeach
</select>
</div>
<div class="col-md-4">Karat</div>
<div class="col-md-8">
<select class="form-control" name="karat" id="selectkarat">
<option disabled selected value> -- Pilih Karat -- </option>
@foreach ($karatall as $karat)
<option value="{{$karat->karat}}"> {{ $karat->keterangan}}</option>
@endforeach
</select>
</div>
<div class="col-md-4">Berat</div>
<div class="col-md-8"><input class="form-control" type="text" name="berat_emas" id="berat_emas"></div>
<div class="col-md-4">Harga</div>
<div class="col-md-8"><input class="form-control .harga" type="text" name="harga" id="harga" readonly></div>
<div class="col-md-4">Nilai Marhun</div>
<div class="col-md-8"><input class="form-control" type="text" name="nilai_marhun" id="nilai_marhun" readonly></div>
<div class="col-md-4">Harga Asas</div>
<div class="col-md-8"><input class="form-control" type="text" name="harga_asas" id="harga_asas" readonly></div>
<div class="col-md-4">Nota</div>
<div class="col-md-8"><input class="form-control" type="text" name="nota" id="nota" readonly></div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="button" class="btn btn-primary" onclick="updateform()">Simpan</button>
</div>
</div>
</div>
</div>
</div>
<script>
$('a.confirmdel').confirm({
@@ -125,6 +183,35 @@
$(this).prop('checked', cb.checked);
})
}
function kemaskini(e) {
$('#modalkemaskini').modal("show");
$('#modalkemaskini').on('shown.bs.modal', function () {
$('#rolename').trigger('focus')
})
let idmarhun = $(e).data('idmarhun');
let marhun = $(e).data('marhun');
let karat = $(e).data('karat');
let berat = $(e).data('berat');
let harga = $(e).data('harga');
let nmarhun = $(e).data('nmarhun');
let hargaasas = $(e).data('hargaasas');
let nota = $(e).data('nota');
$('#idmarhun').val(idmarhun);
$('#selectmarhun').val(marhun);
$('#selectkarat').val(karat);
$('#berat_emas').val(berat);
$('#harga').val(harga);
$('#nilai_marhun').val(nmarhun);
$('#harga_asas').val(hargaasas);
$('#nota').val(nota);
}
function updateform()
{
$("#formkemaskini").submit();
}
</script>
@endsection
@@ -0,0 +1,118 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col-md-11 mx-auto card p-4">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<form id="exportform" action="" method="POST">
<input type="hidden" name="type" value="User">
<table class="table table-striped table-xl" id="senaraimarhun" 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>Nombor Rujukan</th>
<th>Tarikh Lelong</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@foreach ($lelongbid as $bid)
<tr>
<td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $bid->id }}"></td>
<td>{{ $bid->norujukan }}</td>
<td>{{ $bid->t_lelong }}</td>
<td class="text-center">
<a href="{{ route('marhun.show',$bid->id) }}"><i class="far fa-edit"></i></a>
{{-- <a class="confirmdel" href="{{ route('marhun.delete',$bid->id) }}"><i class="far fa-trash-alt"></i></a> --}}
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
</div>
<script>
$('a.confirmdel').confirm({
title: 'Confirmation',
content: 'Anda pasti?',
type: 'orange',
typeAnimated: true,
buttons: {
Delete: {
btnClass: 'btn-warning',
action: function () {
location.href = this.$target.attr('href');
}
},
Batal: {
btnClass: 'btn-default',
action: function () {}
}
}
});
var tablemarhun = $('#senaraimarhun').DataTable( {
"columnDefs": [
{
"targets": 0,
"orderable": false
},
{
"targets": 5,
"orderable": false
}
],
order: [[1, 'asc']],
// "ordering": false,
"info": false,
"lengthChange": false,
"pageLength": 15,
dom: 'Bfrtip',
buttons: [
// 'copy', 'excel', 'pdf'
// { text: 'copy', className: 'btn btn-primary' },
// {
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm addsim',
// text: '<i class="fas fa-plus" id="test"></i>',
// titleAttr: 'Tambah Marhun',
// action: function ( e, dt, node, config ) {
// alert( 'Button activated' );
// }
// },
{
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
titleAttr: 'Export to CSV',
text: '<i class="fas fa-download"></i>',
action: function ( e, dt, node, config ) {
$("#exportform").submit();
}
}
]
});
$('.addsim').tooltip();
$('.export').tooltip();
// $( '.dt-buttons').addClass('btn-group');
$( '.addsim').removeClass('dt-button');
$( '.export').removeClass('dt-button');
function selectall(cb) {
tablemarhun.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
$(this).prop('checked', cb.checked);
})
}
</script>
@endsection
+12 -7
View File
@@ -64,20 +64,21 @@ Route::group(['middleware' => ['permission:sistem'],'prefix'=>'sistem'], functio
Route::post('/export',['as'=>'sistem.export','uses'=>'DatabaseController@export']);
});
Route::group(['middleware' => ['permission:pendaftaranbatch','permission:lelongan'],'prefix'=>'lelong'], function () {
Route::group(['middleware' => ['permission:pendaftaranbatch'],'prefix'=>'lelong'], function () {
Route::get('/create/{id}',['as'=>'lelong.create','uses'=>'LelongController@create']);
Route::get('/senarailelong',['as'=>'lelong.senarailelong','uses'=>'LelongController@index']);
Route::get('/showlelong/{id}',['as'=>'lelong.show','uses'=>'LelongController@show']);
Route::get('/deletelelong/{id}',['as'=>'lelong.delete','uses'=>'LelongController@delete']);
Route::get('/refresh',['as'=>'lelong.refresh','uses'=>'LelongController@refresh']);
Route::get('/lelongstart/{id}',['as'=>'lelong.start','uses'=>'LelongController@start']);
// Route::get('/lelongstart/{id}',['as'=>'lelong.start','uses'=>'LelongController@start']);
});
Route::group(['middleware' => ['permission:pendaftaranbatch','permission:lelongan'],'prefix'=>'lelong'], function () {
Route::get('/create/{id}',['as'=>'lelong.create','uses'=>'LelongController@create']);
Route::get('/senarailelong',['as'=>'lelong.senarailelong','uses'=>'LelongController@index']);
Route::get('/showlelong/{id}',['as'=>'lelong.show','uses'=>'LelongController@show']);
Route::get('/deletelelong/{id}',['as'=>'lelong.delete','uses'=>'LelongController@delete']);
Route::group(['middleware' => ['permission:lelongan'],'prefix'=>'lelong'], function () {
// Route::get('/create/{id}',['as'=>'lelong.create','uses'=>'LelongController@create']);
// Route::get('/senarailelong',['as'=>'lelong.senarailelong','uses'=>'LelongController@index']);
// Route::get('/showlelong/{id}',['as'=>'lelong.show','uses'=>'LelongController@show']);
// Route::get('/deletelelong/{id}',['as'=>'lelong.delete','uses'=>'LelongController@delete']);
Route::get('/lelongstart/{id}',['as'=>'lelong.start','uses'=>'LelongController@start']);
});
@@ -86,4 +87,8 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim
Route::get('/senaraimarhun',['as'=>'marhun.senaraimarhun','uses'=>'MarhunController@index']);
Route::get('/marhun/{id}',['as'=>'marhun.show','uses'=>'MarhunController@show']);
Route::get('/deletemarhun/{id}',['as'=>'marhun.delete','uses'=>'MarhunController@delete']);
Route::post('/kemaskini',['as'=>'marhun.kemaskini','uses'=>'MarhunController@kemaskini']);
Route::get('/semakan',['as'=>'marhun.semakan','uses'=>'MarhunController@semakan']);
});