Passage à ASP.NET vNext
This commit is contained in:
parent
ea90fefc31
commit
388b004837
1929 changed files with 104611 additions and 235941 deletions
149
Yavsc/Views/Command/Create.cshtml
Normal file
149
Yavsc/Views/Command/Create.cshtml
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
@model BookQuery
|
||||
@{
|
||||
ViewData["Title"] = SR["Book "+Model.PerformerProfile.ActivityCode];
|
||||
}
|
||||
@section header{
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
<script src="~/lib/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
|
||||
<script src="~/lib/bootstrap-datepicker/bootstrap-datepicker-locales/bootstrap-datepicker.fr.min.js" charset="UTF-8"></script>
|
||||
<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(){
|
||||
|
||||
$.validator.setDefaults({
|
||||
messages: {
|
||||
remote: "Ce lieu n'est pas identifié par les services de géo-localisation Google",
|
||||
required: "Veuillez renseigner ce champ"
|
||||
}
|
||||
});
|
||||
var gmap = new google.maps.Map(document.getElementById('map'), {
|
||||
zoom: 16,
|
||||
center: { lat: 48.862854, lng: 2.2056466 }
|
||||
});
|
||||
var marker;
|
||||
function chooseLoc(loc) {
|
||||
$('#Location_Address').val(loc.formatted_address);
|
||||
var pos = loc.geometry.location;
|
||||
var lat = new Number(pos.lat);
|
||||
var lng = new Number(pos.lng);
|
||||
$('#Location_Latitude').val(lat.toLocaleString());
|
||||
$('#Location_Longitude').val(lng.toLocaleString());
|
||||
gmap.setCenter(pos);
|
||||
if (marker) {
|
||||
marker.setMap(null);
|
||||
}
|
||||
marker = new google.maps.Marker({
|
||||
map: gmap,
|
||||
draggable: true,
|
||||
animation: google.maps.Animation.DROP,
|
||||
position: pos
|
||||
});
|
||||
google.maps.event.addListener(marker, 'dragend', function() {
|
||||
// TODO reverse geo code
|
||||
var pos = marker.getPosition();
|
||||
$('#Location_Latitude').val(pos.lat);
|
||||
$('#Location_Longitude').val(pos.lng);
|
||||
});
|
||||
$('#Location_Address').valid();
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#EventDate').datepicker({language:'fr'});
|
||||
|
||||
$('#Location_Address').rules("add",
|
||||
{
|
||||
remote: {
|
||||
url: 'http://maps.googleapis.com/maps/api/geocode/json',
|
||||
type: 'get',
|
||||
data: {
|
||||
sensor: false,
|
||||
address: function () { return $('#Location_Address').val() }
|
||||
},
|
||||
dataType: 'json',
|
||||
dataFilter: function(datastr,type) {
|
||||
$('#Location_combo').html("");
|
||||
var data = JSON.parse(datastr);
|
||||
data.results.forEach(function(element) {
|
||||
if (element.formatted_address !== $('#Location_Address').val()) {
|
||||
$('<li>'+element.formatted_address+'</li>')
|
||||
.data("geoloc",element)
|
||||
.click(function() { chooseLoc($(this).data("geoloc")) })
|
||||
.appendTo($('#Location_combo'));}});
|
||||
return (data.status === 'OK') && (data.results.length == 1);
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown)
|
||||
{
|
||||
console.log('ajax loading error ... '+textStatus+' ... '+ errorThrown);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<form asp-action="Create" id="FrmComCre" role="form">
|
||||
<div class="form-horizontal">
|
||||
<h4>@SR["Fill in your book query"]</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
|
||||
<div class="form-group" has-feedback>
|
||||
<fieldset>
|
||||
<legend><label for="EventDate" class="col-md-2 control-label" >
|
||||
@SR["EventDate"]
|
||||
</label></legend>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="EventDate" class="form-control" type="date" id="EventDate"
|
||||
data-val-required=@SR["ChooseAnEventDate"]
|
||||
/>
|
||||
<span asp-validation-for="EventDate" class="text-danger" >
|
||||
</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group" has-feedback>
|
||||
<fieldset>
|
||||
<legend><label for="Location_Address" class="col-md-2 control-label">
|
||||
@SR["Location"]
|
||||
</label>
|
||||
</legend>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Location.Address" type="text" name="Location.Address" id="Location_Address"
|
||||
class="form-control" data-val-required=@SR["SpecifyPlace"]
|
||||
data-val-remote=@SR["GoogleDidntGeoLocalized"]>
|
||||
<span asp-validation-for="Location.Address" class="text-danger" ></span>
|
||||
<ul id="Location_combo" >
|
||||
</ul>
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
@Html.HiddenFor(model=>model.Location.Latitude)
|
||||
@Html.HiddenFor(model=>model.Location.Longitude)
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="@SR["Create"]" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
@Html.HiddenFor(model=>model.Client.Id)
|
||||
@Html.HiddenFor(model=>model.PerformerId)
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
28
Yavsc/Views/Command/Delete.cshtml
Normal file
28
Yavsc/Views/Command/Delete.cshtml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
@model BookQuery
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>Command</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ValidationDate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ValidationDate)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form asp-action="Delete">
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
59
Yavsc/Views/Command/Details.cshtml
Normal file
59
Yavsc/Views/Command/Details.cshtml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
@model BookQuery
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>Command</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.EventDate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.EventDate)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Client)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Client.UserName)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Location.Address)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Location.Address)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.PerformerProfile)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.PerformerProfile.Performer.UserName)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ValidationDate)
|
||||
</dt>
|
||||
<dd>
|
||||
@if (Model.ValidationDate==null) {
|
||||
@SR["NotValidated"]
|
||||
}
|
||||
else {
|
||||
@Html.DisplayFor(model => model.ValidationDate)
|
||||
}
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</p>
|
||||
33
Yavsc/Views/Command/Edit.cshtml
Normal file
33
Yavsc/Views/Command/Edit.cshtml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
@model BookQuery
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
<form asp-action="Edit">
|
||||
<div class="form-horizontal">
|
||||
<h4>Command</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<div class="form-group">
|
||||
<label asp-for="ValidationDate" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="ValidationDate" class="form-control" />
|
||||
<span asp-validation-for="ValidationDate" class="text-danger" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
||||
62
Yavsc/Views/Command/Index.cshtml
Normal file
62
Yavsc/Views/Command/Index.cshtml
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
@model IEnumerable<BookQuery>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<h2>Index</h2>
|
||||
|
||||
<p>
|
||||
<a asp-action="Create">Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.CreationDate)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.EventDate)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Location)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Client)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.PerformerProfile)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ValidationDate)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CreationDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.EventDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Location.Address)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Client.UserName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.PerformerProfile.Performer.UserName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ValidationDate)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
||||
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
||||
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue