Create.cshtml 4.3 KB

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