Gruppenbuchung

This commit is contained in:
Lyndon Jetten
2018-11-26 13:27:16 -04:00
parent 92438e51dd
commit 4a4ed45d98
8 changed files with 148 additions and 142 deletions

View File

@@ -178,7 +178,6 @@
<Compile Include="Util\MobileUtils.cs" />
<Compile Include="Util\TextbausteinDisplayItem.cs" />
<Compile Include="Util\Umfeldsperson.cs" />
<Compile Include="Util\MobilUtils.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\BeWoMobileStyle.css" />

View File

@@ -4,10 +4,13 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using BeWo.Service.ServiceImplementations;
using BeWoPlanerMobil.Models;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using static BeWoPlanerMobil.Util.MobileUtils;
using BS.Shared;
@@ -959,9 +962,9 @@ namespace BeWoPlanerMobil.Controllers
var employeeCount = Model.SelectedEmployees.Count;
var personCount = Model.SelectedSupportConcepts.Count;
var cb2scOids = (from scDc in Model.SelectedSupportConcepts where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 let costBearer2SupportConceptOid = scDc.CostBearerRelations[0].CostBearer2SupportConceptOid where costBearer2SupportConceptOid != null select costBearer2SupportConceptOid.Value).ToList();
var cb2SCOids = (from scDc in Model.SelectedSupportConcepts where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 let costBearer2SupportConceptOid = scDc.CostBearerRelations[0].CostBearer2SupportConceptOid where costBearer2SupportConceptOid != null select costBearer2SupportConceptOid.Value).ToList();
var list = CalculateGroupBookingDuration(employeeCount, personCount, cb2scOids);
var list = CalculateGroupBookingDuration(employeeCount, personCount, cb2SCOids);
var newDCList = new List<ServiceRecordDC>();
@@ -1183,7 +1186,7 @@ namespace BeWoPlanerMobil.Controllers
string calcdId = null;
var lastMinuteInterval = -1;
if(MobileUtils.IsBillable(Model.SelectedServiceDescriptionOid.Value, Model.GetServiceDesctiptions()))
if(Model.SelectedServiceDescriptionOid.HasValue && IsBillable(Model.SelectedServiceDescriptionOid.Value, Model.GetServiceDesctiptions()))
{
roundDuration = true;
@@ -1239,11 +1242,11 @@ namespace BeWoPlanerMobil.Controllers
return list;
}
private void UpdateServiceRecordGroup(ServiceRecordGroupDC groupDC)
private void UpdateServiceRecordGroup(ServiceRecordGroupDC pGroupDC)
{
var newCount = 0;
foreach(var serviceRecord in groupDC.ServiceRecordList)
foreach(var serviceRecord in pGroupDC.ServiceRecordList)
{
if(!serviceRecord.ServiceRecordOid.HasValue)
{
@@ -1251,7 +1254,7 @@ namespace BeWoPlanerMobil.Controllers
}
}
if(newCount == groupDC.ServiceRecordList.Count)
if(newCount == pGroupDC.ServiceRecordList.Count)
{
return;
}
@@ -1279,7 +1282,7 @@ namespace BeWoPlanerMobil.Controllers
}
}
foreach(var item in groupDC.ServiceRecordList)
foreach(var item in pGroupDC.ServiceRecordList)
{
var key = item.Employee.EmployeeOid + "_" + item.SupportConcept.SupportConceptOid;
if(item.CostBearer2SupportConceptOid.HasValue)
@@ -1336,7 +1339,7 @@ namespace BeWoPlanerMobil.Controllers
else
{
newServiceRecord = CloneServiceRecordForGroupBooking(Model.NewServiceRecord);
groupDC.ServiceRecordList.Add(newServiceRecord);
pGroupDC.ServiceRecordList.Add(newServiceRecord);
}
newServiceRecord.Employee = emp;
@@ -1350,7 +1353,7 @@ namespace BeWoPlanerMobil.Controllers
foreach(var item in dcsToChange)
{
groupDC.ServiceRecordList.Remove(item);
pGroupDC.ServiceRecordList.Remove(item);
}
}
}
@@ -1615,43 +1618,6 @@ namespace BeWoPlanerMobil.Controllers
return RedirectToActionPermanent("Main");
}
private static List<ServiceCategoryModel> CreateServiceCategoryModels(IEnumerable<ServiceDescriptionDC> serviceDescriptions)
{
var catOid2ModelDict = new Dictionary<long, ServiceCategoryModel>();
foreach (var sd in serviceDescriptions)
{
if (!catOid2ModelDict.ContainsKey(sd.Category.ServiceCategoryOid.Value))
{
catOid2ModelDict[sd.Category.ServiceCategoryOid.Value] = new ServiceCategoryModel
{
Name = sd.Category.Name,
IsDefault = sd.Category.IsDefault,
Percentage = sd.Category.Percentage,
Position = sd.Category.Position,
OhneHilfeplan = sd.Category.OhneHilfeplan,
ServiceCategoryOid = sd.Category.ServiceCategoryOid,
ServiceDescriptions = new List<ServiceDescriptionDC>()
};
}
catOid2ModelDict[sd.Category.ServiceCategoryOid.Value].ServiceDescriptions.Add(sd);
}
var list = catOid2ModelDict.Values.ToList();
list.Sort((s1, s2) =>
{
if (s1.IsDefault)
{
return 1;
}
return s1.Position != s2.Position ? s1.Position.CompareTo(s2.Position) : s1.ServiceCategoryOid.Value.CompareTo(s2.ServiceCategoryOid.Value);
});
return list;
}
[HttpPost]
[Authorize]
@@ -1821,8 +1787,10 @@ namespace BeWoPlanerMobil.Controllers
var employees = new List<CompactEmployeeDC>();
Model.SelectedServiceRecord = serviceRecord;
Model.SelectedSupportConcepts.Clear();
Model.SelectedEmployees.Clear();
if(serviceRecord?.GroupOid != null)
if (serviceRecord?.GroupOid != null)
{
var serviceRecordGroup = OperationsService.GetServiceRecordGroup(serviceRecord.GroupOid.Value);
@@ -1850,6 +1818,7 @@ namespace BeWoPlanerMobil.Controllers
// TODO: Wie bei SetGroupBooking
//LoadServiceCategoriesForGroupBooking();
Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions());
return RedirectToActionPermanent("Main");
}

