Compare commits

..

No commits in common. "420cf47f2095dd759a4d88d2370222cf97ff3ccd" and "c28be3706e6b1f07da23fcf395668bf218d88ae9" have entirely different histories.

4 changed files with 218 additions and 290 deletions

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->text('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@ -1,6 +1,5 @@
<template> <template>
<ConfirmDeleteModal <ConfirmDeleteModal
v-if="showDeleteModal"
:isOpen="showDeleteModal" :isOpen="showDeleteModal"
title="Konfirmasi" title="Konfirmasi"
message="Yakin ingin menghapus item ini?" message="Yakin ingin menghapus item ini?"
@ -8,14 +7,13 @@
@cancel="closeDeleteModal" @cancel="closeDeleteModal"
/> />
<div class="p-2 sm:p-4">
<!-- Grid Form & Total -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<!-- Input Form -->
<div class="order-2 md:order-1 flex flex-col gap-4">
<!-- Input Kode Item -->
<div> <div>
<label class="block text-sm font-medium text-D">Kode Item *</label> <div class="grid grid-cols-2 h-full gap-4 mb-4">
<div class="flex flex-col gap-4">
<div>
<label class="block text-sm font-medium text-D"
>Kode Item *</label
>
<div <div
class="flex flex-row justify-between mt-1 w-full rounded-md bg-A shadow-sm sm:text-sm border-B" class="flex flex-row justify-between mt-1 w-full rounded-md bg-A shadow-sm sm:text-sm border-B"
> >
@ -33,7 +31,10 @@
> >
<i class="fas fa-arrow-right"></i> <i class="fas fa-arrow-right"></i>
</button> </button>
<div v-else class="flex items-center justify-center px-3"> <div
v-else
class="flex items-center justify-center px-3"
>
<div <div
class="rounded-full h-5 w-5 border-b-2 border-A flex items-center justify-center" class="rounded-full h-5 w-5 border-b-2 border-A flex items-center justify-center"
> >
@ -42,10 +43,10 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Input Harga Jual -->
<div> <div>
<label class="block text-sm font-medium text-D">Harga Jual</label> <label class="block text-sm font-medium text-D"
>Harga Jual</label
>
<InputField <InputField
v-model="hargaJual" v-model="hargaJual"
type="number" type="number"
@ -53,35 +54,31 @@
/> />
</div> </div>
<!-- Tombol Aksi --> <div class="flex justify-between gap-4">
<div class="flex flex-col sm:flex-row justify-between gap-2">
<button <button
@click="tambahItem" @click="tambahItem"
class="w-full sm:w-auto px-4 py-2 rounded-md bg-C text-D font-medium hover:bg-C/80 transition" class="px-4 py-2 rounded-md bg-C text-D font-medium hover:bg-C/80 transition"
> >
Tambah Item Tambah Item
</button> </button>
<button <button
@click="konfirmasiPenjualan" @click="konfirmasiPenjualan"
class="w-full sm:w-auto px-6 py-2 rounded-md bg-D text-A font-semibold hover:bg-D/80 transition" class="px-6 py-2 rounded-md bg-D text-A font-semibold hover:bg-D/80 transition"
> >
Lanjut Lanjut
</button> </button>
</div> </div>
</div> </div>
<div class="flex pt-10 justify-center">
<!-- Total --> <div class="text-start">
<div class="order-1 md:order-2 flex flex-col md:flex-row md:items-center md:justify-center gap-1">
<div class="text-left md:text-start">
<span class="block text-gray-600 font-medium">Total:</span> <span class="block text-gray-600 font-medium">Total:</span>
<span class="text-2xl sm:text-3xl font-bold text-D"> <span class="text-3xl font-bold text-D">
Rp{{ total.toLocaleString() }},- Rp{{ total.toLocaleString() }},-
</span> </span>
</div> </div>
</div> </div>
</div> </div>
<!-- Error & Info -->
<div class="mb-4"> <div class="mb-4">
<p <p
v-if="error" v-if="error"
@ -93,23 +90,21 @@
<p v-if="info" class="text-sm text-C mt-1">{{ info }}</p> <p v-if="info" class="text-sm text-C mt-1">{{ info }}</p>
</div> </div>
<!-- Table Responsive -->
<div class="overflow-x-auto">
<table <table
class="w-full border border-B rounded-lg overflow-hidden text-xs sm:text-sm" class="w-full border border-B text-sm rounded-lg overflow-hidden"
> >
<thead class="bg-A text-D"> <thead class="bg-A text-D">
<tr> <tr>
<th class="border border-B p-2 w-8">No</th> <th class="border border-B p-2">No</th>
<th class="border border-B p-2">Nama Produk</th> <th class="border border-B p-2">Nam Produk</th>
<th class="border border-B p-2">Posisi</th> <th class="border border-B p-2">Posisi</th>
<th class="border border-B p-2">Harga</th> <th class="border border-B p-2">Harga</th>
<th class="border border-B p-2 w-10"></th> <th class="border border-B p-2"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-if="pesanan.length == 0" class="text-center text-D/70"> <tr v-if="pesanan.length == 0" class="text-center text-D/70">
<td colspan="5" class="h-16 border border-B text-xs sm:text-sm"> <td colspan="5" class="h-20 border border-B">
Belum ada item dipesan Belum ada item dipesan
</td> </td>
</tr> </tr>
@ -120,13 +115,13 @@
class="hover:bg-gray-50 text-center" class="hover:bg-gray-50 text-center"
> >
<td class="border border-B p-2">{{ index + 1 }}</td> <td class="border border-B p-2">{{ index + 1 }}</td>
<td class="border border-B p-2 text-left truncate max-w-[120px] sm:max-w-none"> <td class="border border-B p-2 text-left">
{{ item.produk.nama }} {{ item.produk.nama }}
</td> </td>
<td class="border border-B p-2 truncate max-w-[80px]"> <td class="border border-B p-2">
{{ item.posisi ? item.posisi : "Brankas" }} {{ item.posisi ? item.posisi : "Brankas" }}
</td> </td>
<td class="border border-B p-2 whitespace-nowrap"> <td class="border border-B p-2">
Rp{{ item.harga_deal.toLocaleString() }} Rp{{ item.harga_deal.toLocaleString() }}
</td> </td>
<td class="border border-B p-2 text-center"> <td class="border border-B p-2 text-center">
@ -140,12 +135,9 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, computed } from "vue"; import { ref, computed } from "vue";
import InputField from "./InputField.vue"; import InputField from "./InputField.vue";

