|
@@ -245,7 +245,7 @@
|
|
|
<div class="flex flex-wrap gap-2 max-h-[200px] overflow-y-auto pr-1">
|
|
<div class="flex flex-wrap gap-2 max-h-[200px] overflow-y-auto pr-1">
|
|
|
<div v-for="p in (editingOrder?.photos || [])" :key="p.id" class="relative group">
|
|
<div v-for="p in (editingOrder?.photos || [])" :key="p.id" class="relative group">
|
|
|
<img :src="`${RESOURCES_BASE_URL}/${p.file_path}`" class="w-12 h-12 object-cover rounded-lg border border-border/50 shadow-sm" />
|
|
<img :src="`${RESOURCES_BASE_URL}/${p.file_path}`" class="w-12 h-12 object-cover rounded-lg border border-border/50 shadow-sm" />
|
|
|
- <button type="button" @click="handleDeletePhoto(editingOrder.id, p.id)" class="absolute -top-1 -right-1 p-0.5 bg-rose-500 text-white rounded-full opacity-0 group-hover:opacity-100 transition-opacity shadow-lg">
|
|
|
|
|
|
|
+ <button type="button" @click="handleDeletePhoto(p.id)" class="absolute -top-1 -right-1 p-0.5 bg-rose-500 text-white rounded-full opacity-0 group-hover:opacity-100 transition-opacity shadow-lg">
|
|
|
<X class="w-2.5 h-2.5" />
|
|
<X class="w-2.5 h-2.5" />
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
@@ -327,7 +327,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { ref, watch, reactive, onMounted, onUnmounted } from "vue";
|
|
|
|
|
|
|
+import { ref, watch, reactive, computed, onMounted, onUnmounted } from "vue";
|
|
|
import { useRouter, useRoute, RouterLink } from "vue-router";
|
|
import { useRouter, useRoute, RouterLink } from "vue-router";
|
|
|
import { useI18n } from "vue-i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
|
import { loadAdminTranslations } from "@/i18n";
|
|
import { loadAdminTranslations } from "@/i18n";
|
|
@@ -336,7 +336,8 @@ import { toast } from "vue-sonner";
|
|
|
// Icons
|
|
// Icons
|
|
|
import {
|
|
import {
|
|
|
Package, Clock, RefreshCw, Search, Layers, Plus, Database,
|
|
Package, Clock, RefreshCw, Search, Layers, Plus, Database,
|
|
|
- Newspaper, History, X, Users, ImageIcon, Truck, CheckCircle2, XCircle, Star
|
|
|
|
|
|
|
+ Newspaper, History, X, Users, ImageIcon, Truck, CheckCircle2, XCircle, Star,
|
|
|
|
|
+ Trash2, MessageCircle, Edit2
|
|
|
} from "lucide-vue-next";
|
|
} from "lucide-vue-next";
|
|
|
|
|
|
|
|
// UI Components
|
|
// UI Components
|
|
@@ -480,8 +481,8 @@ onUnmounted(() => {
|
|
|
|
|
|
|
|
const newColor = ref("");
|
|
const newColor = ref("");
|
|
|
|
|
|
|
|
-const activeMaterials = computed(() => materials.value.filter(m => m.is_active));
|
|
|
|
|
-const selectedMaterialObj = computed(() => activeMaterials.value.find(m => m.name === orderForm.material_name));
|
|
|
|
|
|
|
+const activeMaterials = computed(() => materials.value.filter((m: any) => m.is_active));
|
|
|
|
|
+const selectedMaterialObj = computed(() => activeMaterials.value.find((m: any) => m.name === orderForm.material_name));
|
|
|
const materialColors = computed(() => {
|
|
const materialColors = computed(() => {
|
|
|
if (!selectedMaterialObj.value) return [];
|
|
if (!selectedMaterialObj.value) return [];
|
|
|
try {
|
|
try {
|
|
@@ -599,9 +600,16 @@ const handleDeleteFile = async (id: number, fid: number, fname: string) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const handleDeletePhoto = async (id: number) => {
|
|
|
|
|
|
|
+const handleDeletePhoto = async (photoId: number) => {
|
|
|
if (confirm(`Delete photo?`)) {
|
|
if (confirm(`Delete photo?`)) {
|
|
|
- try { await adminDeletePhoto(id); fetchData(); }
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ await adminDeletePhoto(photoId);
|
|
|
|
|
+ await fetchData();
|
|
|
|
|
+ if (editingOrder.value) {
|
|
|
|
|
+ const updated = orders.value.find(o => o.id === editingOrder.value?.id);
|
|
|
|
|
+ if (updated) editingOrder.value = updated;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
catch (err: any) { toast.error(err.message); }
|
|
catch (err: any) { toast.error(err.message); }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|