Files
BeWoPlaner/BeWoPlanerMobil/Views/Scheduler/CustomerSelectionPopupPartial.cshtml

93 lines
3.7 KiB
Plaintext

@using BS.Shared.Extensions
@model BeWoPlanerMobil.Models.SchedulerModel
<script type="text/javascript">
function selectAllCustomersOnChange() {
const isChecked = $("#all-customers-checkbox").prop("checked");
$("#customer-input-container").load(
"@Url.Action("SelectAllCustomers")",
{
isChecked: isChecked
},
() => {
$("#selected-customers-list").load("@Url.Action("LoadUpdatedCustomers")", () => {
$("#one-day-scheduler-partial-container").load('@Url.Action("FetchAppointments", "Scheduler")');
});
}
);
}
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();
}
</script>
<div class="modal" tabindex="-1" role="dialog" id="customers-popup">
<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>&times;</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.AllCustomers.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("CustomerSelectionPopupListPartial", Model)
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Übernehmen</button>
</div>
</div>
</div>
</div>