Saving Preordernotification and test email done

This commit is contained in:
Frank Schubert
2023-01-26 19:24:35 +01:00
parent 844e6ccd2a
commit d2ceb7ead8
14 changed files with 791 additions and 100 deletions

View File

@@ -7,8 +7,8 @@
<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("Network")?>">Vorbestellung</a></li>
<li class="breadcrumb-item">Emailaussendungen</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>
@@ -24,19 +24,20 @@
<div class="card">
<div class="card-body">
<form class="form-horizontal" method="post" action="<?=self::getUrl("Preordernotification ", "save")?>">
<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>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="name">Vorbestellkampagne</label>
<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" id="preordercampaign_id" value="<?=$campaign->name?>" disabled="disabled">
<input type="text" class="form-control" name="preordercampaign" id="preordercampaign" value="<?=$campaign->name?>" disabled="disabled">
</div>
</div>
@@ -44,11 +45,11 @@
<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">
<?php if(array_key_exists("interest", $campaign->types)): ?><option value="interest" <?=($notification->type == "interest") ? "selected='selected'" : ""?>>Interessensbekundung</option><?php endif; ?>
<?php if(array_key_exists("provision", $campaign->types)): ?><option value="provision" <?=($notification->type == "provision") ? "selected='selected'" : ""?>>Vorsorgeanschluss</option><?php endif; ?>
<?php if(array_key_exists("order", $campaign->types)): ?><option value="order" <?=($notification->type == "order") ? "selected='selected'" : ""?>>Vollanschluss</option><?php endif; ?>
<?php if(array_key_exists("reorder", $campaign->types)): ?><option value="reorder" <?=($notification->type == "reorder") ? "selected='selected'" : ""?>>Nachbestellung</option><?php endif; ?>
<select class="form-control select2" name="type[]" id="type" multiple="multiple">
<option value="interest" <?=(array_key_exists("type", $notification->filter) && in_array("interest", $notification->filter["type"])) ? "selected='selected'" : ""?>>Interessensbekundung</option>
<option value="provision" <?=(array_key_exists("type", $notification->filter) && in_array("provision", $notification->filter["type"])) ? "selected='selected'" : ""?>>Vorsorgeanschluss</option>
<option value="order" <?=(array_key_exists("type", $notification->filter) && in_array("order", $notification->filter["type"])) ? "selected='selected'" : ""?>>Vollanschluss</option>
<option value="reorder" <?=(array_key_exists("type", $notification->filter) && in_array("reorder", $notification->filter["type"])) ? "selected='selected'" : ""?>>Nachbestellung</option>
</select>
</div>
</div>
@@ -56,12 +57,12 @@
<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->connection_type == "single-dwelling") ? "selected='selected'" : ""?>>Einfamilienhaus</option>
<option value="multi-dwelling" <?=($notification->connection_type == "multi-dwelling") ? "selected='selected'" : ""?>>Mehrfamilienhaus</option>
<option value="apartment-building" <?=($notification->connection_type == "apartment-building") ? "selected='selected'" : ""?>>Mehrparteienhaus</option>
<option value="apartment" <?=($notification->connection_type == "apartment") ? "selected='selected'" : ""?>>Wohneinheit in Mehrparteienhaus</option>
<option value="business" <?=($notification->connection_type == "business") ? "selected='selected'" : ""?>>Gewerbebetrieb</option>
<select class="form-control select2" name="connection_type[]" id="connection_type" multiple="multiple">
<option value="single-dwelling" <?=(array_key_exists("connection_type", $notification->filter) && in_array("single-dwelling", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Einfamilienhaus</option>
<option value="multi-dwelling" <?=(array_key_exists("connection_type", $notification->filter) && in_array("multi-dwelling", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Mehrfamilienhaus</option>
<option value="apartment-building" <?=(array_key_exists("connection_type", $notification->filter) && in_array("apartment-building", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Mehrparteienhaus</option>
<option value="apartment" <?=(array_key_exists("connection_type", $notification->filter) && in_array("apartment", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Wohneinheit in Mehrparteienhaus</option>
<option value="business" <?=(array_key_exists("connection_type", $notification->filter) && in_array("business", $notification->filter['connection_type'])) ? "selected='selected'" : ""?>>Gewerbebetrieb</option>
</select>
</div>
</div>
@@ -82,19 +83,89 @@
<hr />
<h4 class="mt-4">Emailinhalt</h4>
<p>Im folgenden Editor können Sie ein HTML-Email verfassen. Verwenden Sie as Menü und die Werkzeugleiste um den Text zu formatieren:</p>
<textarea id="body_html" name="body_html" placeholder="Bitte geben Sie hier den Emailinhalt ein..." rows="12" style="width: 100%; height: 600px; padding: 10px;"><?=$notification->body_html?></textarea>
<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="row mb-3">
<div class="col-xl-5 input-grop ml-1">
<label class="custom-file-label" for="attachment"><i class="far fa-file-import"></i> Datei(en) auswählen</label>
<input type="file" name="attachment[]" id="attachment" class="custom-file-input" multiple="multiple" />
<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>
@@ -105,7 +176,7 @@
<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"><?=$pop->note?></textarea>
<textarea id="note" class="form-control" name="note" rows="5"><?=$notification->note?></textarea>
</div>
</div>
</div>
@@ -136,12 +207,12 @@
selector: '#body_html',
language: 'de',
skin: "tinymce-5",
plugins: 'link autolink lists table',
plugins: ' code link autolink lists table',
paste_block_drop: true,
paste_as_text: true,
paste_data_images: false,
promotion: false,
toolbar: 'undo redo | styles | bold italic underline strikethrough | fontfamily fontsize fontcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | table | link unlink',
toolbar: 'undo redo | styles | bold italic underline strikethrough | fontfamily fontsize fontcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | table | link unlink | code',
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"
@@ -170,12 +241,33 @@
});
//$('#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: ""
});
});
$(".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"); ?>