Ziele und Maßnahmen mit Bewertungen lokal gespeichert.

This commit is contained in:
2025-10-22 13:22:31 +02:00
parent dc56abcdc3
commit 3de300db6d
14 changed files with 329 additions and 161 deletions

View File

@@ -417,10 +417,10 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedSupportConcept = Model.SupportConcepts.FirstOrDefault(sc => sc.CostBearerRelOids.Any(a => a.Equals(Model.SelectedCostBearerSupportConceptOid)));
}
// Im Einzelbuchungsmodus entweder nichts oder "Hilfeplan auswählen" (-1) ausgewählt.
if(istEinzelBuchung && (!cb2ScOid.HasValue || cb2ScOid.Value == -1))
{
// Im Einzelmodus entweder nichts oder "Hilfeplan auswählen" (-1) ausgewählt.
Model.Categories2Descriptions = new Dictionary<ServiceCategoryDC, List<ServiceDescriptionDC>>();
Model.SelectedGoalOids = new List<long>();
}
@@ -432,7 +432,7 @@ namespace BeWoPlanerMobil.Controllers
{
allC2SOids = Model.GroupBookingSelectedCostBearerSupportConceptOids;
}
else if(cb2ScOid.HasValue && cb2ScOid.Value > 0)
else if(cb2ScOid > 0)
{
allC2SOids.Add(cb2ScOid.Value);
}
@@ -5172,7 +5172,14 @@ namespace BeWoPlanerMobil.Controllers
var selectedGoalOidsInputValue = formCollection[FormCollectionConstants.SelectedGoalOids];
var goalOids = string.IsNullOrWhiteSpace(selectedGoalOidsInputValue) ? new List<long>() : selectedGoalOidsInputValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();
var goals2Ratings = string.IsNullOrWhiteSpace(selectedGoalOidsInputValue) ? new Dictionary<long, long?>() : Utils.JsonMap2Dictionary(selectedGoalOidsInputValue);
var goalOids = new List<long>();
foreach(var goal2Rating in goals2Ratings)
{
goalOids.AddIfNotIn(goal2Rating.Key);
}
var isStartDateValid = DateTime.TryParse(dateInputValue, out var startDate);
if(false == isStartDateValid)
@@ -5246,8 +5253,6 @@ namespace BeWoPlanerMobil.Controllers
}
}
// ToDo für den 13.10.2025: Ziele noch einbauen
if(isEndDateValid == false)
{
endDate = startDate;
@@ -5266,6 +5271,61 @@ namespace BeWoPlanerMobil.Controllers
serviceRecord.Employee = Model.AllEmployees.FirstOrDefault(f => f.EmployeeOid == sbEmployeeOid) ?? Model.LoggedInUser.Employee;
}
var scOids = new List<long>();
if(bookingMode is BookingMode.GroupBookingMode || bookingMode is BookingMode.MultiBookingMode)
{
scOids = Model.GroupBookingSelectedCostBearerSupportConcepts.Select(sc2Cb => sc2Cb.SupportConcept.SupportConceptOid).ToList();
}
else
{
scOids.Add(Model.SelectedSupportConcept.SupportConceptOid);
}
var infos = OperationsService.GetSupportConceptTreeNodeDetailInfos(scOids);
LoadGoals(infos);
Model.SelectedGoalOids = new List<long>();
var allGoalOids = Model.AllGoals.Where(w => w.ValueListEntryOid.HasValue).Select(s => s.ValueListEntryOid.Value);
var selectedGoalOids = allGoalOids.Intersect(goalOids).ToList();
Model.SelectedGoalOids = selectedGoalOids;
foreach(var goalOid in Model.SelectedGoalOids)
{
var goal = Model.AllGoals.FirstOrDefault(f => f.ValueListEntryOid.HasValue && f.ValueListEntryOid.Equals(goalOid));
if(goal is null)
{
continue;
}
Model.SelectedGoals.Add(DcToMokMapper.CreateZiel(goal));
}
foreach(var goalOid2RatingOid in goals2Ratings)
{
var goalOid = goalOid2RatingOid.Key;
var ratingTypeOid = goalOid2RatingOid.Value;
if(false == Model.SelectedGoalOids.Contains(goalOid))
{
continue;
}
var goal = Model.SelectedGoals.FirstOrDefault(f => f.ValueListEntryOid.HasValue && f.ValueListEntryOid.Equals(goalOid));
if(goal is null)
{
continue;
}
goal.RatingTypeOid = ratingTypeOid;
}
if(Model.NumberOfDokuTypes == 0)
{
serviceRecord.Notice = doku6;
@@ -5281,7 +5341,7 @@ namespace BeWoPlanerMobil.Controllers
serviceRecord.DistanceInMeter = null;
serviceRecord.DistanceInMeterDecimal = distance;
Model.SelectedServiceRecord = serviceRecord;
TempData[TempDataConstants.AfterRestoreKey] = true;

View File

@@ -475,4 +475,14 @@ function commaSeparatedOid2Array(csv) {
}
return csv.split(",").map(num => parseInt(num, 10));
}
function map2String(map) {
var output = `Map mit ${map.size} Einträgen:\r\n`;
map.forEach((value, key, map) => {
output += `\t[${key}: ${value}]\r\n`;
});
return output;
}