View File

@@ -150,29 +150,30 @@ namespace BeWoPlanerMobil.Models
}
}
public IEnumerable<SelectListItem> SelectedSupportConceptListItemsForGroupBooking
{
get
{
var selectedSCs = new List<SelectListItem>();
// TODO: KGW?
//public IEnumerable<SelectListItem> SelectedSupportConceptListItemsForGroupBooking
//{
// get
// {
// var selectedSCs = new List<SelectListItem>();
if(SelectedSupportConcepts != null)
{
foreach(var sc in SelectedSupportConcepts.OrderBy(sc => sc.Customer.LastName))
{
selectedSCs.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate == null || w.EndDate.Value >= DateTime.Now).Select(cb => new SelectListItem
{
Value = cb.CostBearer2SupportConceptOid.ToString(),
Text = $"{sc.Customer.LastNameFirstName} | {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}"
}));
}
}
// if(SelectedSupportConcepts != null)
// {
// foreach(var sc in SelectedSupportConcepts.OrderBy(sc => sc.Customer.LastName))
// {
// selectedSCs.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate == null || w.EndDate.Value >= DateTime.Now).Select(cb => new SelectListItem
// {
// Value = cb.CostBearer2SupportConceptOid.ToString(),
// Text = $"{sc.Customer.LastNameFirstName} | {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}"
// }));
// }
// }
return selectedSCs;
}
}
public IEnumerable<SelectListItem> ServiceCategoryListItems
// return selectedSCs;
// }
//}
public IEnumerable<SelectListItem> ServiceCategoryListItems
{
get
{
@@ -197,26 +198,28 @@ namespace BeWoPlanerMobil.Models
return result;
}
}
[Display(Name = "Textbaustein")]
public long? SelectedTextbausteinOid { get; set; }
public IEnumerable<SelectListItem> TextbausteinListItems
{
get
{
var result = new List<SelectListItem>();
// TODO: KGW?
// [Display(Name = "Textbaustein")]
// public long? SelectedTextbausteinOid { get; set; }
if (Textbausteine != null)
{
result.AddRange(Textbausteine.Select(item => new SelectListItem { Value = item.TextModuleOid.Value.ToString(), Text = item.Name }).ToList());
}
// TODO: KGW?
//public IEnumerable<SelectListItem> TextbausteinListItems
//{
// get
// {
// var result = new List<SelectListItem>();
return result;
}
}
// if (Textbausteine != null)
// {
// result.AddRange(Textbausteine.Select(item => new SelectListItem { Value = item.TextModuleOid.Value.ToString(), Text = item.Name }).ToList());
// }
public List<CompactCustomerDC> Customers { get; set; }
// return result;
// }
//}
public List<CompactCustomerDC> Customers { get; set; }
public List<CompactEmployeeDC> Employees { get; set; }
@@ -249,8 +252,9 @@ namespace BeWoPlanerMobil.Models
public List<long> SelectedGroupOfPeopleOids { get; set; } = new List<long>();
[Display(Name = "Gruppen")]
public string SelectedGroupInfo { get; set; }
// TODO: KGW
//[Display(Name = "Gruppen")]
//public string SelectedGroupInfo { get; set; }
public IEnumerable<SelectListItem> EmployeeListItems
{
@@ -288,12 +292,14 @@ namespace BeWoPlanerMobil.Models
public List<CompactEmployeeDC> SelectedEmployees { get; set; } = new List<CompactEmployeeDC>();
public List<long> SelectedCostbearer2SupportConceptOids { get; set; } = new List<long>();
// TODO: KGW
//public List<long> SelectedCostbearer2SupportConceptOids { get; set; } = new List<long>();
[Display(Name = "Gruppenbuchung")]
public bool IsInGroupBookingMode
{
get => _IsInGroupBookingMode;
//get => _IsInGroupBookingMode;
get => false;
set
{

View File

@@ -170,6 +170,6 @@ function addEmployees() {
showSanduhr();
$("groupBookingEmployeeSelectionForm").submit();
$("#groupBookingEmployeeSelectionForm").submit();
}
/* ------------------------------- */

View File

@@ -167,7 +167,10 @@ function initBeWoMobile(actionPath) {
var employeesTableHasEntries = $("#rightContent input:checked").length;
if (isInGroupBookingMode()) {
$("#anlegenEditierenBtn").prop("disabled", (supportConceptTableHasEntries === 0 || employeesTableHasEntries === 0));
var value = (supportConceptTableHasEntries === 0 || employeesTableHasEntries === 0) ? false : true;
$("#anlegenEditierenBtn").prop("disabled", value);
hideElement($("#selectSCForm"));
} else {
showElement($("#selectSCForm"));

View File

@@ -372,8 +372,6 @@ function activateForm(actionPath) {
loadGoals(actionPath);
console.log("actionPath: " + actionPath);
$("#kategorien_select").val($("#kategorien_select option").eq(0).val());
loadServiceDescriptions();
@@ -399,13 +397,12 @@ function resetRecordForm() {
$("#kategorien_select").val($("#kategorien_select option").eq(0).val());
for(var i = 0; i < numberOfDocumentationTypes; i++) {
$('#notiz_textbox' + (i + 1)).val("");
$("#notiz_textbox" + (i + 1)).val("");
}
var selectedCategory = $("#kategorien_select").find(":selected").val();
if(isInEditingMode()) {
console.log('making ajax call to reset the editing mode');
makeAjaxCall("POST", resetEditingModeUrl, function(response) { window.location.reload(); }, { pFormCollection: null }, null);
}
@@ -466,7 +463,7 @@ function validateTimeField(id) {
var zeitStr = id === "#start_textbox" ? "Start" : "End";
if (timeStr !== "" && !zeitRegEx.test(timeStr)) {
showZeiterfassungsError('Bitte geben Sie eine ' + + 'xxx-Zeit in einem g&uuml;ltigen Format (HH:MM oder HHMM) an.');
showZeiterfassungsError("Bitte geben Sie eine " + zeitStr + "-Zeit in einem g&uuml;ltigen Format (HH:MM oder HHMM) an.");
return false;
} else {
clearZED();
@@ -689,7 +686,7 @@ function validateServiceRecordBeforeSubmit() {
}
function ErfolgteSpx() {
if (document.getElementById("SaveSignature").value == "True") {
if (document.getElementById("SaveSignature").value === "True") {
toggleSuccessPopup("Eintrag wurde gespeichert." + "\n" + "Möchte Sie diesen unterschreiben lassen?", 4);
document.getElementById("SaveSignature").value = "False";

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using BeWoPlanerMobil.Models;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.Extensions;
@@ -224,5 +224,42 @@ namespace BeWoPlanerMobil.Util
{
return new JSONCustomer(pCustomer);
}
public static List<ServiceCategoryModel> CreateServiceCategoryModels(IEnumerable<ServiceDescriptionDC> serviceDescriptions)
{
var catOid2ModelDict = new Dictionary<long, ServiceCategoryModel>();
foreach (var sd in serviceDescriptions)
{
if (!catOid2ModelDict.ContainsKey(sd.Category.ServiceCategoryOid.Value))
{
catOid2ModelDict[sd.Category.ServiceCategoryOid.Value] = new ServiceCategoryModel
{
Name = sd.Category.Name,
IsDefault = sd.Category.IsDefault,
Percentage = sd.Category.Percentage,
Position = sd.Category.Position,
OhneHilfeplan = sd.Category.OhneHilfeplan,
ServiceCategoryOid = sd.Category.ServiceCategoryOid,
ServiceDescriptions = new List<ServiceDescriptionDC>()
};
}
catOid2ModelDict[sd.Category.ServiceCategoryOid.Value].ServiceDescriptions.Add(sd);
}
var list = catOid2ModelDict.Values.ToList();
list.Sort((s1, s2) =>
{
if (s1.IsDefault)
{
return 1;
}
return s1.Position != s2.Position ? s1.Position.CompareTo(s2.Position) : s1.ServiceCategoryOid.Value.CompareTo(s2.ServiceCategoryOid.Value);
});
return list;
}
}
}

View File

@@ -1,6 +1,5 @@
@using BeWoPlanerMobil.Models;
@using BeWoPlanerMobil.Util
@using DevExpress.Mvvm.Native
@model MainModel
@{
@@ -581,52 +580,52 @@
<button id="leftBtn" class="tab-links" onclick="openGroupBookingTab(true)">Hilfepläne</button>
<button id="rightBtn" class="tab-links" onclick="openGroupBookingTab(false)">Gruppen</button>
</div>
@using (Html.BeginForm("AddSupportConceptsToGroupBooking", "Main", FormMethod.Post, new {id = "groupBookingSupportConceptSelectionForm"}))
{
var i = 0;
var j = 0;
<div id="leftContent" class="tab-content">
<table>
@foreach (var hp in Model.SupporConceptListItemsForGroupBooking)
{
<tr>
<td style="width: 1px; white-space: nowrap;">
<input type="checkbox" value="@hp.Value" name="costbearer2supportconcept_@i"
@if (Model.SelectedCostbearerRelOids.Contains(long.Parse(hp.Value)))
{
@Html.Raw("checked=\"checked\"")
}/>
</td>
<td class="group-booking-text-cell">
@hp.Text
</td>
</tr>
i++;
}
</table>
</div>
<div id="rightContent" class="tab-content">
<table>
@foreach (var gruppe in Model.GroupOfPeopleListItems)
{
@using (Html.BeginForm("AddSupportConceptsToGroupBooking", "Main", FormMethod.Post, new {id = "groupBookingSupportConceptSelectionForm"}))
{
var i = 0;
var j = 0;
<div id="leftContent" class="tab-content">
<table>
@foreach (var hp in Model.SupporConceptListItemsForGroupBooking)
{
<tr>
<td style="width: 1px; white-space: nowrap;">
<input type="checkbox" value="@gruppe.Value" name="group_@j"
@if (Model.SelectedGroupOfPeopleOids.Contains(long.Parse(gruppe.Value)))
<input type="checkbox" value="@hp.Value" name="costbearer2supportconcept_@i"
@if (Model.SelectedCostbearerRelOids.Contains(long.Parse(hp.Value)))
{
@Html.Raw("checked=\"checked\"")
}/>
</td>
<td class="group-booking-text-cell">
@gruppe.Text
@hp.Text
</td>
</tr>
j++;
}
</table>
</div>
}
i++;
}
</table>
</div>
<div id="rightContent" class="tab-content">
<table>
@foreach (var gruppe in Model.GroupOfPeopleListItems)
{
<tr>
<td style="width: 1px; white-space: nowrap;">
<input type="checkbox" value="@gruppe.Value" name="group_@j"
@if (Model.SelectedGroupOfPeopleOids.Contains(long.Parse(gruppe.Value)))
{
@Html.Raw("checked=\"checked\"")
}/>
</td>
<td class="group-booking-text-cell">
@gruppe.Text
</td>
</tr>
j++;
}
</table>
</div>
}
<input type="button" onclick="addSupportConcepts()" value="Hinzufügen" />
</div>
</div>
@@ -1017,15 +1016,11 @@
SetSaveSignatureUrl = '@Url.Action("SetSaveSignature")';
loadTextbausteineForCategoryUrl = '@Url.Action("LoadTextbausteineForServiceCategory")';
loadCompleteTextbausteinByOidUrl = '@Url.Action("LoadCompleteTextbausteinByOid")';
@*addSupportConceptForGruppenbuchungUrl = '@Url.Action("AddSupportConceptToGruppenbuchung")';
addEmployeeForGruppenbuchungUrl = '@Url.Action("AddEmployeeToGruppenbuchung")';
removeSupportConceptFromGruppenbuchungUrl = '@Url.Action("RemoveSupportConceptFromGruppenbuchung")';
removeEmployeeFromGruppenbuchungUrl = '@Url.Action("RemoveEmployeeFromGruppenbuchung")';*@
setGroupbookinModeUrl = '@Url.Action("SetGroupBookingMode")';
setSelectedGroupServiceRecordUrl = '@Url.Action("SetSelectedGroupServiceRecord")';
resetEditingModeUrl = '@Url.Action("ResetEditingMode")';
loadCategoryAndDescriptionUrl = '@Url.Action("LoadCategoryAndDescription")';
addEmployeesToGroupBookingUrl = '@Url.Action("AddEmployeesToGroupBooking")';
loadCategoryAndDescriptionUrl = '@Url.Action("LoadCategoryAndDescription")';
addEmployeesToGroupBookingUrl = '@Url.Action("AddEmployeesToGroupBooking")';