Mobilklient:

Bewertung hinzugefügt
This commit is contained in:
Lyndon Jetten
2021-06-16 15:11:39 +02:00
parent d96b92852b
commit 38d7564496
19 changed files with 470 additions and 138 deletions

View File

@@ -812,6 +812,7 @@
</Compile>
<Compile Include="SchulbegleitenderDienst\WochenansichtVM.cs" />
<Compile Include="SchulbegleitenderDienst\WochenVertretung.cs" />
<Compile Include="Security\EncryptionUtils.cs" />
<Compile Include="UploadDialog.xaml.cs">
<DependentUpon>UploadDialog.xaml</DependentUpon>
</Compile>

View File

@@ -25,6 +25,7 @@ using BS.Shared;
using BS.Shared.Extensions;
using BeWo.Core;
using BeWo.Security;
using BeWo.ServiceProxy;
using BeWo.View;
using BeWo.View.Detail;
@@ -431,9 +432,9 @@ namespace BeWo
while (!myFile.EndOfStream)
{
var data = myFile.ReadLine().Split('|');
var data = myFile.ReadLine()?.Split('|');
if (data.Length >= 3)
if (data?.Length >= 3)
{
if (!String.IsNullOrEmpty(data[1]) && !String.IsNullOrEmpty(data[2]))
ProfileList.Add(new BeWoProfile(data[0], data[1], data[2]));
@@ -445,7 +446,6 @@ namespace BeWo
catch (Exception e)
{
}
}
private string GetNumericServerName(string serverName)
@@ -1065,6 +1065,7 @@ namespace BeWo
ReadProxyName();
}
// TODO: Verschlüsselung einbauen!
private void ReadProxyName()
{
int counter = 0;
@@ -1079,17 +1080,24 @@ namespace BeWo
filePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "proxy.dat");
}
var file = new System.IO.StreamReader(filePath);
while ((line = file.ReadLine()) != null)
{
byte[] decbuff = Convert.FromBase64String(line);
var x = System.Text.Encoding.UTF8.GetString(decbuff);
var allLines = File.ReadAllLines(filePath);
datai[counter] = x;
foreach(var linex in allLines)
{
var decryptedLine = EncryptionUtils.DecryptString(linex);
datai[counter] = decryptedLine;
counter++;
}
file.Close();
//var file = new StreamReader(filePath);
//while ((line = file.ReadLine()) != null)
//{
// datai[counter] = Encoding.UTF8.GetString(Convert.FromBase64String(line));
// counter++;
//}
//file.Close();
proxyname = datai[0];
proxyUsername = datai[1];
@@ -1103,6 +1111,7 @@ namespace BeWo
}
private void SaveSelectedProfile(BeWoProfile profile)
{
try
@@ -1126,7 +1135,6 @@ namespace BeWo
}
}
private void SaveProfileListToFile()
{
try

View File

@@ -1,36 +1,22 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BeWo.Security;
namespace BeWo
{
/// <summary>
/// Interaktionslogik für ProxyLoginView.xaml
/// </summary>
public partial class ProxyLoginView : Window
public partial class ProxyLoginView
{
public ProxyLoginView()
{
InitializeComponent();
überprüfe();
CheckBeWoProfile();
}
private void überprüfe() {
private void CheckBeWoProfile() {
if (proxynametxt.Text.Equals("") && proxybenutzer.Text.Equals("") && proxypasswort.Password.Equals("")) {
@@ -41,24 +27,34 @@ namespace BeWo
try
{
var filePath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\proxy.dat";
var filePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\proxy.dat";
if (!File.Exists(filePath))
{
filePath = System.IO.Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "proxy.dat");
filePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "proxy.dat");
}
var file = new System.IO.StreamReader(filePath);
while ((line = file.ReadLine()) != null)
{
var allLines = File.ReadAllLines(filePath);
byte[] decbuff = Convert.FromBase64String(line);
var x= System.Text.Encoding.UTF8.GetString(decbuff);
datai[counter] = x;
foreach(var linex in allLines)
{
var decryptedLine = EncryptionUtils.DecryptString(linex);
datai[counter] = decryptedLine;
counter++;
}
file.Close();
//var file = new StreamReader(filePath);
//while ((line = file.ReadLine()) != null)
//{
// byte[] decbuff = Convert.FromBase64String(line);
// var x= System.Text.Encoding.UTF8.GetString(decbuff);
// datai[counter] = x;
// counter++;
//}
//file.Close();
proxynametxt.Text = datai[0];
proxybenutzer.Text = datai[1];
@@ -70,50 +66,53 @@ namespace BeWo
}
// TODO: Verschlüsselung einbauen!
private void proxyOK_Click(object sender, RoutedEventArgs e)
{
string ptname = proxynametxt.Text;
string ptbenutzer = proxybenutzer.Text;
string ptpasswd = proxypasswort.Password;
string[] lines = { ptname, ptbenutzer, ptpasswd };
string[] lines = { proxynametxt.Text, proxybenutzer.Text, proxypasswort.Password };
var encryptedLines = new List<string>();
try
{
var filePath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\proxy.dat";
var filePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\proxy.dat";
if (!File.Exists(filePath))
{
filePath = System.IO.Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "proxy.dat");
filePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "proxy.dat");
}
using (System.IO.StreamWriter file =
new System.IO.StreamWriter(filePath))
foreach(var line in lines)
{
foreach (string line in lines)
{
byte[] encData_byte = new byte[line.Length];
encData_byte = System.Text.Encoding.UTF8.GetBytes(line);
string encodedData = Convert.ToBase64String(encData_byte);
file.WriteLine(encodedData);
}
encryptedLines.Add(EncryptionUtils.EncryptString(line));
}
ptname = "";
ptbenutzer = "";
ptpasswd = "";
File.WriteAllLines(filePath, encryptedLines);
this.Close();
}catch(IOException i){
//using (var file = new StreamWriter(filePath))
//{
// foreach (string line in lines)
// {
// byte[] encData_byte = new byte[line.Length];
// encData_byte = System.Text.Encoding.UTF8.GetBytes(line);
// string encodedData = Convert.ToBase64String(encData_byte);
// file.WriteLine(encodedData);
// }
//}
Close();
}catch(IOException){
//Fehlermeldung
}
}
private void proxyAbbr_Click(object sender, RoutedEventArgs e)
{
this.Close();
Close();
}
}
}

View File

@@ -170,6 +170,7 @@
<Compile Include="Util\BootstrapTreeViewItem.cs" />
<Compile Include="Util\ConvertedDateTimes.cs" />
<Compile Include="Util\FormCollectionConstants.cs" />
<Compile Include="Util\GoalRating.cs" />
<Compile Include="Util\GoalTreeItem.cs" />
<Compile Include="Controllers\LoginController.cs" />
<Compile Include="Controllers\MainController.cs" />
@@ -590,7 +591,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

@@ -64,6 +64,7 @@
--danger: #dc3545;
--light: #f8f9fa;
--dark: #343a40;
--bewo-goal-rating: #0000ff;
--bewo-dev: #00cf7c;
--bewo-customers: #3b7799;
--bewo-service-records: #c80000;
@@ -1929,6 +1930,26 @@ pre code {
background-color: #b9bbbe;
}
.table-bewo-goal-rating,
.table-bewo-goal-rating > th,
.table-bewo-goal-rating > td {
background-color: #b8b8ff;
}
.table-bewo-goal-rating th,
.table-bewo-goal-rating td,
.table-bewo-goal-rating thead th,
.table-bewo-goal-rating tbody + tbody {
border-color: #7a7aff;
}
.table-hover .table-bewo-goal-rating:hover {
background-color: #9f9fff;
}
.table-hover .table-bewo-goal-rating:hover > td,
.table-hover .table-bewo-goal-rating:hover > th {
background-color: #9f9fff;
}
.table-bewo-dev,
.table-bewo-dev > th,
.table-bewo-dev > td {
@@ -2957,6 +2978,36 @@ fieldset:disabled a.btn {
box-shadow: 0 0 0 0.2rem rgba(82, 88, 93, 0.5);
}
.btn-bewo-goal-rating {
color: #fff;
background-color: #0000ff;
border-color: #0000ff;
}
.btn-bewo-goal-rating:hover {
color: #fff;
background-color: #0000d9;
border-color: #0000cc;
}
.btn-bewo-goal-rating:focus, .btn-bewo-goal-rating.focus {
color: #fff;
background-color: #0000d9;
border-color: #0000cc;
box-shadow: 0 0 0 0.2rem rgba(38, 38, 255, 0.5);
}
.btn-bewo-goal-rating.disabled, .btn-bewo-goal-rating:disabled {
color: #fff;
background-color: #0000ff;
border-color: #0000ff;
}
.btn-bewo-goal-rating:not(:disabled):not(.disabled):active, .btn-bewo-goal-rating:not(:disabled):not(.disabled).active, .show > .btn-bewo-goal-rating.dropdown-toggle {
color: #fff;
background-color: #0000cc;
border-color: #0000bf;
}
.btn-bewo-goal-rating:not(:disabled):not(.disabled):active:focus, .btn-bewo-goal-rating:not(:disabled):not(.disabled).active:focus, .show > .btn-bewo-goal-rating.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(38, 38, 255, 0.5);
}
.btn-bewo-dev {
color: #fff;
background-color: #00cf7c;
@@ -3517,6 +3568,31 @@ fieldset:disabled a.btn {
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
}
.btn-outline-bewo-goal-rating {
color: #0000ff;
border-color: #0000ff;
}
.btn-outline-bewo-goal-rating:hover {
color: #fff;
background-color: #0000ff;
border-color: #0000ff;
}
.btn-outline-bewo-goal-rating:focus, .btn-outline-bewo-goal-rating.focus {
box-shadow: 0 0 0 0.2rem rgba(0, 0, 255, 0.5);
}
.btn-outline-bewo-goal-rating.disabled, .btn-outline-bewo-goal-rating:disabled {
color: #0000ff;
background-color: transparent;
}
.btn-outline-bewo-goal-rating:not(:disabled):not(.disabled):active, .btn-outline-bewo-goal-rating:not(:disabled):not(.disabled).active, .show > .btn-outline-bewo-goal-rating.dropdown-toggle {
color: #fff;
background-color: #0000ff;
border-color: #0000ff;
}
.btn-outline-bewo-goal-rating:not(:disabled):not(.disabled):active:focus, .btn-outline-bewo-goal-rating:not(:disabled):not(.disabled).active:focus, .show > .btn-outline-bewo-goal-rating.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(0, 0, 255, 0.5);
}
.btn-outline-bewo-dev {
color: #00cf7c;
border-color: #00cf7c;
@@ -5692,6 +5768,19 @@ a.badge-dark:focus, a.badge-dark.focus {
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
}
.badge-bewo-goal-rating {
color: #fff;
background-color: #0000ff;
}
a.badge-bewo-goal-rating:hover, a.badge-bewo-goal-rating:focus {
color: #fff;
background-color: #0000cc;
}
a.badge-bewo-goal-rating:focus, a.badge-bewo-goal-rating.focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0, 0, 255, 0.5);
}
.badge-bewo-dev {
color: #fff;
background-color: #00cf7c;
@@ -5989,6 +6078,18 @@ a.badge-bewo-report:focus, a.badge-bewo-report.focus {
color: #040505;
}
.alert-bewo-goal-rating {
color: #000085;
background-color: #ccccff;
border-color: #b8b8ff;
}
.alert-bewo-goal-rating hr {
border-top-color: #9f9fff;
}
.alert-bewo-goal-rating .alert-link {
color: #000052;
}
.alert-bewo-dev {
color: #006c40;
background-color: #ccf5e5;
@@ -6490,6 +6591,20 @@ a.badge-bewo-report:focus, a.badge-bewo-report.focus {
border-color: #1b1e21;
}
.list-group-item-bewo-goal-rating {
color: #000085;
background-color: #b8b8ff;
}
.list-group-item-bewo-goal-rating.list-group-item-action:hover, .list-group-item-bewo-goal-rating.list-group-item-action:focus {
color: #000085;
background-color: #9f9fff;
}
.list-group-item-bewo-goal-rating.list-group-item-action.active {
color: #fff;
background-color: #000085;
border-color: #000085;
}
.list-group-item-bewo-dev {
color: #006c40;
background-color: #b8f2da;
@@ -7490,6 +7605,16 @@ button.bg-dark:focus {
background-color: #1d2124 !important;
}
.bg-bewo-goal-rating {
background-color: #0000ff !important;
}
a.bg-bewo-goal-rating:hover, a.bg-bewo-goal-rating:focus,
button.bg-bewo-goal-rating:hover,
button.bg-bewo-goal-rating:focus {
background-color: #0000cc !important;
}
.bg-bewo-dev {
background-color: #00cf7c !important;
}
@@ -7690,6 +7815,10 @@ button.bg-bewo-report:focus {
border-color: #343a40 !important;
}
.border-bewo-goal-rating {
border-color: #0000ff !important;
}
.border-bewo-dev {
border-color: #00cf7c !important;
}
@@ -11321,6 +11450,14 @@ a.text-dark:hover, a.text-dark:focus {
color: #121416 !important;
}
.text-bewo-goal-rating {
color: #0000ff !important;
}
a.text-bewo-goal-rating:hover, a.text-bewo-goal-rating:focus {
color: #0000b3 !important;
}
.text-bewo-dev {
color: #00cf7c !important;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
$theme-colors: ( "bewo-dev": #00cf7c, "primary": #FF5A00, "bewo-customers": #3b7799, "bewo-service-records": #c80000, "bewo-calendar": #04b4d0, "bewo-is-about-to-expire": #FF0000, "bewo-expires-in-three-months": #FF9400, "bewo-group-booking": #f9e79f, "bewo-customer-card-header": #AB4A07, "bewo-employee": #45993B, "bewo-resource": #04B4D0, "bewo-task-red": #993B3B, "bewo-report": #995E3B);
$theme-colors: ( "bewo-goal-rating": #0000ff,"bewo-dev": #00cf7c, "primary": #FF5A00, "bewo-customers": #3b7799, "bewo-service-records": #c80000, "bewo-calendar": #04b4d0, "bewo-is-about-to-expire": #FF0000, "bewo-expires-in-three-months": #FF9400, "bewo-group-booking": #f9e79f, "bewo-customer-card-header": #AB4A07, "bewo-employee": #45993B, "bewo-resource": #04B4D0, "bewo-task-red": #993B3B, "bewo-report": #995E3B);
.no-underline {
text-decoration: none !important

View File

@@ -237,6 +237,8 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedSupportConceptListObject = Model.SupportConceptListObjects.FirstOrDefault(f => f.CostBearer2SupportConceptOid == "-1") ?? Model.SupportConceptListObjects.First();
Model.CostBearer2SupportConceptOid = -1;
Model.HasAnyRatingTypes = OperationsService.GetAllRatingTypes().Any();
}
if(Model.CostBearer2SupportConceptOid != null)
@@ -256,6 +258,40 @@ namespace BeWoPlanerMobil.Controllers
return View(Model);
}
[Authorize]
public void LoadGoalRatings()
{
if(Model == null)
{
return;
}
var ratingTypes = OperationsService.GetAllRatingTypes().OrderBy(o => o.Position); ;
Model.GoalRatingTypes = ratingTypes.ToList();
}
[Authorize]
public string RateSelectedGoal(long? ratingTypeOid, long? goalOid)
{
if(Model == null || ratingTypeOid == null || goalOid == null)
{
return _LeerzeichenFuerGetMethoden;
}
if(!Model.IsInGroupBookingMode)
{
var rating = Model.GoalRatingTypes.FirstOrDefault(ratingType => ratingType.RatingTypeOid == ratingTypeOid);
var goal = Model.GetGoalByOid(goalOid.Value);
goal.RatingTypeOid = ratingTypeOid;
return SerializeObject(new GoalRating(rating?.DisplayName ?? string.Empty, goal.ValueListEntryOid ?? 0));
}
return null;
}
[HttpPost]
[Authorize]
@@ -279,68 +315,7 @@ namespace BeWoPlanerMobil.Controllers
return base.Logout();
}
[Authorize]
public string LoadGoalTreeItems()
{
if (!Model.CostBearer2SupportConceptOid.HasValue || Model.CostBearer2SupportConceptOid.Value > 0 || Model.SelectedSupportConcept == null)
{
return null;
}
var goals = Model.SelectedSupportConcept.Goals;
var missingParentElements = goals.Where(w => w.ParentOid.HasValue && !goals.Any(a => a.ValueListEntryOid.Equals(w.ParentOid))).Select(s => s.ParentOid).ToList();
_ParentGoals = new Dictionary<long, ValueListEntryDC>();
foreach (var oid in missingParentElements)
{
LoadMissingParents(oid.Value);
}
goals.AddRangeIfElementsNotIn(_ParentGoals.Values);
var ziele = goals.Where(w => _Zieltypen.Contains(w.Type)).OrderBy(s => s.TypeDescription).ToList();
var massnahmen = goals.Where(w => _Massnahmentypen.Contains(w.Type)).OrderBy(s => s.TypeDescription).ToList();
var parentItems = goals.Where(w => w.ValueListEntryOid.HasValue && goals.Any(a => a.ParentOid.HasValue && a.ParentOid.Equals(w.ValueListEntryOid))).ToList();
var goalTree = new List<BootstrapTreeViewItem>();
var goalTreeDic = new Dictionary<long, BootstrapTreeViewItem>();
foreach (var ziel in ziele.Where(ziel => ziel.ValueListEntryOid.HasValue))
{
var treeItem = new BootstrapTreeViewItem(ziel.TypeDescription, ziel.ParentOid, ziel.ValueListEntryOid.Value, parentItems.Contains(ziel));
goalTreeDic.Add(ziel.ValueListEntryOid.Value, treeItem);
if (ziel.ParentOid == null)
{
goalTree.Add(treeItem);
}
}
foreach (var zielMitEltern in goalTreeDic.Values.Where(zielMitEltern => zielMitEltern.ParentOid.HasValue))
{
goalTreeDic[zielMitEltern.ParentOid.Value].Nodes.Add(zielMitEltern);
}
foreach (var ziel in massnahmen.Where(z => z.ValueListEntryOid.HasValue))
{
var node = new BootstrapTreeViewItem(ziel.TypeDescription, ziel.ParentOid, ziel.ValueListEntryOid.Value, parentItems.Contains(ziel));
if (ziel.ParentOid != null && goalTreeDic.ContainsKey(ziel.ParentOid.Value))
{
node.ParentOid = goalTreeDic[ziel.ParentOid.Value].ParentOid;
goalTreeDic[ziel.ParentOid.Value].Nodes.Add(node);
}
}
return JsonConvert.SerializeObject(goalTree, Formatting.None, new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
});
}
// Wird beim Neuladen der Seite ausgeführt per Get-Aufruf
[Authorize]
public string LoadGoals()
{
@@ -360,6 +335,7 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedSupportConcept = supportConcept;
var selectedGoals = supportConcept.Goals;
var missingParents = selectedGoals.Where(w => w.ParentOid != null && false == selectedGoals.Any(a => a.ValueListEntryOid.Equals(w.ParentOid))).Select(s => s.ParentOid).ToList();
_ParentGoals = new Dictionary<long, ValueListEntryDC>();
@@ -368,20 +344,23 @@ namespace BeWoPlanerMobil.Controllers
LoadMissingParents(oid.Value);
}
var goalTree = BuildGoalTree(selectedGoals.Union(_ParentGoals.Values).ToList());
var allGoals = selectedGoals.Union(_ParentGoals.Values).ToList();
var goalTree = BuildGoalTree(allGoals);
return SerializeObject(goalTree);
}
private static List<GoalTreeItem> BuildGoalTree(IReadOnlyCollection<ValueListEntryDC> goals)
private List<GoalTreeItem> BuildGoalTree(IReadOnlyCollection<ValueListEntryDC> goals)
{
var ziele = goals.Where(w => _Zieltypen.Contains(w.Type)).OrderBy(s => s.DisplayName).ToList();
var massnahmen = goals.Where(w => _Massnahmentypen.Contains(w.Type)).OrderBy(s => s.DisplayName).ToList();
var goalTree = new List<GoalTreeItem>();
var goalTreeDic = new Dictionary<long, GoalTreeItem>();
var goalsWithRating = Model.SelectedServiceRecord?.Goals.Where(goal => goal.RatingTypeOid.HasValue).ToList() ?? new List<ValueListEntryDC>();
var ratingTypes = OperationsService.GetRatingTypesByOids(goalsWithRating.Where(goal => goal.RatingTypeOid.HasValue).Select(goal => goal.RatingTypeOid.Value).Distinct().ToList());
foreach(var ziel in ziele.Where(z => z.ValueListEntryOid.HasValue))
foreach (var ziel in ziele.Where(z => z.ValueListEntryOid.HasValue))
{
var treeItem = new GoalTreeItem { Children = new List<GoalTreeItem>(), Header = ziel.DisplayName, ParentOid = ziel.ParentOid, ValueListEntryOid = ziel.ValueListEntryOid };
@@ -400,7 +379,20 @@ namespace BeWoPlanerMobil.Controllers
foreach(var ziel in massnahmen)
{
var kind = new GoalTreeItem { Children = new List<GoalTreeItem>(), Header = ziel.DisplayName, IsLeaf = true, ValueListEntryOid = ziel.ValueListEntryOid };
var ratingName = Model.HasAnyRatingTypes ? "Bewerten" : string.Empty;
var goalWithRating = goalsWithRating.FirstOrDefault(g => g.ValueListEntryOid == ziel.ValueListEntryOid);
if(Model.HasAnyRatingTypes && Model.IsInEditingMode && goalWithRating != null && ratingTypes.Any())
{
var ratingType = ratingTypes.FirstOrDefault(rt => rt.RatingTypeOid == goalWithRating.RatingTypeOid);
if(ratingType != null)
{
ratingName = ratingType.DisplayName;
}
}
var kind = new GoalTreeItem { Children = new List<GoalTreeItem>(), Header = ziel.DisplayName, IsLeaf = true, ValueListEntryOid = ziel.ValueListEntryOid, RatingName = ratingName};
if(ziel.ParentOid != null && goalTreeDic.ContainsKey(ziel.ParentOid.Value))
{
@@ -417,6 +409,33 @@ namespace BeWoPlanerMobil.Controllers
}
}
/*
* var hasRatingTypes = Model.GoalRatingTypes.Any();
// TODO: Beim Editieren die Bewertungen laden!
if(hasRatingTypes && Model.IsInEditingMode && Model.SelectedServiceRecord != null)
{
var goalsWithRating = Model.SelectedServiceRecord.Goals.Where(goal => goal.RatingTypeOid.HasValue).ToList();
var ratingTypes = OperationsService.GetRatingTypesByOids(goalsWithRating.Where(goal => goal.RatingTypeOid.HasValue).Select(goal => goal.RatingTypeOid.Value).Distinct().ToList());
goalTree.DoForEach(treeItem =>
{
var goal = goalsWithRating.FirstOrDefault(g => g.ValueListEntryOid == treeItem.ValueListEntryOid);
if(goal != null)
{
var ratingType = ratingTypes.FirstOrDefault(rt => rt.RatingTypeOid == goal.RatingTypeOid);
if(ratingType != null)
{
treeItem.RatingName = ratingType.DisplayName;
}
}
});
}
*/
return goalTree;
}
@@ -1463,7 +1482,7 @@ namespace BeWoPlanerMobil.Controllers
LoadRecordsToModel();
LoadGoalTreeItems();
LoadGoalRatings();
return ResetEditingMode();
}
@@ -1473,7 +1492,6 @@ namespace BeWoPlanerMobil.Controllers
throw;
}
}
private void LoadServiceCategoriesToModel(long? cb2ScOid)

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BeWo.Service.ServiceImplementations;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;

View File

@@ -497,7 +497,7 @@ namespace BeWoPlanerMobil.Models
{
var start = SelectedServiceRecord?.Start;
if(start != null && !(start.Value.GetServiceRecordNoDateTimeDate().Equals(start)))
if(start != null && !start.Value.GetServiceRecordNoDateTimeDate().Equals(start))
{
return start.Value.ToString("HH:mm");
}
@@ -537,6 +537,15 @@ namespace BeWoPlanerMobil.Models
{
return ServiceRecords.FirstOrDefault(serviceRecord => serviceRecord.ServiceRecordOid.Equals(serviceRecordOid));
}
public List<RatingTypeDC> GoalRatingTypes { get; set; } = new List<RatingTypeDC>();
public ValueListEntryDC GetGoalByOid(long goalOid)
{
return SelectedSupportConcept != null ? SelectedSupportConcept.Goals.FirstOrDefault(goal => goal.ValueListEntryOid == goalOid) : null;
}
public bool HasAnyRatingTypes { get; set; }
}
public class CustomSelectListItem

View File

@@ -226,10 +226,26 @@ function calculateTimeWithDuration(timeInputValue, timeElement, startDate, durat
function resetCreateForm() {
$("#serviceRecordCreationForm").trigger("reset");
var test = $("#has-any-rating-types").val().toLowerCase() === "true";
if (test) {
$(".goal-rating-badge").text("Bewerten");
} else {
$(".goal-rating-badge").text("");
}
}
function resetSingleBookingForm() {
$("#singleBookingForm").trigger("reset");
var test = $("#has-any-rating-types").val().toLowerCase() === "true";
if (test) {
$(".goal-rating-badge").text("Bewerten");
} else {
$(".goal-rating-badge").text("");
}
}
function submitSingleBookingForm() {
@@ -443,6 +459,7 @@ function buildGoaldTreeBranch(goalItem) {
var goalOid = goalItem.ValueListEntryOid;
var goalHeader = goalItem.Header;
var isChecked = getSelectedGoalOids() !== null && isInArray(goalOid, getSelectedGoalOids()) ? "checked" : "";
var ratingName = goalItem.RatingName;
if(!goalItem.IsLeaf) {
treeHtml +=
@@ -459,10 +476,48 @@ function buildGoaldTreeBranch(goalItem) {
"</div>";
} else {
treeHtml +=
'<div class="custom-control custom-checkbox">' +
'<div class="custom-control custom-checkbox d-inline">' +
'<input type="checkbox" class="custom-control-input" id="' + goalOid + '" ' + isChecked + ' onchange="updateSelectedGoals()">' +
'<label class="custom-control-label" for="' + goalOid + '">' + goalHeader + "</label>" +
"</div>";
"</div><span id='goal-rating-" + goalOid + "' class='badge badge-bewo-goal-rating goal-rating-badge ml-1' onclick='showGoalRatingPopup(" + goalOid + ")'>" + ratingName + "</span>";
}
}
function showGoalRatingPopup(goalOid) {
try {
$("#goal-rating-popup").modal("show");
$("#goal-to-rate-oid").val(goalOid);
} catch (error) {
logError(error.message);
}
}
function hideGoalRatingPopup() {
try {
$("#goal-rating-popup").modal("hide");
} catch (error) {
logError(error.message);
}
}
function rateGoal(ratingTypeOid) {
try {
var url = getRateSelectedGoalUrl();
var goalOid = $("#goal-to-rate-oid").val();
$.get(url, { ratingTypeOid: ratingTypeOid, goalOid: goalOid }).done(
function (result) {
var obj = $.parseJSON(result);
$("#goal-rating-" + goalOid).text(obj.RatingName);
hideGoalRatingPopup();
$("#goal-to-rate-oid").val("");
}
);
} catch (error) {
logError(error.message);
}
}

View File

@@ -0,0 +1,14 @@
namespace BeWoPlanerMobil.Util
{
public class GoalRating
{
public string RatingName { get; }
public long GoalOid { get; }
public GoalRating(string ratingName, long goalOid)
{
RatingName = ratingName;
GoalOid = goalOid;
}
}
}

View File

@@ -5,11 +5,17 @@ namespace BeWoPlanerMobil.Util
public class GoalTreeItem
{
public string Header { get; set; }
public bool IsLeaf { get; set; }
public List<GoalTreeItem> Children { get; set; }
public long? ParentOid { get; set; }
public long? ValueListEntryOid { get; set; }
public long? TopmostParentOid { get; set; }
public string RatingName { get; set; } = "Bewerten";//string.Empty;
}
}

View File

@@ -295,6 +295,18 @@
function getGetSignatureImageUrl() {
return "@Url.Action("GetSignatureImage")";
}
function getRateSelectedGoalUrl() {
return "@Url.Action("RateSelectedGoal")";
}
function getSelectGoalToRateUrl() {
return "@Url.Action("SelectGoalOidToRate")";
}
function getResetSelectedGoalToRateUrl() {
return "@Url.Action("ResetSelectedGoalToRate")";
}
</script>
<div class="container mt-3" id="checkbox-container">
@@ -1442,3 +1454,31 @@
</div>
</div>
</div>
<!-- Bewertungspopup für Ziele -->
<div id="goal-rating-popup" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Bewertungsskala</h5>
<button class="close" type="button" data-dismiss="modal" onclick="hideGoalRatingPopup()">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
<ul class="list-group">
@foreach(var ratingType in Model.GoalRatingTypes)
{
<li class="list-group-item" id="grt-@ratingType.RatingTypeOid" onclick="rateGoal(@ratingType.RatingTypeOid)">@ratingType.DisplayName</li>
}
</ul>
<input type="hidden" id="goal-to-rate-oid" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="hideGoalRatingPopup()">Zurück</button>
</div>
</div>
</div>
</div>
<input type="hidden" id="has-any-rating-types" value="@Model?.HasAnyRatingTypes ?? False" />

View File

@@ -1168,5 +1168,9 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<FeiertagDC> GetDefaultFeiertageForYear(int year);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<RatingTypeDC> GetRatingTypesByOids(List<long> ratingTypeOids);
}
}

View File

@@ -7076,5 +7076,19 @@ namespace BeWo.Service.ServiceImplementations
DAOFactory.GenericDAO.Update(confirmationReceiptSignatures2Update);
DAOFactory.GenericDAO.Delete(confirmationReceiptSignatures2Delete);
}
public List<RatingTypeDC> GetRatingTypesByOids(List<long> ratingTypeOids)
{
try
{
var ratingTypes = DAOFactory.GenericDAO.LoadByIDs<RatingType>(ratingTypeOids);
return MapperFactory.RatingTypeDC_RatingType.MapToNewDCs(ratingTypes);
}
catch (Exception exception)
{
throw Utils.CreateBeWoFaultException(exception);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using DevExpress.Xpf.Grid;
using System.Windows;
using DevExpress.Xpf.Grid;
namespace BS.Shared.Extensions
{

View File

@@ -0,0 +1,23 @@
using System.Windows;
using System.Windows.Controls;
namespace BS.Shared.Extensions
{
public static class GridExtensions
{
public static void AddChild(this Grid grid, UIElement uiElement)
{
grid?.Children.Add(uiElement);
}
public static void RemoveChild(this Grid grid, UIElement uiElement)
{
grid?.Children.Remove(uiElement);
}
public static void ClearChildren(this Grid grid)
{
grid?.Children.Clear();
}
}
}

View File

@@ -289,6 +289,7 @@
<Compile Include="DataContracts\ServiceRecordHistoryDC.cs" />
<Compile Include="DataContracts\SupportPinDC.cs" />
<Compile Include="Extensions\EnumExtensions.cs" />
<Compile Include="Extensions\GridExtensions.cs" />
<Compile Include="Extensions\ICollectionExtensions.cs" />
<Compile Include="Extensions\IDictionaryTExtensions.cs" />
<Compile Include="Extensions\TimeIntervalExtensions.cs" />