instruments & global positioning
This commit is contained in:
@ -42,11 +42,21 @@ Nombre </dt><dd> @Model.AdminCount</dd>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<h3>Musical</h3>
|
||||
|
||||
<a asp-controller="Instruments" class="btn btn-primary">
|
||||
Gestion des Instruments
|
||||
</a>
|
||||
|
||||
<environment names="coiffure">
|
||||
|
||||
<h3>Coiffure</h3>
|
||||
|
||||
<a asp-controller="HairTaints" class="btn btn-primary">
|
||||
Gestion des couleurs
|
||||
</a>
|
||||
</environment>
|
||||
|
||||
<h3>Devices</h3>
|
||||
<a asp-controller="Devices" class="btn btn-primary">
|
||||
|
@ -4,7 +4,6 @@
|
||||
<script type="text/javascript" src="~/lib/moment/moment-with-locales.min.js"></script>
|
||||
<script type="text/javascript" src="~/lib/eonasdan-bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<link rel="stylesheet" href="~/lib/eonasdan-bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
|
||||
<link rel="stylesheet" href="~/lib/eonasdan-bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
|
||||
<style>
|
||||
#map {
|
||||
width: 100%;
|
||||
@ -83,8 +82,16 @@
|
||||
<div id='reason1'>
|
||||
<textarea rows="15" asp-for="Reason" type="text" name="Reason" id="Reason" maxlength="4096" class="form-control"></textarea>
|
||||
<span asp-validation-for="Reason" class="text-danger"></span>
|
||||
@Html.HiddenFor(model=>model.Location.Latitude)
|
||||
@Html.HiddenFor(model=>model.Location.Longitude)
|
||||
|
||||
<dl>
|
||||
<dt>@SR["Coordonées GPS"]
|
||||
</dt>
|
||||
<dd>
|
||||
<input class="text-box" id="Location_Latitude" name="Location.Latitude" type="text" value="@Model.Location.Latitude" readonly/>
|
||||
<input class="text-box" id="Location_Longitude" name="Location.Longitude" type="text" value="@Model.Location.Longitude" readonly/>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -96,7 +103,7 @@
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
|
||||
<input type="submit" class="btn btn-default" value="Créer"></input>
|
||||
<input type="submit" class="btn btn-default" value="Créer" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,26 @@
|
||||
@model Yavsc.Models.Musical.Profiles.FormationSettings
|
||||
|
||||
|
||||
@if (Model == null) {
|
||||
<p>@SR["ENOFORMATIONSETTINGS"]</p>
|
||||
}
|
||||
@if (Model != null) {
|
||||
<fieldset>
|
||||
<legend>@SR["Formation"] @Model.DisplayName</legend>
|
||||
<p>@Model.Summary</p>
|
||||
|
||||
<h2>
|
||||
|
||||
@foreach(var inst in Model.Instruments) {
|
||||
@Html.DisplayNameFor(model => model.Tool)
|
||||
}
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Tool)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Tool)
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
}
|
42
src/Yavsc/Views/InstrumentRating/Create.cshtml
Normal file
42
src/Yavsc/Views/InstrumentRating/Create.cshtml
Normal file
@ -0,0 +1,42 @@
|
||||
@model Yavsc.Models.Musical.InstrumentRating
|
||||
|
||||
@{
|
||||
ViewData["Title"] = @SR["Create"];
|
||||
}
|
||||
|
||||
<h2>@SR["Create"]</h2>
|
||||
|
||||
<form asp-action="Create">
|
||||
<div class="form-horizontal">
|
||||
<h4>@SR["InstrumentRating"]</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||
|
||||
<input asp-for="OwnerId" type="hidden" Value="@User.GetUserId()" />
|
||||
<div class="form-group">
|
||||
<label asp-for="Rate" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<select asp-for="InstrumentId" asp-items=@ViewBag.YetAvailableInstruments>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Rate" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Rate" class="form-control" />
|
||||
<span asp-validation-for="Rate" class="text-danger" ></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">@SR["Back to List"]</a>
|
||||
</div>
|
||||
|
34
src/Yavsc/Views/InstrumentRating/Delete.cshtml
Normal file
34
src/Yavsc/Views/InstrumentRating/Delete.cshtml
Normal file
@ -0,0 +1,34 @@
|
||||
@model Yavsc.Models.Musical.InstrumentRating
|
||||
|
||||
@{
|
||||
ViewData["Title"] = @SR["Delete"];
|
||||
}
|
||||
|
||||
<h2>@SR["Delete"]</h2>
|
||||
|
||||
<h3>@SR["AreYourSureYouWantToDeleteThis"]</h3>
|
||||
<div>
|
||||
<h4>@SR["InstrumentRating"]</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Rate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Rate)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Instrument.Name)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Instrument.Name)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form asp-action="Delete">
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="@SR["Delete"]" class="btn btn-default" /> |
|
||||
<a asp-action="Index">@SR["Back to List"]</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
30
src/Yavsc/Views/InstrumentRating/Details.cshtml
Normal file
30
src/Yavsc/Views/InstrumentRating/Details.cshtml
Normal file
@ -0,0 +1,30 @@
|
||||
@model Yavsc.Models.Musical.InstrumentRating
|
||||
|
||||
@{
|
||||
ViewData["Title"] = @SR["Details"];
|
||||
}
|
||||
|
||||
<h2>@SR["Details"]</h2>
|
||||
|
||||
<div>
|
||||
<h4>InstrumentRating</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Rate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Rate)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Instrument.Name)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Instrument.Name)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
<a asp-action="Edit" asp-route-id="@Model.Id">@SR["Edit"]</a> |
|
||||
<a asp-action="Index">@SR["Back to List"]</a>
|
||||
</p>
|
40
src/Yavsc/Views/InstrumentRating/Edit.cshtml
Normal file
40
src/Yavsc/Views/InstrumentRating/Edit.cshtml
Normal file
@ -0,0 +1,40 @@
|
||||
@model Yavsc.Models.Musical.InstrumentRating
|
||||
|
||||
@{
|
||||
ViewData["Title"] = @SR["Edit"];
|
||||
}
|
||||
|
||||
<h2>@SR["Edit"]</h2>
|
||||
|
||||
<form asp-action="Edit">
|
||||
<div class="form-horizontal">
|
||||
<h4>InstrumentRating</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="OwnerId" class="control-label col-md-2">OwnerId</label>
|
||||
<div class="col-md-10">
|
||||
<select asp-for="OwnerId" class="form-control" ></select>
|
||||
<span asp-validation-for="OwnerId" class="text-danger" ></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Rate" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Rate" class="form-control" />
|
||||
<span asp-validation-for="Rate" class="text-danger"></span>
|
||||
</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">@SR["Back to List"]</a>
|
||||
</div>
|
||||
|
39
src/Yavsc/Views/InstrumentRating/Index.cshtml
Normal file
39
src/Yavsc/Views/InstrumentRating/Index.cshtml
Normal file
@ -0,0 +1,39 @@
|
||||
@model IEnumerable<Yavsc.Models.Musical.InstrumentRating>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = @SR["Index"];
|
||||
}
|
||||
|
||||
<h2>@SR["Index"]</h2>
|
||||
|
||||
<p>
|
||||
<a asp-action="Create">@SR["Create New"]</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Rate)
|
||||
</th>
|
||||
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Instrument.Name)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Rate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Instrument.Name)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Edit" asp-route-id="@item.Id">@SR["Edit"]</a> |
|
||||
<a asp-action="Details" asp-route-id="@item.Id">@SR["Details"]</a> |
|
||||
<a asp-action="Delete" asp-route-id="@item.Id">@SR["Delete"]</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
@ -15,7 +15,7 @@
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Instruments</dt>
|
||||
<dd>@Html.DisplayFor(m=>m.Instrumentation)</dd>
|
||||
<dd>@Html.DisplayFor(m=>m)</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
|
@ -7,99 +7,8 @@
|
||||
height: 250px;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
@section scripts {
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=@ViewBag.GoogleSettings.BrowserApiKey"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var config = {
|
||||
mapId: 'map',
|
||||
addrId: 'OrganizationAddress_Address',
|
||||
longId: 'OrganizationAddress_Longitude',
|
||||
latId: 'OrganizationAddress_Latitude',
|
||||
addrValidationId: 'AddressError',
|
||||
formValidId: 'valsum',
|
||||
locComboId: 'loccomb'
|
||||
};
|
||||
$.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(sender,loc) {
|
||||
if (sender === 'user') $('#'+config.addrId).val(loc.formatted_address);
|
||||
var pos = loc.geometry.location;
|
||||
var lat = new Number(pos.lat);
|
||||
var lng = new Number(pos.lng);
|
||||
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();
|
||||
$('#'+config.latId).val(pos.lat);
|
||||
$('#'+config.longId).val(pos.lng);
|
||||
});
|
||||
$('#'+config.addrId).valid();
|
||||
$('#'+config.addrValidationId).empty();
|
||||
$('#'+config.formValidId).empty();
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#'+config.addrId).rules("add",
|
||||
{
|
||||
remote: {
|
||||
url: 'https://maps.googleapis.com/maps/api/geocode/json',
|
||||
type: 'get',
|
||||
data: {
|
||||
key: '@Startup.GoogleSettings.BrowserApiKey',
|
||||
sensor: false,
|
||||
address: function () { return $('#'+config.addrId).val() }
|
||||
},
|
||||
dataType: 'json',
|
||||
dataFilter: function(datastr,type) {
|
||||
$('#'+config.locComboId).html("");
|
||||
var data = JSON.parse(datastr);
|
||||
data.results.forEach(function(element) {
|
||||
if (element.formatted_address !== $('#'+config.addrId).val()) {
|
||||
$('<li>'+element.formatted_address+'</li>')
|
||||
.data("geoloc",element)
|
||||
.click(function() { chooseLoc('user',$(this).data("geoloc")) })
|
||||
.appendTo($('#'+config.locComboId));}
|
||||
else { }
|
||||
});
|
||||
if ((data.status === 'OK') && (data.results.length == 1))
|
||||
{
|
||||
chooseLoc('google',data.results[0]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown)
|
||||
{
|
||||
console.log('ajax loading error ... '+textStatus+' ... '+ errorThrown);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
|
||||
@Html.DisplayFor(model => model)
|
||||
@ -192,19 +101,25 @@
|
||||
<span id="AddressError" asp-validation-for="OrganizationAddress.Address" class="text-danger"></span>
|
||||
<ul id="loccomb" >
|
||||
</ul>
|
||||
<div id="map"></div>
|
||||
<div id="map" class="map" data-val="valloc" data-addr="OrganizationAddress_Address" data-loccombo="loccomb" data-lat="OrganizationAddress_Latitude" data-lon="OrganizationAddress_Longitude" data-val-slat="@Model.OrganizationAddress.Latitude" data-val-slon="@Model.OrganizationAddress.Longitude" ></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@Html.Hidden("OrganizationAddress.Latitude") @Html.Hidden("OrganizationAddress.Longitude") @Html.Hidden("PerformerId")
|
||||
@Html.Hidden("OrganizationAddress.Latitude")
|
||||
@Html.Hidden("OrganizationAddress.Longitude")
|
||||
@Html.Hidden("PerformerId")
|
||||
<button type="submit" class="btn btn-default">@SR["Save these settings"]</button>
|
||||
|
||||
</form>
|
||||
|
||||
<a asp-controller="InstrumentRating" asp-action="Index">@SR["Instrumentation"]</a>
|
||||
|
||||
<form asp-controller="Manage" asp-action="UnsetActivity" method="post" class="form-horizontal" role="form">
|
||||
@Html.Hidden("PerfomerId")
|
||||
<button type="submit" class="btn btn-default">@SR["UnsetActivity"]</button>
|
||||
</form>
|
||||
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
@{ await Html.RenderPartialAsync("_MapScriptsPartial"); }
|
||||
|
||||
|
@ -3,15 +3,13 @@
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
function setCoord(config, pos)
|
||||
{
|
||||
var culture = '@System.Globalization.CultureInfo.CurrentCulture.Name';
|
||||
var lat = new Number(pos.lat);
|
||||
var lng = new Number(pos.lng);
|
||||
$('#'+config.latId).val(lat.toLocaleString(culture));
|
||||
$('#'+config.lonId).val(lng.toLocaleString(culture));
|
||||
$('#'+config.latId).val(pos.lat.toLocaleString(culture, { minimumFractionDigits: 7 }));
|
||||
$('#'+config.lonId).val(pos.lng.toLocaleString(culture, { minimumFractionDigits: 7 }));
|
||||
}
|
||||
var marker=null;
|
||||
function chooseLoc(config, sender, loc) {
|
||||
if (sender === 'user') $('#'+config.addrId).val(loc.formatted_address);
|
||||
var pos = loc.geometry.location;
|
||||
@ -19,18 +17,23 @@
|
||||
var gmap = config.gmap;
|
||||
gmap.setCenter(pos);
|
||||
setCoord(config, pos);
|
||||
var marker = new google.maps.Marker({
|
||||
map: gmap,
|
||||
draggable: true,
|
||||
animation: google.maps.Animation.DROP,
|
||||
position: pos
|
||||
if (marker!=null) {
|
||||
marker.position = pos;
|
||||
}
|
||||
else {
|
||||
marker = new google.maps.Marker({
|
||||
map: gmap,
|
||||
draggable: true,
|
||||
animation: google.maps.Animation.DROP,
|
||||
position: pos
|
||||
});
|
||||
google.maps.event.addListener(marker, 'dragend', function() {
|
||||
var pos = marker.getPosition();
|
||||
setCoord(config, { lat: pos.lat(), lng: pos.lng() });
|
||||
});
|
||||
}
|
||||
|
||||
$('#'+config.addrId).valid();
|
||||
$('#'+config.valId).empty();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -41,10 +44,9 @@
|
||||
addrId: $(mapDiv).data('addr'),
|
||||
lonId: $(mapDiv).data('lon'),
|
||||
latId: $(mapDiv).data('lat'),
|
||||
valId: $(mapDiv).data('val'),
|
||||
locComboId: $(mapDiv).data('loccombo')
|
||||
};
|
||||
|
||||
var scenter = { lat: parseFloat($('#'+config.latId).val().replace(',','.')), lng: parseFloat($('#'+config.lonId).val().replace(',','.')) } ;
|
||||
var input = '#'+config.addrId;
|
||||
$(input).data("val-required", '@SR["SpecifyPlace"]') ;
|
||||
$(input).data("val-remote", '@SR[ "GoogleDidntGeoLocalized"]') ;
|
||||
@ -85,9 +87,18 @@
|
||||
});
|
||||
|
||||
var gmap = new google.maps.Map(document.getElementById(config.mapId), {
|
||||
zoom: 8
|
||||
zoom: 8,
|
||||
center: scenter
|
||||
});
|
||||
|
||||
config.gmap = gmap;
|
||||
marker = new google.maps.Marker({
|
||||
map: gmap,
|
||||
draggable: true,
|
||||
animation: google.maps.Animation.DROP,
|
||||
position: scenter
|
||||
});
|
||||
|
||||
}
|
||||
$("div.map").each(function(indexMap){
|
||||
setupInputAddress(this)
|
||||
|
Reference in New Issue
Block a user