|
|
@@ -65,7 +65,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- @Html.HiddenFor(model => contenu.Code_Postal, new { data_picker = "commune.code_postal" })
|
|
|
@Html.HiddenFor(model => contenu.Commune_Insee, new { data_picker = "commune.insee" })
|
|
|
@Html.HiddenFor(model => contenu.Commune, new { data_picker = "commune.nom" })
|
|
|
@Html.HiddenFor(model => contenu.Canton, new { data_picker = "commune.canton" })
|
|
|
@@ -75,7 +74,7 @@
|
|
|
<div class="form-group">
|
|
|
@Html.LabelFor(model => contenu.Commune, htmlAttributes: new { @class = "control-label col-md-2 required" })
|
|
|
<div class="col-md-4">
|
|
|
- <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/com67/" title="Selection commune (nouvelle fenetre)">Sélectionner une commune</a>
|
|
|
+ <a class='modal-window-events' href="http://referentiel.bas-rhin.fr/picker/cd67/com67/" title="Selection commune (nouvelle fenetre)">Sélectionner une commune</a>
|
|
|
<br />
|
|
|
<div class="panel panel-default" id="Commune_Panel" name="Commune_Panel" style="@if (contenu.Commune_Insee == null) { <text>display: none;</text> }">
|
|
|
<div class="panel-heading clearfix">
|
|
|
@@ -100,6 +99,16 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ <div class="form-group">
|
|
|
+ @Html.LabelFor(model => contenu.Code_Postal, htmlAttributes: new { @class = "control-label col-md-2" })
|
|
|
+ <div class="col-md-10">
|
|
|
+ Code(s) postal(aux) associé(s) à la commune <span id="CP-warning" class="text-danger" style="display:none">(attention, plusieurs choix possibles)</span> : <input id="code_postaux" data-picker="commune.code_postal" value="@contenu.Code_Postal" class="disabled-input-as-label" />
|
|
|
+ <br />
|
|
|
+ @Html.DropDownListFor(model => contenu.Code_Postal, Model.Listes["Code_Postal"], htmlAttributes: new { @class = "form-control" })
|
|
|
+ @Html.ValidationMessageFor(model => contenu.Code_Postal, "", new { @class = "text-danger" })
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="form-group">
|
|
|
@Html.LabelFor(model => contenu.Tel, htmlAttributes: new { @class = "control-label col-md-2" })
|
|
|
<div class="col-md-10">
|
|
|
@@ -139,22 +148,53 @@
|
|
|
|
|
|
@section Scripts {
|
|
|
<script type="text/javascript">
|
|
|
- $(".removeItem").click(function () {
|
|
|
- switch ($(this).data("type")) {
|
|
|
- case 'commune':
|
|
|
- $('#Code_Postal').val(null);
|
|
|
- $('#Commune_Insee').val(null);
|
|
|
- $('#Commune').val(null);
|
|
|
- $('#Canton').val(null);
|
|
|
- $('#Territoire_Id').val(null);
|
|
|
- $('#TAD').val(null);
|
|
|
- $('#CDC').val(null);
|
|
|
- $('#Commune_Panel').hide();
|
|
|
- break;
|
|
|
- default:
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
+ $(".removeItem").click(function () {
|
|
|
+ switch ($(this).data("type")) {
|
|
|
+ case 'commune':
|
|
|
+ $('#Code_Postal').val(null);
|
|
|
+ $('#Commune_Insee').val(null);
|
|
|
+ $('#Commune').val(null);
|
|
|
+ $('#Canton').val(null);
|
|
|
+ $('#Territoire_Id').val(null);
|
|
|
+ $('#TAD').val(null);
|
|
|
+ $('#CDC').val(null);
|
|
|
+ $('#Commune_Panel').hide();
|
|
|
+
|
|
|
+ //suppression du champ en dessous
|
|
|
+ $('#code_postaux').val(null);
|
|
|
+ $('#contenu_Code_Postal').empty();
|
|
|
+ $('#CP-warning').hide();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // Function à implémenter pour éviter une erreur
|
|
|
+ function onModalOpen()
|
|
|
+ {
|
|
|
+ $('#CP-warning').hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ function onModalClose()
|
|
|
+ {
|
|
|
+ var code_postaux = $('#code_postaux').val();
|
|
|
+ if (code_postaux != '') {
|
|
|
+ //On vide la liste actuelle
|
|
|
+ $('#contenu_Code_Postal').empty();
|
|
|
+
|
|
|
+ var liste = code_postaux.split(',');
|
|
|
+ liste.forEach(function (element) {
|
|
|
+ //On ajoute les choix
|
|
|
+ $('#contenu_Code_Postal').append($('<option>', {
|
|
|
+ value: element,
|
|
|
+ text: element
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+ if (liste.length > 1) $('#CP-warning').show();
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
@Scripts.Render("~/bundles/jqueryval")
|