signing estimate

This commit is contained in:
2017-02-22 22:58:02 +01:00
parent f0a94ef3d8
commit 11f9714b65
8 changed files with 69 additions and 54 deletions

View File

@ -1,19 +1,22 @@
namespace Yavsc.Interfaces.Workflow {
public interface IEvent {
/// <summary>
/// <c>/topic/(bookquery|estimate)</c>
/// </summary>
/// <returns></returns>
string Topic { get; set ; }
/// <summary>
/// Should be the user's name
/// </summary>
/// <returns></returns>
string Sender { get; set ; }
/// <summary>
/// The message
/// </summary>
/// <returns></returns>
string Message { get; set; }
}
public interface IEvent {
/// <summary>
/// <c>/topic/(bookquery|estimate)</c>
/// </summary>
/// <returns></returns>
string Topic { get; set ; }
/// <summary>
/// Should be the user's name
/// </summary>
/// <returns></returns>
string Sender { get; set ; }
/// <summary>
/// The message
/// </summary>
/// <returns></returns>
string Message { get; set; }
} }

View File

@ -16,6 +16,8 @@ namespace Yavsc.Models.Billing
public string Description { get; set; } public string Description { get; set; }
public BaseProduct Article { get; set; } public BaseProduct Article { get; set; }
public int Count { get; set; } public int Count { get; set; }
[DisplayFormat(DataFormatString="{0:C}")]
public decimal UnitaryCost { get; set; } public decimal UnitaryCost { get; set; }
public long EstimateId { get; set; } public long EstimateId { get; set; }

View File

