
<div class="breadcrumb">
    <h1>Reminder Notification Event</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Reminder Notification Event list</li>
    </ul>
</div>


<form action="" method="post">
<div class="row">
    <div class="col-lg-12 col-md-12">
        <div class="card mb-5">
            <div class="card-body">
                <div class="row row-xs">
                    
                    <div class="col-md-3 mt-3 mt-md-0"  id="div_clinic_id">
                        <label for="clinic_id">ClinicId</label>
                        <select class="form-control" id="clinic_id" name="clinic_id" multiple name="clinic_id[]">
                            <!-- <option value="">Select Clinic</option> -->
                            <?php
                                  $clinicobj = new clinic;
                                  $fields = array('clinic_id,clinic_name');
                                  $clinicArg = array("fields"=>$fields);
                                  $clinicdata = $clinicobj->getAllRecords($clinicArg);
                                  foreach ($clinicdata as $ckey => $clinic_value) 
                                    { 
                                      ?>
                                        <option value="<?php echo $clinic_value->clinic_id; ?>"><?php echo $clinic_value->clinic_name; ?></option>
                              <?php }
                            ?>

                        </select>
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_event_appointment_id">
                        <label for="event_appointment_id">AppointmentId</label>
                        <input type="text" class="form-control" name="event_appointment_id" id="event_appointment_id" />
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_appointment_external_id">
                        <label for="appointment_external_id">Appointmnet External Id</label>    
                        <input type="text" class="form-control" name="appointment_external_id" id="appointment_external_id" />
                    
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_patient_external_id">
                        <label for="patient_external_id">Patient External Id</label>    
                        <input type="text" class="form-control" name="patient_external_id" id="patient_external_id" />
                    
                    </div>

                    <!-- <div class="col-md-2 mt-3 mt-md-0"  id="div_fullname">
                        <label for="fullname">Patient Name</label>
                        <input type="text" class="form-control" name="fullname" id="fullname" />
                    </div> -->


                    <div class="col-md-2 mt-3 mt-md-0"  id="div_dependant_firstname">
                        <label for="dependant_firstname">Patient First Name</label>
                        <input type="text" class="form-control" name="dependant_firstname" id="dependant_firstname"  />
                    </div>


                    <div class="col-md-2 mt-3 mt-md-0"  id="div_dependant_lastname">
                        <br/>
                        <label for="dependant_lastname">Patient Last Name</label>
                        <input type="text" class="form-control" name="dependant_lastname" id="dependant_lastname"  />
                    </div>

                    
                    <!-- <div class="col-md-2 mt-3 mt-md-0"  id="div_event_app_srno">
                        <br/>
                        <label for="event_name_app_srno">PMS Appoinment Sr No</label>
                        <input type="text" class="form-control" name="event_name_app_srno" id="event_name_app_srno" />
                    </div> -->

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_reminder_event">
                        <br/>
                        <label for="reminder_event">Event</label>
                        <select id="reminder_event" name="reminder_event" class="form-control">
                            <option value="">Select event</option>
                            <option value="reminder">Reminder</option>
                            <option value="emergencyreminder">Emergency</option>
                            <option value="followupreminder">Followupreminder</option>
                        </select>
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_event_type">
                        <br/>
                        <label for="event_type">Notification type</label>
                        <select id="event_type" name="event_type" class="form-control">
                            <option value="">Select event type</option>
                            <option value="email">Email</option>
                            <option value="sms">SMS</option>
                            <option value="appnotification">App Notification</option>
                            <option value="inactivepatient">Inactive Patient</option>
                        </select>
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_app_status">
                        <br/>
                        <label for="app_status">Xcare Status</label>
                        <select class="form-control" name="app_status" id="app_status">
                            <option value="">Select Status</option>
                            <option value="requested">requested</option>
                            <option value="scheduled">scheduled</option>
                            <option value="completed">completed</option>
                            <option value="cancelled">cancelled</option>
                        </select>
                    </div>

                    <div class="col-md-2" id="div_reminder_appotiment_date">
                      <br/>
                      <label for="reminder_appotiment_date">Appointment Date</label>
                      <input type="date" class="form-control" id="reminder_appotiment_date" name="reminder_appotiment_date" >

                    </div>

                    <div class="col-md-2" id="div_reminder_eventfire_date">
                      <br/>
                      <label for="reminder_eventfire_date">Event Date</label>
                      <input type="date" class="form-control" id="reminder_eventfire_date" name="reminder_eventfire_date" >

                    </div>

                    <div class="col-md-2 mt-3 mt-md-0">
                        <br/>
                        <label for="">&nbsp;</label>
                        <button type="submit" name="submit" class="btn btn-primary btn-block">Search</button>
                    </div>
                    <div class="col-md-2 mt-3 mt-md-0">
                        <br/>
                        <label for="">&nbsp;</label>
                        <button type="reset" name="reset" class="btn btn-primary btn-block" onClick="window.location.reload()">Reset</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</form>

