diff --git a/Yavsc.Abstract/Billing/IBillable.cs b/Yavsc.Abstract/Billing/IBillable.cs index 41a9ba11..cba89d56 100644 --- a/Yavsc.Abstract/Billing/IBillable.cs +++ b/Yavsc.Abstract/Billing/IBillable.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace Yavsc.Billing { public interface IBillable { - string Description { get; set; } + string GetDescription (); List GetBillItems(); long Id { get; set; } diff --git a/Yavsc/Models/Billing/NominativeServiceCommand.cs b/Yavsc/Models/Billing/NominativeServiceCommand.cs index 315e4671..1dfbd755 100644 --- a/Yavsc/Models/Billing/NominativeServiceCommand.cs +++ b/Yavsc/Models/Billing/NominativeServiceCommand.cs @@ -14,8 +14,10 @@ namespace Yavsc.Models.Billing public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery, IIdentified { + public string GetInvoiceId() { return GetType().Name + "/" + Id; } + public abstract long Id { get; set; } - public abstract string Description { get; set; } + public abstract string GetDescription (); [Required()] public bool Consent { get; set; } diff --git a/Yavsc/Models/HairCut/HairCutQuery.cs b/Yavsc/Models/HairCut/HairCutQuery.cs index c58ffeac..8022745e 100644 --- a/Yavsc/Models/HairCut/HairCutQuery.cs +++ b/Yavsc/Models/HairCut/HairCutQuery.cs @@ -13,13 +13,13 @@ namespace Yavsc.Models.Haircut { // Bill description - public override string Description + public override string GetDescription() { - get; - - set; + var type = Startup.GlobalLocalizer[this.GetType().Name]; + var gender = Startup.GlobalLocalizer[this.Prestation.Gender.ToString()]; + return $"{type} ({gender})"; } - = "Prestation en coiffure à domicile"; + [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] override public long Id { get; set; } diff --git a/Yavsc/Models/HairCut/HairMultiCutQuery.cs b/Yavsc/Models/HairCut/HairMultiCutQuery.cs index b60118e6..544fd5bb 100644 --- a/Yavsc/Models/HairCut/HairMultiCutQuery.cs +++ b/Yavsc/Models/HairCut/HairMultiCutQuery.cs @@ -24,13 +24,11 @@ namespace Yavsc.Models.Haircut public class HairMultiCutQuery : NominativeServiceCommand { - // Bill description - public override string Description + // Bill description + public override string GetDescription() { - get; - - set; - } = "Prestation en coiffure à domicile [commande groupée]"; + return "Prestation en coiffure à domicile [commande groupée]"; + } [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] override public long Id { get; set; } diff --git a/Yavsc/Models/Workflow/RdvQuery.cs b/Yavsc/Models/Workflow/RdvQuery.cs index 4a35e20c..6e7d62e8 100644 --- a/Yavsc/Models/Workflow/RdvQuery.cs +++ b/Yavsc/Models/Workflow/RdvQuery.cs @@ -42,12 +42,10 @@ namespace Yavsc.Models.Workflow [Display(Name="GiveAnExplicitReason")] public string Reason { get; set; } - public override string Description + public override string GetDescription () { - get; - - set; - } = "Rendez-vous"; + return "Rendez-vous"; + } public RdvQuery() { diff --git a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx index db929b58..52ffe2d6 100644 --- a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx +++ b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx @@ -243,7 +243,7 @@ Erreur Google : {0} Identifiant d'enregistrement Google mi-long - Demande de préstation en coiffure à domicile + Demande de préstation en coiffure à domicile Cacher le texte source de l'article Accueil Cacher diff --git a/Yavsc/Settings/PayPalSettings.cs b/Yavsc/Settings/PayPalSettings.cs index b4cae1b7..1cca05af 100644 --- a/Yavsc/Settings/PayPalSettings.cs +++ b/Yavsc/Settings/PayPalSettings.cs @@ -10,17 +10,17 @@ namespace Yavsc /// public string Mode { get; set; } /// - /// + /// Client Id using the REST API /// public string ClientId { get; set; } /// - /// For sandbox only? + /// Client Secret using the REST API /// /// public string ClientSecret { get; set; } /// - /// Your application id ... + /// Application Id using the REST API /// /// public string ApplicationId { get; set; } diff --git a/Yavsc/Settings/SiteSettings.cs b/Yavsc/Settings/SiteSettings.cs index 98b4ebc8..32898c48 100644 --- a/Yavsc/Settings/SiteSettings.cs +++ b/Yavsc/Settings/SiteSettings.cs @@ -38,6 +38,8 @@ namespace Yavsc public string Street { get; set; } public string PostalCode { get; set; } public string CountryCode { get; set; } + + public string HomeViewName { get; set; } /// /// Specifies the directory where should be /// generated pdf files using pandoc diff --git a/Yavsc/Startup/Startup.cs b/Yavsc/Startup/Startup.cs index 09650e1b..bb5c7fc7 100755 --- a/Yavsc/Startup/Startup.cs +++ b/Yavsc/Startup/Startup.cs @@ -27,6 +27,7 @@ namespace Yavsc { using System.Net; using Formatters; + using Microsoft.Extensions.Localization; using Models; using PayPal.Manager; using Services; @@ -38,6 +39,7 @@ namespace Yavsc public static string AvatarsDirName { private set; get; } public static string Authority { get; private set; } public static string Temp { get; set; } + public static string HomeViewName { get; set; } = "Home"; public static SiteSettings SiteSetup { get; private set; } public static PayPalSettings PayPalSettings { get; private set; } @@ -233,7 +235,7 @@ namespace Yavsc }); } - + public static IStringLocalizer GlobalLocalizer { get; private set; } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IOptions siteSettings, @@ -242,8 +244,10 @@ namespace Yavsc RoleManager roleManager, IAuthorizationService authorizationService, IOptions payPalSettings, + IStringLocalizer localizer, ILoggerFactory loggerFactory) { + GlobalLocalizer = localizer; SiteSetup = siteSettings.Value; Authority = siteSettings.Value.Authority; Startup.UserFilesDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Blog).FullName; diff --git a/Yavsc/wwwroot/js/google-geoloc.min.js b/Yavsc/wwwroot/js/google-geoloc.min.js index f2fc1b6e..6b8b8a90 100644 --- a/Yavsc/wwwroot/js/google-geoloc.min.js +++ b/Yavsc/wwwroot/js/google-geoloc.min.js @@ -1 +1 @@ -+function(t,e){t.widget("psc.googlegeocode",{options:{mapId:"map",longId:"Longitude",latId:"Latitude",addrValidationId:"AddressError",formValidId:"ValidationSummary",locComboId:"LocationCombo"},marker:null,gmap:null,_create:function(){this.element.addClass("googlegeocode"),this.gmap=new e.Map(document.getElementById(this.options.mapId),{zoom:16,center:{lat:48.862854,lng:2.2056466}});var o=this;this.element.rules("add",{remote:{url:"https://maps.googleapis.com/maps/api/geocode/json",type:"get",data:{sensor:!1,address:function(){return o.element.val()}},dataType:"json",dataFilter:function(e){t("#"+o.options.locComboId).html("");var a=JSON.parse(e);return a.results.forEach(function(e){e.formatted_address!==o.element.val()&&t("
  • "+e.formatted_address+"
  • ").data("geoloc",e).click(function(){o.chooseLoc("user",e)}).css("cursor","pointer").appendTo(t("#"+o.options.locComboId))}),"OK"===a.status&&1==a.results.length?!0:!1},error:function(){return!1}}})},chooseLoc:function(o,a){"user"===o&&this.element.val(a.formatted_address);var n=a.geometry.location,s=new Number(n.lat),i=new Number(n.lng);return t(document.getElementById(this.options.latId)).val(s.toLocaleString("en")),t(document.getElementById(this.options.longId)).val(i.toLocaleString("en")),this.gmap.setCenter(n),this.marker&&this.marker.setMap(null),this.marker=new e.Marker({map:this.gmap,draggable:!0,animation:e.Animation.DROP,position:n}),e.event.addListener(this.marker,"dragend",function(){var e=this.marker.getPosition();t("#"+this.options.latId).val(e.lat),t("#"+this.options.longId).val(e.lng)}),this.element.valid(),t("#"+this.options.addrValidationId).empty(),t("#"+this.options.formValidId).empty(),t("#"+this.options.locComboId).empty(),this}})}(jQuery,google.maps); \ No newline at end of file +if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t,e){t.widget("psc.googlegeocode",{options:{mapId:"map",longId:"Longitude",latId:"Latitude",addrValidationId:"AddressError",formValidId:"ValidationSummary",locComboId:"LocationCombo"},marker:null,gmap:null,_create:function(){this.element.addClass("googlegeocode"),this.gmap=new e.Map(document.getElementById(this.options.mapId),{zoom:16,center:{lat:48.862854,lng:2.2056466}});var o=this;this.element.rules("add",{remote:{url:"https://maps.googleapis.com/maps/api/geocode/json",type:"get",data:{sensor:!1,address:function(){return o.element.val()}},dataType:"json",dataFilter:function(e){t("#"+o.options.locComboId).html("");var a=JSON.parse(e);return a.results.forEach(function(e){e.formatted_address!==o.element.val()&&t("
  • "+e.formatted_address+"
  • ").data("geoloc",e).click(function(){o.chooseLoc("user",e)}).css("cursor","pointer").appendTo(t("#"+o.options.locComboId))}),"OK"===a.status&&1==a.results.length?!0:!1},error:function(){return!1}}})},chooseLoc:function(o,a){"user"===o&&this.element.val(a.formatted_address);var n=a.geometry.location,r=new Number(n.lat),i=new Number(n.lng);return t(document.getElementById(this.options.latId)).val(r.toLocaleString("en")),t(document.getElementById(this.options.longId)).val(i.toLocaleString("en")),this.gmap.setCenter(n),this.marker&&this.marker.setMap(null),this.marker=new e.Marker({map:this.gmap,draggable:!0,animation:e.Animation.DROP,position:n}),e.event.addListener(this.marker,"dragend",function(){var e=this.marker.getPosition();t("#"+this.options.latId).val(e.lat),t("#"+this.options.longId).val(e.lng)}),this.element.valid(),t("#"+this.options.addrValidationId).empty(),t("#"+this.options.formValidId).empty(),t("#"+this.options.locComboId).empty(),this}})}(jQuery,google.maps); \ No newline at end of file