|
@@ -1,14 +1,20 @@
|
|
|
<script>
|
|
|
- import { schueler, medien, titel, print, configData } from "./../stores.js";
|
|
|
+ import { schueler, print, configData } from "./../stores.js";
|
|
|
import { ipcRenderer } from 'electron'
|
|
|
import PrintKurs from './Print/Kurs.svelte'
|
|
|
import PrintSchueler from './Print/Schueler.svelte'
|
|
|
import PrintMedien from './Print/Medien.svelte'
|
|
|
+ import * as notifier from './../notifier.js'
|
|
|
|
|
|
let c
|
|
|
+ const pdf_name = _ => {
|
|
|
+ const d = new Date().getTime()
|
|
|
+ return `${$schueler[0].klasse}_${$schueler[0].kurs}_${$schueler[0].jahr}_${d}.pdf`
|
|
|
+ }
|
|
|
|
|
|
ipcRenderer.on('pdf-reply', (event, arg) => {
|
|
|
console.log('PDF: ', arg)
|
|
|
+ notifier.fertig('PDF erfolgreich gespeichert')
|
|
|
})
|
|
|
ipcRenderer.on('print-reply', (event, arg) => {
|
|
|
console.log('Print: ', arg)
|
|
@@ -16,13 +22,14 @@
|
|
|
|
|
|
function handle_keydown(event) {
|
|
|
if (event.key === "Escape") $print = false;
|
|
|
- if (event.key === 'p') ipcRenderer.send('print', 'print')
|
|
|
- if (event.key === 's') ipcRenderer.send('pdf', "test_case.pdf")
|
|
|
+ if (event.key === 'p') ipcRenderer.send('print')
|
|
|
+ if (event.key === 's') ipcRenderer.send('pdf', pdf_name())
|
|
|
}
|
|
|
|
|
|
- async function loader (file) {
|
|
|
- const component = import(`./Print/${file}.svelte`)
|
|
|
- return component
|
|
|
+ function run_settings (node) {
|
|
|
+ if (c != PrintKurs) return
|
|
|
+ $configData.gruppe_print_dialog && ipcRenderer.send('print')
|
|
|
+ $configData.gruppe_auto_pdf && ipcRenderer.send('pdf', pdf_name())
|
|
|
}
|
|
|
|
|
|
$: if ($print.name === 'Schueler') c = PrintSchueler
|
|
@@ -33,7 +40,7 @@
|
|
|
<svelte:window on:keydown={handle_keydown} />
|
|
|
|
|
|
{#if c}
|
|
|
- <article class="message is-default no-print" style="position: absolute; top: 2rem; left: 65rem">
|
|
|
+ <article class="message is-default no-print" style="position: absolute; top: 2rem; left: 65rem" use:run_settings>
|
|
|
<div class="message-header">
|
|
|
<span class="icon">
|
|
|
<i class="mdi">info</i>
|
|
@@ -43,8 +50,10 @@
|
|
|
<div class="message-body">
|
|
|
Drucken: <b>p</b>
|
|
|
<br>
|
|
|
+ PDF: <b>s</b>
|
|
|
+ <br>
|
|
|
Abbrechen: <b>ESC</b>
|
|
|
</div>
|
|
|
</article>
|
|
|
- <svelte:component this={c} />
|
|
|
+ <svelte:component this={c}/>
|
|
|
{/if}
|