<div class="separator-breadcrumb border-top"></div>

<div class="row mb-4">
  <div class="col-md-6">
        <!-- <select id="act" name="act" class="form-control maction">
          <option value="">Multiple action</option>              
          <option value="activate_all">Activate selected</option>
          <option value="inactivate_all">Inactivate selected</option>
          <option value="delete_all">Delete selected</option>
        </select>
        <button type="button" class="btn btn-primary m-1" onclick="return validate_all();">Apply</button> -->
  </div> 
</div>     
<div class="widget-body">
    <div class="portlet-body">
                        
    <?php echo (isset($successMsg) && $successMsg!='') ? "<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($successMsg)."</div>" : '' ; ?>
    <?php echo (isset($failedMsg) && $failedMsg!='') ? "<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($failedMsg)."</div>" : '' ?>
   
    <div id="status_msg" style="display: none;"><div class="alert alert-success"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>
    <div id="alert_msg" style="display: none;"><div class="alert alert-danger"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>

    </div>
</div>

<div class="row mb-4">
    <div class="col-md-12 mb-4">
        <div class="card text-left">

            <div class="card-body">
                <div class="table-responsive">
                  <form id="listFrm" name="listFrm" action="" method="post">       
                    <input type="hidden" id="action" name="action" value="">
                    <table id="list" class="display table table-striped table-bordered" style="width:100%">
                        <thead>
                            <tr>
                                <th>Id</th>
                                <th>Appoinment Detail</th>
                                <th>Clinic Detail</th>
                                <th>Patient Detail</th>
                                <th>Event</th>
                                <th>Notification Status</th>
                            </tr>
                        </thead>
                    </table>
                  </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- <link href="./assets/styles/css/select2.min.css" rel="stylesheet" />
<script src="./assets/js/select2.min.js"></script> -->

<!-- <style type="text/css">
.select2 {
  width: 150px !important;
}
</style> -->

<script src="./assets/js/jquery.multiselect.js"></script>
<link rel="stylesheet" href="./assets/styles/css/jquery.multiselect.css">

<script type="application/javascript">
   $(document).ready(function() {

      /*$("#clinic_id").select2({
          tags: true
      });*/

      $('#clinic_id').multiselect({
            columns: 1,
            placeholder: 'Select Clinic',
            search: true,
            selectAll: true
        });

   	  $('#list').DataTable( { 
          "data": [],
          "pageLength": 25,
                "aaSorting": [],
                "aoColumnDefs": [
                    { 'bSortable': false, 'aTargets': [0] }
                ],
          language: {
                    "sEmptyTable" :  "No records found. Please click Search."
          }
          
      } );	

      $( "form" ).on( "submit", function(e) {
        e.preventDefault();
        var cliniId = $("#clinic_id").val();
        var event_appointment_id = $("#event_appointment_id").val();
        //var event_name = $("#event_name").val();
        var app_status = $("#app_status").val();
        //var fullname = $("#fullname").val();
        var dependant_firstname = $("#dependant_firstname").val();
        var dependant_lastname = $("#dependant_lastname").val();
        //var event_name_app_srno = $("#event_name_app_srno").val();
        var reminder_event = $("#reminder_event").val();
        var event_type = $("#event_type").val();
        var reminder_appotiment_date = $("#reminder_appotiment_date").val();
        var reminder_eventfire_date = $("#reminder_eventfire_date").val();
        var appointment_external_id = $("#appointment_external_id").val();
        var patient_external_id = $("#patient_external_id").val();

        $('#list').DataTable().destroy();
          $('#list').DataTable( { 
            "ajax": "remindermessagecenterlist.php?act=load&clinic_id="+cliniId+"&event_appointment_id="+event_appointment_id+"&app_status="+app_status+"&firstname="+dependant_firstname+"&lastname="+dependant_lastname+"&reminder_event="+reminder_event+"&event_type="+event_type+"&appotiment_date="+reminder_appotiment_date+"&event_date="+reminder_eventfire_date+"&appointment_external_id="+appointment_external_id+"&patient_external_id="+patient_external_id,
            "processing": true,
            "serverSide": true,
            "pageLength": 25,
                  "aaSorting": [],
                  "aoColumnDefs": [
                      { 'bSortable': false, 'aTargets': [0] }
                  ],
            language: {
                "processing" : "<div class='loader-bubble loader-bubble-primary m-5'></div>",
                "sEmptyTable" :  "No records found."
            }
            
        } );

      });
    });
</script>