Compare commits
No commits in common. "ae4b8a34496fc69fb9bb49c2fca60d66009fe88a" and "8e59b1f1f151797530ff501f9c8061dfb6608530" have entirely different histories.
ae4b8a3449
...
8e59b1f1f1
@ -20,9 +20,9 @@ class DatabaseSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
User::factory()->create([
|
||||
'nama' => 'Test',
|
||||
'nama' => 'Test User',
|
||||
'role' => 'owner',
|
||||
'password' => bcrypt('123123'),
|
||||
'password' => bcrypt('123123123'),
|
||||
]);
|
||||
|
||||
User::factory(2)->create();
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="my-6">
|
||||
<hr class="border-B mb-5" />
|
||||
<div class="flex flex-row mb-3 overflow-x-auto">
|
||||
<div class="flez flex-row mb-3">
|
||||
<input type="date" v-model="tanggalDipilih"
|
||||
class="mt-1 block rounded-md shadow-sm sm:text-sm bg-A text-D border-B focus:border-C focus:ring focus:outline-none focus:ring-D focus:ring-opacity-50 p-2" />
|
||||
<InputSelect class="ml-3" :options="opsiSales" v-model="salesDipilih" />
|
||||
|
||||
</div>
|
||||
<div class="mt-5 overflow-x-auto">
|
||||
|
||||
<table class="w-full border-collapse border border-C rounded-md">
|
||||
<thead>
|
||||
<tr class="bg-C text-D rounded-t-md">
|
||||
@ -39,12 +39,10 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch, computed } from 'vue';
|
||||
import InputSelect from './InputSelect.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const tanggalDipilih = ref('');
|
||||
@ -53,24 +51,6 @@ const loading = ref(false);
|
||||
|
||||
const produk = computed(() => data.value?.produk || []);
|
||||
|
||||
const salesDipilih = ref(null);
|
||||
const opsiSales = ref([
|
||||
{ label: 'Semua Sales', value: null, selected: true },
|
||||
]);
|
||||
|
||||
const fetchSales = async () => {
|
||||
try {
|
||||
const response = await axios.get('/api/sales');
|
||||
const salesData = response.data;
|
||||
opsiSales.value = [{ label: 'Semua Sales', value: null }, ...salesData.map(sales => ({
|
||||
label: sales.nama,
|
||||
value: sales.id,
|
||||
}))];
|
||||
} catch (error) {
|
||||
console.error('Gagal mengambil data sales:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchData = async (date) => {
|
||||
if (!date) return;
|
||||
|
||||
@ -78,7 +58,8 @@ const fetchData = async (date) => {
|
||||
|
||||
try {
|
||||
const response = await axios.get(`/api/detail-laporan?tanggal=${date}`);
|
||||
data.value = response.data;;
|
||||
data.value = response.data;
|
||||
// console.log("Data berhasil diambil:", data.value);
|
||||
} catch (error) {
|
||||
console.error('Gagal mengambil data laporan:', error);
|
||||
data.value = null;
|
||||
@ -90,8 +71,6 @@ const fetchData = async (date) => {
|
||||
onMounted(() => {
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
tanggalDipilih.value = today;
|
||||
|
||||
fetchSales();
|
||||
});
|
||||
|
||||
watch(tanggalDipilih, (newDate) => {
|
||||
|
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 overflow-x-auto">
|
||||
<div class="mt-5">
|
||||
<table class="w-full border-collapse border border-C rounded-md">
|
||||
<thead>
|
||||
<tr class="bg-C text-D rounded-t-md">
|
||||
|
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 overflow-x-auto">
|
||||
<div class="mt-5">
|
||||
<table class="w-full border-collapse border border-C rounded-md">
|
||||
<thead>
|
||||
<tr class="bg-C text-D rounded-t-md">
|
||||
|
@ -144,7 +144,7 @@ const saveMove = async () => {
|
||||
},
|
||||
body:{
|
||||
id_nampan: selectedTrayId.value,
|
||||
id_produk: selectedItem.value.id_produk,
|
||||
id_produk: selectedItem.value.id_produk, // ikutkan id_produk karena API minta
|
||||
|
||||
},
|
||||
});
|
||||
|
@ -151,11 +151,7 @@ const akunToDelete = ref(null);
|
||||
const fetchAkun = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const response = await axios.get("/api/user", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
});
|
||||
const response = await axios.get("/api/user");
|
||||
akun.value = response.data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching akun:", error);
|
||||
@ -184,11 +180,7 @@ const hapusAkun = (item) => {
|
||||
|
||||
const confirmDelete = async () => {
|
||||
try {
|
||||
await axios.delete(`/api/user/${akunToDelete.value.id}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
});
|
||||
await axios.delete(`/api/user/${akunToDelete.value.id}`);
|
||||
fetchAkun();
|
||||
confirmDeleteOpen.value = false;
|
||||
} catch (error) {
|
||||
|
@ -1,7 +1,11 @@
|
||||
<template>
|
||||
<mainLayout>
|
||||
<!-- Modal Buat Item -->
|
||||
<CreateItemModal :isOpen="openItemModal" :product="editedProduct" @close="closeItemModal" />
|
||||
<CreateItemModal
|
||||
:isOpen="openItemModal"
|
||||
:product="editedProduct"
|
||||
@close="closeItemModal"
|
||||
/>
|
||||
|
||||
<div class="p-6">
|
||||
<p class="font-serif italic text-[25px] text-D">Edit Produk</p>
|
||||
@ -22,8 +26,7 @@
|
||||
<div class="mb-3 flex flex-row w-full gap-3">
|
||||
<div class="flex-1">
|
||||
<label class="block text-D mb-1">Berat (g)</label>
|
||||
<InputField v-model="form.berat" type="number" step="0.01" placeholder="Masukkan berat"
|
||||
@input="calculateHargaJual" />
|
||||
<InputField v-model="form.berat" type="number" step="0.01" placeholder="Masukkan berat" @input="calculateHargaJual" />
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<label class="block text-D mb-1">Kadar (K)</label>
|
||||
@ -34,8 +37,7 @@
|
||||
<div class="mb-3 flex flex-row w-full gap-3">
|
||||
<div class="flex-1">
|
||||
<label class="block text-D mb-1">Harga per Gram</label>
|
||||
<InputField v-model="form.harga_per_gram" type="number" step="0.01" placeholder="Masukkan harga per gram"
|
||||
@input="calculateHargaJual" />
|
||||
<InputField v-model="form.harga_per_gram" type="number" step="0.01" placeholder="Masukkan harga per gram" @input="calculateHargaJual" />
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<label class="block text-D mb-1">Harga Jual</label>
|
||||
@ -81,14 +83,12 @@
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
<p class="text-xs text-gray-600 font-medium"
|
||||
v-html="uploadLoading ? 'Uploading...' : 'Unggah<br/>Foto'"></p>
|
||||
<p class="text-xs text-gray-600 font-medium" v-html="uploadLoading ? 'Uploading...' : 'Unggah<br/>Foto'"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input ref="fileInput" type="file" multiple accept="image/jpeg,image/jpg,image/png" @change="handleFileSelect"
|
||||
class="hidden" />
|
||||
<input ref="fileInput" type="file" multiple accept="image/jpeg,image/jpg,image/png" @change="handleFileSelect" class="hidden" />
|
||||
|
||||
<p class="text-xs text-gray-500 mt-2">Format: JPG, JPEG, PNG (Max: 2MB per file, Max: 6 foto)</p>
|
||||
|
||||
@ -164,20 +164,12 @@ const calculateHargaJual = () => {
|
||||
};
|
||||
|
||||
const loadKategori = async () => {
|
||||
const response = await axios.get("/api/kategori", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
});
|
||||
const response = await axios.get("/api/kategori");
|
||||
category.value = response.data.map((c) => ({ value: c.id, label: c.nama }));
|
||||
};
|
||||
|
||||
const loadProduk = async () => {
|
||||
const response = await axios.get(`/api/produk/${productId}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
});
|
||||
const response = await axios.get(`/api/produk/${productId}`);
|
||||
const produk = response.data;
|
||||
form.value = {
|
||||
nama: produk.nama,
|
||||
@ -224,10 +216,7 @@ const uploadFiles = async (files) => {
|
||||
formData.append("foto", file);
|
||||
formData.append("id_user", userId.value);
|
||||
const res = await axios.post("/api/foto/upload", formData, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
"Content-Type": "multipart/form-data"
|
||||
},
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
});
|
||||
uploadedImages.value.push(res.data);
|
||||
}
|
||||
@ -238,11 +227,7 @@ const uploadFiles = async (files) => {
|
||||
|
||||
const removeImage = async (id) => {
|
||||
try {
|
||||
await axios.delete(`/api/foto/hapus/${id}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
});
|
||||
await axios.delete(`/api/foto/hapus/${id}`);
|
||||
uploadedImages.value = uploadedImages.value.filter((i) => i.id !== id);
|
||||
} catch {
|
||||
uploadError.value = "Gagal menghapus foto";
|
||||
|
Loading…
Reference in New Issue
Block a user