+ Ist die Notice null, wird keine Ausnahme mehr ausgelöst
+ Diagnosen hinzugefügt (in Entwicklung)
+ Medikamentenverordnungslisten hinzugefügt (in Entwicklung)
This commit is contained in:
2023-05-31 17:54:01 +02:00
parent 33a6ad8fed
commit 63a97b0d94
26 changed files with 646 additions and 489 deletions

View File

@@ -39,6 +39,19 @@
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<TypeScriptTarget>ES2015</TypeScriptTarget>
<TypeScriptJSXEmit>React</TypeScriptJSXEmit>
<TypeScriptModuleKind>ES6</TypeScriptModuleKind>
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
<TypeScriptRemoveComments>False</TypeScriptRemoveComments>
<TypeScriptOutFile />
<TypeScriptOutDir />
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
<TypeScriptSourceMap>True</TypeScriptSourceMap>
<TypeScriptMapRoot />
<TypeScriptSourceRoot />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -5066,7 +5079,7 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<UseIIS>True</UseIIS>
<AutoAssignPort>False</AutoAssignPort>
<DevelopmentServerPort>8808</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>

View File

@@ -28,7 +28,7 @@ namespace BeWoPlanerMobil.Controllers
return null;
}
if (((CustomerModel) Session[ModelSessionConstants.CustomerModelKey])?.Employee == null)
if (((CustomerModel) Session[ModelSessionConstants.CustomerModelKey])?.Employee is null)
{
_Model = new CustomerModel{Employee = MobileSessionFacade.LoggedInEmployee};
Session[ModelSessionConstants.CustomerModelKey] = _Model;
@@ -53,7 +53,7 @@ namespace BeWoPlanerMobil.Controllers
}
var customerFilter = MobileUserSettingsUtils.GetSettingValueAsEnum(AbstractModel.UserSettings, SettingsKeys.CustomerFilterCustomers, CustomerFilterEnum.MyCustomer);
Model.SelectedCustomerFilter = customerFilter;
InitViewModel();
@@ -74,9 +74,10 @@ namespace BeWoPlanerMobil.Controllers
private void InitViewModel()
{
if(Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
Logout();
return;
}
if(Model.Employee?.EmployeeOid.HasValue ?? false)
@@ -88,26 +89,23 @@ namespace BeWoPlanerMobil.Controllers
Model.Customers = new List<CompactCustomerDC>();
}
// ReportTypes laden! Erstmal nur Medikamentenansicht
if(AbstractModel.IsAllowedToSeeMedikamentenliste)
{
Model.ReportTypes = new List<CustomerReportType> { CustomerReportType.Medikamentenliste, CustomerReportType.Test };
Model.ReportTypes = new List<CustomerReportType> { CustomerReportType.Medikamentenliste, CustomerReportType.Bedarfsmedikation, CustomerReportType.Historie };
}
}
[Authorize]
public ActionResult PreselectCustomer(long? customerOid)
{
if (Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if (Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
return Logout();
}
InitViewModel();
if (customerOid > 0 && Model.Customers.Any(customer => customer.CustomerOid.Equals(customerOid.Value)))
if(customerOid > 0 && Model.Customers.Any(customer => customer.CustomerOid.Equals(customerOid.Value)))
{
Model.SelectedCustomerOid = customerOid;
@@ -126,7 +124,7 @@ namespace BeWoPlanerMobil.Controllers
{
try
{
if (Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
return Logout();
}
@@ -165,7 +163,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult SetCustomerFilter(FormCollection formCollection)
{
if(Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
return Logout();
}
@@ -185,7 +183,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public FileResult DownloadFile(long fileOid)
{
if (Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if (Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
Logout();
return null;
@@ -199,7 +197,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public string SaveEditedNotice(string newNotice)
{
if(Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
Logout();
return LeerzeichenFuerGetMethoden;
@@ -222,43 +220,66 @@ namespace BeWoPlanerMobil.Controllers
[HttpPost]
public ActionResult SelectReport(FormCollection formCollection)
{
if(Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !AbstractModel.IsAllowedToSeeMedikamentenliste)
{
return Logout();
}
Model.Report = null;
var selectedReportType = formCollection[nameof(Model.SelectedReportType)];
if(int.TryParse(selectedReportType, out var reportTypeInt))
if(int.TryParse(formCollection["report-type-input"], out var selectedReportTypeInt))
{
if(AbstractModel.IsAllowedToSeeMedikamentenliste && reportTypeInt == (int) CustomerReportType.Medikamentenliste)
{
// MedListType = true => Bedarfsliste
GenerateMobileMedListForSelectedCustomer();
}
var selectedReportType = (CustomerReportType) selectedReportTypeInt;
SelectReport(selectedReportType);
}
return RedirectToActionPermanent("Customer");
}
public void GenerateMobileMedListForSelectedCustomer()
private void SelectReport(CustomerReportType selectedReportType)
{
// TODO: Die neueste MedVerListOid laden, sofern eine vorhanden ist.
var mvlOid = CustomerService.GetActiveMedVerListOidForCustomer(Model.SelectedCustomerOid.Value);
Model.SelectedReportType = selectedReportType;
var listen = Model.SelectedCustomer.Medikamentenverordnungslisten;
GenerateMobileMedListForSelectedCustomer();
}
var aktuelleListe = listen.FirstOrDefault(f => f.Gueltig && f.MedListType == false);
if (aktuelleListe?.MedikamentenverordnungslistenOid != null && Request?.Url != null)
public void GenerateMobileMedListForSelectedCustomer(long? selectedMedListOid = null)
{
if(Model.SelectedCustomerOid is null)
{
using (var memoryStream = ReportService.CreateMedikamentenlistenReport(aktuelleListe.MedikamentenverordnungslistenOid.Value, MobileSessionFacade.Tenant))
{
var report = new XtraReport();
report.PrintingSystem.LoadDocument(memoryStream);
return;
}
Model.Report = report;
}
long? medListOid = null;
var customerOid = Model.SelectedCustomerOid.Value;
switch(Model.SelectedReportType)
{
case CustomerReportType.Medikamentenliste:
medListOid = CustomerService.GetActiveMedListByTypeForCustomer(customerOid, false);
break;
case CustomerReportType.Bedarfsmedikation:
medListOid = CustomerService.GetActiveMedListByTypeForCustomer(customerOid, true);
break;
case CustomerReportType.Historie:
medListOid = selectedMedListOid;
break;
}
var medList = Model.SelectedCustomer.Medikamentenverordnungslisten.FirstOrDefault(f => f.MedikamentenverordnungslistenOid == medListOid);
if(medList?.MedikamentenverordnungslistenOid is null || Request?.Url is null)
{
return;
}
using (var memoryStream = ReportService.CreateMedikamentenlistenReport(medList.MedikamentenverordnungslistenOid.Value, MobileSessionFacade.Tenant))
{
var report = new XtraReport();
report.PrintingSystem.LoadDocument(memoryStream);
Model.Report = report;
}
}
@@ -361,11 +382,39 @@ namespace BeWoPlanerMobil.Controllers
return RedirectToActionPermanent("PreselectCustomer", new { customerOid = customer.CustomerOid });
}
[Authorize]
[HttpPost]
public ActionResult ViewMedListFromHistoryList(FormCollection formCollection)
{
if(long.TryParse(formCollection["med-list-oid"], out var medListOid))
{
Model.SelectedReportType = CustomerReportType.Historie;
GenerateMobileMedListForSelectedCustomer(medListOid);
}
return RedirectToActionPermanent("Customer");
}
[Authorize]
[HttpPost]
public ActionResult DeleteMedListFromHistoryList(FormCollection formCollection)
{
if(long.TryParse(formCollection["med-list-oid"], out var medListOid))
{
var medList = Model.SelectedCustomer.Medikamentenverordnungslisten.FirstOrDefault(f => f.MedikamentenverordnungslistenOid == medListOid);
Model.SelectedReportType = CustomerReportType.Historie;
}
return RedirectToActionPermanent("Customer");
}
}
public enum CustomerReportType
{
Medikamentenliste = 0,
Test = 1
Bedarfsmedikation = 1,
Historie = 2
}
}

View File

@@ -83,6 +83,8 @@ namespace BeWoPlanerMobil.Controllers
{
Log.Error("Fehler beim Speichern der BrowserInfo: " + exception);
}
// ToDo: Hier durch die Mandatorsettings den Timeout setzen!
AbstractModel.TimeOfLastAction = $"{DateTime.Now:yyyy-MM-dd}T{DateTime.Now:HH:mm:ss}";

View File

@@ -95,6 +95,10 @@ namespace BeWoPlanerMobil.Controllers
if(Model.Mandator is null)
{
Model.Mandator = GetMandator();
#if DEBUG
//var timeUntilUILock = BS.Shared.Settings.ApplicationSettings.TimeUntilUILock;
//Session.Timeout = timeUntilUILock > 0 ? timeUntilUILock : 20;
#endif
}
var mandatorSettings = Model.Mandator.Settings;
@@ -2498,7 +2502,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult RedirectToReportView()
{
return AbstractModel.IsAllowedToSeeBills ? RedirectToActionPermanent("InitReports", "Report") : RedirectToMain();
return AbstractModel.HasRightToViewQuittierungsbelege ? RedirectToActionPermanent("InitReports", "Report") : RedirectToMain();
}
[Authorize]

View File

@@ -54,7 +54,7 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
if(!AbstractModel.IsAllowedToSeeBills)
if(!AbstractModel.HasRightToViewQuittierungsbelege)
{
return RedirectToActionPermanent("Main", "Main");
}
@@ -75,7 +75,7 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
if(!AbstractModel.IsAllowedToSeeBills)
if(!AbstractModel.HasRightToViewQuittierungsbelege)
{
return RedirectToActionPermanent("Main", "Main");
}

View File

@@ -5,6 +5,7 @@ using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using BeWoPlanerMobil.Service;
using DevExpress.Web.Mvc;
using log4net.Config;

View File

@@ -40,7 +40,7 @@ namespace BeWoPlanerMobil.Models
public static bool HasRightToInsertRessourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnlegen) || CheckRight(UserRightType.CreateAll);
public static bool IsAllowedToSeeBills
public static bool HasRightToViewQuittierungsbelege
{
get
{

View File

@@ -97,7 +97,28 @@ namespace BeWoPlanerMobil.Models
result.Add(new SelectListItem
{
Value = ((int) reportType).ToString(),
Text = reportType.ToString()
Text = reportType == CustomerReportType.Bedarfsmedikation ? "Bedarfsmedikation" : reportType == CustomerReportType.Medikamentenliste ? "Aktuelle Medikamentenverordnung" : "Historie"
});
}
return result;
}
}
public List<SelectListItem> OldMedLists
{
get
{
var result = new List<SelectListItem>();
var ungueltigeListen = SelectedCustomer.Medikamentenverordnungslisten.Where(w => !w.Gueltig).OrderBy(x => x.ErstellDatum).ToList();
foreach(var list in ungueltigeListen)
{
result.Add(new SelectListItem
{
Value = list.MedikamentenverordnungslistenOid.Value.ToString(),
Text = $"{(list.MedListType ? "Medikamentenverordnungsliste" : "Bedarfsmedikamentenverordnungsliste")} vom {list.ErstellDatum}"
});
}

View File

@@ -58,7 +58,7 @@ namespace BeWoPlanerMobil.Service
}
SessionFactories[MobileSessionFacade.Tenant] = new Configuration().Configure(serverPath).SetInterceptor(new MobileUpdInsInterceptor()).BuildSessionFactory();
}
}
return SessionFactories[MobileSessionFacade.Tenant];
}

View File

@@ -75,6 +75,7 @@ namespace BeWoPlanerMobil.Util
public string SchwebiGradDerBehinderung { get; }
public string SchwebiPflegegrad { get; }
public string SchwebiAktenzeichen { get; }
public bool HasSchwebi { get; }
public JsonCustomer(CustomerDC customer, List<BeWoFolderDC> folderTree, Dictionary<string, string> icd10Diagnosen)
{
@@ -102,6 +103,17 @@ namespace BeWoPlanerMobil.Util
SchwebiBeiblattGueltigBis = customer.BeiblattGueltigBis?.ToString("dd.MM.yyyy") ?? string.Empty;
SchwebiAusstAmt = customer.AusstVersAmt;
HasSchwebi = SchwebiIsUnlimited == "JA" ||
!string.IsNullOrWhiteSpace(SchwebiGradDerBehinderung) ||
!string.IsNullOrWhiteSpace(SchwebiPflegegrad) ||
!string.IsNullOrWhiteSpace(SchwebiAktenzeichen) ||
!string.IsNullOrWhiteSpace(SchwebiMerkzeichen) ||
!string.IsNullOrWhiteSpace(SchwebiBehinderungsart) ||
!string.IsNullOrWhiteSpace(SchwebiGueltigVon) ||
!string.IsNullOrWhiteSpace(SchwebiGueltigBis) ||
!string.IsNullOrWhiteSpace(SchwebiBeiblattGueltigBis) ||
!string.IsNullOrWhiteSpace(SchwebiAusstAmt);
ICD10Diagnosen = icd10Diagnosen;
Vorname = customer.FirstName;
Nachname = customer.LastName;

View File

@@ -440,6 +440,11 @@ namespace BeWoPlanerMobil.Util
public static string ToHtml(string s, bool nofollow)
{
if(s is null)
{
return Empty;
}
s = HttpUtility.HtmlEncode(s);
var paragraphs = s.Split(new[] { "\r\n\r\n" }, StringSplitOptions.None);
var stringBuilder = new StringBuilder();

View File

@@ -8,31 +8,31 @@
}
<script>
$(function() {
$(function () {
$("#date-of-birth-picker").datetimepicker({
locale: "de",
format: "L"
});
});
$("#stammdaten-container").ready(function() {
$("#stammdaten-container").ready(function () {
var width = getMaxWidth("customer-prepend-text-eigenschaften");
if(width > 0) {
if (width > 0) {
$(".customer-prepend-text-eigenschaften").width(width);
}
width = getMaxWidth("customer-prepend-text-adresse");
if(width > 0) {
if (width > 0) {
$(".customer-prepend-text-adresse").width(width);
}
width = getMaxWidth("customer-prepend-text-rechnungsadresse");
if(width > 0) {
if (width > 0) {
$(".customer-prepend-text-rechnungsadresse").width(width);
}
width = getMaxWidth("customer-prepend-text-kontakt");
if(width > 0) {
if (width > 0) {
$(".customer-prepend-text-kontakt").width(width);
}
});
@@ -41,18 +41,18 @@
try {
showSpinner();
$("#stammdaten-form").submit();
} catch(error) {
} catch (error) {
showErrorPopup(error);
}
}
(function() {
(function () {
'use strict';
window.addEventListener('load', function() {
window.addEventListener('load', function () {
var forms = document.getElementsByClassName("needs-validation");
var validation = Array.prototype.filter.call(forms, function(form) {
var validation = Array.prototype.filter.call(forms, function (form) {
form.addEventListener('submit', function (event) {
if(form.checkValidity() === false) {
if (form.checkValidity() === false) {
hideSpinner();
event.preventDefault();
event.stopPropagation();
@@ -67,39 +67,92 @@
});
}, false);
})();
</script>
<div class="container-fluid mt-3">
@if(AbstractModel.IsAllowedToSeeCustomerFilter)
{
using(Html.BeginForm("SetCustomerFilter", "Customer", FormMethod.Post))
{
<div class="row mb-3 align-items-center">
<div class="col-sm-2 col-md-1">
@Html.LabelFor(m => m.SelectedCustomerFilter)
</div>
<div class="col-sm-10 col-md-11">
@Html.DropDownListFor(m => m.SelectedCustomerFilter, Model.CustomerFilter, new { onchange = "submitForm(this)", @class = "custom-select" })
</div>
</div>
function submitReportTypeSelectionForm() {
try {
var selectedReportType = $("#report-type-select").find(":selected").val();
$("#report-type-input").val(selectedReportType);
$("#medverordnungs-form").submit();
} catch (error) {
showErrorPopup(error);
}
}
@using(Html.BeginForm("SelectCustomer", "Customer", FormMethod.Post, new { id = "select-customer-form" }))
{
<div class="row align-items-center">
<div class="col-sm-2 col-md-1">
@Html.LabelFor(m => m.SelectedCustomerOid)
</div>
<div class="col-sm-10 col-md-11">
@Html.DropDownListFor(m => m.SelectedCustomerOid, Model.CustomerListItems, new { onchange = "submitCustomerSelectionForm();", @class = "custom-select" })
</div>
</div>
function changeReportTypeSelection() {
try {
var selectedReportType = $("#report-type-select").find(":selected").val();
var medListReportConteiner = $("#med-list-report-container");
var historyList = $("#med-list-history-list");
$("#show-med-list-btn").prop("disabled", selectedReportType === "2");
if (selectedReportType !== "2") {
historyList.hide();
medListReportConteiner.show();
return;
}
historyList.removeClass("d-none");
medListReportConteiner.hide();
historyList.show();
} catch (error) {
showErrorPopup(error);
}
}
function viewHistoryMedList(oid) {
try {
showSpinner();
$("#med-list-oid-view").val(oid);
$("#view-history-med-list").submit();
} catch (error) {
showErrorPopup(error);
}
}
function deleteHistoryMedList(oid) {
try {
showSpinner();
$("#med-list-oid-delete").val(oid);
$("#delete-history-med-list").submit();
} catch (error) {
showErrorPopup(error);
}
}
</script>
<div class="container mt-3">
<div class="row mb-3">
@if(AbstractModel.IsAllowedToSeeCustomerFilter)
{
<div class="col-md mb-2">
@using(Html.BeginForm("SetCustomerFilter", "Customer", FormMethod.Post))
{
@Html.DropDownListFor(m => m.SelectedCustomerFilter, Model.CustomerFilter, new { onchange = "submitForm(this)", @class = "custom-select" })
}
</div>
}
<div class="col-md">
@using(Html.BeginForm("SelectCustomer", "Customer", FormMethod.Post, new { id = "select-customer-form" }))
{
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Klient</span>
</div>
@Html.DropDownListFor(m => m.SelectedCustomerOid, Model.CustomerListItems, new { onchange = "submitCustomerSelectionForm();", @class = "custom-select" })
</div>
}
</div>
</div>
</div>
<div class="container-fluid mt-3">
@if(Model?.SelectedJsonCustomer != null)
{
using(Html.BeginForm("UpdateCustomer", "Customer", FormMethod.Post, new { id = "stammdaten-form", @class = "needs-validation", novalidate="novalidate" }))
using(Html.BeginForm("UpdateCustomer", "Customer", FormMethod.Post, new { id = "stammdaten-form", @class = "needs-validation", novalidate = "novalidate" }))
{
var inputDisabled = !AbstractModel.HasRightToEditCustomers ? "disabled" : string.Empty;
@@ -652,47 +705,77 @@
</div>
</div>
<!-- Medikamentenliste TODO: ÜBERARBEITEN -->
@*@if(Html.IsInDebugMode() && AbstractModel.IsAllowedToSeeMedikamentenliste)
<!-- Medikamentenliste -->
@if(Html.IsInDebugMode() && AbstractModel.IsAllowedToSeeMedikamentenliste)
{
<div class="col-12 my-3">
<div class="card w-100">
<div class="card-header">
<h5 class="text-bewo-customer-card-header">Berichte</h5>
<h5 class="text-bewo-customer-card-header">Medikamentenverordnungen</h5>
</div>
<div class="card-body">
<div class="container-fluid px-0">
@using(Html.BeginForm("SelectReport", "Customer", FormMethod.Post, new { }))
{
@Html.DropDownListFor(m => m.SelectedReportType, Model.ReportTypeItems, new { @class = "custom-select", name = "SelectedReportType" })
<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">
<button class="btn btn-primary" type="button" onclick="submitReportTypeSelectionForm();" id="show-med-list-btn">Bericht anzeigen</button>
</div>
<div class="col-sm-12 col-lg">
@if(!(Model.SelectedCustomer is null))
{
<table class="table d-none mx-0 px-0 bg-bewo-dev" id="med-list-history-list" style="table-layout: fixed !important;">
<thead class="mx-0 px-0">
<tr>
<th>
Liste
</th>
<th>
Ersteller
</th>
<th></th>
</tr>
</thead>
<tbody class="mx-0 px-0">
@foreach(var list in Model.SelectedCustomer.Medikamentenverordnungslisten.Where(w => !w.Gueltig))
{
var listName = $"{(list.MedListType ? "Medikamentenverordnungsliste" : "Bedarfsmedikamentenverordnungsliste")} vom {list.ErstellDatum}";
<tr>
<td>
@listName
</td>
<td>
@list.Ersteller
</td>
<td 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)">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
}
</tbody>
</table>
}
<button class="btn btn-primary my-3" type="submit" onclick="showSpinner()">Bericht anzeigen</button>
<div class="card w-100 h-100">
<div class="card-header" onclick="cardHeaderClick('#chevron-customer-report', '#collapse-customer-report')">
<div class="d-inline-flex">
<i class="fas fa-chevron-down h-100 text-primary" id="chevron-customer-report"></i>
</div>
<div class="d-inline-flex text-primary h-100">
<button type="button" class="btn btn-link">
Medikamentenliste
</button>
</div>
</div>
<div class="collapse" id="collapse-customer-report">
<div class="card w-100 h-100" id="med-list-report-container">
<div class="card-body">
@Html.Partial("CustomerReportPartial", Model)
</div>
</div>
</div>
}
</div>
</div>
</div>
</div>
</div>
}*@
@if(Html.IsInDebugMode() && AbstractModel.HasRightToViewDiagnosen)
}
@if(Html.IsInDebugMode() && AbstractModel.HasRightToViewDiagnosen && (Model.SelectedJsonCustomer.HasDiagnosen || Model.SelectedJsonCustomer.HasDisabilities || Model.SelectedJsonCustomer.HasSchwebi))
{
<div class="col-12 my-3">
<div class="card w-100 h-100">
@@ -709,12 +792,6 @@
<div class="collapse" id="collapse-customer-diagnosen">
<div class="card-body">
@{
/*
* xs: 12
* sm: 12
* md: 12
* lg:
*/
var hasDiagnosen = Model.SelectedJsonCustomer.HasDiagnosen;
var hasDisabilities = Model.SelectedJsonCustomer.HasDisabilities;
var diagnosenCol = hasDiagnosen && hasDisabilities ? "col-lg-6" : "col-lg-12";
@@ -752,53 +829,56 @@
</table>
</div>
}
<div class="@schwebiCol">
<h6 class="text-primary">Schwerbehindertenausweis</h6>
<table class="table">
<tbody>
<tr>
<td>Aust. Vers. -amt</td>
<td>@Model.SelectedJsonCustomer.SchwebiAusstAmt</td>
</tr>
<tr>
<td>Ausweis unbefristet gültig</td>
<td>@Model.SelectedJsonCustomer.SchwebiIsUnlimited</td>
</tr>
<tr>
<td>Ausweis gültig von</td>
<td>@Model.SelectedJsonCustomer.SchwebiGueltigVon</td>
</tr>
<tr>
<td>Ausweis gültig bis</td>
<td>@Model.SelectedJsonCustomer.SchwebiGueltigBis</td>
</tr>
<tr>
<td>Beiblatt gültig bis</td>
<td>@Model.SelectedJsonCustomer.SchwebiBeiblattGueltigBis</td>
</tr>
<tr>
<td>Grad der Behinderung</td>
<td>@Model.SelectedJsonCustomer.SchwebiGradDerBehinderung</td>
</tr>
<tr>
<td>Merkzeichen</td>
<td>@Model.SelectedJsonCustomer.SchwebiMerkzeichen</td>
</tr>
<tr>
<td>Behinderungsart</td>
<td>@Model.SelectedJsonCustomer.SchwebiBehinderungsart</td>
</tr>
<tr>
<td>Pflegegrad</td>
<td>@Model.SelectedJsonCustomer.SchwebiPflegegrad</td>
</tr>
<tr>
<td>Aktenzeichen</td>
<td>@Model.SelectedJsonCustomer.SchwebiAktenzeichen</td>
</tr>
</tbody>
</table>
</div>
@if(Model.SelectedJsonCustomer.HasSchwebi)
{
<div class="@schwebiCol">
<h6 class="text-primary">Schwerbehindertenausweis</h6>
<table class="table">
<tbody>
<tr>
<td>Aust. Vers. -amt</td>
<td>@Model.SelectedJsonCustomer.SchwebiAusstAmt</td>
</tr>
<tr>
<td>Ausweis unbefristet gültig</td>
<td>@Model.SelectedJsonCustomer.SchwebiIsUnlimited</td>
</tr>
<tr>
<td>Ausweis gültig von</td>
<td>@Model.SelectedJsonCustomer.SchwebiGueltigVon</td>
</tr>
<tr>
<td>Ausweis gültig bis</td>
<td>@Model.SelectedJsonCustomer.SchwebiGueltigBis</td>
</tr>
<tr>
<td>Beiblatt gültig bis</td>
<td>@Model.SelectedJsonCustomer.SchwebiBeiblattGueltigBis</td>
</tr>
<tr>
<td>Grad der Behinderung</td>
<td>@Model.SelectedJsonCustomer.SchwebiGradDerBehinderung</td>
</tr>
<tr>
<td>Merkzeichen</td>
<td>@Model.SelectedJsonCustomer.SchwebiMerkzeichen</td>
</tr>
<tr>
<td>Behinderungsart</td>
<td>@Model.SelectedJsonCustomer.SchwebiBehinderungsart</td>
</tr>
<tr>
<td>Pflegegrad</td>
<td>@Model.SelectedJsonCustomer.SchwebiPflegegrad</td>
</tr>
<tr>
<td>Aktenzeichen</td>
<td>@Model.SelectedJsonCustomer.SchwebiAktenzeichen</td>
</tr>
</tbody>
</table>
</div>
}
</div>
@if(Model.SelectedJsonCustomer.HasDisabilities)
{
@@ -807,12 +887,12 @@
<h6 class="text-primary">Behinderungen</h6>
<table class="table">
<tbody>
@foreach(var behinderung in Model.SelectedCustomer.Disabilities)
{
<tr>
<td>@behinderung.DisplayName</td>
</tr>
}
@foreach(var behinderung in Model.SelectedCustomer.Disabilities)
{
<tr>
<td>@behinderung.DisplayName</td>
</tr>
}
</tbody>
</table>
</div>
@@ -823,7 +903,22 @@
</div>
</div>
}
</div>
</div>
}
}
</div>
</div>
@using(Html.BeginForm("SelectReport", "Customer", FormMethod.Post, new { id = "medverordnungs-form" }))
{
<input type="hidden" name="report-type-input" id="report-type-input" />
}
@using(Html.BeginForm("ViewMedListFromHistoryList", "Customer", FormMethod.Post, new { id = "view-history-med-list" }))
{
<input type="hidden" name="med-list-oid" id="med-list-oid-view" />
}
@using(Html.BeginForm("DeleteMedListFromHistoryList", "Customer", FormMethod.Post, new { id = "delete-history-med-list" }))
{
<input type="hidden" name="med-list-oid" id="med-list-oid-delete" />
}

View File

@@ -349,7 +349,7 @@
}
}
@if(AbstractModel.IsAllowedToSeeBills)
@if(AbstractModel.HasRightToViewQuittierungsbelege)
{
using(Html.BeginForm("RedirectToReportView", "Main", FormMethod.Post))
{

View File

@@ -1,9 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bezier = void 0;
var point_1 = require("./point");
var Bezier = /** @class */ (function () {
function Bezier(startPoint, control2, control1, endPoint, startWidth, endWidth) {
import { Point } from './point';
export class Bezier {
constructor(startPoint, control2, control1, endPoint, startWidth, endWidth) {
this.startPoint = startPoint;
this.control2 = control2;
this.control1 = control1;
@@ -11,60 +8,58 @@ var Bezier = /** @class */ (function () {
this.startWidth = startWidth;
this.endWidth = endWidth;
}
Bezier.fromPoints = function (points, widths) {
var c2 = this.calculateControlPoints(points[0], points[1], points[2]).c2;
var c3 = this.calculateControlPoints(points[1], points[2], points[3]).c1;
static fromPoints(points, widths) {
const c2 = this.calculateControlPoints(points[0], points[1], points[2]).c2;
const c3 = this.calculateControlPoints(points[1], points[2], points[3]).c1;
return new Bezier(points[1], c2, c3, points[2], widths.start, widths.end);
};
Bezier.calculateControlPoints = function (s1, s2, s3) {
var dx1 = s1.x - s2.x;
var dy1 = s1.y - s2.y;
var dx2 = s2.x - s3.x;
var dy2 = s2.y - s3.y;
var m1 = { x: (s1.x + s2.x) / 2.0, y: (s1.y + s2.y) / 2.0 };
var m2 = { x: (s2.x + s3.x) / 2.0, y: (s2.y + s3.y) / 2.0 };
var l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);
var l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);
var dxm = m1.x - m2.x;
var dym = m1.y - m2.y;
var k = l2 / (l1 + l2);
var cm = { x: m2.x + dxm * k, y: m2.y + dym * k };
var tx = s2.x - cm.x;
var ty = s2.y - cm.y;
}
static calculateControlPoints(s1, s2, s3) {
const dx1 = s1.x - s2.x;
const dy1 = s1.y - s2.y;
const dx2 = s2.x - s3.x;
const dy2 = s2.y - s3.y;
const m1 = { x: (s1.x + s2.x) / 2.0, y: (s1.y + s2.y) / 2.0 };
const m2 = { x: (s2.x + s3.x) / 2.0, y: (s2.y + s3.y) / 2.0 };
const l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);
const l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);
const dxm = m1.x - m2.x;
const dym = m1.y - m2.y;
const k = l2 / (l1 + l2);
const cm = { x: m2.x + dxm * k, y: m2.y + dym * k };
const tx = s2.x - cm.x;
const ty = s2.y - cm.y;
return {
c1: new point_1.Point(m1.x + tx, m1.y + ty),
c2: new point_1.Point(m2.x + tx, m2.y + ty),
c1: new Point(m1.x + tx, m1.y + ty),
c2: new Point(m2.x + tx, m2.y + ty),
};
};
}
// Returns approximated length. Code taken from https://www.lemoda.net/maths/bezier-length/index.html.
Bezier.prototype.length = function () {
var steps = 10;
var length = 0;
var px;
var py;
for (var i = 0; i <= steps; i += 1) {
var t = i / steps;
var cx = this.point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);
var cy = this.point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);
length() {
const steps = 10;
let length = 0;
let px;
let py;
for (let i = 0; i <= steps; i += 1) {
const t = i / steps;
const cx = this.point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);
const cy = this.point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);
if (i > 0) {
var xdiff = cx - px;
var ydiff = cy - py;
const xdiff = cx - px;
const ydiff = cy - py;
length += Math.sqrt(xdiff * xdiff + ydiff * ydiff);
}
px = cx;
py = cy;
}
return length;
};
}
// Calculate parametric value of x or y given t and the four point coordinates of a cubic bezier curve.
Bezier.prototype.point = function (t, start, c1, c2, end) {
point(t, start, c1, c2, end) {
// prettier-ignore
return (start * (1.0 - t) * (1.0 - t) * (1.0 - t))
+ (3.0 * c1 * (1.0 - t) * (1.0 - t) * t)
+ (3.0 * c2 * (1.0 - t) * t * t)
+ (end * t * t * t);
};
return Bezier;
}());
exports.Bezier = Bezier;
}
}
//# sourceMappingURL=bezier.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"bezier.js","sourceRoot":"","sources":["bezier.ts"],"names":[],"mappings":";;;AAAA,iCAA4C;AAE5C;IA6CE,gBACS,UAAiB,EACjB,QAAoB,EACpB,QAAoB,EACpB,QAAe,EACf,UAAkB,EAClB,QAAgB;QALhB,eAAU,GAAV,UAAU,CAAO;QACjB,aAAQ,GAAR,QAAQ,CAAY;QACpB,aAAQ,GAAR,QAAQ,CAAY;QACpB,aAAQ,GAAR,QAAQ,CAAO;QACf,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAAQ;IACtB,CAAC;IAnDU,iBAAU,GAAxB,UACE,MAAe,EACf,MAAsC;QAEtC,IAAM,EAAE,GAAG,IAAI,CAAC,sBAA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AI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC;aACpD;YAED,EAAE,GAAG,EAAE,CAAC;YACR,EAAE,GAAG,EAAE,CAAC;SACT;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,uGAAuG;IAC/F,KAAK,CACX,CAAS,EACT,KAAa,EACb,EAAU,EACV,EAAU,EACV,GAAW;QAEX,kBAAkB;QAClB,OAAO,CAAQ,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;cACnD,CAAC,GAAG,GAAI,EAAE,GAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAI,CAAC,CAAC;cAC3C,CAAC,GAAG,GAAI,EAAE,GAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAY,CAAC,CAAC;cAC3C,CAAQ,GAAG,GAAK,CAAC,GAAW,CAAC,GAAY,CAAC,CAAC,CAAC;IACrD,CAAC;CACF"}

View File

@@ -1,31 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Point = void 0;
var Point = /** @class */ (function () {
function Point(x, y, pressure, time) {
export class Point {
constructor(x, y, pressure, time) {
if (isNaN(x) || isNaN(y)) {
throw new Error("Point is invalid: (" + x + ", " + y + ")");
throw new Error(`Point is invalid: (${x}, ${y})`);
}
this.x = +x;
this.y = +y;
this.pressure = pressure || 0;
this.time = time || Date.now();
}
Point.prototype.distanceTo = function (start) {
distanceTo(start) {
return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2));
};
Point.prototype.equals = function (other) {
}
equals(other) {
return (this.x === other.x &&
this.y === other.y &&
this.pressure === other.pressure &&
this.time === other.time);
};
Point.prototype.velocityFrom = function (start) {
}
velocityFrom(start) {
return this.time !== start.time
? this.distanceTo(start) / (this.time - start.time)
: 0;
};
return Point;
}());
exports.Point = Point;
}
}
//# sourceMappingURL=point.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"point.js","sourceRoot":"","sources":["point.ts"],"names":[],"mappings":";;;AAQA;IAME,eAAY,CAAS,EAAE,CAAS,EAAE,QAAiB,EAAE,IAAa;QAChE,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,wBAAsB,CAAC,UAAK,CAAC,MAAG,CAAC,CAAC;SACnD;QACD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;IAEM,0BAAU,GAAjB,UAAkB,KAAiB;QACjC,OAAO,IAAI,CAAC,IAAI,CACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAC9D,CAAC;IACJ,CAAC;IAEM,sBAAM,GAAb,UAAc,KAAiB;QAC7B,OAAO,CACL,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;YAClB,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;YAClB,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;YAChC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CACzB,CAAC;IACJ,CAAC;IAEM,4BAAY,GAAnB,UAAoB,KAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;Y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C;IACJ,CAAC;IAEM,YAAY,CAAC,KAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;YAC7B,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YACnD,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;CACF"}

View File

@@ -1,9 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SignatureEventTarget = void 0;
var SignatureEventTarget = /** @class */ (function () {
export class SignatureEventTarget {
/* tslint:enable: variable-name */
function SignatureEventTarget() {
constructor() {
try {
this._et = new EventTarget();
}
@@ -13,16 +10,14 @@ var SignatureEventTarget = /** @class */ (function () {
this._et = document;
}
}
SignatureEventTarget.prototype.addEventListener = function (type, listener, options) {
addEventListener(type, listener, options) {
this._et.addEventListener(type, listener, options);
};
SignatureEventTarget.prototype.dispatchEvent = function (event) {
}
dispatchEvent(event) {
return this._et.dispatchEvent(event);
};
SignatureEventTarget.prototype.removeEventListener = function (type, callback, options) {
}
removeEventListener(type, callback, options) {
this._et.removeEventListener(type, callback, options);
};
return SignatureEventTarget;
}());
exports.SignatureEventTarget = SignatureEventTarget;
}
}
//# sourceMappingURL=signature_event_target.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"signature_event_target.js","sourceRoot":"","sources":["signature_event_target.ts"],"names":[],"mappings":";;;AAAA;IAGE,kCAAkC;IAElC;QACE,IAAI;YACF,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;SAC9B;QAAC,OAAO,KAAK,EAAE;YACd,6DAA6D;YAC7D,mEAAmE;YACnE,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC;SACrB;IACH,CAAC;IAED,+CAAgB,GAAhB,UACE,IAAY,EACZ,QAAmD,EACnD,OAA2C;QAE3C,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,4CAAa,GAAb,UAAc,KAAY;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,kDAAmB,GAAnB,UACE,IAAY,EACZ,QAAmD,EACnD,OAAwC;QAExC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACH,2BAAC;AAAD,CAAC,AAlCD,IAkCC;AAlCY,oDAAoB"}
{"version":3,"file":"signature_event_target.js","sourceRoot":"","sources":["signature_event_target.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAoB;IAG/B,kCAAkC;IAElC;QACE,IAAI;YACF,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;SAC9B;QAAC,OAAO,KAAK,EAAE;YACd,6DAA6D;YAC7D,mEAAmE;YACnE,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC;SACrB;IACH,CAAC;IAED,gBAAgB,CACd,IAAY,EACZ,QAAmD,EACnD,OAA2C;QAE3C,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,aAAa,CAAC,KAAY;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,mBAAmB,CACjB,IAAY,EACZ,QAAmD,EACnD,OAAwC;QAExC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CACF"}

View File

@@ -1,4 +1,3 @@
"use strict";
/**
* The main idea and some parts of the code (e.g. drawing variable width Bézier curve) are taken from:
* http://corner.squareup.com/2012/07/smoother-signatures.html
@@ -9,133 +8,103 @@
* Algorithm for approximated length of a Bézier curve is taken from:
* http://www.lemoda.net/maths/bezier-length/index.html
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var bezier_1 = require("./bezier");
var point_1 = require("./point");
var signature_event_target_1 = require("./signature_event_target");
var throttle_1 = require("./throttle");
var SignaturePad = /** @class */ (function (_super) {
__extends(SignaturePad, _super);
import { Bezier } from './bezier';
import { Point } from './point';
import { SignatureEventTarget } from './signature_event_target';
import { throttle } from './throttle';
export default class SignaturePad extends SignatureEventTarget {
/* tslint:enable: variable-name */
function SignaturePad(canvas, options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this) || this;
_this.canvas = canvas;
_this._drawningStroke = false;
_this._isEmpty = true;
_this._lastPoints = []; // Stores up to 4 most recent points; used to generate a new curve
_this._data = []; // Stores all points in groups (one group per line or dot)
_this._lastVelocity = 0;
_this._lastWidth = 0;
constructor(canvas, options = {}) {
super();
this.canvas = canvas;
this._drawningStroke = false;
this._isEmpty = true;
this._lastPoints = []; // Stores up to 4 most recent points; used to generate a new curve
this._data = []; // Stores all points in groups (one group per line or dot)
this._lastVelocity = 0;
this._lastWidth = 0;
// Event handlers
_this._handleMouseDown = function (event) {
this._handleMouseDown = (event) => {
if (event.buttons === 1) {
_this._drawningStroke = true;
_this._strokeBegin(event);
this._drawningStroke = true;
this._strokeBegin(event);
}
};
_this._handleMouseMove = function (event) {
if (_this._drawningStroke) {
_this._strokeMoveUpdate(event);
this._handleMouseMove = (event) => {
if (this._drawningStroke) {
this._strokeMoveUpdate(event);
}
};
_this._handleMouseUp = function (event) {
if (event.buttons === 1 && _this._drawningStroke) {
_this._drawningStroke = false;
_this._strokeEnd(event);
this._handleMouseUp = (event) => {
if (event.buttons === 1 && this._drawningStroke) {
this._drawningStroke = false;
this._strokeEnd(event);
}
};
_this._handleTouchStart = function (event) {
this._handleTouchStart = (event) => {
// Prevent scrolling.
if (event.cancelable) {
event.preventDefault();
}
if (event.targetTouches.length === 1) {
var touch = event.changedTouches[0];
_this._strokeBegin(touch);
const touch = event.changedTouches[0];
this._strokeBegin(touch);
}
};
_this._handleTouchMove = function (event) {
this._handleTouchMove = (event) => {
// Prevent scrolling.
if (event.cancelable) {
event.preventDefault();
}
var touch = event.targetTouches[0];
_this._strokeMoveUpdate(touch);
const touch = event.targetTouches[0];
this._strokeMoveUpdate(touch);
};
_this._handleTouchEnd = function (event) {
var wasCanvasTouched = event.target === _this.canvas;
this._handleTouchEnd = (event) => {
const wasCanvasTouched = event.target === this.canvas;
if (wasCanvasTouched) {
if (event.cancelable) {
event.preventDefault();
}
var touch = event.changedTouches[0];
_this._strokeEnd(touch);
const touch = event.changedTouches[0];
this._strokeEnd(touch);
}
};
_this._handlePointerStart = function (event) {
_this._drawningStroke = true;
this._handlePointerStart = (event) => {
this._drawningStroke = true;
event.preventDefault();
_this._strokeBegin(event);
this._strokeBegin(event);
};
_this._handlePointerMove = function (event) {
if (_this._drawningStroke) {
this._handlePointerMove = (event) => {
if (this._drawningStroke) {
event.preventDefault();
_this._strokeMoveUpdate(event);
this._strokeMoveUpdate(event);
}
};
_this._handlePointerEnd = function (event) {
if (_this._drawningStroke) {
this._handlePointerEnd = (event) => {
if (this._drawningStroke) {
event.preventDefault();
_this._drawningStroke = false;
_this._strokeEnd(event);
this._drawningStroke = false;
this._strokeEnd(event);
}
};
_this.velocityFilterWeight = options.velocityFilterWeight || 0.7;
_this.minWidth = options.minWidth || 0.5;
_this.maxWidth = options.maxWidth || 2.5;
_this.throttle = ('throttle' in options ? options.throttle : 16); // in milisecondss
_this.minDistance = ('minDistance' in options ? options.minDistance : 5); // in pixels
_this.dotSize = options.dotSize || 0;
_this.penColor = options.penColor || 'black';
_this.backgroundColor = options.backgroundColor || 'rgba(0,0,0,0)';
_this._strokeMoveUpdate = _this.throttle
? throttle_1.throttle(SignaturePad.prototype._strokeUpdate, _this.throttle)
this.velocityFilterWeight = options.velocityFilterWeight || 0.7;
this.minWidth = options.minWidth || 0.5;
this.maxWidth = options.maxWidth || 2.5;
this.throttle = ('throttle' in options ? options.throttle : 16); // in milisecondss
this.minDistance = ('minDistance' in options ? options.minDistance : 5); // in pixels
this.dotSize = options.dotSize || 0;
this.penColor = options.penColor || 'black';
this.backgroundColor = options.backgroundColor || 'rgba(0,0,0,0)';
this._strokeMoveUpdate = this.throttle
? throttle(SignaturePad.prototype._strokeUpdate, this.throttle)
: SignaturePad.prototype._strokeUpdate;
_this._ctx = canvas.getContext('2d');
_this.clear();
this._ctx = canvas.getContext('2d');
this.clear();
// Enable mouse and touch event handlers
_this.on();
return _this;
this.on();
}
SignaturePad.prototype.clear = function () {
var _a = this, ctx = _a._ctx, canvas = _a.canvas;
clear() {
const { _ctx: ctx, canvas } = this;
// Clear canvas using background color
ctx.fillStyle = this.backgroundColor;
ctx.clearRect(0, 0, canvas.width, canvas.height);
@@ -143,51 +112,48 @@ var SignaturePad = /** @class */ (function (_super) {
this._data = [];
this._reset(this._getPointGroupOptions());
this._isEmpty = true;
};
SignaturePad.prototype.fromDataURL = function (dataUrl, options) {
var _this = this;
if (options === void 0) { options = {}; }
return new Promise(function (resolve, reject) {
var image = new Image();
var ratio = options.ratio || window.devicePixelRatio || 1;
var width = options.width || _this.canvas.width / ratio;
var height = options.height || _this.canvas.height / ratio;
var xOffset = options.xOffset || 0;
var yOffset = options.yOffset || 0;
_this._reset(_this._getPointGroupOptions());
image.onload = function () {
_this._ctx.drawImage(image, xOffset, yOffset, width, height);
}
fromDataURL(dataUrl, options = {}) {
return new Promise((resolve, reject) => {
const image = new Image();
const ratio = options.ratio || window.devicePixelRatio || 1;
const width = options.width || this.canvas.width / ratio;
const height = options.height || this.canvas.height / ratio;
const xOffset = options.xOffset || 0;
const yOffset = options.yOffset || 0;
this._reset(this._getPointGroupOptions());
image.onload = () => {
this._ctx.drawImage(image, xOffset, yOffset, width, height);
resolve();
};
image.onerror = function (error) {
image.onerror = (error) => {
reject(error);
};
image.crossOrigin = 'anonymous';
image.src = dataUrl;
_this._isEmpty = false;
this._isEmpty = false;
});
};
SignaturePad.prototype.toDataURL = function (type, encoderOptions) {
if (type === void 0) { type = 'image/png'; }
}
toDataURL(type = 'image/png', encoderOptions) {
switch (type) {
case 'image/svg+xml':
if (typeof encoderOptions !== 'object') {
encoderOptions = undefined;
}
return "data:image/svg+xml;base64," + btoa(this.toSVG(encoderOptions));
return `data:image/svg+xml;base64,${btoa(this.toSVG(encoderOptions))}`;
default:
if (typeof encoderOptions !== 'number') {
encoderOptions = undefined;
}
return this.canvas.toDataURL(type, encoderOptions);
}
};
SignaturePad.prototype.on = function () {
}
on() {
// Disable panning/zooming when touching canvas element
this.canvas.style.touchAction = 'none';
this.canvas.style.msTouchAction = 'none';
this.canvas.style.userSelect = 'none';
var isIOS = /Macintosh/.test(navigator.userAgent) && 'ontouchstart' in document;
const isIOS = /Macintosh/.test(navigator.userAgent) && 'ontouchstart' in document;
// The "Scribble" feature of iOS intercepts point events. So that we can lose some of them when tapping rapidly.
// Use touch events for iOS platforms to prevent it. See https://developer.apple.com/forums/thread/664108 for more information.
if (window.PointerEvent && !isIOS) {
@@ -199,8 +165,8 @@ var SignaturePad = /** @class */ (function (_super) {
this._handleTouchEvents();
}
}
};
SignaturePad.prototype.off = function () {
}
off() {
// Enable panning/zooming when touching canvas element
this.canvas.style.touchAction = 'auto';
this.canvas.style.msTouchAction = 'auto';
@@ -214,22 +180,21 @@ var SignaturePad = /** @class */ (function (_super) {
this.canvas.removeEventListener('touchstart', this._handleTouchStart);
this.canvas.removeEventListener('touchmove', this._handleTouchMove);
this.canvas.removeEventListener('touchend', this._handleTouchEnd);
};
SignaturePad.prototype.isEmpty = function () {
}
isEmpty() {
return this._isEmpty;
};
SignaturePad.prototype.fromData = function (pointGroups, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.clear, clear = _c === void 0 ? true : _c;
}
fromData(pointGroups, { clear = true } = {}) {
if (clear) {
this.clear();
}
this._fromData(pointGroups, this._drawCurve.bind(this), this._drawDot.bind(this));
this._data = this._data.concat(pointGroups);
};
SignaturePad.prototype.toData = function () {
}
toData() {
return this._data;
};
SignaturePad.prototype._getPointGroupOptions = function (group) {
}
_getPointGroupOptions(group) {
return {
penColor: group && 'penColor' in group ? group.penColor : this.penColor,
dotSize: group && 'dotSize' in group ? group.dotSize : this.dotSize,
@@ -239,17 +204,17 @@ var SignaturePad = /** @class */ (function (_super) {
? group.velocityFilterWeight
: this.velocityFilterWeight,
};
};
}
// Private methods
SignaturePad.prototype._strokeBegin = function (event) {
_strokeBegin(event) {
this.dispatchEvent(new CustomEvent('beginStroke', { detail: event }));
var pointGroupOptions = this._getPointGroupOptions();
var newPointGroup = __assign(__assign({}, pointGroupOptions), { points: [] });
const pointGroupOptions = this._getPointGroupOptions();
const newPointGroup = Object.assign(Object.assign({}, pointGroupOptions), { points: [] });
this._data.push(newPointGroup);
this._reset(pointGroupOptions);
this._strokeUpdate(event);
};
SignaturePad.prototype._strokeUpdate = function (event) {
}
_strokeUpdate(event) {
if (this._data.length === 0) {
// This can happen if clear() was called while a signature is still in progress,
// or if there is a race condition between start/update events.
@@ -257,24 +222,24 @@ var SignaturePad = /** @class */ (function (_super) {
return;
}
this.dispatchEvent(new CustomEvent('beforeUpdateStroke', { detail: event }));
var x = event.clientX;
var y = event.clientY;
var pressure = event.pressure !== undefined
const x = event.clientX;
const y = event.clientY;
const pressure = event.pressure !== undefined
? event.pressure
: event.force !== undefined
? event.force
: 0;
var point = this._createPoint(x, y, pressure);
var lastPointGroup = this._data[this._data.length - 1];
var lastPoints = lastPointGroup.points;
var lastPoint = lastPoints.length > 0 && lastPoints[lastPoints.length - 1];
var isLastPointTooClose = lastPoint
const point = this._createPoint(x, y, pressure);
const lastPointGroup = this._data[this._data.length - 1];
const lastPoints = lastPointGroup.points;
const lastPoint = lastPoints.length > 0 && lastPoints[lastPoints.length - 1];
const isLastPointTooClose = lastPoint
? point.distanceTo(lastPoint) <= this.minDistance
: false;
var pointGroupOptions = this._getPointGroupOptions(lastPointGroup);
const pointGroupOptions = this._getPointGroupOptions(lastPointGroup);
// Skip this point if it's too close to the previous one
if (!lastPoint || !(lastPoint && isLastPointTooClose)) {
var curve = this._addPoint(point, pointGroupOptions);
const curve = this._addPoint(point, pointGroupOptions);
if (!lastPoint) {
this._drawDot(point, pointGroupOptions);
}
@@ -289,42 +254,42 @@ var SignaturePad = /** @class */ (function (_super) {
});
}
this.dispatchEvent(new CustomEvent('afterUpdateStroke', { detail: event }));
};
SignaturePad.prototype._strokeEnd = function (event) {
}
_strokeEnd(event) {
this._strokeUpdate(event);
this.dispatchEvent(new CustomEvent('endStroke', { detail: event }));
};
SignaturePad.prototype._handlePointerEvents = function () {
}
_handlePointerEvents() {
this._drawningStroke = false;
this.canvas.addEventListener('pointerdown', this._handlePointerStart);
this.canvas.addEventListener('pointermove', this._handlePointerMove);
this.canvas.ownerDocument.addEventListener('pointerup', this._handlePointerEnd);
};
SignaturePad.prototype._handleMouseEvents = function () {
}
_handleMouseEvents() {
this._drawningStroke = false;
this.canvas.addEventListener('mousedown', this._handleMouseDown);
this.canvas.addEventListener('mousemove', this._handleMouseMove);
this.canvas.ownerDocument.addEventListener('mouseup', this._handleMouseUp);
};
SignaturePad.prototype._handleTouchEvents = function () {
}
_handleTouchEvents() {
this.canvas.addEventListener('touchstart', this._handleTouchStart);
this.canvas.addEventListener('touchmove', this._handleTouchMove);
this.canvas.addEventListener('touchend', this._handleTouchEnd);
};
}
// Called when a new line is started
SignaturePad.prototype._reset = function (options) {
_reset(options) {
this._lastPoints = [];
this._lastVelocity = 0;
this._lastWidth = (options.minWidth + options.maxWidth) / 2;
this._ctx.fillStyle = options.penColor;
};
SignaturePad.prototype._createPoint = function (x, y, pressure) {
var rect = this.canvas.getBoundingClientRect();
return new point_1.Point(x - rect.left, y - rect.top, pressure, new Date().getTime());
};
}
_createPoint(x, y, pressure) {
const rect = this.canvas.getBoundingClientRect();
return new Point(x - rect.left, y - rect.top, pressure, new Date().getTime());
}
// Add point to _lastPoints array and generate a new curve if there are enough points (i.e. 3)
SignaturePad.prototype._addPoint = function (point, options) {
var _lastPoints = this._lastPoints;
_addPoint(point, options) {
const { _lastPoints } = this;
_lastPoints.push(point);
if (_lastPoints.length > 2) {
// To reduce the initial lag make it work with 3 points
@@ -333,68 +298,68 @@ var SignaturePad = /** @class */ (function (_super) {
_lastPoints.unshift(_lastPoints[0]);
}
// _points array will always have 4 points here.
var widths = this._calculateCurveWidths(_lastPoints[1], _lastPoints[2], options);
var curve = bezier_1.Bezier.fromPoints(_lastPoints, widths);
const widths = this._calculateCurveWidths(_lastPoints[1], _lastPoints[2], options);
const curve = Bezier.fromPoints(_lastPoints, widths);
// Remove the first element from the list, so that there are no more than 4 points at any time.
_lastPoints.shift();
return curve;
}
return null;
};
SignaturePad.prototype._calculateCurveWidths = function (startPoint, endPoint, options) {
var velocity = options.velocityFilterWeight * endPoint.velocityFrom(startPoint) +
}
_calculateCurveWidths(startPoint, endPoint, options) {
const velocity = options.velocityFilterWeight * endPoint.velocityFrom(startPoint) +
(1 - options.velocityFilterWeight) * this._lastVelocity;
var newWidth = this._strokeWidth(velocity, options);
var widths = {
const newWidth = this._strokeWidth(velocity, options);
const widths = {
end: newWidth,
start: this._lastWidth,
};
this._lastVelocity = velocity;
this._lastWidth = newWidth;
return widths;
};
SignaturePad.prototype._strokeWidth = function (velocity, options) {
}
_strokeWidth(velocity, options) {
return Math.max(options.maxWidth / (velocity + 1), options.minWidth);
};
SignaturePad.prototype._drawCurveSegment = function (x, y, width) {
var ctx = this._ctx;
}
_drawCurveSegment(x, y, width) {
const ctx = this._ctx;
ctx.moveTo(x, y);
ctx.arc(x, y, width, 0, 2 * Math.PI, false);
this._isEmpty = false;
};
SignaturePad.prototype._drawCurve = function (curve, options) {
var ctx = this._ctx;
var widthDelta = curve.endWidth - curve.startWidth;
}
_drawCurve(curve, options) {
const ctx = this._ctx;
const widthDelta = curve.endWidth - curve.startWidth;
// '2' is just an arbitrary number here. If only length is used, then
// there are gaps between curve segments :/
var drawSteps = Math.ceil(curve.length()) * 2;
const drawSteps = Math.ceil(curve.length()) * 2;
ctx.beginPath();
ctx.fillStyle = options.penColor;
for (var i = 0; i < drawSteps; i += 1) {
for (let i = 0; i < drawSteps; i += 1) {
// Calculate the Bezier (x, y) coordinate for this step.
var t = i / drawSteps;
var tt = t * t;
var ttt = tt * t;
var u = 1 - t;
var uu = u * u;
var uuu = uu * u;
var x = uuu * curve.startPoint.x;
const t = i / drawSteps;
const tt = t * t;
const ttt = tt * t;
const u = 1 - t;
const uu = u * u;
const uuu = uu * u;
let x = uuu * curve.startPoint.x;
x += 3 * uu * t * curve.control1.x;
x += 3 * u * tt * curve.control2.x;
x += ttt * curve.endPoint.x;
var y = uuu * curve.startPoint.y;
let y = uuu * curve.startPoint.y;
y += 3 * uu * t * curve.control1.y;
y += 3 * u * tt * curve.control2.y;
y += ttt * curve.endPoint.y;
var width = Math.min(curve.startWidth + ttt * widthDelta, options.maxWidth);
const width = Math.min(curve.startWidth + ttt * widthDelta, options.maxWidth);
this._drawCurveSegment(x, y, width);
}
ctx.closePath();
ctx.fill();
};
SignaturePad.prototype._drawDot = function (point, options) {
var ctx = this._ctx;
var width = options.dotSize > 0
}
_drawDot(point, options) {
const ctx = this._ctx;
const width = options.dotSize > 0
? options.dotSize
: (options.minWidth + options.maxWidth) / 2;
ctx.beginPath();
@@ -402,20 +367,19 @@ var SignaturePad = /** @class */ (function (_super) {
ctx.closePath();
ctx.fillStyle = options.penColor;
ctx.fill();
};
SignaturePad.prototype._fromData = function (pointGroups, drawCurve, drawDot) {
for (var _i = 0, pointGroups_1 = pointGroups; _i < pointGroups_1.length; _i++) {
var group = pointGroups_1[_i];
var points = group.points;
var pointGroupOptions = this._getPointGroupOptions(group);
}
_fromData(pointGroups, drawCurve, drawDot) {
for (const group of pointGroups) {
const { points } = group;
const pointGroupOptions = this._getPointGroupOptions(group);
if (points.length > 1) {
for (var j = 0; j < points.length; j += 1) {
var basicPoint = points[j];
var point = new point_1.Point(basicPoint.x, basicPoint.y, basicPoint.pressure, basicPoint.time);
for (let j = 0; j < points.length; j += 1) {
const basicPoint = points[j];
const point = new Point(basicPoint.x, basicPoint.y, basicPoint.pressure, basicPoint.time);
if (j === 0) {
this._reset(pointGroupOptions);
}
var curve = this._addPoint(point, pointGroupOptions);
const curve = this._addPoint(point, pointGroupOptions);
if (curve) {
drawCurve(curve, pointGroupOptions);
}
@@ -426,31 +390,29 @@ var SignaturePad = /** @class */ (function (_super) {
drawDot(points[0], pointGroupOptions);
}
}
};
SignaturePad.prototype.toSVG = function (_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.includeBackgroundColor, includeBackgroundColor = _c === void 0 ? false : _c;
var pointGroups = this._data;
var ratio = Math.max(window.devicePixelRatio || 1, 1);
var minX = 0;
var minY = 0;
var maxX = this.canvas.width / ratio;
var maxY = this.canvas.height / ratio;
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
}
toSVG({ includeBackgroundColor = false } = {}) {
const pointGroups = this._data;
const ratio = Math.max(window.devicePixelRatio || 1, 1);
const minX = 0;
const minY = 0;
const maxX = this.canvas.width / ratio;
const maxY = this.canvas.height / ratio;
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
svg.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
svg.setAttribute('viewBox', minX + " " + minY + " " + maxX + " " + maxY);
svg.setAttribute('viewBox', `${minX} ${minY} ${maxX} ${maxY}`);
svg.setAttribute('width', maxX.toString());
svg.setAttribute('height', maxY.toString());
if (includeBackgroundColor && this.backgroundColor) {
var rect = document.createElement('rect');
const rect = document.createElement('rect');
rect.setAttribute('width', '100%');
rect.setAttribute('height', '100%');
rect.setAttribute('fill', this.backgroundColor);
svg.appendChild(rect);
}
this._fromData(pointGroups, function (curve, _a) {
var penColor = _a.penColor;
var path = document.createElement('path');
this._fromData(pointGroups, (curve, { penColor }) => {
const path = document.createElement('path');
// Need to check curve for NaN values, these pop up when drawing
// lines on the canvas that are not continuous. E.g. Sharp corners
// or stopping mid-stroke and than continuing without lifting mouse.
@@ -459,10 +421,10 @@ var SignaturePad = /** @class */ (function (_super) {
!isNaN(curve.control1.y) &&
!isNaN(curve.control2.x) &&
!isNaN(curve.control2.y)) {
var attr = "M " + curve.startPoint.x.toFixed(3) + "," + curve.startPoint.y.toFixed(3) + " " +
("C " + curve.control1.x.toFixed(3) + "," + curve.control1.y.toFixed(3) + " ") +
(curve.control2.x.toFixed(3) + "," + curve.control2.y.toFixed(3) + " ") +
(curve.endPoint.x.toFixed(3) + "," + curve.endPoint.y.toFixed(3));
const attr = `M ${curve.startPoint.x.toFixed(3)},${curve.startPoint.y.toFixed(3)} ` +
`C ${curve.control1.x.toFixed(3)},${curve.control1.y.toFixed(3)} ` +
`${curve.control2.x.toFixed(3)},${curve.control2.y.toFixed(3)} ` +
`${curve.endPoint.x.toFixed(3)},${curve.endPoint.y.toFixed(3)}`;
path.setAttribute('d', attr);
path.setAttribute('stroke-width', (curve.endWidth * 2.25).toFixed(3));
path.setAttribute('stroke', penColor);
@@ -471,10 +433,9 @@ var SignaturePad = /** @class */ (function (_super) {
svg.appendChild(path);
}
/* eslint-enable no-restricted-globals */
}, function (point, _a) {
var penColor = _a.penColor, dotSize = _a.dotSize, minWidth = _a.minWidth, maxWidth = _a.maxWidth;
var circle = document.createElement('circle');
var size = dotSize > 0 ? dotSize : (minWidth + maxWidth) / 2;
}, (point, { penColor, dotSize, minWidth, maxWidth }) => {
const circle = document.createElement('circle');
const size = dotSize > 0 ? dotSize : (minWidth + maxWidth) / 2;
circle.setAttribute('r', size.toString());
circle.setAttribute('cx', point.x.toString());
circle.setAttribute('cy', point.y.toString());
@@ -482,8 +443,6 @@ var SignaturePad = /** @class */ (function (_super) {
svg.appendChild(circle);
});
return svg.outerHTML;
};
return SignaturePad;
}(signature_event_target_1.SignatureEventTarget));
exports.default = SignaturePad;
}
}
//# sourceMappingURL=signature_pad.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,16 +1,12 @@
"use strict";
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias */
// Slightly simplified version of http://stackoverflow.com/a/27078401/815507
Object.defineProperty(exports, "__esModule", { value: true });
exports.throttle = void 0;
function throttle(fn, wait) {
if (wait === void 0) { wait = 250; }
var previous = 0;
var timeout = null;
var result;
var storedContext;
var storedArgs;
var later = function () {
export function throttle(fn, wait = 250) {
let previous = 0;
let timeout = null;
let result;
let storedContext;
let storedArgs;
const later = () => {
previous = Date.now();
timeout = null;
result = fn.apply(storedContext, storedArgs);
@@ -19,13 +15,9 @@ function throttle(fn, wait) {
storedArgs = [];
}
};
return function wrapper() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var now = Date.now();
var remaining = wait - (now - previous);
return function wrapper(...args) {
const now = Date.now();
const remaining = wait - (now - previous);
storedContext = this;
storedArgs = args;
if (remaining <= 0 || remaining > wait) {
@@ -46,5 +38,4 @@ function throttle(fn, wait) {
return result;
};
}
exports.throttle = throttle;
//# sourceMappingURL=throttle.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["throttle.ts"],"names":[],"mappings":";AAAA,yFAAyF;A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AAO,EAAE;gBACZ,aAAa,GAAG,IAAI,CAAC;gBACrB,UAAU,GAAG,EAAE,CAAC;aACjB;SACF;aAAM,IAAI,CAAC,OAAO,EAAE;YACnB,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;SAC/C;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}

View File

@@ -4735,11 +4735,15 @@ namespace BeWo.Data.Access
public long? GetActiveMedVerListOidForCustomer(long customerOid)
{
// Gültig und MedListType = 0
return GetActiveMedListByTypeForCustomer(customerOid, false);
}
public long? GetActiveMedListByTypeForCustomer(long customerOid, bool isBedarfsmedikation)
{
var criteria = CreateCriteria<Medikamentenverordnungsliste>()
.Add(Restrictions.Eq(nameof(Medikamentenverordnungsliste.Gueltig), true))
.Add(Restrictions.Eq(nameof(Medikamentenverordnungsliste.Customer) + ".Oid", customerOid))
.Add(Restrictions.Eq(nameof(Medikamentenverordnungsliste.MedListType), false));
.Add(Restrictions.Eq(nameof(Medikamentenverordnungsliste.MedListType), isBedarfsmedikation));
var list = criteria.UniqueResult<Medikamentenverordnungsliste>();

View File

@@ -748,5 +748,9 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<CompactPersonDC> GetAllAuthorizedCompactPersons();
[FaultContract(typeof(BeWoFault))]
[OperationContract]
long? GetActiveMedListByTypeForCustomer(long customerOid, bool isBedarfsmedikation);
}
}

View File

@@ -4540,6 +4540,18 @@ namespace BeWo.Service.ServiceImplementations
throw Utils.CreateBeWoFaultException(e);
}
}
public long? GetActiveMedListByTypeForCustomer(long customerOid, bool isBedarfsmedikation)
{
try
{
return DAOFactory.SearchDAO.GetActiveMedListByTypeForCustomer(customerOid, isBedarfsmedikation);
}
catch(Exception e)
{
throw Utils.CreateBeWoFaultException(e);
}
}
}
internal struct WohnheimbuchungsIntervallStruct