templates/case_laboratory/add_sample.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Add Test Sample{% endblock %}
  3. {% block content %}
  4. <div class="kt-subheader kt-grid__item"></div>
  5. <div class="kt-container kt-grid__item kt-grid__item--fluid">
  6.     <div class="kt-portlet kt-portlet--mobile">
  7.         <div class="kt-portlet__head kt-portlet__head--lg">
  8.             <div class="kt-portlet__head-label">
  9.                 <h3 class="kt-portlet__head-title">Add Test Sample</h3>
  10.             </div>
  11.             <div class="kt-portlet__head-toolbar">
  12.                 <div class="kt-portlet__head-wrapper">
  13.                     <a href="{{ path('case_lab_test') }}" class="btn btn-clean btn-icon-sm"><i
  14.                             class="la la-long-arrow-left"></i>Back</a>
  15.                 </div>
  16.             </div>
  17.         </div>
  18.         <div class="kt-portlet__body">
  19.             {% include 'parts/flash.html.twig' %}
  20.             <div class="accordion accordion-toggle-arrow" id="case-details">
  21.                 <div class="card">
  22.                     <div class="card-header" id="patient-info-heading">
  23.                         <div class="card-title" data-toggle="collapse" data-target="#patient-info" aria-expanded="true"
  24.                             aria-controls="patient-info">
  25.                             Patient Information
  26.                         </div>
  27.                     </div>
  28.                     <div id="patient-info" class="show" aria-labelledby="patient-info-label"
  29.                         data-parent="#case-details">
  30.                         <div class="card-body">
  31.                             {{ render(controller('App\\Controller\\PatientController::personalInfo', {'id':
  32.                             patient_id})) }}
  33.                         </div>
  34.                     </div>
  35.                 </div>
  36.                 <div class="card">
  37.                     <div class="card-header" id="sample-heading">
  38.                         <div class="card-title" data-toggle="collapse" data-target="#case-samples" aria-expanded="true"
  39.                             aria-controls="case-samples">
  40.                             Collect Samples
  41.                         </div>
  42.                     </div>
  43.                     <div id="case-samples" class="show" aria-labelledby="sample-label" data-parent="#case-details">
  44.                         <div class="card-body">
  45.                             <div class="row">
  46.                                 <div class="col col-lg-6">
  47.                                     {{ form_start(form, {'attr': {'class': 'kt-form' } }) }}
  48.                                     <div class="kt-portlet__body">
  49.                                         <div class="form-group row">
  50.                                             {{ form_label(form.type, '', {'label_attr': { 'class': 'col-form-label
  51.                                             col-lg-3 col-sm-12 font-weight-bold' }}) }}
  52.                                             <div class="col-lg-4 col-md-9 col-sm-12">
  53.                                                 {{ form_widget(form.type, {'attr': { 'class': 'form-control
  54.                                                 select-picker' }}) }}
  55.                                                 {{ form_errors(form.type) }}
  56.                                             </div>
  57.                                             <button type="submit" class="btn btn-brand">Add Sample</button>
  58.                                         </div>
  59.                                     </div>
  60.                                     {{ form_end(form) }}
  61.                                 </div>
  62.                                 <div class="col col-lg-6">
  63.                                     <div class="kt-portlet__body">
  64.                                         <table class="table table-striped table-bordered table-hover">
  65.                                             <thead>
  66.                                                 <tr>
  67.                                                     <th>Type</th>
  68.                                                     <th>Sample No.</th>
  69.                                                     <th width="5%">Action</th>
  70.                                                 </tr>
  71.                                             </thead>
  72.                                             <tbody>
  73.                                                 {% for sample in samples %}
  74.                                                 <tr>
  75.                                                     <td>{{ sample.type }}</td>
  76.                                                     <td>{{ sample.number }}</td>
  77.                                                     <td class="text-center">
  78.                                                         <a href="{{ path('case_lab_sample_delete', {'id': sample.id | nzo_encrypt}) }}"
  79.                                                             onclick="return confirm('Are you sure?');"
  80.                                                             data-toggle="kt-tooltip" title="Delete Sample">
  81.                                                             <i class="fa far fa-trash fa-2x kt-font-danger"></i>
  82.                                                         </a>
  83.                                                     </td>
  84.                                                 </tr>
  85.                                                 {% else %}
  86.                                                 <td colspan="3" class="text-center">No records found</td>
  87.                                                 {% endfor %}
  88.                                             </tbody>
  89.                                         </table>
  90.                                     </div>
  91.                                     <div class="kt-portlet__foot">
  92.                                         <div class="kt-form__actions text-right">
  93.                                             <button type="button" class="btn btn-brand">Print Labels</button>
  94.                                         </div>
  95.                                     </div>
  96.                                 </div>
  97.                             </div>
  98.                         </div>
  99.                     </div>
  100.                 </div>
  101.                 <div class="card">
  102.                     <div class="card-header" id="tests-info-heading">
  103.                         <div class="card-title" data-toggle="collapse" data-target="#tests-info" aria-expanded="true"
  104.                             aria-controls="tests-info">
  105.                             Tests to be done
  106.                         </div>
  107.                     </div>
  108.                     <div id="tests-info" class="show" aria-labelledby="tests-info-label" data-parent="#case-details">
  109.                         <div class="card-body">
  110.                             <form id="case_lab_test_form" class="kt-form" method="post"
  111.                                 action="{{ path('case_lab_add_test_sample', {'case_id': case_id}) }}">
  112.                                 <div class="kt-portlet__body">
  113.                                     <table class="table table-striped table-bordered table-hover table-checkable"
  114.                                         id="kt_table_2">
  115.                                         <thead>
  116.                                             <tr>
  117.                                                 <th width="50">
  118.                                                     <label
  119.                                                         class="kt-checkbox kt-checkbox--single kt-checkbox--bold kt-checkbox--brand">
  120.                                                         <input id="header_checkbox" type="checkbox"
  121.                                                             class="kt-group-checkable">
  122.                                                         <span></span>
  123.                                                     </label>
  124.                                                 </th>
  125.                                                 <th>Test Name</th>
  126.                                                 <th>Method</th>
  127.                                                 <th>Normal Range</th>
  128.                                                 <th width="300">Sample No.</th>
  129.                                                 <th>Send To</th>
  130.                                             </tr>
  131.                                         </thead>
  132.                                         <tbody>
  133.                                             {% for test in tests %}
  134.                                             <tr>
  135.                                                 <td>
  136.                                                     <label
  137.                                                         class="kt-checkbox kt-checkbox--single kt-checkbox--bold kt-checkbox--brand">
  138.                                                         <input data-chkReport="chkReport{{ loop.index }}"
  139.                                                             type="checkbox" name="confirm_samples[]"
  140.                                                             value="{{ loop.index }}" {% if test.sample_id %} checked{%
  141.                                                             endif %} class="kt-group-checkable" {% if test.result %}
  142.                                                             disabled{% endif %}>
  143.                                                         <span></span>
  144.                                                     </label>
  145.                                                     {% if not test.result %}
  146.                                                     <input type="hidden" name="tests[{{ loop.index }}]"
  147.                                                         value="{{ test.id }}">
  148.                                                     {% endif %}
  149.                                                 </td>
  150.                                                 <td>{{ test.test_name }}</td>
  151.                                                 <td>
  152.                                                     {% if test.method_names %}
  153.                                                     {% set methods = test.method_names|split(',') %}
  154.                                                     <ul>
  155.                                                         {% for method in methods %}
  156.                                                         <li>{{ method }}</li>
  157.                                                         {% endfor %}
  158.                                                     </ul>
  159.                                                     {% else %}
  160.                                                     &mdash;
  161.                                                     {% endif %}
  162.                                                 </td>
  163.                                                 <td>
  164.                                                     {% if test.normal_range %}
  165.                                                     {% set ranges = test.normal_range|split(',') %}
  166.                                                     <ul>
  167.                                                         {% for range in ranges %}
  168.                                                         <li>{{ range }}</li>
  169.                                                         {% endfor %}
  170.                                                     </ul>
  171.                                                     {% else %}
  172.                                                     &mdash;
  173.                                                     {% endif %}
  174.                                                 </td>
  175.                                                 <td>
  176.                                                     <div class="form-group">
  177.                                                         <select name="samples[{{ loop.index }}]"
  178.                                                             data-dd-report="{{ loop.index }}"
  179.                                                             class="select-picker form-control" {% if test.result %}
  180.                                                             disabled{% endif %}>
  181.                                                             <option value="">Select Sample</option>
  182.                                                             {% if samples %}
  183.                                                             {% for sample in samples %}
  184.                                                             <option value="{{ sample.id }}" {% if
  185.                                                                 (sample.id==test.sample_id) %} selected {% endif %}>{{
  186.                                                                 sample.number }}</option>
  187.                                                             {% endfor %}
  188.                                                             {% endif %}
  189.                                                         </select>
  190.                                                     </div>
  191.                                                 </td>
  192.                                                 <td>
  193.                                                     <div class="form-group">
  194.                                                         <select name="hospitals[{{ loop.index }}]"
  195.                                                             data-dd-report="{{ loop.index }}"
  196.                                                             class="select-picker form-control" {% if test.result %}
  197.                                                             disabled{% endif %}>
  198.                                                             <option value="">Select Hospital</option>
  199.                                                             {% if hospitals %}
  200.                                                             {% for hospital in hospitals %}
  201.                                                             <option value="{{ hospital.id }}" {% if
  202.                                                                 (hospital.id==test.hospital_id) %} selected {% endif %}>
  203.                                                                 {{ hospital.name }}</option>
  204.                                                             {% endfor %}
  205.                                                             {% endif %}
  206.                                                         </select>
  207.                                                     </div>
  208.                                                 </td>
  209.                                             </tr>
  210.                                             {% else %}
  211.                                             <td colspan="6" class="text-center">No records found</td>
  212.                                             {% endfor %}
  213.                                         </tbody>
  214.                                     </table>
  215.                                 </div>
  216.                                 <div class="kt-portlet__foot">
  217.                                     <div class="kt-form__actions text-right">
  218.                                         {% if tests %}
  219.                                         <input type="submit" id="assign_sample" class="btn btn-brand">
  220.                                         {% endif %}
  221.                                     </div>
  222.                                 </div>
  223.                             </form>
  224.                         </div>
  225.                     </div>
  226.                 </div>
  227.             </div>
  228.         </div>
  229.     </div>
  230. </div>
  231. {% endblock %}
  232. {% block scripts %}
  233. {{ parent() }}
  234. <script>
  235.     $('.select-picker').selectpicker();
  236.     $('#header_checkbox').on('click', function () {
  237.         $("input[name='confirm_samples[]']:not(:disabled)").prop('checked', $(this).prop('checked'));
  238.     });
  239.     $('#case_lab_test_form').on('submit', function (e) {
  240.         e.preventDefault();
  241.         var isBlank = true, isValid = true;
  242.         $("input[name='confirm_samples[]']:checked").each(function () {
  243.             if (this.value) {
  244.                 isBlank = false;
  245.                 if (!$('select[name="samples[' + this.value + ']"]').val()) {
  246.                     isValid = false;
  247.                     swal.fire({
  248.                         text: "Please select sample of selected tests.",
  249.                         type: 'error',
  250.                         showCancelButton: true,
  251.                         showConfirmButton: false,
  252.                         animation: false,
  253.                         cancelButtonText: "Cancel",
  254.                         cancelButtonClass: "btn btn-default"
  255.                     });
  256.                     return false;
  257.                 }
  258.             }
  259.         });
  260.         if (isBlank) {
  261.             swal.fire({
  262.                 text: "Please select at least one sample!",
  263.                 type: 'info',
  264.                 animation: false,
  265.                 showCancelButton: true,
  266.                 showConfirmButton: false,
  267.                 cancelButtonText: "Cancel",
  268.                 cancelButtonClass: "btn btn-default"
  269.             });
  270.             return false;
  271.         } else {
  272.             if (isValid) {
  273.                 this.submit();
  274.             }
  275.         }
  276.     });
  277.     $('td select').on('change', function () {
  278.         if (this.value) {
  279.             if (!$('input[data-chkReport="chkReport' + $(this).data('dd-report') + '"]').is(':checked')) {
  280.                 swal.fire({
  281.                     text: "Please select the report to save report data.",
  282.                     type: 'info',
  283.                     animation: false,
  284.                     showCancelButton: true,
  285.                     showConfirmButton: false,
  286.                     cancelButtonText: "Cancel",
  287.                     cancelButtonClass: "btn btn-default"
  288.                 });
  289.             }
  290.         }
  291.     });
  292. </script>
  293. {% endblock %}