View File

@@ -204,7 +204,7 @@ function validateForm(form, prefix) {
if(isNoticeMandatory) {
if(numberOfNoticeTextareas === 0) {
var doku = $(`#${prefix}-doku-textarea`).val();
var doku = $(`#${prefix}-doku-textarea-5`).val();
if(doku === undefined || doku === null) {
doku = "";
@@ -307,7 +307,7 @@ function getDokuTexte(prefix) {
const noticeList = [null, null, null, null, null];
try {
const hasMultipleDokufelder = $(`#${prefix}-doku-textarea`).length === 0;
const hasMultipleDokufelder = $(`#${prefix}-doku-textarea-5`).length === 0;
let dokufeldCounter = 0;
@@ -321,18 +321,9 @@ function getDokuTexte(prefix) {
}
}
} else {
noticeList[0] = $(`#${prefix}-doku-textarea`).val();
noticeList[0] = $(`#${prefix}-doku-textarea-5`).val();
dokufeldCounter = 1;
}
let x = "";
for(let j = 0; j < dokufeldCounter; j++) {
x += noticeList[j];
if(j < noticeList.length - 1) {
x += ", ";
}
}
} catch(error) {
window.showErrorPopup(error);
} finally {

View File

@@ -17,7 +17,7 @@
try {
var goalOid = $("#goal-to-rate-oid").val();
window.updateGoal2Rating("@Model.BookingModePrefix", goalOid, ratingTypeOid);
window.updateGoalRating("@Model.BookingModePrefix", goalOid, ratingTypeOid);
$.get("@Url.Action("RateSelectedGoal")",
{

View File

@@ -80,11 +80,13 @@
const id = box.attr("id").split("-")[2];
if(box.prop("checked") === true && !id.includes("goal")) {
selectedGoals += id + ";";
selectedGoals += `${id};`;
}
});
return selectedGoals.substr(0, selectedGoals.length - 1);
const result = selectedGoals.substr(0, selectedGoals.length - 1);
return result;
} catch(error) {
showErrorPopup(error);
return null;
@@ -94,8 +96,10 @@
function updateSelectedGoals() {
try {
const selectedGoals = getCheckedGoals();
console.log(selectedGoals);
window.updateGoals2Ratings("@Model.BookingModePrefix", new Map(selectedGoals.split(";").map(item => [item, ""])));
const goalsAsMap = new Map(selectedGoals.split(";").map(item => [item, null]));
window.updateGoals2Ratings("@Model.BookingModePrefix", goalsAsMap);
$.get("@Url.Action("UpdateGoals")", {pGoalOids: selectedGoals}, function (numberOfSelectedGoals) {
$("#goals-button").html(`Ziele <span class='badge badge-light text-primary'>${numberOfSelectedGoals}</span>`);

View File

@@ -264,8 +264,8 @@
@if(Model.NumberOfDokuTypes == 0)
{
<div class="form-group">
<label for="gb-doku-textarea">Dokumentation</label>
<textarea class="form-control" onchange="window.updateDokuText('gb', $(this).val(), 5)" autocomplete="on" name="Dokumentation6" id="gb-doku-textarea">@notice0</textarea>
<label for="gb-doku-textarea-5">Dokumentation</label>
<textarea class="form-control" onchange="window.updateDokuText('gb', $(this).val(), 5)" autocomplete="on" name="Dokumentation6" id="gb-doku-textarea-5">@notice0</textarea>
</div>
}
else

View File

@@ -67,7 +67,32 @@
@* Ziele *@
@if((Model.GroupBookingSelectedCostBearerSupportConcepts?.Any() ?? false) && (Model.AllGoals?.Any() ?? false))
{
<div class="form-row my-0">
<div class="form-row">
<div class="col-md mt-2">
<div class="card w-100">
<div class="card-header py-0" onclick="cardHeaderClick2(this)">
<div class="d-inline-flex">
<i class="fas @Html.GetCollapsibleChevron(Model, "goals-container") h-100 text-dark"></i>
</div>
<div class="d-inline-flex h-100">
<button type="button" class="btn btn-link text-dark">
Ziele
</button>
</div>
</div>
<div class="collapse @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, "goals-container")" id="goals-container">
<div class="card-body p-1">
<div class="container p-0" id="goals-tree">
@Html.Partial("GoalTreePartial", Model)
</div>
</div>
</div>
</div>
</div>
</div>
@*<div class="form-row my-0">
<div class="col-md">
<button type="button" class="btn btn-primary form-control mt-2" data-toggle="modal" data-target="#goal-popup" id="goals-button">
Ziele <span class="badge badge-light text-primary">@Model.SelectedGoals.Count</span>
@@ -78,7 +103,7 @@
<div class="col-md">
<div class="collapse w-100 mt-2 max-vw-50 @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, "goals-container")" id="goals-container"></div>
</div>
</div>
</div>*@
}
@* Kategorie und Leistungen *@

View File

@@ -60,7 +60,7 @@
function validatePasswordStrength() {
try{
(new window.MoKPasswordSecurity("pw-strength-feedback")).validatePassword($("#new-password").val());
(new MoKPasswordSecurity("pw-strength-feedback")).validatePassword($("#new-password").val());
} catch(error) {
window.showErrorPopup(error);
}

View File

@@ -258,8 +258,8 @@
@if(Model.NumberOfDokuTypes == 0)
{
<div class="form-group mt-2">
<label for="mb-doku-textarea">Dokumentation</label>
<textarea class="form-control" autocomplete="on" name="Dokumentation6" id="mb-doku-textarea" onchange="window.updateDokuText('mb', $(this).val(), 5)">@notice0</textarea>
<label for="mb-doku-textarea-5">Dokumentation</label>
<textarea class="form-control" autocomplete="on" name="Dokumentation6" id="mb-doku-textarea-5" onchange="window.updateDokuText('mb', $(this).val(), 5)">@notice0</textarea>
</div>
}
else

View File

@@ -3,27 +3,21 @@
@using BeWoPlanerMobil.Util
@model BeWoPlanerMobil.Models.MainModel
@*
ToDo: Bei Hilfeplan schauen, ob die Ziele/Maßnahmen, Kategorie/Leistung, Textbausteines korrekt sind.
*@
<script type="text/javascript">
@if(TempData[TempDataConstants.AfterRestoreKey] is true)
{
<text>
//clearLocalBeWoStorage();
clearLocalBeWoStorage();
</text>
}
var keyMap = new Map(
[
[`${getLocalStorageKey()}-SbCb2ScRelOid`, "Hilfeplan"],
[`${getLocalStorageKey()}-SbEmployeeOids`, "Mitarbeiter"],
[`${getLocalStorageKey()}-SbCategory`, "Kategorie"],
[`${getLocalStorageKey()}-SbServiceDescription`, "Leistung"],
[`${getLocalStorageKey()}-SbStartDate`, "Start"],
[`${getLocalStorageKey()}-SbCb2ScRelOid`, "Hilfeplan"],
[`${getLocalStorageKey()}-SbEmployeeOids`, "Mitarbeiter"],
[`${getLocalStorageKey()}-SbCategory`, "Kategorie"],
[`${getLocalStorageKey()}-SbServiceDescription`, "Leistung"],
[`${getLocalStorageKey()}-SbStartDate`, "Start"],
[`${getLocalStorageKey()}-SbEndDate`, "Enddatum"],
[`${getLocalStorageKey()}-SbStartTime`, "Von"],
[`${getLocalStorageKey()}-SbEndTime`, "Bis"],
@@ -34,9 +28,9 @@
[`${getLocalStorageKey()}-SbBetrag`, "Betrag"],
[`${getLocalStorageKey()}-SbDoku1`, "Doku 1"],
[`${getLocalStorageKey()}-SbDoku2`, "Doku 2"],
[`${getLocalStorageKey()}-SbDoku3`, "Doku 3"],
[`${getLocalStorageKey()}-SbDoku4`, "Doku 4"],
[`${getLocalStorageKey()}-SbDoku5`, "Doku 5"],
[`${getLocalStorageKey()}-SbDoku3`, "Doku 3"],
[`${getLocalStorageKey()}-SbDoku4`, "Doku 4"],
[`${getLocalStorageKey()}-SbDoku5`, "Doku 5"],
[`${getLocalStorageKey()}-SbDoku6`, "Doku 6"],
[`${getLocalStorageKey()}-SbGoals2Ratings`, "Ziele & Maßnahmen"],
[`${getLocalStorageKey()}-SbCurrentPage`, "Ausgewählte Seite"],
@@ -50,7 +44,7 @@
[`${getLocalStorageKey()}-GbStartTime`, "Von"],
[`${getLocalStorageKey()}-GbEndTime`, "Bis"],
[`${getLocalStorageKey()}-GbDuration`, "Dauer"],
[`${getLocalStorageKey()}-GbDurationUnit`, "Einheit der Dauer"],
[`${getLocalStorageKey()}-GbDurationUnit`, "Einheit der Dauer"],
[`${getLocalStorageKey()}-GbDistance`, "Gefahrene Kilometer"],
[`${getLocalStorageKey()}-GbMarker`, "Marker"],
[`${getLocalStorageKey()}-GbBetrag`, "Betrag"],
@@ -62,30 +56,30 @@
[`${getLocalStorageKey()}-GbDoku6`, "Doku 6"],
[`${getLocalStorageKey()}-GbGoals2Ratings`, "Ziele & Maßnahmen"],
[`${getLocalStorageKey()}-MbCb2ScRelOids`, "Hilfepläne"],
[`${getLocalStorageKey()}-MbCb2ScRelOids`, "Hilfepläne"],
[`${getLocalStorageKey()}-MbEmployeeOids`, "Mitarbeiter"],
[`${getLocalStorageKey()}-MbCategory`, "Kategorie"],
[`${getLocalStorageKey()}-MbServiceDescription`, "Leistung"],
[`${getLocalStorageKey()}-MbStartDate`, "Start"],
[`${getLocalStorageKey()}-MbEndDate`, "Enddatum"],
[`${getLocalStorageKey()}-MbStartTime`, "Von"],
[`${getLocalStorageKey()}-MbEndTime`, "Bis"],
[`${getLocalStorageKey()}-MbCategory`, "Kategorie"],
[`${getLocalStorageKey()}-MbServiceDescription`, "Leistung"],
[`${getLocalStorageKey()}-MbStartDate`, "Start"],
[`${getLocalStorageKey()}-MbEndDate`, "Enddatum"],
[`${getLocalStorageKey()}-MbStartTime`, "Von"],
[`${getLocalStorageKey()}-MbEndTime`, "Bis"],
[`${getLocalStorageKey()}-MbDuration`, "Dauer"],
[`${getLocalStorageKey()}-MbDurationUnit`, "Einheit der Dauer"],
[`${getLocalStorageKey()}-MbDistance`, "Gefahrene Kilometer"],
[`${getLocalStorageKey()}-MbMarker`, "Marker"],
[`${getLocalStorageKey()}-MbBetrag`, "Betrag"],
[`${getLocalStorageKey()}-MbDoku1`, "Doku 1"],
[`${getLocalStorageKey()}-MbDoku2`, "Doku 2"],
[`${getLocalStorageKey()}-MbDoku3`, "Doku 3"],
[`${getLocalStorageKey()}-MbDoku4`, "Doku 4"],
[`${getLocalStorageKey()}-MbDoku5`, "Doku 5"],
[`${getLocalStorageKey()}-MbDoku6`, "Doku 6"],
[`${getLocalStorageKey()}-MbGoals2Ratings`, "Ziele & Maßnahmen"]
[`${getLocalStorageKey()}-MbDurationUnit`, "Einheit der Dauer"],
[`${getLocalStorageKey()}-MbDistance`, "Gefahrene Kilometer"],
[`${getLocalStorageKey()}-MbMarker`, "Marker"],
[`${getLocalStorageKey()}-MbBetrag`, "Betrag"],
[`${getLocalStorageKey()}-MbDoku1`, "Doku 1"],
[`${getLocalStorageKey()}-MbDoku2`, "Doku 2"],
[`${getLocalStorageKey()}-MbDoku3`, "Doku 3"],
[`${getLocalStorageKey()}-MbDoku4`, "Doku 4"],
[`${getLocalStorageKey()}-MbDoku5`, "Doku 5"],
[`${getLocalStorageKey()}-MbDoku6`, "Doku 6"],
[`${getLocalStorageKey()}-MbGoals2Ratings`, "Ziele & Maßnahmen"]
]
);
var timeRegex = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
var timeRegex = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
function saveLocally(key, value) {
if(value === undefined || value === null || value.length === 0) {
@@ -93,37 +87,73 @@
return;
}
localStorage.setItem(key, value);
localStorage.setItem(key, value);
}
function getLocalStorageKey() {
return "@MobileSessionFacade.LocalStorageKey";
}
function updateGoals2Ratings(prefix, map) {
if(map === null || map === undefined || map.length === 0) {
localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`);
function updateGoalRating(prefix, goalOid, ratingTypeOid) {
const localStorageKey = `@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`;
const storedValue = localStorage.getItem(localStorageKey);
const goals2Ratings = storedValue ? new Map(JSON.parse(storedValue)) : new Map();
if(goals2Ratings.has(goalOid)) {
goals2Ratings.set(goalOid, ratingTypeOid);
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`, JSON.stringify([...goals2Ratings]));
}
}
function updateGoals2Ratings(prefix, newMap) {
const localStorageKey = `@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`;
if(newMap === null || newMap === undefined || newMap.length === 0) {
localStorage.removeItem(localStorageKey);
return;
}
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`, [...map]);
const storedValue = localStorage.getItem(localStorageKey);
const oldMap = storedValue ? new Map(JSON.parse(storedValue)) : new Map();
const mergedMap = new Map();
newMap.forEach((value, key, map) => {
const possibleRating =
oldMap.has(key)
? oldMap.get(key)
: null;
mergedMap.set(key, possibleRating);
});
const strigified = JSON.stringify([...mergedMap]);
logColorfulMessage(`updateGoals2Ratings(${prefix}, ${window.map2String(newMap)}): Ziele/Maßnahmen gespeichert:\r\n${window.map2String(mergedMap)}\r\nstringified: ${strigified}`, "#FF5A00");
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`, strigified);
}
function updateCbScRelOids(prefix, csv) {
if(csv === null || csv === undefined || csv.toString().length === 0) {
if(csv === null || csv === undefined || csv.toString().length === 0) {
localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Cb2ScRelOid${(prefix === "sb" ? "" : "s")}`);
return;
}
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Cb2ScRelOid${(prefix === "sb" ? "" : "s")}`, csv);
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Cb2ScRelOid${(prefix === "sb" ? "" : "s")}`, csv);
}
function updateEmployeeOids(prefix, csv) {
if(csv === null || csv === undefined || csv.toString().length === 0) {
localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`);
localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`);
return;
}
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`, csv);
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`, csv);
}
function updateCategory(prefix, categoryOid) {
@@ -140,14 +170,14 @@
function updateStartTime(prefix, startTime) {
if(false === timeRegex.test(startTime)) {
return;
}
return;
}
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartTime`, startTime);
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartTime`, startTime);
}
function updateEndDate(prefix, endDate) {
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndDate`, endDate);
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndDate`, endDate);
}
function updateEndTime(prefix, endTime) {
@@ -155,7 +185,7 @@
return;
}
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndTime`, endTime);
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndTime`, endTime);
}
function updateDuration(prefix, duration) {
@@ -173,7 +203,7 @@
function updateBetrag(prefix, betrag) {
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Betrag`, betrag);
}
function updateDokuText(prefix, text, nr) {
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Doku${(nr + 1)}`, text);
}
@@ -183,8 +213,6 @@
}
function updateDurationUnit(prefix, durationUnit) {
logInfo(`Speichere die ${prefix}-Dauereinheit ${durationUnit} lokal.`);
saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}DurationUnit`, durationUnit);
}
@@ -198,86 +226,98 @@
const key = localStorage.key(i);
if(key.startsWith(`@MobileSessionFacade.LocalStorageKey`)) {
localStorage.removeItem(key);
localStorage.removeItem(key);
}
}
}
function updateGoal2Rating(prefix, goalOid, ratingTypeOid) {
logInfo(`(${prefix}) Bewerte das Ziel mit der Oid ${goalOid} mit der Bewertungsid ${ratingTypeOid}`);
const localStorageKey = `@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`;
const stored = localStorage.getItem(localStorageKey);
console.log(stored);
logInfo2(stored);
const map = stored ? new Map(JSON.parse(stored)) : new Map();
map.set(goalOid, ratingTypeOid);
saveLocally(localStorageKey, JSON.stringify([...map]));
for(const key of map.keys()) {
const val = map.get(key);
logInfo3(`${key}: ${val}`);
}
saveLocally(localStorageKey, JSON.stringify([...map]));
}
function printLocalStorage() {
$("#local-storage-popup-body").html("");
let output = "";
@if(Html.IsInDebugMode())
{
<text>
$("#local-storage-popup-body").html("");
let output = "";
let singleBookingOutput = "<h2>Einzelbuchung</h2><table class='table table-sm table-striped'>" +
"<thead>" +
"<tr>" +
"<th scope='col'>Id</th>" +
"<th scope='col'>Wert</th>" +
"<th scope='col'>Feld</th>" +
"<th scope='col'></th>" +
"</tr>" +
"</thead>";
let singleBookingOutput = "<h2>Einzelbuchung</h2><table class='table table-sm table-striped'>" +
"<thead>" +
"<tr>" +
"<th scope='col'>Id</th>" +
"<th scope='col'>Wert</th>" +
"<th scope='col'>Feld</th>" +
"<th scope='col'></th>" +
"</tr>" +
"</thead>";
let groupBookingOutput = "<h2 class='mt-3'>Gruppenbuchung</h2><table class='table table-sm table-striped'>" +
"<thead>" +
"<tr>" +
"<th scope='col'>Id</th>" +
"<th scope='col'>Wert</th>" +
"<th scope='col'>Feld</th>" +
"<th scope='col'></th>" +
"</tr>" +
"</thead>";
let groupBookingOutput = "<h2 class='mt-3'>Gruppenbuchung</h2><table class='table table-sm table-striped'>" +
"<thead>" +
"<tr>" +
"<th scope='col'>Id</th>" +
"<th scope='col'>Wert</th>" +
"<th scope='col'>Feld</th>" +
"<th scope='col'></th>" +
"</tr>" +
"</thead>";
let multiBookingOutput = "<h2 class='mt-3'>Mehrfachbuchung</h2><table class='table table-sm table-striped'>" +
"<thead>" +
"<tr>" +
"<th scope='col'>Id</th>" +
"<th scope='col'>Wert</th>" +
"<th scope='col'>Feld</th>" +
"<th scope='col'></th>" +
"</tr>" +
"</thead>";
let multiBookingOutput = "<h2 class='mt-3'>Mehrfachbuchung</h2><table class='table table-sm table-striped'>" +
"<thead>" +
"<tr>" +
"<th scope='col'>Id</th>" +
"<th scope='col'>Wert</th>" +
"<th scope='col'>Feld</th>" +
"<th scope='col'></th>" +
"</tr>" +
"</thead>";
for(let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
for(let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if(false === key.startsWith(`@MobileSessionFacade.LocalStorageKey-`)) {
continue;
}
if(false === key.startsWith(`@MobileSessionFacade.LocalStorageKey-`)) {
continue;
}
const value = localStorage.getItem(key);
const value = localStorage.getItem(key);
if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Sb`)) {
singleBookingOutput += `<tr><td>${key}</td><td>${keyMap.get(key)}</td><td>${value}</td><td><button type="button" class="btn btn-sm btn-danger" onclick="localStorage.removeItem('${key}');printLocalStorage();"><i class="fas fa-trash"></i></button></td></tr>`;
} else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Gb`)) {
groupBookingOutput += `<tr><td>${key}</td><td>${keyMap.get(key)}</td><td>${value}</td><td><button type="button" class="btn btn-sm btn-danger" onclick="localStorage.removeItem('${key}');printLocalStorage();"><i class="fas fa-trash"></i></button></td></tr>`;
} else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Mb`)) {
multiBookingOutput += `<tr><td>${key}</td><td>${keyMap.get(key)}</td><td>${value}</td><td><button type="button" class="btn btn-sm btn-danger" onclick="localStorage.removeItem('${key}');printLocalStorage();"><i class="fas fa-trash"></i></button></td></tr>`;
}
if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Sb`)) {
singleBookingOutput += `<tr><td>${key}</td><td>${keyMap.get(key)}</td><td>${value}</td><td><button type="button" class="btn btn-sm btn-danger" onclick="localStorage.removeItem('${key}');printLocalStorage();"><i class="fas fa-trash"></i></button></td></tr>`;
} else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Gb`)) {
groupBookingOutput += `<tr><td>${key}</td><td>${keyMap.get(key)}</td><td>${value}</td><td><button type="button" class="btn btn-sm btn-danger" onclick="localStorage.removeItem('${key}');printLocalStorage();"><i class="fas fa-trash"></i></button></td></tr>`;
} else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Mb`)) {
multiBookingOutput += `<tr><td>${key}</td><td>${keyMap.get(key)}</td><td>${value}</td><td><button type="button" class="btn btn-sm btn-danger" onclick="localStorage.removeItem('${key}');printLocalStorage();"><i class="fas fa-trash"></i></button></td></tr>`;
}
}
singleBookingOutput += "</table>";
groupBookingOutput += "</table>";
multiBookingOutput += "</table>";
output += singleBookingOutput + "<hr>" + groupBookingOutput + "<hr>" + multiBookingOutput;
$("#local-storage-popup-body").html(`<div class='btn-group my-1' role='group'><button type='button' class='btn btn-outline-danger' onclick='clearLocalBeWoStorage();printLocalStorage();'><span class='fas fa-trash-alt'></span>Leeren</button></div><hr>${output}`);
$("#local-storage-popup").modal("show");
</text>
}
singleBookingOutput += "</table>";
groupBookingOutput += "</table>";
multiBookingOutput += "</table>";
output += singleBookingOutput + "<hr>" + groupBookingOutput + "<hr>" + multiBookingOutput;
$("#local-storage-popup-body").html(`<div class='btn-group my-1' role='group'><button type='button' class='btn btn-outline-danger' onclick='clearLocalBeWoStorage();printLocalStorage();'><span class='fas fa-trash-alt'></span>Leeren</button></div><hr>${output}`);
$("#local-storage-popup").modal("show");
}
function restoreAllFields() {
showSpinner();
showSpinner();
const bookingMode = @((int) Model.CurrentBookingMode);
@@ -302,18 +342,20 @@
$("#srr-distance-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Distance`));
$("#srr-doku-textarea-1").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku1`));
$("#srr-doku-textarea-2").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku2`));
$("#srr-doku-textarea-3").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku3`));
$("#srr-doku-textarea-4").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku4`));
$("#srr-doku-textarea-5").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku5`));
$("#srr-doku-textarea-1").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku1`));
$("#srr-doku-textarea-2").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku2`));
$("#srr-doku-textarea-3").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku3`));
$("#srr-doku-textarea-4").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku4`));
$("#srr-doku-textarea-5").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku5`));
$("#srr-doku-textarea-6").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku6`));
$("#srr-leistung-select").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}ServiceDescription`));
$("#srr-leistung-select").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}ServiceDescription`));
$("#srr-goals-ratings").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Goals2Ratings`));
$("#srr-booking-mode").val(bookingMode);
$("#srr-sb-cb2sc-oid").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-SbCb2ScRelOid`));
$("#srr-sb-cb2sc-oid").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-SbCb2ScRelOid`));
$("#srr-current-page").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-SbCurrentPage`));
@@ -323,6 +365,8 @@
@using(Html.BeginForm("RestoreServiceRecordForm", "Main", FormMethod.Post, new { id = "restore-service-record-form" }))
{
<input type="hidden" id="srr-goals-ratings" name="@FormCollectionConstants.SelectedGoalOids" />
<input type="hidden" id="srr-current-page" name="@FormCollectionConstants.CurrentPageKey" />
<input type="hidden" id="srr-leistung-select" name="@FormCollectionConstants.ServiceDescriptionKey" />

View File

@@ -304,14 +304,25 @@
{
<div class="form-row">
<div class="col-md mt-2">
<button type="button" class="btn btn-primary form-control" data-toggle="modal" data-target="#goal-popup" id="goals-button">
Ziele <span class="badge badge-light text-primary">@Model.SelectedGoals.Count</span>
</button>
</div>
</div>
<div class="form-row">
<div class="col-md">
<div class="collapse mt-2 w-100 max-vw-50 @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, "goals-container")" id="goals-container"></div>
<div class="card w-100">
<div class="card-header py-0" onclick="cardHeaderClick2(this)">
<div class="d-inline-flex">
<i class="fas @Html.GetCollapsibleChevron(Model, "goals-container") h-100 text-dark"></i>
</div>
<div class="d-inline-flex h-100">
<button type="button" class="btn btn-link text-dark">
Ziele
</button>
</div>
</div>
<div class="collapse @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, "goals-container")" id="goals-container">
<div class="card-body p-1">
<div class="container p-0" id="goals-tree">
@Html.Partial("GoalTreePartial", Model)
</div>
</div>
</div>
</div>
</div>
</div>
}
@@ -385,7 +396,7 @@
var columnWidth = Model.IsEndDateVisible ? "col-md-6" : "col";
var x = Model.StartTimeToEdit;
//var x = Model.StartTimeToEdit;
}
<div class="form-row">

View File

@@ -40,7 +40,7 @@
prefix = "mb";
}
const dokufeldId = `#${prefix}-doku-textarea`;
const dokufeldId = `#${prefix}-doku-textarea-5`;
const dokuTextareaId = `#${prefix}-doku-textarea-`;
const textareaContainerId = `#${prefix}-doku_`;