@ -9,6 +9,7 @@ namespace Yavsc.Models.Billing
{ {
using Interfaces; using Interfaces;
using Models.Workflow; using Models.Workflow;
using Newtonsoft.Json;
public partial class Estimate : IEstimate public partial class Estimate : IEstimate
{ {
@ -22,7 +23,7 @@ namespace Yavsc.Models.Billing
/// it will result in a new estimate template /// it will result in a new estimate template
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[ForeignKey("CommandId")] [ForeignKey("CommandId"),JsonIgnore]
public BookQuery Query { get; set; } public BookQuery Query { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Title { get; set; } public string Title { get; set; }
@ -62,12 +63,12 @@ namespace Yavsc.Models.Billing
[Required] [Required]
public string OwnerId { get; set; } public string OwnerId { get; set; }
[ForeignKey("OwnerId")] [ForeignKey("OwnerId"),JsonIgnore]
public virtual PerformerProfile Owner { get; set; } public virtual PerformerProfile Owner { get; set; }
[Required] [Required]
public string ClientId { get; set; } public string ClientId { get; set; }
[ForeignKey("ClientId")] [ForeignKey("ClientId"),JsonIgnore]
public virtual ApplicationUser Client { get; set; } public virtual ApplicationUser Client { get; set; }
public string CommandType public string CommandType

View File

@ -1,7 +1,3 @@
namespace Yavsc.Models.Messaging
{
// //
// BookQueryEvent.cs // BookQueryEvent.cs
// //
@ -23,6 +19,12 @@ namespace Yavsc.Models.Messaging
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc.Models.Messaging
{
using Interfaces.Workflow;
public class BookQueryEvent: BookQueryProviderInfo, IEvent public class BookQueryEvent: BookQueryProviderInfo, IEvent
{ {
public BookQueryEvent() public BookQueryEvent()

View File

@ -1,16 +1,23 @@
using System.Linq; using System.Linq;
using Microsoft.Data.Entity;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Yavsc.Helpers;
using Yavsc.Models.Billing;
namespace Yavsc.Models.Messaging namespace Yavsc.Models.Messaging
{ {
using Interfaces.Workflow;
using Billing;
using Yavsc.Helpers;
using System;
public class EstimationEvent: IEvent public class EstimationEvent: IEvent
{ {
public EstimationEvent(ApplicationDbContext context, Estimate estimate, IStringLocalizer SR) public EstimationEvent(ApplicationDbContext context, Estimate estimate, IStringLocalizer SR)
{ {
Topic = "Estimation";
Estimation = estimate; Estimation = estimate;
var perfer = context.Performers.FirstOrDefault( var perfer = context.Performers.Include(
p=>p.Performer
).FirstOrDefault(
p => p.PerformerId == estimate.OwnerId p => p.PerformerId == estimate.OwnerId
); );
// Use estimate.OwnerId; // Use estimate.OwnerId;
@ -27,28 +34,19 @@ namespace Yavsc.Models.Messaging
ProviderClientInfo ProviderInfo { get; set; } ProviderClientInfo ProviderInfo { get; set; }
Estimate Estimation { get; set; } Estimate Estimation { get; set; }
private string subtopic = null; public string Topic
string IEvent.Topic
{
get
{
return "/topic/estimate"+subtopic!=null?"/"+subtopic:"";
}
set
{
subtopic = value;
}
}
string IEvent.Sender
{
get; set;
}
string IEvent.Message
{ {
get; set; get; set;
} }
public string Sender
{
get; set;
}
public string Message
{
get; set;
}
} }
} }

View File

@ -212,14 +212,13 @@
<data name="EstimateToProduce"><value>Demandes de Devis en souffrance</value></data> <data name="EstimateToProduce"><value>Demandes de Devis en souffrance</value></data>
<data name="EstimateToSignAsPro"><value>Devis à valider</value></data> <data name="EstimateToSignAsPro"><value>Devis à valider</value></data>
<data name="EstimateToSignAsCli"><value>Devis à accèpter ou refuser</value></data> <data name="EstimateToSignAsCli"><value>Devis à accèpter ou refuser</value></data>
<data name="EstimationMessageToClient"><value>{0} à validé et évalué votre demande, avec un devis à {1:C}</value></data>
<data name="EventDate"><value>Date de l'évennement</value></data> <data name="EventDate"><value>Date de l'évennement</value></data>
<data name="BillToSignAsPro"><value>Factures à produire</value></data> <data name="BillToSignAsPro"><value>Factures à produire</value></data>
<data name="BillToSignAsCli"><value>Factures à honnorer</value></data> <data name="BillToSignAsCli"><value>Factures à honnorer</value></data>
<data name="PayementsDone"><value>Paiements effectués</value></data> <data name="PayementsDone"><value>Paiements effectués</value></data>
<data name="EstimationMessageToClient"><value>{0} a validé un devis pour vous : {1}\nAu total : {2} €
Il attend maintenant votre signature.</value></data>
<data name="EstimateWanted"><value>Demande de devis</value></data> <data name="EstimateWanted"><value>Demande de devis</value></data>
<data name="Event date"><value>Date de l'évennement</value></data> <data name="Event date"><value>Date de l'évennement</value></data>
<data name="EventWebPage"><value>Page web de l'événement</value></data> <data name="EventWebPage"><value>Page web de l'événement</value></data>

View File

@ -12,10 +12,10 @@
<table class="table"> <table class="table">
<tr> <tr>
<th> <th>
@Html.DisplayNameFor(model => model.Description) @Html.DisplayNameFor(model => model.Title)
</th> </th>
<th> <th>
@Html.DisplayNameFor(model => model.Title) @Html.DisplayNameFor(model => model.Description)
</th> </th>
<th> <th>
@Html.DisplayNameFor(model => model.Query.Client) @Html.DisplayNameFor(model => model.Query.Client)
@ -23,6 +23,9 @@
<th> <th>
@SR["Performer"] @SR["Performer"]
</th> </th>
<th>
@Html.DisplayNameFor(model => model.ProviderValidationDate)
</th>
<th> <th>
@SR["Id"] @SR["Id"]
</th> </th>
@ -32,10 +35,10 @@
@foreach (var item in Model) { @foreach (var item in Model) {
<tr> <tr>
<td> <td>
@Html.DisplayFor(modelItem => item.Description) @Html.DisplayFor(modelItem => item.Title)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Title) @Html.DisplayFor(modelItem => item.Description)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Query.Client.UserName) @Html.DisplayFor(modelItem => item.Query.Client.UserName)
@ -43,6 +46,9 @@
<td> <td>
@Html.DisplayFor(modelItem => item.Query.PerformerProfile.Performer.UserName) @Html.DisplayFor(modelItem => item.Query.PerformerProfile.Performer.UserName)
</td> </td>
<td>
@Html.DisplayFor(modelItem => item.ProviderValidationDate)
</td>
<td> <td>
@Html.DisplayFor(modelItem => item.Id) @Html.DisplayFor(modelItem => item.Id)
</td> </td>

View File

@ -1,4 +1,5 @@
@model Estimate @model Estimate
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt> <dt>
@Html.DisplayNameFor(model => model.Title) @Html.DisplayNameFor(model => model.Title)
@ -23,5 +24,8 @@
} }
</dd> </dd>
</dl> </dl>
</div> <label>Signature fournisseur :
<img src="/api/pdfestimate/prosign/@Model.Id" alt="" style="height:100px; background-color: white;">
</label>
@await Component.InvokeAsync("Estimate",Model.Id) @await Component.InvokeAsync("Estimate",Model.Id)