132 lines
4.5 KiB
Plaintext
132 lines
4.5 KiB
Plaintext
@using BeWoPlanerMobil.Util
|
|
@using BS.Shared
|
|
@model BeWoPlanerMobil.Models.MainModel
|
|
|
|
@{
|
|
if(TempData[TempDataConstants.DoLogoutKey] is bool doLogout && doLogout)
|
|
{
|
|
<text>
|
|
<script type="text/javascript">
|
|
$("#second-logout-form").submit();
|
|
</script>
|
|
</text>
|
|
}
|
|
|
|
var selectedServiceDescription = Model.GetSelectedOrFirstServiceDescription();
|
|
var selectedCategory = selectedServiceDescription?.Category;
|
|
|
|
var bookingMode = Model.CurrentBookingMode;
|
|
|
|
string prefix;
|
|
|
|
switch(bookingMode)
|
|
{
|
|
case BookingMode.GroupBookingMode:
|
|
prefix = "gb";
|
|
break;
|
|
case BookingMode.MultiBookingMode:
|
|
prefix = "mb";
|
|
break;
|
|
default:
|
|
prefix = "sb";
|
|
break;
|
|
}
|
|
}
|
|
|
|
<script type="text/javascript">
|
|
function setSelectedServiceDescription(serviceDescriptionOid) {
|
|
$.get("@Url.Action("SetServiceDescription")", {pServiceDescriptionOid: serviceDescriptionOid});
|
|
}
|
|
|
|
function setSelectedServiceCategory() {
|
|
const selectedCategoryOid = $("#@(Model.BookingModePrefix)-category-select").find(":selected").val();
|
|
|
|
window.updateCategory("@prefix", selectedCategoryOid);
|
|
|
|
$("#category-to-description-container").load("@Url.Action("SetSelectedServiceCategory")", {categoryOidStr: selectedCategoryOid},
|
|
function() {
|
|
window.updateServiceDescription("@prefix", $("#@prefix-leistung-select").find(":selected").val());
|
|
|
|
$("#tree").load("@Url.Action("LoadUpToDateTextModules")");
|
|
}
|
|
);
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
window.calcPrependWidth();
|
|
|
|
window.addEventListener("load", function() {
|
|
$("#@prefix-category-select").on("change", function() {
|
|
window.updateCategory("@prefix", $("#@prefix-category-select").find(":selected").val());
|
|
});
|
|
|
|
$("#@prefix-leistung-select").on("change", function() {
|
|
window.updateServiceDescription("@prefix", $("#@prefix-leistung-select").find(":selected").val());
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
<!-- Kategorie -->
|
|
<div class="form-row">
|
|
<div class="col-md">
|
|
<div class="form-group mt-2 mb-0">
|
|
<div class="input-group">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text prepend-input-group-text">
|
|
Kategorie
|
|
</div>
|
|
</div>
|
|
<select id="@prefix-category-select" class="custom-select" onchange="setSelectedServiceCategory()">
|
|
@foreach(var serviceCategory2ServiceDescriptions in Model.Categories2Descriptions)
|
|
{
|
|
var category = serviceCategory2ServiceDescriptions.Key;
|
|
|
|
if(category is null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var selected = selectedCategory != null && selectedCategory.Equals(category) ? " selected" : string.Empty;
|
|
|
|
<option value="@category.ServiceCategoryOid"@selected>@category.Name</option>
|
|
}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Leistung -->
|
|
<div class="form-row">
|
|
<div class="col-md">
|
|
<div class="form-group mt-2 mb-0">
|
|
<div class="input-group">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text prepend-input-group-text">
|
|
Leistung
|
|
</div>
|
|
</div>
|
|
<select class="custom-select" id="@prefix-leistung-select" name="ServiceDescription" onchange="setServiceDescription('@prefix-leistung-select')">
|
|
@if(selectedCategory != null && Model.Categories2Descriptions.ContainsKey(selectedCategory))
|
|
{
|
|
foreach(var serviceDescription in Model.Categories2Descriptions[selectedCategory])
|
|
{
|
|
if(serviceDescription is null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var oid = serviceDescription.ServiceDescriptionOid;
|
|
|
|
var selected = selectedServiceDescription.Equals(serviceDescription) ? " selected" : string.Empty;
|
|
<option id="@prefix-service-description-@oid" value="@serviceDescription.ServiceDescriptionOid" @selected>@serviceDescription.Name</option>
|
|
}
|
|
}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> |