Compare commits

..

No commits in common. "3ba9b200b57362dd458b8417c64d1d2ceaa8be7a" and "9692e0140056eb448ae3938666cc003ab5bc3e75" have entirely different histories.

3 changed files with 16 additions and 23 deletions

View File

@ -39,7 +39,7 @@ class TransaksiController extends Controller
if ($search) {
$query->where(function ($q) use ($search) {
$q->where('kode_transaksi', 'like', '%' . $search . '%')
->orWhere('nama_pembeli', 'like', '%' . $search . '%');
->orWhere('nama_pembeli', 'like', '%' . $search . '%');
});
}
@ -125,20 +125,13 @@ class TransaksiController extends Controller
]);
foreach ($request->items as $it) {
$query = Item::with(['produk.foto', 'nampan']);
// TODO: ubah saat transaksi pake kode_item
// $item = Item::where('kode_item', $it['kode_item'])->first();
// if (!$item) {
// throw new \Exception("Item dengan kode_item {$it['kode_item']} tidak ditemukan.");
// }
$item = Item::where('id',$it['kode_item'])->with('produk')->first();
if (is_numeric($it['kode_item'])) {
$item = $query->where('id', (int)$it['kode_item'])->first();
} else {
$item = $query->where('kode_item', $it['kode_item'])->first();
}
if (!$item) {
return response()->json(['message' => 'Item tidak ditemukan'], 404);
}
if (!$item) {
throw new \Exception("Item dengan kode_item {$it['kode_item']} tidak ditemukan.");
}
ItemTransaksi::create([
'id_transaksi' => $transaksi->id,
'id_produk' => $item->produk->id,

View File

@ -284,7 +284,7 @@ const konfirmasiPenjualan = () => {
}, 5000);
return;
}
console.log(pesanan.value)
// Tampilkan struk overlay
showStruk.value = true;
};

View File

@ -355,7 +355,7 @@ const handleSimpan = () => {
}
const simpanTransaksi = async (dataTransaksi) => {
// console.log('Data transaksi yang akan disimpan:', dataTransaksi);
// console.log('Data transaksi yang akan disimpan:', dataTransaksi);
try {
const response = await axios.post('/api/transaksi', dataTransaksi, {