diff --git a/app/composables/useTemplates.ts b/app/composables/useTemplates.ts index be3be66..c1866bf 100644 --- a/app/composables/useTemplates.ts +++ b/app/composables/useTemplates.ts @@ -11,6 +11,19 @@ export interface PrintTemplate { const STORAGE_KEY = 'printercentral-templates' +// Función para generar UUID compatible con todos los navegadores +function generateId(): string { + if (typeof crypto !== 'undefined' && crypto.randomUUID) { + return crypto.randomUUID() + } + // Fallback para navegadores sin crypto.randomUUID + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const r = Math.random() * 16 | 0 + const v = c === 'x' ? r : (r & 0x3 | 0x8) + return v.toString(16) + }) +} + export function useTemplates() { const templates = useState('templates', () => []) const initialized = useState('templatesInitialized', () => false) @@ -37,7 +50,7 @@ export function useTemplates() { function saveTemplate(name: string, description: string, operations: Operation[]): PrintTemplate { const template: PrintTemplate = { - id: crypto.randomUUID(), + id: generateId(), name, description, operations: JSON.parse(JSON.stringify(operations)), diff --git a/app/pages/index.vue b/app/pages/index.vue index 9757584..ac48086 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -3,6 +3,7 @@ const activeTab = ref('constructor') const isDesktop = useMediaQuery('(min-width: 768px)') const queue = usePrintQueue() const printers = usePrinters() +const showPrintersDrawer = ref(false) // Cargar impresoras al iniciar onMounted(() => { @@ -18,30 +19,42 @@ onMounted(() => {
- +
@@ -71,5 +84,15 @@ onMounted(() => { + + + + +
+ +
+