[update] Kasir, KasirForm, KasirTransaksiList Responsive Mobile Desktop
This commit is contained in:
parent
1cd2aa60d4
commit
634c0683b5
@ -0,0 +1,33 @@
|
|||||||
|
<?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');
|
||||||
|
}
|
||||||
|
};
|
@ -1,5 +1,6 @@
|
|||||||
<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?"
|
||||||
@ -7,13 +8,14 @@
|
|||||||
@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>
|
||||||
<div class="grid grid-cols-2 h-full gap-4 mb-4">
|
<label class="block text-sm font-medium text-D">Kode Item *</label>
|
||||||
<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"
|
||||||
>
|
>
|
||||||
@ -31,10 +33,7 @@
|
|||||||
>
|
>
|
||||||
<i class="fas fa-arrow-right"></i>
|
<i class="fas fa-arrow-right"></i>
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div v-else class="flex items-center justify-center px-3">
|
||||||
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"
|
||||||
>
|
>
|
||||||
@ -43,10 +42,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Input Harga Jual -->
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-D"
|
<label class="block text-sm font-medium text-D">Harga Jual</label>
|
||||||
>Harga Jual</label
|
|
||||||
>
|
|
||||||
<InputField
|
<InputField
|
||||||
v-model="hargaJual"
|
v-model="hargaJual"
|
||||||
type="number"
|
type="number"
|
||||||
@ -54,31 +53,35 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-between gap-4">
|
<!-- Tombol Aksi -->
|
||||||
|
<div class="flex flex-col sm:flex-row justify-between gap-2">
|
||||||
<button
|
<button
|
||||||
@click="tambahItem"
|
@click="tambahItem"
|
||||||
class="px-4 py-2 rounded-md bg-C text-D font-medium hover:bg-C/80 transition"
|
class="w-full sm:w-auto 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="px-6 py-2 rounded-md bg-D text-A font-semibold hover:bg-D/80 transition"
|
class="w-full sm:w-auto 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">
|
|
||||||
<div class="text-start">
|
<!-- Total -->
|
||||||
|
<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-3xl font-bold text-D">
|
<span class="text-2xl sm: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"
|
||||||
@ -90,21 +93,23 @@
|
|||||||
<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 text-sm rounded-lg overflow-hidden"
|
class="w-full border border-B rounded-lg overflow-hidden text-xs sm:text-sm"
|
||||||
>
|
>
|
||||||
<thead class="bg-A text-D">
|
<thead class="bg-A text-D">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="border border-B p-2">No</th>
|
<th class="border border-B p-2 w-8">No</th>
|
||||||
<th class="border border-B p-2">Nam Produk</th>
|
<th class="border border-B p-2">Nama 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"></th>
|
<th class="border border-B p-2 w-10"></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-20 border border-B">
|
<td colspan="5" class="h-16 border border-B text-xs sm:text-sm">
|
||||||
Belum ada item dipesan
|
Belum ada item dipesan
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -115,13 +120,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">
|
<td class="border border-B p-2 text-left truncate max-w-[120px] sm:max-w-none">
|
||||||
{{ item.produk.nama }}
|
{{ item.produk.nama }}
|
||||||
</td>
|
</td>
|
||||||
<td class="border border-B p-2">
|
<td class="border border-B p-2 truncate max-w-[80px]">
|
||||||
{{ item.posisi ? item.posisi : "Brankas" }}
|
{{ item.posisi ? item.posisi : "Brankas" }}
|
||||||
</td>
|
</td>
|
||||||
<td class="border border-B p-2">
|
<td class="border border-B p-2 whitespace-nowrap">
|
||||||
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">
|
||||||
@ -135,9 +140,12 @@
|
|||||||
</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";
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
<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 border border-B rounded-lg text-sm">
|
<table class="w-full min-w-[500px] 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">Tanggal</th>
|
<th class="border border-B p-2 text-left">Tanggal</th>
|
||||||
<th class="border border-B p-2">Kode Transaksi</th>
|
<th class="border border-B p-2 text-left">Kode Transaksi</th>
|
||||||
<th class="border border-B p-2">Pendapatan</th>
|
<th class="border border-B p-2 text-left">Pendapatan</th>
|
||||||
<th class="border border-B p-2">Detail Item</th>
|
<th class="border border-B p-2 text-center">Detail Item</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -15,12 +16,16 @@
|
|||||||
<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 @click="$emit('detail', trx)"
|
<button
|
||||||
class="px-3 py-1 rounded-md bg-D text-A hover:bg-D/80 transition">Detail</button>
|
@click="$emit('detail', trx)"
|
||||||
|
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>
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<mainLayout>
|
<mainLayout>
|
||||||
<div class="lg:p-2 pt-6">
|
<div class="lg:p-2 pt-6">
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-5 gap-3 sm:gap-2 mx-auto min-h-[75vh]">
|
<div
|
||||||
|
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 class="bg-white rounded-xl shadow-lg border border-B overflow-hidden h-full">
|
<div
|
||||||
<div class="p-2 md:p-4 h-full">
|
class="bg-white rounded-xl shadow-lg border border-B overflow-hidden h-auto lg:h-full"
|
||||||
|
>
|
||||||
|
<div class="p-2 sm:p-3 md:p-4 h-auto lg:h-full">
|
||||||
<KasirForm />
|
<KasirForm />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -13,22 +17,44 @@
|
|||||||
|
|
||||||
<!-- Right Section - Transaction List -->
|
<!-- Right Section - Transaction List -->
|
||||||
<div class="lg:col-span-2">
|
<div class="lg:col-span-2">
|
||||||
<div class="bg-white rounded-xl shadow-lg border border-B overflow-hidden lg:h-fit sticky top-4">
|
<div
|
||||||
<!-- Transaction List Content -->
|
class="bg-white rounded-xl shadow-lg border border-B overflow-hidden lg:h-fit sticky top-4 max-h-[70vh] overflow-y-auto"
|
||||||
<div class="p-4 sm:p-6 overflow-y-auto">
|
>
|
||||||
<!-- Loading State -->
|
<div class="p-3 sm:p-4 md:p-6">
|
||||||
<div v-if="loading" class="flex items-center justify-center py-8">
|
<!-- Loading -->
|
||||||
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-C"></div>
|
<div
|
||||||
<span class="ml-3 text-D/70">Memuat transaksi...</span>
|
v-if="loading"
|
||||||
|
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 State -->
|
<!-- Empty -->
|
||||||
<div v-else-if="!transaksi.length" class="text-center py-8">
|
<div
|
||||||
<svg class="w-16 h-16 mx-auto text-B mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
v-else-if="!transaksi.length"
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1"
|
class="text-center py-8"
|
||||||
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">Belum ada transaksi</p>
|
<p class="text-[var(--color-D)]/60 text-sm">
|
||||||
|
Belum ada transaksi
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Transaction List -->
|
<!-- Transaction List -->
|
||||||
@ -46,34 +72,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>
|
||||||
|
Loading…
Reference in New Issue
Block a user