Gestion des activités
This commit is contained in:
parent
2644ac2d60
commit
50f7f1813c
22 changed files with 91 additions and 63 deletions
|
|
@ -13,11 +13,17 @@ namespace Yavsc.ApiControllers
|
|||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.Models.Messaging;
|
||||
|
||||
[Route("api/pdfestimate"), Authorize]
|
||||
public class PdfEstimateController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
private IStringLocalizer _localizer;
|
||||
private GoogleAuthSettings _googleSettings;
|
||||
private IGoogleCloudMessageSender _GCMSender;
|
||||
private IAuthorizationService authorizationService;
|
||||
|
||||
private ILogger logger;
|
||||
|
|
@ -94,7 +100,11 @@ namespace Yavsc.ApiControllers
|
|||
User.ReceiveSignature(id,Request.Form.Files[0],"pro");
|
||||
estimate.ProviderValidationDate = DateTime.Now;
|
||||
dbContext.SaveChanges();
|
||||
return Ok (new { ProviderValidationDate = estimate.ProviderValidationDate });
|
||||
// Notify the client
|
||||
var yaev = new EstimationEvent(dbContext,estimate,_localizer);
|
||||
var regids = estimate.Client.Devices.Select(d => d.GCMRegistrationId);
|
||||
var grep = await _GCMSender.NotifyEstimateAsync(_googleSettings,regids,yaev);
|
||||
return Ok (new { ProviderValidationDate = estimate.ProviderValidationDate, GCMSent = grep.success });
|
||||
}
|
||||
|
||||
[HttpPost("clisign/{id}")]
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@ using Microsoft.AspNet.Mvc;
|
|||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
using Models;
|
||||
using Models.Workflow;
|
||||
[Produces("application/json"),Route("api/profile")]
|
||||
public abstract class ProfileApiController<T> : Controller where T : PerformerProfile
|
||||
public abstract class ProfileApiController<T> : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
public ProfileApiController(ApplicationDbContext context)
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ namespace Yavsc.Controllers
|
|||
if (pro.Performer.Devices.Count > 0) {
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
var sregids = string.Join(",",regids);
|
||||
grep = await _GCMSender.NotifyBookQueryAsync(_googleSettings,regids,yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ namespace Yavsc.Controllers
|
|||
_context = context;
|
||||
}
|
||||
|
||||
// GET: Do
|
||||
[HttpGet,ActionName("Index")]
|
||||
// GET: /Do/Index
|
||||
[HttpGet]
|
||||
public IActionResult Index(string id)
|
||||
{
|
||||
if (id == null)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ using System;
|
|||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[ServiceFilter(typeof(LanguageActionFilter)),
|
||||
Route("do")]
|
||||
public class FrontOfficeController : Controller
|
||||
{
|
||||
ApplicationDbContext _context;
|
||||
|
|
@ -42,17 +40,11 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
throw new NotImplementedException("No Activity code");
|
||||
}
|
||||
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(
|
||||
a => a.Code == id);
|
||||
|
||||
return View(
|
||||
_context.Performers.Include(p => p.Performer)
|
||||
.Include(p=>p.Performer.Devices).Where
|
||||
(p => p.Activity.Any( a => a.DoesCode == id) && p.Active).OrderBy(
|
||||
x => x.MinDailyCost
|
||||
)
|
||||
);
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == id);
|
||||
var result = _context.Performers
|
||||
.Include(p=>p.Performer).Where(p => p.Activity.Any(u=>u.DoesCode==id)).OrderBy( x => x.MinDailyCost );
|
||||
|
||||
return View(result);
|
||||
}
|
||||
|
||||
[Route("Book/{id}"), HttpPost]
|
||||
|
|
|
|||
|
|
@ -110,11 +110,9 @@ namespace Yavsc.Controllers
|
|||
DiskUsage = user.DiskUsage,
|
||||
DiskQuota = user.DiskQuota
|
||||
};
|
||||
if (_dbContext.Performers.Any(x => x.PerformerId == user.Id))
|
||||
{
|
||||
model.Activity = _dbContext.Performers.First(x => x.PerformerId == user.Id).Activity;
|
||||
|
||||
}
|
||||
model.HaveProfessionalSettings = _dbContext.Performers.Any(x => x.PerformerId == user.Id);
|
||||
model.Activity = _dbContext.UserActivities.Include(a=>a.Does).Where(u=>u.UserId == user.Id)
|
||||
.ToList();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
|
@ -522,6 +520,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
|
||||
var exSiren = await _dbContext.ExceptionsSIREN.FirstOrDefaultAsync(
|
||||
ex => ex.SIREN == model.SIREN
|
||||
);
|
||||
|
|
@ -574,8 +573,8 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
else ModelState.AddModelError(string.Empty, $"Access denied ({uid} vs {model.PerformerId})");
|
||||
}
|
||||
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
ViewBag.Activities = _dbContext.ActivityItems(model.Activity);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,6 @@ namespace Yavsc.Helpers
|
|||
};
|
||||
return yaev;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ namespace Yavsc.Models
|
|||
builder.Entity<GoogleCloudMobileDeclaration>().Property(x=>x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
|
||||
builder.Entity<PostTag>().HasKey(x=>new { x.PostId, x.TagId});
|
||||
builder.Entity<ApplicationUser>().HasMany<Connection>( c=>c.Connections );
|
||||
builder.Entity<UserActivity>().HasKey(u=> new { u.DoesCode, u.UserId});
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ namespace Yavsc.Models.Billing
|
|||
{
|
||||
using Interfaces;
|
||||
using Models.Booking;
|
||||
using Yavsc.Models.Workflow;
|
||||
|
||||
public partial class Estimate : IEstimate
|
||||
{
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
|
@ -61,8 +63,13 @@ namespace Yavsc.Models.Billing
|
|||
[Required]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[ForeignKey("OwnerId")]
|
||||
public virtual PerformerProfile Owner { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ClientId { get; set; }
|
||||
[ForeignKey("ClientId")]
|
||||
public virtual ApplicationUser Client { get; set; }
|
||||
|
||||
public string CommandType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Yavsc.Models.Workflow;
|
|||
|
||||
namespace Yavsc.Models.Booking
|
||||
{
|
||||
public class DjPerformerProfile : PerformerProfile
|
||||
public class DjPerformerProfile : SpecializationSettings
|
||||
{
|
||||
public string SoundCloudId { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Yavsc.Models.Workflow
|
|||
public virtual ApplicationUser Performer { get; set; }
|
||||
|
||||
[InverseProperty("User")]
|
||||
[Display(Name="Activity"),Required]
|
||||
[Display(Name="Activity")]
|
||||
public virtual List<UserActivity> Activity { get; set; }
|
||||
|
||||
[Required,StringLength(14),Display(Name="SIREN"),
|
||||
|
|
|
|||
15
Yavsc/Models/Workflow/Specialization.cs
Normal file
15
Yavsc/Models/Workflow/Specialization.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Workflow
|
||||
{
|
||||
public abstract class SpecializationSettings
|
||||
{
|
||||
[Key]
|
||||
public long UserActivityId { get; set; }
|
||||
|
||||
[ForeignKey("UserActivityId")]
|
||||
public virtual UserActivity Context { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -299,6 +299,8 @@
|
|||
<data name="Profile edition"><value>Édition du profile</value></data>
|
||||
<data name="Product reference"><value>Référence produit</value></data>
|
||||
<data name="prestation"><value>prestation</value></data>
|
||||
<data name="Professional settings"><value>Paramètres professionels</value></data>
|
||||
|
||||
<data name="ProviderId"><value>Identifiant du fournisseur</value></data>
|
||||
<data name="ProviderName"><value>Nom du fournisseur</value></data>
|
||||
<data name="Rate"><value>Cote</value></data>
|
||||
|
|
@ -376,8 +378,8 @@
|
|||
<data name="YourNeed"><value>Votre besoin</value></data>
|
||||
<data name="yourquerytransmitted"><value>Votre demande a été transmise</value></data>
|
||||
<data name="YourSkills"><value>Vos talents, vos spécialités, le domaine de vos activités</value></data>
|
||||
<data name="YourPosts"><value>Vos publications</value></data>
|
||||
<data name="YourProfile"><value>Votre profile</value></data>
|
||||
<data name="Your posts"><value>Vos publications</value></data>
|
||||
<data name="Your profile"><value>Votre profile</value></data>
|
||||
<data name="YourMessageHasBeenSent"><value>Votre messge a été envoyé</value></data>
|
||||
<data name="Tell more, below, about your query"><value>Dites en plus, ci àprès, à propos de cet évennement</value></data>
|
||||
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ namespace Yavsc
|
|||
};
|
||||
var supportedUICultures = new[]
|
||||
{
|
||||
new CultureInfo("en"),
|
||||
new CultureInfo("fr")
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en")
|
||||
};
|
||||
|
||||
// You must explicitly state which cultures your application supports.
|
||||
|
|
@ -335,7 +335,7 @@ namespace Yavsc
|
|||
ConfigureFileServerApp(app, siteSettings.Value, env, authorizationService);
|
||||
ConfigureWebSocketsApp(app, siteSettings.Value, env);
|
||||
|
||||
app.UseRequestLocalization(localizationOptions.Value, (RequestCulture)new RequestCulture((string)"en"));
|
||||
app.UseRequestLocalization(localizationOptions.Value, (RequestCulture) new RequestCulture((string)"en"));
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ namespace Yavsc.ViewModels.Manage
|
|||
|
||||
public List<UserActivity> Activity { get; set; }
|
||||
|
||||
public bool HaveProfessionalSettings { get; set; }
|
||||
|
||||
public long PostsCounter { get; set; }
|
||||
|
||||
public AccountBalance Balance { get; set; }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td> @Html.Display("item.Name")
|
||||
<td> @item.Does.Name
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
<em>@ViewBag.Activity.Description</em>
|
||||
|
||||
@foreach (var profile in Model) {
|
||||
await Html.RenderPartialAsync("_PerformerPartial", profile) ;
|
||||
<hr/>
|
||||
await Html.RenderPartialAsync("PerformerProfile", profile) ;
|
||||
<form action="~/Command/Create" >
|
||||
<input type="hidden" name="id" value="@profile.PerformerId" />
|
||||
<input type="submit" value="@SR["Book "+ViewBag.Activity.Code]"/>
|
||||
</form>
|
||||
<input type="submit" value="@SR["Book "+ViewBag.Activity.Code]"/>
|
||||
</form>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
ViewData["Title"] = "Front office";
|
||||
}
|
||||
|
||||
<h2>Index</h2>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<p>
|
||||
Invitez un groupe musical à animer votre événement </p>
|
||||
<p>
|
||||
<a class="btn btn-default" href="~/do/Book/IT">
|
||||
<a class="btn btn-default" asp-controller="FrontOffice" asp-action="Book" asp-route-id="IT">
|
||||
En savoir plus
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<p>
|
||||
Organisez un concert. </p>
|
||||
<p>
|
||||
<a class="btn btn-default" href="~/do/Book/IT">
|
||||
<a class="btn btn-default" asp-controller="FrontOffice" asp-action="Book" asp-route-id="IT">
|
||||
En savoir plus
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
<p> Offrez-vous un anniversaire, un mariage Hip Hop </p>
|
||||
<p>
|
||||
|
||||
<a class="btn btn-default" href="~/do/Book/IT">
|
||||
<a class="btn btn-default" asp-controller="FrontOffice" asp-action="Book" asp-route-id="IT">
|
||||
En savoir plus
|
||||
|
||||
</a>
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
<p>
|
||||
Invitez votre chanteur à la fête </p>
|
||||
<p>
|
||||
<a class="btn btn-default" href="~/do/Book/IT">
|
||||
<a class="btn btn-default" asp-controller="FrontOffice" asp-route-id="Book" >
|
||||
En savoir plus
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
@model IndexViewModel
|
||||
@using System.Security.Claims
|
||||
@{
|
||||
ViewData["Title"] = @SR["Manage your account"];
|
||||
}
|
||||
|
|
@ -53,21 +54,27 @@
|
|||
>@SR[@Model.Avatar==null?"Set":"Modify"]</a>]
|
||||
</dd>
|
||||
|
||||
<dt>@SR["Activity"]:</dt>
|
||||
<dd>@Html.DisplayFor(model => model.Activity)
|
||||
<dt>@SR["Professional settings"]:</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.HaveProfessionalSettings)
|
||||
[<a asp-controller="Manage" asp-action="SetActivity"
|
||||
>@SR[Model.HaveProfessionalSettings?"Modify settings":"Set"]</a>]
|
||||
</dd>
|
||||
@if (Model.HaveProfessionalSettings) {
|
||||
<dt>@SR["Activities"]:</dt>
|
||||
<dd>
|
||||
@string.Join(", ",Model.Activity.Select( u=> u.Does.Name ).ToArray())
|
||||
[<a asp-controller="Do" asp-action="Index"
|
||||
>@SR[@Model.Activity==null?"Set":"Modify settings"]</a>]
|
||||
</dd>
|
||||
|
||||
}
|
||||
<dt>@SR["Bank info"]:</dt>
|
||||
<dd>@Html.DisplayFor(m => m.BankInfo) [<a asp-controller="Manage" asp-action="AddBankInfo"
|
||||
>@SR[@Model.BankInfo==null?"Set":"Modify"]</a>]</dd>
|
||||
|
||||
<dt>@SR["YourPosts"]:</dt>
|
||||
<dd>@Model.PostsCounter
|
||||
[<a asp-controller="Blogspot" asp-action="UserPosts"
|
||||
asp-route-id="@Model.UserName">@SR["YourPosts"]</a>]
|
||||
</dd>
|
||||
<dt><a asp-controller="Blogspot" asp-action="UserPosts"
|
||||
asp-route-id="@Model.UserName">@SR["Your posts"]:</a></dt>
|
||||
<dd>@Model.PostsCounter</dd>
|
||||
|
||||
<dt>@SR["TwoFactorAuthentication"]:</dt>
|
||||
<dd>
|
||||
|
|
@ -114,6 +121,10 @@
|
|||
@(Model.DiskUsage.ToString("0,#")) / @(Model.DiskQuota.ToString("0,#"))
|
||||
</text>
|
||||
</dd>
|
||||
<dt>Identifiant utilisateur</dt>
|
||||
<dd>
|
||||
@User.GetUserId()
|
||||
</dd>
|
||||
</dl>
|
||||
<h4>
|
||||
<a asp-controller="Account" asp-action="Delete" >@SR["Unregister"]</a>
|
||||
|
|
|
|||
|
|
@ -105,22 +105,13 @@
|
|||
}
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
|
||||
@{ await Html.RenderPartialAsync("_PerformerPartial", Model) ; }
|
||||
@Html.DisplayFor(model => model)
|
||||
|
||||
<form id="FrmSetAct" asp-controller="Manage" asp-action="SetActivity" method="post" class="form-horizontal" role="form">
|
||||
<h4>@SR["Choose below your main activity"]:</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="ValidationSummary.All" class="text-danger" id="valsum"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Activity" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<select asp-for="Activity" asp-items=@ViewBag.Activities class="form-control" multiple>
|
||||
|
||||
</select>
|
||||
|
||||
<span asp-validation-for="Activity" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="AcceptNotifications" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@
|
|||
}
|
||||
|
||||
</ul>
|
||||
<button id="btnAddUser">Ajouter aux contacts</button>
|
||||
|
||||
}
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue