Merge branch 'faiqahzaman' of https://gitlab.com/azfararsyad/lelong into faiqahzaman

This commit is contained in:
faiqahzaman
2022-03-10 16:34:47 +08:00
11 changed files with 244 additions and 89 deletions
+2 -2
View File
@@ -163,7 +163,7 @@ class ApiController extends Controller
Money::MYR($total_bayaran),
route('pay.callback'),
'Bayaran Borang',
['redirect_url' => 'http://192.168.88:8003/api/pembayaran/response']
['redirect_url' => 'http://192.168.85:8003/api/pembayaran/response']
);
// dd($response);
$previous_siri = Resit::orderBy('id','desc')->first();
@@ -341,7 +341,7 @@ class ApiController extends Controller
Money::MYR($total_bayaran),
route('pay.bidcallback'),
'Bayaran Bidaan',
['redirect_url' => 'http://192.168.88:8003/api/pembayaran/bidresponse']
['redirect_url' => 'http://192.168.85:8003/api/pembayaran/bidresponse']
);
// dd($response);
$previous_siri = Resit::orderBy('id','desc')->first();
+19
View File
@@ -76,6 +76,25 @@ class CartController extends Controller
}
}
public function removeFromCart(Request $request)
{
$item = Cart::where('id',$request->cart_id)->first();
if($item->delete())
{
return response()->json([
'success' => true,
'carts' => $item
]);
}
else
{
return response()->json([
'success' => false,
'message' => 'Error! Cannot save.',
], 401);
}
}
public function updateItem (Request $request)
{
$cart = Cart::where('id','=',$request->id)->first();
+53 -22
View File
@@ -138,30 +138,9 @@ class MarhunController extends Controller
// dd($lelkarat);
return view('marhun.marhun',compact('marhun','lelongbid','karatall','emasall','lelkarat'));
}
public function exportmarhundetails(Request $request)
{
$lelongbid = LelongBid::where('id','=',$request->lelongbid)->first();
$marhun = LelongBidMarhun::where('lelongbid_id','=',$request->lelongbid)->get();
$karatall = JenisKarat::all();
$emasall = JenisEmas::all();
$pdf = PDF::loadView('pdf.marhundetails',compact('marhun',
'lelongbid',
'karatall',
'emasall'))->setPaper('a4', 'landscape');
return $pdf->download('Senarai Lelong Details.pdf');
}
public function senarailelongmarhun(Request $request)
{
public function senarailelongmarhun(Request $request){
$user = Auth::user();
@@ -217,6 +196,58 @@ class MarhunController extends Controller
}
//Operasi
public function exportmarhundetails($lelong_id)
{
$lelongs= LelongBid::where('lelong_id','=',$lelong_id)->get()->toArray();
$arraycaw= [];
$total_berat = 0;
$berat = 0;
$total_harga = 0;
$harga = 0;
$total_nmarhun = 0;
$nilai_marhun = 0;
$total_hargaasas = 0;
$hargaasas = 0;
foreach($lelongs as $index1=>$lelong){
$marhun= LelongBidMarhun::where('lelongbid_id','=',$lelong['id'])->get();
$total_berat = $total_berat + ($marhun->sum('berat'));
$total_harga = $total_harga + ($marhun->sum('harga'));
$total_nmarhun = $total_nmarhun + ($marhun->sum('n_marhun'));
$total_hargaasas = $total_hargaasas + ($marhun->sum('hargaasas'));
$lelongs[$index1]['detailmarhun']=$marhun;
}
array_push($arraycaw,[
'berat'=>$berat,
'harga'=>$harga,
'n_marhun'=>$nilai_marhun,
'hargaasas'=>$hargaasas
]);
$pdf = PDF::loadView('pdf.marhundetails',compact('lelongs','arraycaw','total_nmarhun','total_berat','total_harga','total_hargaasas'
))->setPaper('a4', 'potrait');
return $pdf->download('Senarai Marhun.pdf');
}
public function sahubahmutu(Request $request)
{
// dd($request->all());
@@ -646,6 +646,20 @@ class SimulasiController extends Controller
}
array_push($arraycaw,[
'cawangan'=>$cawangan->caw_name,
't_lelong'=>$simulasi->tarikh_lelong,
'bil_marhun'=>sizeof($databid),
'berat'=>$berat,
'n_marhun'=>$nilai_marhun,
'pinjaman'=>$pinjaman,
'upah'=>0,
'hargaasas'=>$hargaasas,
'cajlelong'=>$cajlelong,
'rugilelong'=>$rugilelong,
'bakilelong'=>$bakilelong,
]);
$total_marhun = $total_marhun + sizeof($databid);
@@ -17,7 +17,6 @@ class CreateFileTable extends Migration
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->string('file_type');
$table->binary('filename');
$table->datetime('deleted_at')->nullable();
$table->integer('deleted_by')->nullable();
$table->timestamps();
@@ -26,6 +25,9 @@ class CreateFileTable extends Migration
->references('id')->on('users')
->onDelete('cascade');
});
// once the table is created use a raw query to ALTER it and add the MEDIUMBLOB
DB::statement("ALTER TABLE file ADD filename LONGBLOB");
}
/**
@@ -25,7 +25,8 @@
<td>{{$loop->iteration}}</td>
<td>{{ $data->tarikh_lelong }}</td>
<td>{{ $data->sts_lelong }}</td>
<td><a href=" {{ route('marhun.senaraimarhun', ['lelong_id'=>$data['lelong_id']]) }} " data-toggle="tooltip" data-placement="top" title="Senarai Lelong Marhun" ><i class="far fa-edit"></i></a></td>
<td><a href="{{ route('marhun.exportmarhundetails', ['lelong_id'=>$data['lelong_id']]) }}" data-toggle="tooltip" data-placement="top" title="Muat Turun Senarai Marhun" style="margin-right:40px" ><i class="fas fa-download"></i></a>
<a href=" {{ route('marhun.senaraimarhun', ['lelong_id'=>$data['lelong_id']]) }} " data-toggle="tooltip" data-placement="top" title="Senarai Lelong Marhun" ><i class="far fa-edit"></i></a></td>
</tr>
@endforeach
</tbody>
@@ -29,7 +29,7 @@
<td>{{ $bid->norujukan }}</td>
<td>{{ $bid->t_lelong }}</td>
<td class="text-center">
<a href="{{ route('marhun.show',$bid->id) }}" data-toggle="tooltip" data-placement="top" title="Senari Marhun" ><i class="far fa-edit"></i></a>
<a href="{{ route('marhun.show',$bid->id) }}" data-toggle="tooltip" data-placement="top" title="Senarai Marhun" ><i class="far fa-edit"></i></a>
</td>
</tr>
@endforeach
+73 -50
View File
@@ -11,7 +11,7 @@
#sim td {padding:3px 5px 3px 5px; padding-right:10px;}, #sim th {
border: 0px solid;
padding: 1px;
text-align: center;
text-align: left;
}
@@ -20,8 +20,8 @@
#sim tr:hover {}
#sim th {
text-align: center;
border: 1px solid;
text-align: left;
border: 0px solid;
table-layout:auto;
color: black;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
@@ -75,64 +75,87 @@ tr:nth-child(even) {
</tr>
<tr>
<td colspan="2"><u><b>SENARAI BARANG LELONG (DETAILS)</b></u></td>
<td colspan="2"><u><b>LAPORAN SIMULASI SEMUA CAWANGAN</b></u></td>
</tr>
</table>
<br>
<br>
<table cellspacing="0" cellpadding="5" style="float:right;" border="1" width="100%" height="80" align="center" id="sim">
<br><br>
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
<thead>
<tr>
<th width="2%" align="center">No</th>
<th width="9%" align="center">No Rujukan </th>
<th width="6%" align="center">Jenis Marhun</th>
<th width="5%" align="center">Karat</th>
<th width="5%" align="center">Berat(gm)</th>
<th width="9%" align="center">Harga(RM)</th>
<th width="9%" align="center">Nilai Marhun(RM)</th>
<th width="9%" align="center">Harga Asas(RM)</th>
<th width="12%" align="center">Nota</th>
<th width="2%" align="left">No</th>
<th width="12%" align="left">No Rujukan </th>
<th width="10%" align="left">Jenis Marhun</th>
<th width="10%" align="left">Karat</th>
<th width="10%" align="left">Berat(gm)</th>
<th width="12%" align="left">Harga(RM)</th>
<th width="14%" align="left">Nilai Marhun(RM)</th>
<th width="14%" align="left">Harga Asas(RM)</th>
<th width="16%" align="left">Nota</th>
</tr>
</thead>
<tbody>
@foreach ($marhun as $index=>$item)
<tr>
<td>{{$index+1}}</td>
<td>{{ $lelongbid->norujukan }}</td>
<td>{{ $item->marhun }}</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>
</tr>
@endforeach
</tbody>
<@php
@endphp
{{--
@foreach ($lelongs as $marhun)
<tr>
<td colspan="3" align="left"><strong>Jumlah Keseluruhan</strong></td>
<td></td>
<td>{{$total_berat}}</td>
<td>{{$total_harga}}</td>
<td>{{$total_nilaimarhun}}</td>
<td>{{$total_hargaasas}}</td>
<td></td>
</tr> --}}
</table>
<td>{{ $loop->iteration }} </td>
<td>{{ $marhun['norujukan'] }}</td>
<td>@foreach ($marhun['detailmarhun'] as $item)
{{ $item['marhun'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['detailmarhun'] as $item)
{{ $item['karat'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['detailmarhun'] as $item)
{{ $item['berat'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['detailmarhun'] as $item)
{{ $item['harga'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['detailmarhun'] as $item)
{{ $item['n_marhun'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['detailmarhun'] as $item)
{{ $item['hargaasas'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['detailmarhun'] as $item)
{{ $item['nota'] }}<br>
@endforeach</td>
</tr>
<tr>
<td colspan="4" align="left"><strong>Jumlah</strong></td>
<td>{{ number_format($marhun['berat'], 2, '.', ',') }}</td>
<td></td>
<td>{{ number_format($marhun['nilaimarhun'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['hargaasas'], 2, '.', ',') }}</td>
<td></td>
{{-- <td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td> --}}
</tr>
@endforeach
@foreach ($arraycaw as $index=>$caw)
<tr>
<td colspan="4" align="left"><strong>Jumlah Keseluruhan</strong></td>
<td><strong>{{ number_format($total_berat, 2, '.', ',') }}</strong></td>
<td><strong>{{ number_format($total_harga, 2, '.', ',') }}</strong></td>
<td><strong>{{ number_format($total_nmarhun, 2, '.', ',') }}</strong></td>
<td><strong>{{ number_format($total_hargaasas, 2, '.', ',') }}</strong></td>
<td></td>
{{-- <td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td> --}}
</tr>
@endforeach
</table>
</tbody>
+71 -10
View File
@@ -106,7 +106,8 @@ tr:nth-child(even) {
<br>
<br>
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
<thead>
<tr>
<th width="2%" align="left">No</th>
@@ -132,13 +133,13 @@ tr:nth-child(even) {
<td>{{ $cawangan['caw_name'] }}</td>
<td>{{ ($caw['t_lelong']) }}</td>
<td>{{ ($caw['norujukan']) }}</td>
<td>{{ ($caw['berat']) }}</td>
<td>{{ ($caw['nilaimarhun']) }}</td>
<td>{{ ($caw['pinjaman']) }}</td>
<td>{{ ($caw['upahsimpan']) }}</td>
<td>{{ ($caw['hargaasas']) }}</td>
<td>{{ ($caw['cajlelong']) }}</td>
<td>{{ ($caw['baki']) }}</td>
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['nilaimarhun'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['pinjaman'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['upahsimpan'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['hargaasas'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['cajlelong'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['baki'], 2, '.', ',') }}</td>
{{-- <td>{{ ($bid['bakilelong']) }}</td>
<td>{{ ($bid['rugilelong']) }}</td> --}}
@@ -158,14 +159,74 @@ tr:nth-child(even) {
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td></td>
{{-- <td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>({{ number_format($total_rugilelong, 2, '.', ',') }})</td> --}}
</tr>
</table>
<br>
<table width="100%" border="0" id="sim">
<tr>
<td><h5>.</h5></td>
</tr>
<tr>
<th style="text-align:center;" colspan="12"><h3><b>SIMULASI KESELURUHAN</b></h3></th>
</tr>
<thead>
<tr class="text-center">
<th>No</th>
<th>Cawangan</th>
<th>Tarikh Lelong</th>
<th>Bil Marhun (Paket)</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
<th>Pinjaman (RM)</th>
<th>Upah (RM)</th>
<th>Harga Asas (RM)</th>
<th>Caj Lelong (RM)</th>
<th>Baki Lelong (RM)</th>
<th>Rugi Lelong (RM)</th>
</tr>
</thead>
<tbody>
@foreach ($arraycaw as $index=>$caw)
<tr>
<td>{{$index+1}}</td>
<td>{{ $caw['cawangan'] }}</td>
<td>{{ $caw['t_lelong'] }}</td>
<td>{{ $caw['bil_marhun'] }}</td>
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['n_marhun'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['pinjaman'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['upah'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['hargaasas'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['cajlelong'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['bakilelong'], 2, '.', ',') }}</td>
<td>({{ number_format($caw['rugilelong'], 2, '.', ',') }})</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="3"><b>JUMLAH KESELURUHAN</b></td>
<td>{{ $total_marhun }}</td>
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nmarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($total_upah, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>({{ number_format($total_rugilelong, 2, '.', ',') }})</td>
</tr>
</tfoot>
</table>
<table width="100%" border="0" id="sim">
<tr>
+3 -1
View File
@@ -24,7 +24,7 @@ use App\Http\Controllers\ApiController;
//Public routes
Route::post('/register', [AuthController::class, 'register']);
Route::post('/user/login', [AuthController::class, 'loginUser']);
Route::post('/addToCart', [CartController::class, 'addToCart']);
Route::get('/cart/{userid}', [CartController::class, 'getCart']);
Route::post('/password/email', [ForgotPasswordController::class, 'sendResetLinkEmail']);
@@ -52,6 +52,8 @@ Route::group(['middleware' => ['auth:sanctum']], function () {
Route::put('/userUpdate/profile', [UserController::class, 'updateProfileUser']);
// Cart
Route::post('/addToCart', [CartController::class, 'addToCart']);
Route::post('/removeFromCart', [CartController::class, 'removeFromCart']);
Route::post('/updateItem', [CartController::class, 'updateItem']);
Route::get('/deleteItem/{id}', [CartController::class, 'deleteCart']);
+3 -1
View File
@@ -125,9 +125,11 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim
Route::post('/kemaskini',['as'=>'marhun.kemaskini','uses'=>'MarhunController@kemaskini']);
Route::get('/semakan',['as'=>'marhun.semakan','uses'=>'MarhunController@semakan']);
Route::post('/exportmarhun',['as'=>'marhun.exportmarhundetails','uses'=>'MarhunController@exportmarhundetails']);
Route::get('/semak/{id}',['as'=>'marhun.semak','uses'=>'MarhunController@semak']);
Route::post('/tambahmarhun',['as'=>'marhun.tambahmarhun','uses'=>'MarhunController@tambahmarhun']);
Route::get('/exportmarhundetails/{lelong_id}',['as'=>'marhun.exportmarhundetails','uses'=>'MarhunController@exportmarhundetails']);
});
//Khazanah