Resolver conflicto documents
This commit is contained in:
commit
9979e020f3
27
src/components/Holos/Button/ButtonRh.vue
Normal file
27
src/components/Holos/Button/ButtonRh.vue
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<script setup>
|
||||||
|
import GoogleIcon from "@Shared/GoogleIcon.vue";
|
||||||
|
defineProps({
|
||||||
|
type: {
|
||||||
|
default: "button",
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
default: "add",
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
default: "",
|
||||||
|
type: String,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button
|
||||||
|
:type="type"
|
||||||
|
class="inline-flex items-center gap-3 bg-[#2563eb] hover:bg-[#1e40af] text-white px-4 py-2 rounded-full shadow-md"
|
||||||
|
>
|
||||||
|
<GoogleIcon :name="icon" />
|
||||||
|
<span>{{ text }}</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
650
src/components/Holos/PDF/Canvas.vue
Normal file
650
src/components/Holos/PDF/Canvas.vue
Normal file
@ -0,0 +1,650 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed, nextTick, watch } from 'vue';
|
||||||
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
|
||||||
|
/** Propiedades */
|
||||||
|
const props = defineProps({
|
||||||
|
element: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
isSelected: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Eventos */
|
||||||
|
const emit = defineEmits(['select', 'delete', 'update', 'move']);
|
||||||
|
|
||||||
|
/** Referencias */
|
||||||
|
const isEditing = ref(false);
|
||||||
|
const editValue = ref('');
|
||||||
|
const editInput = ref(null);
|
||||||
|
const editTextarea = ref(null);
|
||||||
|
const elementRef = ref(null);
|
||||||
|
const isDragging = ref(false);
|
||||||
|
const isResizing = ref(false);
|
||||||
|
const resizeDirection = ref(null); // 'corner', 'right', 'bottom'
|
||||||
|
const dragStart = ref({ x: 0, y: 0 });
|
||||||
|
const resizeStart = ref({ x: 0, y: 0, width: 0, height: 0 });
|
||||||
|
const fileInput = ref(null);
|
||||||
|
|
||||||
|
/** Propiedades computadas */
|
||||||
|
const elementStyles = computed(() => {
|
||||||
|
const baseStyles = {
|
||||||
|
left: `${props.element.x}px`,
|
||||||
|
top: `${props.element.y}px`,
|
||||||
|
width: `${props.element.width || 200}px`,
|
||||||
|
height: `${props.element.height || 40}px`
|
||||||
|
};
|
||||||
|
|
||||||
|
// Aplicar estilos de formato para elementos de texto
|
||||||
|
if (props.element.type === 'text' && props.element.formatting) {
|
||||||
|
const formatting = props.element.formatting;
|
||||||
|
|
||||||
|
if (formatting.fontSize) {
|
||||||
|
baseStyles.fontSize = `${formatting.fontSize}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formatting.color) {
|
||||||
|
baseStyles.color = formatting.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseStyles;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Propiedades computadas para clases CSS dinámicas
|
||||||
|
const textContainerClasses = computed(() => {
|
||||||
|
if (props.element.type !== 'text') return {};
|
||||||
|
|
||||||
|
const formatting = props.element.formatting || {};
|
||||||
|
|
||||||
|
return {
|
||||||
|
'font-bold': formatting.bold,
|
||||||
|
'italic': formatting.italic,
|
||||||
|
'underline': formatting.underline,
|
||||||
|
'text-left': !formatting.textAlign || formatting.textAlign === 'left',
|
||||||
|
'text-center': formatting.textAlign === 'center',
|
||||||
|
'text-right': formatting.textAlign === 'right',
|
||||||
|
'justify-start': !formatting.textAlign || formatting.textAlign === 'left',
|
||||||
|
'justify-center': formatting.textAlign === 'center',
|
||||||
|
'justify-end': formatting.textAlign === 'right'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const inputClasses = computed(() => {
|
||||||
|
if (props.element.type !== 'text') return {};
|
||||||
|
|
||||||
|
const formatting = props.element.formatting || {};
|
||||||
|
|
||||||
|
return {
|
||||||
|
'font-bold': formatting.bold,
|
||||||
|
'italic': formatting.italic,
|
||||||
|
'underline': formatting.underline,
|
||||||
|
'text-left': !formatting.textAlign || formatting.textAlign === 'left',
|
||||||
|
'text-center': formatting.textAlign === 'center',
|
||||||
|
'text-right': formatting.textAlign === 'right'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const inputStyles = computed(() => {
|
||||||
|
if (props.element.type !== 'text') return {};
|
||||||
|
|
||||||
|
const formatting = props.element.formatting || {};
|
||||||
|
const styles = {};
|
||||||
|
|
||||||
|
if (formatting.fontSize) {
|
||||||
|
styles.fontSize = `${formatting.fontSize}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formatting.color) {
|
||||||
|
styles.color = formatting.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Watchers */
|
||||||
|
watch(() => props.isSelected, (selected) => {
|
||||||
|
if (selected && isEditing.value) {
|
||||||
|
nextTick(() => {
|
||||||
|
if (props.element.type === 'text' && editInput.value) {
|
||||||
|
editInput.value.focus();
|
||||||
|
editInput.value.select();
|
||||||
|
} else if (props.element.type === 'code' && editTextarea.value) {
|
||||||
|
editTextarea.value.focus();
|
||||||
|
editTextarea.value.select();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Métodos */
|
||||||
|
const handleSelect = (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
emit('select', props.element.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDelete = () => {
|
||||||
|
emit('delete', props.element.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
const startEditing = () => {
|
||||||
|
if (props.element.type === 'table' && props.element.content) {
|
||||||
|
// Deep copy para evitar mutaciones directas
|
||||||
|
editValue.value = JSON.parse(JSON.stringify(props.element.content));
|
||||||
|
} else if (props.element.type === 'code') {
|
||||||
|
editValue.value = props.element.content || 'console.log("Hola mundo");';
|
||||||
|
} else {
|
||||||
|
editValue.value = props.element.content || getDefaultEditValue();
|
||||||
|
}
|
||||||
|
isEditing.value = true;
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
if (editTextarea.value) editTextarea.value.focus();
|
||||||
|
if (editInput.value) editInput.value.focus();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const finishEditing = () => {
|
||||||
|
if (isEditing.value) {
|
||||||
|
isEditing.value = false;
|
||||||
|
|
||||||
|
// Para tablas, emitir el objeto completo
|
||||||
|
if (props.element.type === 'table') {
|
||||||
|
emit('update', {
|
||||||
|
id: props.element.id,
|
||||||
|
content: editValue.value
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
emit('update', {
|
||||||
|
id: props.element.id,
|
||||||
|
content: editValue.value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKeydown = (event) => {
|
||||||
|
if (props.element.type === 'text') {
|
||||||
|
if (event.key === 'Enter' && !event.shiftKey) {
|
||||||
|
event.preventDefault();
|
||||||
|
finishEditing();
|
||||||
|
} else if (event.key === 'Escape') {
|
||||||
|
isEditing.value = false;
|
||||||
|
editValue.value = props.element.content || 'Nuevo texto';
|
||||||
|
}
|
||||||
|
} else if (props.element.type === 'code') {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
isEditing.value = false;
|
||||||
|
editValue.value = props.element.content || 'console.log("Hola mundo");';
|
||||||
|
}
|
||||||
|
// Para código, permitimos Enter normal y usamos Ctrl+Enter para terminar
|
||||||
|
if (event.key === 'Enter' && event.ctrlKey) {
|
||||||
|
event.preventDefault();
|
||||||
|
finishEditing();
|
||||||
|
}
|
||||||
|
} else if (props.element.type === 'table') {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
isEditing.value = false;
|
||||||
|
// Restaurar el contenido original de la tabla
|
||||||
|
editValue.value = props.element.content ?
|
||||||
|
JSON.parse(JSON.stringify(props.element.content)) :
|
||||||
|
getDefaultEditValue();
|
||||||
|
}
|
||||||
|
// Para tablas, Enter normal para nueva línea en celda, Ctrl+Enter para terminar
|
||||||
|
if (event.key === 'Enter' && event.ctrlKey) {
|
||||||
|
event.preventDefault();
|
||||||
|
finishEditing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Manejo de archivo de imagen
|
||||||
|
const handleFileSelect = (event) => {
|
||||||
|
const file = event.target.files[0];
|
||||||
|
if (file && file.type.startsWith('image/')) {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = (e) => {
|
||||||
|
emit('update', {
|
||||||
|
id: props.element.id,
|
||||||
|
content: e.target.result,
|
||||||
|
fileName: file.name
|
||||||
|
});
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
}
|
||||||
|
// Limpiar el input
|
||||||
|
event.target.value = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
// Funcionalidad de arrastre
|
||||||
|
const handleMouseDown = (event) => {
|
||||||
|
if (isEditing.value || isResizing.value) return;
|
||||||
|
|
||||||
|
isDragging.value = true;
|
||||||
|
dragStart.value = {
|
||||||
|
x: event.clientX - props.element.x,
|
||||||
|
y: event.clientY - props.element.y
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', handleMouseMove);
|
||||||
|
document.addEventListener('mouseup', handleMouseUp);
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseMove = (event) => {
|
||||||
|
if (isDragging.value && !isResizing.value) {
|
||||||
|
const newX = event.clientX - dragStart.value.x;
|
||||||
|
const newY = event.clientY - dragStart.value.y;
|
||||||
|
|
||||||
|
emit('move', {
|
||||||
|
id: props.element.id,
|
||||||
|
x: Math.max(0, newX),
|
||||||
|
y: Math.max(0, newY)
|
||||||
|
});
|
||||||
|
} else if (isResizing.value && !isDragging.value) {
|
||||||
|
handleResizeMove(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseUp = () => {
|
||||||
|
isDragging.value = false;
|
||||||
|
isResizing.value = false;
|
||||||
|
resizeDirection.value = null;
|
||||||
|
document.removeEventListener('mousemove', handleMouseMove);
|
||||||
|
document.removeEventListener('mouseup', handleMouseUp);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Funcionalidad de redimensionamiento por esquina
|
||||||
|
const startResize = (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
isResizing.value = true;
|
||||||
|
resizeDirection.value = 'corner';
|
||||||
|
resizeStart.value = {
|
||||||
|
x: event.clientX,
|
||||||
|
y: event.clientY,
|
||||||
|
width: props.element.width || 200,
|
||||||
|
height: props.element.height || 40
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', handleMouseMove);
|
||||||
|
document.addEventListener('mouseup', handleMouseUp);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Funcionalidad de redimensionamiento por bordes
|
||||||
|
const startResizeEdge = (event, direction) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
isResizing.value = true;
|
||||||
|
resizeDirection.value = direction;
|
||||||
|
resizeStart.value = {
|
||||||
|
x: event.clientX,
|
||||||
|
y: event.clientY,
|
||||||
|
width: props.element.width || 200,
|
||||||
|
height: props.element.height || 40
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', handleMouseMove);
|
||||||
|
document.addEventListener('mouseup', handleMouseUp);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleResizeMove = (event) => {
|
||||||
|
if (!isResizing.value) return;
|
||||||
|
|
||||||
|
const deltaX = event.clientX - resizeStart.value.x;
|
||||||
|
const deltaY = event.clientY - resizeStart.value.y;
|
||||||
|
|
||||||
|
let newWidth = resizeStart.value.width;
|
||||||
|
let newHeight = resizeStart.value.height;
|
||||||
|
|
||||||
|
// Calcular nuevas dimensiones según la dirección
|
||||||
|
if (resizeDirection.value === 'corner') {
|
||||||
|
newWidth = Math.max(getMinWidth(), Math.min(getMaxWidth(), resizeStart.value.width + deltaX));
|
||||||
|
newHeight = Math.max(getMinHeight(), Math.min(getMaxHeight(), resizeStart.value.height + deltaY));
|
||||||
|
} else if (resizeDirection.value === 'right') {
|
||||||
|
newWidth = Math.max(getMinWidth(), Math.min(getMaxWidth(), resizeStart.value.width + deltaX));
|
||||||
|
} else if (resizeDirection.value === 'bottom') {
|
||||||
|
newHeight = Math.max(getMinHeight(), Math.min(getMaxHeight(), resizeStart.value.height + deltaY));
|
||||||
|
}
|
||||||
|
|
||||||
|
emit('update', {
|
||||||
|
id: props.element.id,
|
||||||
|
width: newWidth,
|
||||||
|
height: newHeight
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Obtener tamaños mínimos según el tipo de elemento
|
||||||
|
const getMinWidth = () => {
|
||||||
|
switch (props.element.type) {
|
||||||
|
case 'text':
|
||||||
|
return 100;
|
||||||
|
case 'image':
|
||||||
|
return 100;
|
||||||
|
case 'table':
|
||||||
|
return 200;
|
||||||
|
default:
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getMinHeight = () => {
|
||||||
|
switch (props.element.type) {
|
||||||
|
case 'text':
|
||||||
|
return 30;
|
||||||
|
case 'image':
|
||||||
|
return 80;
|
||||||
|
case 'table':
|
||||||
|
return 80;
|
||||||
|
default:
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Obtener tamaños máximos según el tipo de elemento
|
||||||
|
const getMaxWidth = () => {
|
||||||
|
return 800; // Máximo general
|
||||||
|
};
|
||||||
|
|
||||||
|
const getMaxHeight = () => {
|
||||||
|
return 600; // Máximo general
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
ref="elementRef"
|
||||||
|
:style="elementStyles"
|
||||||
|
@click="handleSelect"
|
||||||
|
@dblclick="startEditing"
|
||||||
|
@mousedown="handleMouseDown"
|
||||||
|
class="absolute group select-none"
|
||||||
|
:class="{
|
||||||
|
'ring-2 ring-blue-500 ring-opacity-50': isSelected,
|
||||||
|
'cursor-move': !isEditing && !isResizing,
|
||||||
|
'cursor-text': isEditing && (element.type === 'text' || element.type === 'code'),
|
||||||
|
'cursor-se-resize': isResizing && resizeDirection === 'corner',
|
||||||
|
'cursor-e-resize': isResizing && resizeDirection === 'right',
|
||||||
|
'cursor-s-resize': isResizing && resizeDirection === 'bottom',
|
||||||
|
'z-50': isSelected,
|
||||||
|
'z-10': !isSelected
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<!-- Input oculto para selección de archivos -->
|
||||||
|
<input
|
||||||
|
ref="fileInput"
|
||||||
|
type="file"
|
||||||
|
accept="image/*"
|
||||||
|
@change="handleFileSelect"
|
||||||
|
class="hidden"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Elemento de Texto con formato aplicado -->
|
||||||
|
<div
|
||||||
|
v-if="element.type === 'text'"
|
||||||
|
class="w-full h-full flex items-center px-3 py-2 bg-white rounded border border-gray-300 shadow-sm dark:bg-white dark:border-gray-400"
|
||||||
|
:class="textContainerClasses"
|
||||||
|
:style="{
|
||||||
|
fontSize: element.formatting?.fontSize ? `${element.formatting.fontSize}px` : '14px',
|
||||||
|
color: element.formatting?.color || '#374151'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-if="isEditing"
|
||||||
|
ref="editInput"
|
||||||
|
v-model="editValue"
|
||||||
|
@blur="finishEditing"
|
||||||
|
@keydown="handleKeydown"
|
||||||
|
class="w-full bg-transparent outline-none cursor-text"
|
||||||
|
:class="inputClasses"
|
||||||
|
:style="inputStyles"
|
||||||
|
@mousedown.stop
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
v-else
|
||||||
|
class="truncate pointer-events-none w-full"
|
||||||
|
:class="textContainerClasses"
|
||||||
|
:style="{
|
||||||
|
fontSize: element.formatting?.fontSize ? `${element.formatting.fontSize}px` : '14px',
|
||||||
|
color: element.formatting?.color || '#374151'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{ element.content || 'Nuevo texto' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Elemento de Imagen (sin cambios) -->
|
||||||
|
<div
|
||||||
|
v-else-if="element.type === 'image'"
|
||||||
|
class="w-full h-full flex items-center justify-center bg-gray-100 rounded border border-gray-300 dark:bg-primary/10 dark:border-primary/20 overflow-hidden"
|
||||||
|
>
|
||||||
|
<!-- Si hay imagen cargada -->
|
||||||
|
<img
|
||||||
|
v-if="element.content && element.content.startsWith('data:image')"
|
||||||
|
:src="element.content"
|
||||||
|
:alt="element.fileName || 'Imagen'"
|
||||||
|
class="w-full h-full object-cover pointer-events-none"
|
||||||
|
/>
|
||||||
|
<!-- Placeholder para imagen -->
|
||||||
|
<div v-else class="flex flex-col items-center justify-center text-gray-400 dark:text-primary-dt/50 p-4">
|
||||||
|
<GoogleIcon name="image" class="text-2xl mb-1" />
|
||||||
|
<span class="text-xs text-center">Haz doble clic para cargar imagen</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Elemento de Tabla (sin cambios en esta parte) -->
|
||||||
|
<div
|
||||||
|
v-else-if="element.type === 'table'"
|
||||||
|
class="w-full h-full bg-white rounded border overflow-hidden"
|
||||||
|
>
|
||||||
|
<div v-if="element.content && element.content.data" class="w-full h-full">
|
||||||
|
<table class="w-full h-full text-xs border-collapse">
|
||||||
|
<thead v-if="element.content.data.length > 0">
|
||||||
|
<tr class="bg-blue-50 dark:bg-blue-900/20">
|
||||||
|
<th
|
||||||
|
v-for="(header, colIndex) in element.content.data[0]"
|
||||||
|
:key="colIndex"
|
||||||
|
class="border border-gray-300 dark:border-primary/20 px-1 py-1 text-left font-semibold text-blue-800 dark:text-blue-300"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-if="isEditing"
|
||||||
|
v-model="editValue.data[0][colIndex]"
|
||||||
|
class="w-full bg-transparent outline-none text-xs"
|
||||||
|
@mousedown.stop
|
||||||
|
@click.stop
|
||||||
|
@focus.stop
|
||||||
|
/>
|
||||||
|
<span v-else class="truncate">{{ header }}</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr
|
||||||
|
v-for="(row, rowIndex) in element.content.data.slice(1)"
|
||||||
|
:key="rowIndex"
|
||||||
|
class="hover:bg-gray-50 dark:hover:bg-primary/5"
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
v-for="(cell, colIndex) in row"
|
||||||
|
:key="colIndex"
|
||||||
|
class="border border-gray-300 dark:border-primary/20 px-1 py-1"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-if="isEditing"
|
||||||
|
v-model="editValue.data[rowIndex + 1][colIndex]"
|
||||||
|
class="w-full bg-transparent outline-none text-xs"
|
||||||
|
@mousedown.stop
|
||||||
|
@click.stop
|
||||||
|
@focus.stop
|
||||||
|
/>
|
||||||
|
<span v-else class="truncate text-gray-700 dark:text-primary-dt">{{ cell }}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!-- Placeholder para tabla vacía -->
|
||||||
|
<div v-else class="flex flex-col items-center justify-center text-gray-400 dark:text-primary-dt/50 p-4">
|
||||||
|
<GoogleIcon name="table_chart" class="text-2xl mb-1" />
|
||||||
|
<span class="text-xs text-center">Doble clic para editar tabla</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Controles del elemento con z-index más alto -->
|
||||||
|
<div
|
||||||
|
v-if="isSelected && !isEditing"
|
||||||
|
class="absolute -top-8 right-0 flex gap-1 opacity-100 transition-opacity z-[60]"
|
||||||
|
>
|
||||||
|
<!-- Indicador de tamaño -->
|
||||||
|
<div class="px-2 py-1 bg-gray-800 text-white text-xs rounded shadow-sm pointer-events-none">
|
||||||
|
{{ Math.round(element.width || 200) }} × {{ Math.round(element.height || 40) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Botón para cargar imagen (solo para elementos de imagen) -->
|
||||||
|
<button
|
||||||
|
v-if="element.type === 'image'"
|
||||||
|
@click.stop="() => fileInput.click()"
|
||||||
|
class="w-6 h-6 bg-blue-500 hover:bg-blue-600 text-white rounded text-xs flex items-center justify-center transition-colors shadow-sm"
|
||||||
|
title="Cargar imagen"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="upload" class="text-xs" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Botón eliminar -->
|
||||||
|
<button
|
||||||
|
@click.stop="handleDelete"
|
||||||
|
class="w-6 h-6 bg-red-500 hover:bg-red-600 text-white rounded text-xs flex items-center justify-center transition-colors shadow-sm"
|
||||||
|
title="Eliminar"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="close" class="text-xs" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Controles de redimensionamiento mejorados -->
|
||||||
|
<div v-if="isSelected && !isEditing" class="absolute inset-0 pointer-events-none z-[55]">
|
||||||
|
<!-- Esquina inferior derecha - MÁS GRANDE Y VISIBLE -->
|
||||||
|
<div
|
||||||
|
@mousedown.stop="startResize"
|
||||||
|
class="absolute -bottom-2 -right-2 w-4 h-4 bg-blue-500 border-2 border-white cursor-se-resize pointer-events-auto rounded-sm shadow-md hover:bg-blue-600 transition-all"
|
||||||
|
title="Redimensionar"
|
||||||
|
>
|
||||||
|
<div class="absolute inset-0.5 bg-white/30 rounded-sm"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Lado derecho - MÁS VISIBLE -->
|
||||||
|
<div
|
||||||
|
@mousedown.stop="(event) => startResizeEdge(event, 'right')"
|
||||||
|
class="absolute top-2 bottom-2 -right-1 w-2 bg-blue-500 cursor-e-resize pointer-events-auto rounded-sm shadow-sm hover:bg-blue-600 transition-all"
|
||||||
|
title="Redimensionar ancho"
|
||||||
|
>
|
||||||
|
<!-- Indicador visual en el centro -->
|
||||||
|
<div class="absolute top-1/2 left-1/2 w-0.5 h-4 bg-white/60 -translate-x-1/2 -translate-y-1/2 rounded-full"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Lado inferior - MÁS VISIBLE -->
|
||||||
|
<div
|
||||||
|
@mousedown.stop="(event) => startResizeEdge(event, 'bottom')"
|
||||||
|
class="absolute -bottom-1 left-2 right-2 h-2 bg-blue-500 cursor-s-resize pointer-events-auto rounded-sm shadow-sm hover:bg-blue-600 transition-all"
|
||||||
|
title="Redimensionar alto"
|
||||||
|
>
|
||||||
|
<!-- Indicador visual en el centro -->
|
||||||
|
<div class="absolute top-1/2 left-1/2 w-4 h-0.5 bg-white/60 -translate-x-1/2 -translate-y-1/2 rounded-full"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Esquinas adicionales para mejor UX -->
|
||||||
|
<div
|
||||||
|
@mousedown.stop="startResize"
|
||||||
|
class="absolute -top-2 -left-2 w-4 h-4 bg-blue-500 border-2 border-white cursor-nw-resize pointer-events-auto rounded-sm shadow-md hover:bg-blue-600 transition-all"
|
||||||
|
title="Redimensionar"
|
||||||
|
>
|
||||||
|
<div class="absolute inset-0.5 bg-white/30 rounded-sm"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
@mousedown.stop="startResize"
|
||||||
|
class="absolute -top-2 -right-2 w-4 h-4 bg-blue-500 border-2 border-white cursor-ne-resize pointer-events-auto rounded-sm shadow-md hover:bg-blue-600 transition-all"
|
||||||
|
title="Redimensionar"
|
||||||
|
>
|
||||||
|
<div class="absolute inset-0.5 bg-white/30 rounded-sm"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
@mousedown.stop="startResize"
|
||||||
|
class="absolute -bottom-2 -left-2 w-4 h-4 bg-blue-500 border-2 border-white cursor-sw-resize pointer-events-auto rounded-sm shadow-md hover:bg-blue-600 transition-all"
|
||||||
|
title="Redimensionar"
|
||||||
|
>
|
||||||
|
<div class="absolute inset-0.5 bg-white/30 rounded-sm"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Indicador de arrastre -->
|
||||||
|
<div
|
||||||
|
v-if="isDragging"
|
||||||
|
class="absolute inset-0 bg-blue-500 opacity-20 rounded pointer-events-none"
|
||||||
|
></div>
|
||||||
|
|
||||||
|
<!-- Indicador de redimensionamiento -->
|
||||||
|
<div
|
||||||
|
v-if="isResizing"
|
||||||
|
class="absolute inset-0 bg-green-500 opacity-20 rounded pointer-events-none"
|
||||||
|
></div>
|
||||||
|
|
||||||
|
<!-- Botón para terminar edición de tabla -->
|
||||||
|
<div
|
||||||
|
v-if="isEditing && element.type === 'table'"
|
||||||
|
class="absolute -bottom-10 left-0 flex gap-2 z-[60]"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
@click="finishEditing"
|
||||||
|
class="px-3 py-1 bg-green-600 hover:bg-green-700 text-white text-xs rounded shadow-sm transition-colors"
|
||||||
|
>
|
||||||
|
Guardar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="() => { isEditing = false; editValue = JSON.parse(JSON.stringify(element.content)); }"
|
||||||
|
class="px-3 py-1 bg-gray-600 hover:bg-gray-700 text-white text-xs rounded shadow-sm transition-colors"
|
||||||
|
>
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Estilos existentes sin cambios... */
|
||||||
|
.resize-handle-corner {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle-corner:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle-edge {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle-edge:hover {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.group:hover .resize-handle-edge {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-none {
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
64
src/components/Holos/PDF/Draggable.vue
Normal file
64
src/components/Holos/PDF/Draggable.vue
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
|
||||||
|
/** Propiedades */
|
||||||
|
const props = defineProps({
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
icon: String,
|
||||||
|
title: String,
|
||||||
|
description: String,
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Eventos */
|
||||||
|
const emit = defineEmits(['dragstart']);
|
||||||
|
|
||||||
|
/** Referencias */
|
||||||
|
const isDragging = ref(false);
|
||||||
|
|
||||||
|
/** Métodos */
|
||||||
|
const handleDragStart = (event) => {
|
||||||
|
isDragging.value = true;
|
||||||
|
event.dataTransfer.setData('text/plain', JSON.stringify({
|
||||||
|
type: props.type,
|
||||||
|
title: props.title
|
||||||
|
}));
|
||||||
|
emit('dragstart', props.type);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDragEnd = () => {
|
||||||
|
isDragging.value = false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
draggable="true"
|
||||||
|
@dragstart="handleDragStart"
|
||||||
|
@dragend="handleDragEnd"
|
||||||
|
class="flex items-center gap-3 p-3 rounded-lg border border-gray-200 bg-white cursor-grab hover:bg-gray-50 hover:border-blue-300 transition-colors dark:bg-primary-d dark:border-primary/20 dark:hover:bg-primary/10"
|
||||||
|
:class="{
|
||||||
|
'opacity-50 cursor-grabbing': isDragging,
|
||||||
|
'shadow-sm hover:shadow-md': !isDragging
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div class="flex-shrink-0 w-8 h-8 rounded-md bg-blue-100 flex items-center justify-center dark:bg-blue-900/30">
|
||||||
|
<GoogleIcon
|
||||||
|
:name="icon"
|
||||||
|
class="text-blue-600 dark:text-blue-400 text-lg"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="text-sm font-medium text-gray-900 dark:text-primary-dt">
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-500 dark:text-primary-dt/70 truncate">
|
||||||
|
{{ description }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
353
src/components/Holos/PDF/PDFViewport.vue
Normal file
353
src/components/Holos/PDF/PDFViewport.vue
Normal file
@ -0,0 +1,353 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed, nextTick, watch } from 'vue';
|
||||||
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
import PageSizeSelector from '@Holos/PDF/PageSizeSelector.vue';
|
||||||
|
|
||||||
|
/** Propiedades */
|
||||||
|
const props = defineProps({
|
||||||
|
pages: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [{ id: 1, elements: [] }]
|
||||||
|
},
|
||||||
|
selectedElementId: String,
|
||||||
|
isExporting: Boolean
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Eventos */
|
||||||
|
const emit = defineEmits(['drop', 'dragover', 'click', 'add-page', 'delete-page', 'page-change', 'page-size-change']);
|
||||||
|
|
||||||
|
/** Referencias */
|
||||||
|
const viewportRef = ref(null);
|
||||||
|
const currentPage = ref(1);
|
||||||
|
const pageSize = ref('A4');
|
||||||
|
|
||||||
|
/** Tamaños de página */
|
||||||
|
const pageSizes = {
|
||||||
|
'A4': { width: 794, height: 1123, label: '210 × 297 mm' },
|
||||||
|
'A3': { width: 1123, height: 1587, label: '297 × 420 mm' },
|
||||||
|
'Letter': { width: 816, height: 1056, label: '216 × 279 mm' },
|
||||||
|
'Legal': { width: 816, height: 1344, label: '216 × 356 mm' },
|
||||||
|
'Tabloid': { width: 1056, height: 1632, label: '279 × 432 mm' }
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Constantes de diseño ajustadas */
|
||||||
|
const PAGE_MARGIN = 50;
|
||||||
|
const ZOOM_LEVEL = 0.65;
|
||||||
|
|
||||||
|
/** Propiedades computadas */
|
||||||
|
const currentPageSize = computed(() => pageSizes[pageSize.value]);
|
||||||
|
const PAGE_WIDTH = computed(() => currentPageSize.value.width);
|
||||||
|
const PAGE_HEIGHT = computed(() => currentPageSize.value.height);
|
||||||
|
const scaledPageWidth = computed(() => PAGE_WIDTH.value * ZOOM_LEVEL);
|
||||||
|
const scaledPageHeight = computed(() => PAGE_HEIGHT.value * ZOOM_LEVEL);
|
||||||
|
const totalPages = computed(() => props.pages.length);
|
||||||
|
|
||||||
|
/** Watchers */
|
||||||
|
watch(pageSize, (newSize) => {
|
||||||
|
emit('page-size-change', {
|
||||||
|
size: newSize,
|
||||||
|
dimensions: pageSizes[newSize]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Métodos */
|
||||||
|
const handleDrop = (event, pageIndex) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const pageElement = event.currentTarget;
|
||||||
|
const rect = pageElement.getBoundingClientRect();
|
||||||
|
|
||||||
|
const relativeX = (event.clientX - rect.left) / ZOOM_LEVEL;
|
||||||
|
const relativeY = (event.clientY - rect.top) / ZOOM_LEVEL;
|
||||||
|
|
||||||
|
emit('drop', {
|
||||||
|
originalEvent: event,
|
||||||
|
pageIndex,
|
||||||
|
x: Math.max(0, Math.min(PAGE_WIDTH.value, relativeX)),
|
||||||
|
y: Math.max(0, Math.min(PAGE_HEIGHT.value, relativeY))
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDragOver = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
emit('dragover', event);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClick = (event, pageIndex) => {
|
||||||
|
if (event.target.classList.contains('pdf-page')) {
|
||||||
|
emit('click', { originalEvent: event, pageIndex });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleNextPage = () => {
|
||||||
|
if (currentPage.value >= totalPages.value) {
|
||||||
|
addPage();
|
||||||
|
} else {
|
||||||
|
setCurrentPage(currentPage.value + 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const addPage = () => {
|
||||||
|
emit('add-page');
|
||||||
|
// Solo cambiar a la nueva página cuando se agrega una
|
||||||
|
nextTick(() => {
|
||||||
|
const newPageNumber = totalPages.value + 1;
|
||||||
|
setCurrentPage(newPageNumber);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const deletePage = (pageIndex) => {
|
||||||
|
if (totalPages.value > 1) {
|
||||||
|
emit('delete-page', pageIndex);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollToPage = (pageNumber) => {
|
||||||
|
if (viewportRef.value) {
|
||||||
|
const pageElement = viewportRef.value.querySelector(`[data-page="${pageNumber}"]`);
|
||||||
|
if (pageElement) {
|
||||||
|
pageElement.scrollIntoView({
|
||||||
|
behavior: 'smooth',
|
||||||
|
block: 'nearest',
|
||||||
|
inline: 'center'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const setCurrentPage = (pageNumber) => {
|
||||||
|
currentPage.value = pageNumber;
|
||||||
|
emit('page-change', pageNumber);
|
||||||
|
|
||||||
|
// Mantener la página actual centrada
|
||||||
|
nextTick(() => {
|
||||||
|
scrollToPage(pageNumber);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Métodos expuestos */
|
||||||
|
defineExpose({
|
||||||
|
scrollToPage,
|
||||||
|
setCurrentPage,
|
||||||
|
PAGE_WIDTH,
|
||||||
|
PAGE_HEIGHT,
|
||||||
|
ZOOM_LEVEL
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex-1 flex flex-col bg-gray-100 dark:bg-primary-d/20">
|
||||||
|
<!-- Toolbar de páginas -->
|
||||||
|
<div class="flex items-center justify-between px-4 py-3 bg-white dark:bg-primary-d border-b border-gray-200 dark:border-primary/20">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<span class="text-sm font-medium text-gray-700 dark:text-primary-dt">
|
||||||
|
Página {{ currentPage }} de {{ totalPages }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-1 border-l border-gray-200 dark:border-primary/20 pl-4">
|
||||||
|
<button
|
||||||
|
@click="setCurrentPage(Math.max(1, currentPage - 1))"
|
||||||
|
:disabled="currentPage <= 1"
|
||||||
|
class="p-1.5 text-gray-400 hover:text-gray-600 disabled:opacity-50 disabled:cursor-not-allowed dark:text-primary-dt/70 dark:hover:text-primary-dt rounded hover:bg-gray-100 dark:hover:bg-primary/10"
|
||||||
|
title="Página anterior"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="keyboard_arrow_left" class="text-lg" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
@click="handleNextPage"
|
||||||
|
:disabled="isExporting"
|
||||||
|
class="p-1.5 text-gray-400 hover:text-gray-600 disabled:opacity-50 disabled:cursor-not-allowed dark:text-primary-dt/70 dark:hover:text-primary-dt rounded hover:bg-gray-100 dark:hover:bg-primary/10 relative"
|
||||||
|
:title="currentPage >= totalPages ? 'Crear nueva página' : 'Página siguiente'"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="keyboard_arrow_right" class="text-lg" />
|
||||||
|
<!-- Indicador solo cuando estamos en la última página -->
|
||||||
|
<GoogleIcon
|
||||||
|
v-if="currentPage >= totalPages"
|
||||||
|
name="add"
|
||||||
|
class="absolute -top-1 -right-1 text-xs text-green-500 bg-white rounded-full"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<!-- Selector de tamaño de página -->
|
||||||
|
<PageSizeSelector v-model="pageSize" />
|
||||||
|
|
||||||
|
<span class="text-xs text-gray-500 dark:text-primary-dt/70 bg-gray-50 dark:bg-primary/10 px-2 py-1 rounded">
|
||||||
|
{{ Math.round(ZOOM_LEVEL * 100) }}% • {{ currentPageSize.label }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<button
|
||||||
|
@click="addPage"
|
||||||
|
:disabled="isExporting"
|
||||||
|
class="flex items-center gap-1.5 px-3 py-1.5 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors disabled:opacity-50 font-medium"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="add" class="text-sm" />
|
||||||
|
Nueva Página
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Viewport de páginas horizontal -->
|
||||||
|
<div
|
||||||
|
ref="viewportRef"
|
||||||
|
class="flex-1 overflow-auto"
|
||||||
|
style="background-color: #f8fafc; background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px); background-size: 24px 24px;"
|
||||||
|
>
|
||||||
|
<!-- Contenedor horizontal centrado -->
|
||||||
|
<div class="flex items-center justify-center min-h-full p-6">
|
||||||
|
<div class="flex items-center gap-8">
|
||||||
|
<!-- Páginas -->
|
||||||
|
<div
|
||||||
|
v-for="(page, pageIndex) in pages"
|
||||||
|
:key="page.id"
|
||||||
|
:data-page="pageIndex + 1"
|
||||||
|
class="relative group flex-shrink-0"
|
||||||
|
>
|
||||||
|
<!-- Header de página -->
|
||||||
|
<div class="flex flex-col items-center mb-3">
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<span class="text-sm font-medium text-gray-600 dark:text-primary-dt/80">
|
||||||
|
Página {{ pageIndex + 1 }}
|
||||||
|
</span>
|
||||||
|
<button
|
||||||
|
v-if="totalPages > 1"
|
||||||
|
@click="deletePage(pageIndex)"
|
||||||
|
:disabled="isExporting"
|
||||||
|
class="opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 disabled:opacity-50 p-1 rounded hover:bg-red-50 transition-all"
|
||||||
|
title="Eliminar página"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="delete" class="text-sm" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<span class="text-xs text-gray-400 dark:text-primary-dt/50">
|
||||||
|
{{ currentPageSize.label }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Contenedor de página con sombra -->
|
||||||
|
<div class="relative">
|
||||||
|
<!-- Sombra de página -->
|
||||||
|
<div class="absolute top-2 left-2 w-full h-full bg-gray-400/30 rounded-lg"></div>
|
||||||
|
|
||||||
|
<!-- Página PDF -->
|
||||||
|
<div
|
||||||
|
class="pdf-page relative bg-white rounded-lg border border-gray-300 dark:border-primary/20 overflow-hidden"
|
||||||
|
:class="{
|
||||||
|
'ring-2 ring-blue-500 ring-opacity-50 shadow-lg': currentPage === pageIndex + 1,
|
||||||
|
'shadow-md hover:shadow-lg': currentPage !== pageIndex + 1,
|
||||||
|
'opacity-50': isExporting
|
||||||
|
}"
|
||||||
|
:style="{
|
||||||
|
width: `${scaledPageWidth}px`,
|
||||||
|
height: `${scaledPageHeight}px`
|
||||||
|
}"
|
||||||
|
@drop="(e) => handleDrop(e, pageIndex)"
|
||||||
|
@dragover="handleDragOver"
|
||||||
|
@click="(e) => handleClick(e, pageIndex)"
|
||||||
|
>
|
||||||
|
<!-- Área de contenido con márgenes visuales -->
|
||||||
|
<div class="relative w-full h-full">
|
||||||
|
<!-- Guías de margen -->
|
||||||
|
<div
|
||||||
|
class="absolute border border-dashed border-blue-300/40 pointer-events-none"
|
||||||
|
:style="{
|
||||||
|
top: `${PAGE_MARGIN * ZOOM_LEVEL}px`,
|
||||||
|
left: `${PAGE_MARGIN * ZOOM_LEVEL}px`,
|
||||||
|
width: `${(PAGE_WIDTH - (PAGE_MARGIN * 2)) * ZOOM_LEVEL}px`,
|
||||||
|
height: `${(PAGE_HEIGHT - (PAGE_MARGIN * 2)) * ZOOM_LEVEL}px`
|
||||||
|
}"
|
||||||
|
></div>
|
||||||
|
|
||||||
|
<!-- Elementos de la página con transformación -->
|
||||||
|
<div
|
||||||
|
class="absolute inset-0"
|
||||||
|
:style="{
|
||||||
|
transform: `scale(${ZOOM_LEVEL})`,
|
||||||
|
transformOrigin: 'top left',
|
||||||
|
width: `${PAGE_WIDTH}px`,
|
||||||
|
height: `${PAGE_HEIGHT}px`
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<slot
|
||||||
|
name="elements"
|
||||||
|
:page="page"
|
||||||
|
:pageIndex="pageIndex"
|
||||||
|
:pageWidth="PAGE_WIDTH"
|
||||||
|
:pageHeight="PAGE_HEIGHT"
|
||||||
|
:zoomLevel="ZOOM_LEVEL"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Indicador de página vacía -->
|
||||||
|
<div
|
||||||
|
v-if="page.elements.length === 0"
|
||||||
|
class="absolute inset-0 flex items-center justify-center pointer-events-none z-10"
|
||||||
|
:style="{ transform: `scale(${1/ZOOM_LEVEL})` }"
|
||||||
|
>
|
||||||
|
<div class="text-center text-gray-400 dark:text-primary-dt/50">
|
||||||
|
<GoogleIcon name="description" class="text-4xl mb-2" />
|
||||||
|
<p class="text-sm font-medium">Página {{ pageIndex + 1 }}</p>
|
||||||
|
<p class="text-xs">Arrastra elementos aquí</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Overlay durante exportación -->
|
||||||
|
<div
|
||||||
|
v-if="isExporting"
|
||||||
|
class="absolute inset-0 bg-white/90 dark:bg-primary-d/90 flex items-center justify-center z-50 backdrop-blur-sm"
|
||||||
|
>
|
||||||
|
<div class="text-center bg-white dark:bg-primary-d rounded-lg p-6 shadow-lg border border-gray-200 dark:border-primary/20">
|
||||||
|
<GoogleIcon name="picture_as_pdf" class="text-5xl text-red-600 dark:text-red-400 animate-pulse mb-3" />
|
||||||
|
<p class="text-lg font-semibold text-gray-900 dark:text-primary-dt mb-1">Generando PDF...</p>
|
||||||
|
<p class="text-sm text-gray-500 dark:text-primary-dt/70">Procesando {{ totalPages }} página{{ totalPages !== 1 ? 's' : '' }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pdf-page {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pdf-page:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pdf-page.ring-2 {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflow-auto {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflow-auto::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflow-auto::-webkit-scrollbar-thumb {
|
||||||
|
background: #cbd5e1;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflow-auto::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: #94a3b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflow-auto::-webkit-scrollbar {
|
||||||
|
height: 8px;
|
||||||
|
width: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
141
src/components/Holos/PDF/PageSizeSelector.vue
Normal file
141
src/components/Holos/PDF/PageSizeSelector.vue
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
|
||||||
|
/** Propiedades */
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: {
|
||||||
|
type: String,
|
||||||
|
default: 'A4'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Eventos */
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
/** Referencias */
|
||||||
|
const isOpen = ref(false);
|
||||||
|
|
||||||
|
/** Tamaños de página disponibles */
|
||||||
|
const pageSizes = [
|
||||||
|
{
|
||||||
|
name: 'A4',
|
||||||
|
label: 'A4 (210 x 297 mm)',
|
||||||
|
width: 794,
|
||||||
|
height: 1123,
|
||||||
|
description: 'Estándar internacional'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'A3',
|
||||||
|
label: 'A3 (297 x 420 mm)',
|
||||||
|
width: 1123,
|
||||||
|
height: 1587,
|
||||||
|
description: 'Doble de A4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Letter',
|
||||||
|
label: 'Carta (216 x 279 mm)',
|
||||||
|
width: 816,
|
||||||
|
height: 1056,
|
||||||
|
description: 'Estándar US'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Legal',
|
||||||
|
label: 'Oficio (216 x 356 mm)',
|
||||||
|
width: 816,
|
||||||
|
height: 1344,
|
||||||
|
description: 'Legal US'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Tabloid',
|
||||||
|
label: 'Tabloide (279 x 432 mm)',
|
||||||
|
width: 1056,
|
||||||
|
height: 1632,
|
||||||
|
description: 'Doble carta'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Propiedades computadas */
|
||||||
|
const selectedSize = computed(() => {
|
||||||
|
return pageSizes.find(size => size.name === props.modelValue) || pageSizes[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Métodos */
|
||||||
|
const selectSize = (size) => {
|
||||||
|
emit('update:modelValue', size.name);
|
||||||
|
isOpen.value = false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="relative">
|
||||||
|
<!-- Selector principal -->
|
||||||
|
<button
|
||||||
|
@click="isOpen = !isOpen"
|
||||||
|
class="flex items-center gap-2 px-3 py-2 text-sm bg-white dark:bg-primary-d border border-gray-200 dark:border-primary/20 rounded-md hover:bg-gray-50 dark:hover:bg-primary/10 transition-colors"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="aspect_ratio" class="text-gray-500 dark:text-primary-dt/70" />
|
||||||
|
<span class="text-gray-700 dark:text-primary-dt">{{ selectedSize.name }}</span>
|
||||||
|
<GoogleIcon
|
||||||
|
name="expand_more"
|
||||||
|
class="text-gray-400 dark:text-primary-dt/50 transition-transform"
|
||||||
|
:class="{ 'rotate-180': isOpen }"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Dropdown -->
|
||||||
|
<div
|
||||||
|
v-if="isOpen"
|
||||||
|
@click.away="isOpen = false"
|
||||||
|
class="absolute top-full left-0 mt-1 w-72 bg-white dark:bg-primary-d border border-gray-200 dark:border-primary/20 rounded-lg shadow-lg z-50 py-2"
|
||||||
|
>
|
||||||
|
<div class="px-3 py-2 text-xs font-semibold text-gray-500 dark:text-primary-dt/70 uppercase tracking-wider border-b border-gray-100 dark:border-primary/20">
|
||||||
|
Tamaños de página
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="max-h-64 overflow-y-auto">
|
||||||
|
<button
|
||||||
|
v-for="size in pageSizes"
|
||||||
|
:key="size.name"
|
||||||
|
@click="selectSize(size)"
|
||||||
|
class="w-full flex items-center gap-3 px-3 py-3 hover:bg-gray-50 dark:hover:bg-primary/10 transition-colors text-left"
|
||||||
|
:class="{
|
||||||
|
'bg-blue-50 dark:bg-blue-900/20': selectedSize.name === size.name
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<div
|
||||||
|
class="w-8 h-10 border border-gray-300 dark:border-primary/30 rounded-sm bg-white dark:bg-primary-d flex items-center justify-center"
|
||||||
|
:class="{
|
||||||
|
'border-blue-500 dark:border-blue-400': selectedSize.name === size.name
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="bg-gray-200 dark:bg-primary/20 rounded-sm"
|
||||||
|
:style="{
|
||||||
|
width: `${Math.min(20, (size.width / size.height) * 32)}px`,
|
||||||
|
height: `${Math.min(32, (size.height / size.width) * 20)}px`
|
||||||
|
}"
|
||||||
|
:class="{
|
||||||
|
'bg-blue-200 dark:bg-blue-800': selectedSize.name === size.name
|
||||||
|
}"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="font-medium text-gray-900 dark:text-primary-dt">{{ size.label }}</div>
|
||||||
|
<div class="text-xs text-gray-500 dark:text-primary-dt/70">{{ size.description }}</div>
|
||||||
|
<div class="text-xs text-gray-400 dark:text-primary-dt/50 mt-1">
|
||||||
|
{{ size.width }} x {{ size.height }} px
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="selectedSize.name === size.name" class="flex-shrink-0">
|
||||||
|
<GoogleIcon name="check" class="text-blue-500 dark:text-blue-400" />
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
233
src/components/Holos/PDF/TextFormatter.vue
Normal file
233
src/components/Holos/PDF/TextFormatter.vue
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed, watch } from 'vue';
|
||||||
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
|
||||||
|
/** Propiedades */
|
||||||
|
const props = defineProps({
|
||||||
|
element: {
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Eventos */
|
||||||
|
const emit = defineEmits(['update']);
|
||||||
|
|
||||||
|
/** Propiedades computadas */
|
||||||
|
const formatting = computed(() => props.element?.formatting || {});
|
||||||
|
const hasTextElement = computed(() => props.element?.type === 'text');
|
||||||
|
|
||||||
|
/** Métodos */
|
||||||
|
const toggleBold = () => {
|
||||||
|
if (!hasTextElement.value) return;
|
||||||
|
updateFormatting('bold', !formatting.value.bold);
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleItalic = () => {
|
||||||
|
if (!hasTextElement.value) return;
|
||||||
|
updateFormatting('italic', !formatting.value.italic);
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleUnderline = () => {
|
||||||
|
if (!hasTextElement.value) return;
|
||||||
|
updateFormatting('underline', !formatting.value.underline);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateFontSize = (size) => {
|
||||||
|
if (!hasTextElement.value) return;
|
||||||
|
updateFormatting('fontSize', size);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateTextAlign = (align) => {
|
||||||
|
if (!hasTextElement.value) return;
|
||||||
|
updateFormatting('textAlign', align);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateColor = (color) => {
|
||||||
|
if (!hasTextElement.value) return;
|
||||||
|
updateFormatting('color', color);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateFormatting = (key, value) => {
|
||||||
|
const newFormatting = { ...formatting.value, [key]: value };
|
||||||
|
emit('update', {
|
||||||
|
id: props.element.id,
|
||||||
|
formatting: newFormatting
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Colores predefinidos */
|
||||||
|
const predefinedColors = [
|
||||||
|
'#000000', '#333333', '#666666', '#999999',
|
||||||
|
'#FF0000', '#00FF00', '#0000FF', '#FFFF00',
|
||||||
|
'#FF00FF', '#00FFFF', '#FFA500', '#800080'
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Tamaños de fuente */
|
||||||
|
const fontSizes = [8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 72];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
v-if="visible && hasTextElement"
|
||||||
|
class="flex items-center gap-6 px-4 py-2 bg-gray-50 dark:bg-primary-d/50 border-b border-gray-200 dark:border-primary/20"
|
||||||
|
>
|
||||||
|
<!-- Estilo de texto -->
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-xs font-medium text-gray-600 dark:text-primary-dt/80">Estilo:</span>
|
||||||
|
<div class="flex gap-1">
|
||||||
|
<button
|
||||||
|
@click="toggleBold"
|
||||||
|
:class="[
|
||||||
|
'w-8 h-8 rounded flex items-center justify-center text-sm font-bold transition-colors',
|
||||||
|
formatting.bold
|
||||||
|
? 'bg-blue-500 text-white shadow-sm'
|
||||||
|
: 'bg-white text-gray-700 hover:bg-blue-50 border border-gray-200 dark:bg-primary-d dark:text-primary-dt dark:hover:bg-primary/10 dark:border-primary/20'
|
||||||
|
]"
|
||||||
|
title="Negrita (Ctrl+B)"
|
||||||
|
>
|
||||||
|
B
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
@click="toggleItalic"
|
||||||
|
:class="[
|
||||||
|
'w-8 h-8 rounded flex items-center justify-center text-sm italic transition-colors',
|
||||||
|
formatting.italic
|
||||||
|
? 'bg-blue-500 text-white shadow-sm'
|
||||||
|
: 'bg-white text-gray-700 hover:bg-blue-50 border border-gray-200 dark:bg-primary-d dark:text-primary-dt dark:hover:bg-primary/10 dark:border-primary/20'
|
||||||
|
]"
|
||||||
|
title="Cursiva (Ctrl+I)"
|
||||||
|
>
|
||||||
|
I
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
@click="toggleUnderline"
|
||||||
|
:class="[
|
||||||
|
'w-8 h-8 rounded flex items-center justify-center text-sm underline transition-colors',
|
||||||
|
formatting.underline
|
||||||
|
? 'bg-blue-500 text-white shadow-sm'
|
||||||
|
: 'bg-white text-gray-700 hover:bg-blue-50 border border-gray-200 dark:bg-primary-d dark:text-primary-dt dark:hover:bg-primary/10 dark:border-primary/20'
|
||||||
|
]"
|
||||||
|
title="Subrayado (Ctrl+U)"
|
||||||
|
>
|
||||||
|
U
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Separador -->
|
||||||
|
<div class="w-px h-6 bg-gray-300 dark:bg-primary/30"></div>
|
||||||
|
|
||||||
|
<!-- Tamaño de fuente -->
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-xs font-medium text-gray-600 dark:text-primary-dt/80">Tamaño:</span>
|
||||||
|
<select
|
||||||
|
:value="formatting.fontSize || 12"
|
||||||
|
@change="updateFontSize(parseInt($event.target.value))"
|
||||||
|
class="px-2 py-1 text-sm border border-gray-200 rounded bg-white dark:bg-primary-d dark:border-primary/20 dark:text-primary-dt focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||||
|
>
|
||||||
|
<option v-for="size in fontSizes" :key="size" :value="size">
|
||||||
|
{{ size }}px
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Separador -->
|
||||||
|
<div class="w-px h-6 bg-gray-300 dark:bg-primary/30"></div>
|
||||||
|
|
||||||
|
<!-- Alineación -->
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-xs font-medium text-gray-600 dark:text-primary-dt/80">Alinear:</span>
|
||||||
|
<div class="flex gap-1">
|
||||||
|
<button
|
||||||
|
@click="updateTextAlign('left')"
|
||||||
|
:class="[
|
||||||
|
'w-8 h-8 rounded flex items-center justify-center transition-colors',
|
||||||
|
(formatting.textAlign || 'left') === 'left'
|
||||||
|
? 'bg-blue-500 text-white shadow-sm'
|
||||||
|
: 'bg-white text-gray-700 hover:bg-blue-50 border border-gray-200 dark:bg-primary-d dark:text-primary-dt dark:hover:bg-primary/10 dark:border-primary/20'
|
||||||
|
]"
|
||||||
|
title="Alinear izquierda"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="format_align_left" class="text-sm" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
@click="updateTextAlign('center')"
|
||||||
|
:class="[
|
||||||
|
'w-8 h-8 rounded flex items-center justify-center transition-colors',
|
||||||
|
formatting.textAlign === 'center'
|
||||||
|
? 'bg-blue-500 text-white shadow-sm'
|
||||||
|
: 'bg-white text-gray-700 hover:bg-blue-50 border border-gray-200 dark:bg-primary-d dark:text-primary-dt dark:hover:bg-primary/10 dark:border-primary/20'
|
||||||
|
]"
|
||||||
|
title="Centrar"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="format_align_center" class="text-sm" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
@click="updateTextAlign('right')"
|
||||||
|
:class="[
|
||||||
|
'w-8 h-8 rounded flex items-center justify-center transition-colors',
|
||||||
|
formatting.textAlign === 'right'
|
||||||
|
? 'bg-blue-500 text-white shadow-sm'
|
||||||
|
: 'bg-white text-gray-700 hover:bg-blue-50 border border-gray-200 dark:bg-primary-d dark:text-primary-dt dark:hover:bg-primary/10 dark:border-primary/20'
|
||||||
|
]"
|
||||||
|
title="Alinear derecha"
|
||||||
|
>
|
||||||
|
<GoogleIcon name="format_align_right" class="text-sm" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Separador -->
|
||||||
|
<div class="w-px h-6 bg-gray-300 dark:bg-primary/30"></div>
|
||||||
|
|
||||||
|
<!-- Color de texto -->
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-xs font-medium text-gray-600 dark:text-primary-dt/80">Color:</span>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<!-- Color actual -->
|
||||||
|
<div
|
||||||
|
class="w-8 h-8 rounded border-2 border-gray-300 cursor-pointer relative overflow-hidden"
|
||||||
|
:style="{ backgroundColor: formatting.color || '#000000' }"
|
||||||
|
title="Color actual"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
:value="formatting.color || '#000000'"
|
||||||
|
@input="updateColor($event.target.value)"
|
||||||
|
class="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Colores rápidos -->
|
||||||
|
<div class="flex gap-1">
|
||||||
|
<button
|
||||||
|
v-for="color in predefinedColors.slice(0, 6)"
|
||||||
|
:key="color"
|
||||||
|
@click="updateColor(color)"
|
||||||
|
class="w-6 h-6 rounded border border-gray-300 hover:scale-110 transition-transform"
|
||||||
|
:class="{
|
||||||
|
'ring-2 ring-blue-500': (formatting.color || '#000000') === color
|
||||||
|
}"
|
||||||
|
:style="{ backgroundColor: color }"
|
||||||
|
:title="color"
|
||||||
|
></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Información del elemento -->
|
||||||
|
<div class="ml-auto flex items-center gap-2 text-xs text-gray-500 dark:text-primary-dt/70">
|
||||||
|
<GoogleIcon name="text_fields" class="text-sm" />
|
||||||
|
<span>Elemento de texto seleccionado</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
78
src/components/Holos/Skeleton/Sidebar/Drop.vue
Normal file
78
src/components/Holos/Skeleton/Sidebar/Drop.vue
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed } from "vue";
|
||||||
|
import { RouterLink, useRoute } from "vue-router";
|
||||||
|
|
||||||
|
import useLeftSidebar from "@Stores/LeftSidebar";
|
||||||
|
import GoogleIcon from "@Shared/GoogleIcon.vue";
|
||||||
|
|
||||||
|
/** Definidores */
|
||||||
|
const leftSidebar = useLeftSidebar();
|
||||||
|
const vroute = useRoute();
|
||||||
|
|
||||||
|
/** Propiedades */
|
||||||
|
const props = defineProps({
|
||||||
|
name: String,
|
||||||
|
icon: String,
|
||||||
|
to: String,
|
||||||
|
active: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
collapsed: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const isCollapsed = ref(props.collapsed);
|
||||||
|
|
||||||
|
const closeSidebar = () => {
|
||||||
|
if (TwScreen.isDevice("phone") || TwScreen.isDevice("tablet")) {
|
||||||
|
leftSidebar.close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const isActive = computed(() => props.active || props.to === vroute.name);
|
||||||
|
|
||||||
|
const classes = computed(() => {
|
||||||
|
return isActive.value
|
||||||
|
? "flex items-center px-4 py-2 mx-2 my-1 text-white !bg-blue-600 rounded-lg transition-all duration-200 !border-transparent"
|
||||||
|
: "flex items-center px-4 py-2 mx-2 my-1 text-gray-600 hover:bg-gray-100 rounded-lg transition-all duration-200";
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ul>
|
||||||
|
<li class="hidden md:block">
|
||||||
|
<div class="flex items-center px-2 py-2 rounded">
|
||||||
|
<button
|
||||||
|
class="dropdown-toggle w-full"
|
||||||
|
@click.stop="isCollapsed = !isCollapsed"
|
||||||
|
>
|
||||||
|
<RouterLink
|
||||||
|
:to="$view({ name: props.to })"
|
||||||
|
:class="classes"
|
||||||
|
class="flex items-center justify-between flex-1"
|
||||||
|
@click="closeSidebar"
|
||||||
|
>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<GoogleIcon v-if="icon" :name="icon" class="text-xl mr-2" />
|
||||||
|
<span class="text-sm font-medium">{{ name }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<GoogleIcon
|
||||||
|
:name="isCollapsed ? 'expand_more' : 'expand_less'"
|
||||||
|
class="text-gray-400 text-lg"
|
||||||
|
/>
|
||||||
|
</RouterLink>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<div
|
||||||
|
class="transition-all duration-300 ease-in-out overflow-hidden"
|
||||||
|
:class="{ 'max-h-0': isCollapsed, 'max-h-96': !isCollapsed }"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
@ -1,19 +1,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
/** Propiedades */
|
/** Propiedades */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
name: String
|
name: String,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ul v-if="$slots['default']">
|
<ul v-if="$slots['default']">
|
||||||
<li class="px-5 hidden md:block">
|
<li class="px-5 hidden md:block">
|
||||||
<div class="flex flex-row items-center h-8">
|
<div class="flex flex-row items-center h-8 cursor-pointer">
|
||||||
<div class="text-sm font-light tracking-wide text-gray-400 uppercase">
|
<div class="text-sm font-light tracking-wide text-gray-400 uppercase">
|
||||||
{{name}}
|
{{ name }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<slot />
|
<slot />
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import useLoader from '@Stores/Loader';
|
|||||||
import Layout from '@Holos/Layout/App.vue';
|
import Layout from '@Holos/Layout/App.vue';
|
||||||
import Link from '@Holos/Skeleton/Sidebar/Link.vue';
|
import Link from '@Holos/Skeleton/Sidebar/Link.vue';
|
||||||
import Section from '@Holos/Skeleton/Sidebar/Section.vue';
|
import Section from '@Holos/Skeleton/Sidebar/Section.vue';
|
||||||
|
import DropDown from '@Holos/Skeleton/Sidebar/Drop.vue'
|
||||||
|
|
||||||
/** Definidores */
|
/** Definidores */
|
||||||
const loader = useLoader()
|
const loader = useLoader()
|
||||||
@ -41,35 +42,37 @@ onMounted(() => {
|
|||||||
<template #leftSidebar>
|
<template #leftSidebar>
|
||||||
<Section name="Principal">
|
<Section name="Principal">
|
||||||
<Link
|
<Link
|
||||||
icon="grid_view"
|
icon="grid_view"
|
||||||
name="Dashboard"
|
name="Dashboard"
|
||||||
to="admin.dashboard.index"
|
to="admin.dashboard.index"
|
||||||
/>
|
/>
|
||||||
<Link
|
<DropDown
|
||||||
icon="people"
|
icon="people"
|
||||||
name="Empleados"
|
name="Empleados"
|
||||||
to="admin.employees.index"
|
to="admin.employees.index"
|
||||||
/>
|
:collapsed="true"
|
||||||
<Link
|
>
|
||||||
icon="school"
|
<Link
|
||||||
name="Historial Académico"
|
icon="school"
|
||||||
to="admin.academic.index"
|
name="Historial Académico"
|
||||||
/>
|
to="admin.academic.index"
|
||||||
<Link
|
/>
|
||||||
icon="security"
|
<Link
|
||||||
name="Seguridad y Salud"
|
icon="security"
|
||||||
to="admin.security.index"
|
name="Seguridad y Salud"
|
||||||
/>
|
to="admin.security.index"
|
||||||
<Link
|
/>
|
||||||
icon="payments"
|
<Link
|
||||||
name="Nómina"
|
icon="payments"
|
||||||
to="admin.payroll.index"
|
name="Nómina"
|
||||||
/>
|
to="admin.payroll.index"
|
||||||
<Link
|
/>
|
||||||
icon="info"
|
<Link
|
||||||
name="Información Adicional"
|
icon="info"
|
||||||
to="admin.additional.index"
|
name="Información Adicional"
|
||||||
/>
|
to="admin.additional.index"
|
||||||
|
/>
|
||||||
|
</DropDown>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="Vacaciones">
|
<Section name="Vacaciones">
|
||||||
<Link
|
<Link
|
||||||
@ -79,48 +82,52 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="Capacitaciones">
|
<Section name="Capacitaciones">
|
||||||
<Link
|
<DropDown
|
||||||
icon="grid_view"
|
|
||||||
name="Solicitud de Cursos"
|
|
||||||
to="admin.courses.request"
|
|
||||||
/>
|
|
||||||
<Link
|
|
||||||
icon="grid_view"
|
icon="grid_view"
|
||||||
name="Cursos"
|
name="Cursos"
|
||||||
to="admin.courses.index"
|
to="admin.courses.index"
|
||||||
/>
|
:collapsed="true"
|
||||||
<Link
|
>
|
||||||
icon="grid_view"
|
<Link
|
||||||
name="Asignación de Cursos"
|
icon="grid_view"
|
||||||
to="admin.courses.assignamment"
|
name="Solicitud de Cursos"
|
||||||
/>
|
to="admin.courses.request"
|
||||||
<Link
|
/>
|
||||||
icon="grid_view"
|
<Link
|
||||||
name="Calendario de Cursos"
|
icon="grid_view"
|
||||||
to="admin.courses.calendar"
|
name="Asignación de Cursos"
|
||||||
/>
|
to="admin.courses.assignamment"
|
||||||
|
/>
|
||||||
|
<Link
|
||||||
|
icon="grid_view"
|
||||||
|
name="Calendario de Cursos"
|
||||||
|
to="admin.courses.calendar"
|
||||||
|
/>
|
||||||
|
</DropDown>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="Eventos">
|
<Section name="Eventos">
|
||||||
<Link
|
<DropDown
|
||||||
icon="grid_view"
|
icon="grid_view"
|
||||||
name="Dashboard"
|
name="Eventos"
|
||||||
to="admin.events.index"
|
to="admin.events.index"
|
||||||
/>
|
:collapsed="true"
|
||||||
<Link
|
>
|
||||||
icon="grid_view"
|
<Link
|
||||||
name="Asignación de presupuesto"
|
icon="grid_view"
|
||||||
to="admin.events.assignamment"
|
name="Asignación de presupuesto"
|
||||||
/>
|
to="admin.events.assignamment"
|
||||||
<Link
|
/>
|
||||||
icon="grid_view"
|
<Link
|
||||||
name="Justificación de gastos"
|
icon="grid_view"
|
||||||
to="admin.events.justification"
|
name="Justificación de gastos"
|
||||||
/>
|
to="admin.events.justification"
|
||||||
<Link
|
/>
|
||||||
icon="grid_view"
|
<Link
|
||||||
name="Reportes de gastos"
|
icon="grid_view"
|
||||||
to="admin.events.reports"
|
name="Reportes de gastos"
|
||||||
/>
|
to="admin.events.reports"
|
||||||
|
/>
|
||||||
|
</DropDown>
|
||||||
</Section>
|
</Section>
|
||||||
<Section
|
<Section
|
||||||
v-if="hasPermission('users.index')"
|
v-if="hasPermission('users.index')"
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
import Adding from '@Holos/Button/ButtonRh.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -12,13 +13,7 @@ import GoogleIcon from '@Shared/GoogleIcon.vue';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="inline-flex items-center gap-3 bg-[#2563eb] hover:bg-[#1e40af] text-white px-4 py-2 rounded-full shadow-md">
|
<Adding text="Agregar Registro" />
|
||||||
<GoogleIcon
|
|
||||||
class="text-white text-xl"
|
|
||||||
name="add"
|
|
||||||
/>
|
|
||||||
Agregar Registro
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
import Adding from '@Holos/Button/ButtonRh.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -12,10 +13,7 @@ import GoogleIcon from '@Shared/GoogleIcon.vue';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="inline-flex items-center gap-3 bg-[#2563eb] hover:bg-[#1e40af] text-white px-4 py-2 rounded-full shadow-md">
|
<Adding text="Nueva Evaluación" />
|
||||||
<GoogleIcon class="text-white text-xl" name="add" />
|
|
||||||
Nueva Evaluación
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
import Searcher from '@Holos/Searcher.vue';
|
import Searcher from '@Holos/Searcher.vue';
|
||||||
|
import Adding from '@Holos/Button/ButtonRh.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -12,15 +13,8 @@ import Searcher from '@Holos/Searcher.vue';
|
|||||||
<p class="mt-1 text-sm text-gray-500 dark:text-primary-dt/70">Gestión de información general de empleados</p>
|
<p class="mt-1 text-sm text-gray-500 dark:text-primary-dt/70">Gestión de información general de empleados</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center">
|
<div>
|
||||||
<button
|
<Adding text="Nuevo Empleado" />
|
||||||
class="inline-flex items-center gap-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md shadow-md"
|
|
||||||
>
|
|
||||||
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
|
||||||
</svg>
|
|
||||||
Nuevo Empleado
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, nextTick, onMounted, computed } from 'vue';
|
import { ref, onMounted, computed } from 'vue';
|
||||||
import { PDFDocument, rgb, StandardFonts } from 'pdf-lib';
|
import { PDFDocument, rgb, StandardFonts } from 'pdf-lib';
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
import Draggable from '@Holos/Draggable.vue';
|
import Draggable from '@Holos/PDF/Draggable.vue';
|
||||||
import CanvasElement from '@Holos/Canvas.vue';
|
import CanvasElement from '@Holos/PDF/Canvas.vue';
|
||||||
import PDFViewport from '@Holos/PDFViewport.vue';
|
import PDFViewport from '@Holos/PDF/PDFViewport.vue';
|
||||||
|
import TextFormatter from '@Holos/PDF/TextFormatter.vue';
|
||||||
|
|
||||||
/** Estado reactivo */
|
/** Estado reactivo */
|
||||||
const pages = ref([{ id: 1, elements: [] }]);
|
const pages = ref([{ id: 1, elements: [] }]);
|
||||||
@ -13,10 +14,61 @@ const elementCounter = ref(0);
|
|||||||
const documentTitle = ref('Documento sin título');
|
const documentTitle = ref('Documento sin título');
|
||||||
const isExporting = ref(false);
|
const isExporting = ref(false);
|
||||||
const currentPage = ref(1);
|
const currentPage = ref(1);
|
||||||
|
const pageIdCounter = ref(1); // <-- Agregar contador separado para páginas
|
||||||
|
|
||||||
|
/** Estado para tamaño de página */
|
||||||
|
const currentPageSize = ref({
|
||||||
|
width: 794, // A4 por defecto
|
||||||
|
height: 1123
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Manejar cambio de tamaño de página */
|
||||||
|
const handlePageSizeChange = (sizeData) => {
|
||||||
|
currentPageSize.value = sizeData.dimensions;
|
||||||
|
// Aquí podrías ajustar elementos existentes si es necesario
|
||||||
|
window.Notify.info(`Tamaño de página cambiado a ${sizeData.size}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Actualizar el método moveElement para usar el tamaño dinámico
|
||||||
|
const moveElement = (moveData) => {
|
||||||
|
const element = allElements.value.find(el => el.id === moveData.id);
|
||||||
|
if (element) {
|
||||||
|
element.x = Math.max(0, Math.min(currentPageSize.value.width - (element.width || 200), moveData.x));
|
||||||
|
element.y = Math.max(0, Math.min(currentPageSize.value.height - (element.height || 40), moveData.y));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/** Referencias */
|
/** Referencias */
|
||||||
const viewportRef = ref(null);
|
const viewportRef = ref(null);
|
||||||
|
|
||||||
|
/** Referencias adicionales */
|
||||||
|
const textFormatterElement = ref(null);
|
||||||
|
const showTextFormatter = ref(false);
|
||||||
|
|
||||||
|
const selectElement = (elementId) => {
|
||||||
|
selectedElementId.value = elementId;
|
||||||
|
const selectedEl = allElements.value.find(el => el.id === elementId);
|
||||||
|
showTextFormatter.value = selectedEl?.type === 'text';
|
||||||
|
textFormatterElement.value = selectedEl;
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateElement = (update) => {
|
||||||
|
const element = allElements.value.find(el => el.id === update.id);
|
||||||
|
if (element) {
|
||||||
|
Object.assign(element, update);
|
||||||
|
// Si se actualiza el formato, actualizar la referencia
|
||||||
|
if (update.formatting && textFormatterElement.value?.id === update.id) {
|
||||||
|
textFormatterElement.value = { ...element };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCanvasClick = (clickData) => {
|
||||||
|
selectedElementId.value = null;
|
||||||
|
showTextFormatter.value = false;
|
||||||
|
textFormatterElement.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
/** Tipos de elementos disponibles */
|
/** Tipos de elementos disponibles */
|
||||||
const availableElements = [
|
const availableElements = [
|
||||||
{
|
{
|
||||||
@ -109,14 +161,6 @@ const handleDragOver = (event) => {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCanvasClick = (clickData) => {
|
|
||||||
selectedElementId.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectElement = (elementId) => {
|
|
||||||
selectedElementId.value = elementId;
|
|
||||||
};
|
|
||||||
|
|
||||||
const deleteElement = (elementId) => {
|
const deleteElement = (elementId) => {
|
||||||
const index = allElements.value.findIndex(el => el.id === elementId);
|
const index = allElements.value.findIndex(el => el.id === elementId);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
@ -128,26 +172,11 @@ const deleteElement = (elementId) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateElement = (update) => {
|
|
||||||
const element = allElements.value.find(el => el.id === update.id);
|
|
||||||
if (element) {
|
|
||||||
Object.assign(element, update);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const moveElement = (moveData) => {
|
|
||||||
const element = allElements.value.find(el => el.id === moveData.id);
|
|
||||||
if (element) {
|
|
||||||
element.x = moveData.x;
|
|
||||||
element.y = moveData.y;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Paginación */
|
/** Paginación */
|
||||||
const addPage = () => {
|
const addPage = () => {
|
||||||
const newPageId = Math.max(...pages.value.map(p => p.id)) + 1;
|
pageIdCounter.value++; // <-- Incrementar contador independiente
|
||||||
pages.value.push({
|
pages.value.push({
|
||||||
id: newPageId,
|
id: pageIdCounter.value,
|
||||||
elements: []
|
elements: []
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -211,249 +240,215 @@ const exportPDF = async () => {
|
|||||||
isExporting.value = true;
|
isExporting.value = true;
|
||||||
window.Notify.info('Generando PDF...');
|
window.Notify.info('Generando PDF...');
|
||||||
|
|
||||||
// Crear un nuevo documento PDF
|
// Crear un nuevo documento PDF con el tamaño de página seleccionado
|
||||||
const pdfDoc = await PDFDocument.create();
|
const pdfDoc = await PDFDocument.create();
|
||||||
let currentPage = pdfDoc.addPage([595.28, 841.89]); // A4 size in points
|
|
||||||
let currentPageHeight = 841.89;
|
// Convertir dimensiones de pixels a puntos (1 px = 0.75 puntos)
|
||||||
|
const pageWidthPoints = currentPageSize.value.width * 0.75;
|
||||||
|
const pageHeightPoints = currentPageSize.value.height * 0.75;
|
||||||
|
|
||||||
|
let currentPDFPage = pdfDoc.addPage([pageWidthPoints, pageHeightPoints]);
|
||||||
|
let currentPageHeight = pageHeightPoints;
|
||||||
let yOffset = 50; // Margen superior
|
let yOffset = 50; // Margen superior
|
||||||
|
|
||||||
// Obtener fuentes
|
// Obtener fuentes
|
||||||
const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica);
|
const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica);
|
||||||
const courierFont = await pdfDoc.embedFont(StandardFonts.Courier);
|
const courierFont = await pdfDoc.embedFont(StandardFonts.Courier);
|
||||||
|
|
||||||
// Ordenar elementos por posición (de arriba hacia abajo, de izquierda a derecha)
|
// Procesar páginas del maquetador
|
||||||
const sortedElements = [...allElements.value].sort((a, b) => {
|
for (let pageIndex = 0; pageIndex < pages.value.length; pageIndex++) {
|
||||||
if (Math.abs(a.y - b.y) < 20) {
|
const page = pages.value[pageIndex];
|
||||||
return a.x - b.x; // Si están en la misma línea, ordenar por X
|
|
||||||
}
|
|
||||||
return a.y - b.y; // Ordenar por Y
|
|
||||||
});
|
|
||||||
|
|
||||||
// Procesar elementos
|
// Crear nueva página PDF si no es la primera
|
||||||
for (const element of sortedElements) {
|
if (pageIndex > 0) {
|
||||||
// Calcular posición en el PDF
|
currentPDFPage = pdfDoc.addPage([pageWidthPoints, pageHeightPoints]);
|
||||||
const x = Math.max(50, Math.min(500, (element.x * 0.75) + 50)); // Convertir y limitar X
|
currentPageHeight = pageHeightPoints;
|
||||||
let y = currentPageHeight - yOffset - (element.y * 0.75); // Convertir Y
|
|
||||||
|
|
||||||
// Verificar si necesitamos una nueva página
|
|
||||||
const elementHeight = getElementHeight(element);
|
|
||||||
if (y - elementHeight < 50) {
|
|
||||||
currentPage = pdfDoc.addPage([595.28, 841.89]);
|
|
||||||
currentPageHeight = 841.89;
|
|
||||||
yOffset = 50;
|
yOffset = 50;
|
||||||
y = currentPageHeight - yOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (element.type) {
|
// Ordenar elementos de esta página por posición
|
||||||
case 'text':
|
const sortedElements = [...page.elements].sort((a, b) => {
|
||||||
if (element.content) {
|
if (Math.abs(a.y - b.y) < 20) {
|
||||||
// Dividir texto largo en líneas
|
return a.x - b.x; // Si están en la misma línea, ordenar por X
|
||||||
const words = element.content.split(' ');
|
}
|
||||||
const lines = [];
|
return a.y - b.y; // Ordenar por Y
|
||||||
let currentLine = '';
|
});
|
||||||
const maxWidth = Math.min(400, (element.width || 200) * 0.75);
|
|
||||||
|
|
||||||
for (const word of words) {
|
// Procesar elementos de la página
|
||||||
const testLine = currentLine + (currentLine ? ' ' : '') + word;
|
for (const element of sortedElements) {
|
||||||
const testWidth = helveticaFont.widthOfTextAtSize(testLine, 12);
|
// Calcular posición en el PDF manteniendo proporciones
|
||||||
|
const scaleX = pageWidthPoints / currentPageSize.value.width;
|
||||||
|
const scaleY = pageHeightPoints / currentPageSize.value.height;
|
||||||
|
|
||||||
if (testWidth <= maxWidth) {
|
const x = Math.max(50, element.x * scaleX);
|
||||||
currentLine = testLine;
|
const y = currentPageHeight - (element.y * scaleY) - 50; // Margen superior
|
||||||
} else {
|
|
||||||
if (currentLine) lines.push(currentLine);
|
switch (element.type) {
|
||||||
currentLine = word;
|
case 'text':
|
||||||
|
if (element.content) {
|
||||||
|
// Dividir texto largo en líneas
|
||||||
|
const words = element.content.split(' ');
|
||||||
|
const lines = [];
|
||||||
|
let currentLine = '';
|
||||||
|
const maxWidth = Math.min(pageWidthPoints - 100, (element.width || 200) * scaleX);
|
||||||
|
|
||||||
|
for (const word of words) {
|
||||||
|
const testLine = currentLine + (currentLine ? ' ' : '') + word;
|
||||||
|
const testWidth = helveticaFont.widthOfTextAtSize(testLine, 12);
|
||||||
|
|
||||||
|
if (testWidth <= maxWidth) {
|
||||||
|
currentLine = testLine;
|
||||||
|
} else {
|
||||||
|
if (currentLine) lines.push(currentLine);
|
||||||
|
currentLine = word;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (currentLine) lines.push(currentLine);
|
||||||
|
|
||||||
|
// Dibujar cada línea
|
||||||
|
lines.forEach((line, index) => {
|
||||||
|
currentPDFPage.drawText(line, {
|
||||||
|
x: x,
|
||||||
|
y: y - (index * 15),
|
||||||
|
size: 12,
|
||||||
|
font: helveticaFont,
|
||||||
|
color: rgb(0, 0, 0),
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (currentLine) lines.push(currentLine);
|
break;
|
||||||
|
|
||||||
// Dibujar cada línea
|
case 'image':
|
||||||
lines.forEach((line, index) => {
|
if (element.content && element.content.startsWith('data:image')) {
|
||||||
currentPage.drawText(line, {
|
try {
|
||||||
x: x,
|
// Convertir base64 a bytes
|
||||||
y: y - (index * 15),
|
const base64Data = element.content.split(',')[1];
|
||||||
size: 12,
|
const imageBytes = Uint8Array.from(
|
||||||
font: helveticaFont,
|
atob(base64Data),
|
||||||
color: rgb(0, 0, 0),
|
c => c.charCodeAt(0)
|
||||||
});
|
);
|
||||||
});
|
|
||||||
|
|
||||||
yOffset += lines.length * 15 + 10;
|
let image;
|
||||||
}
|
if (element.content.includes('image/jpeg') || element.content.includes('image/jpg')) {
|
||||||
break;
|
image = await pdfDoc.embedJpg(imageBytes);
|
||||||
|
} else if (element.content.includes('image/png')) {
|
||||||
case 'code':
|
image = await pdfDoc.embedPng(imageBytes);
|
||||||
if (element.content) {
|
|
||||||
// Dibujar fondo para el código
|
|
||||||
const codeLines = element.content.split('\n');
|
|
||||||
const codeWidth = Math.min(450, (element.width || 300) * 0.75);
|
|
||||||
const codeHeight = (codeLines.length * 12) + 20;
|
|
||||||
|
|
||||||
currentPage.drawRectangle({
|
|
||||||
x: x - 10,
|
|
||||||
y: y - codeHeight,
|
|
||||||
width: codeWidth,
|
|
||||||
height: codeHeight,
|
|
||||||
color: rgb(0.95, 0.95, 0.95),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Dibujar código
|
|
||||||
codeLines.forEach((line, index) => {
|
|
||||||
// Truncar líneas muy largas
|
|
||||||
const maxChars = Math.floor(codeWidth / 6);
|
|
||||||
const displayLine = line.length > maxChars ?
|
|
||||||
line.substring(0, maxChars - 3) + '...' : line;
|
|
||||||
|
|
||||||
currentPage.drawText(displayLine, {
|
|
||||||
x: x - 5,
|
|
||||||
y: y - 15 - (index * 12),
|
|
||||||
size: 9,
|
|
||||||
font: courierFont,
|
|
||||||
color: rgb(0, 0, 0),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
yOffset += codeHeight + 20;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'image':
|
|
||||||
if (element.content && element.content.startsWith('data:image')) {
|
|
||||||
try {
|
|
||||||
// Convertir base64 a bytes
|
|
||||||
const base64Data = element.content.split(',')[1];
|
|
||||||
const imageBytes = Uint8Array.from(
|
|
||||||
atob(base64Data),
|
|
||||||
c => c.charCodeAt(0)
|
|
||||||
);
|
|
||||||
|
|
||||||
let image;
|
|
||||||
if (element.content.includes('image/jpeg') || element.content.includes('image/jpg')) {
|
|
||||||
image = await pdfDoc.embedJpg(imageBytes);
|
|
||||||
} else if (element.content.includes('image/png')) {
|
|
||||||
image = await pdfDoc.embedPng(imageBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (image) {
|
|
||||||
// Calcular dimensiones manteniendo proporción
|
|
||||||
const maxWidth = Math.min(400, (element.width || 200) * 0.75);
|
|
||||||
const maxHeight = Math.min(300, (element.height || 150) * 0.75);
|
|
||||||
|
|
||||||
const imageAspectRatio = image.width / image.height;
|
|
||||||
let displayWidth = maxWidth;
|
|
||||||
let displayHeight = maxWidth / imageAspectRatio;
|
|
||||||
|
|
||||||
if (displayHeight > maxHeight) {
|
|
||||||
displayHeight = maxHeight;
|
|
||||||
displayWidth = maxHeight * imageAspectRatio;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPage.drawImage(image, {
|
if (image) {
|
||||||
|
// Calcular dimensiones manteniendo proporción y escala
|
||||||
|
const maxWidth = Math.min(pageWidthPoints - 100, (element.width || 200) * scaleX);
|
||||||
|
const maxHeight = Math.min(300, (element.height || 150) * scaleY);
|
||||||
|
|
||||||
|
const imageAspectRatio = image.width / image.height;
|
||||||
|
let displayWidth = maxWidth;
|
||||||
|
let displayHeight = maxWidth / imageAspectRatio;
|
||||||
|
|
||||||
|
if (displayHeight > maxHeight) {
|
||||||
|
displayHeight = maxHeight;
|
||||||
|
displayWidth = maxHeight * imageAspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentPDFPage.drawImage(image, {
|
||||||
|
x: x,
|
||||||
|
y: y - displayHeight,
|
||||||
|
width: displayWidth,
|
||||||
|
height: displayHeight,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (imageError) {
|
||||||
|
console.warn('Error al procesar imagen:', imageError);
|
||||||
|
// Dibujar placeholder para imagen
|
||||||
|
currentPDFPage.drawRectangle({
|
||||||
x: x,
|
x: x,
|
||||||
y: y - displayHeight,
|
y: y - 60,
|
||||||
width: displayWidth,
|
width: 100 * scaleX,
|
||||||
height: displayHeight,
|
height: 60 * scaleY,
|
||||||
|
borderColor: rgb(0.7, 0.7, 0.7),
|
||||||
|
borderWidth: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
yOffset += displayHeight + 20;
|
currentPDFPage.drawText('[Imagen no disponible]', {
|
||||||
|
x: x + 5,
|
||||||
|
y: y - 35,
|
||||||
|
size: 10,
|
||||||
|
font: helveticaFont,
|
||||||
|
color: rgb(0.7, 0.7, 0.7),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (imageError) {
|
} else {
|
||||||
console.warn('Error al procesar imagen:', imageError);
|
// Placeholder para imagen vacía
|
||||||
// Dibujar placeholder para imagen
|
currentPDFPage.drawRectangle({
|
||||||
currentPage.drawRectangle({
|
|
||||||
x: x,
|
x: x,
|
||||||
y: y - 60,
|
y: y - 60,
|
||||||
width: 100,
|
width: 100 * scaleX,
|
||||||
height: 60,
|
height: 60 * scaleY,
|
||||||
borderColor: rgb(0.7, 0.7, 0.7),
|
borderColor: rgb(0.7, 0.7, 0.7),
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
borderDashArray: [3, 3],
|
||||||
});
|
});
|
||||||
|
|
||||||
currentPage.drawText('[Imagen no disponible]', {
|
currentPDFPage.drawText('[Imagen]', {
|
||||||
x: x + 5,
|
x: x + 25,
|
||||||
y: y - 35,
|
y: y - 35,
|
||||||
size: 10,
|
size: 10,
|
||||||
font: helveticaFont,
|
font: helveticaFont,
|
||||||
color: rgb(0.7, 0.7, 0.7),
|
color: rgb(0.7, 0.7, 0.7),
|
||||||
});
|
});
|
||||||
|
|
||||||
yOffset += 80;
|
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
// Placeholder para imagen vacía
|
|
||||||
currentPage.drawRectangle({
|
|
||||||
x: x,
|
|
||||||
y: y - 60,
|
|
||||||
width: 100,
|
|
||||||
height: 60,
|
|
||||||
borderColor: rgb(0.7, 0.7, 0.7),
|
|
||||||
borderWidth: 1,
|
|
||||||
borderDashArray: [3, 3],
|
|
||||||
});
|
|
||||||
|
|
||||||
currentPage.drawText('[Imagen]', {
|
case 'table':
|
||||||
x: x + 25,
|
if (element.content && element.content.data) {
|
||||||
y: y - 35,
|
const tableData = element.content.data;
|
||||||
size: 10,
|
const cellWidth = 80 * scaleX;
|
||||||
font: helveticaFont,
|
const cellHeight = 20 * scaleY;
|
||||||
color: rgb(0.7, 0.7, 0.7),
|
const tableWidth = tableData[0].length * cellWidth;
|
||||||
});
|
const tableHeight = tableData.length * cellHeight;
|
||||||
|
|
||||||
yOffset += 80;
|
// Dibujar bordes de la tabla
|
||||||
}
|
currentPDFPage.drawRectangle({
|
||||||
break;
|
x: x,
|
||||||
|
y: y - tableHeight,
|
||||||
|
width: tableWidth,
|
||||||
|
height: tableHeight,
|
||||||
|
borderColor: rgb(0.3, 0.3, 0.3),
|
||||||
|
borderWidth: 1,
|
||||||
|
});
|
||||||
|
|
||||||
case 'table':
|
// Dibujar contenido de las celdas
|
||||||
if (element.content && element.content.data) {
|
tableData.forEach((row, rowIndex) => {
|
||||||
const tableData = element.content.data;
|
row.forEach((cell, colIndex) => {
|
||||||
const cellWidth = 80;
|
const cellX = x + (colIndex * cellWidth);
|
||||||
const cellHeight = 20;
|
const cellY = y - (rowIndex * cellHeight) - 15;
|
||||||
const tableWidth = tableData[0].length * cellWidth;
|
|
||||||
const tableHeight = tableData.length * cellHeight;
|
|
||||||
|
|
||||||
// Dibujar bordes de la tabla
|
// Dibujar borde de celda
|
||||||
currentPage.drawRectangle({
|
currentPDFPage.drawRectangle({
|
||||||
x: x,
|
x: cellX,
|
||||||
y: y - tableHeight,
|
y: y - ((rowIndex + 1) * cellHeight),
|
||||||
width: tableWidth,
|
width: cellWidth,
|
||||||
height: tableHeight,
|
height: cellHeight,
|
||||||
borderColor: rgb(0.3, 0.3, 0.3),
|
borderColor: rgb(0.7, 0.7, 0.7),
|
||||||
borderWidth: 1,
|
borderWidth: 0.5,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dibujar contenido de las celdas
|
// Dibujar texto de la celda (truncar si es muy largo)
|
||||||
tableData.forEach((row, rowIndex) => {
|
const maxChars = Math.floor(cellWidth / 8);
|
||||||
row.forEach((cell, colIndex) => {
|
const displayText = cell.length > maxChars ?
|
||||||
const cellX = x + (colIndex * cellWidth);
|
cell.substring(0, maxChars - 3) + '...' : cell;
|
||||||
const cellY = y - (rowIndex * cellHeight) - 15;
|
|
||||||
|
|
||||||
// Dibujar borde de celda
|
currentPDFPage.drawText(displayText, {
|
||||||
currentPage.drawRectangle({
|
x: cellX + 5,
|
||||||
x: cellX,
|
y: cellY,
|
||||||
y: y - ((rowIndex + 1) * cellHeight),
|
size: 8,
|
||||||
width: cellWidth,
|
font: helveticaFont,
|
||||||
height: cellHeight,
|
color: rowIndex === 0 ? rgb(0.2, 0.2, 0.8) : rgb(0, 0, 0),
|
||||||
borderColor: rgb(0.7, 0.7, 0.7),
|
});
|
||||||
borderWidth: 0.5,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Dibujar texto de la celda (truncar si es muy largo)
|
|
||||||
const maxChars = 10;
|
|
||||||
const displayText = cell.length > maxChars ?
|
|
||||||
cell.substring(0, maxChars - 3) + '...' : cell;
|
|
||||||
|
|
||||||
currentPage.drawText(displayText, {
|
|
||||||
x: cellX + 5,
|
|
||||||
y: cellY,
|
|
||||||
size: 8,
|
|
||||||
font: helveticaFont,
|
|
||||||
color: rowIndex === 0 ? rgb(0.2, 0.2, 0.8) : rgb(0, 0, 0), // Encabezados en azul
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
break;
|
||||||
yOffset += tableHeight + 20;
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,6 +499,8 @@ const clearCanvas = () => {
|
|||||||
pages.value = [{ id: 1, elements: [] }];
|
pages.value = [{ id: 1, elements: [] }];
|
||||||
selectedElementId.value = null;
|
selectedElementId.value = null;
|
||||||
elementCounter.value = 0;
|
elementCounter.value = 0;
|
||||||
|
pageIdCounter.value = 1; // <-- Resetear también el contador de páginas
|
||||||
|
currentPage.value = 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -526,7 +523,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex h-screen bg-gray-50 dark:bg-primary-d/50">
|
<div class="flex h-screen bg-gray-50 dark:bg-primary-d/50">
|
||||||
<!-- Panel Izquierdo - Elementos -->
|
<!-- Panel Izquierdo - Elementos (sin cambios) -->
|
||||||
<div class="w-64 bg-white dark:bg-primary-d border-r border-gray-200 dark:border-primary/20 flex flex-col">
|
<div class="w-64 bg-white dark:bg-primary-d border-r border-gray-200 dark:border-primary/20 flex flex-col">
|
||||||
<!-- Header del panel -->
|
<!-- Header del panel -->
|
||||||
<div class="p-4 border-b border-gray-200 dark:border-primary/20">
|
<div class="p-4 border-b border-gray-200 dark:border-primary/20">
|
||||||
@ -602,18 +599,12 @@ onMounted(() => {
|
|||||||
|
|
||||||
<!-- Área Principal con Viewport -->
|
<!-- Área Principal con Viewport -->
|
||||||
<div class="flex-1 flex flex-col">
|
<div class="flex-1 flex flex-col">
|
||||||
<!-- Toolbar superior -->
|
<!-- Toolbar superior básico -->
|
||||||
<div class="h-14 bg-white dark:bg-primary-d border-b border-gray-200 dark:border-primary/20 flex items-center justify-between px-4">
|
<div class="h-14 bg-white dark:bg-primary-d border-b border-gray-200 dark:border-primary/20 flex items-center justify-between px-4">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<!-- Herramientas de formato (simuladas) -->
|
<h2 class="font-semibold text-gray-900 dark:text-primary-dt text-sm">
|
||||||
<div class="flex items-center gap-1 text-sm">
|
{{ documentTitle }}
|
||||||
<button class="p-1 hover:bg-gray-100 dark:hover:bg-primary/10 rounded" :disabled="isExporting">
|
</h2>
|
||||||
<GoogleIcon name="format_bold" class="text-gray-600 dark:text-primary-dt" />
|
|
||||||
</button>
|
|
||||||
<button class="p-1 hover:bg-gray-100 dark:hover:bg-primary/10 rounded" :disabled="isExporting">
|
|
||||||
<GoogleIcon name="format_italic" class="text-gray-600 dark:text-primary-dt" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
@ -633,6 +624,13 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- TextFormatter como toolbar estático -->
|
||||||
|
<TextFormatter
|
||||||
|
:element="textFormatterElement"
|
||||||
|
:visible="showTextFormatter"
|
||||||
|
@update="updateElement"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- PDFViewport -->
|
<!-- PDFViewport -->
|
||||||
<PDFViewport
|
<PDFViewport
|
||||||
ref="viewportRef"
|
ref="viewportRef"
|
||||||
@ -644,6 +642,7 @@ onMounted(() => {
|
|||||||
@add-page="addPage"
|
@add-page="addPage"
|
||||||
@delete-page="deletePage"
|
@delete-page="deletePage"
|
||||||
@page-change="(page) => currentPage = page"
|
@page-change="(page) => currentPage = page"
|
||||||
|
@page-size-change="handlePageSizeChange"
|
||||||
>
|
>
|
||||||
<template #elements="{ page, pageIndex }">
|
<template #elements="{ page, pageIndex }">
|
||||||
<CanvasElement
|
<CanvasElement
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
import Adding from '@Holos/Button/ButtonRh.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -12,10 +13,7 @@ import GoogleIcon from '@Shared/GoogleIcon.vue';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="inline-flex items-center gap-3 bg-[#2563eb] hover:bg-[#1e40af] text-white px-4 py-2 rounded-full shadow-md">
|
<Adding text="Procesar Nómina" />
|
||||||
<GoogleIcon class="text-white text-xl" name="add" />
|
|
||||||
Procesar Nómina
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
import Adding from '@Holos/Button/ButtonRh.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -12,10 +13,7 @@ import GoogleIcon from '@Shared/GoogleIcon.vue';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="inline-flex items-center gap-3 bg-[#2563eb] hover:bg-[#1e40af] text-white px-4 py-2 rounded-full shadow-md">
|
<Adding text="Agregar Información" />
|
||||||
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor"><path d="M12 4v16M20 12H4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
||||||
Actualizar Información
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -130,24 +130,16 @@ const router = createRouter({
|
|||||||
title: 'Inicio',
|
title: 'Inicio',
|
||||||
icon: 'home',
|
icon: 'home',
|
||||||
},
|
},
|
||||||
redirect: '/admin/dashboard',
|
redirect: '/admin/employees',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'dashboard',
|
path: 'dashboard',
|
||||||
name: 'admin.dashboard',
|
name: 'admin.dashboard.index',
|
||||||
component: () => import('@Pages/Dashboard/Admin.vue'),
|
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Dashboard',
|
title: 'Dashboard',
|
||||||
icon: 'grid_view',
|
icon: 'grid_view',
|
||||||
},
|
},
|
||||||
redirect: '/admin/dashboard',
|
component: () => import('@Pages/Dashboard/Admin.vue'),
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
name: 'admin.dashboard.index',
|
|
||||||
component: () => import('@Pages/Dashboard/Admin.vue'),
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'employees',
|
path: 'employees',
|
||||||
@ -162,71 +154,27 @@ const router = createRouter({
|
|||||||
path: '',
|
path: '',
|
||||||
name: 'admin.employees.index',
|
name: 'admin.employees.index',
|
||||||
component: () => import('@Pages/Employees/Index.vue'),
|
component: () => import('@Pages/Employees/Index.vue'),
|
||||||
}
|
},
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'academic',
|
|
||||||
name: 'admin.academic',
|
|
||||||
meta: {
|
|
||||||
title: 'Historial Académico',
|
|
||||||
icon: 'school',
|
|
||||||
},
|
|
||||||
redirect: '/admin/academic',
|
|
||||||
children: [
|
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'academic',
|
||||||
name: 'admin.academic.index',
|
name: 'admin.academic.index',
|
||||||
component: () => import('@Pages/Academic/Index.vue'),
|
component: () => import('@Pages/Academic/Index.vue'),
|
||||||
}
|
},
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'security',
|
|
||||||
name: 'admin.security',
|
|
||||||
meta: {
|
|
||||||
title: 'Seguridad y Salud',
|
|
||||||
icon: 'security',
|
|
||||||
},
|
|
||||||
redirect: '/admin/security',
|
|
||||||
children: [
|
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'security',
|
||||||
name: 'admin.security.index',
|
name: 'admin.security.index',
|
||||||
component: () => import('@Pages/Security/Index.vue'),
|
component: () => import('@Pages/Security/Index.vue'),
|
||||||
}
|
},
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'payroll',
|
|
||||||
name: 'admin.payroll',
|
|
||||||
meta: {
|
|
||||||
title: 'Nómina',
|
|
||||||
icon: 'payments',
|
|
||||||
},
|
|
||||||
redirect: '/admin/payroll',
|
|
||||||
children: [
|
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'payroll',
|
||||||
name: 'admin.payroll.index',
|
name: 'admin.payroll.index',
|
||||||
component: () => import('@Pages/Payroll/Index.vue'),
|
component: () => import('@Pages/Payroll/Index.vue'),
|
||||||
}
|
},
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'additional',
|
|
||||||
name: 'admin.additional',
|
|
||||||
meta: {
|
|
||||||
title: 'Información Adicional',
|
|
||||||
icon: 'info',
|
|
||||||
},
|
|
||||||
redirect: '/admin/additional',
|
|
||||||
children: [
|
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'additional',
|
||||||
name: 'admin.additional.index',
|
name: 'admin.additional.index',
|
||||||
component: () => import('@Pages/Additional/Index.vue'),
|
component: () => import('@Pages/Additional/Index.vue'),
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user