Create.cshtml 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. @using CD67.FicheCollege.MVC.Models
  2. @model TerritoireViewModel
  3. @{
  4. ViewBag.Title = "Création";
  5. Layout = "~/Views/Shared/_Layout.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">
  60. <div class="col-md-offset-2 col-md-10">
  61. <input type="submit" value="Créer" class="btn btn-default" />
  62. </div>
  63. </div>
  64. </div>
  65. }
  66. <div>
  67. @Html.ActionLink("Retour à la liste", "Index")
  68. </div>
  69. @section Scripts {
  70. <script type="text/javascript">
  71. $(".removeItem").click(function () {
  72. switch ($(this).data("type")) {
  73. case 'referent':
  74. $('#Referent_SID').val(null);
  75. $('#Referent_Nom').val(null);
  76. $('#Referent_Prenom').val(null);
  77. $('#Referent_Structure').val(null);
  78. $('#Referent_Login').val(null);
  79. $('#Referent_Email').val(null);
  80. $('#Referent_Panel').hide();
  81. break;
  82. default:
  83. return false;
  84. }
  85. });
  86. </script>
  87. }