171 lines
6.5 KiB
Plaintext
171 lines
6.5 KiB
Plaintext
@using BeWoPlanerMobil.Util
|
|
@model BeWoPlanerMobil.Models.MainModel
|
|
|
|
@{
|
|
if(TempData[TempDataConstants.DoLogoutKey] is bool doLogout && doLogout)
|
|
{
|
|
<text>
|
|
<script type="text/javascript">
|
|
$("#second-logout-form").submit();
|
|
</script>
|
|
</text>
|
|
}
|
|
}
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function () {
|
|
$("#mb-hours-minutes-dropdown-btn").on("click",
|
|
function() {
|
|
$("#mb-hours-minutes-dropdown-btn").data("text", $("#mb-hours-minutes-dropdown-btn").text().replaceAll(/\s/g, ""));
|
|
});
|
|
|
|
$(".hours-minutes-link").on("click",
|
|
function() {
|
|
const previousText = $("#mb-hours-minutes-dropdown-btn").data("text");
|
|
const currentText = $(this).text().replaceAll(/\s/g, "");
|
|
|
|
if(previousText === currentText) {
|
|
return;
|
|
}
|
|
|
|
const buttonText = $(this).text();
|
|
$("#mb-hours-minutes-dropdown-btn").text(buttonText);
|
|
|
|
window.setInputFilter('mb-duration', 'mb-distance', 'mb-hours-minutes-dropdown-btn');
|
|
|
|
$.get('@Url.Action("ToggleDurationUnit")', { isInHoursMode: buttonText === "Stunden" });
|
|
|
|
calculateDuration(true, 'mb-start-time', 'mb-end-time', 'mb-duration', 'mb-hours-minutes-dropdown-btn', 'mb-start-date-picker', 'mb-end-date-picker', false, false);
|
|
});
|
|
});
|
|
|
|
function addEmployeeToMultiBooking() {
|
|
var selectedEmployees = [];
|
|
|
|
let oidString = "";
|
|
|
|
$("#multi-booking-employee-selection-popup input:checked").each(function() {
|
|
selectedEmployees.push($(this).val());
|
|
});
|
|
|
|
for(let i = 0; i < selectedEmployees.length; i++) {
|
|
oidString += selectedEmployees[i];
|
|
|
|
if(i < selectedEmployees.length - 1) {
|
|
oidString += ",";
|
|
}
|
|
}
|
|
|
|
$.get("@Url.Action("AddEmployeesToMultiBooking")", { pEmployeeOids: oidString }).done(function(numberOfSelectedEmployees) {
|
|
$("#multi-booking-selected-employees-count-badge").text(numberOfSelectedEmployees);
|
|
|
|
$("#multi-booking-create-button").prop("disabled", numberOfSelectedEmployees === "0" ? true : false);
|
|
});
|
|
}
|
|
|
|
function submitMultiBookingForm() {
|
|
showSpinner();
|
|
|
|
$.get("@Url.Action("MultiBookingHasSelectedSupportConcepts")").done(function (result1) {
|
|
if(false === checkJson(result1)) {
|
|
logWarning("submitMultiBookingForm: Der zurückgegebene Wert ist kein gültiges JSON!");
|
|
hideSpinner();
|
|
return;
|
|
}
|
|
|
|
$.get("@Url.Action("MultiBookingHasSelectedEmployees")").done(function (result2) {
|
|
if(false === checkJson(result2)) {
|
|
logWarning("submitMultiBookingForm: Der zurückgegebene Wert ist kein gültiges JSON!");
|
|
hideSpinner();
|
|
return;
|
|
}
|
|
|
|
const hasSupportConcepts = parseJason(result1);
|
|
const hasEmployees = parseJason(result2);
|
|
|
|
if (hasSupportConcepts && hasEmployees) {
|
|
validateForm($("#multiBookingForm"), "mb-");
|
|
} else {
|
|
hideSpinner();
|
|
let message = "";
|
|
|
|
if (!hasSupportConcepts && !hasEmployees) {
|
|
message = "Bitte wählen Sie mindestens einen Hilfeplan und Mitarbeiter aus.";
|
|
} else if(hasSupportConcepts && !hasEmployees) {
|
|
message = "Bitte wählen Sie mindestens einen Mitarbeiter aus.";
|
|
} else {
|
|
message = "Bitte wählen Sie mindestens einen Hilfeplan aus.";
|
|
}
|
|
|
|
showAlertMessageBoxWithoutCallback("Speichern nicht möglich", message);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<div class="row">
|
|
<div class="col col-12">
|
|
@if(Model != null)
|
|
{
|
|
@Html.Partial("MultiBookingFormPartial", Model);
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
@* (Mehrfachbuchung) Hilfeplan- und Gruppenauswahl Popup *@
|
|
<div class="modal" data-backdrop="static" tabindex="-1" role="dialog" id="multi-booking-popup">
|
|
<div class="modal-dialog modal-dialog-scrollable" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title font-weight-bold">Gruppen und Hilfepläne für Gruppenbuchung</h5>
|
|
<button type="button" class="close" data-dismiss="modal">
|
|
<span>×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<nav class="nav nav-pills nav-fill">
|
|
<a class="nav-item nav-link active" href="#multi-booking-supportconcepts" data-toggle="tab" role="tab">Hilfepläne</a>
|
|
<a class="nav-item nav-link" href="#multi-booking-groups" data-toggle="tab" role="tab">Gruppen</a>
|
|
</nav>
|
|
<div class="tab-content" id="multi-booking-sc-cb-rel-tab-content">
|
|
@Html.Partial("MultiBookingScCbRelList", Model)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@* (Mehrfachbuchung) Mitarbeiterauswahl Popup *@
|
|
<div class="modal" tabindex="-1" role="dialog" id="multi-booking-employee-selection-popup">
|
|
<div class="modal-dialog modal-dialog-scrollable" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title font-weight-bold">Mitarbeiter hinzufügen</h5>
|
|
<button type="button" class="close" data-dismiss="modal" onclick="resetSearch('mb-employee-search-input', 'employee-text')">
|
|
<span>×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="input-group mb-3">
|
|
<input class="form-control w-100" type="text" id="mb-employee-search-input" placeholder="Suchen..." oninput="listSearchOnChange('mb-employee-search-input', 'employee-text', 'employee-name-label')" />
|
|
<div class="input-group-append">
|
|
<button class="btn btn-outline-secondary" type="button" onclick="resetSearch('mb-employee-search-input', 'employee-text')">
|
|
<span class="fas fa-times-circle"></span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
@foreach(var employee in Model.EmployeesForGroupAndMultiBooking)
|
|
{
|
|
var checkedValue = Model.MultiBookingSelectedEmployees.Contains(employee) ? "checked=\"checked\"" : string.Empty;
|
|
|
|
<div class="custom-control custom-checkbox employee-text">
|
|
<input type="checkbox" @checkedValue class="custom-control-input" id="multi-employee-@employee.EmployeeOid" onchange="addEmployeeToMultiBooking()" value="@employee.EmployeeOid" />
|
|
<label for="multi-employee-@employee.EmployeeOid" class="custom-control-label employee-name-label">@employee.DetailDescription</label>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> |