@foreach(var selectedCb2ScRelation in Model.GroupBookingSelectionObject.SelectedRelations)
{
diff --git a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml
index fd20aaa26..11573b25c 100644
--- a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml
+++ b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml
@@ -17,81 +17,189 @@
}
+ var keyMap = new Map(
+ [
+ [`${getLocalStorageKey()}-SbCb2ScRelOid`, "Hilfeplan"],
+ [`${getLocalStorageKey()}-SbEmployeeOids`, "Mitarbeiter"],
+ [`${getLocalStorageKey()}-SbCategory`, "Kategorie"],
+ [`${getLocalStorageKey()}-SbServiceDescription`, "Leistung"],
+ [`${getLocalStorageKey()}-SbStartDate`, "Start"],
+ [`${getLocalStorageKey()}-SbEndDate`, "Enddatum"],
+ [`${getLocalStorageKey()}-SbStartTime`, "Von"],
+ [`${getLocalStorageKey()}-SbEndTime`, "Bis"],
+ [`${getLocalStorageKey()}-SbDuration`, "Dauer"],
+ [`${getLocalStorageKey()}-SbDurationUnit`, "Einheit der Dauer"],
+ [`${getLocalStorageKey()}-SbDistance`, "Gefahrene Kilometer"],
+ [`${getLocalStorageKey()}-SbMarker`, "Marker"],
+ [`${getLocalStorageKey()}-SbBetrag`, "Betrag"],
+ [`${getLocalStorageKey()}-SbDoku1`, "Doku 1"],
+ [`${getLocalStorageKey()}-SbDoku2`, "Doku 2"],
+ [`${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"],
+
+ [`${getLocalStorageKey()}-GbCb2ScRelOids`, "Hilfepläne"],
+ [`${getLocalStorageKey()}-GbEmployeeOids`, "Mitarbeiter"],
+ [`${getLocalStorageKey()}-GbCategory`, "Kategorie"],
+ [`${getLocalStorageKey()}-GbServiceDescription`, "Leistung"],
+ [`${getLocalStorageKey()}-GbStartDate`, "Start"],
+ [`${getLocalStorageKey()}-GbEndDate`, "Enddatum"],
+ [`${getLocalStorageKey()}-GbStartTime`, "Von"],
+ [`${getLocalStorageKey()}-GbEndTime`, "Bis"],
+ [`${getLocalStorageKey()}-GbDuration`, "Dauer"],
+ [`${getLocalStorageKey()}-GbDurationUnit`, "Einheit der Dauer"],
+ [`${getLocalStorageKey()}-GbDistance`, "Gefahrene Kilometer"],
+ [`${getLocalStorageKey()}-GbMarker`, "Marker"],
+ [`${getLocalStorageKey()}-GbBetrag`, "Betrag"],
+ [`${getLocalStorageKey()}-GbDoku1`, "Doku 1"],
+ [`${getLocalStorageKey()}-GbDoku2`, "Doku 2"],
+ [`${getLocalStorageKey()}-GbDoku3`, "Doku 3"],
+ [`${getLocalStorageKey()}-GbDoku4`, "Doku 4"],
+ [`${getLocalStorageKey()}-GbDoku5`, "Doku 5"],
+ [`${getLocalStorageKey()}-GbDoku6`, "Doku 6"],
+ [`${getLocalStorageKey()}-GbGoals2Ratings`, "Ziele & Maßnahmen"],
+
+ [`${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()}-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"]
+ ]
+ );
+
+ var timeRegex = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
+
+ function saveLocally(key, value) {
+ if(value === undefined || value === null || value.length === 0) {
+ logWarning(`Der Wert "${value}" bei Schlüssel "${key}" ist ungültig!`);
+ return;
+ }
+
+ localStorage.setItem(key, value);
+ }
+
function getLocalStorageKey() {
return "@MobileSessionFacade.LocalStorageKey";
}
function updateGoals2Ratings(prefix, map) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}`, [...map]);
+ if(map === null || map === undefined || map.length === 0) {
+ localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`);
+ }
+
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`, [...map]);
}
function updateCbScRelOids(prefix, csv) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Cb2ScRelOid${(prefix === "sb" ? "" : "s")}`, csv);
+ 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);
}
function updateEmployeeOids(prefix, csv) {
- logInfo3(`Speichere die MitarbeiterOids: "${csv}"`);
+ if(csv === null || csv === undefined || csv.toString().length === 0) {
+ localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`);
+ return;
+ }
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`, csv);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`, csv);
}
function updateCategory(prefix, categoryOid) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Category`, categoryOid);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Category`, categoryOid);
}
function updateServiceDescription(prefix, serviceDescriptionOid) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}ServiceDescription`, serviceDescriptionOid);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}ServiceDescription`, serviceDescriptionOid);
}
function updateStartDate(prefix, startDate) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartDate`, startDate);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartDate`, startDate);
}
function updateStartTime(prefix, startTime) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartTime`, startTime);
+ if(false === timeRegex.test(startTime)) {
+ return;
+ }
+
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartTime`, startTime);
}
function updateEndDate(prefix, endDate) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndDate`, endDate);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndDate`, endDate);
}
function updateEndTime(prefix, endTime) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndTime`, endTime);
+ if(false === timeRegex.test(endTime)) {
+ return;
+ }
+
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndTime`, endTime);
}
function updateDuration(prefix, duration) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Duration`, duration);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Duration`, duration);
}
function updateDistance(prefix, distance) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Distance`, distance);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Distance`, distance);
}
function updateMarker(prefix, marker) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Marker`, marker);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Marker`, marker);
}
function updateBetrag(prefix, betrag) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Betrag`, betrag);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Betrag`, betrag);
}
-
+
function updateDokuText(prefix, text, nr) {
- localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Doku${(nr + 1)}`, text);
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Doku${(nr + 1)}`, text);
}
function removeGoals2Ratings(prefix) {
localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`);
}
+ function updateDurationUnit(prefix, durationUnit) {
+ logInfo(`Speichere die ${prefix}-Dauereinheit ${durationUnit} lokal.`);
+
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}DurationUnit`, durationUnit);
+ }
+
+ function updateCurrentPage(currentPage) {
+ saveLocally(`@MobileSessionFacade.LocalStorageKey-SbCurrentPage`, currentPage);
+ }
+
+
function clearLocalBeWoStorage() {
for(let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
- if(!key.startsWith(`@MobileSessionFacade.LocalStorageKey`)) {
- continue;
+ if(key.startsWith(`@MobileSessionFacade.LocalStorageKey`)) {
+ localStorage.removeItem(key);
}
-
- localStorage.removeItem(key);
}
}
@@ -99,16 +207,16 @@
const localStorageKey = `@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`;
const stored = localStorage.getItem(localStorageKey);
+ console.log(stored);
const map = stored ? new Map(JSON.parse(stored)) : new Map();
map.set(goalOid, ratingTypeOid);
- localStorage.setItem(localStorageKey, JSON.stringify([...map]));
+ saveLocally(localStorageKey, JSON.stringify([...map]));
}
function printLocalStorage() {
- $("#dev-popup-body").html("");
-
+ $("#local-storage-popup-body").html("");
let output = "";
let singleBookingOutput = "
Einzelbuchung
" +
@@ -116,6 +224,8 @@
"" +
"| Id | " +
"Wert | " +
+ "Feld | " +
+ " | " +
"
" +
"";
@@ -123,7 +233,9 @@
"" +
"" +
"| Id | " +
- "Wert | " +
+ "Wert | " +
+ "Feld | " +
+ " | " +
"
" +
"";
@@ -132,6 +244,8 @@
"" +
"| Id | " +
"Wert | " +
+ "Feld | " +
+ " | " +
"
" +
"";
@@ -145,11 +259,11 @@
const value = localStorage.getItem(key);
if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Sb`)) {
- singleBookingOutput += `| ${key} | ${value} |
`;
+ singleBookingOutput += `| ${key} | ${keyMap.get(key)} | ${value} | |
`;
} else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Gb`)) {
- groupBookingOutput += `| ${key} | ${value} |
`;
+ groupBookingOutput += `| ${key} | ${keyMap.get(key)} | ${value} | |
`;
} else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Mb`)) {
- multiBookingOutput += `| ${key} | ${value} |
`;
+ multiBookingOutput += `| ${key} | ${keyMap.get(key)} | ${value} | |
`;
}
}
@@ -158,12 +272,13 @@
multiBookingOutput += "
";
output += singleBookingOutput + "
" + groupBookingOutput + "
" + multiBookingOutput;
- $("#dev-local-storage-body").html(`
${
- output}`);
- $("#dev-local-storage").modal("show");
+ $("#local-storage-popup-body").html(`
${output}`);
+ $("#local-storage-popup").modal("show");
}
function restoreAllFields() {
+ showSpinner();
+
const bookingMode = @((int) Model.CurrentBookingMode);
const prefix = bookingMode === 0 ? "Sb" : bookingMode === 1 ? "Gb" : "Mb";
@@ -174,37 +289,44 @@
$("#srr-mb-cb2sc-oids").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-MbCb2ScRelOids`));
$("#srr-mb-emp-oids").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-MbEmployeeOids`));
-
-
$("#srr-start-date-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}StartDate`));
$("#srr-start-time-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}StartTime`));
$("#srr-end-date-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}EndDate`));
$("#srr-end-time-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}EndTime`));
- //$("#srr-marker-cb").val();
- //$("#srr-betrag").val();
+ $("#srr-marker-cb").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Marker`));
+ $("#srr-betrag").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Betrag`));
- //$("#srr-duration-input").val();
+ $("#srr-duration-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Duration`));
+ $("#srr-duration-unit").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}DurationUnit`));
- //$("#srr-distance-input").val();
+ $("#srr-distance-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Distance`));
- //$("#srr-doku-textarea-1").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-0`));
- //$("#srr-doku-textarea-2").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-1`));
- //$("#srr-doku-textarea-3").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-2`));
- //$("#srr-doku-textarea-4").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-3`));
- //$("#srr-doku-textarea-5").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-4`));
- //$("#srr-doku-textarea-6").val(beWoStorage.getItemValueById(`${prefix}doku-textarea`));
+ $("#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-booking-mode").val(bookingMode);
- //$("#restore-service-record-form").submit();
+ $("#srr-sb-cb2sc-oid").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-SbCb2ScRelOid`));
+
+ $("#srr-current-page").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-SbCurrentPage`));
+
+ $("#restore-service-record-form").submit();
}
@using(Html.BeginForm("RestoreServiceRecordForm", "Main", FormMethod.Post, new { id = "restore-service-record-form" }))
{
-
+
+
+
@@ -215,6 +337,7 @@
+
@@ -225,6 +348,7 @@
+
@@ -245,7 +369,7 @@
@if(Html.IsInDebugMode())
{