This commit is contained in:
Paul Schneider 2026-07-06 00:47:35 +01:00
commit 6ac264fa2c
8 changed files with 42 additions and 31 deletions

View file

@ -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<CommandFormsController> _localizer;
public CommandFormsController(ApplicationDbContext context)
public CommandFormsController(ApplicationDbContext context,
IStringLocalizer<CommandFormsController> 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]

View file

@ -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
};