View File

@@ -55,7 +55,7 @@
<script type="text/javascript" src="@Scripts.Url("~/Scripts/moment/locale/de.js")"></script>
<script type="text/javascript" src="@Scripts.Url("~/Scripts/ownSoft-Scripts/mobileUtils.js?v=1.6")"></script>
<script type="text/javascript" src="@Scripts.Url("~/Scripts/ownSoft-Scripts/view-scripts/main.js?v=1.9")"></script>
<script type="text/javascript" src="@Scripts.Url("~/Scripts/ownSoft-Scripts/view-scripts/main.js?v=2.0")"></script>
<script type="text/javascript" src="@Scripts.Url("~/Scripts/ownSoft-Scripts/signature.js?v=1.5")"></script>
<link type="text/css" rel="stylesheet" href="@Url.Content("~/Scripts/bootstrap/bootstrap4-modal-fullscreen.min.css")" />

View File

@@ -1,4 +1,9 @@
using System;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using DevExpress.XtraScheduler;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
@@ -15,10 +20,6 @@ using System.Text.RegularExpressions;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Xml.Serialization;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using DevExpress.XtraScheduler;
namespace BS.Shared.Core
{
@@ -1198,7 +1199,29 @@ namespace BS.Shared.Core
string msg = iso.GetString(isoBytes);
return msg;
}
}
/// <summary>
/// Wandelt einen JSON-String in ein Wörterbuch vom Typ Dictionary<long, long?> um.
/// </summary>
/// <param name="json">Die serialisierte Map</param>
/// <returns>Dictionary vom Typ Dictionary<long, long?>.</returns>
public static Dictionary<long, long?> JsonMap2Dictionary(string json)
{
var dictionary = new Dictionary<long, long?>();
var pairs = JsonConvert.DeserializeObject<List<List<long?>>>(json);
foreach(var pair in pairs)
{
if(pair.Count >= 2 && pair[0].HasValue)
{
dictionary[pair[0].Value] = pair[1];
}
}
return dictionary;
}
}
public struct NullCompareResult
{