/**
* Copyright (C) 2022 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* @usage:
* Preperations:
* Be sure to have PrimeVue loaded with the toast and confirmdialog
* components as primevue variable
* Install:
* Import this Plugin and install it with the app.use() function.
* Use:
* In your component you can call now the global property $fhcAlert
* which has the following functions:
*
* alertSuccess
* ------------
* Displays a success message
* @param string message
* @return void
*
* alertInfo
* ---------
* Displays an info message
* @param string message
* @return void
*
* alertWarning
* ------------
* Displays a warning
* @param string message
* @return void
*
* alertError
* ----------
* Displays an error
* @param string message
* @return void
*
* alertSystemError
* ----------------
* Displays an alert with the error details and a button to mail
* the error to the Support Team
* @param string message
* @return void
*
* confirmDelete
* -------------
* Displays a confirmation dialog and returns a Promise which resolves
* with true or false depending und the pressed button.
* @return Promise
*
* alertDefault
* ------------
* Displays an alert
* @param string severity can be 'success', 'info', 'warning', 'error'
* @param string title
* @param string message
* @param boolean sticky (optional) defaults to false
* @return void
*
* alertMultiple
* -------------
* Displays multiple alerts
* @param array messageArray
* @param string severity (optional) defaults to 'info'
* @param string title (optional) defaults to 'Info'
* @param boolean sticky (optional) defaults to false
* @return void
*
* handleSystemError
* -----------------
* Automatiticly determine how to display an system error and display it.
* This would be used in a catch block of an ajax call.
* @param mixed error
* @return void
*
* handleSystemMessage
* -------------------
* Automatiticly determine how to display a message and display it.
* @param mixed message
* @return void
*/
/*
import PvConfig from "../../../index.ci.php/public/js/components/primevue/config/config.esm.min.js";
import PvToast from "../../../index.ci.php/public/js/components/primevue/toast/toast.esm.min.js";
import PvConfirm from "../../../index.ci.php/public/js/components/primevue/confirmdialog/confirmdialog.esm.min.js";
import PvConfirmationService from "../../../index.ci.php/public/js/components/primevue/confirmationservice/confirmationservice.esm.min.js";
*/
import { createApp } from 'vue';
import PvConfig from 'primevue/config';
import PvToast from 'primevue/toast';
import PvConfirm from 'primevue/confirmdialog';
import PvConfirmationService from 'primevue/confirmationservice';
import {CoreRESTClient} from '../RESTClient.js';
const helperAppContainer = document.createElement('div');
const helperApp = createApp({
components: {
PvToast,
PvConfirm
},
methods: {
mailToUrl(slotProps) {
let mailTo = 'noreply@technikum-wien.at'; // TODO domain anpassen
let subject = 'Meldung%20Systemfehler';
let body = `
Danke, dass Sie uns den Fehler melden. %0D%0A %0D%0A
Bitte beschreiben Sie uns ausführlich das Problem.%0D%0A
Bsp: Ich habe X ausgewählt und Y angelegt. Beim Speichern erhielt ich die Fehlermeldung. [Optional: Ich habe den Browser Z verwendet.]%0D%0A
-----------------------------------------------------------------------------------------------------------------------------------%0D%0A
PROBLEM: ... %0D%0A %0D%0A %0D%0A
-----------------------------------------------------------------------------------------------------------------------------------%0D%0A
Fehler URL: ` + FHC_JS_DATA_STORAGE_OBJECT.called_path + '/' + FHC_JS_DATA_STORAGE_OBJECT.called_method + `%0D%0A
Fehler Meldung: ` + slotProps.message.detail + `%0D%0A
-----------------------------------------------------------------------------------------------------------------------------------%0D%0A %0D%0A
Wir kümmern uns um eine rasche Behebung des Problems!`
return "mailto:" + mailTo + "?subject=" + subject + "&body=" + body;
},
openMessagecard(e) {
bootstrap.Collapse.getOrCreateInstance(e.target.getAttribute('href')).toggle();
}
},
unmounted() {
helperAppContainer.parentElement.removeChild(helperAppContainer);
},
template: `
{{slotProps.message.summary}}
Sorry! Ein interner technischer Fehler ist aufgetreten.