FlatFeeDiscount

This commit is contained in:
2017-03-02 13:25:20 +01:00
parent d09189f830
commit a2319dd026
8 changed files with 39 additions and 27 deletions

View File

@ -116,7 +116,7 @@ namespace Yavsc.Controllers
} }
[AllowAnonymous,ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public ActionResult HairCut(string performerId, string activityCode) public ActionResult HairCut(string performerId, string activityCode)
{ {
HairPrestation pPrestation=null; HairPrestation pPrestation=null;
@ -136,11 +136,14 @@ namespace Yavsc.Controllers
|| pPrestation.Tech == HairTechnos.Mech ) ? "":"hidden"; || pPrestation.Tech == HairTechnos.Mech ) ? "":"hidden";
ViewBag.TechClass = ( pPrestation.Gender == HairCutGenders.Women ) ? "":"hidden"; ViewBag.TechClass = ( pPrestation.Gender == HairCutGenders.Women ) ? "":"hidden";
ViewData["PerfPrefs"] = _context.BrusherProfile.Single(p=>p.UserId == performerId); ViewData["PerfPrefs"] = _context.BrusherProfile.Single(p=>p.UserId == performerId);
var result = new HairCutView { var perfer = _context.Performers.Include(
HairBrusher = _context.Performers.Include(
p=>p.Performer p=>p.Performer
).Single(p=>p.PerformerId == performerId), ).Single(p=>p.PerformerId == performerId);
Topic = pPrestation var result = new HairCutQuery {
PerformerProfile = perfer,
PerformerId = perfer.PerformerId,
ClientId = User.GetUserId(),
Prestation = pPrestation
}; };
return View(result); return View(result);
} }

View File

@ -132,5 +132,8 @@ namespace Yavsc.Models.Haircut
public decimal CarePrice { get; set; } public decimal CarePrice { get; set; }
[Display(Name="Remise au forfait coupe+technique"),DisplayFormat(DataFormatString="{0:C}")]
public decimal FlatFeeDiscount { get; set; }
} }
} }

View File

@ -11,7 +11,14 @@ namespace Yavsc.Models.Haircut
{ {
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; } public long Id { get; set; }
HairPrestation Prestation { get; set; }
[Required]
public long PrestationId { get; set; }
[ForeignKey("PrestationId")]
public virtual HairPrestation Prestation { get; set; }
[Required]
public Location Location { get; set; } public Location Location { get; set; }

View File

@ -1,12 +0,0 @@
using Yavsc.Models.Haircut;
using Yavsc.Models.Workflow;
namespace Yavsc.ViewModels.Haircut
{
public class HairCutView
{
public PerformerProfile HairBrusher { get; set; }
public HairPrestation Topic { get; set; }
}
}

View File

@ -261,13 +261,21 @@
<span asp-validation-for="ShortFoldingPrice" class="text-danger" /> <span asp-validation-for="ShortFoldingPrice" class="text-danger" />
</div> </div>
</div> </div>
<div class="form-group">
<label asp-for="FlatFeeDiscount" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="FlatFeeDiscount" class="form-control" />
<span asp-validation-for="FlatFeeDiscount" class="text-danger" />
</div>
</div>
model.ShortFoldingPrice
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" /> <input type="submit" value="Save" class="btn btn-default" />
</div> </div>
</div> </div>
</fieldset> </fieldset>
</div> </div>
</form> </form>

View File

@ -36,9 +36,7 @@
</dl> </dl>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>Tarifs hors coiffure ou coupe</legend> <legend>Tarifs divers</legend>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt> <dt>
@Html.DisplayNameFor(model => model.ShampooPrice) @Html.DisplayNameFor(model => model.ShampooPrice)
@ -53,7 +51,12 @@
<dd> <dd>
@Html.DisplayFor(model => model.CarePrice) @Html.DisplayFor(model => model.CarePrice)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.FlatFeeDiscount)
</dt>
<dd>
@Html.DisplayFor(model => model.FlatFeeDiscount)
</dd>
</dl> </dl>
</fieldset> </fieldset>

View File

@ -1,4 +1,4 @@
@model HairCutView @model HairCutQuery
@{ ViewData["Title"] = $"{ViewBag.Activity.Name}: Votre commande"; } @{ ViewData["Title"] = $"{ViewBag.Activity.Name}: Votre commande"; }
@await Html.PartialAsync("BrusherProfileScript",ViewData["PerfPrefs"]) @await Html.PartialAsync("BrusherProfileScript",ViewData["PerfPrefs"])
@section scripts { @section scripts {
@ -124,7 +124,7 @@
<h2>@ViewData["Title"]</h2> <h2>@ViewData["Title"]</h2>
@Html.DisplayFor(m=>m.HairBrusher) @Html.DisplayFor(m=>m.PerformerProfile)
<form asp-controller="HairCutCommand" asp-action="HairCut"> <form asp-controller="HairCutCommand" asp-action="HairCut">
<div class="form-horizontal"> <div class="form-horizontal">

View File

@ -31,7 +31,7 @@
@if (act.Children.Count>0) { @if (act.Children.Count>0) {
<p><em>@act.Name</em><br/> <p><em>@act.Name</em><br/>
@act.Description </p> @act.Description </p>
<a asp-route-id="@act.Code"> <a asp-route-id="@act.Code" class="btn btn-default">
@foreach (Activity c in act.Children) { @foreach (Activity c in act.Children) {
@if (!c.Hidden) { @Html.DisplayFor(subact=>c) } @if (!c.Hidden) { @Html.DisplayFor(subact=>c) }
} }