Edit.cshtml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. @using CD67.FicheCollege.MVC.Models
  2. @model CollegeViewModel
  3. @{
  4. ViewBag.Title = "Ajout";
  5. Layout = "~/Views/Shared/_Layout.cshtml";
  6. College contenu = Model.Contenu as College;
  7. }
  8. <h1>@Model.College_Libelle</h1>
  9. @using (Html.BeginForm())
  10. {
  11. @Html.AntiForgeryToken()
  12. <fieldset>
  13. <legend>
  14. Informations générales - @Model.Acces.ToString()
  15. </legend>
  16. <div class="form-horizontal">
  17. <h4>Collège</h4>
  18. <hr />
  19. @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  20. @if (Model.Acces == ModeAcces.Modification)
  21. {
  22. @Html.HiddenFor(model => contenu.Id)
  23. }
  24. <div class="form-group">
  25. @Html.LabelFor(model => contenu.Id, htmlAttributes: new { @class = "control-label col-md-2" })
  26. <div class="col-md-10">
  27. @if (Model.Acces == ModeAcces.Modification)
  28. {
  29. @Html.EditorFor(model => contenu.Id, new { htmlAttributes = new { @class = "form-control", @disabled = true } })
  30. }
  31. else
  32. {
  33. @Html.EditorFor(model => contenu.Id, new { htmlAttributes = new { @class = "form-control" } })
  34. }
  35. @Html.ValidationMessageFor(model => contenu.Id, "", new { @class = "text-danger" })
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. @Html.LabelFor(model => contenu.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
  40. <div class="col-md-10">
  41. @Html.EditorFor(model => contenu.Libelle, new { htmlAttributes = new { @class = "form-control" } })
  42. @Html.ValidationMessageFor(model => contenu.Libelle, "", new { @class = "text-danger" })
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. @Html.LabelFor(model => contenu.TypeCollege_Id, htmlAttributes: new { @class = "control-label col-md-2" })
  47. <div class="col-md-10">
  48. @Html.DropDownListFor(model => contenu.TypeCollege_Id, Model.Listes["TypeCollege_Id"], htmlAttributes: new { @class = "form-control" })
  49. @Html.ValidationMessageFor(model => contenu.TypeCollege_Id, "", new { @class = "text-danger" })
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. @Html.LabelFor(model => contenu.Adresse, htmlAttributes: new { @class = "control-label col-md-2" })
  54. <div class="col-md-10">
  55. @Html.EditorFor(model => contenu.Adresse, new { htmlAttributes = new { @class = "form-control" } })
  56. @Html.ValidationMessageFor(model => contenu.Adresse, "", new { @class = "text-danger" })
  57. </div>
  58. </div>
  59. @Html.HiddenFor(model => contenu.Code_Postal, new { data_picker = "commune.code_postal" })
  60. @Html.HiddenFor(model => contenu.Commune_Insee, new { data_picker = "commune.insee" })
  61. @Html.HiddenFor(model => contenu.Commune, new { data_picker = "commune.nom" })
  62. @Html.HiddenFor(model => contenu.Canton, new { data_picker = "commune.canton" })
  63. @Html.HiddenFor(model => contenu.Territoire_Id, new { data_picker = "commune.code_tad" })
  64. @Html.HiddenFor(model => contenu.TAD, new { data_picker = "commune.tad" })
  65. @Html.HiddenFor(model => contenu.CDC, new { data_picker = "commune.cdc" })
  66. <div class="form-group">
  67. @Html.LabelFor(model => contenu.Commune, htmlAttributes: new { @class = "control-label col-md-2 required" })
  68. <div class="col-md-4">
  69. <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/com67/" title="Selection commune (nouvelle fenetre)">Sélectionner une commune</a>
  70. <br />
  71. <div class="panel panel-default" id="Commune_Panel" name="Commune_Panel" style="@if (contenu.Commune_Insee == null) { <text>display: none;</text> }">
  72. <div class="panel-heading clearfix">
  73. <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
  74. <i class="fa fa-map-marker color1" aria-hidden="true"></i>
  75. Localisation (commune)
  76. </h4>
  77. <div class="pull-right">
  78. <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="commune"></span>
  79. </div>
  80. </div>
  81. <div class="panel-body" style="text-align: center;">
  82. <span>
  83. <b><span data-picker="commune.nom">@contenu.Commune</span ></b >
  84. <br />Canton : <span data-picker="commune.canton">@contenu.Canton</span >
  85. <br />TAD : <span data-picker="commune.tad">@contenu.TAD</span >
  86. <br />CDC : <span data-picker="commune.cdc">@contenu.CDC</span >
  87. </span>
  88. </div>
  89. </div>
  90. @Html.ValidationMessageFor(model => contenu.Commune, "", new { @class = "text-danger" })
  91. </div>
  92. </div>
  93. <div class="form-group">
  94. @Html.LabelFor(model => contenu.Tel, htmlAttributes: new { @class = "control-label col-md-2" })
  95. <div class="col-md-10">
  96. @Html.EditorFor(model => contenu.Tel, new { htmlAttributes = new { @class = "form-control" } })
  97. @Html.ValidationMessageFor(model => contenu.Tel, "", new { @class = "text-danger" })
  98. </div>
  99. </div>
  100. <div class="form-group">
  101. @Html.LabelFor(model => contenu.Fax, htmlAttributes: new { @class = "control-label col-md-2" })
  102. <div class="col-md-10">
  103. @Html.EditorFor(model => contenu.Fax, new { htmlAttributes = new { @class = "form-control" } })
  104. @Html.ValidationMessageFor(model => contenu.Fax, "", new { @class = "text-danger" })
  105. </div>
  106. </div>
  107. <div class="form-group">
  108. @Html.LabelFor(model => contenu.Email, htmlAttributes: new { @class = "control-label col-md-2" })
  109. <div class="col-md-10">
  110. @Html.EditorFor(model => contenu.Email, new { htmlAttributes = new { @class = "form-control" } })
  111. @Html.ValidationMessageFor(model => contenu.Email, "", new { @class = "text-danger" })
  112. </div>
  113. </div>
  114. <div class="form-group">
  115. <div class="col-md-offset-2 col-md-10">
  116. <input type="submit" value="@Model.Acces.EnumDisplayNameFor(MvcHtmlHelpers.DisplayValue.Prompt)" class="btn btn-default" /> |
  117. @if (Model.Acces == ModeAcces.Creation)
  118. { @Html.ActionLink("Annuler", "Index") }
  119. else
  120. { @Html.ActionLink("Annuler", "Details", new { Id = Model.College_Id }) }
  121. </div>
  122. </div>
  123. </div>
  124. </fieldset>
  125. }
  126. @section Scripts {
  127. <script type="text/javascript">
  128. $(".removeItem").click(function () {
  129. switch ($(this).data("type")) {
  130. case 'commune':
  131. $('#Code_Postal').val(null);
  132. $('#Commune_Insee').val(null);
  133. $('#Commune').val(null);
  134. $('#Canton').val(null);
  135. $('#Territoire_Id').val(null);
  136. $('#TAD').val(null);
  137. $('#CDC').val(null);
  138. $('#Commune_Panel').hide();
  139. break;
  140. default:
  141. return false;
  142. }
  143. });
  144. </script>
  145. @Scripts.Render("~/bundles/jqueryval")
  146. }