var/cache/dev/twig/cf/cf603dfaaf046953b593fd904a58709c.php line 45

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\CoreExtension;
  6. use Twig\Extension\SandboxExtension;
  7. use Twig\Markup;
  8. use Twig\Sandbox\SecurityError;
  9. use Twig\Sandbox\SecurityNotAllowedTagError;
  10. use Twig\Sandbox\SecurityNotAllowedFilterError;
  11. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  12. use Twig\Source;
  13. use Twig\Template;
  14. use Twig\TemplateWrapper;
  15. /* abscence_sheet/new.html.twig */
  16. class __TwigTemplate_1408f5c20fa379ff68d98da4d45ab0da extends Template
  17. {
  18. private Source $source;
  19. /**
  20. * @var array<string, Template>
  21. */
  22. private array $macros = [];
  23. public function __construct(Environment $env)
  24. {
  25. parent::__construct($env);
  26. $this->source = $this->getSourceContext();
  27. $this->blocks = [
  28. 'content' => [$this, 'block_content'],
  29. 'footer' => [$this, 'block_footer'],
  30. 'javascripts' => [$this, 'block_javascripts'],
  31. ];
  32. }
  33. protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
  34. {
  35. // line 1
  36. return "layout/backEndLayout.html.twig";
  37. }
  38. protected function doDisplay(array $context, array $blocks = []): iterable
  39. {
  40. $macros = $this->macros;
  41. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  42. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "abscence_sheet/new.html.twig"));
  43. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  44. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "abscence_sheet/new.html.twig"));
  45. $this->parent = $this->loadTemplate("layout/backEndLayout.html.twig", "abscence_sheet/new.html.twig", 1);
  46. yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
  47. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  48. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  49. }
  50. // line 3
  51. /**
  52. * @return iterable<null|scalar|\Stringable>
  53. */
  54. public function block_content(array $context, array $blocks = []): iterable
  55. {
  56. $macros = $this->macros;
  57. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  58. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "content"));
  59. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  60. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "content"));
  61. // line 4
  62. yield " \t";
  63. $this->env->getRuntime("Symfony\\Component\\Form\\FormRenderer")->setTheme((isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 4, $this->source); })()), ["bootstrap_4_layout.html.twig"], true);
  64. // line 5
  65. yield "\t\t\t <div class=\"col-12 jumbotron\" >
  66. \t \t\t\t\t<div class=\"row mt-4 mx-auto box-shadow\">
  67. \t\t\t\t\t\t<div class=\"card-header\">
  68. <h3 class=\"my-0 text-center text-justify text-uppercase\"> Nouvelle fiche d'abscences</h3>
  69. </div>
  70. \t\t\t\t\t\t<div class=\"mt-4 col-md-12 col-sm-12 table-responsive\">
  71. \t\t\t\t\t\t\t<div class=\"row\">
  72. \t\t\t\t\t\t\t\t<div class=\"col-3 table-responsive\"></div>
  73. \t\t\t\t\t\t\t\t<div class=\"col-6 table-responsive\">
  74. \t\t\t\t\t\t\t\t\t";
  75. // line 17
  76. yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock((isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 17, $this->source); })()), 'form_start', ["action" => $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("admin_abscences_sheet_create"), "attr" => ["class" => "evaluation"]]);
  77. yield "
  78. \t\t\t\t\t\t\t\t\t<p>
  79. \t\t\t\t\t\t\t\t\t\t";
  80. // line 19
  81. yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 19, $this->source); })()), "sequence", [], "any", false, false, false, 19), 'widget', ["attr" => ["class" => "ChoiceSequence"]]);
  82. yield "
  83. \t\t\t\t\t\t\t\t\t</p>
  84. \t\t\t\t\t\t\t\t\t<p>
  85. \t\t\t\t\t\t\t\t\t\t";
  86. // line 22
  87. yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 22, $this->source); })()), "classRoom", [], "any", false, false, false, 22), 'widget', ["attr" => ["name" => "ChoiceClassRoom"]]);
  88. yield "
  89. \t\t\t\t\t\t\t\t\t</p>
  90. <div class=\"row\">
  91. <div class=\"col-6\">
  92. \t\t\t\t\t\t\t\t\t\t";
  93. // line 26
  94. yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 26, $this->source); })()), "startDate", [], "any", false, false, false, 26), 'widget', ["attr" => ["name" => "StartDate"]]);
  95. yield "
  96. </div>
  97. <div class=\"col-6\">
  98. ";
  99. // line 29
  100. yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 29, $this->source); })()), "endDate", [], "any", false, false, false, 29), 'widget', ["attr" => ["name" => "EndDate"]]);
  101. yield "
  102. </div>
  103. \t\t\t\t\t\t\t\t\t</div>
  104. \t\t\t\t\t\t\t\t\t
  105. \t\t\t\t\t\t\t\t</div>
  106. \t\t\t\t\t\t\t\t<div class=\"col-3 table-responsive\"></div>
  107. \t\t\t\t\t\t\t</div>
  108. \t\t\t\t\t\t</div>
  109. \t\t\t\t\t\t<div id=\"ficheBodyStudents\" class=\" col-md-12 row\">
  110. \t\t\t\t\t\t\t";
  111. // line 39
  112. yield from $this->loadTemplate("abscence_sheet/liststudents.html.twig", "abscence_sheet/new.html.twig", 39)->unwrap()->yield($context);
  113. // line 40
  114. yield "\t\t\t\t\t\t</div>
  115. \t\t\t\t\t</div>
  116. \t\t\t\t\t<div class=\"row mt-2 mx-auto\">
  117. \t\t\t\t\t\t\t<div class=\" col-3\">
  118. \t\t\t\t\t\t\t</div>
  119. \t\t\t\t\t\t\t<div class=\" col-3 mx-auto btn-group d-inline-flex p-2 bd-highlight\">
  120. \t\t\t\t\t\t\t\t<button class=\"btn btn-danger\" type=\"submit\">
  121. \t\t\t\t\t\t\t\t\t<b>
  122. \t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-balance-scale\"></i>submit</b>
  123. \t\t\t\t\t\t\t\t</button>
  124. </div>
  125. \t\t\t\t\t\t\t<div class=\" col-3 mx-auto btn-group d-inline-flex p-2 bd-highligh\">
  126. \t\t\t\t\t\t\t\t<a class=\"btn btn-info\" href=\"";
  127. // line 52
  128. yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("admin_abscences_sheet_index");
  129. yield "\">
  130. \t\t\t\t\t\t\t\t\t<i class=\"fa fa-list\"></i>
  131. \t\t\t\t\t\t\t\t\t";
  132. // line 54
  133. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Back to the list", [], "admin"), "html", null, true);
  134. yield "
  135. \t\t\t\t\t\t\t\t</a>
  136. \t\t\t\t\t\t\t\t
  137. \t\t\t\t\t\t\t</div>
  138. \t\t\t\t\t\t\t<div class=\" col-3\">
  139. \t\t\t\t\t\t\t</div>
  140. \t\t\t\t\t</div>
  141. \t\t\t\t
  142. \t\t\t";
  143. // line 62
  144. yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock((isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 62, $this->source); })()), 'form_end');
  145. yield "
  146. \t\t</div>
  147. \t\t\t\t
  148. ";
  149. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  150. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  151. yield from [];
  152. }
  153. // line 66
  154. /**
  155. * @return iterable<null|scalar|\Stringable>
  156. */
  157. public function block_footer(array $context, array $blocks = []): iterable
  158. {
  159. $macros = $this->macros;
  160. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  161. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "footer"));
  162. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  163. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "footer"));
  164. // line 67
  165. yield "\t";
  166. yield from $this->yieldParentBlock("footer", $context, $blocks);
  167. yield "
  168. ";
  169. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  170. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  171. yield from [];
  172. }
  173. // line 70
  174. /**
  175. * @return iterable<null|scalar|\Stringable>
  176. */
  177. public function block_javascripts(array $context, array $blocks = []): iterable
  178. {
  179. $macros = $this->macros;
  180. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  181. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));
  182. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  183. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));
  184. // line 71
  185. yield "\t";
  186. yield from $this->yieldParentBlock("javascripts", $context, $blocks);
  187. yield "
  188. <script type=\"text/javascript\">
  189. \t\tvar classRoom = \$(\"#abscence_sheet_classRoom\");
  190. var idClassRoom, idSequence=\$(\"#abscence_sheet_sequence\").val(), startDate, endDate;
  191. classRoom.change(function () {
  192. \t\t\t\tidClassRoom = \$(\"#abscence_sheet_classRoom option:selected\").val();
  193. \t\t\t\t\$.ajax({
  194. \t\t\t\t\ttype: \"POST\",
  195. \t\t\t\t\turl: \"";
  196. // line 81
  197. yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("admin_abscence_list_students");
  198. yield "\",
  199. \t\t\t\t\tdata: {
  200. \t\t\t\t\tidClassRoom: idClassRoom
  201. \t\t\t\t\t},
  202. \t\t\t\t\tdatatype: \"json\",
  203. \t\t\t\t\tsuccess: function (data) {
  204. \t\t\t\t\t\t\$(\"#ficheBodyStudents\").html(data).show();
  205. \t\t\t\t\t}
  206. \t\t\t\t});
  207. \t\t\t});
  208. \t\t\t\$(\"#abscence_sheet_sequence\").change(function () {
  209. \t\t\t\tidSequence = \$(this).val();
  210. \t\t\t});
  211. \t\t\t\$(\"#abscence_sheet_startDate\").change(function () {
  212. \t\t\t\tstartDate = \$(this).val();
  213. \t\t\t});
  214. \t\t\t\$(\"#abscence_sheet_endDate\").change(function () {
  215. \t\t\t\tendDate = \$(this).val();
  216. \t\t\t});
  217. \t\t\t
  218. \t\t\$(function () {
  219. \t\t\t\$(document).on('submit', 'form', function (e) { // il est impératif de commencer avec cette méthode qui va empêcher le navigateur d'envoyer le formulaire lui-même
  220. \t\t\te.preventDefault();
  221. \t\t\tconsole.log(idClassRoom, idSequence, startDate, endDate);
  222. \t\t\tvar abscencesJson = [];
  223. \t\t\tif(startDate < endDate) {
  224. \t\t\t\t\t\$(\"input[max=180]\").each(function (index) {
  225. \t\t\t\t\t\tabscencesJson.push({\"matricule\": \$(this).attr('id'), \"weight\": \$(this).val(), \"raison\": \$(this).parent().next().children().val()});
  226. \t\t\t\t\t});
  227. \t\t\t\t\tconsole.log(abscencesJson);
  228. \t\t\t\t\tpostData = {
  229. \t\t\t\t\t\t\"abscences\": JSON.stringify(abscencesJson),
  230. \t\t\t\t\t\t\"idRoom\": idClassRoom,
  231. \t\t\t\t\t\t\"idSequence\": idSequence,
  232. \t\t\t\t\t\t\"startDate\": startDate,
  233. \t\t\t\t\t\t\"endDate\": endDate
  234. \t\t\t\t\t};
  235. \t\t\t\tif(abscencesJson.length>0){
  236. \t\t\t\t\$.ajax({
  237. \t\t\t\t\ttype: \"POST\",
  238. \t\t\t\t\turl: \"";
  239. // line 125
  240. yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("admin_abscences_sheet_create");
  241. yield "\",
  242. \t\t\t\t\tdata: postData,
  243. \t\t\t\t\tdatatype: \"json\",
  244. \t\t\t\t\tsuccess: function (data) {
  245. \t\t\t\t\t\talert(\"Enregistre avec succes.\");
  246. \t\t\t\t\t},
  247. \t\t\t\t\terror: function (e) {
  248. \t\t\t\t\t\tconsole.log(e.message);
  249. \t\t\t\t\t\talert(\"Echec.\");
  250. \t\t\t\t\t}
  251. \t\t\t\t\t});
  252. \t\t\t\t} else {
  253. \t\t\t\t\talert(\"Aucune abscence enregistree\");
  254. \t\t\t\t}
  255. \t\t\t
  256. \t\t\t} else {
  257. \t\t\t\talert(\"La date de debut doit etre anterieure a la date de fin\");
  258. \t\t\t}
  259. \t\t});
  260. \t\t});
  261. \t\t
  262. \t</script>
  263. ";
  264. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  265. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  266. yield from [];
  267. }
  268. /**
  269. * @codeCoverageIgnore
  270. */
  271. public function getTemplateName(): string
  272. {
  273. return "abscence_sheet/new.html.twig";
  274. }
  275. /**
  276. * @codeCoverageIgnore
  277. */
  278. public function isTraitable(): bool
  279. {
  280. return false;
  281. }
  282. /**
  283. * @codeCoverageIgnore
  284. */
  285. public function getDebugInfo(): array
  286. {
  287. return array ( 280 => 125, 233 => 81, 219 => 71, 206 => 70, 192 => 67, 179 => 66, 164 => 62, 153 => 54, 148 => 52, 134 => 40, 132 => 39, 119 => 29, 113 => 26, 106 => 22, 100 => 19, 95 => 17, 81 => 5, 78 => 4, 65 => 3, 42 => 1,);
  288. }
  289. public function getSourceContext(): Source
  290. {
  291. return new Source("{% extends 'layout/backEndLayout.html.twig' %}
  292. {% block content %}
  293. \t{% form_theme form 'bootstrap_4_layout.html.twig' %}
  294. \t\t\t <div class=\"col-12 jumbotron\" >
  295. \t \t\t\t\t<div class=\"row mt-4 mx-auto box-shadow\">
  296. \t\t\t\t\t\t<div class=\"card-header\">
  297. <h3 class=\"my-0 text-center text-justify text-uppercase\"> Nouvelle fiche d'abscences</h3>
  298. </div>
  299. \t\t\t\t\t\t<div class=\"mt-4 col-md-12 col-sm-12 table-responsive\">
  300. \t\t\t\t\t\t\t<div class=\"row\">
  301. \t\t\t\t\t\t\t\t<div class=\"col-3 table-responsive\"></div>
  302. \t\t\t\t\t\t\t\t<div class=\"col-6 table-responsive\">
  303. \t\t\t\t\t\t\t\t\t{{ form_start(form, {action: path('admin_abscences_sheet_create'),'attr': { 'class':'evaluation'} }) }}
  304. \t\t\t\t\t\t\t\t\t<p>
  305. \t\t\t\t\t\t\t\t\t\t{{ form_widget(form.sequence ,{'attr':{'class':'ChoiceSequence'} } ) }}
  306. \t\t\t\t\t\t\t\t\t</p>
  307. \t\t\t\t\t\t\t\t\t<p>
  308. \t\t\t\t\t\t\t\t\t\t{{ form_widget(form.classRoom,{'attr':{ 'name' :'ChoiceClassRoom'} }) }}
  309. \t\t\t\t\t\t\t\t\t</p>
  310. <div class=\"row\">
  311. <div class=\"col-6\">
  312. \t\t\t\t\t\t\t\t\t\t{{ form_widget(form.startDate,{'attr':{ 'name' :'StartDate'} }) }}
  313. </div>
  314. <div class=\"col-6\">
  315. {{ form_widget(form.endDate,{'attr':{ 'name' :'EndDate'} }) }}
  316. </div>
  317. \t\t\t\t\t\t\t\t\t</div>
  318. \t\t\t\t\t\t\t\t\t
  319. \t\t\t\t\t\t\t\t</div>
  320. \t\t\t\t\t\t\t\t<div class=\"col-3 table-responsive\"></div>
  321. \t\t\t\t\t\t\t</div>
  322. \t\t\t\t\t\t</div>
  323. \t\t\t\t\t\t<div id=\"ficheBodyStudents\" class=\" col-md-12 row\">
  324. \t\t\t\t\t\t\t{% include \"abscence_sheet/liststudents.html.twig\" %}
  325. \t\t\t\t\t\t</div>
  326. \t\t\t\t\t</div>
  327. \t\t\t\t\t<div class=\"row mt-2 mx-auto\">
  328. \t\t\t\t\t\t\t<div class=\" col-3\">
  329. \t\t\t\t\t\t\t</div>
  330. \t\t\t\t\t\t\t<div class=\" col-3 mx-auto btn-group d-inline-flex p-2 bd-highlight\">
  331. \t\t\t\t\t\t\t\t<button class=\"btn btn-danger\" type=\"submit\">
  332. \t\t\t\t\t\t\t\t\t<b>
  333. \t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-balance-scale\"></i>submit</b>
  334. \t\t\t\t\t\t\t\t</button>
  335. </div>
  336. \t\t\t\t\t\t\t<div class=\" col-3 mx-auto btn-group d-inline-flex p-2 bd-highligh\">
  337. \t\t\t\t\t\t\t\t<a class=\"btn btn-info\" href=\"{{ path('admin_abscences_sheet_index') }}\">
  338. \t\t\t\t\t\t\t\t\t<i class=\"fa fa-list\"></i>
  339. \t\t\t\t\t\t\t\t\t{{ 'Back to the list'|trans({}, 'admin') }}
  340. \t\t\t\t\t\t\t\t</a>
  341. \t\t\t\t\t\t\t\t
  342. \t\t\t\t\t\t\t</div>
  343. \t\t\t\t\t\t\t<div class=\" col-3\">
  344. \t\t\t\t\t\t\t</div>
  345. \t\t\t\t\t</div>
  346. \t\t\t\t
  347. \t\t\t{{ form_end(form) }}
  348. \t\t</div>
  349. \t\t\t\t
  350. {% endblock %}
  351. {% block footer %}
  352. \t{{ parent() }}
  353. {% endblock %}
  354. {% block javascripts %}
  355. \t{{parent()}}
  356. <script type=\"text/javascript\">
  357. \t\tvar classRoom = \$(\"#abscence_sheet_classRoom\");
  358. var idClassRoom, idSequence=\$(\"#abscence_sheet_sequence\").val(), startDate, endDate;
  359. classRoom.change(function () {
  360. \t\t\t\tidClassRoom = \$(\"#abscence_sheet_classRoom option:selected\").val();
  361. \t\t\t\t\$.ajax({
  362. \t\t\t\t\ttype: \"POST\",
  363. \t\t\t\t\turl: \"{{ path('admin_abscence_list_students') }}\",
  364. \t\t\t\t\tdata: {
  365. \t\t\t\t\tidClassRoom: idClassRoom
  366. \t\t\t\t\t},
  367. \t\t\t\t\tdatatype: \"json\",
  368. \t\t\t\t\tsuccess: function (data) {
  369. \t\t\t\t\t\t\$(\"#ficheBodyStudents\").html(data).show();
  370. \t\t\t\t\t}
  371. \t\t\t\t});
  372. \t\t\t});
  373. \t\t\t\$(\"#abscence_sheet_sequence\").change(function () {
  374. \t\t\t\tidSequence = \$(this).val();
  375. \t\t\t});
  376. \t\t\t\$(\"#abscence_sheet_startDate\").change(function () {
  377. \t\t\t\tstartDate = \$(this).val();
  378. \t\t\t});
  379. \t\t\t\$(\"#abscence_sheet_endDate\").change(function () {
  380. \t\t\t\tendDate = \$(this).val();
  381. \t\t\t});
  382. \t\t\t
  383. \t\t\$(function () {
  384. \t\t\t\$(document).on('submit', 'form', function (e) { // il est impératif de commencer avec cette méthode qui va empêcher le navigateur d'envoyer le formulaire lui-même
  385. \t\t\te.preventDefault();
  386. \t\t\tconsole.log(idClassRoom, idSequence, startDate, endDate);
  387. \t\t\tvar abscencesJson = [];
  388. \t\t\tif(startDate < endDate) {
  389. \t\t\t\t\t\$(\"input[max=180]\").each(function (index) {
  390. \t\t\t\t\t\tabscencesJson.push({\"matricule\": \$(this).attr('id'), \"weight\": \$(this).val(), \"raison\": \$(this).parent().next().children().val()});
  391. \t\t\t\t\t});
  392. \t\t\t\t\tconsole.log(abscencesJson);
  393. \t\t\t\t\tpostData = {
  394. \t\t\t\t\t\t\"abscences\": JSON.stringify(abscencesJson),
  395. \t\t\t\t\t\t\"idRoom\": idClassRoom,
  396. \t\t\t\t\t\t\"idSequence\": idSequence,
  397. \t\t\t\t\t\t\"startDate\": startDate,
  398. \t\t\t\t\t\t\"endDate\": endDate
  399. \t\t\t\t\t};
  400. \t\t\t\tif(abscencesJson.length>0){
  401. \t\t\t\t\$.ajax({
  402. \t\t\t\t\ttype: \"POST\",
  403. \t\t\t\t\turl: \"{{ path('admin_abscences_sheet_create') }}\",
  404. \t\t\t\t\tdata: postData,
  405. \t\t\t\t\tdatatype: \"json\",
  406. \t\t\t\t\tsuccess: function (data) {
  407. \t\t\t\t\t\talert(\"Enregistre avec succes.\");
  408. \t\t\t\t\t},
  409. \t\t\t\t\terror: function (e) {
  410. \t\t\t\t\t\tconsole.log(e.message);
  411. \t\t\t\t\t\talert(\"Echec.\");
  412. \t\t\t\t\t}
  413. \t\t\t\t\t});
  414. \t\t\t\t} else {
  415. \t\t\t\t\talert(\"Aucune abscence enregistree\");
  416. \t\t\t\t}
  417. \t\t\t
  418. \t\t\t} else {
  419. \t\t\t\talert(\"La date de debut doit etre anterieure a la date de fin\");
  420. \t\t\t}
  421. \t\t});
  422. \t\t});
  423. \t\t
  424. \t</script>
  425. {% endblock javascripts %}
  426. ", "abscence_sheet/new.html.twig", "/var/www/prod/liveedu/templates/abscence_sheet/new.html.twig");
  427. }
  428. }