View File

@ -1,13 +1,12 @@
<template> <template>
<div class="overflow-x-auto">
<h3 class="text-lg font-semibold mb-4 text-gray-800">Transaksi</h3> <h3 class="text-lg font-semibold mb-4 text-gray-800">Transaksi</h3>
<table class="w-full min-w-[500px] border border-B rounded-lg text-sm"> <table class="w-full border border-B rounded-lg text-sm">
<thead class="bg-A text-D"> <thead class="bg-A text-D">
<tr> <tr>
<th class="border border-B p-2 text-left">Tanggal</th> <th class="border border-B p-2">Tanggal</th>
<th class="border border-B p-2 text-left">Kode Transaksi</th> <th class="border border-B p-2">Kode Transaksi</th>
<th class="border border-B p-2 text-left">Pendapatan</th> <th class="border border-B p-2">Pendapatan</th>
<th class="border border-B p-2 text-center">Detail Item</th> <th class="border border-B p-2">Detail Item</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -16,16 +15,12 @@
<td class="border border-B p-2">{{ trx.kode }}</td> <td class="border border-B p-2">{{ trx.kode }}</td>
<td class="border border-B p-2">Rp{{ (trx.pendapatan || 0).toLocaleString() }}</td> <td class="border border-B p-2">Rp{{ (trx.pendapatan || 0).toLocaleString() }}</td>
<td class="border border-B p-2 text-center"> <td class="border border-B p-2 text-center">
<button <button @click="$emit('detail', trx)"
@click="$emit('detail', trx)" class="px-3 py-1 rounded-md bg-D text-A hover:bg-D/80 transition">Detail</button>
class="px-3 py-1 rounded-md bg-D text-A hover:bg-D/80 transition">
Detail
</button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</template> </template>
<script setup> <script setup>

