Files
BeWoPlaner/BeWoPlanerMobil/Views/Customer/CustomerMedListPartial.cshtml
Lyndon Jetten 1df62f4183 MoK:
- Löschrechtprüfung an FaC angepasst.
- Ziele und Maßnahmen sind alphabetisch absteigend sortiert wie im FaC.
- Reports bei Klienten verbessert.
- Bargeldtransaktionshistorie eingebaut.
2024-02-20 14:42:04 +01:00

148 lines
5.6 KiB
Plaintext

@using BeWoPlanerMobil.Controllers
@model BeWoPlanerMobil.Models.CustomerModel
<script type="text/javascript">
function changeReportTypeSelection() {
try {
var selectedReportType = $("#report-type-select").find(":selected").val();
var historyList = $("#med-list-history-list");
$("#show-med-list-btn").prop("disabled", selectedReportType === "2");
if (selectedReportType !== "2") {
historyList.hide();
return;
}
historyList.removeClass("d-none");
historyList.show();
} catch (error) {
showErrorPopup(error);
}
}
function viewHistoryMedList(oid) {
try {
showSpinner();
$("#med-list-oid-view").val(oid);
$("#view-history-med-list").submit();
$("#customer-report-popup-container").load("@Url.Action("ShowHistoricalMedList")",
{
medListOid: oid
},
function () {
$("#customer-report-container").height($(window).height() * .8);
$("#customer-report-popup").modal("show");
hideSpinner();
}
);
} catch (error) {
showErrorPopup(error);
}
}
function deleteHistoryMedList(oid, name) {
try {
showMessagePopupWithCallback("Löschen", `Sind Sie sicher, dass Sie die ${name} löschen wollen?`, function () {
showSpinner();
$("#medikamentenlistencontainer").load("@Url.Action("DeleteHistoricalMedList")",
{
medListOid: oid
},
function () {
hideSpinner();
});
});
} catch (error) {
showErrorPopup(error);
}
}
function closeReport() {
try {
$.get("@Url.Action("ResetReport")");
} catch (error) {
showErrorPopup(error);
}
}
function loadMedListReport() {
try {
showSpinner();
var selectedReportType = $("#report-type-select").find(":selected").val();
$("#customer-report-popup-container").load("@Url.Action("ShowMedList")",
{
reportType: selectedReportType
},
function () {
$("#customer-report-container").height($(window).height() * .8);
$("#customer-report-popup").modal("show");
hideSpinner();
});
} catch(error) {
showErrorPopup(error);
}
}
</script>
<div class="container-fluid my-0 py-0">
<div class="row">
<div class="col-sm-6 col-lg-auto mb-3">
@Html.DropDownListFor(m => m.SelectedReportType, Model.ReportTypeItems, new { @class = "custom-select", id = "report-type-select", onchange = "changeReportTypeSelection()" })
</div>
<div class="col-sm-6 col-lg-auto mb-3">
@{
var showReportBtnDisabledValue = Model.SelectedReportType == CustomerReportType.Historie ? "disabled" : string.Empty;
}
<button @showReportBtnDisabledValue class="btn btn-primary" type="button" onclick="loadMedListReport();" id="show-med-list-btn">Bericht anzeigen</button>
</div>
<div class="col-sm-12 col-lg">
@if(!(Model.SelectedCustomer is null))
{
var displayValue = Model.SelectedReportType == CustomerReportType.Historie ? string.Empty : "d-none";
<table class="table @displayValue" id="med-list-history-list" style="table-layout: fixed !important;">
<thead>
<tr>
<th class="px-0">
Liste
</th>
<th>
Ersteller
</th>
<th class="px-0"></th>
</tr>
</thead>
<tbody>
@foreach(var list in Model.SelectedCustomer.Medikamentenverordnungslisten.Where(w => !w.Gueltig).OrderBy(x => x.ErstellDatum))
{
var listName = $"{(list.MedListType ? "Medikamentenverordnungsliste" : "Bedarfsmedikamentenverordnungsliste")} vom {list.ErstellDatum}";
var name = $"{listName} von {list.Ersteller}";
<tr>
<td class="px-0">
@listName
</td>
<td>
@list.Ersteller
</td>
<td class="px-0" style="text-align: right;">
<button type="button" class="btn btn-primary" onclick="viewHistoryMedList(@list.MedikamentenverordnungslistenOid)">
<i class="far fa-eye"></i>
</button>
<button type="button" class="btn btn-bewo-service-records" onclick="deleteHistoryMedList(@list.MedikamentenverordnungslistenOid, '@name')">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
</div>