Commit ef51177d by Tobin

dc

parent c65d1d6e
...@@ -22,7 +22,7 @@ class Booking extends CI_Controller { ...@@ -22,7 +22,7 @@ class Booking extends CI_Controller {
$template['page_head'] = "Booking Management"; $template['page_head'] = "Booking Management";
$provider_id = ($this->session->userdata('user_type')==2)?$this->session->userdata('id'):''; $provider_id = ($this->session->userdata('user_type')==2)?$this->session->userdata('id'):'';
$template['booking_data'] = $this->Booking_model->getBookingData('',$provider_id,'0,1,2,3,5'); $template['booking_data'] = $this->Booking_model->getBookingData('',$provider_id,'0,1,2,3,5,6');
$this->load->view('template',$template); $this->load->view('template',$template);
} }
...@@ -35,7 +35,7 @@ class Booking extends CI_Controller { ...@@ -35,7 +35,7 @@ class Booking extends CI_Controller {
$booking_id = (!is_numeric($_POST['booking_id']))? $booking_id = (!is_numeric($_POST['booking_id']))?
decode_param($_POST['booking_id']):$_POST['booking_id']; decode_param($_POST['booking_id']):$_POST['booking_id'];
$view_all = (isset($_POST['view_all'])&&$_POST['view_all'] != '')?$_POST['view_all']:'0,1,2,3,5'; $view_all = (isset($_POST['view_all'])&&$_POST['view_all'] != '')?$_POST['view_all']:'0,1,2,3,5,6';
$provider_id = ($this->session->userdata('user_type')==2)?$this->session->userdata('id'):''; $provider_id = ($this->session->userdata('user_type')==2)?$this->session->userdata('id'):'';
$bookData['bookData'] = $this->Booking_model->getBookingData($booking_id,$provider_id,$view_all); $bookData['bookData'] = $this->Booking_model->getBookingData($booking_id,$provider_id,$view_all);
...@@ -48,10 +48,11 @@ class Booking extends CI_Controller { ...@@ -48,10 +48,11 @@ class Booking extends CI_Controller {
if(!isset($_POST) || !isset($_POST['booking_id']) || empty($_POST['booking_id'])){ if(!isset($_POST) || !isset($_POST['booking_id']) || empty($_POST['booking_id'])){
echo json_encode(array('status'=>'0'));exit; echo json_encode(array('status'=>'0'));exit;
} }
$status = (isset($_POST['status']) && $_POST['status'] != '')?$_POST['status']:'1';
$booking_id = decode_param($_POST['booking_id']); $booking_id = decode_param($_POST['booking_id']);
$resp = $this->Booking_model->changeStatus($booking_id,'4'); $resp = $this->Booking_model->changeStatus($booking_id,$status);
if($resp){ if($resp){
echo json_encode(array('status'=>'1'));exit; echo json_encode(array('status'=>'1','data'=>array('booking_id'=>$_POST['booking_id'])));exit;
} }
echo json_encode(array('status'=>'0'));exit; echo json_encode(array('status'=>'0'));exit;
} }
......
...@@ -5,7 +5,7 @@ class Booking_model extends CI_Model { ...@@ -5,7 +5,7 @@ class Booking_model extends CI_Model {
parent::_construct(); parent::_construct();
} }
public function getBookingData($booking_id='',$provider_id='',$view='0,1,2,3,5'){ public function getBookingData($booking_id='',$provider_id='',$view='0,1,2,3,5,6'){
$cond = (!empty($view))?" BOK.status IN ($view) ":" BOK.status != '4' "; $cond = (!empty($view))?" BOK.status IN ($view) ":" BOK.status != '4' ";
$cond .= (!empty($booking_id))?" AND BOK.id='$booking_id' ":""; $cond .= (!empty($booking_id))?" AND BOK.id='$booking_id' ":"";
$cond .= (!empty($provider_id))?" AND EVT.provider_id='$provider_id' ":""; $cond .= (!empty($provider_id))?" AND EVT.provider_id='$provider_id' ":"";
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<th class="center"><?= $booking->customer_name ?></th> <th class="center"><?= $booking->customer_name ?></th>
<th class="center"><?= $booking->date.' '.$booking->time ?></th> <th class="center"><?= $booking->date.' '.$booking->time ?></th>
<th class="center"><?= $booking->amount ?></th> <th class="center"><?= $booking->amount ?></th>
<th class="center"> <th class="center" id="bookingStatus_<?= encode_param($booking->booking_id) ?>">
<?php <?php
switch($booking->book_status){ switch($booking->book_status){
case 0: echo 'Cancelled'; break; case 0: echo 'Cancelled'; break;
...@@ -68,16 +68,28 @@ ...@@ -68,16 +68,28 @@
case 3: echo 'Pending'; break; case 3: echo 'Pending'; break;
case 4: echo 'Deleted'; break; case 4: echo 'Deleted'; break;
case 5: echo 'Payment Failed'; break; case 5: echo 'Payment Failed'; break;
case 6: echo 'Waiting for Aproval'; break;
} }
?> ?>
</th> </th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-info" id="viewBooking" booking_id="<?= encode_param($booking->booking_id) ?>"> <a class="cpoint text-primary" id="viewBooking"
booking_id="<?= encode_param($booking->booking_id) ?>">
<i class="fa fa-fw fa-eye"></i>View <i class="fa fa-fw fa-eye"></i>View
</a> </a> <br>
<!-- <a class="btn btn-sm btn-danger" status="2" onclick="confirmDelete(jQuery(this),'Booking/changeStatus',{'booking_id':'<?= encode_param($booking->booking_id) ?>'})"> <?php
<i class="fa fa-fw fa-trash"></i>Delete if($this->session->userdata('user_type')==2 && $booking->book_status == '6'){
</a> --> $msg = "Are you sure to Aprove this booking ?";
$bookId = encode_param($booking->booking_id);
$param = "{'booking_id':'$bookId','alertMsg':'$msg'}"; ?>
<a id="approveBooking_<?= encode_param($booking->booking_id) ?>"
class="cpoint text-success" status="1" call_back="updateBokApproved"
status_id="<?= encode_param($booking->booking_id) ?>"
onclick="confirmDelete(jQuery(this),'Booking/changeStatus',<?= $param ?>)">
<i class="fa fa-fw fa-check"></i>Approve
</a>
<?php } ?>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>
...@@ -89,4 +101,4 @@ ...@@ -89,4 +101,4 @@
</div> </div>
</div> </div>
</section> </section>
</div> </div>
\ No newline at end of file
...@@ -603,7 +603,7 @@ function viewBooking(booking_id){ ...@@ -603,7 +603,7 @@ function viewBooking(booking_id){
jQuery.ajax({ jQuery.ajax({
url : base_url+"Booking/getBookingData", url : base_url+"Booking/getBookingData",
type : 'POST', type : 'POST',
data : {'booking_id':booking_id,'view_all':'0,1,2,3,4,5'}, data : {'booking_id':booking_id,'view_all':'0,1,2,3,4,5,6'},
success: function(resp){ success: function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){ if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader(); remModalLoader();
...@@ -933,8 +933,22 @@ function setPromoStatus(elmId,data){ ...@@ -933,8 +933,22 @@ function setPromoStatus(elmId,data){
jQuery('[id="statusFlag_'+elmId+'"]').html(data['c_status']); jQuery('[id="statusFlag_'+elmId+'"]').html(data['c_status']);
} }
function updateBokApproved(elmId,data){
if(data==undefined || data=='undefined' || data==null || data=='null' || data=='' ||
elmId==undefined || elmId=='undefined' || elmId==null || elmId=='null' || elmId==''){
return false;
}
jQuery('[id="bookingStatus_'+elmId+'"]').html('Booked');
console.log('[id="bookingStatus_'+elmId+'"]');
jQuery('[id="approveBooking_'+elmId+'"]').remove();
}
function confirmDelete(thisObj,fnName,params){ function confirmDelete(thisObj,fnName,params){
if(confirm("Are you sure to delete permanently?")){ var msg = "Are you sure to delete permanently ?";
if(params.alertMsg){
msg = params.alertMsg;
}
if(confirm(msg)){
updateStatus(thisObj,fnName,params,status); updateStatus(thisObj,fnName,params,status);
} }
} }
...@@ -1011,4 +1025,4 @@ jQuery('[id^="addMultiLang"]').on('click',function() { ...@@ -1011,4 +1025,4 @@ jQuery('[id^="addMultiLang"]').on('click',function() {
jQuery('[id="showMultiLangBlock_'+block+'"]').removeClass('hide'); jQuery('[id="showMultiLangBlock_'+block+'"]').removeClass('hide');
} }
}); });
\ 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