View File

@ -1,15 +1,11 @@
<template> <template>
<mainLayout> <mainLayout>
<div class="lg:p-2 pt-6"> <div class="lg:p-2 pt-6">
<div <div class="grid grid-cols-1 lg:grid-cols-5 gap-3 sm:gap-2 mx-auto min-h-[75vh]">
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-3 sm:gap-2 mx-auto min-h-[75vh]"
>
<!-- Left Section - Form Kasir --> <!-- Left Section - Form Kasir -->
<div class="lg:col-span-3"> <div class="lg:col-span-3">
<div <div class="bg-white rounded-xl shadow-lg border border-B overflow-hidden h-full">
class="bg-white rounded-xl shadow-lg border border-B overflow-hidden h-auto lg:h-full" <div class="p-2 md:p-4 h-full">
>
<div class="p-2 sm:p-3 md:p-4 h-auto lg:h-full">
<KasirForm /> <KasirForm />
</div> </div>
</div> </div>
@ -17,44 +13,22 @@
<!-- Right Section - Transaction List --> <!-- Right Section - Transaction List -->
<div class="lg:col-span-2"> <div class="lg:col-span-2">
<div <div class="bg-white rounded-xl shadow-lg border border-B overflow-hidden lg:h-fit sticky top-4">
class="bg-white rounded-xl shadow-lg border border-B overflow-hidden lg:h-fit sticky top-4 max-h-[70vh] overflow-y-auto" <!-- Transaction List Content -->
> <div class="p-4 sm:p-6 overflow-y-auto">
<div class="p-3 sm:p-4 md:p-6"> <!-- Loading State -->
<!-- Loading --> <div v-if="loading" class="flex items-center justify-center py-8">
<div <div class="animate-spin rounded-full h-8 w-8 border-b-2 border-C"></div>
v-if="loading" <span class="ml-3 text-D/70">Memuat transaksi...</span>
class="flex items-center justify-center py-8"
>
<div
class="animate-spin rounded-full h-8 w-8 border-b-2 border-C"
></div>
<span class="ml-3 text-D/70"
>Memuat transaksi...</span
>
</div> </div>
<!-- Empty --> <!-- Empty State -->
<div <div v-else-if="!transaksi.length" class="text-center py-8">
v-else-if="!transaksi.length" <svg class="w-16 h-16 mx-auto text-B mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
class="text-center py-8" <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1"
> d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
<svg
class="w-16 h-16 mx-auto text-B mb-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1"
d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"
/>
</svg> </svg>
<p class="text-[var(--color-D)]/60 text-sm"> <p class="text-[var(--color-D)]/60 text-sm">Belum ada transaksi</p>
Belum ada transaksi
</p>
</div> </div>
<!-- Transaction List --> <!-- Transaction List -->
@ -72,34 +46,34 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue"
import axios from "axios"; import axios from "axios"
import mainLayout from "../layouts/mainLayout.vue"; import mainLayout from '../layouts/mainLayout.vue'
import KasirForm from "../components/KasirForm.vue"; import KasirForm from '../components/KasirForm.vue'
import KasirTransaksiList from "../components/KasirTransaksiList.vue"; import KasirTransaksiList from '../components/KasirTransaksiList.vue'
const transaksi = ref([]); const transaksi = ref([])
const loading = ref(true); const loading = ref(true)
onMounted(async () => { onMounted(async () => {
try { try {
loading.value = true; loading.value = true
const res = await axios.get("/api/transaksi?limit=10", { const res = await axios.get("/api/transaksi?limit=10", {
headers: { headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`, Authorization: `Bearer ${localStorage.getItem("token")}`,
}, },
}); })
transaksi.value = res.data; transaksi.value = res.data
} catch (err) { } catch (err) {
console.error("Gagal fetch transaksi:", err); console.error("Gagal fetch transaksi:", err)
} finally { } finally {
loading.value = false; loading.value = false
} }
}); })
const lihatDetail = (trx) => { const lihatDetail = (trx) => {
alert(`Detail transaksi: ${trx.kode}`); alert(`Detail transaksi: ${trx.kode}`)
}; }
</script> </script>