almost done

auth
Zelda Ababil 2024-01-20 02:41:31 +07:00
parent 81144d5515
commit 137eb42ac7
7 changed files with 274 additions and 211 deletions

View File

@ -20,8 +20,7 @@ class Transaksi extends Controller
foreach ($KelompokKategori as $item) {
foreach ($item->kelompokKategoriPivot as $kelompokKategoriPivot) {
// Query tambahan untuk mendapatkan total pembelian berdasarkan produk
$totalPembelianByProduk[$kelompokKategoriPivot->produk->id] = DetailPesanan::
select('detail_pesanans.produk_id', DB::raw('SUM(detail_pesanans.jumlah_produk) as total_beli'))
$totalPembelianByProduk[$kelompokKategoriPivot->produk->id] = DetailPesanan::select('detail_pesanans.produk_id', DB::raw('SUM(detail_pesanans.jumlah_produk) as total_beli'))
->where('detail_pesanans.produk_id', '=', $kelompokKategoriPivot->produk->id)
->groupBy('detail_pesanans.produk_id')
->first();
@ -81,6 +80,7 @@ class Transaksi extends Controller
'jumlah_produk' => $value['qty'],
'harga_produk' => $value['harga'],
'total_harga_produk' => $value['total'],
'keterangan_produk' => $value['keterangan'] ?? null,
];
$detailPesananModels = \App\Models\DetailPesanan::create($oderDatas);
}

View File

@ -20,6 +20,7 @@ class DetailPesanan extends Model
'harga_produk',
'jumlah_produk',
'total_harga_produk',
'keterangan_produk',
'diskon_id',
'nama_diskon',
'kode_diskon',

View File

