Compare commits
2 Commits
d51b73c347
...
55213cee64
Author | SHA1 | Date | |
---|---|---|---|
|
55213cee64 | ||
|
bfbe5d69a9 |
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Nampan;
|
use App\Models\Nampan;
|
||||||
|
use App\Models\Item;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class NampanController extends Controller
|
class NampanController extends Controller
|
||||||
@ -85,4 +86,14 @@ class NampanController extends Controller
|
|||||||
'message' => 'Nampan berhasil dihapus'
|
'message' => 'Nampan berhasil dihapus'
|
||||||
], 204);
|
], 204);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function kosongkan()
|
||||||
|
{
|
||||||
|
Item::query()->update(['id_nampan' => null]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Semua nampan berhasil dikosongkan'
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,44 +9,27 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
<div v-else class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||||
<div
|
<div v-for="tray in filteredTrays" :key="tray.id"
|
||||||
v-for="tray in filteredTrays"
|
class="border rounded-lg p-4 shadow-sm hover:shadow-md transition">
|
||||||
:key="tray.id"
|
|
||||||
class="border rounded-lg p-4 shadow-sm hover:shadow-md transition"
|
|
||||||
>
|
|
||||||
<div class="flex justify-between items-center mb-3">
|
<div class="flex justify-between items-center mb-3">
|
||||||
<h2 class="font-bold text-lg" style="color: #102C57;">{{ tray.nama }}</h2>
|
<h2 class="font-bold text-lg" style="color: #102C57;">{{ tray.nama }}</h2>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<button
|
<button class="p-2 rounded bg-yellow-400 hover:bg-yellow-500" @click="emit('edit', tray)">
|
||||||
class="p-2 rounded bg-yellow-400 hover:bg-yellow-500"
|
|
||||||
@click="emit('edit', tray)"
|
|
||||||
>
|
|
||||||
✏️
|
✏️
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button class="bg-red-500 text-white p-1 rounded" @click="emit('delete', tray.id)">
|
||||||
class="bg-red-500 text-white p-1 rounded"
|
|
||||||
@click="emit('delete', tray.id)"
|
|
||||||
>
|
|
||||||
🗑️
|
🗑️
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="tray.items && tray.items.length > 0" class="space-y-2 max-h-64 overflow-y-auto pr-2">
|
<div v-if="tray.items && tray.items.length > 0" class="space-y-2 max-h-64 overflow-y-auto pr-2">
|
||||||
<div
|
<div v-for="item in tray.items" :key="item.id" class="flex justify-between items-center border rounded-lg p-2"
|
||||||
v-for="item in tray.items"
|
@click="openMovePopup(item)">
|
||||||
:key="item.id"
|
|
||||||
class="flex justify-between items-center border rounded-lg p-2"
|
|
||||||
@click="openMovePopup(item)"
|
|
||||||
>
|
|
||||||
|
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<img
|
<img v-if="item.produk.foto && item.produk.foto.length > 0" :src="item.produk.foto[0].url"
|
||||||
v-if="item.produk.foto && item.produk.foto.length > 0"
|
alt="foto produk" class="w-12 h-12 object-cover rounded" />
|
||||||
:src="item.produk.foto[0].url"
|
|
||||||
alt="foto produk"
|
|
||||||
class="w-12 h-12 object-cover rounded"
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
<p class="text-sm" style="color: #102C57;">{{ item.produk.nama }}</p>
|
<p class="text-sm" style="color: #102C57;">{{ item.produk.nama }}</p>
|
||||||
<p class="text-sm" style="color: #102C57;">{{ item.produk.kategori }}</p>
|
<p class="text-sm" style="color: #102C57;">{{ item.produk.kategori }}</p>
|
||||||
@ -88,11 +71,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="tray-select" class="block text-sm font-medium text-gray-700 mb-1">Nama Nampan</label>
|
<label for="tray-select" class="block text-sm font-medium text-gray-700 mb-1">Nama Nampan</label>
|
||||||
<select
|
<select id="tray-select" v-model="selectedTrayId"
|
||||||
id="tray-select"
|
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50">
|
||||||
v-model="selectedTrayId"
|
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
|
|
||||||
>
|
|
||||||
<option value="" disabled>Pilih Nampan</option>
|
<option value="" disabled>Pilih Nampan</option>
|
||||||
<option v-for="tray in availableTrays" :key="tray.id" :value="tray.id">
|
<option v-for="tray in availableTrays" :key="tray.id" :value="tray.id">
|
||||||
{{ tray.nama }}
|
{{ tray.nama }}
|
||||||
@ -100,18 +80,12 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-end gap-2">
|
<div class="flex justify-end gap-2">
|
||||||
<button
|
<button @click="closePopup"
|
||||||
@click="closePopup"
|
class="px-4 py-2 rounded border border-gray-300 text-gray-700 hover:bg-gray-100 transition">
|
||||||
class="px-4 py-2 rounded border border-gray-300 text-gray-700 hover:bg-gray-100 transition"
|
|
||||||
>
|
|
||||||
Batal
|
Batal
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button @click="saveMove" :disabled="!selectedTrayId" class="px-4 py-2 rounded text-white transition"
|
||||||
@click="saveMove"
|
:class="selectedTrayId ? 'bg-orange-500 hover:bg-orange-600' : 'bg-gray-400 cursor-not-allowed'">
|
||||||
:disabled="!selectedTrayId"
|
|
||||||
class="px-4 py-2 rounded text-white transition"
|
|
||||||
:class="selectedTrayId ? 'bg-orange-500 hover:bg-orange-600' : 'bg-gray-400 cursor-not-allowed'"
|
|
||||||
>
|
|
||||||
Simpan
|
Simpan
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -150,7 +150,7 @@ const closeConfirmModal = () => { showConfirmModal.value = false }
|
|||||||
|
|
||||||
const confirmEmptyTray = async () => {
|
const confirmEmptyTray = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.post("/api/brankas", { action: "move_all_from_tray" })
|
await axios.delete("/api/kosongkan-nampan",)
|
||||||
alert("Semua item berhasil dipindahkan ke Brankas")
|
alert("Semua item berhasil dipindahkan ke Brankas")
|
||||||
closeConfirmModal()
|
closeConfirmModal()
|
||||||
location.reload()
|
location.reload()
|
||||||
|
@ -21,6 +21,7 @@ Route::prefix('api')->group(function () {
|
|||||||
Route::apiResource('kategori', KategoriController::class);
|
Route::apiResource('kategori', KategoriController::class);
|
||||||
|
|
||||||
Route::get('brankas', [ItemController::class, 'brankasItem']);
|
Route::get('brankas', [ItemController::class, 'brankasItem']);
|
||||||
|
Route::delete('kosongkan-nampan', [NampanController::class, 'kosongkan']);
|
||||||
|
|
||||||
// Foto Sementara
|
// Foto Sementara
|
||||||
Route::post('foto/upload', [FotoSementaraController::class, 'upload']);
|
Route::post('foto/upload', [FotoSementaraController::class, 'upload']);
|
||||||
|
Loading…
Reference in New Issue
Block a user