feat: push product images to cloud for the QR menu
local_backend now uploads each product's image file to cloud_backend during the existing ~5 min menu sync, so the QR menu can show real photos without needing a manually-set digital_image_url. Only re-uploads images whose content hash changed since the last push (Product.cloud_image_hash), to avoid re-sending unchanged binaries every cycle. Also adds a manual "sync now" trigger (POST /api/system/sync-menu) and a matching button in Settings → Operation, for pushing menu/price/image changes immediately instead of waiting for the next automatic cycle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -354,6 +354,43 @@ function QuickNotesSection({ settings, updateMut }) {
|
||||
)
|
||||
}
|
||||
|
||||
function CloudSyncSection() {
|
||||
const [syncing, setSyncing] = useState(false)
|
||||
|
||||
async function syncNow() {
|
||||
setSyncing(true)
|
||||
try {
|
||||
await client.post('/api/system/sync-menu')
|
||||
toast.success('Το μενού στάλθηκε στο cloud')
|
||||
} catch (e) {
|
||||
toast.error(e.response?.data?.detail || 'Η αποστολή απέτυχε — ελέγξτε τη σύνδεση')
|
||||
} finally {
|
||||
setSyncing(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<SectionCard
|
||||
title="Συγχρονισμός Ψηφιακού Μενού"
|
||||
description="Στέλνει ονόματα, περιγραφές, τιμές και φωτογραφίες προϊόντων στο cloud για το ψηφιακό μενού (QR). Γίνεται αυτόματα κάθε ~5 λεπτά."
|
||||
>
|
||||
<OptionRow
|
||||
label="Άμεσος συγχρονισμός"
|
||||
description="Στείλτε τις αλλαγές τώρα αντί να περιμένετε τον επόμενο αυτόματο κύκλο"
|
||||
>
|
||||
<button
|
||||
onClick={syncNow}
|
||||
disabled={syncing}
|
||||
className="flex items-center gap-1.5 h-8 px-3 rounded-lg border border-gray-200 bg-white text-gray-600 text-xs font-medium hover:bg-gray-50 hover:text-gray-800 transition-colors disabled:opacity-50"
|
||||
>
|
||||
<span className={syncing ? 'animate-spin inline-block' : 'inline-block'}>⭮</span>
|
||||
{syncing ? 'Συγχρονισμός…' : 'Συγχρονισμός τώρα'}
|
||||
</button>
|
||||
</OptionRow>
|
||||
</SectionCard>
|
||||
)
|
||||
}
|
||||
|
||||
function TableOrderSettingsSection() {
|
||||
const qc = useQueryClient()
|
||||
const { data: settings, isLoading } = useQuery({
|
||||
@@ -713,6 +750,7 @@ export default function OperationTab() {
|
||||
<AutoScheduleSection />
|
||||
<FlagDefsSection />
|
||||
<QuickTemplatesSection />
|
||||
<CloudSyncSection />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user