|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
<script>
|
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
import html2canvas from 'html2canvas';
|
|
|
|
|
import Organized from '$lib/form/Organized.svelte';
|
|
|
|
|
import Colabs from './Colabs.svelte';
|
|
|
|
|
import { onMount } from "svelte";
|
|
|
|
|
import html2canvas from "html2canvas";
|
|
|
|
|
import Organized from "$lib/form/Organized.svelte";
|
|
|
|
|
import Colabs from "./Colabs.svelte";
|
|
|
|
|
import {
|
|
|
|
|
title,
|
|
|
|
|
heading,
|
|
|
|
@ -13,18 +13,18 @@
|
|
|
|
|
weekday,
|
|
|
|
|
address,
|
|
|
|
|
city,
|
|
|
|
|
canvas
|
|
|
|
|
} from '$lib/stores/store';
|
|
|
|
|
canvas,
|
|
|
|
|
} from "$lib/stores/store";
|
|
|
|
|
|
|
|
|
|
/** @type {HTMLDivElement} */ let editor;
|
|
|
|
|
|
|
|
|
|
const handleSubmit = async () => {
|
|
|
|
|
console.log('submit');
|
|
|
|
|
console.log("submit");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getContent = () => {
|
|
|
|
|
if (!editor) {
|
|
|
|
|
console.log('no hay editor');
|
|
|
|
|
console.log("no hay editor");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (editor && editor.firstChild !== null) {
|
|
|
|
@ -35,11 +35,11 @@
|
|
|
|
|
const saveCanvas = async () => {
|
|
|
|
|
if ($canvas !== undefined) {
|
|
|
|
|
const img = await html2canvas($canvas, { scale: 2 });
|
|
|
|
|
const image = img.toDataURL('image/png');
|
|
|
|
|
const image = img.toDataURL("image/png");
|
|
|
|
|
const data = new FormData();
|
|
|
|
|
data.append('image', image);
|
|
|
|
|
data.append("image", image);
|
|
|
|
|
data.append(
|
|
|
|
|
'content',
|
|
|
|
|
"content",
|
|
|
|
|
JSON.stringify({
|
|
|
|
|
title: $title,
|
|
|
|
|
heading: $heading,
|
|
|
|
@ -49,13 +49,13 @@
|
|
|
|
|
time: $time,
|
|
|
|
|
weekday: $weekday,
|
|
|
|
|
address: $address,
|
|
|
|
|
city: $city
|
|
|
|
|
city: $city,
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const req = await fetch('/admin', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: data
|
|
|
|
|
const req = await fetch("/admin", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: data,
|
|
|
|
|
});
|
|
|
|
|
console.log(req);
|
|
|
|
|
}
|
|
|
|
@ -64,11 +64,11 @@
|
|
|
|
|
const downloadCanvas = async () => {
|
|
|
|
|
if ($canvas !== undefined) {
|
|
|
|
|
const res = await html2canvas($canvas, { scale: 2 });
|
|
|
|
|
const image = res.toDataURL('image/png');
|
|
|
|
|
const link = document.createElement('a');
|
|
|
|
|
link.download = `${$date.split('-')[0]}-${$date.split('-')[1]}-${
|
|
|
|
|
$date.split('-')[2].split('T')[0]
|
|
|
|
|
}-${$city.replace(' ', '_')}-cartel.png`;
|
|
|
|
|
const image = res.toDataURL("image/png");
|
|
|
|
|
const link = document.createElement("a");
|
|
|
|
|
link.download = `${$date.split("-")[0]}-${$date.split("-")[1]}-${
|
|
|
|
|
$date.split("-")[2].split("T")[0]
|
|
|
|
|
}-${$city.replace(" ", "_")}-cartel.png`;
|
|
|
|
|
link.href = image;
|
|
|
|
|
link.click();
|
|
|
|
|
}
|
|
|
|
@ -76,21 +76,21 @@
|
|
|
|
|
|
|
|
|
|
const quillOptions = {
|
|
|
|
|
modules: {
|
|
|
|
|
toolbar: [['bold', 'italic']]
|
|
|
|
|
toolbar: [["bold", "italic"]],
|
|
|
|
|
},
|
|
|
|
|
theme: 'snow'
|
|
|
|
|
theme: "snow",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
|
const { default: Quill } = await import('quill');
|
|
|
|
|
const { default: Quill } = await import("quill");
|
|
|
|
|
|
|
|
|
|
let quill = new Quill(editor, {
|
|
|
|
|
modules: {
|
|
|
|
|
toolbar: quillOptions
|
|
|
|
|
toolbar: quillOptions,
|
|
|
|
|
},
|
|
|
|
|
theme: 'snow',
|
|
|
|
|
theme: "snow",
|
|
|
|
|
placeholder:
|
|
|
|
|
'Participan:\nFernando Marín (DMD)\nPresenta:\nFernanda del Castillo (DMD Asturias)'
|
|
|
|
|
"Participan:\nFernando Marín (DMD)\nPresenta:\nFernanda del Castillo (DMD Asturias)",
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
@ -113,7 +113,12 @@
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="subtitle">Subtítulo</label>
|
|
|
|
|
<input bind:value={$subtitle} type="text" name="subtitle" placeholder="Subtítulo" />
|
|
|
|
|
<input
|
|
|
|
|
bind:value={$subtitle}
|
|
|
|
|
type="text"
|
|
|
|
|
name="subtitle"
|
|
|
|
|
placeholder="Subtítulo"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
@ -134,7 +139,12 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div class="dayname">
|
|
|
|
|
<label for="weekday">Día de la semana</label>
|
|
|
|
|
<input bind:value={$weekday} type="text" name="weekday" placeholder="Ej. Lunes" />
|
|
|
|
|
<input
|
|
|
|
|
bind:value={$weekday}
|
|
|
|
|
type="text"
|
|
|
|
|
name="weekday"
|
|
|
|
|
placeholder="Ej. Lunes"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -142,7 +152,6 @@
|
|
|
|
|
<label for="address">Dirección</label>
|
|
|
|
|
<textarea
|
|
|
|
|
bind:value={$address}
|
|
|
|
|
type="text"
|
|
|
|
|
name="address"
|
|
|
|
|
placeholder="Ej. Calle del Abeto, 4"
|
|
|
|
|
/>
|
|
|
|
|