WIP Mailtemplate 2024-08-22
This commit is contained in:
179
Layout/default/Mailtemplate/Form.php
Normal file
179
Layout/default/Mailtemplate/Form.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<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>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?=($template->id) ? "Emailtemplate bearbeiten" : "Neues Emailtemplate" ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Mailtemplate", "save")?>" enctype="multipart/form-data">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<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;" />
|
||||
</div>
|
||||
|
||||
<h4 class="mt-4">Emailtemplate</h4>
|
||||
|
||||
|
||||
<div class="form-group row mt-3 col-12">
|
||||
<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>
|
||||
|
||||
|
||||
<h4 class="mt-4">Dateianhänge</h4>
|
||||
<div class="form-group row mb-3">
|
||||
<div class="col-xl-5 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?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>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea id="note" class="form-control" name="note" rows="5"><?=$template->note?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" name="return" value="form" class="btn btn-primary mr-1">Speichern</button>
|
||||
<button type="submit" name="return" value="index" class="btn btn-primary">Speichern und zur Übersicht</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>plugins/tinymce/tinymce.min.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
|
||||
|
||||
<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_items = "";
|
||||
menu_vars.forEach((item) => { menu_vars_items += " " + item[0]});
|
||||
menu_vars_items = menu_vars_items.trim();
|
||||
console.log(menu_vars_items);
|
||||
|
||||
$(function () {
|
||||
tinymce.init({
|
||||
//font_formats: "Arial=arial,sans-serif;",
|
||||
selector: '#body_html',
|
||||
language: 'de',
|
||||
skin: "tinymce-5",
|
||||
plugins: ' code link autolink lists table',
|
||||
paste_block_drop: true,
|
||||
paste_as_text: true,
|
||||
paste_data_images: false,
|
||||
promotion: false,
|
||||
toolbar1: 'undo redo | styles | bold italic underline strikethrough | fontfamily fontsize fontcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | table | link unlink | code',
|
||||
toolbar2: 'vorname nachname firma',
|
||||
content_css: "<?=self::getResourcePath()?>/assets/css/tinymce.css",
|
||||
font_family_formats: "Arial=arial,sans-serif; Courier New=courier new,courier,monospace; Georgia=georgia,palatino,serif; Helvetica=helvetica,sans-serif; Lucida Sans=lucida sans unicode,sans-serif; Tahoma=tahoma,arial,helvetica,sans-serif; Times New Roman=times new roman,times,serif",
|
||||
menubar: 'file edit view insert format tools table variables',
|
||||
menu: {
|
||||
variables: { title: 'Textbausteine', items: menu_vars_items }
|
||||
},
|
||||
setup: function (editor) {
|
||||
menu_vars.forEach(function(item) {
|
||||
editor.ui.registry.addMenuItem(item[0], {
|
||||
text: item[1],
|
||||
onAction: function () {
|
||||
editor.insertContent('{{' + item[0].toUpperCase() + '}}');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
bsCustomFileInput.init();
|
||||
|
||||
});
|
||||
|
||||
function deleteFile(id) {
|
||||
event.preventDefault();
|
||||
console.log($("#deletefile-" + id).val());
|
||||
if(!$("#deletefile-" + id).val()) {
|
||||
$('#file-' + id + " .filename").css("text-decoration", "line-through");
|
||||
$('#file-' + id + " .filename").css("color", "red");
|
||||
$("#deletefile-" + id).val("1");
|
||||
} else {
|
||||
$('#file-' + id + " .filename").removeAttr("style");
|
||||
$("#deletefile-" + id).val("");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
Reference in New Issue
Block a user