@ -17,13 +17,25 @@ class Produk extends Model
'kategori_produk_id',
'kode_produk',
'nama_produk',
'gambar_produk',
'varian_produk',
'deskripsi_produk',
'harga_produk',
'stok_produk',
'tersedia',
'gambar_produk',
'urutan',
];
// full path to reach image from storage folder and check if image exists or not
public function getGambarProdukAttribute($value)
{
$storage = storage_path('app/public/produk/' . $this->kategori_produk_id . '/' . $value);
if (file_exists($storage)) {
return asset('storage/produk/' . $this->kategori_produk_id . '/' . $value);
} else {
return asset('assets/images/menu_image.jpeg');
}
}
public function kategori_produk()
{

View File

@ -18,6 +18,20 @@ scratch. This page gets rid of all links and provides the needed markup only.
<!-- Theme style -->
<link rel="stylesheet" href="{{ asset('assets/dist/css/adminlte.min.css') }}">
<style>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
</style>
@stack('styles')
</head>

View File

@ -64,6 +64,10 @@
hr.style2 {
border-top: 1px solid #8c8b8b;
}
.dashed-line {
border: 1.5px dashed black;
}
</style>
<body style="width: 80mm;">
@ -87,7 +91,6 @@
<table class="literely-table" style="width: 100%;">
<tbody>
@foreach ($pesanan->detailPesanan as $item)
{{-- @dd($item) --}}
<tr>
<td style="width: 2px;">{{ $loop->iteration }}</td>
<td style="width: 80px;" colspan="3">{{ $item->nama_produk }}</td>
@ -96,7 +99,9 @@
<td></td>
<td style="text-align: right">{{ $item->jumlah_produk }}</td>
<td style="text-align: right">{{ convert_to_rupiah($item->harga_produk) }}</td>
<td style="text-align: right">{{ convert_to_rupiah($item->total_harga_produk) }}</td>
<td style="text-align: right;width: 30px">
{{ $item->diskon_persen != '' ? $item->diskon_persen . '%' : '' }}</td>
<td style="text-align: right;width: 90px">{{ convert_to_rupiah($item->total_harga_produk) }}</td>
</tr>
@endforeach
</tbody>
@ -134,8 +139,49 @@
<hr class="style1">
<p style="text-align: center">Terima Kasih, Selamat Datang Kembali</p>
<p style="text-align: center;font-size: 7pt;">@sepiringtelurkeriting</p>
<hr class="dashed-line" style="margin-top: 15px;">
<p style="text-align: center;font-size: 7pt">untuk dapur</p>
<hr class="dashed-line" style="margin-top: 10px;">
<span style="display: flex; justify-content: space-between;margin-top: 10px;">
<span>
<p>{{ tanggal_indonesia($pesanan->tanggal_pesanan) }}</p>
<p>{{ date('H:i', strtotime($pesanan->tanggal_pesanan)) }}</p>
<p>Meja: {{ $pesanan->nomor_meja }}</p>
</span>
<span style="text-align: right">
<p>{{ $pesanan->kode_pesanan }}</p>
<p>Kasir: {{ $pesanan->user->name }}</p>
<p>Order: {{ $pesanan->nama_pemesan }}</p>
</span>
</span>
<p></p>
<hr class="style2">
<p style="text-align: left; margin-top:3px;">Menu Order</p>
<table class="table" style="width: 100%;">
<tbody>
@foreach ($pesanan->detailPesanan as $item)
<tr>
<td style="width: 80px;" colspan="3">
{{ $loop->iteration }}. {{ $item->nama_produk }}
<br>
<small>
&nbsp;&nbsp;&nbsp;&nbsp;{{ $item->keterangan_produk }}
</small>
</td>
</tr>
@endforeach
</tbody>
</table>
<p style="text-align: left; margin-top:5px;">Keterangan Pesanan Keseluruhan</p>
<table class="table" style="width: 100%;">
<tbody>
<tr>
<td style="width: 80px;" colspan="3">
{{ $pesanan->keterangan_pesanan != '' ? $pesanan->keterangan_pesanan : '-' }}</td>
</tr>
</tbody>
</table>
<hr class="style2">
</body>
<script>
window.print();

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -63,6 +64,7 @@
hr.style2 {
border-top: 1px solid #8c8b8b;
}
.dashed-line {
border: 1.5px dashed black;
}
@ -89,7 +91,6 @@
<table class="literely-table" style="width: 100%;">
<tbody>
@foreach ($pesanan->detailPesanan as $item)
{{-- @dd($item) --}}
<tr>
<td style="width: 2px;">{{ $loop->iteration }}</td>
<td style="width: 80px;" colspan="3">{{ $item->nama_produk }}</td>
@ -137,34 +138,44 @@
<p style="text-align: center">Terima Kasih, Selamat Datang Kembali</p>
<p style="text-align: center;font-size: 7pt;">@sepiringtelurkeriting</p>
<hr class="dashed-line" style="margin-top: 15px;">
<hr class="style2" style="margin-top: 15px;">
<span style="display: flex; justify-content: space-between">
<p style="text-align: center;font-size: 7pt">untuk dapur</p>
<hr class="dashed-line" style="margin-top: 10px;">
<span style="display: flex; justify-content: space-between;margin-top: 10px;">
<span>
<p>{{ tanggal_indonesia($pesanan->tanggal_pesanan) }}</p>
<p>{{ date('H:i', strtotime($pesanan->tanggal_pesanan)) }}</p>
<p>Meja: {{ $pesanan->nomor_meja }}</p>
</span>
<span style="text-align: right">
<p>{{ $pesanan->kode_pesanan }}</p>
<p>{{ $pesanan->user->name }}</p>
<p>Kasir: {{ $pesanan->user->name }}</p>
<p>Order: {{ $pesanan->nama_pemesan }}</p>
</span>
</span>
<p></p>
<hr class="style2">
<p style="text-align: left; margin-top:3px;">Menu</p>
<p style="text-align: left; margin-top:3px;">Menu Order</p>
<table class="table" style="width: 100%;">
<tbody>
@foreach ($pesanan->detailPesanan as $item)
<tr>
<td style="width: 80px;" colspan="3">* {{ $item->nama_produk }}</td>
<td style="width: 80px;" colspan="3">
{{ $loop->iteration }}. {{ $item->nama_produk }}
<br>
<small>
&nbsp;&nbsp;&nbsp;&nbsp;{{ $item->keterangan_produk }}
</small>
</td>
</tr>
@endforeach
</tbody>
</table>
<p style="text-align: left; margin-top:3px;">Keterangan Pesanan</p>
<p style="text-align: left; margin-top:5px;">Keterangan Pesanan Keseluruhan</p>
<table class="table" style="width: 100%;">
<tbody>
<tr>
<td style="width: 80px;" colspan="3">* {{ $pesanan->keterangan_pesanan }}</td>
<td style="width: 80px;" colspan="3">
{{ $pesanan->keterangan_pesanan != '' ? $pesanan->keterangan_pesanan : '-' }}</td>
</tr>
</tbody>
</table>

View File

@ -113,11 +113,7 @@
</div>
<div class="card-body">
<img style="width: 100%;height: 100%;object-fit: cover;"
src="
@if ($kelompokKategoriPivot->produk->gambar_produk != null) {{ asset('storage/' . $kelompokKategoriPivot->produk->gambar_produk) }}
@else
{{ asset('assets/images/menu_image.jpeg') }} @endif
"
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
</div>
<a class="btn btn-warning"
@ -146,11 +142,7 @@
</div>
<div class="card-body">
<img style="width: 100%;height: 100%;object-fit: cover;"
src="
@if ($kelompokKategoriPivot->produk->gambar_produk != null) {{ asset('storage/' . $kelompokKategoriPivot->produk->gambar_produk) }}
@else
{{ asset('assets/images/menu_image.jpeg') }} @endif
"
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
</div>
<a class="btn btn-warning"
@ -179,11 +171,7 @@
</div>
<div class="card-body">
<img style="width: 100%;height: 100%;object-fit: cover;"
src="
@if ($kelompokKategoriPivot->produk->gambar_produk != null) {{ asset('storage/' . $kelompokKategoriPivot->produk->gambar_produk) }}
@else
{{ asset('assets/images/menu_image.jpeg') }} @endif
"
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
</div>
<a class="btn btn-warning"
@ -212,11 +200,7 @@
</div>
<div class="card-body">
<img style="width: 100%;height: 100%;object-fit: cover;"
src="
@if ($kelompokKategoriPivot->produk->gambar_produk != null) {{ asset('storage/' . $kelompokKategoriPivot->produk->gambar_produk) }}
@else
{{ asset('assets/images/menu_image.jpeg') }} @endif
"
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
</div>
<a class="btn btn-warning"
@ -244,11 +228,7 @@
</div>
<div class="card-body">
<img style="width: 100%;height: 100%;object-fit: cover;"
src="
@if ($kelompokKategoriPivot->produk->gambar_produk != null) {{ asset('storage/' . $kelompokKategoriPivot->produk->gambar_produk) }}
@else
{{ asset('assets/images/menu_image.jpeg') }} @endif
"
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
</div>
<a class="btn btn-warning"
@ -281,11 +261,7 @@
<div class="card-body">
<div class="col-md-12">
<img style="width: 100%;height: 100%;object-fit: cover;"
src="
@if ($kelompokKategoriPivot->produk->gambar_produk != null) {{ asset('storage/' . $kelompokKategoriPivot->produk->gambar_produk) }}
@else
{{ asset('assets/images/menu_image.jpeg') }} @endif
"
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
<div class="col-md-12 mt-1"
style="align-items: center;align-content: center;">
@ -319,11 +295,7 @@
<div class="card-body">
<div class="col-md-12">
<img style="width: 100%;height: 100%;object-fit: cover;"
src="
@if ($kelompokKategoriPivot->produk->gambar_produk != null) {{ asset('storage/' . $kelompokKategoriPivot->produk->gambar_produk) }}
@else
{{ asset('assets/images/menu_image.jpeg') }} @endif
"
src="{{ $kelompokKategoriPivot->produk->gambar_produk }}"
alt="{{ $kelompokKategoriPivot->produk->nama_produk ?? '' }}">
<div class="col-md-12 mt-1"
style="align-items: center;align-content: center;">
@ -364,12 +336,18 @@
<div class="card-body">
<table class="table table-bordered table-striped" id="order-menus" width="100%">
<thead style="background-color: lightgray">
<tr>
{{-- <tr>
<th width="60%" class="text-center">Menu</th>
<th>Qty</th>
<th width="10%" style="text-align: center">
<i class="fas fa-cog"></i>
</th>
</tr> --}}
<tr>
<th class="text-center">Menu</th>
<th class="text-center" width="100px">Qty</th>
<th class="text-center" width="60px">(%)</th>
<th class="text-center" width="30px">⚙️</th>
</tr>
</thead>
<tbody id="tbody-order-menus">
@ -377,7 +355,7 @@
<tfoot style="background-color: lightgray">
<tr>
<th class="text-center">Total</th>
<th colspan="2">
<th colspan="3">
<span class="row">
<span class="col-6">Rp.</span>
<span class="col-6" style="text-align: right" id="total">0</span>
@ -387,7 +365,7 @@
</tr>
<tr>
<th class="text-center">Diskon (%)</th>
<th colspan="2">
<th colspan="3">
<div class="input-group input-group-sm">
<input type="number" name="diskon" class="form-control rounded-0">
</div>
@ -395,7 +373,7 @@
</tr>
<tr>
<th class="text-center">Grand Total</th>
<th colspan="2">
<th colspan="3">
<span class="row">
<span class="col-6">Rp.</span>
<span class="col-6" style="text-align: right" id="total-diskon">0</span>
@ -405,7 +383,7 @@
</tr>
<tr>
<th class="text-center">Bayar</th>
<th colspan="2">
<th colspan="3">
<div class="input-group input-group-sm">
<input type="text" name="nominal-bayar" class="form-control rounded-0"
required id="nominal-bayar">
@ -414,7 +392,7 @@
</tr>
<tr>
<th class="text-center">Kembali</th>
<th colspan="2">
<th colspan="3">
<span class="row">
<span class="col-6">Rp.</span>
<span class="col-6" style="text-align: right" id="kembali">0</span>
@ -423,7 +401,7 @@
</th>
</tr>
<tr>
<th colspan="3">
<th colspan="4">
<span class="row">
<input type="text" name="nama-pemesan" class="form-control rounded-0"
placeholder="Nama Pemesan" id="nama-pemesan" required>
@ -437,7 +415,7 @@
</th>
</tr>
<tr style="background-color: white">
<th colspan="3">
<th colspan="4">
<button class="btn btn-warning btn-block" id="pesan-bayar">Bayar</button>
</th>
</tr>
@ -868,7 +846,8 @@
qty: qty,
diskonSatuan: diskonSatuan,
harga: harga,
total: total
total: total,
keterangan: document.getElementsByName('keterangan_satuan')[i - 1].value
});
}
}