From 84b636f93eab55df37524fa298cc7bcf7368a331 Mon Sep 17 00:00:00 2001 From: Tobin <tobin@techware.in> Date: Wed, 3 Oct 2018 09:28:45 +0530 Subject: [PATCH] daily --- application/controllers/Ride.php | 7 +++++-- application/models/Ride_model.php | 1 + application/views/Ride/add_transport.php | 14 ++++++++++++++ application/views/Ride/view.php | 43 +++++++++++++++++++++++-------------------- application/views/Ride/view_rides.php | 24 ++++++++++++++---------- 5 files changed, 57 insertions(+), 32 deletions(-) diff --git a/application/controllers/Ride.php b/application/controllers/Ride.php index 9d93dbd..043e631 100644 --- a/application/controllers/Ride.php +++ b/application/controllers/Ride.php @@ -17,6 +17,7 @@ class Ride extends CI_Controller { $this->load->model('Broker_model'); $this->load->model('Driver_model'); $this->load->model('Vehicle_model'); + $this->load->model('Company_model'); $template['page'] = 'Ride/add_transport'; @@ -29,6 +30,7 @@ class Ride extends CI_Controller { $template['trip_type'] = $this->Ride_model->getTripType(); $template['driver_data'] = $this->Driver_model->getDriver(); $template['broker_data'] = $this->Broker_model->getBroker(); + $template['company_data'] = $this->Company_model->getCompany(); $template['vehicle_data'] = $this->Vehicle_model->getVehicle(); $template['appointment_reason'] = $this->Ride_model->getAppReason(); @@ -54,7 +56,7 @@ class Ride extends CI_Controller { if($header == 0){ $headerArr[] = $col; }else{ - $rowArr[][$headerArr[$colCnt]] = $col; + $rowArr[$headerArr[$colCnt]] = $col; $colCnt++; } } @@ -136,7 +138,7 @@ class Ride extends CI_Controller { $this->session->set_flashdata('message',$flashMsg); redirect(base_url('Ride/import_ride')); } - $data = array("Appointment Date"=>$_POST['appointment_date'],"Appointment Time"=>$_POST['appointment_time'],"Member's First Name"=>$_POST['first_name'],"Member's Last Name"=>$_POST['last_name']); + $data = array("Member's First Name"=>$_POST['first_name'],"Member's Last Name"=>$_POST['last_name'],"Appointment Date"=>$_POST['appointment_date'],"Appointment Time"=>$_POST['appointment_time']); $_POST['patient_name'] = $_POST['first_name'].' '.$_POST['last_name']; $_POST['appointment_time'] = $_POST['appointment_date'].' '.$_POST['appointment_time']; @@ -211,6 +213,7 @@ class Ride extends CI_Controller { $this->session->set_flashdata('message',$flashMsg); redirect(base_url('Ride/view_rides')); } + $template['data'] = $ride_data; $template['ride_data'] = json_decode($ride_data->data,true); $this->load->view('template',$template); } diff --git a/application/models/Ride_model.php b/application/models/Ride_model.php index 5581148..68e8ed1 100644 --- a/application/models/Ride_model.php +++ b/application/models/Ride_model.php @@ -34,6 +34,7 @@ class Ride_model extends CI_Model { return 0; } $status = $this->db->insert('transport_details',$data); + pr($this->db->last_query()); return ($status)?1:0; } diff --git a/application/views/Ride/add_transport.php b/application/views/Ride/add_transport.php index c3e237a..eb1b184 100644 --- a/application/views/Ride/add_transport.php +++ b/application/views/Ride/add_transport.php @@ -165,6 +165,20 @@ ?> </select> </div> + <!-- 3 - 5 --> + <div class="form-group has-feedback"> + <label>Select NEMT Company</label> + <select name="company_id" class="form-control required" data-parsley-trigger="change" required> + <option selected disabled>Select Company</option> + <?php + if(!empty($company_data)){ + foreach ($company_data as $company) { + echo '<option value="'.$company->company_id.'">'.$company->company_name.'</option>'; + } + } + ?> + </select> + </div> </div> </div> <div class="col-md-12"> diff --git a/application/views/Ride/view.php b/application/views/Ride/view.php index 803e0d3..59bbc9d 100644 --- a/application/views/Ride/view.php +++ b/application/views/Ride/view.php @@ -26,33 +26,36 @@ <div class="box-header with-border"> <div class="col-md-6"><h3 class="box-title">Driver Details</h3></div> <div class="col-md-6" align="right"> - <a class="btn btn-sm btn-primary" href="<?= base_url('Driver/edit/'.encode_param($driver_id)) ?>">Edit</a> - <a class="btn btn-sm btn-primary" href="<?= base_url('Driver/driver_list') ?>">Back</a> + <a class="btn btn-sm btn-primary" href="<?= base_url('Ride/view_rides') ?>">Back</a> </div> </div> <div class="box-body"> - <div> - <div class="col-md-12"> - <div class="col-md-6"> - <div class="col-md-2"> Name </div> - <div class="col-md-1"> : </div> - <div class="col-md-3"> Name </div> - </div> - </div> + <div class="col-md-6"> Booking Type </div> + <div class="col-md-1"> : </div> + <div class="col-md-5"> <?= (empty($data->broker_name))?'Phone Booking':$data->broker_name ?> </div> <?php - $row = 0; - $row_html = '<div class="col-md-2"> {:label} </div> + $col = 0; + $row_html = '<div class="col-md-6"> {:label} </div> <div class="col-md-1"> : </div> - <div class="col-md-3"> {:value} </div>' + <div class="col-md-5"> {:value} </div>'; + + if(empty($data->broker_id)){ + echo str_replace(array('{:label}','{:value}'), array('Medicaid Number',$data->medical_no), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Member Name',$data->patient_name), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Member\'s Age',$data->age), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Member\'s Phone Number',$data->phone), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Appointment Date & Time',$data->appointment_time), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Pickup Address',$data->pickup_location), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Delivery Address',$data->drop_location), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Trip Reason Code',$data->reason_code), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Vehicle Type',$data->vehicle_type), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Trip Type',$data->trip_type), $row_html); + echo str_replace(array('{:label}','{:value}'), array('Trip Cost',$data->trip_cost), $row_html); + } foreach($ride_data AS $key => $ride){ - echo ($row == 0)?'<div class="col-md-12">':''; - echo ($row == 0)?'<div class="col-md-6">':''; - echo str_replace(array('{:label}','{:value}'), array($key,$ride), $row_html); - echo ($col == 2)?'</div>':''; - echo ($col == 1)?'</div>':''; + echo str_replace(array('{:label}','{:value}'), array($key,$ride), $row_html); } - ?> - </div> + ?> </div> </section> </div> diff --git a/application/views/Ride/view_rides.php b/application/views/Ride/view_rides.php index c9ad360..97ad82b 100644 --- a/application/views/Ride/view_rides.php +++ b/application/views/Ride/view_rides.php @@ -36,10 +36,10 @@ <th width="150px;">Patient Name</th> <th width="50px;">Age</th> <th width="100px;">Phone</th> - <th width="150px;">Appintment Date</th> + <th width="150px;">Appointment Date</th> <th width="150px;">Status</th> <th width="150px;">Data Source</th> - <th width="300px;">Action</th> + <th width="320px;">Action</th> </tr> </thead> <tbody> @@ -55,12 +55,16 @@ <td class="center"><?= date('d-M-Y G:i',strtotime($ride->appointment_time)) ?></th> <td class="center"> <?php - switch ($ride->status){ - case 0: echo 'Inactive';break; - case 1: echo 'Waiting For Drivers';break; - case 3: echo 'Driver Accepted';break; - case 4: echo 'Ride Completed';break; - case 4: echo 'Ride Cancelled';break; + if(date('Ymd Gi') > strtotime($ride->appointment_time) && ($ride->status == 1 || $ride->status == 0)){ + echo 'Ride Expired'; + }else{ + switch ($ride->status){ + case 0: echo 'Inactive';break; + case 1: echo 'Waiting For Drivers';break; + case 3: echo 'Driver Accepted';break; + case 4: echo 'Ride Completed';break; + case 4: echo 'Ride Cancelled';break; + } } ?> </td> @@ -75,7 +79,7 @@ onClick="return doconfirm()"> <i class="fa fa-fw fa-trash"></i>Delete </a> - <?php if($ride->status == 1 && date('Ymd Gi') < $ride->appointment_time){?> + <?php if($ride->status == 1 && date('Ymd Gi') < strtotime($ride->appointment_time)){?> <a class="btn btn-sm btn-primary" href="<?= base_url('Ride/view/'.encode_param($ride->transport_id)) ?>"> <i class="fa fa-fw fa-edit"></i>Assign Driver @@ -90,4 +94,4 @@ </div> </div> </section> -</div> +</div> \ No newline at end of file -- libgit2 0.27.1