368 lines
18 KiB
PHP
368 lines
18 KiB
PHP
<?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("Preorder")?>">Vorbestellung</a></li>
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("Preordernotification")?>">Emailaussendungen</a></li>
|
|
<li class="breadcrumb-item active"><?=($notification->id) ? "bearbeiten" : "Neu" ?></li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title"><?=($notification->id) ? "Emailaussendung bearbeiten" : "Neue Emailaussendung" ?></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("Preordernotification", "save")?>" enctype="multipart/form-data">
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<input type="hidden" name="id" value="<?=$notification->id?>" />
|
|
<input type="hidden" name="preordercampaign_id" value="<?=$campaign->id?>" />
|
|
|
|
<h4>Absender</h4>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="sender_name">Name *</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="sender_name" id="sender_name" value="<?=($notification->sender_name) ? $notification->sender_name : $campaign->network->owner->getCompanyOrName()?>">
|
|
<small>Wird beim Empfänger als Absender angezeigt</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="sender_email">Emailadresse *</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="sender_email" id="sender_email" value="<?=($notification->sender_email) ? $notification->sender_email : $campaign->network->owner->email?>">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="sender_replyto">Antworten an (Reply-To):</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="sender_replyto" id="sender_replyto" value="<?=$notification->sender_replyto?>">
|
|
</div>
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
<h4 class="mt-4">Empfänger</h4>
|
|
<p>Die Aussendung wird an die Kontaktemailadresse aller Bestellungen versendet. Wählen Sie folgende Konditionen aus, um die Empfänger zu beschränken:</p>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="preordercamaign">Vorbestellkampagne</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="preordercampaign" id="preordercampaign" value="<?=$campaign->name?>" disabled="disabled">
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="type">Bestelltyp</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control select2" name="type[]" id="type" multiple="multiple">
|
|
<option value="interest" <?=($notification && array_key_exists("type", $notification->filter) && in_array("interest", $notification->filter["type"])) ? "selected='selected'" : ""?>>Interessensbekundung</option>
|
|
<option value="provision" <?=($notification && array_key_exists("type", $notification->filter) && in_array("provision", $notification->filter["type"])) ? "selected='selected'" : ""?>>Vorsorgeanschluss</option>
|
|
<option value="order" <?=($notification && array_key_exists("type", $notification->filter) && in_array("order", $notification->filter["type"])) ? "selected='selected'" : ""?>>Vollanschluss</option>
|
|
<option value="reorder" <?=($notification && array_key_exists("type", $notification->filter) && in_array("reorder", $notification->filter["type"])) ? "selected='selected'" : ""?>>Nachbestellung</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="connection_type">Anschlusstyp</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control select2" name="connection_type[]" id="connection_type" multiple="multiple">
|
|
<option value="single-dwelling" <?=($notification && array_key_exists("connection_type", $notification->filter) && in_array("single-dwelling", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Einfamilienhaus</option>
|
|
<option value="multi-dwelling" <?=($notification && array_key_exists("connection_type", $notification->filter) && in_array("multi-dwelling", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Mehrfamilienhaus</option>
|
|
<option value="apartment-building" <?=($notification && array_key_exists("connection_type", $notification->filter) && in_array("apartment-building", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Mehrparteienhaus</option>
|
|
<option value="apartment" <?=($notification && array_key_exists("connection_type", $notification->filter) && in_array("apartment", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Wohneinheit in Mehrparteienhaus</option>
|
|
<option value="business" <?=($notification && array_key_exists("connection_type", $notification->filter) && in_array("business", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Gewerbebetrieb</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!--div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="product_id">Vertriebspartner</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control select2" name="partner_id" id="partner_id" multiple="multiple">
|
|
<option value=""></option>
|
|
<?php foreach($partners as $partner): ?>
|
|
<option value="<?=$partner->id?>" <?=($notification->id && $notification->partner_id == $partner->id) ? "selected='selected'" : ""?>><?=$partner->getCompanyOrName()?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div-->
|
|
|
|
<hr />
|
|
|
|
|
|
<h4 class="mt-4">Email</h4>
|
|
|
|
<p>Im folgenden Editor können Sie ein HTML-Email verfassen. Verwenden Sie das Menü und die Werkzeugleiste um den Text zu formatieren.</p>
|
|
<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="<?=$notification->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($notification->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="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($notification->files) && count($notification->files)): ?>
|
|
<div class="row">
|
|
<div class="col-4">
|
|
<div class="card" style="">
|
|
<ul class="list-group list-group-flush">
|
|
<?php foreach($notification->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">
|
|
|
|
<h4>Versand</h4>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="tosend_day">Versandzeitpunkt</label>
|
|
<div class="col-lg-2">
|
|
<label>Datum</label>
|
|
<input type="text" class="form-control" name="tosend_day" id="tosend_date" value="<?=($notification->tosend_date) ? date("d.m.Y", $notification->tosend_date) : ""?>" />
|
|
<small>Emailversand wird zu diesem Zeitpunkt gestartet</small>
|
|
</div>
|
|
<div class="col-lg-2">
|
|
<label>Uhrzeit</label>
|
|
<select name="tosend_hour" class="form-control">
|
|
<?php for($h = 0; $h < 24; $h++): ?>
|
|
<option value="<?=$h?>" <?=($notification->tosend_date && date('H', $notification->tosend_date) == $h) ? "selected='selected'" : ""?>><?=str_pad($h, 2, "0", STR_PAD_LEFT)?>:00</option>
|
|
<?php endfor; ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="testmail_to">Test Email versenden</label>
|
|
<div class="col-lg-10">
|
|
<div class="row">
|
|
<div class="col-6">
|
|
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text"><i class="fas fa-envelope"></i></span>
|
|
</div>
|
|
<input type="text" class="form-control" name="testmail_to" id="testmail_to" value="" placeholder="Testempfänger" />
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-6">
|
|
<button type="submit" name="send_testmail" value="1" class="btn btn-outline-success"><i class="far fa-paper-plane"></i> Testmail jetzt abschicken</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</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"><?=$notification->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() + '}}');
|
|
}
|
|
});
|
|
});
|
|
/*
|
|
editor.ui.registry.addMenuItem('vorname', {
|
|
text: 'Vorname',
|
|
onAction: function () {
|
|
editor.insertContent('{{VORNAME}}');
|
|
}
|
|
});
|
|
editor.ui.registry.addMenuItem('nachname', {
|
|
text: 'Nachname',
|
|
onAction: function () {
|
|
editor.insertContent('{{NACHNAME}}');
|
|
}
|
|
});
|
|
editor.ui.registry.addMenuItem('firma', {
|
|
text: 'Firma',
|
|
onAction: function () {
|
|
editor.insertContent('{{FIRMA}}');
|
|
}
|
|
});
|
|
editor.ui.registry.addMenuItem('firmaodername', {
|
|
text: 'Firma oder Name',
|
|
onAction: function () {
|
|
editor.insertContent('{{FIRMA_ODER_NAME}}');
|
|
}
|
|
});
|
|
editor.ui.registry.addMenuItem('email', {
|
|
text: 'Emailadresse',
|
|
onAction: function () {
|
|
editor.insertContent('{{EMAIL}}');
|
|
}
|
|
});*/
|
|
}
|
|
|
|
});
|
|
|
|
bsCustomFileInput.init();
|
|
|
|
/*$('#body_html').summernote({
|
|
height: 400,
|
|
lang: "de-DE",
|
|
placeholder: "Bitte geben Sie hier den Emailtext ein...",
|
|
toolbar: [
|
|
['style', ['style']],
|
|
['font', ['bold', 'underline', 'clear', 'fontname']],
|
|
['fontsize', ['fontsize', 'fontsizeunit']],
|
|
['color', ['color']],
|
|
['para', ['ul', 'ol', 'paragraph', 'height']],
|
|
['table', ['table']],
|
|
['insert', ['link']],
|
|
['view', ['fullscreen', 'codeview', 'help']]
|
|
],
|
|
fontNames: ["Arial", "Arial Black", "Courier New", "Georgia", "Helvetica", "Lucida Sans Unicode", "Tahoma", "Times New Roman"],
|
|
|
|
addDefaultFonts: false
|
|
|
|
});
|
|
//$('#body_html').summernote('fontSizeUnit', "pt");
|
|
//$('#body_html').summernote("fontSize", 12);*/
|
|
|
|
$('#tosend_date').datepicker({
|
|
language: 'de',
|
|
format: "dd.mm.yyyy",
|
|
showWeekDays: true,
|
|
todayBtn: 'linked',
|
|
autoclose: true
|
|
});
|
|
|
|
$(".select2").select2({
|
|
allowClear: true,
|
|
placeholder: ""
|
|
});
|
|
});
|
|
|
|
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"); ?>
|