Added Mailtemplate
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Mailtemplate")?>">Emailtemplates</a></li>
|
||||
<li class="breadcrumb-item active"><?=($template->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
<li class="breadcrumb-item active"><?=($template && $template->id) ? $template->code : "Neu" ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?=($template->id) ? "Emailtemplate bearbeiten" : "Neues Emailtemplate" ?></h4>
|
||||
@@ -31,23 +31,47 @@
|
||||
<input type="hidden" name="id" value="<?=$template->id?>" />
|
||||
|
||||
<div class="form-group row col-12">
|
||||
<label class="form-label" for="name">Template Name:</label>
|
||||
<input type="text" class="form-control" name="name" id="name" value="<?=$template->name?>" placeholder="Template Name" style="border-radius:0;" />
|
||||
<label class="form-label" for="name">Template Name *:</label>
|
||||
<input type="text" class="form-control" name="name" id="name" value="<?=$template->name?>" placeholder="Template Name" />
|
||||
</div>
|
||||
|
||||
<h4 class="mt-4">Emailtemplate</h4>
|
||||
<div class="form-group row col-12">
|
||||
<label class="form-label" for="code">Template Code:</label>
|
||||
<input type="text" class="form-control" id="code" value="<?=$template->code?>" disabled="disabled" />
|
||||
</div>
|
||||
|
||||
<div class="form-group row col-12">
|
||||
<label class="form-label" for="description">Beschreibung:</label>
|
||||
<input type="text" class="form-control" name="description" id="description" value="<?=$template->description?>" placeholder="Beschreibung" />
|
||||
</div>
|
||||
|
||||
<hr class="mt-3" />
|
||||
|
||||
<h4 class="mt-3">Emailtemplate</h4>
|
||||
|
||||
<div class="form-group row col-12 mt-3">
|
||||
<label><input type="checkbox" class="" id="is_include" name="is_include" value="1" <?=($template && $template->is_include) ? "checked='checked'" : ""?> /> Template zum Einbetten</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row mt-3 col-12">
|
||||
<label class="form-label" for="subject">Betreff:</label>
|
||||
<label class="form-label" for="subject">Betreff *:</label>
|
||||
<input type="text" class="form-control" name="subject" id="subject" value="<?=$template->subject?>" placeholder="Betreff" style="border-radius:0;" />
|
||||
</div>
|
||||
<textarea id="body_html" name="body_html" placeholder="Bitte geben Sie hier den Emailinhalt ein..." rows="12" style="width: 100%; height: 600px; padding: 10px;"><?= htmlentities($template->body)?></textarea>
|
||||
|
||||
<div class="form-group row col-12 mt-3">
|
||||
<label><input type="checkbox" id="is_html" name="is_html" value="1" <?=($template && $template->body_text) ? "" : "checked='checked'"?> onchange="toggleHtml()" /> HTML-Template</label>
|
||||
</div>
|
||||
|
||||
<h4>Template Text</h4>
|
||||
<textarea id="body_text" name="body_text" class="<?=($template && $template->body_text) ? "" : "hidden"?>" placeholder="Bitte geben Sie hier den Emailinhalt ein..." rows="12" style="width: 100%; height: 600px; padding: 10px;"><?= htmlentities($template->body_text)?></textarea>
|
||||
<textarea id="body_html" name="body_html" class="<?=(!$template || $template->body_html) ? "" : "hidden"?>" placeholder="Bitte geben Sie hier den Emailinhalt ein..." rows="12" style="width: 100%; height: 600px; padding: 10px;"><?= htmlentities($template->body_html)?></textarea>
|
||||
|
||||
|
||||
|
||||
<h4 class="mt-4">Dateianhänge</h4>
|
||||
<div class="form-group row mb-3">
|
||||
<div class="col-xl-5 input-grop">
|
||||
<div class="col-xl-4 input-grop">
|
||||
<div class="custom-file">
|
||||
<input type="file" name="attachment[]" id="attachment" class="custom-file-input" multiple="multiple" />
|
||||
<label class="custom-file-label" for="attachment"> Datei(en) auswählen</label>
|
||||
@@ -58,12 +82,20 @@
|
||||
<?php if(is_array($template->files) && count($template->files)): ?>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="card" style="">
|
||||
<ul class="list-group list-group-flush">
|
||||
<?php foreach($template->files as $file): ?>
|
||||
<li id="file-<?=$file->id?>" class="list-group-item"><input type="hidden" name="deletefile[<?=$file->id?>]" id="deletefile-<?=$file->id?>" value="" /><a href="#" onclick="deleteFile(<?=$file->id?>)" class="mr-2"><i class="far fa-trash text-danger"></i></a> <span class="filename"><i class="far fa-file"></i> <?=$file->filename?></span></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<div class="card">
|
||||
<?php foreach($template->files as $file): ?>
|
||||
<input type="hidden" name="deletefile[<?=$file->id?>]" id="deletefile-<?=$file->id?>" value="" />
|
||||
<ul id="file-<?=$file->id?>" class="list-group list-group-horizontal">
|
||||
<li class="list-group-item flex-fill" style="border-radius: 0;">
|
||||
<span class="filename text-monospace"><i class="far fa-file"></i> <?=$file->filename?></span>
|
||||
</li><li class="list-group-item" style="border-radius: 0;">
|
||||
<a href="<?=self::getUrl("File", "download", ["id" => $file->file->id])?>"><i class="far fa-download text-primary"></i></a>
|
||||
</li><li class="list-group-item" style="border-radius: 0;">
|
||||
<a href="#" onclick="deleteFile(<?=$file->id?>)"><i class="far fa-trash-alt text-danger"></i></a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -105,27 +137,18 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var menu_vars = [
|
||||
['vorname', "Vorname"],
|
||||
['nachname', "Nachname"],
|
||||
['firma', "Firma"],
|
||||
['firma_oder_name', "Firma oder Name"],
|
||||
['email', "Emailadresse"],
|
||||
['anschluss_oaid', "Anschluss OAID"],
|
||||
['anschluss_strasse', "Anschluss Straße"],
|
||||
['anschluss_hausnummer', "Anschluss Hausnummer"],
|
||||
['anschluss_plz', "Anschluss PLZ"],
|
||||
['anschluss_ort', "Anschluss Ort"],
|
||||
['anschluss_gemeinde', "Anschluss Gemeinde"],
|
||||
['preorder_code', "Bestellcode"],
|
||||
];
|
||||
|
||||
var menu_vars = [];
|
||||
<?php foreach($embeds as $embed): ?>
|
||||
menu_vars.push(['<?=$embed->code?>', "<?=$embed->name?>"]);
|
||||
<?php endforeach; ?>
|
||||
|
||||
var menu_vars_items = "";
|
||||
menu_vars.forEach((item) => { menu_vars_items += " " + item[0]});
|
||||
menu_vars_items = menu_vars_items.trim();
|
||||
console.log(menu_vars_items);
|
||||
|
||||
$(function () {
|
||||
function initEditor() {
|
||||
tinymce.init({
|
||||
//font_formats: "Arial=arial,sans-serif;",
|
||||
selector: '#body_html',
|
||||
@@ -149,7 +172,7 @@
|
||||
editor.ui.registry.addMenuItem(item[0], {
|
||||
text: item[1],
|
||||
onAction: function () {
|
||||
editor.insertContent('{{' + item[0].toUpperCase() + '}}');
|
||||
editor.insertContent('{{EMBED:' + item[0].toLowerCase() + '}}');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -159,12 +182,37 @@
|
||||
});
|
||||
|
||||
bsCustomFileInput.init();
|
||||
}
|
||||
|
||||
$(function () {
|
||||
initEditor();
|
||||
if($("#body_html").hasClass("hidden")) {
|
||||
tinymce.get("body_html").hide();
|
||||
$("#body_html").hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function toggleHtml() {
|
||||
console.log($("#body_html"));
|
||||
console.log($("#body_text"));
|
||||
if($("#is_html").is(":checked")) {
|
||||
console.log("is checked");
|
||||
$("#body_text").hide();
|
||||
tinymce.get("body_html").show();
|
||||
} else {
|
||||
console.log("is not checked");
|
||||
$("#body_text").show();
|
||||
tinymce.get("body_html").hide();
|
||||
$("#body_html").hide();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function deleteFile(id) {
|
||||
event.preventDefault();
|
||||
console.log($("#deletefile-" + id).val());
|
||||
//console.log($("#deletefile-" + id).val());
|
||||
if(!$("#deletefile-" + id).val()) {
|
||||
$('#file-' + id + " .filename").css("text-decoration", "line-through");
|
||||
$('#file-' + id + " .filename").css("color", "red");
|
||||
|
||||
Reference in New Issue
Block a user