implémente une première vue de confirmation de la commande

vnext
Paul Schneider 8 years ago
parent 5a48793c16
commit 0c173caf24
2 changed files with 73 additions and 2 deletions

@ -152,12 +152,16 @@ namespace Yavsc.Controllers
var regids = command.PerformerProfile.Performer
.Devices.Select(d => d.GCMRegistrationId);
var sregids = string.Join(",",regids);
_logger.LogWarning($"ApiKey: {_googleSettings.ApiKey} {sregids}");
_logger.LogWarning($"ApiKey: {_googleSettings.ApiKey}");
_logger.LogWarning($"RegIds: {sregids}");
grep = await _GCMSender.NotifyAsync(_googleSettings,regids,yaev);
}
// TODO setup a profile choice to allow notifications
// both on mailbox and mobile
// if (grep==null || grep.success<=0 || grep.failure>0)
ViewBag.GooglePayload=grep;
if (grep!=null)
_logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}");
await _emailSender.SendEmailAsync(
_siteSettings, _smtpSettings,
@ -166,7 +170,8 @@ namespace Yavsc.Controllers
$"{yaev.Description}\r\n-- \r\n{yaev.Comment}\r\n"
);
}
return RedirectToAction("Index");
ViewBag.GoogleSettings = _googleSettings;
return View("CommandConfirmation",command);
}
ViewBag.GoogleSettings = _googleSettings;
return View(command);

@ -0,0 +1,66 @@
@model BookQuery
@using Yavsc.Models.Google.Messaging
@{
ViewData["Title"] = SR["Book "+Model.PerformerProfile.ActivityCode];
}
@section header{
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
<script src="https://maps.googleapis.com/maps/api/js?key=@ViewBag.GoogleSettings.BrowserApiKey"></script>
<link rel="stylesheet" href="~/css/bootstrap-datepicker/bootstrap-datepicker3.standalone.min.css">
<style>
#map {
width: 100%;
height: 250px;
}
#Location_combo li {
cursor: pointer;
}
#Location_combo li:hover {
text-decoration: underline;
}
</style>
}
@section scripts{
<script>
$(document).ready(function(){
var gmap = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
center: { lat: @Model.Location.Latitude, lng: @Model.Location.Longitude }
});
var marker;
});
</script>
}
<h2>@ViewData["Title"]</h2>
<div class="form-horizontal">
<h4>@SR["Your book query"]</h4>
<hr />
@Html.DisplayFor(m => m.EventDate)
@Html.DisplayFor(m => m.Location)
<h4>@SR["Notifications sent to its devices"]</h4>
<hr />
@if (ViewBag.GooglePayload !=null)
{
@if (ViewBag.GooglePayload.results !=null) {
@:success: @ViewBag.GooglePayload.success
@:failure: @ViewBag.GooglePayload.failure
<br/>
@foreach (MessageWithPayloadResponse.Result mr in ViewBag.GooglePayload.results) {
@:message_id: @mr.message_id
@:registration_id: @mr.registration_id
@:error: @mr.error
<br/>
}
}
}
</div>
Loading…