Commit 6d302e54 by Tobin

daily commit

parent fb2d85e1
...@@ -38,80 +38,170 @@ class Ride extends CI_Controller { ...@@ -38,80 +38,170 @@ class Ride extends CI_Controller {
$this->load->view('template',$template); $this->load->view('template',$template);
} }
function import(){ function excelMapping(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); $flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_FILES) || empty($_FILES) || !isset($_FILES['csv_file']) || empty($_FILES['csv_file']) || !isset($_POST) || empty($_POST) || !isset($_POST['broker_id']) || empty($_POST['broker_id'])|| !isset($_POST['company_id']) || empty($_POST['company_id'])){ if(!isset($_FILES) || empty($_FILES) || !isset($_FILES['import_file']) || empty($_FILES['import_file']) ||
!isset($_POST) || empty($_POST) || !isset($_POST['broker_id']) || empty($_POST['broker_id']) ||
!isset($_POST['company_id']) || empty($_POST['company_id'])){
$this->session->set_flashdata('message',$flashMsg); $this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/import_ride')); redirect(base_url('Ride/import_ride'));
} }
$fileType = '';
$importedFile = '';
$this->load->library('upload');
$config = set_upload_all_files("assets/uploads/upload_files");
$config['file_name'] = 'importFile'.date('dmyhis').$_FILES['import_file']['name'];
$this->upload->initialize($config);
$fileData = explode('.',$_FILES['import_file']['name']);
if($this->upload->do_upload('import_file') && !empty($fileData) &&
isset($fileData[1]) && !empty($fileData[1])){
$fileType = strtolower($fileData[1]);
$upload_data = $this->upload->data();
$importedFile = $config['upload_path']."/".$upload_data['file_name'];
} else {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/import_ride'));
}
$importData = '';
switch($fileType){
case 'csv':
$importData = $this->getImportDataCSV($importedFile,0);
break;
}
if(empty($importData) || !isset($importData['status']) || $importData['status'] == 3 ||
$importData['status'] == 4 || ($importData['status'] == 1 && empty($importData['headerArr']))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/import_ride'));
}
if ($importData['status'] == 2){
$flashMsg['message'] = "Please Choose a vaild file..!";
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/import_ride'));
}
$template['fileType'] = $fileType;
$template['headerArr'] = $importData['headerArr'];
$template['broker_id'] = $_POST['broker_id'];
$template['company_id'] = $_POST['company_id'];
$template['import_file'] = $importedFile;
$template['page'] = 'Ride/excel_mapping';
$template['menu'] = "Excel Import Manager";
$template['sub_menu'] = "Excel Field Mapping";
$template['page_title'] = "Ride Management";
$template['page_desc'] = "Excel Field Mapping";
$this->load->view('template',$template);
}
function getImportDataCSV($importedFile = '', $header = 0, $headerOrder = array()){
$retData = array('status'=>0);
if(empty($importedFile)){
return $retData;
}
if($header == 1 && empty($headerOrder)){
return 4;
}
$header = 0; $header = 0;
$insertArr = array(); $insertArr = array();
$headerArr = array(); $headerArr = array();
$insertData = array(); $insertData = array();
$medicalIds = array(); $customerIds = array();
$custInsrData = array(); $custInsrData = array();
if (($handle = fopen($_FILES['csv_file']['tmp_name'], "r")) !== FALSE) {
while (($row = fgetcsv($handle, 1000, ",")) !== FALSE) { if (($handle = fopen($importedFile, "r")) === FALSE) {
$colCnt = 0; $retData['status'] = 2;
$rowArr = array(); return $retData;
foreach($row as $col){ }
if($header == 0){
$col = str_replace(' ','_',$col); while (($row = fgetcsv($handle, 1000, ",")) !== FALSE) {
$col = preg_replace('/[^A-Za-z0-9\_\/]/', '', $col); $colCnt = 0;
$headerArr[] = $col; $rowArr = array();
}else{ foreach($row as $col){
if($headerArr[$colCnt] == 'Appointment_Date'){ if($header == 0){
$col = date('d-m-Y',strtotime($col)); $col = str_replace(' ','_',$col);
} $col = preg_replace('/[^A-Za-z0-9\_\/]/', '', $col);
if($headerArr[$colCnt] == 'Appointment_Time'){ $headerArr[] = $col;
$last = substr($col, -2); }else{
$col = str_replace($last,":".$last,$col); if($headerArr[$colCnt] == 'Appointment_Date'){
$col = (!empty($col))?date('G:i',strtotime($col)):''; $col = date('d-m-Y',strtotime($col));
}
$rowArr[$headerArr[$colCnt]] = $col;
$colCnt++;
}
}
if($header != 0){
$time = '12:00';
if(!empty($row[10])){
$last = substr($row[10], -2);
$time = str_replace($last,":".$last,$row[10]);
$time = (!empty($time))?date('G:i',strtotime($time)):'12:00';
} }
$date_time = (!empty($row[8]))?date('d-m-Y',strtotime($row[8])).' '.$time:''; if($headerArr[$colCnt] == 'Appointment_Time'){
$last = substr($col, -2);
$insertData = array('company_id'=>$_POST['company_id'],'broker_id'=>$_POST['broker_id'],'medical_no'=>$row[0],'patient_name'=>$row[2].' '.$row[1], $col = str_replace($last,":".$last,$col);
'age'=>$row[4],'phone'=>$row[5],'trip_no'=>$row[7],'reason_code'=>$row[11],'trip_cost'=>$row[22],'pickup_location'=>$row[23],'drop_location'=>$row[28], $col = (!empty($col))?date('G:i',strtotime($col)):'';
'trip_bid_status'=>$row[37],'trip_status'=>$row[12],'vehicle_type'=>$row[13],'trip_type'=>$row[14],
'data'=>json_encode($rowArr));
$insertData['appointment_time'] = strtotime($date_time);
$insertArr[] = $insertData;
$custData = $this->db->query("SELECT medical_id FROM customers WHERE medical_id='".$row[0]."' AND status <> '2'");
if(1 > $custData->num_rows() && !in_array($row[0],$medicalIds)){
$medicalIds[] = $row[0];
$custInsrData[] = array('medical_id'=>$row[0],'first_name'=>$row[2],
'last_name'=>$row[1],'date_of_birth'=>$row[3],
'age'=>$row[4],'phone'=>$row[5],'alt_phone'=>$row[6]);
} }
$rowArr[$headerArr[$colCnt]] = $col;
$colCnt++;
} }
$header = 1;
} }
fclose($handle); if(!empty($headerArr) && $header == 1){
$retData['status'] = 1;
$status = $this->Ride_model->uploadRides($insertArr,$custInsrData); $retData['headerArr'] = $headerArr;
if($status){ return $retData;
$flashMsg['class'] = "success";
$flashMsg['message'] = "Upload Scuccessfull";
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/view_rides'));
} }
}else{ if($header != 0){
$flashMsg['message'] = "Please Choose a valid File"; $time = '12:00';
if(!empty($row[10])){
$last = substr($row[10], -2);
$time = str_replace($last,":".$last,$row[10]);
$time = (!empty($time))?date('G:i',strtotime($time)):'12:00';
}
$date_time = (!empty($row[8]))?date('d-m-Y',strtotime($row[8])).' '.$time:'';
$insertData = array('company_id'=>$_POST['company_id'],'broker_id'=>$_POST['broker_id'],'medical_no'=>$row[0],'patient_name'=>$row[2].' '.$row[1],
'age'=>$row[4],'phone'=>$row[5],'trip_no'=>$row[7],'reason_code'=>$row[11],'trip_cost'=>$row[22],'pickup_location'=>$row[23],'drop_location'=>$row[28],
'trip_bid_status'=>$row[37],'trip_status'=>$row[12],'vehicle_type'=>$row[13],'trip_type'=>$row[14],
'data'=>json_encode($rowArr));
$insertData['appointment_time'] = strtotime($date_time);
$insertArr[] = $insertData;
$custData = $this->db->query("SELECT medical_id FROM customers WHERE medical_id='".$row[0]."' AND status <> '2'");
if(1 > $custData->num_rows() && !in_array($row[0],$customerIds)){
$medicalIds[] = $row[0];
$custInsrData[] = array('medical_id'=>$row[0],'first_name'=>$row[2],
'last_name'=>$row[1],'date_of_birth'=>$row[3],
'age'=>$row[4],'phone'=>$row[5],'alt_phone'=>$row[6]);
}
}
$header = 1;
} }
$this->session->set_flashdata('message',$flashMsg); fclose($handle);
redirect(base_url('Ride/import_ride'));
if(empty($insertArr)){
$retData['status'] = 3;
} else {
$retData['status'] = 1;
$retData['insertArr'] = $insertArr;
$retData['custInsrData'] = $custInsrData;
}
return $retData;
}
function import(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST) ||
!isset($_POST['broker_id']) || empty($_POST['broker_id']) ||
!isset($_POST['company_id']) || empty($_POST['company_id']) ||
!isset($_POST['header_order']) || empty($_POST['header_order']) ||
!isset($_POST['file_type']) || empty($_POST['file_type']) ||
!isset($_POST['import_file']) || empty($_POST['import_file'])){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/import_ride'));
}
$importData = $this->getImportDataCSV($_POST['import_file'],1,$_POST['header_order']);
} }
function create_ride(){ function create_ride(){
...@@ -358,5 +448,191 @@ class Ride extends CI_Controller { ...@@ -358,5 +448,191 @@ class Ride extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg); $this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/assign_driver/'.encode_param($ride_id))); redirect(base_url('Ride/assign_driver/'.encode_param($ride_id)));
} }
function changeSchuduleStatus(){
if(!isset($_POST) || empty($_POST) || !isset($_POST['transport_id']) || empty($_POST['transport_id']) ||
!isset($_POST['is_scheduled']) || $_POST['is_scheduled'] == ''){
echo json_encode($result);exit;
}
$ride_ids = $_POST['transport_id'];
$is_scheduled = ($_POST['is_scheduled'] == 1)?0:1;
$succArr = array();
if(is_array($ride_ids)){
foreach ($ride_ids AS $ride_id) {
$result = $this->changeScheduler($ride_id,$is_scheduled);
if($result['status'] == 1){
$succArr[] = $ride_id;
}
$result['succArr'] = $succArr;
}
} else {
$result = $this->changeScheduler($ride_ids,$is_scheduled);
if($result['status'] == 1){
$result['succArr'] = array($ride_ids);
}
}
echo json_encode($result);exit;
}
function changeScheduler($ride_id,$is_scheduled = '0'){
$result = array('status'=>'0');
if(empty($ride_id)){
return $result;
}
$status = $this->Ride_model->changeSchuduleStatus($ride_id,$is_scheduled);
if($status){
$result['status'] = 1;
if($is_scheduled == 1){
$ride_data = $this->Ride_model->getRideData($ride_id);
if(empty($ride_data)){
$result['status'] = 0;
$status = $this->Ride_model->changeSchuduleStatus($ride_id,0);
} else {
$pickup_location = $ride_data->pickup_location;
$appointment_time = $ride_data->appointment_time;
if(empty($pickup_location) || empty($appointment_time)){
$result['status'] = 0;
$status = $this->Ride_model->changeSchuduleStatus($ride_id,0);
}
$pickupLocData = $this->getLatLngFromLocation($pickup_location);
if(empty($pickupLocData)){
$result['status'] = 0;
$status = $this->Ride_model->changeSchuduleStatus($ride_id,0);
} else {
$status = $this->Ride_model->autoAssignDriver($ride_id,$appointment_time,
array('lat'=>$pickupLocData['lat'],'lng'=>$pickupLocData['lng']));
if(!$status){
$result['status'] = 0;
$status = $this->Ride_model->changeSchuduleStatus($ride_id,0);
}
}
}
}
}
return $result;
}
function getLatLngFromLocation($location = ''){
if(empty($location))
return 0;
$locData = file_get_contents("https://maps.google.com/maps/api/geocode/json?address=".
urlencode($location).
"&sensor=false&key=AIzaSyC9JX3BZZfx2S6GQieC_PqjuJdUbZ7_wyM");
if(empty($locData))
return 0;
$loc_data = json_decode($locData);
if(empty($loc_data))
return 0;
$locArr['lat'] = $loc_data->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$locArr['lng'] = $loc_data->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
if(empty($locArr['lat']) || empty($locArr['lng'])){
return 0;
}
return $locArr;
}
function scheduled_rides(){
if($this->session->userdata['user_type'] == 1){
redirect(base_url());
}
$this->load->model('Broker_model');
$template['page'] = 'Ride/scheduled_rides';
$template['page_title'] = "Scheduled Rides";
$template['page_desc'] = "View Scheduled Ride";
$template['menu'] = "Ride Management";
$template['sub_menu'] = "View Scheduled Rides";
$condArr = array();
if(isset($_POST) && isset($_POST['search_date']) && !empty($_POST['search_date'])){
$srtDateTime = strtotime($_POST['search_date']);
$endDateTime = strtotime($_POST['search_date'].' 23:59');
$condArr[] = " AND (TD.appointment_time>'$srtDateTime' AND TD.appointment_time<'$endDateTime') ";
}
$company_id = ($this->session->userdata['user_type'] != 1)?$this->session->userdata['id']:'';
$template['ride_data'] = $this->Ride_model->getRideData('',$company_id,'',1,$condArr);
$this->load->view('template',$template);
}
} }
// function import(){
// $flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
// if(!isset($_FILES) || empty($_FILES) || !isset($_FILES['csv_file']) || empty($_FILES['csv_file']) || !isset($_POST) || empty($_POST) || !isset($_POST['broker_id']) || empty($_POST['broker_id'])|| !isset($_POST['company_id']) || empty($_POST['company_id'])){
// $this->session->set_flashdata('message',$flashMsg);
// redirect(base_url('Ride/import_ride'));
// }
// $status = $this->Ride_model->uploadRides($insertArr,$custInsrData);
// if($status){
// $flashMsg['class'] = "success";
// $flashMsg['message'] = "Upload Scuccessfull";
// $this->session->set_flashdata('message',$flashMsg);
// redirect(base_url('Ride/view_rides'));
// }
// }else{
// $flashMsg['message'] = "Please Choose a valid File";
// }
// $this->session->set_flashdata('message',$flashMsg);
// redirect(base_url('Ride/import_ride'));
// }
// EXCEL EXPORT
// $allowedFileType = ['application/vnd.ms-excel','text/xls','text/xlsx',
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
// if(in_array($_FILES["import_file"]["type"],$allowedFileType)){
// $targetPath = 'uploads/'.$_FILES['import_file']['name'];
// move_uploaded_file($_FILES['import_file']['tmp_name'], $targetPath);
// $Reader = new SpreadsheetReader($targetPath);
// $sheetCount = count($Reader->sheets());
// for($i=0; $i<$sheetCount; $i++){
// $Reader->ChangeSheet($i);
// foreach ($Reader as $Row){
// $name = "";
// if(isset($Row[0])) {
// $name = mysqli_real_escape_string($conn,$Row[0]);
// }
// $description = "";
// if(isset($Row[1])) {
// $description = mysqli_real_escape_string($conn,$Row[1]);
// }
// if (!empty($name) || !empty($description)) {
// $query = "insert into tbl_info(name,description) values('".$name."','".$description."')";
// $result = mysqli_query($conn, $query);
// if (! empty($result)) {
// $type = "success";
// $message = "Excel Data Imported into the Database";
// } else {
// $type = "error";
// $message = "Problem in Importing Excel Data";
// }
// }
// }
// }
// } else {
// $type = "error";
// $message = "Invalid File Type. Upload Excel File.";
// }
?> ?>
\ No newline at end of file
...@@ -40,6 +40,16 @@ function set_upload_editservice($path){ ...@@ -40,6 +40,16 @@ function set_upload_editservice($path){
} }
function set_upload_all_files($path){
$config = array();
$config['upload_path'] = $path;
$config['allowed_types'] = '*';
$config['overwrite'] = FALSE;
return $config;
}
function remove_html(&$item, $key) function remove_html(&$item, $key)
{ {
$item = strip_tags($item); $item = strip_tags($item);
......
...@@ -42,14 +42,24 @@ class Ride_model extends CI_Model { ...@@ -42,14 +42,24 @@ class Ride_model extends CI_Model {
return ($status)?1:0; return ($status)?1:0;
} }
function getRideData($ride_id = '',$company_id = '',$broker_id = ''){ function getRideData($ride_id = '',$company_id = '',$broker_id = '',$scheduled = '',$condArr = array()){
$cond = (!empty($ride_id))?" AND TD.transport_id = '$ride_id'":""; $cond = (!empty($ride_id))?" AND TD.transport_id = '$ride_id'":"";
$cond .= ($broker_id != '')?" AND TD.broker_id = '$broker_id'":""; $cond .= ($broker_id != '')?" AND TD.broker_id = '$broker_id'":"";
$cond .= (!empty($company_id))?" AND TD.company_id = '$company_id'":""; $cond .= (!empty($company_id))?" AND TD.company_id = '$company_id'":"";
$sql = "SELECT TD.*,BK.broker_name,AR.reason,VH.vehicle_id,VH.vehicle_type,TT.trip_type,TS.trip_status if($scheduled != ''){
$cond .= " AND TD.is_scheduled = '$scheduled'";
}
if(!empty($condArr)){
$cond .= implode(' ', $condArr);
}
$sql = "SELECT TD.*,CONCAT(DV.first_name,' ',DV.last_name) AS assigned_driver_name,BK.broker_name,
AR.reason,VH.vehicle_id,VH.vehicle_type,TT.trip_type,TS.trip_status
FROM transport_details AS TD FROM transport_details AS TD
LEFT JOIN brokers AS BK ON (TD.broker_id = BK.broker_id) LEFT JOIN brokers AS BK ON (TD.broker_id = BK.broker_id)
LEFT JOIN drivers AS DV ON (DV.driver_id = TD.assigned_driver)
LEFT JOIN vehicles AS VH ON (VH.vehicle_id = TD.vehicle_type) LEFT JOIN vehicles AS VH ON (VH.vehicle_id = TD.vehicle_type)
LEFT JOIN trip_type AS TT ON (TT.trip_id = TD.trip_type) LEFT JOIN trip_type AS TT ON (TT.trip_id = TD.trip_type)
LEFT JOIN trip_status AS TS ON (TS.trip_status_id = TD.trip_status) LEFT JOIN trip_status AS TS ON (TS.trip_status_id = TD.trip_status)
...@@ -111,5 +121,84 @@ class Ride_model extends CI_Model { ...@@ -111,5 +121,84 @@ class Ride_model extends CI_Model {
return ($status)?1:0; return ($status)?1:0;
} }
function changeSchuduleStatus($ride_id = '',$is_scheduled = '0'){
if(empty($ride_id)){
return;
}
$status = $this->db->update('transport_details',
array('is_scheduled'=>$is_scheduled),
array('transport_id'=>$ride_id));
if($is_scheduled == 0){
$this->deleteAssignedRider($ride_id);
}
return $status;
}
function deleteAssignedRider($ride_id = ''){
if(empty($ride_id)){
return;
}
$this->db->delete('ride_status',array('ride_id'=>$ride_id));
}
function autoAssignDriver($ride_id = '',$appointment_time = '', $pickupLoc = array()){
if(empty($ride_id) || empty($appointment_time) || empty($pickupLoc) || !isset($pickupLoc['lat']) || $pickupLoc['lat'] == '' || !isset($pickupLoc['lng']) || $pickupLoc['lng'] == ''){
return;
}
$time = date("G:i",$appointment_time);
$date = date("d-m-y",$appointment_time);
$endTime = date("G:i",strtotime($time) + 60 * 60);
$startTime = date("G:i",strtotime($time) - 60 * 60);
$endDateTime = strtotime($date.' '.$endTime);
$startDateTime = strtotime($date.' '.$startTime);
$sql = "SELECT GROUP_CONCAT(TD.assigned_driver) AS assigned_drivers
FROM transport_details AS TD
WHERE TD.driver_assign_status='0' AND TD.assigned_driver<>'0' AND TD.is_scheduled='1' AND
TD.appointment_time>$startDateTime AND TD.appointment_time<$endDateTime AND
TD.status IN (4,5,8)";
$prvDrivers = $this->db->query($sql);
if(empty($prvDrivers)){
return 0;
}
$driverCond = '';
if($prvDrivers->num_rows() > 0){
$prvDrivers = $prvDrivers->row_array();
$driverCond = (isset($prvDrivers['assigned_drivers']) && !empty($prvDrivers['assigned_drivers']))?
'AND DRV.driver_id NOT IN ('.$prvDrivers['assigned_drivers'].')':'';
}
$sql = "SELECT DRV.driver_id,3956*2*ASIN(SQRT(POWER(SIN((".$pickupLoc['lat']."-DRV.lat_driver)*
pi()/180/2),2)+COS(".$pickupLoc['lat']."*pi()/180)*COS(DRV.lat_driver*pi()/180)*
POWER(SIN((".$pickupLoc['lng']."-DRV.lng_driver)*pi()/180/2),2))) AS distance
FROM drivers AS DRV
WHERE DRV.status = 1 ".$driverCond."
HAVING distance < 25
ORDER BY distance
LIMIT 0,1";
$driverData = $this->db->query($sql);
if(empty($driverData)){
return 0;
}
if($driverData->num_rows() > 0){
$nearByDriver = $driverData->row_array();
$nearByDriver = $nearByDriver['driver_id'];
$status = $this->db->update('transport_details',
array('driver_assign_status'=>'0','assigned_driver'=>$nearByDriver,'status'=>'3'),
array('transport_id'=>$ride_id));
} else {
$status = $this->db->update('transport_details',
array('driver_assign_status'=>'1','status'=>'3'),
array('transport_id'=>$ride_id));
}
return $status;
}
} }
?> ?>
\ No newline at end of file
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">Upload Ride</h3> <h3 class="box-title">Upload Ride</h3>
</div> </div>
<form role="form" action="<?=base_url('Ride/import')?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data"> <form role="form" action="<?=base_url('Ride/excelMapping')?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
<br> <br>
<div class="box-body"> <div class="box-body">
<div class="col-md-12"> <div class="col-md-12">
...@@ -231,7 +231,9 @@ ...@@ -231,7 +231,9 @@
<?php <?php
if(!empty($company_data)){ if(!empty($company_data)){
foreach ($company_data as $company) { foreach ($company_data as $company) {
echo '<option value="'.$company->company_id.'">'.$company->company_name.'</option>'; echo '<option value="'.$company->company_id.'">'.
$company->company_name.
'</option>';
} }
} }
?> ?>
...@@ -257,16 +259,17 @@ ...@@ -257,16 +259,17 @@
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<label>CSV File</label> <label>File to be Uploaded</label>
<input name="csv_file" type="file" accept=".csv" class="required" /> <input name="import_file" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
</div> class="required" />
</div>
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="box-footer"> <div class="box-footer">
<button type="submit" class="btn btn-primary">Upload</button> <button type="submit" class="btn btn-primary">Upload</button>
</div> </div>
</div> </div>
</div> </div>
<br> <br>
......
<?php
$headerArr = Array(0=>'Medicaid_Number',1=>'Members_Last_Name',2=>'Members_First_Name',
3=>'Members_Date_of_Birth',4=>'Members_Age',5=>'Members_Phone_Number',
6=>'Members_Alt_Phone',7=>'Trip_Number',8=>'Appointment_Date',
9=>'Appointment_Day_of_Week',10=>'Appointment_Time',11=>'Trip_Reason_Code',
12=>'Trip_Status',13=>'Vehicle_Type',14=>'Trip_Type',15=>'Wheelchair_Flag',
16=>'Crutches_\/_Walker_\/_Cane_Flag',17=>'Number_of_Car_Seats_Required',
18=>'Pregnant_Flag',19=>'Number_of_Additional_Passengers',
20=>'Additional_Passengers_With_Appointments',21=>'Trip_Mileage',22=>'Trip_Cost',
23=>'Pickup_Address',24=>'Pickup_City',25=>'Pickup_State',26=>'Pickup_Zip_Code',
27=>'Delivery_Name',28=>'Delivery_Address',29=>'Delivery_City',30=>'Delivery_State',
31=>'Delivery_Zip_Code',32=>'Delivery_Phone_Number',33=>'Special_Needs',
34=>'Inst_\/_Directions',35=>'Return_Time',36=>'Attendant_Flag',
37=>'Trip_Bid_Status',38=>'Date_Trip_Bid_Status_Was_Changed',
39=>'Confirmation_Number',40=>'Copay',41=>'Trip_Status_Date');
?>
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $page_title ?>
<small><?= $page_desc ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $sub_menu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6">
<h3 class="box-title">Excel Mapping</h3>
</div>
</div>
<div class="box-body">
<div class="col-md-7">
<div style="overflow:scroll;height:400px;">
<table id="mappedHeaders" class="border-cls" style="width:98%;">
<?php
foreach($headerArr AS $id => $header){
echo '<tr class="border-cls">
<td class="headtag-td">'.str_replace('_',' ',$header).'</td>
<td class="headtag-td">
<div type="child" class="drag-box" id="order_'.$id.'" ondrop="dropElement(event)"
ondragover="allowDropElement(event)" headOrder="'.$id.'"></div>
</td>
</tr>';
}
?>
</table>
</div>
</div>
<div class="col-md-5">
<div type="parent" class="header-tag-box" ondrop="dropElement(event)" ondragover="allowDropElement(event)">
<?php
if(!empty($headerArr)){
foreach ($headerArr AS $headID => $heading) { ?>
<div id="tempHead_<?= $headID ?>" class="header-tag" draggable="true"
ondragstart="dragElement(event)" tmporder="<?= $headID ?>">
<?= str_replace(array('/','_'),array('',' '),$heading) ?>
</div>
<?php }
}
?>
</div>
</div>
<div class="col-md-12 btn-mapping">
<button id="upload_excell" type="button" class="btn btn-primary" dmclick="0">Import Excell</button>
</div>
</div>
</div>
</div>
</div>
</section>
<input type="hidden" name="fileType" value="<?= $fileType ?>">
<input type="hidden" name="broker_id" value="<?= $broker_id ?>">
<input type="hidden" name="company_id" value="<?= $company_id ?>">
<input type="hidden" name="import_file" value="<?= $import_file ?>">
</div>
\ No newline at end of file
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $page_title ?>
<small><?= $page_desc ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $sub_menu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6">
<h3 class="box-title">Scheduled Rides</h3>
</div>
</div>
<div class="box-body">
<form action="<?= base_url('Ride/scheduled_rides') ?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
<div class="col-md-12">
<div class="form-group has-feedback">
<label>Appointment Date</label>
<div class="input-group date" data-provide="datepicker">
<input id="datepicker" type="text" class="form-control required" data-parsley-trigger="change" data-parsley-minlength="2" required="" name="search_date" placeholder="Search Date" autocomplete="off">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-2" style="float:right;padding:initial;">
<a class="btn btn-sm btn-primary" style="width: 150px;" href="<?= base_url('Ride/scheduled_rides') ?>">View All</a>
</div>
<div class="col-md-2" style="float:right;padding:initial;">
<button class="btn btn-sm btn-primary" style="width: 150px;" type="submit">Search</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<table class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="100px">Scheduled Time</th>
<th width="100px">Arrival Time</th>
<th width="100px">Coustomer Name</th>
<th width="100px">Mobility</th>
<th width="100px">Pick Up Address</th>
<th width="100px">Drop Off Address</th>
<th width="100px">Rider Status</th>
<th width="40px">View</th>
</tr>
</thead>
<tbody>
<?php
$report_data = array();
if(!empty($ride_data)){
foreach($ride_data as $ride) {
$json_ride = json_decode($ride->data,true);
if(empty($json_ride)){
continue;
} ?>
<tr>
<th class="hidden"><?= $ride->transport_id ?></th>
<th class="center">
<?= date("d-m-y G:i",$ride->appointment_time) ?>
</th>
<th class="center"></th>
<th class="center"><?= $ride->patient_name ?></th>
<th class="center"></th>
<th class="center"><?= $ride->pickup_location ?></th>
<th class="center"><?= $ride->drop_location ?></th>
<th class="center">
<?php
if(!empty($ride->assigned_driver) && $ride->driver_assign_status == '1'){
echo 'Driver Cancelled & Auto Assigned to Dispatcher';
} else if (empty($ride->assigned_driver) && $ride->driver_assign_status == '1'){
echo 'No Driver Found, ride assigned to dispatcher';
} else if (!empty($ride->assigned_driver) && $ride->driver_assign_status == '0' && !empty($ride->assigned_driver_name) && $ride->status == 3){
echo 'Waiting for driver response : Driver Name '.$ride->assigned_driver_name;
} else if (!empty($ride->assigned_driver) && $ride->driver_assign_status == '0' && !empty($ride->assigned_driver_name) && $ride->status == 4){
echo 'Driver Accepted : Driver Name '.$ride->assigned_driver_name;
}
?>
</th>
<th class="center">
<a id="viewRideDetails" key="<?= $ride->transport_id ?>" class="cpoint">
<i class="fa fa-fw fa-eye"></i>
</a>
</th>
</tr>
<?php
$report_data[$ride->transport_id] = $json_ride;
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript">
report_data = <?= json_encode($report_data); ?>;
</script>
\ No newline at end of file
<?php <?php
$headerArr = array("Medicaid_Number","Members_Last_Name","Members_First_Name","Members_Date_of_Birth","Members_Age","Members_Phone_Number","Members_Alt_Phone","Trip_Number","Appointment_Date","Appointment_Day_of_Week","Appointment_Time","Trip_Reason_Code","Trip_Status","Vehicle_Type","Trip_Type","Wheelchair_Flag","Crutches_\/_Walker_\/_Cane_Flag","Number_of_Car_Seats_Required","Pregnant_Flag","Number_of_Additional_Passengers","Additional_Passengers_With_Appointments","Trip_Mileage","Trip_Cost","Pickup_Address","Pickup_City","Pickup_State","Pickup_Zip_Code","Delivery_Name","Delivery_Address","Delivery_City","Delivery_State","Delivery_Zip_Code","Delivery_Phone_Number","Special_Needs","Inst_\/_Directions","Return_Time","Attendant_Flag","Trip_Bid_Status","Date_Trip_Bid_Status_Was_Changed","Confirmation_Number","Copay","Trip_Status_Date"); $headerArr = array("Medicaid_Number","Members_Last_Name","Members_First_Name","Members_Date_of_Birth","Members_Age","Members_Phone_Number","Members_Alt_Phone","Trip_Number","Appointment_Date","Appointment_Day_of_Week","Appointment_Time","Trip_Reason_Code","Trip_Status","Vehicle_Type","Trip_Type","Wheelchair_Flag","Crutches_\/_Walker_\/_Cane_Flag","Number_of_Car_Seats_Required","Pregnant_Flag","Number_of_Additional_Passengers","Additional_Passengers_With_Appointments","Trip_Mileage","Trip_Cost","Pickup_Address","Pickup_City","Pickup_State","Pickup_Zip_Code","Delivery_Name","Delivery_Address","Delivery_City","Delivery_State","Delivery_Zip_Code","Delivery_Phone_Number","Special_Needs","Inst_\/_Directions","Return_Time","Attendant_Flag","Trip_Bid_Status","Date_Trip_Bid_Status_Was_Changed","Confirmation_Number","Copay","Trip_Status_Date");
?> ?>
<div class="content-wrapper" > <div class="content-wrapper" >
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
...@@ -50,7 +49,7 @@ ...@@ -50,7 +49,7 @@
} }
} }
?> ?>
<option value="0" <?= ($broker_id == 0)?'selected':'' ?>>Phone Bookings</option> <option value="0" <?= ($broker_id != '' && $broker_id == 0)?'selected':'' ?>>Phone Bookings</option>
</select> </select>
</div> </div>
</div> </div>
...@@ -77,9 +76,11 @@ ...@@ -77,9 +76,11 @@
</thead> </thead>
<tbody> <tbody>
<?php <?php
$ride_ids = array();
$report_data = array(); $report_data = array();
if(!empty($ride_data)){ if(!empty($ride_data)){
foreach($ride_data as $ride) { foreach($ride_data as $ride) {
$ride_ids[] = $ride->transport_id;
$json_ride = json_decode($ride->data,true); $json_ride = json_decode($ride->data,true);
if(empty($json_ride)){ if(empty($json_ride)){
continue; continue;
...@@ -88,6 +89,16 @@ ...@@ -88,6 +89,16 @@
<tr> <tr>
<th class="hidden"><?= $ride->transport_id ?></th> <th class="hidden"><?= $ride->transport_id ?></th>
<th class="center"> <th class="center">
<?php if($this->session->userdata['user_type'] != 1){
$style = 'style="color:red;";';
if($ride->is_scheduled == 1){
$style = 'style="color:green;";';
} ?>
<a id="markSchedule_<?= $ride->transport_id ?>" transport_id="<?= $ride->transport_id ?>"
is_scheduled="<?= $ride->is_scheduled ?>" class="cpoint">
<i class="fa fa-fw fa-check" <?=$style?> ></i>
</a>
<?php } ?>
<a id="viewRideDetails" key="<?= $ride->transport_id ?>" class="cpoint"> <a id="viewRideDetails" key="<?= $ride->transport_id ?>" class="cpoint">
<i class="fa fa-fw fa-eye"></i> <i class="fa fa-fw fa-eye"></i>
</a> </a>
...@@ -117,6 +128,13 @@ ...@@ -117,6 +128,13 @@
}?> }?>
</tbody> </tbody>
</table> </table>
<?php if($this->session->userdata['user_type'] != 1){ ?>
<div class="col-md-1" style="float:right;padding:initial;">
<a id="scheduleAll" class="btn btn-sm btn-primary">
Schedule All
</a>
</div>
<?php } ?>
</div> </div>
</div> </div>
</div> </div>
...@@ -124,5 +142,6 @@ ...@@ -124,5 +142,6 @@
</section> </section>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
ride_ids = <?= json_encode($ride_ids); ?>;
report_data = <?= json_encode($report_data); ?>; report_data = <?= json_encode($report_data); ?>;
</script> </script>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
} }
}); });
}); });
<?php break; ?> <?php break;
default : ?> default : ?>
jQuery(function () { jQuery(function () {
jQuery('.datatable').DataTable({ jQuery('.datatable').DataTable({
......
...@@ -22,6 +22,6 @@ ...@@ -22,6 +22,6 @@
<script src="<?php echo base_url(); ?>assets/js/jQuery-2.1.4.min.js"></script> <script src="<?php echo base_url(); ?>assets/js/jQuery-2.1.4.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
report_data = []; report_data = ride_ids = [];
</script> </script>
</head> </head>
...@@ -136,6 +136,14 @@ ...@@ -136,6 +136,14 @@
Import Rides Import Rides
</a> </a>
</li> </li>
<?php if($this->session->userdata['user_type'] != 1){ ?>
<li>
<a href="<?= base_url('Ride/scheduled_rides') ?>">
<i class="fa fa-circle-o text-aqua"></i>
Scheduled Rides
</a>
</li>
<?php } ?>
</ul> </ul>
</li> </li>
<li><a href="<?= base_url('Payment/getPayDetails') ?>"> <li><a href="<?= base_url('Payment/getPayDetails') ?>">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
} }
.dropdown-toggle { .dropdown-toggle {
background: rgba(0, 0, 0, 0.1) none repeat scroll 0 0; background: rgba(0, 0, 0, 0.1) none repeat scroll 0 0;
} }
.modal-wide .modal-dialog { .modal-wide .modal-dialog {
width:80% !important; width:80% !important;
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
border:none !important; border:none !important;
} }
#map_canvas { #map_canvas {
height: 350px; height: 350px;
width: 98%; width: 98%;
} }
#map_canvasmap { #map_canvasmap {
height: 350px; height: 350px;
width: 98%; width: 98%;
} }
.input_size{width: 280px !important;} .input_size{width: 280px !important;}
...@@ -78,38 +78,38 @@ ...@@ -78,38 +78,38 @@
.sleeper{ .sleeper{
background-image: url(./images/1.png);background-repeat: no-repeat;height: 23px; background-image: url(./images/1.png);background-repeat: no-repeat;height: 23px;
width: 34px; width: 34px;
margin-top:10px; margin-top:10px;
height: 41px; height: 41px;
}.seater{ }.seater{
background-image: url(./images/4.png);background-repeat: no-repeat;height: 23px; background-image: url(./images/4.png);background-repeat: no-repeat;height: 23px;
width: 34px; width: 34px;
margin-top:10px; margin-top:10px;
height: 41px; height: 41px;
}.sleeper1{ }.sleeper1{
background-image: url(../images/empty.png);background-repeat: no-repeat;height: 23px; background-image: url(../images/empty.png);background-repeat: no-repeat;height: 23px;
width: 34px; width: 34px;
margin-top:10px; margin-top:10px;
height: 41px; height: 41px;
} }
.sub_buttons{padding-top:23px !important;} .sub_buttons{padding-top:23px !important;}
.well { .well {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
margin-top: -30px; margin-top: -30px;
height: 30px; height: 30px;
min-height: 30px; min-height: 30px;
padding: 0 6.5px; padding: 0 6.5px;
left: 25%; left: 25%;
} }
.thumbnailss { .thumbnailss {
list-style:none; list-style:none;
} }
/******SEAT BLOCK CSS********/ /******SEAT BLOCK CSS********/
.sleeper { .sleeper {
background-image: url(../images/1.png); background-image: url(../images/1.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
...@@ -117,26 +117,26 @@ ...@@ -117,26 +117,26 @@
margin-top: 10px; margin-top: 10px;
height: 39px; height: 39px;
cursor: pointer; cursor: pointer;
} }
.ssleeper { .ssleeper {
background-image: url(../images/3.png); background-image: url(../images/3.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 39px; height: 39px;
} }
.bsleeper { .bsleeper {
background-image: url(../images/3.png); background-image: url(../images/3.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 39px; height: 39px;
} }
.selectedsleeper { .selectedsleeper {
background-image: url(../images/2.png); background-image: url(../images/2.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
...@@ -144,44 +144,44 @@ ...@@ -144,44 +144,44 @@
margin-top: 10px; margin-top: 10px;
height: 39px; height: 39px;
cursor: pointer; cursor: pointer;
} }
.selectedsleeper1{ .selectedsleeper1{
background-image: url(../images/1.png); background-image: url(../images/1.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 39px; height: 39px;
cursor: pointer; cursor: pointer;
} }
.seater { .seater {
background-image: url(../images/4.png); background-image: url(../images/4.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 27px; height: 27px;
cursor: pointer; cursor: pointer;
} }
.sseater { .sseater {
background-image: url(../images/7.png); background-image: url(../images/7.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 39px; height: 39px;
} }
.bseater { .bseater {
background-image: url(../images/7.png); background-image: url(../images/7.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 39px; height: 39px;
} }
/*.ssseater{ /*.ssseater{
background-image: url(../images/4.png); background-image: url(../images/4.png);
background-repeat: no-repeat; background-repeat: no-repeat;
...@@ -190,56 +190,111 @@ ...@@ -190,56 +190,111 @@
margin-top: 10px; margin-top: 10px;
height: 27px; height: 27px;
cursor: pointer; cursor: pointer;
}*/ }*/
.selectedseat { .selectedseat {
background-image: url(../images/6.png); background-image: url(../images/6.png);
/*background-image: url(../images/6.png);*/ /*background-image: url(../images/6.png);*/
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 27px; height: 27px;
cursor: pointer; cursor: pointer;
} }
.sleeper1 { .sleeper1 {
background-image: url(../images/empty.png); background-image: url(../images/empty.png);
background-repeat: no-repeat; background-repeat: no-repeat;
height: 23px; height: 23px;
width: 34px; width: 34px;
margin-top: 10px; margin-top: 10px;
height: 21px; height: 21px;
} }
/******SEAT BLOCK CSS********/ /******SEAT BLOCK CSS********/
.prevent-click { .prevent-click {
pointer-events: none; pointer-events: none;
cursor: default; cursor: default;
text-decoration: none; text-decoration: none;
color: black; color: black;
} }
.hide { .hide {
display:none !important; display:none !important;
} }
.loader{ .loader{
position: absolute; position: absolute;
top: 0px; top: 0px;
right: 0px; right: 0px;
bottom: 0px; bottom: 0px;
left: 0px; left: 0px;
text-align: center; text-align: center;
background-image: url(../images/loader.gif); background-image: url(../images/loader.gif);
background-size: 12%; background-size: 5%;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: rgba(211,211,211,0.5); background-color: rgba(0,0,0,0.56);
} }
.height_200{ .height_200{
height: 200px !important; height: 200px !important;
} }
.cpoint{ .cpoint{
cursor: pointer !important; cursor: pointer !important;
} }
\ No newline at end of file
.overlay {
position: fixed; /* Sit on top of the page content */
display: none; /* Hidden by default */
width: 100%; /* Full width (cover the whole page) */
height: 100%; /* Full height (cover the whole page) */
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.5); /* Black background with opacity */
z-index: 2; /* Specify a stack order in case you're using a different order for other elements */
cursor: pointer; /* Add a pointer on hover */
}
.drag-box {
float: left;
width: 100%;
min-height: 25px;
margin: 2px;
border: 1px solid #A8A8A8;
}
.border-cls {
border: 1px solid #e0dbdb;
}
.headtag-td {
padding: 5px;
width: 50%;
}
.header-tag {
border: 1px solid darkgray;
border-radius: 10px;
padding: 0px 10px;
display: inline-block;
margin: 2px;
background: #c2ccd6;
}
.header-tag-box {
width:100%;
min-height:400px;
border: 1px solid #dfdbdb;
padding: 2px;
}
.clear {
clear: both !important;
}
.btn-mapping {
text-align: center;
padding: 15px;
}
\ No newline at end of file
jQuery(document).ready(function(){
jQuery('<div class="overlay"></div>').insertBefore(".content-wrapper");
});
function setImg(input,id) { function setImg(input,id) {
if (input.files && input.files[0]) { if (input.files && input.files[0]) {
var reader = new FileReader(); var reader = new FileReader();
...@@ -9,9 +13,9 @@ function setImg(input,id) { ...@@ -9,9 +13,9 @@ function setImg(input,id) {
} }
} }
function initPickUp() { function initPickUp() {
var options = {componentRestrictions: {country: country_flag}}; var options = {componentRestrictions: {country: country_flag}};
var input = document.getElementById('pickup_location'); var input = document.getElementById('pickup_location');
var autocomplete = new google.maps.places.Autocomplete(input, options); var autocomplete = new google.maps.places.Autocomplete(input, options);
} }
google.maps.event.addDomListener(window, 'load', initPickUp); google.maps.event.addDomListener(window, 'load', initPickUp);
function initDestination() { function initDestination() {
...@@ -51,10 +55,10 @@ jQuery('[name="fieldType"]').click(function(){ ...@@ -51,10 +55,10 @@ jQuery('[name="fieldType"]').click(function(){
jQuery('[id="rGenerate"]').click(function(){ jQuery('[id="rGenerate"]').click(function(){
event.preventDefault(); event.preventDefault();
var fields = '', var fields = '',
action = jQuery(this).attr('action'), action = jQuery(this).attr('action'),
thisObj = jQuery(this); thisObj = jQuery(this);
fieldType = jQuery('input[name="fieldType"]:checked').val(), fieldType = jQuery('input[name="fieldType"]:checked').val(),
where_cond = jQuery('[id="where_cond"]').serialize(); where_cond = jQuery('[id="where_cond"]').serialize();
if(thisObj.attr('dmclick') == 1){ if(thisObj.attr('dmclick') == 1){
return false; return false;
...@@ -98,8 +102,8 @@ jQuery('[id="rGenerate"]').click(function(){ ...@@ -98,8 +102,8 @@ jQuery('[id="rGenerate"]').click(function(){
report_data[key] = data; report_data[key] = data;
var vBtn = '<a class="btn btn-sm btn-primary" id="report_view_pop_'+key+'" key="'+key+'"><i class="fa fa-fw fa-edit"></i>View</a>'; var vBtn = '<a class="btn btn-sm btn-primary" id="report_view_pop_'+key+'" key="'+key+'"><i class="fa fa-fw fa-edit"></i>View</a>';
table.row.add([data['Order_ID'],data['Medical_Number'],data['Patient_Name'], table.row.add([data['Order_ID'],data['Medical_Number'],data['Patient_Name'],
data['Patient_Age'],data['Patient_Phone'],data['Appointment_Reason'], data['Patient_Age'],data['Patient_Phone'],data['Appointment_Reason'],
data['Appointment_Time'],vBtn]).draw(); data['Appointment_Time'],vBtn]).draw();
}); });
jQuery('[id="report_table_html"]').removeClass('hide'); jQuery('[id="report_table_html"]').removeClass('hide');
slideTo('report_table_html'); slideTo('report_table_html');
...@@ -127,14 +131,14 @@ function slideTo(id){ ...@@ -127,14 +131,14 @@ function slideTo(id){
jQuery('#report_table tbody').on('click','a',function() { jQuery('#report_table tbody').on('click','a',function() {
var thisObj = jQuery(this), var thisObj = jQuery(this),
key = thisObj.attr('key'); key = thisObj.attr('key');
viewOrderDetails(key); viewOrderDetails(key);
}); });
jQuery('[id="viewRideDetails"]').click(function(){ jQuery('[id="viewRideDetails"]').click(function(){
console.log('sdrfg'); console.log('sdrfg');
var thisObj = jQuery(this), var thisObj = jQuery(this),
key = thisObj.attr('key'); key = thisObj.attr('key');
viewOrderDetails(key); viewOrderDetails(key);
}); });
...@@ -146,10 +150,10 @@ function viewOrderDetails(key){ ...@@ -146,10 +150,10 @@ function viewOrderDetails(key){
jQuery.each(report_data[key], function(field,value) { jQuery.each(report_data[key], function(field,value) {
value = (value == null || value == 'null' || value == undefined || value == 'undefined')?'--':value; value = (value == null || value == 'null' || value == undefined || value == 'undefined')?'--':value;
rowHtml += '<div class="col-xs-6"><div class="col-xs-12">'+ rowHtml += '<div class="col-xs-6"><div class="col-xs-12">'+
'<div class="col-xs-6">'+field.replace(/_/g,' ')+'</div>'+ '<div class="col-xs-6">'+field.replace(/_/g,' ')+'</div>'+
'<div class="col-xs-1">:</div>'+ '<div class="col-xs-1">:</div>'+
'<div class="col-xs-5">'+value+'</div>'+ '<div class="col-xs-5">'+value+'</div>'+
'</div></div>'; '</div></div>';
if(colCount == 2){ if(colCount == 2){
body_html += rowHtml; body_html += rowHtml;
rowHtml = ''; rowHtml = '';
...@@ -189,4 +193,167 @@ function addModalLoader(){ ...@@ -189,4 +193,167 @@ function addModalLoader(){
function remModalLoader(){ function remModalLoader(){
jQuery("[id='modal_loader_body']").remove(); jQuery("[id='modal_loader_body']").remove();
jQuery("[id='modal_content']").removeClass('relative height_200'); jQuery("[id='modal_content']").removeClass('relative height_200');
} }
\ No newline at end of file
jQuery('[id="scheduleAll"]').click(function(){
if(ride_ids==undefined || ride_ids=='undefined' || ride_ids==null || ride_ids=='null' || ride_ids==''){
return false;
}
markAsScheduled(ride_ids,'0');
});
jQuery('[id^="markSchedule_"]').click(function(){
var thisObj = jQuery(this),
is_scheduled = thisObj.attr('is_scheduled'),
transport_id = thisObj.attr('transport_id');
if(transport_id == undefined || transport_id == 'undefined' || transport_id == null || transport_id == 'null' || transport_id == '' ||
is_scheduled == undefined || is_scheduled == 'undefined' || is_scheduled == null || is_scheduled == 'null' || is_scheduled == ''){
return false;
}
if(is_scheduled == 1){
flag = confirm("Are you sure to continue with this action...?");
if(flag != true) return false;
}
markAsScheduled(transport_id,is_scheduled);
});
function markAsScheduled(transport_id,is_scheduled){
if(transport_id == undefined || transport_id == 'undefined' || transport_id == null || transport_id == 'null' || transport_id == '' ||
is_scheduled == undefined || is_scheduled == 'undefined' || is_scheduled == null || is_scheduled == 'null' || is_scheduled == ''){
return false;
}
showFullScreenLoader();
jQuery.ajax({
url : base_url+"Ride/changeSchuduleStatus",
type : 'POST',
data : {'transport_id':transport_id,'is_scheduled':is_scheduled},
success: function(resp){
if(resp == '' || resp == undefined || resp == null || resp == 'null' || resp == 'undefined'){
remFullScreenLoader();
return false;
}
resp = jQuery.parseJSON(resp);
if(resp['status'] == 1){
var color = '';
if(is_scheduled == 1){
color = 'red'
is_scheduled = 0;
} else {
color = 'green'
is_scheduled = 1;
}
jQuery.each(resp['succArr'], function(index,value) {
jQuery('[id="markSchedule_'+value+'"]').attr('is_scheduled',is_scheduled);
jQuery(jQuery('[id="markSchedule_'+value+'"]')).children().css( "color", color );
});
remFullScreenLoader();
}
},
error: function (jqXHR, exception) {
remFullScreenLoader();
}
});
}
function showFullScreenLoader(){
var thisObj = jQuery('.overlay');
thisObj.css("display",'block');
thisObj.addClass('relative');
thisObj.prepend("<div id='fullScreenLoaderBody' class='loader'></div>");
}
function remFullScreenLoader(){
var thisObj = jQuery('.overlay');
thisObj.css("display",'none');
jQuery('[id="fullScreenLoaderBody"]').remove();
thisObj.removeClass('relative');
}
function allowDropElement(ev) {
if(ev.target.getAttribute('type') != 'parent' && ev.target.firstChild != null){
return false;
}
ev.preventDefault();
}
function dragElement(ev) {
ev.dataTransfer.setData("tmporderid", ev.target.getAttribute('id'));
}
function dropElement(ev) {
ev.preventDefault();
var tmporderid = ev.dataTransfer.getData("tmporderid");
ev.target.appendChild(document.getElementById(tmporderid));
}
jQuery('[id="upload_excell"]').click(function(){
var thisObj = jQuery(this), childThisObj = '', headerOrder = [], fileType = jQuery('[name="fileType"]').val(),
broker_id = jQuery('[name="broker_id"]').val(), company_id = jQuery('[name="company_id"]').val(),
import_file = jQuery('[name="import_file"]').val();
if(thisObj.attr('dmclick') != 0){
return false;
}
if(fileType == '' || fileType == undefined || fileType == null || fileType == 'null' || fileType == 'undefined' ||
broker_id == '' || broker_id == undefined || broker_id == null || broker_id == 'null' || broker_id == 'undefined' ||
company_id == '' || company_id == undefined || company_id == null || company_id == 'null' || company_id == 'undefined' ||
import_file == '' || import_file == undefined || import_file == null || import_file == 'null' || import_file == 'undefined'){
setErrModal('Error Uploading Excell','Please Map All the Fields to the corrospinding header..!');
return false;
}
showFullScreenLoader();
thisObj.attr('dmclick',1);
jQuery('[id="mappedHeaders"] [type="child"]').each(function(){
childThisObj = jQuery(this);
if (childThisObj.children().length <= 0) {
remFullScreenLoader();
thisObj.attr('dmclick',0);
setErrModal('Error Uploading Excell','Something went wrong, please try again later..!');
return false;
}
var childHead = childThisObj.children();
headerOrder[childThisObj.attr('headOrder')] = childHead.attr('tmporder');
});
jQuery.ajax({
url : base_url+"Ride/import",
type : 'POST',
data : {'broker_id':broker_id,'company_id':company_id,'header_order':headerOrder,'file_type':fileType,'import_file':import_file},
success: function(resp){
if(resp == '' || resp == undefined || resp == null || resp == 'null' || resp == 'undefined'){
remFullScreenLoader();
thisObj.attr('dmclick',0);
setErrModal('Error Uploading Excell','Something went wrong, please try again..!');
return false;
}
resp = jQuery.parseJSON(resp);
if(resp['status'] == 1){
var color = '';
if(is_scheduled == 1){
color = 'red'
is_scheduled = 0;
} else {
color = 'green'
is_scheduled = 1;
}
jQuery.each(resp['succArr'], function(index,value) {
jQuery('[id="markSchedule_'+value+'"]').attr('is_scheduled',is_scheduled);
jQuery(jQuery('[id="markSchedule_'+value+'"]')).children().css( "color", color );
});
remFullScreenLoader();
}
},
error: function (jqXHR, exception) {
remFullScreenLoader();
thisObj.attr('dmclick',0);
setErrModal('Error Uploading Excell','Something went wrong, please try again..!');
return false;
}
});
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment