Skip to content

Commit 18a9047

Browse files
committed
Merge branch 'stable' of github.com:microting/eform-backendconfiguration-plugin into stable
2 parents e3a7aeb + 888ecb4 commit 18a9047

File tree

5 files changed

+69
-171
lines changed

5 files changed

+69
-171
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Controllers/TaskManagementController.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1818
SOFTWARE.
1919
*/
2020

21+
using Sentry;
22+
2123
namespace BackendConfiguration.Pn.Controllers;
2224

2325
using System;
@@ -133,6 +135,7 @@ public async Task GetWordReport([FromBody]TaskManagementRequestModel filtersMode
133135
}
134136
catch (Exception e)
135137
{
138+
SentrySdk.CaptureException(e);
136139
Response.ContentLength = e.Message.Length;
137140
Response.ContentType = "text/plain";
138141
Response.StatusCode = 400;
@@ -171,6 +174,7 @@ public async Task GetExcelReport([FromBody]TaskManagementRequestModel filtersMod
171174
}
172175
catch (Exception e)
173176
{
177+
SentrySdk.CaptureException(e);
174178
Response.ContentLength = e.Message.Length;
175179
Response.ContentType = "text/plain";
176180
Response.StatusCode = 400;

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationTaskManagementService/BackendConfigurationTaskManagementService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2828
using BackendConfiguration.Pn.Services.RebusService;
2929
using ImageMagick;
3030
using Rebus.Bus;
31+
using Sentry;
3132

3233
namespace BackendConfiguration.Pn.Services.BackendConfigurationTaskManagementService;
3334

@@ -180,6 +181,7 @@ public async Task<List<WorkorderCaseModel>> Index(TaskManagementRequestModel fil
180181
}
181182
catch (Exception e)
182183
{
184+
SentrySdk.CaptureException(e);
183185
Log.LogException(e.Message);
184186
Log.LogException(e.StackTrace);
185187
throw;
@@ -252,6 +254,7 @@ public async Task<OperationDataResult<WorkOrderCaseReadModel>> GetTaskById(int w
252254
}
253255
catch (Exception e)
254256
{
257+
SentrySdk.CaptureException(e);
255258
Log.LogException(e.Message);
256259
Log.LogException(e.StackTrace);
257260
return new OperationDataResult<WorkOrderCaseReadModel>(false,
@@ -286,6 +289,7 @@ public async Task<OperationDataResult<List<string>>> GetItemsEntityListByPropert
286289
}
287290
catch (Exception e)
288291
{
292+
SentrySdk.CaptureException(e);
289293
Log.LogException(e.Message);
290294
Log.LogException(e.StackTrace);
291295
return new OperationDataResult<List<string>>(false,
@@ -394,6 +398,7 @@ public async Task<OperationResult> DeleteTaskById(int workOrderCaseId)
394398
}
395399
catch (Exception e)
396400
{
401+
SentrySdk.CaptureException(e);
397402
Log.LogException(e.Message);
398403
Log.LogException(e.StackTrace);
399404
return new OperationResult(false,
@@ -636,6 +641,7 @@ await _bus.SendLocal(new WorkOrderCreated(
636641
}
637642
catch (Exception e)
638643
{
644+
SentrySdk.CaptureException(e);
639645
Log.LogException(e.Message);
640646
Log.LogException(e.StackTrace);
641647
return new OperationResult(false,

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/ExcelService/ExcelService.cs

Lines changed: 16 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ public async Task<Stream> GenerateWorkOrderCaseReport(TaskManagementFiltersModel
5454
.Select(x => x.Name)
5555
.FirstOrDefaultAsync().ConfigureAwait(false);
5656

57+
if (string.IsNullOrEmpty(propertyName))
58+
{
59+
propertyName = localizationService.GetString("All");
60+
}
61+
62+
if (string.IsNullOrEmpty(filtersModel.AreaName))
63+
{
64+
filtersModel.AreaName = localizationService.GetString("All");
65+
}
66+
67+
Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "results"));
68+
5769
var resultDocument = Path.Combine(Path.GetTempPath(), "results",
5870
$"{propertyName}_{filtersModel.AreaName}.xlsx");
5971

@@ -93,6 +105,7 @@ public async Task<Stream> GenerateWorkOrderCaseReport(TaskManagementFiltersModel
93105
}
94106
catch (Exception ex)
95107
{
108+
SentrySdk.CaptureException(ex);
96109
logger.LogError(ex.Message);
97110
throw;
98111
}
@@ -224,6 +237,7 @@ public async Task<OperationDataResult<Stream>> GenerateExcelDashboard(List<OldRe
224237
}
225238
catch (Exception e)
226239
{
240+
SentrySdk.CaptureException(e);
227241
logger.LogError(e.Message);
228242
return new OperationDataResult<Stream>(false,
229243
localizationService.GetString("ErrorWhileCreatingWordFile"));
@@ -436,141 +450,6 @@ public async Task<OperationDataResult<Stream>> GenerateExcelDashboard(List<Repor
436450
}
437451
}
438452
}
439-
440-
// var workbookPart = spreadsheetDocument.AddWorkbookPart();
441-
// workbookPart.Workbook = new Workbook();
442-
//
443-
// // Create Stylesheet for bold headers and date format
444-
// var stylesPart = workbookPart.AddNewPart<WorkbookStylesPart>();
445-
// stylesPart.Stylesheet = CreateStylesheet();
446-
// stylesPart.Stylesheet.Save();
447-
//
448-
// var sheets = workbookPart.Workbook.AppendChild(new Sheets());
449-
// var worksheetNames = new List<string>();
450-
// var duplicateNumber = 0;
451-
//
452-
// foreach (var eformModel in reportModel)
453-
// {
454-
// foreach (var reportEformGroupModel in eformModel.GroupEform)
455-
// {
456-
// if (eformModel.FromDate != null)
457-
// {
458-
// var sheetName = eformModel.GroupEform.Count > 1
459-
// ? $"{eformModel.GroupTagName} - {reportEformGroupModel.CheckListId}"
460-
// : $"{eformModel.GroupTagName}";
461-
//
462-
// sheetName = CreateSafeSheetName(sheetName);
463-
//
464-
// // Check for duplicate sheet names
465-
// if (worksheetNames.Contains(sheetName))
466-
// {
467-
// duplicateNumber++;
468-
// sheetName = $"({duplicateNumber}){sheetName}";
469-
// sheetName = sheetName.Substring(0, Math.Min(31, sheetName.Length));
470-
// }
471-
// else
472-
// {
473-
// worksheetNames.Add(sheetName);
474-
// }
475-
//
476-
// var worksheetPart = workbookPart.AddNewPart<WorksheetPart>();
477-
// worksheetPart.Worksheet = new Worksheet(new SheetData());
478-
// var sheetData = worksheetPart.Worksheet.GetFirstChild<SheetData>();
479-
//
480-
// var sheet = new Sheet
481-
// {
482-
// Id = workbookPart.GetIdOfPart(worksheetPart),
483-
// SheetId = (uint)(sheets.Count() + 1),
484-
// Name = sheetName
485-
// };
486-
// sheets.Append(sheet);
487-
//
488-
// // Create header row with bold formatting
489-
// var headerRow = new Row();
490-
// var headers = new List<Cell>
491-
// {
492-
// ConstructCell(localizationService.GetString("Id"), CellValues.String, 1),
493-
// ConstructCell(localizationService.GetString("Property"), CellValues.String, 1),
494-
// ConstructCell(localizationService.GetString("SubmittedDate"), CellValues.String, 1),
495-
// ConstructCell(localizationService.GetString("DoneBy"), CellValues.String, 1),
496-
// ConstructCell(localizationService.GetString("EmployeeNo"), CellValues.String, 1),
497-
// ConstructCell(localizationService.GetString("ItemName"), CellValues.String, 1)
498-
// };
499-
//
500-
// foreach (var itemHeader in reportEformGroupModel.ItemHeaders)
501-
// {
502-
// headers.Add(ConstructCell(itemHeader.Value, CellValues.String, 1));
503-
// }
504-
//
505-
// headerRow.Append(headers);
506-
// sheetData.AppendChild(headerRow);
507-
//
508-
// // Populate data rows
509-
// foreach (var dataModel in reportEformGroupModel.Items)
510-
// {
511-
// var dataRow = new Row();
512-
// dataRow.Append(
513-
// ConstructCell(dataModel.MicrotingSdkCaseId.ToString(), CellValues.String),
514-
// ConstructCell(dataModel.PropertyName, CellValues.String),
515-
// ConstructCell(dataModel.MicrotingSdkCaseDoneAt?.ToString("dd.MM.yyyy HH:mm:ss"),
516-
// CellValues.String),
517-
// ConstructCell(dataModel.DoneBy, CellValues.String),
518-
// ConstructCell(dataModel.EmployeeNo, CellValues.String),
519-
// ConstructCell(dataModel.ItemName, CellValues.String)
520-
// );
521-
//
522-
// foreach (var dataModelCaseField in dataModel.CaseFields)
523-
// {
524-
// var value = dataModelCaseField.Value switch
525-
// {
526-
// "checked" => "1",
527-
// "unchecked" => "0",
528-
// _ => dataModelCaseField.Value
529-
// };
530-
//
531-
// switch (dataModelCaseField.Key)
532-
// {
533-
// case "date":
534-
// if (DateTime.TryParse(value, out var dateValue))
535-
// {
536-
// dataRow.Append(ConstructCell(dateValue.ToString("dd.MM.yyyy"),
537-
// CellValues.String));
538-
// }
539-
// else
540-
// {
541-
// dataRow.Append(ConstructCell(value, CellValues.String));
542-
// }
543-
//
544-
// break;
545-
// case "number":
546-
// if (double.TryParse(value, out var numberValue))
547-
// {
548-
// dataRow.Append(ConstructCell(
549-
// numberValue.ToString(CultureInfo.InvariantCulture),
550-
// CellValues.Number));
551-
// }
552-
// else
553-
// {
554-
// dataRow.Append(ConstructCell(value, CellValues.String));
555-
// }
556-
//
557-
// break;
558-
// default:
559-
// dataRow.Append(ConstructCell(value, CellValues.String));
560-
// break;
561-
// }
562-
// }
563-
//
564-
// sheetData.AppendChild(dataRow);
565-
// }
566-
//
567-
// // Apply autofilter and table formatting
568-
// // ApplyTableFormatting(sheet, worksheetPart, sheetData);
569-
// }
570-
// }
571-
// }
572-
//
573-
// workbookPart.Workbook.Save();
574453
}
575454
ValidateExcel(filePath);
576455

@@ -579,6 +458,7 @@ public async Task<OperationDataResult<Stream>> GenerateExcelDashboard(List<Repor
579458
}
580459
catch (Exception e)
581460
{
461+
SentrySdk.CaptureException(e);
582462
logger.LogError(e.Message);
583463
return new OperationDataResult<Stream>(false,
584464
localizationService.GetString("ErrorWhileCreatingExcelFile"));
@@ -884,6 +764,7 @@ public Task<Stream> GenerateTaskTracker(List<TaskTrackerModel> model)
884764
}
885765
catch (Exception ex)
886766
{
767+
SentrySdk.CaptureException(ex);
887768
logger.LogError(ex.Message);
888769
throw;
889770
}

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/statistics-container/statistics-container.component.html

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,41 @@
1414
[clearable]="true"
1515
/>
1616
</mat-form-field>
17-
<div class="d-flex flex-row flex-wrap mb-2 top-stats">
18-
<app-planned-task-days
19-
[plannedTaskDaysModel]="plannedTaskDays"
20-
[selectedPropertyName]="propertyName"
21-
[view]="viewTopLine"
22-
(clickOnDiagram)="clickOnPlannedTaskDays()"
23-
class="ml-2"
24-
/>
25-
<app-ad-hoc-task-priorities
26-
[adHocTaskPrioritiesModel]="adHocTaskPrioritiesModel"
27-
[selectedPropertyName]="propertyName"
28-
[view]="viewTopLine"
29-
(clickOnDiagram)="clickOnAdHocTaskPriorities($event)"
30-
class="ml-2"
31-
/>
32-
<app-document-updated-days
33-
[documentUpdatedDaysModel]="documentUpdatedDaysModel"
34-
[selectedPropertyName]="propertyName"
35-
[view]="viewTopLine"
36-
(clickOnDiagram)="clickOnDocumentUpdatedDays($event)"
37-
class="ml-2"
38-
/>
17+
<div class="d-flex flex-row flex-wrap top-stats">
18+
<div class="d-flex flex-row flex-wrap row-container">
19+
<app-planned-task-days
20+
[plannedTaskDaysModel]="plannedTaskDays"
21+
[selectedPropertyName]="propertyName"
22+
[view]="viewTopLine"
23+
(clickOnDiagram)="clickOnPlannedTaskDays()"
24+
class="half-width"
25+
/>
26+
<app-ad-hoc-task-workers
27+
[adHocTaskWorkers]="adHocTaskWorkers"
28+
[selectedPropertyName]="propertyName"
29+
[view]="viewBottomLine"
30+
(clickOnDiagram)="clickOnAdHocTaskWorkers($event)"
31+
class="half-width"
32+
/>
33+
</div>
3934
</div>
4035
<div class="d-flex flex-row flex-wrap bottom-stats">
41-
<app-planned-task-workers
42-
[plannedTaskWorkers]="plannedTaskWorkers"
43-
[selectedPropertyName]="propertyName"
44-
[view]="viewBottomLine"
45-
(clickOnDiagram)="clickOnPlannedTaskWorkers($event)"
46-
class="ml-2"
47-
/>
48-
<app-ad-hoc-task-workers
49-
[adHocTaskWorkers]="adHocTaskWorkers"
50-
[selectedPropertyName]="propertyName"
51-
[view]="viewBottomLine"
52-
(clickOnDiagram)="clickOnAdHocTaskWorkers($event)"
53-
class="ml-2"
54-
/>
36+
<div class="d-flex flex-row flex-wrap row-container">
37+
<app-planned-task-workers
38+
[plannedTaskWorkers]="plannedTaskWorkers"
39+
[selectedPropertyName]="propertyName"
40+
[view]="viewBottomLine"
41+
(clickOnDiagram)="clickOnPlannedTaskWorkers($event)"
42+
class="half-width"
43+
/>
44+
<app-ad-hoc-task-priorities
45+
[adHocTaskPrioritiesModel]="adHocTaskPrioritiesModel"
46+
[selectedPropertyName]="propertyName"
47+
[view]="viewTopLine"
48+
(clickOnDiagram)="clickOnAdHocTaskPriorities($event)"
49+
class="half-width"
50+
/>
51+
</div>
5552
</div>
5653
</mat-card-content>
5754
</mat-card>

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/statistics-container/statistics-container.component.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,13 @@ mat-card-content.d-flex.flex-column {
1717
}
1818
}
1919
}
20+
21+
.row-container {
22+
width: 100%;
23+
}
24+
25+
.half-width {
26+
flex: 1 1 45%;
27+
box-sizing: border-box;
28+
padding: 10px;
29+
}

0 commit comments

Comments
 (0)