Commit the working vertical slices for inventory image processing and the Sale workflow, including Sale history, audited voiding, multi-item persistence, admin UI, migrations, documentation, and tests.
This commit is contained in:
@@ -11,7 +11,7 @@ const props = defineProps({
|
||||
errorMessage: { type: String, default: '' },
|
||||
isSaving: { type: Boolean, default: false },
|
||||
});
|
||||
const emit = defineEmits(['reorder', 'primary', 'alt-text', 'retry', 'delete']);
|
||||
const emit = defineEmits(['upload', 'reorder', 'primary', 'alt-text', 'retry', 'delete']);
|
||||
const altText = ref(props.images.find((image) => image.isPrimary)?.altText ?? '');
|
||||
const isEditingAltText = ref(false);
|
||||
const orderedImages = computed(() => [...props.images].sort((left, right) => left.sortOrder - right.sortOrder));
|
||||
@@ -20,6 +20,12 @@ function saveAltText() {
|
||||
emit('alt-text', altText.value);
|
||||
isEditingAltText.value = false;
|
||||
}
|
||||
|
||||
function handleFileChange(event) {
|
||||
const [file] = event.target.files;
|
||||
if (file) emit('upload', file);
|
||||
event.target.value = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -38,6 +44,11 @@ function saveAltText() {
|
||||
<button class="button button--secondary" type="button" @click="emit('retry')">Retry processing</button>
|
||||
</div>
|
||||
|
||||
<div class="admin-image-manager__upload">
|
||||
<label class="fixture-label" for="admin-image-upload">Add image</label>
|
||||
<input id="admin-image-upload" class="fixture-input" type="file" accept="image/jpeg,image/png,image/webp" :disabled="isSaving" @change="handleFileChange" />
|
||||
</div>
|
||||
|
||||
<ImageGallery :images="orderedImages" />
|
||||
|
||||
<p v-if="isSaving" class="state state--loading" role="status">Saving image changes...</p>
|
||||
@@ -66,5 +77,6 @@ function saveAltText() {
|
||||
.admin-image-manager__header { justify-content: space-between; }
|
||||
.admin-image-manager__header h2 { font-size: var(--text-xl); }
|
||||
.admin-image-manager__controls { display: grid; gap: var(--space-4); }
|
||||
.admin-image-manager__upload { display: grid; gap: var(--space-2); }
|
||||
.admin-image-manager__row--order { align-items: stretch; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user