Estimate validation polish + PDF/TeX generation in Yavsc.Api
- List removal: GetOngoingEstimatesAsProvider filters on ProviderValidationDate so a provider's signed estimate leaves their list; PostIt refreshes the list on navigation pop-back. - Title renames: "Devis en attente de signature fournisseur/client" on both the provider and client sides (HomePage, VM, tests). - Move the estimate/bill TeX+PDF generation flow from Yavsc.Org into Yavsc.Api (TeXHelpers, PdfGenerationViewModel, BillViewComponent, Bill/Estimate templates, _ViewImports). Program.cs wires AddControllersWithViews + SiteSettings; FrontOfficeApiController injects IRazorViewEngine (cast to IViewEngine) with optional deps and exposes estimate.tex/estimate.pdf endpoints keyed by query id. - PDF generation drives through the Estimate_pdf view (side-effect render) and compiles via the system lualatex, fed TeX on stdin (no intermediate .tex), PDF to the bills dir, aux artifacts cleaned so only the .pdf persists. Resolve the bills dir to an absolute path so lualatex's -output-directory and working directory agree regardless of the host cwd (fixes "I can't write on file estimate-1.log"). - PostIt: DownloadAsync on the client + GetEstimateTex/PdfAsync; Télécharger PDF/TeX buttons on the validation and command-detail pages via a StorageProvider save helper. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
70a123b840
commit
97d0584292
41 changed files with 1036 additions and 290 deletions
|
|
@ -8,6 +8,7 @@ namespace Yavsc.Models.Billing
|
|||
{
|
||||
using Models.Workflow;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Estimate : IEstimate
|
||||
{
|
||||
|
|
@ -78,14 +79,39 @@ namespace Yavsc.Models.Billing
|
|||
public DateTime ClientValidationDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// All signatures captured against this estimate, in
|
||||
/// capture order. Multiple versions per (Type, SignerId)
|
||||
/// are allowed; the controller reads the most recent
|
||||
/// when asked. See <see cref="Signature"/>.
|
||||
/// All signatures captured against this estimate, keyed by
|
||||
/// <see cref="SignatureType"/>. The persister upserts by
|
||||
/// (EstimateId, Type), so there is at most one row per type.
|
||||
/// This collection is the persisted shape and stays
|
||||
/// <c>[JsonIgnore]</c>: the wire payload exposes signatures
|
||||
/// only through the dedicated <see cref="SignaturePro"/> and
|
||||
/// <see cref="SignatureClient"/> projections, since an
|
||||
/// estimate has exactly these two signature slots and never
|
||||
/// more. See <see cref="Signature"/>.
|
||||
/// </summary>
|
||||
[InverseProperty(nameof(Signature.Estimate))]
|
||||
[JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Signature> Signatures { get; set; }
|
||||
= new List<Signature>();
|
||||
|
||||
/// <summary>
|
||||
/// The provider's signature on this estimate, or null when the
|
||||
/// provider has not signed. Projected from
|
||||
/// <see cref="Signatures"/>; not mapped (the table is
|
||||
/// <see cref="Signatures"/>).
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public Signature? SignaturePro
|
||||
=> Signatures?.FirstOrDefault(s => s.Type == SignatureType.Pro);
|
||||
|
||||
/// <summary>
|
||||
/// The client's signature on this estimate, or null when the
|
||||
/// client has not signed. Projected from
|
||||
/// <see cref="Signatures"/>; not mapped.
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public Signature? SignatureClient
|
||||
=> Signatures?.FirstOrDefault(s => s.Type == SignatureType.Client);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue