Files
thetool/Layout/default/MaintenanceNotification/Form.php
2024-11-12 18:31:21 +01:00

117 lines
6.1 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("MaintenanceNotification")?>">Wartungsmeldungen</a></li>
<li class="breadcrumb-item active"><?=($notification && $notification->id) ? "Bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title"><?=($notification->id) ? "Wartungsmeldung bearbeiten" : "Neue Wartungsmeldung" ?></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("MaintenanceNotification", "save")?>" enctype="multipart/form-data">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?=$notification->id?>" />
<label class="form-label" for="from">Wartungsfenster Von *:</label>
<div class="form-group row">
<div class="col-2">
<input type="text" class="form-control datepicker" name="from_date" id="from_date" placeholder="Datum" value="<?=($notification && $notification->from) ? date("d.m.Y", $notification->from) : ""?>" />
</div>
<div class="col-2">
<input type="text" class="form-control timepicker" name="from_time" id="from_time" placeholder="Uhrzeit" value="<?=($notification && $notification->from) ? date("H:i", $notification->from) : ""?>" />
</div>
</div>
<label class="form-label" for="from">Wartungsfenster Bis *:</label>
<div class="form-group row">
<div class="col-2">
<input type="text" class="form-control datepicker" name="to_date" id="to_date" placeholder="Datum" value="<?=($notification && $notification->to) ? date("d.m.Y", $notification->to) : ""?>"/>
</div>
<div class="col-2">
<input type="text" class="form-control timepicker" name="to_time" id="to_time" placeholder="Uhrzeit" value="<?=($notification && $notification->to) ? date("H:i", $notification->to) : ""?>"/>
</div>
</div>
<div class="form-group row col-12">
<label class="form-label" for="from">PLZ-Bereich *:</label>
<textarea class="form-control" name="plz" id="from" style="height: 86px;"><?=($notification && $notification->plzs) ? implode(", ", $notification->plzs) : ""?></textarea>
<small class="text-primary">PLZ' mit Leerzeichen oder Komma getrennt</small>
</div>
<hr />
<div class="form-group row mt-3 col-12">
<label class="form-label" for="subject_id">Betreff *:</label>
<select name="subject_id" id="subject_id" class="form-control" onchange="changeText(this)">
<option></option>
<?php foreach(MaintenanceNotificationTemplate::getAll() as $tpl): ?>
<option value="<?=$tpl->id?>" <?=($notification && $notification->subject_id == $tpl->id) ? "selected='selected'" : ""?> data-text-template="<?=htmlentities($tpl->text)?>"><?=htmlentities($tpl->subject)?></option>
<?php endforeach; ?>
</select>
</div>
<label class="form-label" for="text">Wartungsmeldung Text *:</label>
<textarea id="text" name="text" placeholder="Bitte geben Sie hier den Emailinhalt ein..." rows="12" style="width: 100%; height: 600px; padding: 10px;"><?= htmlentities($notification->text)?></textarea>
</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>
$(document).ready(function() {
$('.datepicker').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
orientation: "bottom",
autoclose: true
});
$('.timepicker').timepicker({
format: "HH:mm"
});
});
function changeText(elem) {
var text = $(elem).find(":selected").data("text-template");
$("#text").text(text);
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>