diff --git a/src/PostIt/PostIt/Services/YavscApiClient.cs b/src/PostIt/PostIt/Services/YavscApiClient.cs
index 201a36fd..0a42773b 100644
--- a/src/PostIt/PostIt/Services/YavscApiClient.cs
+++ b/src/PostIt/PostIt/Services/YavscApiClient.cs
@@ -205,6 +205,16 @@ public class YavscApiClient : IAsyncDisposable
return dto!;
}
+ ///
+ /// Call a JSON endpoint with no request body while still allowing a
+ /// positional cancellation token argument.
+ ///
+ public Task CallAsync(
+ HttpMethod method,
+ string path,
+ CancellationToken ct)
+ => CallAsync(method, path, body: null, ct);
+
/// Call an endpoint that returns no useful body (DELETE, etc.).
public async Task CallAsync(
HttpMethod method,
@@ -216,6 +226,16 @@ public class YavscApiClient : IAsyncDisposable
response.EnsureSuccessStatusCode();
}
+ ///
+ /// Call an endpoint with no request body while still allowing a
+ /// positional cancellation token argument.
+ ///
+ public Task CallAsync(
+ HttpMethod method,
+ string path,
+ CancellationToken ct)
+ => CallAsync(method, path, body: null, ct);
+
private async Task SendAsync(
HttpMethod method, string path, object? body, CancellationToken ct)
{
diff --git a/src/Yavsc.Abstract/Workflow/QueryStatus.cs b/src/Yavsc.Abstract/Workflow/QueryStatus.cs
index e440ebbc..86104376 100644
--- a/src/Yavsc.Abstract/Workflow/QueryStatus.cs
+++ b/src/Yavsc.Abstract/Workflow/QueryStatus.cs
@@ -9,12 +9,9 @@ namespace Yavsc
public enum QueryStatus: int
{
Inserted,
- OwnerValidated,
- Visited,
Rejected,
Accepted,
InProgress,
-
// final states
Failed,
Success
diff --git a/src/Yavsc.Org/Controllers/Contracting/CommandFormsController.cs b/src/Yavsc.Org/Controllers/Contracting/CommandFormsController.cs
index b5d8ca24..f59666fc 100644
--- a/src/Yavsc.Org/Controllers/Contracting/CommandFormsController.cs
+++ b/src/Yavsc.Org/Controllers/Contracting/CommandFormsController.cs
@@ -1,19 +1,24 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Localization;
using Yavsc.Models;
using Yavsc.Models.Workflow;
using Yavsc.Server.Helpers;
+using Yavsc.Services;
namespace Yavsc.Controllers
{
public class CommandFormsController : Controller
{
private readonly ApplicationDbContext _context;
+ private readonly IStringLocalizer _localizer;
- public CommandFormsController(ApplicationDbContext context)
+ public CommandFormsController(ApplicationDbContext context,
+ IStringLocalizer localizer)
{
_context = context;
+ _localizer = localizer;
}
// GET: CommandForms
@@ -46,17 +51,14 @@ namespace Yavsc.Controllers
SetViewBag();
return View();
}
+
private void SetViewBag(CommandForm commandForm = null)
{
ViewBag.ActivityCode = new SelectList(_context.Activities, "Code", "Name", commandForm?.ActivityCode);
- ViewBag.ActionName = new SelectList(
- new[]{
- new SelectListItem { Value = "Create", Text = "Create" },
- new SelectListItem { Value = "Update", Text = "Update" },
- new SelectListItem { Value = "Delete", Text = "Delete" }
- });
-
+ ViewBag.ActionName = BillingService.Billing.Keys
+ .Select((string b) => new SelectListItem { Value = b, Text = _localizer[b] }).ToList();
}
+
// POST: CommandForms/Create
[HttpPost]
[ValidateAntiForgeryToken]
diff --git a/src/Yavsc.Org/Controllers/Contracting/FrontOfficeController.cs b/src/Yavsc.Org/Controllers/Contracting/FrontOfficeController.cs
index b234dfff..b86d0ab4 100644
--- a/src/Yavsc.Org/Controllers/Contracting/FrontOfficeController.cs
+++ b/src/Yavsc.Org/Controllers/Contracting/FrontOfficeController.cs
@@ -36,16 +36,16 @@ namespace Yavsc.Controllers
public ActionResult Index()
{
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
- var now = DateTime.Now;
+ var now = DateTime.UtcNow;
var model = new FrontOfficeIndexViewModel
{
- EstimateToProduceCount = _context.RdvQueries.Where(c => c.PerformerId == uid && c.EventDate > now
- && c.ValidationDate == null && !_context.Estimates.Any(e => (e.CommandId == c.Id && e.ProviderValidationDate != null))).Count(),
- EstimateToSignAsProCount = _context.RdvQueries.Where(c => (c.PerformerId == uid && c.EventDate > now
- && c.ValidationDate == null && _context.Estimates.Any(e => (e.CommandId == c.Id && e.ProviderValidationDate != null)))).Count(),
- EstimateToSignAsCliCount = _context.Estimates.Where(e => e.ClientId == uid && e.ClientValidationDate == null).Count(),
- BillToSignAsProCount = 0,
+ EstimateToProduceCount = _context.RdvQueries.Where(c => c.PerformerId == uid && c.EventDate > now && c.Status == QueryStatus.Inserted
+ && c.ValidationDate == null && !_context.Estimates.Any(e => e.CommandId == c.Id)).Count(),
+ EstimateToHonorAsProCount = _context.RdvQueries.Where(c => c.PerformerId == uid && c.EventDate > now && c.Status == QueryStatus.Accepted
+ && c.ValidationDate == null && _context.Estimates.Any(e => e.CommandId == c.Id )).Count(),
+ EstimateToSignAsCliCount = _context.Estimates.Where(e => e.ClientId == uid && e.Query.Status == QueryStatus.Accepted).Count(),
+
BillToSignAsCliCount = 0,
NewPayementsCount = 0
};
diff --git a/src/Yavsc.Org/Extensions/EnumExtensions.cs b/src/Yavsc.Org/Extensions/EnumExtensions.cs
index ae733f20..29fb0eee 100644
--- a/src/Yavsc.Org/Extensions/EnumExtensions.cs
+++ b/src/Yavsc.Org/Extensions/EnumExtensions.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Localization;
@@ -23,7 +20,7 @@ namespace Yavsc.Extensions
var typeInfo = type.GetTypeInfo();
var values = Enum.GetValues(type).Cast();
var items = new List();
-
+
foreach (var value in values)
{
items.Add(new SelectListItem {
diff --git a/src/Yavsc.Org/Views/FrontOffice/Index.cshtml b/src/Yavsc.Org/Views/FrontOffice/Index.cshtml
index e563532d..ed4c9038 100644
--- a/src/Yavsc.Org/Views/FrontOffice/Index.cshtml
+++ b/src/Yavsc.Org/Views/FrontOffice/Index.cshtml
@@ -13,7 +13,7 @@
EstimateToSignAsPro
- @Html.DisplayFor(m=>m.EstimateToSignAsProCount)
+ @Html.DisplayFor(m=>m.EstimateToHonorAsProCount)
EstimateToSignAsCli
@@ -21,11 +21,6 @@
@Html.DisplayFor(m=>m.EstimateToSignAsCliCount)
- BillToSignAsPro
-
- @Html.DisplayFor(m=>m.BillToSignAsProCount)
-
-
BillToSignAsCli
@Html.DisplayFor(m=>m.BillToSignAsCliCount)
diff --git a/src/Yavsc.Server/Helpers/WorkflowHelpers.cs b/src/Yavsc.Server/Helpers/WorkflowHelpers.cs
index 11dad810..8be68ea0 100644
--- a/src/Yavsc.Server/Helpers/WorkflowHelpers.cs
+++ b/src/Yavsc.Server/Helpers/WorkflowHelpers.cs
@@ -55,6 +55,7 @@ namespace Yavsc.Helpers
throw new InvalidOperationException($"Billing setup: code '{code}' already registered with different type");
}
BillingService.Billing.Add(code, getter);
+ BillingService.GlobalBillingMap.Add(typeName, code);
}
}
diff --git a/src/Yavsc.Server/ViewModels/FrontOffice/FrontOfficeIndexViewModel.cs b/src/Yavsc.Server/ViewModels/FrontOffice/FrontOfficeIndexViewModel.cs
index bd5225bf..b12e1f6b 100644
--- a/src/Yavsc.Server/ViewModels/FrontOffice/FrontOfficeIndexViewModel.cs
+++ b/src/Yavsc.Server/ViewModels/FrontOffice/FrontOfficeIndexViewModel.cs
@@ -3,11 +3,10 @@ namespace Yavsc.ViewModels.FrontOffice
public class FrontOfficeIndexViewModel
{
public int EstimateToProduceCount { get; set; }
- public int EstimateToSignAsProCount { get; set; }
+ public int EstimateToHonorAsProCount { get; set; }
public int EstimateToSignAsCliCount { get; set; }
- public int BillToSignAsProCount { get; set; }
public int BillToSignAsCliCount { get; set; }
public int NewPayementsCount { get; set; }
}
-}
\ No newline at end of file
+}