AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.80
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/drivermanagement.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Drivermanagement extends MY_Controller {

  function __construct()
  {
     parent::__construct();
     $this->load->helper("url");
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->library('javascript');
     $this->load->library('Ajax_pagination');
     $this->perPage = ROW_PER_PAGE;
     $this->load->model('driver_model');
     $this->load->model('dashboard_model');
     $this->load->model('menumanagement_model');
     $this->load->model('dashboard_model');
     $session_data = $this->session->userdata('logged_in');
      if($this->session->userdata('user_language'))
      {
          $language = $this->session->userdata('user_language');
      }
      else
      {
          $language = $this->config->item("language");
      }
      $data['user_language'] =  $language;
      $this->lang->load('superAdmin', $language);
  }

  function index($SearchBy = '')
  {
    if ($this->input->server('REQUEST_METHOD') == 'POST') {
      if ($this->input->post('EditId') == '') {
        $this->addDriver();
      }
      else if ($this->input->post('EditId') != ''){
        $this->editDriver();
      }
    }
    else {
      $this->showDriverList($SearchBy);
    }
  }
  /************************Driver Management*************************/
  function showDriverList($SearchBy = '') {
    //total rows count
    $totalRec = count($this->driver_model->get_driver_list());
    
    //pagination configuration
    $config['target']      = '#postListPending';
    $config['base_url']    = base_url().'drivermanagement/ajaxPaginationDataPending/'.$SearchBy;
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $this->perPage;
    $this->ajax_pagination->initialize($config);
    
    //get the posts data
    $pending = '0';
    $approved = '1';
    $rejected = '2';
    $data['PendingDriverList'] = $this->driver_model->get_driver_list(array('limit'=>$this->perPage), $SearchBy = $pending);
    $data['ApprovedDriverList'] = $this->driver_model->get_driver_list(array('limit'=>$this->perPage), $SearchBy = $approved);
    $data['RejectedDriverList'] = $this->driver_model->get_driver_list(array('limit'=>$this->perPage), $SearchBy = $rejected);

    $myMonths = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
    $myDevices = array('1' => 'iPhone', '2' => 'Android');
    $myVehicles = array('1' => 'Bicycle', '2' => 'Car', '3' => 'Scooter', '4' => 'Motorcycle', '5' => 'Walker');

    $data['myMonths'] = $myMonths;
    $data['myDevices'] = $myDevices;
    $data['myVehicles'] = $myVehicles;

    $data['StateList'] =$this->dashboard_model->StateList();
    $data['CityList'] =$this->dashboard_model->GetCityByState();

    $data['title']="Driver";  
    $data['page']="drivermanagement"; 
    $this->load->view('superadmin/header',$data);
    $this->load->view('superadmin/main-sidebar');
    $this->load->view('superadmin/drivermanagement');
    $this->load->view('superadmin/footer');
  }
  function getDriverDataOriginal() {
    $driver_id = $this->input->post('driver_id');
    $data = $this->driver_model->getDriverDataOriginal($driver_id);
    echo json_encode($data);
  }
  function ajaxPaginationDataPending(){
    $action = $this->input->post('action');
    $page = $this->input->post('page');
    if(!$page){
        $offset = 0;
    }else{
        $offset = $page;
    }
    $perpage = $this->input->post('per_page');
    if(!$perpage){
        $perpage = $this->perPage;
    }else{
        $perpage = $perpage;
    }
    
    //total rows count
    $totalRec = count($this->driver_model->get_driver_list());
    
    //pagination configuration
    $config['target']      = '#postListPending';
    $config['base_url']    = base_url().'drivermanagement/ajaxPaginationDataPending';
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $perpage;
    $this->ajax_pagination->initialize($config);
    
    //get the posts data
    $pending = '0';
    $approved = '1';
    $rejected = '2';
    $data['PendingDriverList'] = $this->driver_model->get_driver_list(array('start'=>$offset,'limit'=>$perpage), $SearchBy = $pending);
    $data['title']="Driver";  
    $data['page']="driver"; 
    $this->load->view('superadmin/driver-pending-list-ajax', $data, false);
  }
  function ajaxPaginationDataApproved(){
    $action = $this->input->post('action');
    $page = $this->input->post('page');
    if(!$page){
        $offset = 0;
    }else{
        $offset = $page;
    }
    $perpage = $this->input->post('per_page');
    if(!$perpage){
        $perpage = $this->perPage;
    }else{
        $perpage = $perpage;
    }
    
    //total rows count
    $totalRec = count($this->driver_model->get_driver_list());
    
    //pagination configuration
    $config['target']      = '#postListApproved';
    $config['base_url']    = base_url().'drivermanagement/ajaxPaginationDataApproved';
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $perpage;
    $this->ajax_pagination->initialize($config);
    
    //get the posts data
    $pending = '0';
    $approved = '1';
    $rejected = '2';
    $data['ApprovedDriverList'] = $this->driver_model->get_driver_list(array('start'=>$offset,'limit'=>$perpage), $SearchBy = $approved);
    $data['title']="Driver";  
    $data['page']="driver"; 
    $this->load->view('superadmin/driver-approved-list-ajax', $data, false);
  }
  function addDriver() {
    /*echo "<pre>";
    print_r ($this->input->post());
    echo "</pre>";
    exit();*/
    $this->form_validation->set_rules('driver_email', 'Email address', 'trim|required|callback_isEmailExist');
    $now = date('Y-m-d H:i:s');
    if ($this->form_validation->run() == FALSE) {
      $this->showDriverList();
    }
    else {
      if ($_FILES['driver_license_photo']['name'] != '') {
        $driver_license_photo = $this->do_upload_license_image('driver_license_photo');
        //$driver_license_photo = str_replace(' ', '_', $_FILES['driver_license_photo']['name']);
      }
      else {
        $driver_license_photo = '';
      }
      if ($_FILES['driver_insurance_photo']['name'] != '') {
        $driver_insurance_photo = $this->do_upload_insurance_image('driver_insurance_photo');
        //$driver_insurance_photo = str_replace(' ', '_', $_FILES['driver_insurance_photo']['name']);
      }
      else {
        $driver_insurance_photo = '';
      }
      $this->db->trans_start();

      if ($this->input->post('driver_dob')) {
        $date1 = str_replace('/', '-', $this->input->post('driver_dob'));
        $date_array = explode('-', $date1);
        $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
        $driver_dob  = date("Y-m-d", strtotime($date1));
      }
      else {
        $driver_dob  = date("Y-m-d");
      }
      
      if ($this->input->post('driver_license_dob')) {
        $date1 = str_replace('/', '-', $this->input->post('driver_license_dob'));
        $date_array = explode('-', $date1);
        $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
        $driver_license_dob  = date("Y-m-d", strtotime($date1));
      }
      else {
        $driver_license_dob  = date("Y-m-d");
      }
      
      if ($this->input->post('driver_license_expire_dob')) {
        $date1 = str_replace('/', '-', $this->input->post('driver_license_expire_dob'));
        $date_array = explode('-', $date1);
        $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
        $driver_license_expire_dob  = date("Y-m-d", strtotime($date1));
      }
      else {
        $driver_license_expire_dob  = date("Y-m-d");
      }
        //FOR AUS
        $ownVehicle      = $this->input->post('ownVehicle');
        $ageConfirm      = $this->input->post('ageConfirm');
        $hasWorkPermit      = $this->input->post('hasWorkPermit');
        $hasABN      = $this->input->post('hasABN');
        $workingHour      = $this->input->post('workingHour');

      $data_in = array(
        'restaurant_id'               =>  0,
        'driver_email'                =>  $this->input->post('driver_email'),
        'driver_first_name'           =>  $this->input->post('driver_first_name'),
        'driver_last_name'            =>  $this->input->post('driver_last_name'),
        'driver_middle_name'          =>  $this->input->post('driver_middle_name'),
        'driver_dob'                  =>  $driver_dob,
        'driver_mobile_number'        =>  $this->input->post('driver_mobile_number'),
        'driver_device'               =>  $this->input->post('driver_device'),
        'driver_city'                 =>  $this->input->post('driver_city'),
        'driver_vehicle_type'         =>  $this->input->post('driver_vehicle_type'),
        'driver_vehicle_make'         =>  $this->input->post('driver_vehicle_make'),
        'driver_vehicle_model'        =>  $this->input->post('driver_vehicle_model'),
        'driver_vehicle_year'         =>  $this->input->post('driver_vehicle_year'),
        'driver_license_first_name'   =>  $this->input->post('driver_license_first_name'),
        'driver_license_last_name'    =>  $this->input->post('driver_license_last_name'),
        'driver_license_middle_name'  =>  $this->input->post('driver_license_middle_name'),
        'driver_license_dob'          =>  $driver_license_dob,
        'driver_license_number'       =>  $this->input->post('driver_license_number'),
        'driver_license_plate_number' =>  $this->input->post('driver_license_plate_number'),
        'driver_license_state'        =>  $this->input->post('driver_license_state'),
        'driver_license_expire_dob'   =>  $driver_license_expire_dob,
        'driver_license_photo'        =>  $driver_license_photo,
        'driver_insurance_provider'   =>  $this->input->post('driver_insurance_provider'),
        'driver_insurance_number'     =>  $this->input->post('driver_insurance_number'),
        'driver_insurance_photo'      =>  $driver_insurance_photo,
        'addeddate'                   =>  $now,
        'driver_street_address'     =>  $this->input->post('driver_street_address'),
        'driver_social_security_number'     =>  $this->input->post('driver_social_security_number'),
        'driver_zipcode'     =>  $this->input->post('driver_zipcode'),
        'driver_validate'     =>  '1',
        'driver_password'     =>  md5($this->input->post('driver_password')),
        'payee_name'              =>  $this->input->post('payee_name'),
        'driver_bank_ac_no'       =>  $this->input->post('driver_bank_ac_no'),
        'is_savings_account'      =>  $this->input->post('is_savings_account'),
        'is_personal_account'     =>  $this->input->post('is_personal_account'),
        'driver_swift_code'       =>  $this->input->post('driver_swift_code'),
        'driver_routine_no'       =>  $this->input->post('driver_routine_no')
      );
        $data_in['own_vehicle']    = $ownVehicle;
        $data_in['age_confirm']     = $ageConfirm;
        $data_in['has_work_permit'] = $hasWorkPermit;
        $data_in['has_abn']         = $hasABN;
        $data_in['working_hour']    = $workingHour;
      $this->db->insert('rt_driver', $data_in);
      $this->db->trans_complete();
      $this->session->set_flashdata('success_msg', 'Driver is successfully saved');
      redirect('superadmin/drivermanagement');
    }
  }
  function editDriver() {
    /*echo "<pre>";
    print_r ($this->input->post());
    echo "</pre>";
    exit();*/
    $this->form_validation->set_rules('driver_email', 'Email address', 'trim|required|callback_isEmailExist');
    if ($this->form_validation->run() == FALSE) {
      $this->showDriverList();
    }
    else {
      $EditId = $this->input->post('EditId');
      if ($_FILES['driver_license_photo']['name'] != '') {
        $driver_license_photo = $this->do_upload_license_image('driver_license_photo');
        //$driver_license_photo = str_replace(' ', '_', $_FILES['driver_license_photo']['name']);
      }
      else {
        $driver_license_photo = '';
      }
      if ($_FILES['driver_insurance_photo']['name'] != '') {
        $driver_insurance_photo = $this->do_upload_insurance_image('driver_insurance_photo');
        //$driver_insurance_photo = str_replace(' ', '_', $_FILES['driver_insurance_photo']['name']);
      }
      else {
        $driver_insurance_photo = '';
      }
     /* $driver_dob = str_replace('/', '-', $this->input->post('driver_dob'));
      $driver_dob = date('Y-m-d', strtotime($driver_dob));
      $driver_license_dob = str_replace('/', '-', $this->input->post('driver_license_dob'));
      $driver_license_dob = date('Y-m-d', strtotime($driver_license_dob));
      $driver_license_expire_dob = str_replace('/', '-', $this->input->post('driver_license_expire_dob'));
      $driver_license_expire_dob = date('Y-m-d', strtotime($driver_license_expire_dob));*/
      if ($this->input->post('driver_dob') != '') {
        $date1 = str_replace('/', '-', $this->input->post('driver_dob'));
        $date_array = explode('-', $date1);
        $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
        $driver_dob  = date("Y-m-d", strtotime($date1));
      }
      else {
        $driver_dob = '';
      }
      
      
      if ($this->input->post('driver_license_dob') != '') {
        $date1 = str_replace('/', '-', $this->input->post('driver_license_dob'));
        $date_array = explode('-', $date1);
        $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
        $driver_license_dob  = date("Y-m-d", strtotime($date1));
      }
      
      if ($this->input->post('driver_license_expire_dob') != '') {
        $date1 = str_replace('/', '-', $this->input->post('driver_license_expire_dob'));
        $date_array = explode('-', $date1);
        $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
        $driver_license_expire_dob  = date("Y-m-d", strtotime($date1));
      }
    //FOR AUS
    $ownVehicle      = $this->input->post('ownVehicle');
    $ageConfirm      = $this->input->post('ageConfirm');
    $hasWorkPermit      = $this->input->post('hasWorkPermit');
    $hasABN      = $this->input->post('hasABN');
    $workingHour      = $this->input->post('workingHour');
        $data_up = array();
        $data_up['driver_email'] =  $this->input->post('driver_email');
        $data_up['driver_first_name'] =  $this->input->post('driver_first_name');
        $data_up['driver_last_name'] =  $this->input->post('driver_last_name');
        $data_up['driver_middle_name'] =  $this->input->post('driver_middle_name');
        $data_up['driver_dob'] =  $driver_dob;
        $data_up['driver_mobile_number'] =  $this->input->post('driver_mobile_number');
        $data_up['driver_device'] =  $this->input->post('driver_device');
        $data_up['driver_state'] =  $this->input->post('driver_state');
        $data_up['driver_city'] =  $this->input->post('driver_city');
        $data_up['driver_vehicle_type'] =  $this->input->post('driver_vehicle_type');
        $data_up['driver_vehicle_make'] =  $this->input->post('driver_vehicle_make');
        $data_up['driver_vehicle_model'] =  $this->input->post('driver_vehicle_model');
        $data_up['driver_vehicle_year'] =  $this->input->post('driver_vehicle_year');
        $data_up['driver_license_first_name'] =  $this->input->post('driver_license_first_name');
        $data_up['driver_license_last_name'] =  $this->input->post('driver_license_last_name');
        $data_up['driver_license_middle_name'] =  $this->input->post('driver_license_middle_name');
        $data_up['driver_license_dob'] =  $driver_license_dob;
        $data_up['driver_license_number'] =  $this->input->post('driver_license_number');
        $data_up['driver_license_plate_number'] =  $this->input->post('driver_license_plate_number');
        $data_up['driver_license_state'] =  $this->input->post('driver_license_state');
        $data_up['driver_license_expire_dob'] =  $driver_license_expire_dob;
        $data_up['driver_license_photo'] =  $driver_license_photo;
        $data_up['driver_insurance_provider'] =  $this->input->post('driver_insurance_provider');
        $data_up['driver_insurance_number'] =  $this->input->post('driver_insurance_number');
        $data_up['driver_street_address'] =  $this->input->post('driver_street_address');
        $data_up['driver_social_security_number'] =  $this->input->post('driver_social_security_number');
        $data_up['driver_zipcode'] =  $this->input->post('driver_zipcode');
        $data_up['payee_name'] =  $this->input->post('payee_name');
        $data_up['driver_bank_ac_no'] =  $this->input->post('driver_bank_ac_no');
        $data_up['is_savings_account'] =  $this->input->post('is_savings_account');
        $data_up['is_personal_account'] =  $this->input->post('is_personal_account');
        $data_up['driver_swift_code'] =  $this->input->post('driver_swift_code');
        $data_up['driver_routine_no'] =  $this->input->post('driver_routine_no');

        if ($this->input->post('driver_password') != '') {
            $data_up['driver_password'] = md5($this->input->post('driver_password'));
        }
        $data_up['own_vehicle']    = $ownVehicle;
        $data_up['age_confirm']     = $ageConfirm;
        $data_up['has_work_permit'] = $hasWorkPermit;
        $data_up['has_abn']         = $hasABN;
        $data_up['working_hour']    = $workingHour;
      $this->db->trans_start();
      $this->db->where('driver_id', $EditId);
      $this->db->update('rt_driver', $data_up);
      $this->db->trans_complete();
      $this->session->set_flashdata('success_msg', 'Driver is successfully updated');
      redirect('superadmin/drivermanagement');
    }
  }
  function isEmailExist() {
    $driver_id = $this->input->post('EditId');
    if ($driver_id == '') {
      $driver_id = 0;
    }
    $driver_email = $this->input->post('driver_email');
    $isEmailExists = $this->driver_model->isEmailExist($driver_email,$driver_id);
    if ($isEmailExists) {
      $this->form_validation->set_message('isEmailExist', 'Email already exist');
      return false;
    }
    else {
      return true;
    }
  }
  function do_upload_license_image($db_field_name, $old_photo_name = '') {
    $rendid = date('Ymdhis');
    $last_name = $this->input->post('driver_last_name');
    $filename = $_FILES['driver_license_photo']['name'];
    $vid_ext_arr  = explode(".",$filename);
    $vid_ext_arr_cnt= count($vid_ext_arr);
    $vid_ext    = strtolower($vid_ext_arr[$vid_ext_arr_cnt-1]);
    $new_name = $last_name.'_DLImage_'.$rendid.'.'.$vid_ext;
    $config1 = array(
          'upload_path' => DRIVER_LICENSE_PATH_THUMBS,
          'allowed_types' => "gif|jpg|png|jpeg|pdf|doc|xml|docx",
          'overwrite' => TRUE,
          'file_name' => $new_name
          );
    $this->load->library('upload', $config1);
    $this->upload->initialize($config1);
    if($this->upload->do_upload($db_field_name))
    {
    return $new_name;
    }
    else {
    $error = $this->upload->display_errors();
    $this->session->set_flashdata('error_msg',  $error);
    $this->showDriverList();
    }
  }
  function do_upload_insurance_image($db_field_name, $old_photo_name = '') {
    $rendid = date('Ymdhis');
    $last_name = $this->input->post('driver_last_name');
    $filename = $_FILES['driver_insurance_photo']['name'];
    $vid_ext_arr  = explode(".",$filename);
    $vid_ext_arr_cnt= count($vid_ext_arr);
    $vid_ext    = strtolower($vid_ext_arr[$vid_ext_arr_cnt-1]);
    $new_name = $last_name.'_DIImage_'.$rendid.'.'.$vid_ext;
    $config1 = array(
          'upload_path' => DRIVER_INSURANCE_PATH_THUMBS,
          'allowed_types' => "gif|jpg|png|jpeg|pdf|doc|xml|docx",
          'overwrite' => TRUE,
          'file_name' => $new_name
          );
    $this->load->library('upload', $config1);
    $this->upload->initialize($config1);
    if($this->upload->do_upload($db_field_name))
    {
    
    return $new_name;
    }
    else {
    $error = $this->upload->display_errors();
    $this->session->set_flashdata('error_msg',  $error);
    $this->showDriverList();
    }
  }
  /*************************Driver Schedule*****************************/
  /*************************Driver Schedule*****************************/
  function driverschedule() {
    if ($this->input->server('REQUEST_METHOD') == 'POST') {
        $this->addSchedule();
    }
    else {
      $this->showAddSchedule();
    }
  }
  function showAddSchedule() {
    //$driver_per_day_array = $this->driver_model->getMainDriverSchedule();
    //$driver_per_day = $driver_per_day_array['driver_per_day'];
    $driver_schedule = $this->driver_model->getDriverSchedule();
    /*echo "<pre>";
    print_r($driver_schedule);
    echo "</pre>";
    exit();*/
    /*foreach ($driver_schedule as $key => $value) {
      echo date('Y-m-d h:i:s A', strtotime($value['driver_schedule_date'])).'<br>';
      date_default_timezone_set('America/Los_Angeles');
      echo date('Y-m-d h:i:s A', strtotime($value['driver_schedule_date'])).'<br>';
    }
    exit();*/
    //$data['driver_per_day'] = $driver_per_day;
    $data['addedSchedule'] = $driver_schedule;
    $data['title']="Driver Schedule";  
    $data['page']="driver_schedule"; 
    $this->load->view('superadmin/header',$data);
    $this->load->view('superadmin/main-sidebar');
    $this->load->view('superadmin/driver_schedule');
    $this->load->view('superadmin/footer');
  }
  function addSchedule() {


	
			$now = date('Y-m-d H:i:s');
			$driver_per_day_date = $this->input->post('driver_per_day_date');
			$driver_per_day_count = $this->input->post('driver_per_day_count');

			$date1 = str_replace('/', '-', $driver_per_day_date);
			$date_array = explode('-', $date1);
			$date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
			$driver_per_day_date  = date("Y-m-d", strtotime($date1));

			$schedule_exist = $this->driver_model->checkDriverSchedule($driver_per_day_date);
			
			if($schedule_exist)
			{
			  $this->db->trans_start();
			  $data_up = array('driver_schedule_date' => $driver_per_day_date,'driver_schedule_count' => $driver_per_day_count,'addeddate'=>  $now);
			  $this->db->where('id', $schedule_exist['id']);
			  $this->db->update('rt_driver_schedule', $data_up);
			  $this->db->trans_complete();
			}else{
			  $this->db->trans_start();
			  $data_up = array('driver_schedule_date' => $driver_per_day_date,'driver_schedule_count' => $driver_per_day_count,'addeddate'=>  $now);
			  $this->db->insert('rt_driver_schedule', $data_up);
			  $this->db->trans_complete();
			}
			if ($this->db->trans_status() === FALSE) {
				$this->session->set_flashdata('error_msg', 'Error Occurred.');
			}
			else {
				$this->session->set_flashdata('success_msg', 'Schedule Updated Successfully');
			}
			redirect('superadmin/drivermanagement/driverschedule');

	  
  }

  function checkDateFormat($driver_per_day_date) {
		
		if (preg_match("/[0-31]{2}\/[0-12]{2}\/[0-9]{4}/", $driver_per_day_date)) {
		if(checkdate(substr($driver_per_day_date, 3, 2), substr($driver_per_day_date, 0, 2), substr($driver_per_day_date, 6, 4)))
		return true;
		else
		return false;
		} else {
		return false;
		}
	} 

  function getVal() {
    $driver_per_day_date = $this->input->post('seldt');
    $date1 = str_replace('/', '-', $driver_per_day_date);
    $date_array = explode('-', $date1);
    $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
    $driver_per_day_date  = date("Y-m-d", strtotime($date1));

    $schedule_exist = $this->driver_model->checkDriverSchedule($driver_per_day_date);
    
    if($schedule_exist)
    {
      echo $schedule_exist['driver_schedule_count'];
    }else{
      echo '';
    }

  }


  function invoicelist()
  {
     $SearchBy = '1';
    $PerPage = $this->input->post('Per_Page');
    if(!$PerPage){
      $PerPage = $this->perPage;
    }else{
      $PerPage = $PerPage;
    }
    //total rows count
    $totalRec = count($this->driver_model->get_driver_invoice_list());
    //pagination configuration
    $config['target']      = '#postList';
    $config['base_url']    = base_url().'drivermanagement/ajaxPaginationDataInvoice/'.$SearchBy;
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $PerPage;
    $this->ajax_pagination->initialize($config);
    //get the posts data
    $data['InvoiceList'] = $this->driver_model->get_driver_invoice_list(array('limit'=>$PerPage), $SearchBy);
    
    $query['Driverlist'] = $this ->driver_model -> DriverList();
    //$query['CategoryList'] = $this ->driver_model -> CategoryList();
    $data['title']="Driver Invoice";  
    $query['SiteTab'] ='driver_invoice';
    $data['page']="driver_invoice";  
    $this->load->view('superadmin/header',$data);
    $this->load->view('superadmin/main-sidebar');
    $this->load->view('superadmin/driver_invoice_list',$query);
    $this->load->view('superadmin/footer');
  }


  function ajaxPaginationDataInvoice(){
    $page = $this->input->post('page');
    if(!$page){
        $offset = 0;
    }else{
        $offset = $page;
    }

    $action = $this->input->post('action');

    $perpage = $this->input->post('per_page');
    if(!$perpage){
        $perpage = $this->perPage;
    }else{
        $perpage = $perpage;
    }

    $action2 = $this->input->post('action2');
    if(!$action2){
        $action2 = '0';
    }else{
        $action2 = $action2;
    }
    
    //total rows count
    $totalRec = count($this->driver_model->get_driver_invoice_list($params = array(), $action,$action2));
    
    //pagination configuration
    $config['target']      = '#postList';
    $config['base_url']    = base_url().'drivermanagement/ajaxPaginationDataInvoice';
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $perpage;
    $config['action']      = $action;
    $config['action2']     = $action2;
    $this->ajax_pagination->initialize($config);
    
    //get the posts data
    $data['InvoiceList'] = $this->driver_model->get_driver_invoice_list(array('start'=>$offset,'limit'=>$perpage),$action,$action2);
    $data['title']="driver_invoice";  
    $data['page']="driver_invoice"; 
    /*** Remember what was the last page start ***/
    if ($this->input->post('pagination') != '') {
      $myPage = $this->input->post('page');
      $myAction = $this->input->post('action');
      $myPerPage = $this->input->post('per_page');
      $myAction2 = $this->input->post('action2');
      $paginationArray = array('page' => $myPage, 'action' => $myAction, 'per_page' => $myPerPage, 'action2' => $myAction2, 'page_name' => $data['page'], 'pagination' => $this->input->post('pagination'));
      if ($this->session->userdata('paginationArray')) {
        $this->session->unset_userdata('paginationArray');
      }
      $this->session->set_userdata('paginationArray', $paginationArray);
    }
    /*** Remember what was the last page end ***/
    $this->load->view('superadmin/driver_invoice_list_ajax', $data, false);
  }



  function driver_list()
  {
    $stst = $this->input->post('stst');

    $schedule_date = $this->input->post('popdate');
    //$schedule_date = '2016-09-27';
    $drivernm ='';
    $Driverlist = $this ->driver_model -> DriverAvailableList($schedule_date);
    if(is_array($Driverlist) && sizeof($Driverlist)>0)
    {
      $noofdriver = 0;
      $drivernm .="<div class='col-md-12' style='margin-bottom: 10px;'><div class='col-md-6 paddingleft0'><input type='hidden' id='searchScheduleDate' value='".$schedule_date."'><input type='text' placeholder='Search Driver' class='from-control' id='searchDriverSchedule' onkeyup='searchDriverSchedule(this.value)'><div id='auto_sug' style='display:none'></div></div><div class='col-md-6 paddingleft0'><button type='button' class='btn btn-info pull-right' onclick='driver_schedule_export()'>Export</button></div></div><div class='clearfix'></div>";
      foreach($Driverlist as $row) {  
        $noofdriver = $noofdriver+1;
        $isonlineicon= '<span class="red-dot"></span>';
        $isonline = $row->driver_availability_status;
        if($isonline==1)
        {
          $isAssigned = $this->driver_model->driverAssigned($row->driver_id);
          if ($isAssigned) {
            $isonlineicon= '<span class="yellow-dot"></span>';
          }
          else {
            $isonlineicon= '<span class="green-dot"></span>';
          }
          //$isonlineicon= '<span class="green-dot"></span>';
        }

        if($stst==1)
        {
          $head1 = 'Drivers applied : '.$noofdriver.'';
        }else{
          $head1 = 'Drivers List';
          $isonlineicon='';
        }

      $schedule_time_from  = date("g:i A", strtotime($row->schedule_time_from));
      $schedule_time_to  = date("g:i A", strtotime($row->schedule_time_to));

      $drivernm .="<div class='col-md-12 commonDriverScheduleRow' id='driverScheduleRow_".$row->driver_id."'><p class='col-md-6 paddingleft0' style='overflow: hidden; text-overflow: ellipsis;' id=''>".$isonlineicon." ".$row->driver_first_name." ".$row->driver_last_name."</p><p class='col-md-6 paddingleft0'>".$schedule_time_from."&nbsp; - &nbsp;".$schedule_time_to."</p></div>";

    }


    


    $datatable ='<div class="modal-dialog">

                   <!-- Modal content-->
                   <div class="modal-content">
                     <div class="modal-header" style="background-color: #45444E;color: white;">
                       <button type="button" class="close" data-dismiss="modal">&times;</button>
                       <h4 class="modal-title text-center">'.$head1.'</h4>
                     </div>
                     <div class="modal-body">
                       '.$drivernm.'
                     </div>
                     <div class="modal-footer">
                       <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                     </div>
                   </div>

                 </div>
                </div>';
    }else{

        $datatable ='<div class="modal-dialog">

                   <!-- Modal content-->
                   <div class="modal-content">
                     <div class="modal-header" style="background-color: #45444E;color: white;">
                       <button type="button" class="close" data-dismiss="modal">&times;</button>
                       <h4 class="modal-title text-center">Applied Driver List</h4>
                     </div>
                     <div class="modal-body">
                       <p>No Driver Available</p>
                     </div>
                     <div class="modal-footer">
                       <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                     </div>
                   </div>

                 </div>
                </div>';

    }

    echo $datatable;

  }

}

Anon7 - 2022
AnonSec Team