138 lines
5.2 KiB
Plaintext
138 lines
5.2 KiB
Plaintext
@using BeWoPlanerMobil.Models
|
|
@using BeWoPlanerMobil.Util
|
|
@using BS.Shared.Extensions
|
|
@model IAbsenceTimeModel
|
|
|
|
@{
|
|
var controllerName = Model.HtmlPrefix.FirstCharToUpper();
|
|
}
|
|
|
|
<script type="text/javascript">
|
|
@if(ViewData["AbsenceTimeError"] is string testMessage)
|
|
{
|
|
<text>
|
|
showMessagePopupWithHtml("Fehler", "<div class='alert' role='alert'>@Html.Raw(ViewData["AbsenceTimeError"])</div>");
|
|
</text>
|
|
}
|
|
|
|
$(window).ready(function() {
|
|
@if(Model.SelectedAbsenceTime != null)
|
|
{
|
|
<text>
|
|
$("#absence-times-form-popup").modal("show");
|
|
</text>
|
|
}
|
|
});
|
|
|
|
function deleteAbsenceTime(absenceTimeOid, absenceTimeSpanDescription) {
|
|
try {
|
|
event.stopPropagation();
|
|
|
|
const word = absenceTimeSpanDescription.includes("Ab") ? "" : "vom ";
|
|
|
|
showMessagePopupWithCallback("Abwesenheit löschen",
|
|
`Möchten Sie wirklich die Abwesenheit ${word}${absenceTimeSpanDescription.toLowerCase()} löschen?`,
|
|
function() {
|
|
showSpinner();
|
|
|
|
$("#absence-times-container").load("@Url.Action("DeleteAbsenceTime", controllerName)", {absenceTimeOid: absenceTimeOid}, function() {
|
|
hideSpinner();
|
|
});
|
|
},
|
|
false);
|
|
} catch (error) {
|
|
showErrorPopup(error);
|
|
}
|
|
}
|
|
|
|
function selectAbsenceTime(absenceTimeOid) {
|
|
try {
|
|
event.stopPropagation();
|
|
$.get("@Url.Action("SetSelectedAbsenceTimeOid", controllerName)", {absenceTimeOid: absenceTimeOid}).done(function(result) {
|
|
if(result !== undefined && result !== null && result.length > 1) {
|
|
showMessagePopupWithHtml("Fehler", `<div class='alert alert-danger' role='alert'>${result}</div>`);
|
|
} else if(result !== undefined && result !== null && result.length === 1) {
|
|
$(`#@Model.HtmlPrefix-absence-time-modal-body`).load('@Url.Action("LoadAbsenceTimeToForm", controllerName)', function () {
|
|
calcAbsenceTimePrependWidth();
|
|
$(`#@Model.HtmlPrefix-absence-times-form-popup`).modal("show");
|
|
});
|
|
}
|
|
});
|
|
} catch (error) {
|
|
showErrorPopup(error);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
@foreach(var absenceTime in Model.AbsenceTimeObject.AbsenceTimes.OrderByDescending(at => at.Start))
|
|
{
|
|
if(absenceTime.Start is null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
<div class="row mx-0 px-0 mb-2">
|
|
<div class="card w-100">
|
|
<div class="card-header" onclick="cardHeaderClick2(this)">
|
|
<div class="row">
|
|
<div class="col-sm-auto mr-auto">
|
|
<div class="input-group">
|
|
<div class="input-group-prepend">
|
|
<i class="fas fa-chevron-down h-100 text-bewo-customer-card-header chevron-identifier-class"></i>
|
|
</div>
|
|
<p class="form-control text-bewo-customer-card-header border-0 bg-transparent" style="user-select: none !important;">
|
|
@absenceTime.Start.Value.GetIntervalDescription(absenceTime.End)
|
|
</p>
|
|
</div>
|
|
</div>
|
|
@if(Model.HasRightToEdit || Model.HasRightToDelete)
|
|
{
|
|
<div class="col-sm-auto">
|
|
<div class="btn-toolbar justify-content-between">
|
|
@if(Model.HasRightToEdit)
|
|
{
|
|
<div class="btn-group pr-1" role="group">
|
|
<button class="btn btn-primary" type="button" onclick="selectAbsenceTime(@absenceTime.AbsenceTimeOid)">
|
|
<span class="fas fa-edit mr-0 pr-0"></span>
|
|
</button>
|
|
</div>
|
|
}
|
|
|
|
@if(Model.HasRightToDelete)
|
|
{
|
|
<div class="btn-group" role="group">
|
|
<button class="btn btn-danger" type="button" onclick="deleteAbsenceTime(@absenceTime.AbsenceTimeOid, '@absenceTime.Start.Value.GetIntervalDescription(absenceTime.End)')">
|
|
<span class="fas fa-trash mr-0 pr-0"></span>
|
|
</button>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="collapse @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, $"{Model.HtmlPrefix}-absence-time-{absenceTime.AbsenceTimeOid}")" id="customer-absence-time-@absenceTime.AbsenceTimeOid">
|
|
<div class="card-body">
|
|
<div class="container-fluid px-0">
|
|
<div class="row">
|
|
<div class="col-auto mr-auto text-secondary">
|
|
Kategorie:
|
|
</div>
|
|
<div class="col-auto">
|
|
@absenceTime.Reason.Description
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-auto mr-auto text-secondary">
|
|
Erläuterung:
|
|
</div>
|
|
<div class="col-auto">
|
|
@absenceTime.Notice
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
} |