Commit 392150ab by Tobin

daily commit

parent 5b617617
......@@ -83,7 +83,7 @@ $autoload['drivers'] = array();
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','generals_helper','file');
$autoload['helper'] = array('url','generals_helper','file','excelReader');
/*
| -------------------------------------------------------------------
......
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Customer extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Customer_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
if($this->session->userdata['user_type'] != 1){
redirect(base_url());
}
}
public function addCustomerUser(){
$template['page'] = 'Customer/add-customer-user';
$template['page_title'] = "Add New Customer";
$template['page_desc'] = "Create New Customer Users";
$template['menu'] = "Customer Management";
$template['sub_menu'] = "Add Customer";
$this->load->view('template',$template);
}
public function listCustomerUsers(){
$template['page'] = 'Customer/list-customer-users';
$template['page_title'] = "View All Customer Users";
$template['page_desc'] = "View and Manageme All Customer Users";
$template['menu'] = "Customer Management";
$template['sub_menu'] = "View Customer";
$template['customerData'] = $this->Customer_model->getCustomer();
$this->load->view('template',$template);
}
public function createCustomer(){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/addCustomerUser'));
}
if($err == 0 && (!isset($_POST['first_name']) || empty($_POST['first_name']))){
$err = 1;
$errMsg = 'Provide a First Name';
}
else if($err == 0 && (!isset($_POST['last_name']) || empty($_POST['last_name']))){
$err = 1;
$errMsg = 'Provide a Last Name';
}
else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){
$err = 1;
$errMsg = 'Provide a Phone Number';
}
else if($err == 0 && (!isset($_POST['email']) || empty($_POST['email']))){
$err = 1;
$errMsg = 'Provide an Email ID';
}
else if($err == 0 && (!isset($_POST['date_of_birth']) || empty($_POST['date_of_birth']))){
$err = 1;
$errMsg = 'Provide Date Of Birth';
}
else if($err == 0 && (!isset($_POST['address']) || empty($_POST['address']))){
$err = 1;
$errMsg = 'Provide an Address';
}
else if($err == 0 && (!isset($_FILES['profile_image']) || empty($_FILES['profile_image']))){
$err = 1;
$errMsg = 'Provide Profile Picture';
}
$_POST['age'] = '';
$_POST['profile_image'] = '';
if($err == 0){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['profile_image']['name'];
$this->upload->initialize($config);
if(!$this->upload->do_upload('profile_image')){
$err = 1;
$errMsg = $this->upload->display_errors();
}else{
$upload_data = $this->upload->data();
$_POST['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
$_POST['age'] = $this->calculateAge($_POST['date_of_birth']);
if($_POST['age'] < 0){
$err = 1;
$errMsg = 'Provide a valid date of birth';
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/addCustomerUser'));
}
$status = $this->Customer_model->createCustomer($_POST);
if($status == 1){
$flashMsg['class'] = 'success';
$flashMsg['message'] = 'User Created';
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/listCustomerUsers'));
}else if($status == 2){
$flashMsg['message'] = 'Email ID already in use.';
}else if($status == 3){
$flashMsg['message'] = 'Phone Number already in use.';
}
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/addCustomerUser'));
}
public function calculateAge($birthDate = ''){
if(empty($birthDate))
return;
$birthDate = explode("/", $birthDate);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
? ((date("Y") - $birthDate[2]) - 1)
: (date("Y") - $birthDate[2]));
return $age;
}
public function getCustomerData(){
$return_arr = array('status'=>'0');
if(!isset($_POST) || empty($_POST) || !isset($_POST['customer_id']) || empty($_POST['customer_id'])){
echo json_encode($return_arr);exit;
}
$customer_id = decode_param($_POST['customer_id']);
$customer_data = $this->Customer_model->getCustomer(array('customer_id'=>$customer_id));
if(!empty($customer_data)){
$return_arr['status'] = 1;
$return_arr['customer_data'] = $customer_data;
}
echo json_encode($return_arr);exit;
}
function changeStatus($customer_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($customer_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/listCustomerUsers'));
}
$customer_id = decode_param($customer_id);
$status = $this->Customer_model->changeStatus($customer_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Customer/listCustomerUsers'));
}
function editCustomer($customer_id = ''){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($customer_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/listCustomerUsers'));
}
$template['page'] = 'Customer/add-customer-user';
$template['menu'] = "Customer Management";
$template['sub_menu'] = "Edit Customer";
$template['page_desc'] = "Edit Customer Details";
$template['page_title'] = "Edit Customer";
$template['customer_id'] = $customer_id;
$customer_id = decode_param($customer_id);
$template['customer_data'] = $this->Customer_model->getCustomer(array('customer_id'=>$customer_id));
$this->load->view('template',$template);
}
function updateCustomer($customer_id = ''){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($customer_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/listCustomerUsers'));
}
$customerIdDec = decode_param($customer_id);
$err = 0;
$errMsg = '';
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/addCustomerUser'));
}
if($err == 0 && (!isset($_POST['first_name']) || empty($_POST['first_name']))){
$err = 1;
$errMsg = 'Provide a First Name';
}
else if($err == 0 && (!isset($_POST['last_name']) || empty($_POST['last_name']))){
$err = 1;
$errMsg = 'Provide a Last Name';
}
else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){
$err = 1;
$errMsg = 'Provide a Phone Number';
}
else if($err == 0 && (!isset($_POST['email']) || empty($_POST['email']))){
$err = 1;
$errMsg = 'Provide an Email ID';
}
else if($err == 0 && (!isset($_POST['date_of_birth']) || empty($_POST['date_of_birth']))){
$err = 1;
$errMsg = 'Provide Date Of Birth';
}
else if($err == 0 && (!isset($_POST['address']) || empty($_POST['address']))){
$err = 1;
$errMsg = 'Provide an Address';
}
if($err == 0){
$_POST['age'] = $this->calculateAge($_POST['date_of_birth']);
if($_POST['age'] < 0){
$err = 1;
$errMsg = 'Provide a valid date of birth';
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/editCustomer/'.$customer_id));
}
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['profile_image']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('profile_image')){
$upload_data = $this->upload->data();
$_POST['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
$status = $this->Customer_model->updateCustomer($customerIdDec,$_POST);
if($status == 1){
$flashMsg['class'] = 'success';
$flashMsg['message'] = 'User Details Updated';
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/listCustomerUsers'));
}else if($status == 2){
$flashMsg['message'] = 'Email ID already in use.';
}else if($status == 3){
$flashMsg['message'] = 'Phone Number already in use.';
}
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/editCustomer/'.$customer_id));
}
}
?>
\ No newline at end of file
......@@ -105,7 +105,12 @@ class Report extends CI_Controller {
if(empty($dataRow) || empty($fileName)){
return;
}
$this->db->query("UPDATE `company_payment_details` SET `report_count`=report_count+1 WHERE `company_id`=10");
if($this->session->userdata['user_type'] != 1){
$company_id = $this->session->userdata['id'];
$this->db->query("UPDATE `company_payment_details`
SET `report_count`=report_count+1
WHERE `company_id`=".$company_id);
}
//Download CSV\\
$temp_memory = fopen('php://memory', 'w');
foreach ($dataRow as $line) {
......
......@@ -7,6 +7,7 @@ class Ride extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Ride_model');
$this->load->model('Customer_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
......@@ -105,42 +106,61 @@ class Ride extends CI_Controller {
$this->load->view('template',$template);
}
function getImportDataCSV($importedFile = '', $headerRetFlag = 0, $headerOrder = array()){
function getImportDataCSV($importedFile = '', $headerRetFlag = 0, $headerOrder = array(), $data = array()){
$header = 0;
$insertArr = array();
$headerArr = array();
$insertData = array();
$customerIds = array();
$custInsrData = array();
$customerPh = array();
$retData = array('status'=>0);
if($headerRetFlag == 1 && empty($headerOrder)){
return 4;
if($headerRetFlag == 1 && (!isset($data['broker_id']) || !isset($data['company_id']) ||
empty($data['broker_id']) || empty($data['company_id']))){
$retData['status'] = 0;
return $retData;
}
if (empty($importedFile) || !file_exists($importedFile) ||
($handle=fopen($importedFile, "r")) === FALSE) {
$retData['status'] = 2;
return $retData;
}
if($headerRetFlag == 1 && empty($headerOrder)){
$retData['status'] = 4;
return $retData;
}
while (($row = fgetcsv($handle, 1000, ",")) !== FALSE) {
$colCnt = 0;
$rowArr = array();
$customerId = '';
foreach($row as $col){
if($header == 0){
$col = str_replace(' ','_',$col);
$col = preg_replace('/[^A-Za-z0-9\_\/]/', '', $col);
$headerArr[] = $col;
}else{
if(isset($headerOrder[$colCnt]) && isset($headerArr[$headerOrder[$colCnt]])){
if($headerArr[$headerOrder[$colCnt]] == 'Appointment_Date'){
$col = date('d-m-Y',strtotime($col));
}
if($headerArr[$headerOrder[$colCnt]] == 'Appointment_Time'){
$last = substr($col,-2);
$col = str_replace($last,":".$last,$col);
$col = (!empty($col))?date('G:i',strtotime($col)):'';
}
$rowArr[$headerArr[$headerOrder[$colCnt]]] = $col;
} else {
if($headerArr[$colCnt] == 'Appointment_Date'){
$col = date('d-m-Y',strtotime($col));
}
if($headerArr[$colCnt] == 'Appointment_Time'){
$last = substr($col, -2);
$last = substr($col,-2);
$col = str_replace($last,":".$last,$col);
$col = (!empty($col))?date('G:i',strtotime($col)):'';
}
$rowArr[$headerArr[$colCnt]] = $col;
}
$colCnt++;
}
}
......@@ -150,6 +170,32 @@ class Ride extends CI_Controller {
return $retData;
}
if($header != 0){
if(!isset($headerOrder['0']) || !isset($headerOrder['1']) || !isset($headerOrder['2']) ||
!isset($headerOrder['4']) || !isset($headerOrder['5']) || !isset($headerOrder['7']) ||
!isset($headerOrder['8']) || !isset($headerOrder['10']) || !isset($headerOrder['11']) ||
!isset($headerOrder['12']) || !isset($headerOrder['13']) || !isset($headerOrder['14']) ||
!isset($headerOrder['22']) || !isset($headerOrder['23']) || !isset($headerOrder['28'])){
continue;
}
if(!in_array($row[$headerOrder['5']],$customerPh)){
$customerData = $this->Customer_model->getCustomer(array('phone' => $row[$headerOrder['5']]));
if(empty($customerData)){
$custData = array(
'age'=>$row[$headerOrder['4']],'phone'=>$row[$headerOrder['5']],
'last_name'=>$row[$headerOrder['1']],'first_name'=>$row[$headerOrder['2']],
'status'=>'0'
);
$customerId = $this->Customer_model->createCustomer($custData);
if(empty($customerId)){
continue;
}
} else {
$customerId = $customerData->customer_id;
}
$customerPh[$customerId] = $row[$headerOrder['5']];
} else {
$customerId = array_search($row[$headerOrder['5']],$customerPh);
}
$time = '12:00';
if(!empty($row[$headerOrder['10']])){
$last = substr($row[$headerOrder['10']], -2);
......@@ -157,10 +203,13 @@ class Ride extends CI_Controller {
$time = (!empty($time))?date('G:i',strtotime($time)):'12:00';
}
$date_time = (!empty($row[8]))?date('d-m-Y',strtotime($row[$headerOrder['8']])).' '.$time:'';
$tripBidStatus = (isset($headerOrder['37']) && isset($row[$headerOrder['37']]))?
$row[$headerOrder['37']]:'';
$insertData = array(
'company_id' => $_POST['company_id'],
'broker_id' => $_POST['broker_id'],
'broker_id' => $data['broker_id'],
'company_id' => $data['company_id'],
'customer_id' => $customerId,
'age' => $row[$headerOrder['4']],
'phone' => $row[$headerOrder['5']],
......@@ -171,30 +220,14 @@ class Ride extends CI_Controller {
'reason_code' => $row[$headerOrder['11']],
'trip_status' => $row[$headerOrder['12']],
'vehicle_type' => $row[$headerOrder['13']],
'patient_name' => $row[$headerOrder['2']].' '.$row[$headerOrder['1']],
'drop_location' => $row[$headerOrder['28']],
'pickup_location' => $row[$headerOrder['23']],
'trip_bid_status' => $row[$headerOrder['37']],
'patient_name' => $row[$headerOrder['2']].' '.$row[$headerOrder['1']],
'trip_bid_status' => $tripBidStatus,
'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[$headerOrder['0']]."' AND status <> '2'");
// if(1 > $custData->num_rows() && !in_array($row[$headerOrder['0']],$customerIds)){
// $medicalIds[] = $row[$headerOrder['0']];
// $custInsrData[] = array(
// 'medical_id' => $row[$headerOrder['0']],
// 'first_name' => $row[$headerOrder['2']],
// 'last_name' => $row[$headerOrder['1']],
// 'age' => $row[$headerOrder['4']],
// 'phone' => $row[$headerOrder['5']],
// 'alt_phone' => $row[$headerOrder['6']]
// 'date_of_birth' => $row[$headerOrder['3']]
// );
// }
}
$header = 1;
}
......@@ -205,25 +238,23 @@ class Ride extends CI_Controller {
} else {
$retData['status'] = 1;
$retData['insertData'] = $insertArr;
$retData['custInsrData'] = $custInsrData;
}
return $retData;
}
function getImportDataExcel($importedFile = '', $headerRetFlag = 0, $headerOrder = array()){
require_once('spreadsheet-reader-master/php-excel-reader/excel_reader2.php');
require_once('spreadsheet-reader-master/SpreadsheetReader.php');
function getImportDataExcel($importedFile = '', $headerRetFlag = 0, $headerOrder = array(), $data = array()){
$header = 0;
$insertArr = array();
$headerArr = array();
$insertData = array();
$customerIds = array();
$custInsrData = array();
$customerPh = array();
$custData = array();
$retData = array('status'=>0);
if($headerRetFlag == 1 && empty($headerOrder)){
return 4;
if($headerRetFlag == 1 && (!isset($data['broker_id']) || !isset($data['company_id']) ||
empty($data['broker_id']) || empty($data['company_id']))){
$retData['status'] = 0;
return $retData;
}
if (empty($importedFile) || !file_exists($importedFile)){
$retData['status'] = 2;
......@@ -234,27 +265,44 @@ class Ride extends CI_Controller {
$retData['status'] = 3;
return $retData;
}
if($headerRetFlag == 1 && empty($headerOrder)){
$retData['status'] = 4;
return $retData;
}
for($i=0; $i < count($reader->sheets()); $i++){
$reader->ChangeSheet($i);
foreach ($reader as $row){
$colCnt = 0;
$rowArr = array();
$customerId = '';
foreach($row as $col){
if($header == 0){
$col = str_replace(' ','_',$col);
$col = preg_replace('/[^A-Za-z0-9\_\/]/', '', $col);
$headerArr[] = $col;
}else{
if(isset($headerOrder[$colCnt]) && isset($headerArr[$headerOrder[$colCnt]])){
if($headerArr[$headerOrder[$colCnt]] == 'Appointment_Date'){
$col = date('d-m-Y',strtotime($col));
}
if($headerArr[$headerOrder[$colCnt]] == 'Appointment_Time'){
$last = substr($col,-2);
$col = str_replace($last,":".$last,$col);
$col = (!empty($col))?date('G:i',strtotime($col)):'';
}
$rowArr[$headerArr[$headerOrder[$colCnt]]] = $col;
} else {
if($headerArr[$colCnt] == 'Appointment_Date'){
$col = date('d-m-Y',strtotime($col));
}
if($headerArr[$colCnt] == 'Appointment_Time'){
$last = substr($col, -2);
$last = substr($col,-2);
$col = str_replace($last,":".$last,$col);
$col = (!empty($col))?date('G:i',strtotime($col)):'';
}
$rowArr[$headerArr[$colCnt]] = $col;
}
$colCnt++;
}
}
......@@ -264,6 +312,33 @@ class Ride extends CI_Controller {
return $retData;
}
if($header != 0){
if(!isset($headerOrder['0']) || !isset($headerOrder['1']) || !isset($headerOrder['2']) ||
!isset($headerOrder['4']) || !isset($headerOrder['5']) || !isset($headerOrder['7']) ||
!isset($headerOrder['8']) || !isset($headerOrder['10']) || !isset($headerOrder['11']) ||
!isset($headerOrder['12']) || !isset($headerOrder['13']) || !isset($headerOrder['14']) ||
!isset($headerOrder['22']) || !isset($headerOrder['23']) || !isset($headerOrder['28'])){
continue;
}
if(!in_array($row[$headerOrder['5']],$customerPh)){
$customerData=$this->Customer_model->getCustomer(array('phone'=>$row[$headerOrder['5']]));
if(empty($customerData)){
$custData = array('age'=>$row[$headerOrder['4']],
'phone'=>$row[$headerOrder['5']],
'last_name'=>$row[$headerOrder['1']],
'first_name'=>$row[$headerOrder['2']],
'status'=>'0');
$customerId = $this->Customer_model->createCustomer($custData);
if(empty($customerId)){
continue;
}
} else {
$customerId = $customerData->customer_id;
}
$customerPh[$customerId] = $row[$headerOrder['5']];
} else {
$customerId = array_search($row[$headerOrder['5']],$customerPh);
}
$time = '12:00';
if(!empty($row[$headerOrder['10']])){
$last = substr($row[$headerOrder['10']], -2);
......@@ -271,10 +346,13 @@ class Ride extends CI_Controller {
$time = (!empty($time))?date('G:i',strtotime($time)):'12:00';
}
$date_time = (!empty($row[8]))?date('d-m-Y',strtotime($row[$headerOrder['8']])).' '.$time:'';
$tripBidStatus = (isset($headerOrder['37']) && isset($row[$headerOrder['37']]))?
$row[$headerOrder['37']]:'';
$insertData = array(
'company_id' => $_POST['company_id'],
'broker_id' => $_POST['broker_id'],
'broker_id' => $data['broker_id'],
'company_id' => $data['company_id'],
'customer_id' => $customerId,
'age' => $row[$headerOrder['4']],
'phone' => $row[$headerOrder['5']],
......@@ -285,30 +363,14 @@ class Ride extends CI_Controller {
'reason_code' => $row[$headerOrder['11']],
'trip_status' => $row[$headerOrder['12']],
'vehicle_type' => $row[$headerOrder['13']],
'patient_name' => $row[$headerOrder['2']].' '.$row[$headerOrder['1']],
'drop_location' => $row[$headerOrder['28']],
'pickup_location' => $row[$headerOrder['23']],
'trip_bid_status' => $row[$headerOrder['37']],
'patient_name' => $row[$headerOrder['2']].' '.$row[$headerOrder['1']],
'trip_bid_status' => $tripBidStatus,
'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[$headerOrder['0']]."' AND status <> '2'");
// if(1 > $custData->num_rows() && !in_array($row[$headerOrder['0']],$customerIds)){
// $medicalIds[] = $row[$headerOrder['0']];
// $custInsrData[] = array(
// 'medical_id' => $row[$headerOrder['0']],
// 'first_name' => $row[$headerOrder['2']],
// 'last_name' => $row[$headerOrder['1']],
// 'age' => $row[$headerOrder['4']],
// 'phone' => $row[$headerOrder['5']],
// 'alt_phone' => $row[$headerOrder['6']]
// 'date_of_birth' => $row[$headerOrder['3']]
// );
// }
}
$header = 1;
}
......@@ -319,7 +381,6 @@ class Ride extends CI_Controller {
} else {
$retData['status'] = 1;
$retData['insertData'] = $insertArr;
$retData['custInsrData'] = $custInsrData;
}
return $retData;
}
......@@ -335,20 +396,20 @@ class Ride extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Ride/import_ride'));
}
$data = array('broker_id'=>$_POST['broker_id'],'company_id'=>$_POST['company_id']);
switch($_POST['file_type']){
case 'csv':
$respStatus = $this->getImportDataCSV($_POST['import_file'],1,$_POST['header_order']);
$respStatus = $this->getImportDataCSV($_POST['import_file'],1,$_POST['header_order'],$data);
break;
case 'xls':
case 'xlsx':
$respStatus = $this->getImportDataExcel($_POST['import_file'],1,$_POST['header_order']);
$respStatus = $this->getImportDataExcel($_POST['import_file'],1,$_POST['header_order'],$data);
break;
}
if(!empty($respStatus) && isset($respStatus['status']) && $respStatus['status'] != ''){
if($respStatus['status'] == 1){
$status = $this->Ride_model->uploadRides($respStatus['insertData'],$respStatus['custInsrData']);
$status = $this->Ride_model->uploadRides($respStatus['insertData']);
if($status){
$flashMsg['class'] = "success";
$flashMsg['message'] = "Upload Scuccessfull";
......@@ -359,7 +420,6 @@ class Ride extends CI_Controller {
$respStatus['status'] = '3';
}
unset($respStatus['insertData']);
unset($respStatus['custInsrData']);
}
} else {
$respStatus['status'] = '0';
......@@ -550,7 +610,7 @@ class Ride extends CI_Controller {
$locData = file_get_contents("https://maps.google.com/maps/api/geocode/json?address=".
urlencode($ride_data->pickup_location).
"&sensor=false&key=AIzaSyC9JX3BZZfx2S6GQieC_PqjuJdUbZ7_wyM");
"&sensor=false&key=".$this->session->userdata['settings']['google_api_key']);
$loc_data = json_decode($locData);
if(empty($loc_data)){
......@@ -688,7 +748,7 @@ class Ride extends CI_Controller {
return 0;
$locData = file_get_contents("https://maps.google.com/maps/api/geocode/json?address=".
urlencode($location).
"&sensor=false&key=AIzaSyC9JX3BZZfx2S6GQieC_PqjuJdUbZ7_wyM");
"&sensor=false&key=".$this->session->userdata['settings']['google_api_key']);
if(empty($locData))
return 0;
$loc_data = json_decode($locData);
......
.DS_Store
test
materials
\ No newline at end of file
### v.0.5.11 2015-04-30
- Added a special case for cells formatted as text in XLSX. Previously leading zeros would get truncated if a text cell contained only numbers.
### v.0.5.10 2015-04-18
- Implemented SeekableIterator. Thanks to [paales](https://github.com/paales) for suggestion ([Issue #54](https://github.com/nuovo/spreadsheet-reader/issues/54) and [Pull request #55](https://github.com/nuovo/spreadsheet-reader/pull/55)).
- Fixed a bug in CSV and ODS reading where reading position 0 multiple times in a row would result in internal pointer being advanced and reading the next line. (E.g. reading row #0 three times would result in rows #0, #1, and #2.). This could have happened on multiple calls to `current()` while in #0 position, or calls to `seek(0)` and `current()`.
### v.0.5.9 2015-04-18
- [Pull request #85](https://github.com/nuovo/spreadsheet-reader/pull/85): Fixed an index check. (Thanks to [pa-m](https://github.com/pa-m)).
### v.0.5.8 2015-01-31
- [Issue #50](https://github.com/nuovo/spreadsheet-reader/issues/50): Fixed an XLSX rewind issue. (Thanks to [osuwariboy](https://github.com/osuwariboy))
- [Issue #52](https://github.com/nuovo/spreadsheet-reader/issues/52), [#53](https://github.com/nuovo/spreadsheet-reader/issues/53): Apache POI compatibility for XLSX. (Thanks to [dimapashkov](https://github.com/dimapashkov))
- [Issue #61](https://github.com/nuovo/spreadsheet-reader/issues/61): Autoload fix in the main class. (Thanks to [i-bash](https://github.com/i-bash))
- [Issue #60](https://github.com/nuovo/spreadsheet-reader/issues/60), [#69](https://github.com/nuovo/spreadsheet-reader/issues/69), [#72](https://github.com/nuovo/spreadsheet-reader/issues/72): Fixed an issue where XLSX ChangeSheet may not work. (Thanks to [jtresponse](https://github.com/jtresponse), [osuwariboy](https://github.com/osuwariboy))
- [Issue #70](https://github.com/nuovo/spreadsheet-reader/issues/70): Added a check for constructor parameter correctness.
### v.0.5.7 2013-10-29
- Attempt to replicate Excel's "General" format in XLSX files that is applied to otherwise unformatted cells.
Currently only decimal number values are converted to PHP's floats.
### v.0.5.6 2013-09-04
- Fix for formulas being returned along with values in XLSX files. (Thanks to [marktag](https://github.com/marktag))
### v.0.5.5 2013-08-23
- Fix for macro sheets appearing when parsing XLS files. (Thanks to [osuwariboy](https://github.com/osuwariboy))
### v.0.5.4 2013-08-22
- Fix for a PHP warning that occurs with completely empty sheets in XLS files.
- XLSM (macro-enabled XLSX) files are recognized and read, too.
- composer.json file is added to the repository (thanks to [matej116](https://github.com/matej116))
### v.0.5.3 2013-08-12
- Fix for repeated columns in ODS files not reading correctly (thanks to [etfb](https://github.com/etfb))
- Fix for filename extension reading (Thanks to [osuwariboy](https://github.com/osuwariboy))
### v.0.5.2 2013-06-28
- A fix for the case when row count wasn't read correctly from the sheet in a XLS file.
### v.0.5.1 2013-06-27
- Fixed file type choice when using mime-types (previously there were problems with
XLSX and ODS mime-types) (Thanks to [incratec](https://github.com/incratec))
- Fixed an error in XLSX iterator where `current()` would advance the iterator forward
with each call. (Thanks to [osuwariboy](https://github.com/osuwariboy))
### v.0.5.0 2013-06-17
- Multiple sheet reading is now supported:
- The `Sheets()` method lets you retrieve a list of all sheets present in the file.
- `ChangeSheet($Index)` method changes the sheet in the reader to the one specified.
- Previously temporary files that were extracted, were deleted after the SpreadsheetReader
was destroyed but the empty directories remained. Now those are cleaned up as well.
### v.0.4.3 2013-06-14
- Bugfix for shared string caching in XLSX files. When the shared string count was larger
than the caching limit, instead of them being read from file, empty strings were returned.
### v.0.4.2 2013-06-02
- XLS file reading relies on the external Spreadsheet_Excel_Reader class which, by default,
reads additional information about cells like fonts, styles, etc. Now that is disabled
to save some memory since the style data is unnecessary anyway.
(Thanks to [ChALkeR](https://github.com/ChALkeR) for the tip.)
Martins Pilsetnieks <[email protected]>
\ No newline at end of file
### spreadsheet-reader is licensed under the MIT License
Copyright (C) 2012-2015 Martins Pilsetnieks
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Spreadsheet_Excel_Reader is licensed under the PHP license as noted in the excel_reader2.php file
> LICENSE: This source file is subject to version 3.0 of the PHP license
> that is available through the world-wide-web at the following URI:
> http://www.php.net/license/3_0.txt. If you did not receive a copy of
> the PHP License and are unable to obtain it through the web, please
> send a note to [email protected] so we can mail you a copy immediately.
**spreadsheet-reader** is a PHP spreadsheet reader that differs from others in that the main goal for it was efficient
data extraction that could handle large (as in really large) files. So far it may not definitely be CPU, time
or I/O-efficient but at least it won't run out of memory (except maybe for XLS files).
So far XLSX, ODS and text/CSV file parsing should be memory-efficient. XLS file parsing is done with php-excel-reader
from http://code.google.com/p/php-excel-reader/ which, sadly, has memory issues with bigger spreadsheets, as it reads the
data all at once and keeps it all in memory.
### Requirements:
* PHP 5.3.0 or newer
* PHP must have Zip file support (see http://php.net/manual/en/zip.installation.php)
### Usage:
All data is read from the file sequentially, with each row being returned as a numeric array.
This is about the easiest way to read a file:
<?php
// If you need to parse XLS files, include php-excel-reader
require('php-excel-reader/excel_reader2.php');
require('SpreadsheetReader.php');
$Reader = new SpreadsheetReader('example.xlsx');
foreach ($Reader as $Row)
{
print_r($Row);
}
?>
However, now also multiple sheet reading is supported for file formats where it is possible. (In case of CSV, it is handled as if
it only has one sheet.)
You can retrieve information about sheets contained in the file by calling the `Sheets()` method which returns an array with
sheet indexes as keys and sheet names as values. Then you can change the sheet that's currently being read by passing that index
to the `ChangeSheet($Index)` method.
Example:
<?php
$Reader = new SpreadsheetReader('example.xlsx');
$Sheets = $Reader -> Sheets();
foreach ($Sheets as $Index => $Name)
{
echo 'Sheet #'.$Index.': '.$Name;
$Reader -> ChangeSheet($Index);
foreach ($Reader as $Row)
{
print_r($Row);
}
}
?>
If a sheet is changed to the same that is currently open, the position in the file still reverts to the beginning, so as to conform
to the same behavior as when changed to a different sheet.
### Testing
From the command line:
php test.php path-to-spreadsheet.xls
In the browser:
http://path-to-library/test.php?File=/path/to/spreadsheet.xls
### Notes about library performance
* CSV and text files are read strictly sequentially so performance should be O(n);
* When parsing XLS files, all of the file content is read into memory so large XLS files can lead to "out of memory" errors;
* XLSX files use so called "shared strings" internally to optimize for cases where the same string is repeated multiple times.
Internally XLSX is an XML text that is parsed sequentially to extract data from it, however, in some cases these shared strings are a problem -
sometimes Excel may put all, or nearly all of the strings from the spreadsheet in the shared string file (which is a separate XML text), and not necessarily in the same
order. Worst case scenario is when it is in reverse order - for each string we need to parse the shared string XML from the beginning, if we want to avoid keeping the data in memory.
To that end, the XLSX parser has a cache for shared strings that is used if the total shared string count is not too high. In case you get out of memory errors, you can
try adjusting the *SHARED_STRING_CACHE_LIMIT* constant in SpreadsheetReader_XLSX to a lower one.
### TODOs:
* ODS date formats;
### Licensing
All of the code in this library is licensed under the MIT license as included in the LICENSE file, however, for now the library
relies on php-excel-reader library for XLS file parsing which is licensed under the PHP license.
\ No newline at end of file
{
"name": "nuovo/spreadsheet-reader",
"description": "Spreadsheet reader library for Excel, OpenOffice and structured text files",
"keywords": ["spreadsheet", "xls", "xlsx", "ods", "csv", "excel", "openoffice"],
"homepage": "https://github.com/nuovo/spreadsheet-reader",
"version": "0.5.11",
"time": "2015-04-30",
"type": "library",
"license": ["MIT"],
"authors": [
{
"name": "Martins Pilsetnieks",
"email": "[email protected]",
"homepage": "http://www.nuovo.lv/"
}
],
"support": {
"email": "[email protected]"
},
"require": {
"php": ">= 5.3.0",
"ext-zip": "*"
},
"autoload": {
"classmap": ["./"]
}
}
<?php
/**
* XLS parsing uses php-excel-reader from http://code.google.com/p/php-excel-reader/
*/
header('Content-Type: text/plain');
if (isset($argv[1]))
{
$Filepath = $argv[1];
}
elseif (isset($_GET['File']))
{
$Filepath = $_GET['File'];
}
else
{
if (php_sapi_name() == 'cli')
{
echo 'Please specify filename as the first argument'.PHP_EOL;
}
else
{
echo 'Please specify filename as a HTTP GET parameter "File", e.g., "/test.php?File=test.xlsx"';
}
exit;
}
// Excel reader from http://code.google.com/p/php-excel-reader/
require('php-excel-reader/excel_reader2.php');
require('SpreadsheetReader.php');
date_default_timezone_set('UTC');
$StartMem = memory_get_usage();
echo '---------------------------------'.PHP_EOL;
echo 'Starting memory: '.$StartMem.PHP_EOL;
echo '---------------------------------'.PHP_EOL;
try
{
$Spreadsheet = new SpreadsheetReader($Filepath);
$BaseMem = memory_get_usage();
$Sheets = $Spreadsheet -> Sheets();
echo '---------------------------------'.PHP_EOL;
echo 'Spreadsheets:'.PHP_EOL;
print_r($Sheets);
echo '---------------------------------'.PHP_EOL;
echo '---------------------------------'.PHP_EOL;
foreach ($Sheets as $Index => $Name)
{
echo '---------------------------------'.PHP_EOL;
echo '*** Sheet '.$Name.' ***'.PHP_EOL;
echo '---------------------------------'.PHP_EOL;
$Time = microtime(true);
$Spreadsheet -> ChangeSheet($Index);
foreach ($Spreadsheet as $Key => $Row)
{
echo $Key.': ';
if ($Row)
{
print_r($Row);
}
else
{
var_dump($Row);
}
$CurrentMem = memory_get_usage();
echo 'Memory: '.($CurrentMem - $BaseMem).' current, '.$CurrentMem.' base'.PHP_EOL;
echo '---------------------------------'.PHP_EOL;
if ($Key && ($Key % 500 == 0))
{
echo '---------------------------------'.PHP_EOL;
echo 'Time: '.(microtime(true) - $Time);
echo '---------------------------------'.PHP_EOL;
}
}
echo PHP_EOL.'---------------------------------'.PHP_EOL;
echo 'Time: '.(microtime(true) - $Time);
echo PHP_EOL;
echo '---------------------------------'.PHP_EOL;
echo '*** End of sheet '.$Name.' ***'.PHP_EOL;
echo '---------------------------------'.PHP_EOL;
}
}
catch (Exception $E)
{
echo $E -> getMessage();
}
?>
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include('excelReaderLibrary/SpreadsheetReader.php');
include('excelReaderLibrary/php-excel-reader/excel_reader.php');
?>
\ No newline at end of file
<?php
class Customer_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
function getCustomer($customer_data = array()){
$cond = (isset($customer_data['phone']) && !empty($customer_data['phone']))?
" AND phone LIKE '%".trim($customer_data['phone'])."'":"";
$cond .= (!empty($customer_data['customer_id']))?
" AND customer_id = '".trim($customer_data['customer_id'])."'":"";
$result = $this->db->query("SELECT * FROM customers WHERE status IN (0,1) $cond");
if(empty($result)){
return;
}
return (empty($customer_data))?$result->result():$result->row();
}
function createCustomer($customer_data = array()){
if(empty($customer_data))
return 0;
if(isset($customer_data['email']) && !empty($customer_data['email'])){
$emailChk = $this->db->get_where('customers',array('email'=>$customer_data['email'],'status !='=>'2'));
if(!empty($emailChk) && $emailChk->num_rows() > 0){
return 2;
}
}
if(isset($customer_data['phone']) && !empty($customer_data['phone'])){
$phoneChk = $this->db->get_where('customers',array('phone'=>$customer_data['phone'],'status !='=>'2'));
if(!empty($phoneChk) && $phoneChk->num_rows() > 0){
return 3;
}
}
$status = $this->db->insert('customers',$customer_data);
return ($status)?1:0;;
}
function updateCustomer($customer_id = '', $customer_data = array()){
if(empty($customer_id) || empty($customer_data))
return 0;
$emailChk = $this->db->get_where('customers',array('email'=>$customer_data['email'],
'customer_id !='=>$customer_id,
'status !='=>'2'));
if(!empty($emailChk) && $emailChk->num_rows() > 0){
return 2;
}
$phoneChk = $this->db->get_where('customers',array('phone'=>$customer_data['phone'],
'customer_id !='=>$customer_id,
'status !='=>'2'));
if(!empty($phoneChk) && $phoneChk->num_rows() > 0){
return 3;
}
$status = $this->db->update('customers',$customer_data,array('customer_id'=>$customer_id));
return ($status)?1:0;;
}
function changeStatus($customer_id = '', $status = '0'){
if(empty($customer_id)){
return 0;
}
$status = $this->db->update('customers',array('status'=>$status), array('customer_id'=>$customer_id));
return $status;
}
}
?>
\ 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
$redirectUrl = (isset($customer_id) && !empty($customer_id))
?'Customer/updateCustomer/'.$customer_id
:'Customer/createCustomer';
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">
<h3 class="box-title">Customer Personal Details</h3>
</div>
<form role="form" action="<?=base_url($redirectUrl)?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
<div class="box-body">
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group has-feedback">
<label>First Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z\ . ! @ # $ % ^ & * () + = , \/]+$"
required="" name="first_name" placeholder="Enter Customer First Name"
value="<?= (isset($customer_data) && isset($customer_data->first_name))?$customer_data->first_name:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Last Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z\ . ! @ # $ % ^ & * () + = , \/]+$" required="" name="last_name" placeholder="Enter Customer Last Name"
value="<?= (isset($customer_data) && isset($customer_data->last_name))?$customer_data->last_name:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Email</label>
<input type="email" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="email" placeholder="Enter Customer Email"
value="<?= (isset($customer_data) && isset($customer_data->email))?$customer_data->email:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Phone</label>
<input type="number" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="phone" placeholder="Enter Customer Phone"
value="<?= (isset($customer_data) && isset($customer_data->phone))?$customer_data->phone:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Date Of Birth</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="date_of_birth" placeholder="Pick Date Of Birth" autocomplete="off" value="<?= (isset($customer_data) && isset($customer_data->date_of_birth))?$customer_data->date_of_birth:'' ?>">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Alternate Phone</label>
<input type="number" class="form-control" data-parsley-trigger="change"
data-parsley-minlength="2" name="alt_phone" placeholder="Enter Alternate Phone"
value="<?= (isset($customer_data) && isset($customer_data->alt_phone))?$customer_data->alt_phone:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Address</label>
<textarea class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="address" placeholder="Enter Customer Address"><?= (isset($customer_data) && isset($customer_data->address))?trim($customer_data->address):'' ?></textarea>
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputEmail1">Profile Picture</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="profile_image" src="<?= (isset($customer_data) && isset($customer_data->profile_image))?base_url($customer_data->profile_image):'' ?>" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>'" height="75" width="75" />
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="profile_image" type="file" accept="image/*"
class="<?= (isset($customer_id) && !empty($customer_id))?'':'required' ?>"
onchange="setImg(this,'profile_image')" />
</div>
</div>
</div>
</div>
</div>
<div style="border-bottom: 1px solid #f4f4f4;border-bottom-width: 1px;border-bottom-style: solid;
border-bottom-color: rgb(244, 244, 244);">
<h3 class="box-title" style="font-size: 18px !important;">
Customer Medical Details
</h3>
</div><br>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group has-feedback">
<label>SSN</label>
<input type="text" class="form-control" data-parsley-trigger="change"
data-parsley-minlength="2" name="ssn" placeholder="Provide SSN"
value="<?= (isset($customer_data) && isset($customer_data->ssn))?$customer_data->ssn:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group has-feedback">
<label>GRP</label>
<input type="text" class="form-control" data-parsley-trigger="change"
data-parsley-minlength="2" name="grp" placeholder="Provide GRP"
value="<?= (isset($customer_data) && isset($customer_data->grp))?$customer_data->grp:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Issuer</label>
<input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2"
type="text" name="issuer" placeholder="Provide Issuer"
value="<?= (isset($customer_data) && isset($customer_data->issuer))?$customer_data->issuer:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Insurance Provider</label>
<input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2"
type="text" name="insurance_provider" placeholder="Provide Insurance Provider"
value="<?= (isset($customer_data) && isset($customer_data->insurance_provider))?$customer_data->insurance_provider:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Member ID</label>
<input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2"
type="text" name="member_id" placeholder="Provide Member ID"
value="<?= (isset($customer_data) && isset($customer_data->member_id))?$customer_data->member_id:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group has-feedback">
<label>Group Number</label>
<input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2"
type="text" name="group_number" placeholder="Provide Group Number"
value="<?= (isset($customer_data) && isset($customer_data->group_number))?$customer_data->group_number:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
</div>
<div class="col-md-12">
<div class="box-footer">
<div style="text-align: center;">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
<!-- <div class="form-group has-feedback">
<label>Last Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z\ . ! @ # $ % ^ & * () + = , \/]+$" required="" name="last_name" placeholder="Enter Driver Name">
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group">
<label>Phone</label>
<input type="number" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="phone" placeholder="Enter Phone Number">
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<label>Email</label>
<input type="email" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="email_id" placeholder="Enter email ID">
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<label>Password</label>
<input type="password" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="password" placeholder="Enter Pasword">
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="col-md-12">
<div class="box-footer">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div> -->
<!-- <div class="col-md-6">
<div class="form-group">
<label>Profile Picture</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="profile_image" src="" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>'" height="75" width="75" />
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="profile_image" type="file" accept="image/*" class="required" onchange="setImg(this,'profile_image')" />
</div>
</div>
</div>
<div class="form-group">
<label style="padding-top:10px;">Licence</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="licence_img" src="" onerror="this.src='<?=base_url("assets/images/no_image.png")?>'" height="75" width="75" />
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="licence" type="file" accept="image/*" class="required" onchange="setImg(this,'licence_img')" />
</div>
</div>
</div>
<?php if($this->session->userdata['user_type'] == 1){ ?>
<div class="form-group">
<label style="padding-top:12px;">Company</label>
<select name="company_id" class="form-control required" data-parsley-trigger="change" required>
<option selected disabled>Select Company</option>
<?php
if(!empty($companies)){
foreach ($companies as $company) {
echo '<option value="'.$company->company_id.'">'.$company->company_name.'</option>';
}
}
?>
</select>
</div>
<?php }else{ ?>
<input type="hidden" name="company_id" value="<?= $this->session->userdata['id'] ?>">
<?php } ?>
<div class="form-group">
<label>Select Vehicle</label>
<select name="vehicle_id" class="form-control required" data-parsley-trigger="change" required>
<option selected disabled>Select Vehicle Type</option>
<?php
if(!empty($vehicles)){
foreach ($vehicles as $vehicle) {
echo '<option value="'.$vehicle->vehicle_id.'">'.$vehicle->vehicle_type.'</option>';
}
}
?>
</select>
</div>
</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-xs-12">
<div class="box box-warning">
<div class="box-body">
<table id="driverTable" class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="150px;">Name</th>
<th width="100px;">Phone</th>
<th width="150px;">Email ID</th>
<th width="50px;">Age</th>
<th width="150px;">Date Of Birth</th>
<th width="50px;">Status</th>
<th width="500px;">Action</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($customerData)){
foreach($customerData as $customer) {
?>
<tr>
<th class="hidden"><?= $customer->customer_id ?></th>
<td class="center"><?= $customer->first_name.' '.$customer->last_name ?></th>
<td class="center"><?= $customer->phone ?></th>
<td class="center"><?= $customer->email ?></th>
<td class="center"><?= $customer->age ?></th>
<td class="center"><?= $customer->date_of_birth ?></th>
<td class="center"><?= ($customer->status == '1')?'Active':'Inactive'?></td>
<td class="center">
<a class="btn btn-sm btn-primary" id="viewCustomer" customer_id="<?= encode_param($customer->customer_id) ?>">
<i class="fa fa-fw fa-edit"></i>View
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url('Customer/editCustomer/'.encode_param($customer->customer_id)) ?>">
<i class="fa fa-fw fa-trash"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Customer/changeStatus/".encode_param($customer->customer_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php if($customer->status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Customer/changeStatus/".encode_param($customer->customer_id))."/0" ?>">
<i class="fa fa-cog"></i> De-activate
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Customer/changeStatus/".encode_param($customer->customer_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
</a>
<?php } ?>
</td>
</tr>
<?php
}
}?>
</tbody>
</table>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery('[id="viewCustomer"]').on('click',function() {
markCalBak(jQuery(this).attr('customer_id'));
});
function markCalBak(customer_id){
if(customer_id=='' || customer_id==undefined || customer_id=='undefined' || customer_id==null || customer_id=='null'){
return true;
}
modalTrigger('Ride Details','');
addModalLoader();
jQuery.ajax({
url : base_url+"Customer/getCustomerData",
type : 'POST',
data : {'customer_id':customer_id},
success: function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == '0'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var customer_data = resp_data['customer_data'];
// Direct HTML
var html = '<div class="col-xs-12"><div class="col-md-2"> '+
'<div class="form-group has-feedback"> '+
'<img id="customerProfileImg" src="'+base_url+customer_data['profile_image']+'" '+
'height="100" width="100" /> '+
'</div> '+
'</div> '+
'<div class="col-md-5"> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 38px;">First Name </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['first_name']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 68px;">Email </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['email']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 55px;">Address </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['address']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 80px;">Age </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['age']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 79px;">SSN </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['ssn']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 68px;">Issuer </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['issuer']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 39px;">Member ID </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['member_id']+
'</label> '+
'</div> '+
'</div> '+
'<div class="col-md-5"> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 56px;">Last Name </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['last_name']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 80px;">Phone </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['phone']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 43px;">Date Of Dirth </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['date_of_birth']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 25px;">Alternate Phone </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['alt_phone']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 96px;">GRP </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['grp']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 11px;">Insurance Provider </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['insurance_provider']+
'</label> '+
'</div> '+
'<div class="form-group has-feedback"> '+
'<span style="padding-right: 34px;">Group Number </span> : '+
'<label style="padding-left: 10px;">'+
customer_data['group_number']+
'</label> '+
'</div> '+
'</div> '+
'</div>';
// Dymanic Drawing
// var html = '', bodyHtml = '', profPic = '';
// profPic = '<div class="col-md-2"> '+
// '<div class="form-group has-feedback"> '+
// '<img id="customerProfileImg" src="'+base_url+customer_data['profile_image']+'" '+
// 'height="100" width="100" /> '+
// '</div> '+
// '</div>';
// bodyHtml += '<div class="col-md-10">';
// jQuery.each(customer_data, function(key,value) {
// if(key == 'customer_id' || key == 'status'){
// return true;
// }
// key = key.replace(/_/g,' ').toUpperCase();
// value = (value==''||value==null||value=='null'||value==undefined||value=='undefined')?'--':value;
// value = value;
// bodyHtml += '<div class="col-md-3">'+key+'</div>'+
// '<div class="col-md-1"><span>:</span></div>'+
// '<div class="col-md-6">'+value+'</div>';
// });
// bodyHtml += '</div>';
// html = '<div class="col-xs-12">'+profPic+bodyHtml+'</div>';
remModalLoader();
jQuery('[id="modal_content"]').html(html);
jQuery('[id="customerProfileImg"]').error(function() {
jQuery('[id="customerProfileImg"]').attr('src',base_url+'assets/images/user_avatar.jpg');
});
},
fail: function(xhr, textStatus, errorThrown){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
});
}
</script>
\ No newline at end of file
......@@ -11,8 +11,8 @@
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li>User</li>
<li class="active">View User</li>
<li><?= $menu ?></li>
<li class="active"><?= $sub_menu ?></li>
</ol>
</section>
<!-- Main content -->
......
......@@ -268,3 +268,9 @@
</div>
</section>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('[name^="TDLS.transport_id"],[name^="TDLS.medical_no"],[name^="TDLS.patient_name"],[name^="TDLS.age"],[name^="TDLS.phone"],[name^="APRES.reason"],[name^="TDLS.appointment_time"]').prop("checked", true).parent().closest('div').addClass('disable-block');
});
</script>
\ No newline at end of file
......@@ -13,6 +13,9 @@
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');
$reqFields = array(0,2,1,4,5,7,23,28,22,14,11,8,10,11,12,13);
$headerArr = array_replace(array_flip($reqFields),$headerArr);
?>
<div class="content-wrapper">
<section class="content-header">
......@@ -50,10 +53,18 @@
<table id="mappedHeaders" class="border-cls" style="width:98%;">
<?php
foreach($headerArr AS $id => $header){
$reqDisp = '';
$requiredFlag = 'required="no"';
if(in_array($id,$reqFields)){
$reqDisp = '<i class="fa fa-asterisk text-danger" style="font-size:8px;"></i>';
$requiredFlag = 'required="yes"';
}
echo '<tr class="border-cls tr-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)"
'.str_replace('_',' ',$header).' '.$reqDisp.'
</td>
<td class="headtag-td">
<div type="child" '.$requiredFlag.' class="drag-box" id="order_'.$id.'" ondrop="dropElement(event)"
ondragover="allowDropElement(event)" headOrder="'.$id.'"></div>
</td>
</tr>';
......
<?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" >
<!-- Content Header (Page header) -->
......@@ -107,7 +107,11 @@
</th>
<?php
$json_ride = array_merge(array_flip($headerArr),$json_ride);
foreach($json_ride AS $key => $data){
if(!in_array($key,$headerArr)){
continue;
}
switch ($key){
case 'Wheelchair_Flag': $json_ride[$key] = ($data == 1)?'YES':'NO'; break;
case 'Attendant_Flag': $json_ride[$key] = ($data == 1)?'YES':'NO'; break;
......
......@@ -82,8 +82,8 @@
<input type="text" name="smtp_password" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['smtp_password'] ?>">
</div>
<div class="form-group col-xs-4">
<label>SMTP Host</label>
<input type="text" name="smtp_host" class="form-control required" placeholder="Enter Host Name" value="<?= $data['smtp_host'] ?>">
<label>Google API Key</label>
<input type="text" name="google_api_key" class="form-control required" placeholder="Enter Google API" value="<?= $data['google_api_key'] ?>">
</div>
</div>
</div>
......
......@@ -2,7 +2,7 @@
base_url = "<?php echo base_url(); ?>";
country_flag = '<?= $this->session->userdata['settings']['country_flag'] ?>';
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC9JX3BZZfx2S6GQieC_PqjuJdUbZ7_wyM&libraries=places"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=<?= $this->session->userdata['settings']['google_api_key'] ?>&libraries=places"></script>
<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/pace.js"></script>
<script src="<?php echo base_url(); ?>assets/js/select2.full.min.js"></script>
......
......@@ -40,10 +40,32 @@
</li>
</ul>
</li>
<?php if($this->session->userdata['user_type'] == 1){ ?>
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
<span>Customer Management</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li>
<a href="<?= base_url('Customer/addCustomerUser') ?>">
<i class="fa fa-circle-o text-aqua"></i>
Add Customer
</a>
</li>
<li>
<a href="<?= base_url('Customer/listCustomerUsers') ?>">
<i class="fa fa-circle-o text-aqua"></i>
View Customer
</a>
</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
<span>Company Management</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
......
......@@ -302,3 +302,8 @@
.tr-cls {
height: 43px;
}
.disable-block {
pointer-events: none;
opacity: 0.5;
}
\ No newline at end of file
......@@ -41,6 +41,7 @@ function checkChild(thisObj){
} else {
jQuery('[id^="table_'+table+'_"]').prop("checked", false);
}
jQuery('[name^="TDLS.transport_id"],[name^="TDLS.medical_no"],[name^="TDLS.patient_name"],[name^="TDLS.age"],[name^="TDLS.phone"],[name^="APRES.reason"],[name^="TDLS.appointment_time"]').prop("checked", true).parent().closest('div').addClass('disable-block');
}
jQuery('[name="fieldType"]').click(function(){
......@@ -65,7 +66,6 @@ jQuery('[id="rGenerate"]').click(function(){
}
thisObj.attr('dmclick','1');
jQuery('[name^="TDLS.transport_id"],[name^="TDLS.medical_no"],[name^="TDLS.patient_name"],[name^="TDLS.age"],[name^="TDLS.phone"],[name^="APRES.reason"],[name^="TDLS.appointment_time"]').prop("checked", true);
if(fieldType == 'custom'){
jQuery.each(jQuery('[id="field_list"]').serialize().split('&'), function (key,field) {
var field_arr = field.split('=');
......@@ -162,7 +162,7 @@ function viewOrderDetails(key){
colCount++;
}
});
body_html += '</div>';
body_html += (rowHtml != '')?rowHtml+'</div>':'</div>';
modalTrigger('Ride Details',body_html);
}
......@@ -289,6 +289,7 @@ function dragElement(ev) {
function dropElement(ev) {
ev.preventDefault();
jQuery(event.target).css('border-color','#A8A8A8');
var tmporderid = ev.dataTransfer.getData("tmporderid");
ev.target.appendChild(document.getElementById(tmporderid));
}
......@@ -296,7 +297,7 @@ function dropElement(ev) {
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(), childHead = '', errMsg = '';
import_file = jQuery('[name="import_file"]').val(), childHead = '', errMsg = '', error = '0';
if(thisObj.attr('dmclick') != 0){
return false;
......@@ -313,17 +314,21 @@ jQuery('[id="upload_excell"]').click(function(){
showFullScreenLoader();
thisObj.attr('dmclick',1);
jQuery('[id="mappedHeaders"] [type="child"]').each(function(){
jQuery('[id="mappedHeaders"] [required="yes"]').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;
childThisObj.css('border-color','red');
setErrModal('Error Uploading Excell','Map all required fields..!');
error = '1';
}
childHead = childThisObj.children();
headerOrder[childThisObj.attr('headOrder')] = childHead.attr('tmporder');
});
if(error == '1'){
return false;
}
jQuery.ajax({
url : base_url+"Ride/import",
type : 'POST',
......
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