Edit.cshtml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. @using CD67.FicheCollege.MVC.Models
  2. @model TerritoireViewModel
  3. @{
  4. ViewBag.Title = "Modification";
  5. Layout = "~/Views/Shared/_AdminLayout.cshtml";
  6. Territoire territoire = Model.Obj;
  7. }
  8. <h2>Modification</h2>
  9. @using (Html.BeginForm())
  10. {
  11. @Html.AntiForgeryToken()
  12. <div class="form-horizontal">
  13. <h4>Territoire</h4>
  14. <hr />
  15. @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  16. @Html.HiddenFor(model => territoire.Id)
  17. @Html.HiddenFor(model => territoire.Ordre)
  18. <div class="form-group">
  19. @Html.LabelFor(model => territoire.Id, htmlAttributes: new { @class = "control-label col-md-2" })
  20. <div class="col-md-10">
  21. @Html.EditorFor(model => territoire.Id, new { htmlAttributes = new { @class = "form-control", @disabled = true } })
  22. @Html.ValidationMessageFor(model => territoire.Id, "", new { @class = "text-danger" })
  23. </div>
  24. </div>
  25. <div class="form-group">
  26. @Html.LabelFor(model => territoire.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
  27. <div class="col-md-10">
  28. @Html.EditorFor(model => territoire.Libelle, new { htmlAttributes = new { @class = "form-control" } })
  29. @Html.ValidationMessageFor(model => territoire.Libelle, "", new { @class = "text-danger" })
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. @Html.Label("Référent", htmlAttributes: new { @class = "control-label col-md-2" })
  34. <div class="col-md-4" data-picker-type="referent">
  35. @Html.HiddenFor(model => territoire.Referent_SID, new { data_picker = "agent.id" })
  36. @Html.HiddenFor(model => territoire.Referent_Nom, new { data_picker = "agent.nom" })
  37. @Html.HiddenFor(model => territoire.Referent_Prenom, new { data_picker = "agent.prenom" })
  38. @Html.HiddenFor(model => territoire.Referent_Structure, new { data_picker = "agent.chemin" })
  39. @Html.HiddenFor(model => territoire.Referent_Login, new { data_picker = "agent.login" })
  40. @Html.HiddenFor(model => territoire.Referent_Email, new { data_picker = "agent.mail" })
  41. <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/ad67/?type=referent" title="Selection d'un référent (nouvelle fenetre)">Sélectionner un référent</a>
  42. <br />
  43. <div class="panel panel-default" id="Referent_Panel" name="Referent_Panel" style="@if (territoire.Referent_SID == null) { <text>display: none;</text> }">
  44. <div class="panel-heading clearfix">
  45. <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
  46. <i class="fa fa-user color1" aria-hidden="true"></i>
  47. Agent
  48. </h4>
  49. <div class="pull-right">
  50. <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="referent"></span>
  51. </div>
  52. </div>
  53. <div class="panel-body" style="text-align: center;">
  54. <b><span data-picker="agent.prenom">@territoire.Referent_Prenom</span> <span data-picker="agent.nom">@territoire.Referent_Nom</span></b>
  55. <br /><span data-picker="agent.chemin">@territoire.Referent_Structure</span>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="form-group btn-bar">
  61. <a href=@Url.Action("Index") class="btn btn-default">Annuler</a>
  62. <input type="submit" value="Enregistrer" class="btn btn-primary" />
  63. </div>
  64. </div>
  65. }
  66. @section Scripts {
  67. <script type="text/javascript">
  68. $(".removeItem").click(function () {
  69. switch ($(this).data("type")) {
  70. case 'referent':
  71. $('#Referent_SID').val(null);
  72. $('#Referent_Nom').val(null);
  73. $('#Referent_Prenom').val(null);
  74. $('#Referent_Structure').val(null);
  75. $('#Referent_Login').val(null);
  76. $('#Referent_Email').val(null);
  77. $('#Referent_Panel').hide();
  78. break;
  79. default:
  80. return false;
  81. }
  82. });
  83. </script>
  84. }