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

View File

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

View File

@ -17,13 +17,25 @@ class Produk extends Model
'kategori_produk_id', 'kategori_produk_id',
'kode_produk', 'kode_produk',
'nama_produk', 'nama_produk',
'gambar_produk', 'varian_produk',
'deskripsi_produk', 'deskripsi_produk',
'harga_produk', 'harga_produk',
'stok_produk', 'stok_produk',
'tersedia', '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() 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 --> <!-- Theme style -->
<link rel="stylesheet" href="{{ asset('assets/dist/css/adminlte.min.css') }}"> <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') @stack('styles')
</head> </head>

View File

@ -64,6 +64,10 @@
hr.style2 { hr.style2 {
border-top: 1px solid #8c8b8b; border-top: 1px solid #8c8b8b;
} }
.dashed-line {
border: 1.5px dashed black;
}
</style> </style>
<body style="width: 80mm;"> <body style="width: 80mm;">
@ -87,7 +91,6 @@
<table class="literely-table" style="width: 100%;"> <table class="literely-table" style="width: 100%;">
<tbody> <tbody>
@foreach ($pesanan->detailPesanan as $item) @foreach ($pesanan->detailPesanan as $item)
{{-- @dd($item) --}}
<tr> <tr>
<td style="width: 2px;">{{ $loop->iteration }}</td> <td style="width: 2px;">{{ $loop->iteration }}</td>
<td style="width: 80px;" colspan="3">{{ $item->nama_produk }}</td> <td style="width: 80px;" colspan="3">{{ $item->nama_produk }}</td>
@ -96,7 +99,9 @@
<td></td> <td></td>
<td style="text-align: right">{{ $item->jumlah_produk }}</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->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> </tr>
@endforeach @endforeach
</tbody> </tbody>
@ -134,8 +139,49 @@
<hr class="style1"> <hr class="style1">
<p style="text-align: center">Terima Kasih, Selamat Datang Kembali</p> <p style="text-align: center">Terima Kasih, Selamat Datang Kembali</p>
<p style="text-align: center;font-size: 7pt;">@sepiringtelurkeriting</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> </body>
<script> <script>
window.print(); window.print();

View File

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" /> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
@ -9,9 +10,9 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Oswald&family=Roboto:wght@300;400&display=swap" <link href="https://fonts.googleapis.com/css2?family=Oswald&family=Roboto:wght@300;400&display=swap"
rel="stylesheet"> rel="stylesheet">
</head> </head>
<style> <style>
@page { @page {
margin: 0.2cm; margin: 0.2cm;
} }
@ -63,12 +64,13 @@
hr.style2 { hr.style2 {
border-top: 1px solid #8c8b8b; border-top: 1px solid #8c8b8b;
} }
.dashed-line { .dashed-line {
border: 1.5px dashed black; border: 1.5px dashed black;
} }
</style> </style>
<body style="width: 80mm;"> <body style="width: 80mm;">
<h2 style="text-align: center">Sepiring Telur Keriting</h2> <h2 style="text-align: center">Sepiring Telur Keriting</h2>
<p style="text-align: center">Jln. Jawa No. 28A, Jember</p> <p style="text-align: center">Jln. Jawa No. 28A, Jember</p>
<hr class="style2"> <hr class="style2">
@ -89,7 +91,6 @@
<table class="literely-table" style="width: 100%;"> <table class="literely-table" style="width: 100%;">
<tbody> <tbody>
@foreach ($pesanan->detailPesanan as $item) @foreach ($pesanan->detailPesanan as $item)
{{-- @dd($item) --}}
<tr> <tr>
<td style="width: 2px;">{{ $loop->iteration }}</td> <td style="width: 2px;">{{ $loop->iteration }}</td>
<td style="width: 80px;" colspan="3">{{ $item->nama_produk }}</td> <td style="width: 80px;" colspan="3">{{ $item->nama_produk }}</td>
@ -137,41 +138,51 @@
<p style="text-align: center">Terima Kasih, Selamat Datang Kembali</p> <p style="text-align: center">Terima Kasih, Selamat Datang Kembali</p>
<p style="text-align: center;font-size: 7pt;">@sepiringtelurkeriting</p> <p style="text-align: center;font-size: 7pt;">@sepiringtelurkeriting</p>
<hr class="dashed-line" style="margin-top: 15px;"> <hr class="dashed-line" style="margin-top: 15px;">
<hr class="style2" style="margin-top: 15px;"> <p style="text-align: center;font-size: 7pt">untuk dapur</p>
<span style="display: flex; justify-content: space-between"> <hr class="dashed-line" style="margin-top: 10px;">
<span style="display: flex; justify-content: space-between;margin-top: 10px;">
<span> <span>
<p>{{ tanggal_indonesia($pesanan->tanggal_pesanan) }}</p> <p>{{ tanggal_indonesia($pesanan->tanggal_pesanan) }}</p>
<p>{{ date('H:i', strtotime($pesanan->tanggal_pesanan)) }}</p> <p>{{ date('H:i', strtotime($pesanan->tanggal_pesanan)) }}</p>
<p>Meja: {{ $pesanan->nomor_meja }}</p>
</span> </span>
<span style="text-align: right"> <span style="text-align: right">
<p>{{ $pesanan->kode_pesanan }}</p> <p>{{ $pesanan->kode_pesanan }}</p>
<p>{{ $pesanan->user->name }}</p> <p>Kasir: {{ $pesanan->user->name }}</p>
<p>Order: {{ $pesanan->nama_pemesan }}</p>
</span> </span>
</span> </span>
<p></p> <p></p>
<hr class="style2"> <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%;"> <table class="table" style="width: 100%;">
<tbody> <tbody>
@foreach ($pesanan->detailPesanan as $item) @foreach ($pesanan->detailPesanan as $item)
<tr> <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> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </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%;"> <table class="table" style="width: 100%;">
<tbody> <tbody>
<tr> <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> </tr>
</tbody> </tbody>
</table> </table>
<hr class="style2"> <hr class="style2">
</body> </body>
<script> <script>
window.print(); window.print();
</script> </script>
</html> </html>

View File

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