111 lines
4.3 KiB
Plaintext
111 lines
4.3 KiB
Plaintext
@using BS.Shared.Extensions
|
|
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
|
|
|
|
<script type="text/javascript">
|
|
function selectAllCustomersOnChange() {
|
|
const isChecked = $("#all-customers-checkbox").prop("checked");
|
|
|
|
$("#customer-input-container").load("@Url.Action("SelectAllCustomersForFiltering")", { isChecked: isChecked }, () => { scheduler.Refresh(); });
|
|
}
|
|
|
|
function customerListSearchOnChange() {
|
|
var text = $("#customer-search-input").val().toLowerCase();
|
|
|
|
const entries = $(".customer-text");
|
|
|
|
if(text.length === 0) {
|
|
entries.show();
|
|
}
|
|
|
|
$.each(entries, function (index, item) {
|
|
const customer = $(item);
|
|
|
|
if(customer.find(".customer-name-label").text().toLowerCase().includes(text)) {
|
|
customer.show();
|
|
} else {
|
|
customer.hide();
|
|
}
|
|
});
|
|
}
|
|
|
|
function resetCustomerSeach() {
|
|
$("#customer-search-input").val("");
|
|
$(".customer-text").show();
|
|
}
|
|
|
|
function removeSelectedCustomer(customerOid) {
|
|
const checkbox = $(`#customer-${customerOid}-checkbox`);
|
|
|
|
if(checkbox.length) {
|
|
checkbox.prop("checked", false);
|
|
}
|
|
|
|
changeCustomerListSelection();
|
|
}
|
|
|
|
function changeCustomerListSelection() {
|
|
const selectedCustomerOids = $("#customer-input-container input:checked").map(function () {return $(this).attr("id").split("-")[1];}).get();
|
|
const allCustomersCount = $("#customer-input-container input[type=checkbox]").map(function () {return $(this).attr("id").split("-")[1];}).get();
|
|
const selectedCustomersCount = selectedCustomerOids.length;
|
|
|
|
$("#all-customers-checkbox").prop("checked", (allCustomersCount === selectedCustomersCount));
|
|
|
|
showSpinner();
|
|
$("#customer-input-container").load(
|
|
"@Url.Action("UpdateCustomerSelection")",
|
|
{ selectedCustomerOids: selectedCustomerOids },
|
|
() => {
|
|
scheduler.Refresh();
|
|
hideSpinner();
|
|
}
|
|
);
|
|
}
|
|
</script>
|
|
|
|
<div class="modal" tabindex="-1" role="dialog" id="customers-popup-apt-flt">
|
|
<div class="modal-dialog modal-dialog-scrollable" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h6 class="modal-title text-center w-100 font-weight-bold">
|
|
<span class="fas fa-user text-bewo-customers"></span>
|
|
Klienten
|
|
</h6>
|
|
<button type="button" class="close" data-dismiss="modal" onclick="resetCustomerSeach()">
|
|
<span>×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="container-fluid">
|
|
<div class="input-group mb-3">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text">
|
|
@{
|
|
var allCustomersCheckedVal = Model.PossibleCustomers.AreListEqual(Model.SelectedCustomers) ? "checked" : string.Empty;
|
|
}
|
|
|
|
<div class="custom-control custom-checkbox custom-control-inline mx-auto">
|
|
<input type="checkbox" class="custom-control-input" id="all-customers-checkbox" @allCustomersCheckedVal onchange="selectAllCustomersOnChange()" />
|
|
<label class="custom-control-label" for="all-customers-checkbox">Alle</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<input class="form-control w-100" type="text" placeholder="Suchen..." oninput="customerListSearchOnChange()" id="customer-search-input" />
|
|
<div class="input-group-append">
|
|
<button class="btn btn-outline-secondary" type="button" onclick="resetCustomerSeach()">
|
|
<span class="fas fa-times-circle"></span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="customer-input-container">
|
|
@Html.Partial("AptFltCustomerPopupListPartial", Model)
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" data-dismiss="modal">Übernehmen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> |