[FEAT] 更新 Admin 密碼與新增機台照片更新功能
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 40s

This commit is contained in:
2026-03-18 17:43:40 +08:00
parent 2afcdcebc5
commit 64ac398270
9 changed files with 350 additions and 82 deletions

View File

@@ -1,14 +1,7 @@
@extends('layouts.admin')
@section('content')
<div class="space-y-8 pb-20" x-data="{
selectedFiles: [null, null, null],
handleFileChange(e, index) {
if (e.target.files.length > 0) {
this.selectedFiles[index] = URL.createObjectURL(e.target.files[0]);
}
}
}">
<div class="space-y-8 pb-20">
<!-- Header -->
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-6">
<div class="flex items-center gap-4">
@@ -224,55 +217,6 @@
</div>
</div>
<!-- Machine Images Management -->
<div class="luxury-card rounded-3xl p-7 animate-luxury-in" style="animation-delay: 400ms">
<div class="flex items-center gap-3 mb-6">
<div class="w-10 h-10 rounded-xl bg-indigo-500/10 flex items-center justify-center text-indigo-500">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"/></svg>
</div>
<h3 class="text-lg font-black text-slate-800 dark:text-white tracking-tight">{{ __('Machine Images') }}</h3>
</div>
<div class="space-y-6">
<div class="grid grid-cols-3 gap-4">
@for($i = 0; $i < 3; $i++)
<div class="relative group">
<label class="relative flex flex-col items-center justify-center aspect-square border-2 border-dashed border-slate-200 dark:border-slate-800 rounded-3xl cursor-pointer bg-slate-50/50 dark:bg-slate-900/50 hover:bg-slate-100 dark:hover:bg-slate-800/80 transition-all overflow-hidden">
<!-- Current Image or Preview -->
<div class="absolute inset-0 w-full h-full">
@if(isset($machine->image_urls[$i]))
<img src="{{ $machine->image_urls[$i] }}" class="w-full h-full object-cover" x-show="!selectedFiles[{{ $i }}]">
@endif
<template x-if="selectedFiles[{{ $i }}]">
<img :src="selectedFiles[{{ $i }}]" class="w-full h-full object-cover">
</template>
</div>
<!-- Overlay for Empty/Hover -->
<div class="relative z-10 flex flex-col items-center justify-center p-4 bg-white/60 dark:bg-black/40 backdrop-blur-sm opacity-0 group-hover:opacity-100 transition-opacity w-full h-full"
:class="{'opacity-100': !selectedFiles[{{ $i }}] && !@json(isset($machine->image_urls[$i]))}">
<svg class="w-6 h-6 mb-1 text-slate-500 dark:text-slate-200" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M12 4v16m8-8H4" />
</svg>
<span class="text-[10px] font-black uppercase tracking-widest text-slate-600 dark:text-slate-200">
{{ isset($machine->image_urls[$i]) || false ? __('Change') : __('Upload') }}
</span>
</div>
<input type="file" name="images[{{ $i }}]" accept="image/*" class="hidden" @change="handleFileChange($event, {{ $i }})">
</label>
<div class="mt-2 text-center">
<span class="text-[9px] font-black text-slate-400 uppercase tracking-[0.2em]">{{ __('Slot') }} {{ $i + 1 }}</span>
</div>
</div>
@endfor
</div>
<p class="text-[10px] text-slate-400 mt-4 font-bold uppercase tracking-widest leading-relaxed">
* {{ __('You can upload images one by one. Supporting up to 3 slots.') }}<br>
* {{ __('Click any slot to select or replace a photo.') }}
</p>
</div>
</div>
</div>
</div>
</form>