Files
BeWoPlaner/BeWoPlanerMobil/Views/DevExpressScheduler/CustomEmployeeSelectPartial.cshtml

106 lines
4.8 KiB
Plaintext

@using BS.Shared
@using BS.Shared.Core.Utilities
@using BS.Shared.Extensions
@model BeWoPlanerMobil.Models.AppointmentModel
<style type="text/css">
li {
cursor: pointer;
}
</style>
@functions
{
static string GetParticipationColor(ParticipationAnswer participationAnswer)
{
var background = "";
switch(participationAnswer)
{
case ParticipationAnswer.Zusage:
background = "#48D44E";
break;
case ParticipationAnswer.Vorbehalt:
background = "#B927D9";
break;
case ParticipationAnswer.Absage:
background = "#AB0030";
break;
}
return background;
}
}
@{
var areAllSelected = Model.SelectedEmployee2SchedulerAppointments.Select(x => x.Employee.EmployeeOid).ToList().AreListEqual(Model.PossibleEmployees.Select(employee => employee.EmployeeOid).ToList());
var allChecked = areAllSelected ? "checked" : string.Empty;
var isNew = Model.Oid is null && Model.RecurrenceIndex == 0 && Model.RecurrenceInfo is null;
var isEdit = isNew is false;
var checkBoxEnabled = isEdit && Model.HasRightKalenderMitarbeiterTermineAendern || isNew && Model.HasRightKalenderMitarbeiterTermineAnlegen;
var disabled = checkBoxEnabled is false || (Model.CanBeEdited is false && isNew is false) ? "disabled" : string.Empty;
}
<div class="dropdown pr-1" id="employees-dropdown">
<button class="btn btn-sm-auto btn-bewo-employee dropdown-toggle w-100" type="button" data-toggle="dropdown">
Mitarbeiter <span class="badge badge-light" id="apt-emp-badge">@Model.SelectedEmployee2SchedulerAppointments.Count</span>
</button>
<div class="dropdown-menu" onclick="event.stopPropagation();">
<div class="dropdown-item py-1 px-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<div class="input-group-text">
<input type="checkbox" @disabled @allChecked onclick="selectAllEmployeeCustomerResource('emp')" id="apt-emp-select-all">
</div>
</div>
<input type="text" class="form-control" @disabled id="emp-drop-search-input" placeholder="Suchen ..." oninput="onNewSearchInput('emp')">
<div class="input-group-append">
<button type="button" class="btn btn-sm-auto btn-outline-secondary" @disabled onclick="resetNewSearch('emp')">
<span class="fas fa-times-circle"></span>
</button>
</div>
</div>
</div>
<div class="dropdown-divider"></div>
<div id="dropdown-emp-itm-container">
@for(var i = 0; i < Model.PossibleEmployees.Count; i++)
{
var employee = Model.PossibleEmployees[i];
var isChecked = Model.SelectedEmployeeOids.Contains(employee.EmployeeOid) ? "checked" : string.Empty;
var employee2Appointment = Model.SelectedEmployee2SchedulerAppointments.FirstOrDefault(e2A => e2A.Employee.EmployeeOid.Equals(employee.EmployeeOid));
var background = employee2Appointment is null ? string.Empty : GetParticipationColor(employee2Appointment.ParticipationAnswer);
var x = WebUtils.CheckColorString(employee.EmployeeColor) ? "" : string.Empty;
var dNone = i / Model.EmployeePageLimit + 1 != 1 ? " d-none" : string.Empty;
<div class="dropdown-item w-100 @dNone" id="dropdown-item-@i">
<form class="form-inline justify-content-between">
<div class="form-group form-check">
<input class="form-check-input" @disabled type="checkbox" id="apt-edit-emp-@employee.EmployeeOid" @isChecked onclick="updateEmployeeCustomerResourceSelection('emp')" />
<label for="apt-edit-emp-@employee.EmployeeOid" class="form-check-label">
@employee.DetailDescription
</label>
</div>
@if(WebUtils.CheckColorString(employee.EmployeeColor))
{
<div class="float-right" style="width: 10px; height: 10px; background-color: @employee.EmployeeColor; border: 1px solid @employee.EmployeeColor; border-radius: 3px;"></div>
}
</form>
</div>
}
</div>
<div class="dropdown-divider" id="apt-emp-pag-divider"></div>
<div class="dropdown-item" id="apt-emp-pag-dropdow-item">
<nav id="apt-emp-pag-nav">
<ul class="pagination justify-content-center" id="apt-emp-pagination">
</ul>
</nav>
</div>
</div>
</div>