fixes GMaps usage & Command creation
This commit is contained in:
parent
49de239344
commit
4999284419
12 changed files with 192 additions and 269 deletions
|
|
@ -99,7 +99,7 @@
|
|||
<input asp-for="OrganizationAddress.Address" class="form-control" type="text" />
|
||||
|
||||
<span id="AddressError" asp-validation-for="OrganizationAddress.Address" class="text-danger"></span>
|
||||
<ul id="loccomb" >
|
||||
<ul id="LocationCombo" >
|
||||
</ul>
|
||||
<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>
|
||||
|
||||
|
|
@ -118,8 +118,20 @@
|
|||
@Html.Hidden("PerfomerId")
|
||||
<button type="submit" class="btn btn-default">@SR["UnsetActivity"]</button>
|
||||
</form>
|
||||
|
||||
|
||||
@section scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
@{ await Html.RenderPartialAsync("_MapScriptsPartial"); }
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#OrganizationAddress_Address").googlegeocode({
|
||||
culture: '@System.Globalization.CultureInfo.CurrentCulture.Name',
|
||||
mapsApiKey: '@Startup.GoogleSettings.BrowserApiKey',
|
||||
mapId: 'map',
|
||||
longId: 'OrganizationAddress_Longitude',
|
||||
latId: 'OrganizationAddress_Latitude',
|
||||
addrValidationId: 'AddressError',
|
||||
formValidId: 'ValidationSummary',
|
||||
locComboId: 'LocationCombo'})
|
||||
})
|
||||
</script>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,48 @@
|
|||
@model SetAddressViewModel
|
||||
|
||||
@model Location
|
||||
@section header {
|
||||
<style>
|
||||
#map {
|
||||
#amap {
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
}
|
||||
</style>
|
||||
|
||||
}
|
||||
|
||||
<form asp-action="SetAddress">
|
||||
<div asp-validation-summary="ValidationSummary.All" class="text-danger" id="ValidationSummary"></div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<label asp-for="Street1" class="col-md-2 control-label">@SR["Address"]</label>
|
||||
<label asp-for="Address" class="col-md-2 control-label">@SR["Address"]</label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Street1" class="form-control" type="text" />
|
||||
<input asp-for="Address" class="form-control" type="text" data-val-required="Spécifier un lieu" />
|
||||
|
||||
<span id="AddressError" asp-validation-for="Street1" class="text-danger"></span>
|
||||
<span id="AddressError" asp-validation-for="Address" class="text-danger"></span>
|
||||
<ul id="LocationCombo" >
|
||||
</ul>
|
||||
<div id="map"></div>
|
||||
<div id="amap"></div>
|
||||
<input class="text-box" id="Latitude" name="Latitude" type="hidden" value="@Model.Latitude" readonly/>
|
||||
<input class="text-box" id="Longitude" name="Longitude" type="hidden" value="@Model.Longitude" readonly/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-success" value="Enregistrer" />
|
||||
|
||||
</form>
|
||||
|
||||
@section scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
|
||||
@section scripts {
|
||||
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=@ViewBag.GoogleSettings.BrowserApiKey"></script>
|
||||
<script src="~/js/google-geoloc.js" asp-append-version="true"></script>
|
||||
<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"
|
||||
}
|
||||
});
|
||||
$("#Address").googlegeocode()
|
||||
})
|
||||
</script>
|
||||
|
||||
@{ await Html.RenderPartialAsync("_MapScriptsPartial"); }
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#Address").googlegeocode({
|
||||
culture: '@System.Globalization.CultureInfo.CurrentCulture.Name',
|
||||
mapsApiKey: '@Startup.GoogleSettings.BrowserApiKey',
|
||||
mapId: 'amap',
|
||||
longId: 'Longitude',
|
||||
latId: 'Latitude',
|
||||
addrValidationId: 'AddressError',
|
||||
formValidId: 'ValidationSummary',
|
||||
locComboId: 'LocationCombo'})
|
||||
})
|
||||
</script>
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue