| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- @using CD67.FicheCollege.MVC.Models
- @model CollegeViewModel
- @{
- ViewBag.Title = "Ajout";
- Layout = "~/Views/Shared/_Layout.cshtml";
- College college = Model.Obj;
- }
- @if (Model.Acces == ModeAcces.Modification)
- {
- <h1>@college.Libelle</h1>
- }
- else
- {
- <h1>Nouveau collège</h1>
- }
- @using (Html.BeginForm())
- {
- @Html.AntiForgeryToken()
- <fieldset>
- <legend>
- Informations générales - @Model.Acces.ToString()
- </legend>
- <div class="form-horizontal">
- <h4>Collège</h4>
- <hr />
- @Html.ValidationSummary(true, "", new { @class = "text-danger" })
- @if (Model.Acces == ModeAcces.Modification)
- {
- @Html.HiddenFor(model => college.Id)
- }
- @Html.HiddenFor(model => college.Annee_Id)
- <div class="form-group">
- @Html.LabelFor(model => college.CodeRne, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => college.CodeRne, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => college.CodeRne, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => college.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => college.Libelle, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => college.Libelle, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => college.TypeCollege_Id, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.DropDownListFor(model => college.TypeCollege_Id, Model.Sel_TypesCollege, htmlAttributes: new { @class = "form-control" })
- @Html.ValidationMessageFor(model => college.TypeCollege_Id, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => college.Adresse, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => college.Adresse, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => college.Adresse, "", new { @class = "text-danger" })
- </div>
- </div>
- @Html.HiddenFor(model => college.Commune_Insee, new { data_picker = "commune.insee" })
- @Html.HiddenFor(model => college.Commune, new { data_picker = "commune.nom" })
- @Html.HiddenFor(model => college.Canton, new { data_picker = "commune.canton" })
- @Html.HiddenFor(model => college.Territoire_Id, new { data_picker = "commune.code_tad" })
- @Html.HiddenFor(model => college.TAD, new { data_picker = "commune.tad" })
- @Html.HiddenFor(model => college.CDC, new { data_picker = "commune.cdc" })
- <div class="form-group">
- @Html.LabelFor(model => college.Commune, htmlAttributes: new { @class = "control-label col-md-2 required" })
- <div class="col-md-4">
- <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 (college.Commune_Insee == null) { <text>display: none;</text> }">
- <div class="panel-heading clearfix">
- <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
- <i class="fa fa-map-marker color1" aria-hidden="true"></i>
- Localisation (commune)
- </h4>
- <div class="pull-right">
- <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="commune"></span>
- </div>
- </div>
- <div class="panel-body" style="text-align: center;">
- <span>
- <b><span data-picker="commune.nom">@college.Commune</span ></b >
- <br />Canton : <span data-picker="commune.canton">@college.Canton</span >
- <br />TAD : <span data-picker="commune.tad">@college.TAD</span >
- <br />CDC : <span data-picker="commune.cdc">@college.CDC</span >
- </span>
- </div>
- </div>
- @Html.ValidationMessageFor(model => college.Commune, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => college.Code_Postal, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- Code(s) postal(aux) associé(s) à la commune
- @if (Model.Sel_CodesPostaux.Count() > 1) {
- <span id="CP-warning" class="text-danger">(attention, plusieurs choix possibles)</span>
- }
- : <input id="code_postaux" data-picker="commune.code_postal" value="@String.Join(",", Model.Sel_CodesPostaux.Select(i => i.Text))" class="disabled-input-as-label" />
- <br />
- @Html.DropDownListFor(model => college.Code_Postal, Model.Sel_CodesPostaux, htmlAttributes: new { @class = "form-control" })
- @Html.ValidationMessageFor(model => college.Code_Postal, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => college.Tel, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => college.Tel, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => college.Tel, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => college.Fax, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => college.Fax, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => college.Fax, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => college.Email, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => college.Email, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => college.Email, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- <input type="submit" value="@Model.Acces.EnumDisplayNameFor(MvcHtmlHelpers.DisplayValue.Prompt)" class="btn btn-default" /> |
- @if (Model.Acces == ModeAcces.Creation)
- { @Html.ActionLink("Annuler", "Index") }
- else
- { @Html.ActionLink("Annuler", "Details", new { Id = college.Id }) }
- </div>
- </div>
- </div>
- </fieldset>
- }
- @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();
- //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")
- }
|