Commit 90058168 by Tobin

dc

parent 1a377254
...@@ -42,18 +42,17 @@ class Booking extends CI_Controller { ...@@ -42,18 +42,17 @@ class Booking extends CI_Controller {
echo $viewPage;exit; echo $viewPage;exit;
} }
function changeStatus($booking_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['booking_id']) || empty($_POST['booking_id'])){
if(empty($booking_id) || !is_numeric($booking_id = decode_param($booking_id))){ echo json_encode(array('status'=>'0'));exit;
$this->session->set_flashdata('message',$flashMsg); }
redirect(base_url('Booking/viewBookings')); $booking_id = decode_param($_POST['booking_id']);
} $resp = $this->Booking_model->changeStatus($booking_id,'4');
$status = $this->Booking_model->changeStatus($booking_id,$status); if($resp){
if(!$status){ echo json_encode(array('status'=>'1'));exit;
$this->session->set_flashdata('message',$flashMsg); }
} echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Booking/viewBookings')); }
}
function generateReport(){ function generateReport(){
......
...@@ -189,18 +189,18 @@ class Category extends CI_Controller { ...@@ -189,18 +189,18 @@ class Category extends CI_Controller {
redirect(base_url('Category/editCategory/'.$category_id)); redirect(base_url('Category/editCategory/'.$category_id));
} }
function changeStatus($category_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['category_id']) || empty($_POST['category_id']) ||
if(empty($category_id)){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Category/listCategory'));
} }
$category_id = decode_param($category_id); $status = $_POST['status'];
$status = $this->Category_model->changeStatus($category_id,$status); $category_id = decode_param($_POST['category_id']);
if(!$status){ $resp = $this->Category_model->changeStatus($category_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
echo json_encode(array('status'=>'1'));exit;
} }
redirect(base_url('Category/listCategory')); echo json_encode(array('status'=>'0'));exit;
} }
} }
?> ?>
\ No newline at end of file
...@@ -107,44 +107,37 @@ class Checker extends CI_Controller { ...@@ -107,44 +107,37 @@ class Checker extends CI_Controller {
redirect(base_url('Checker/addChecker')); redirect(base_url('Checker/addChecker'));
} }
function changeStatus($checker_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['checker_id']) || empty($_POST['checker_id']) ||
if(empty($checker_id)){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Checker/viewCheckers'));
} }
$checker_id = decode_param($checker_id); $status = $_POST['status'];
$checker_id = decode_param($_POST['checker_id']);
$resp = $this->Checker_model->changeStatus($checker_id,$status); $resp = $this->Checker_model->changeStatus($checker_id,$status);
if(!$resp){ if($resp){
$this->session->set_flashdata('message',$flashMsg); $this->load->model('Api_model');
} else { $checkerData = $this->db->get_where('checker',array('id'=>$checker_id))->row();
if($status == 1){
$this->load->model('Api_model'); if(!empty($checkerData)){
$checkerData = $this->db->get_where('checker',array('id'=>$checker_id))->row(); $subject = "Your Checker Account is now activated";
$email_id = $checkerData->username;
if(!empty($checkerData)){
$subject = "Your Checker Account is now activated"; $message = "<html><body>Your Checker Account for the username
$email_id = $checkerData->username; <strong>".$email_id."</strong> is now activated.</body></html>";
$message = "<html> $template = getNotifTemplate();
<body> if(isset($template['checker_activation_mail']) &&
Your Checker Account for the username !empty($template['checker_activation_mail'])){
<strong>".$email_id."</strong> is now activated. $message = str_replace(array('{:user_name}'),array($email_id),
</body> $template['checker_activation_mail']);
</html>";
$template = getNotifTemplate();
if(isset($template['checker_activation_mail']) &&
!empty($template['checker_activation_mail'])){
$message = str_replace(array('{:user_name}'),array($email_id),
$template['checker_activation_mail']);
}
$this->Api_model->send_mail($subject,$email_id,$message);
} }
$this->Api_model->send_mail($subject,$email_id,$message);
} }
echo json_encode(array('status'=>'1'));exit;
} }
redirect(base_url('Checker/viewCheckers')); echo json_encode(array('status'=>'0'));exit;
} }
} }
?> ?>
\ No newline at end of file
...@@ -53,19 +53,20 @@ class Customer extends CI_Controller { ...@@ -53,19 +53,20 @@ class Customer extends CI_Controller {
$resArr['data'] = $mechData; $resArr['data'] = $mechData;
echo json_encode($resArr);exit; echo json_encode($resArr);exit;
} }
function changeStatus($customer_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['customer_id']) || empty($_POST['customer_id']) ||
if(empty($customer_id) || !is_numeric($customer_id = decode_param($customer_id))){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Customer/viewCustomers')); }
} $status = $_POST['status'];
$status = $this->Customer_model->changeStatus($customer_id,$status); $customer_id = decode_param($_POST['customer_id']);
if(!$status){ $resp = $this->Customer_model->changeStatus($customer_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
} echo json_encode(array('status'=>'1'));exit;
redirect(base_url('Customer/viewCustomers')); }
} echo json_encode(array('status'=>'0'));exit;
}
public function createCustomer(){ public function createCustomer(){
$err = 0; $err = 0;
...@@ -84,7 +85,7 @@ class Customer extends CI_Controller { ...@@ -84,7 +85,7 @@ class Customer extends CI_Controller {
}else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){ }else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){
$err = 1; $err = 1;
$errMsg = 'Provide Customer Phone'; $errMsg = 'Provide Customer Phone';
}else if($err == 0 && (!isset($_POST['city']) || empty($_POST['city']))){ }else if($err == 0 && (!isset($_POST['profile_city']) || empty($_POST['profile_city']))){
$err = 1; $err = 1;
$errMsg = 'Provide a City Name'; $errMsg = 'Provide a City Name';
}else if($err == 0 && (!isset($_POST['gender']) || empty($_POST['gender']))){ }else if($err == 0 && (!isset($_POST['gender']) || empty($_POST['gender']))){
...@@ -196,7 +197,7 @@ class Customer extends CI_Controller { ...@@ -196,7 +197,7 @@ class Customer extends CI_Controller {
}else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){ }else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){
$err = 1; $err = 1;
$errMsg = 'Provide Customer Phone'; $errMsg = 'Provide Customer Phone';
}else if($err == 0 && (!isset($_POST['city']) || empty($_POST['city']))){ }else if($err == 0 && (!isset($_POST['profile_city']) || empty($_POST['profile_city']))){
$err = 1; $err = 1;
$errMsg = 'Provide a City Name'; $errMsg = 'Provide a City Name';
}else if($err == 0 && (!isset($_POST['gender']) || empty($_POST['gender']))){ }else if($err == 0 && (!isset($_POST['gender']) || empty($_POST['gender']))){
......
...@@ -379,18 +379,18 @@ class Event extends CI_Controller { ...@@ -379,18 +379,18 @@ class Event extends CI_Controller {
redirect(base_url('Event/listEvents')); redirect(base_url('Event/listEvents'));
} }
function changeStatus($event_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['event_id']) || empty($_POST['event_id']) ||
if(empty($event_id)){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Event/listEvents'));
} }
$event_id = decode_param($event_id); $status = $_POST['status'];
$status = $this->Event_model->changeStatus($event_id,$status); $event_id = decode_param($_POST['event_id']);
if(!$status){ $resp = $this->Event_model->changeStatus($event_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
echo json_encode(array('status'=>'1'));exit;
} }
redirect(base_url('Event/listEvents')); echo json_encode(array('status'=>'0'));exit;
} }
function getEventData(){ function getEventData(){
......
...@@ -126,18 +126,18 @@ class Host extends CI_Controller { ...@@ -126,18 +126,18 @@ class Host extends CI_Controller {
redirect(base_url('Host/editHostCategory/'.$host_id)); redirect(base_url('Host/editHostCategory/'.$host_id));
} }
function changeStatus($host_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['host_id']) || empty($_POST['host_id']) ||
if(empty($host_id)){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Host/listHostCategory'));
} }
$host_id = decode_param($host_id); $status = $_POST['status'];
$status = $this->Host_model->changeStatus($host_id,$status); $host_id = decode_param($_POST['host_id']);
if(!$status){ $resp = $this->Host_model->changeStatus($host_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
echo json_encode(array('status'=>'1'));exit;
} }
redirect(base_url('Host/listHostCategory')); echo json_encode(array('status'=>'0'));exit;
} }
} }
?> ?>
\ No newline at end of file
...@@ -54,31 +54,30 @@ class Provider extends CI_Controller { ...@@ -54,31 +54,30 @@ class Provider extends CI_Controller {
echo json_encode($resArr);exit; echo json_encode($resArr);exit;
} }
function changeStatus($provider_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['provider_id']) || empty($_POST['provider_id']) ||
if(empty($provider_id) || !is_numeric($provider_id = decode_param($provider_id))){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Provider/viewProviders')); }
} $status = $_POST['status'];
$resp = $this->Provider_model->changeStatus($provider_id,$status); $provider_id = decode_param($_POST['provider_id']);
if(!$resp){ $resp = $this->Provider_model->changeStatus($provider_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
} else { $this->load->model('Api_model');
if($status == 1){ $providerData = $this->Provider_model->getProviderData($provider_id,'0,1');
$this->load->model('Api_model');
$providerData = $this->Provider_model->getProviderData($provider_id,'0,1');
$subject = "Your Organizer Account is now activated";
$email_id = $providerData->email;
if(!empty($providerData)){
$subject = "Your Organizer Account is now activated";
$email_id = $providerData->email;
$template = getNotifTemplate(); $template = getNotifTemplate();
$message = "<html> $message = "<html>
<body> <body>
Your Organizer Account for the username Your Organizer Account for the username
<strong>".$providerData->username."</strong> is now activated. Please use this link for access your account <strong>".$providerData->username."</strong> is now activated.
<a href='".base_url()."'>".base_url()."</a><br> Please use this link for access your account
</body> <a href='".base_url()."'>".base_url()."</a><br>
</html>"; </body>
</html>";
if(isset($template['provider_activation_mail']) && if(isset($template['provider_activation_mail']) &&
!empty($template['provider_activation_mail'])){ !empty($template['provider_activation_mail'])){
...@@ -86,12 +85,12 @@ class Provider extends CI_Controller { ...@@ -86,12 +85,12 @@ class Provider extends CI_Controller {
array($providerData->username,base_url()), array($providerData->username,base_url()),
$template['provider_activation_mail']); $template['provider_activation_mail']);
} }
$this->Api_model->send_mail($subject,$email_id,$message);
$this->Api_model->send_mail($subject,$email_id,$message);
} }
} echo json_encode(array('status'=>'1'));exit;
redirect(base_url('Provider/viewProviders')); }
} echo json_encode(array('status'=>'0'));exit;
}
public function createProvider(){ public function createProvider(){
$err = 0; $err = 0;
......
...@@ -185,19 +185,19 @@ class Region extends CI_Controller { ...@@ -185,19 +185,19 @@ class Region extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg); $this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Region/editRegion/'.$region_id)); redirect(base_url('Region/editRegion/'.$region_id));
} }
function changeStatus($region_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['region_id']) || empty($_POST['region_id']) ||
if(empty($region_id)){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Region/listRegion'));
} }
$region_id = decode_param($region_id); $status = $_POST['status'];
$status = $this->Region_model->changeStatus($region_id,$status); $region_id = decode_param($_POST['region_id']);
if(!$status){ $resp = $this->Region_model->changeStatus($region_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
echo json_encode(array('status'=>'1'));exit;
} }
redirect(base_url('Region/listRegion')); echo json_encode(array('status'=>'0'));exit;
} }
} }
?> ?>
...@@ -35,19 +35,20 @@ class Staff extends CI_Controller { ...@@ -35,19 +35,20 @@ class Staff extends CI_Controller {
$this->load->view('template',$template); $this->load->view('template',$template);
} }
function changeStatus($staff_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['staff_id']) || empty($_POST['staff_id']) ||
if(empty($staff_id) || !is_numeric($staff_id = decode_param($staff_id))){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Staff/viewStaffs')); }
} $status = $_POST['status'];
$status = $this->Staff_model->changeStatus($staff_id,$status); $staff_id = decode_param($_POST['staff_id']);
if(!$status){ $resp = $this->Staff_model->changeStatus($staff_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
} echo json_encode(array('status'=>'1'));exit;
redirect(base_url('Staff/viewStaffs')); }
} echo json_encode(array('status'=>'0'));exit;
}
public function createStaff(){ public function createStaff(){
$err = 0; $err = 0;
......
...@@ -107,18 +107,18 @@ class Tag extends CI_Controller { ...@@ -107,18 +107,18 @@ class Tag extends CI_Controller {
redirect(base_url('Tag/editTags/'.$tag_id)); redirect(base_url('Tag/editTags/'.$tag_id));
} }
function changeStatus($tag_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['tag_id']) || empty($_POST['tag_id']) ||
if(empty($tag_id)){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Tag/listTags'));
} }
$tag_id = decode_param($tag_id); $tag_id = decode_param($_POST['tag_id']);
$status = $this->Tag_model->changeStatus($tag_id,$status); $status = $_POST['status'];
if(!$status){ $resp = $this->Tag_model->changeStatus($tag_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
echo json_encode(array('status'=>'1'));exit;
} }
redirect(base_url('Tag/listTags')); echo json_encode(array('status'=>'0'));exit;
} }
function getTagData(){ function getTagData(){
......
...@@ -242,18 +242,18 @@ class Venue extends CI_Controller { ...@@ -242,18 +242,18 @@ class Venue extends CI_Controller {
redirect(base_url('Venue/editVenues/'.$venue_id)); redirect(base_url('Venue/editVenues/'.$venue_id));
} }
function changeStatus($venue_id = '',$status = '1'){ function changeStatus(){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); if(!isset($_POST) || !isset($_POST['venue_id']) || empty($_POST['venue_id']) ||
if(empty($venue_id)){ !isset($_POST['status']) || $_POST['status'] == ''){
$this->session->set_flashdata('message',$flashMsg); echo json_encode(array('status'=>'0'));exit;
redirect(base_url('Venue/listVenues'));
} }
$venue_id = decode_param($venue_id); $status = $_POST['status'];
$status = $this->Venue_model->changeStatus($venue_id,$status); $venue_id = decode_param($_POST['venue_id']);
if(!$status){ $resp = $this->Venue_model->changeStatus($venue_id,$status);
$this->session->set_flashdata('message',$flashMsg); if($resp){
echo json_encode(array('status'=>'1'));exit;
} }
redirect(base_url('Venue/listVenues')); echo json_encode(array('status'=>'0'));exit;
} }
function getVenueData(){ function getVenueData(){
......
...@@ -39,7 +39,7 @@ class Webservice extends CI_Controller { ...@@ -39,7 +39,7 @@ class Webservice extends CI_Controller {
} }
} }
public function update_fcm_token(){ public function update_fcm_token(){
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->update_fcm_token($data); $res = $this->Webservice_model->update_fcm_token($data);
...@@ -50,7 +50,7 @@ class Webservice extends CI_Controller { ...@@ -50,7 +50,7 @@ class Webservice extends CI_Controller {
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
public function login() { public function login() {
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Webservice_model->login($data); $res = $this->Webservice_model->login($data);
...@@ -85,7 +85,7 @@ class Webservice extends CI_Controller { ...@@ -85,7 +85,7 @@ class Webservice extends CI_Controller {
} }
} }
public function get_events_list() { public function get_events_list() {
$data = $_GET; $data = $_GET;
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
...@@ -196,7 +196,7 @@ class Webservice extends CI_Controller { ...@@ -196,7 +196,7 @@ class Webservice extends CI_Controller {
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->update_city($data); $res = $this->Webservice_model->update_city($data);
if($res['status']!=0){ if($res['status']!=0){
$this->response($res['data']); $this->response($res['data']);
} }
else{ else{
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
...@@ -360,7 +360,7 @@ class Webservice extends CI_Controller { ...@@ -360,7 +360,7 @@ class Webservice extends CI_Controller {
} }
} }
public function responseEventList($data) { public function responseEventList($data) {
//print_r($data);exit(); //print_r($data);exit();
$result = array( $result = array(
'status' => 'success', 'status' => 'success',
...@@ -373,7 +373,7 @@ class Webservice extends CI_Controller { ...@@ -373,7 +373,7 @@ class Webservice extends CI_Controller {
print json_encode($result); print json_encode($result);
} }
public function get_last_booking() { public function get_last_booking() {
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
...@@ -386,7 +386,7 @@ class Webservice extends CI_Controller { ...@@ -386,7 +386,7 @@ class Webservice extends CI_Controller {
} }
} }
public function responseBookList($data) { public function responseBookList($data) {
$result = array( $result = array(
'status' => 'success', 'status' => 'success',
...@@ -407,7 +407,7 @@ class Webservice extends CI_Controller { ...@@ -407,7 +407,7 @@ class Webservice extends CI_Controller {
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
public function user_language(){ public function user_language(){
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->user_language($data); $res = $this->Webservice_model->user_language($data);
...@@ -418,7 +418,7 @@ class Webservice extends CI_Controller { ...@@ -418,7 +418,7 @@ class Webservice extends CI_Controller {
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
} }
?> ?>
\ No newline at end of file
...@@ -9,7 +9,7 @@ class Customer_model extends CI_Model { ...@@ -9,7 +9,7 @@ class Customer_model extends CI_Model {
$cond .= (!empty($customer_id))?" AND CUST.customer_id='$customer_id' ":""; $cond .= (!empty($customer_id))?" AND CUST.customer_id='$customer_id' ":"";
$sql = "SELECT CUST.customer_id,CUST.name,CUST.email,CUST.phone,CUST.email,CUST.gender, $sql = "SELECT CUST.customer_id,CUST.name,CUST.email,CUST.phone,CUST.email,CUST.gender,
CUST.dob,CUST.city,CUST.reset_key,CUST.social_id,CUST.profile_image,USR.status CUST.dob,CUST.profile_city,CUST.reset_key,CUST.social_id,CUST.profile_image,USR.status
FROM customer AS CUST FROM customer AS CUST
INNER JOIN users AS USR ON (USR.id=CUST.customer_id) INNER JOIN users AS USR ON (USR.id=CUST.customer_id)
WHERE $cond"; WHERE $cond";
...@@ -66,7 +66,7 @@ class Customer_model extends CI_Model { ...@@ -66,7 +66,7 @@ class Customer_model extends CI_Model {
$status = $this->db->insert('customer', $status = $this->db->insert('customer',
array('customer_id'=>$customer_id, array('customer_id'=>$customer_id,
'dob'=>$customer_data['dob'], 'dob'=>$customer_data['dob'],
'city'=>$customer_data['city'], 'profile_city'=>$customer_data['profile_city'],
'name'=>$customer_data['name'], 'name'=>$customer_data['name'],
'email'=>$customer_data['email'], 'email'=>$customer_data['email'],
'phone'=>$customer_data['phone'], 'phone'=>$customer_data['phone'],
...@@ -97,7 +97,7 @@ class Customer_model extends CI_Model { ...@@ -97,7 +97,7 @@ class Customer_model extends CI_Model {
if(!empty($phoneChk) && $phoneChk->num_rows() > 0) { return 3; } if(!empty($phoneChk) && $phoneChk->num_rows() > 0) { return 3; }
$upMecArr = array('dob'=>$customer_data['dob'], $upMecArr = array('dob'=>$customer_data['dob'],
'city'=>$customer_data['city'], 'profile_city'=>$customer_data['profile_city'],
'name'=>$customer_data['name'], 'name'=>$customer_data['name'],
'phone'=>$customer_data['phone'], 'phone'=>$customer_data['phone'],
'email'=>$customer_data['email'], 'email'=>$customer_data['email'],
......
...@@ -82,12 +82,10 @@ ...@@ -82,12 +82,10 @@
<td class="center"> <td class="center">
<a class="btn btn-sm btn-info" id="viewBooking" booking_id="<?= encode_param($booking->booking_id) ?>"> <a class="btn btn-sm btn-info" 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>
<a class="btn btn-sm btn-danger" <a class="btn btn-sm btn-danger" status="2" onclick="confirmDelete(jQuery(this),'Booking/changeStatus',{'booking_id':'<?= encode_param($booking->booking_id) ?>'})">
href="<?=base_url("Booking/changeStatus/".encode_param($booking->booking_id))."/4"?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete <i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>
......
...@@ -61,26 +61,26 @@ ...@@ -61,26 +61,26 @@
<th class="center"><?= $category->category ?></th> <th class="center"><?= $category->category ?></th>
<th class="center"><?= $category->category_ar ?></th> <th class="center"><?= $category->category_ar ?></th>
<th class="center"><?= $category->category_description ?></th> <th class="center"><?= $category->category_description ?></th>
<th class="center"><?= ($category->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $category->cat_id ?>">
<?= ($category->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="<?= base_url('Category/editCategory/'.encode_param($category->cat_id))?>"> href="<?= base_url('Category/editCategory/'.encode_param($category->cat_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Category/changeStatus',{'category_id':'<?=encode_param($category->cat_id)?>'})"
href="<?= base_url("Category/changeStatus/".encode_param($category->cat_id))."/2" ?>" status="2"><i class="fa fa-fw fa-trash"></i>Delete
onClick="return doconfirm()"> </a>
<i class="fa fa-fw fa-trash"></i>Delete <?php
</a> $status=0; $btnClass='btn-warning'; $btnName='De-activate';
<?php if($category->status == 1){ ?> if($category->status != 1){
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Category/changeStatus/".encode_param($category->cat_id))."/0" ?>"> $status=1; $btnClass='btn-success'; $btnName='Activate';
<i class="fa fa-cog"></i> De-activate }
</a> ?>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Category/changeStatus',{'category_id':'<?= encode_param($category->cat_id) ?>'})" status="<?= $status ?>" status_id="<?= $category->cat_id ?>">
<a class="btn btn-sm btn-success" href="<?= base_url("Category/changeStatus/".encode_param($category->cat_id))."/1" ?>"> <i class="fa fa-cog"><?= $btnName ?></i>
<i class="fa fa-cog"></i> Activate </a>
</a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -84,22 +84,22 @@ ...@@ -84,22 +84,22 @@
<th class="hidden"><?= $checker->id ?></th> <th class="hidden"><?= $checker->id ?></th>
<th class="center"><?= $checker->username ?></th> <th class="center"><?= $checker->username ?></th>
<th class="center"><?= $checker->name ?></th> <th class="center"><?= $checker->name ?></th>
<th class="center"><?= ($checker->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $checker->id ?>">
<?= ($checker->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-danger" <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Checker/changeStatus',{'checker_id':'<?=encode_param($checker->id)?>'})"
href="<?= base_url("Checker/changeStatus/".encode_param($checker->id))."/2" ?>" status="2"><i class="fa fa-fw fa-trash"></i>Delete
onClick="return doconfirm()"> </a>
<i class="fa fa-fw fa-trash"></i>Delete <?php
</a> $status=0; $btnClass='btn-warning'; $btnName='De-activate';
<?php if($checker->status == 1){ ?> if($checker->status != 1){
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Checker/changeStatus/".encode_param($checker->id))."/0" ?>"> $status=1; $btnClass='btn-success'; $btnName='Activate';
<i class="fa fa-cog"></i> De-activate }
</a> ?>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Checker/changeStatus',{'checker_id':'<?= encode_param($checker->id)?>'})" status="<?= $status ?>" status_id="<?= $checker->id ?>">
<a class="btn btn-sm btn-success" href="<?= base_url("Checker/changeStatus/".encode_param($checker->id))."/1" ?>"> <i class="fa fa-cog"><?= $btnName ?></i>
<i class="fa fa-cog"></i> Activate </a>
</a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="form-group"> <div class="form-group">
<label>City</label> <label>City</label>
<input type="text" class="form-control required" data-parsley-trigger="change" <input type="text" class="form-control required" data-parsley-trigger="change"
id="loc_search_1" name="city" placeholder="City" value="<?= (isset($customer_data->city))?$customer_data->city:'' ?>" required autocomplete="off"> id="loc_search_1" name="profile_city" placeholder="City" value="<?= (isset($customer_data->profile_city))?$customer_data->profile_city:'' ?>" required autocomplete="off">
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
......
...@@ -56,8 +56,10 @@ ...@@ -56,8 +56,10 @@
<th class="center"><?= $customer->name ?></th> <th class="center"><?= $customer->name ?></th>
<th class="center"><?= $customer->email ?></th> <th class="center"><?= $customer->email ?></th>
<th class="center"><?= $customer->phone ?></th> <th class="center"><?= $customer->phone ?></th>
<th class="center"><?= $customer->city ?></th> <th class="center"><?= $customer->profile_city ?></th>
<th class="center"><?= ($customer->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $customer->customer_id ?>">
<?= ($customer->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-info" id="viewCustomer" customer_id="<?= encode_param($customer->customer_id) ?>"> <a class="btn btn-sm btn-info" id="viewCustomer" customer_id="<?= encode_param($customer->customer_id) ?>">
<i class="fa fa-fw fa-eye"></i>View <i class="fa fa-fw fa-eye"></i>View
...@@ -65,21 +67,19 @@ ...@@ -65,21 +67,19 @@
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="<?= base_url('Customer/editCustomers/'.encode_param($customer->customer_id)) ?>"> href="<?= base_url('Customer/editCustomers/'.encode_param($customer->customer_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <?php
href="<?= base_url("Customer/changeStatus/".encode_param($customer->customer_id))."/2" ?>" $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
onClick="return doconfirm()"> if($customer->status != 1){
<i class="fa fa-fw fa-trash"></i>Delete $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
</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" ?>"> <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Customer/changeStatus',{'customer_id':'<?=encode_param($customer->customer_id)?>'})"
<i class="fa fa-cog"></i> De-activate status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Customer/changeStatus',{'customer_id':'<?= encode_param($customer->customer_id) ?>'})" status="<?= $status ?>" status_id="<?= $customer->customer_id ?>">
<a class="btn btn-sm btn-success" href="<?= base_url("Customer/changeStatus/".encode_param($customer->customer_id))."/1" ?>"> <i class="fa fa-cog"><?= $btnName ?></i>
<i class="fa fa-cog"></i> Activate </a>
</a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
<th>Category</th> <th>Category</th>
<th>Region</th> <th>Region</th>
<th>Venue</th> <th>Venue</th>
<!-- <th>Location</th> -->
<th>Status</th> <th>Status</th>
<th width="330px">Action</th> <th width="330px">Action</th>
</tr> </tr>
...@@ -58,15 +57,22 @@ ...@@ -58,15 +57,22 @@
<td><?= $event->category ?></td> <td><?= $event->category ?></td>
<td><?= $event->region_name ?></td> <td><?= $event->region_name ?></td>
<td><?= $event->venue_name ?></td> <td><?= $event->venue_name ?></td>
<td> <?php
<?php switch($event->event_status){
switch($event->event_status){ case 1 :
case 1 : echo 'Active'; break; echo '<td class="center" id="statusFlag_'.$event->event_id.'">
case 0 : echo 'De-activate'; break; Active
case 3 : echo 'Waiting For Approval'; break; </td>'; break;
} case 0 :
?> echo '<td class="center" id="statusFlag_'.$event->event_id.'">
</td> De-activate
</td>'; break;
case 3 :
echo '<td class="center" id="statusFlag_'.$event->event_id.'">
Waiting For Approval
</td>'; break;
}
?>
<td> <td>
<button class="btn btn-sm btn-info" id="viewEventDetails" <button class="btn btn-sm btn-info" id="viewEventDetails"
event_id="<?= encode_param($event->event_id) ?>"> event_id="<?= encode_param($event->event_id) ?>">
...@@ -76,30 +82,25 @@ ...@@ -76,30 +82,25 @@
href="<?= base_url('Event/editEvents/'.encode_param($event->event_id))?>"> href="<?= base_url('Event/editEvents/'.encode_param($event->event_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Event/changeStatus',{'event_id':'<?=encode_param($event->event_id)?>'})"
href="<?= base_url("Event/changeStatus/".encode_param($event->event_id))."/2" ?>" status="2"><i class="fa fa-fw fa-trash"></i>Delete
onClick="return doconfirm()"> </a>
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php <?php
switch($event->event_status){ switch($event->event_status){
case 1 : ?> case 1 :
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Event/changeStatus/".encode_param($event->event_id))."/0" ?>"> $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
<i class="fa fa-cog"></i> De-activate break;
</a> case 0 :
<?php break; $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
case 0 : ?> break;
<a class="btn btn-sm btn-success" href="<?= base_url("Event/changeStatus/".encode_param($event->event_id))."/1" ?>"> case 3 :
<i class="fa fa-cog"></i> Activate $status = 1; $btnName = 'Approve'; $btnClass = 'btn-info';
</a> break;
<?php break;
case 3 : ?>
<a class="btn btn-sm btn-warning" href="<?= base_url("Event/changeStatus/".encode_param($event->event_id))."/1" ?>">
<i class="fa fa-cog"></i> Approve
</a>
<?php break;
} }
?> ?>
<a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Event/changeStatus',{'event_id':'<?= encode_param($event->event_id) ?>'})" status="<?= $status ?>" status_id="<?= $event->event_id ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -55,26 +55,26 @@ ...@@ -55,26 +55,26 @@
<th class="center"> <th class="center">
<?= ($host->show_layout == 0)?'NO':'YES' ?> <?= ($host->show_layout == 0)?'NO':'YES' ?>
</th> </th>
<th class="center"><?= ($host->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $host->host_cat_id ?>">
<?= ($host->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="<?= base_url('Host/editHostCategory/'.encode_param($host->host_cat_id))?>"> href="<?= base_url('Host/editHostCategory/'.encode_param($host->host_cat_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <?php
href="<?= base_url("Host/changeStatus/".encode_param($host->host_cat_id))."/2" ?>" $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
onClick="return doconfirm()"> if($host->status != 1){
<i class="fa fa-fw fa-trash"></i>Delete $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
</a> }
<?php if($host->status == 1){ ?> ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Host/changeStatus/".encode_param($host->host_cat_id))."/0" ?>"> <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Host/changeStatus',{'host_id':'<?=encode_param($host->host_cat_id)?>'})"
<i class="fa fa-cog"></i> De-activate status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Host/changeStatus',{'host_id':'<?= encode_param($host->host_cat_id) ?>'})" status="<?= $status ?>" status_id="<?= $host->host_cat_id ?>">
<a class="btn btn-sm btn-success" href="<?= base_url("Host/changeStatus/".encode_param($host->host_cat_id))."/1" ?>"> <i class="fa fa-cog"><?= $btnName ?></i>
<i class="fa fa-cog"></i> Activate </a>
</a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -57,7 +57,9 @@ ...@@ -57,7 +57,9 @@
<th class="center"><?= $provider->username ?></th> <th class="center"><?= $provider->username ?></th>
<th class="center"><?= $provider->email ?></th> <th class="center"><?= $provider->email ?></th>
<th class="center"><?= $provider->phone ?></th> <th class="center"><?= $provider->phone ?></th>
<th class="center"><?= ($provider->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $provider->provider_id ?>">
<?= ($provider->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-info" id="viewProvider" provider_id="<?= encode_param($provider->provider_id) ?>"> <a class="btn btn-sm btn-info" id="viewProvider" provider_id="<?= encode_param($provider->provider_id) ?>">
<i class="fa fa-fw fa-eye"></i>View <i class="fa fa-fw fa-eye"></i>View
...@@ -65,21 +67,19 @@ ...@@ -65,21 +67,19 @@
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="<?= base_url('Provider/editProviders/'.encode_param($provider->provider_id)) ?>"> href="<?= base_url('Provider/editProviders/'.encode_param($provider->provider_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <?php
href="<?= base_url("Provider/changeStatus/".encode_param($provider->provider_id))."/2" ?>" $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
onClick="return doconfirm()"> if($provider->status != 1){
<i class="fa fa-fw fa-trash"></i>Delete $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
</a> }
<?php if($provider->status == 1){ ?> ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Provider/changeStatus/".encode_param($provider->provider_id))."/0" ?>"> <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Provider/changeStatus',{'provider_id':'<?=encode_param($provider->provider_id)?>'})"
<i class="fa fa-cog"></i> De-activate status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Provider/changeStatus',{'provider_id':'<?= encode_param($provider->provider_id) ?>'})" status="<?= $status ?>" status_id="<?= $provider->provider_id ?>">
<a class="btn btn-sm btn-success" href="<?= base_url("Provider/changeStatus/".encode_param($provider->provider_id))."/1" ?>"> <i class="fa fa-cog"><?= $btnName ?></i>
<i class="fa fa-cog"></i> Activate </a>
</a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -59,26 +59,26 @@ ...@@ -59,26 +59,26 @@
</th> </th>
<th class="center"><?= $region->name ?></th> <th class="center"><?= $region->name ?></th>
<th class="center"><?= $region->name_ar ?></th> <th class="center"><?= $region->name_ar ?></th>
<th class="center"><?= ($region->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $region->id ?>">
<?= ($region->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="<?= base_url('Region/editRegion/'.encode_param($region->id))?>"> href="<?= base_url('Region/editRegion/'.encode_param($region->id))?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <?php
href="<?= base_url("Region/changeStatus/".encode_param($region->id))."/2" ?>" $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
onClick="return doconfirm()"> if($region->status != 1){
<i class="fa fa-fw fa-trash"></i>Delete $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
</a> }
<?php if($region->status == 1){ ?> ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Region/changeStatus/".encode_param($region->id))."/0" ?>"> <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Region/changeStatus',{'region_id':'<?=encode_param($region->id)?>'})"
<i class="fa fa-cog"></i> De-activate status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Region/changeStatus',{'region_id':'<?= encode_param($region->id) ?>'})" status="<?= $status ?>" status_id="<?= $region->id ?>">
<a class="btn btn-sm btn-success" href="<?= base_url("Region/changeStatus/".encode_param($region->id))."/1" ?>"> <i class="fa fa-cog"><?= $btnName ?></i>
<i class="fa fa-cog"></i> Activate </a>
</a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
if(!empty($staff_data)){ if(!empty($staff_data)){
foreach($staff_data as $staff) { ?> foreach($staff_data as $staff) { ?>
<tr> <tr>
<th class="hidden"><?= $staff->staff_id ?></th> <th class="hidden"><?= $staff->id ?></th>
<th class="center textCenterAlign"> <th class="center textCenterAlign">
<img id="image_id" src="<?= base_url($staff->profile_image) ?>" <img id="image_id" src="<?= base_url($staff->profile_image) ?>"
onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';"
...@@ -59,26 +59,27 @@ ...@@ -59,26 +59,27 @@
</th> </th>
<th class="center"><?= $staff->display_name ?></th> <th class="center"><?= $staff->display_name ?></th>
<th class="center"><?= $staff->username ?></th> <th class="center"><?= $staff->username ?></th>
<th class="center"><?= ($staff->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $staff->id ?>">
<?= ($staff->status == 1)?'Active':'De-active' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="<?= base_url('Staff/editStaffs/'.encode_param($staff->id)) ?>"> href="<?= base_url('Staff/editStaffs/'.encode_param($staff->id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <?php
href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/2" ?>" $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
onClick="return doconfirm()"> if($staff->status != 1){
<i class="fa fa-fw fa-trash"></i>Delete $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
</a> }
<?php if($staff->status == 1){ ?> ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/0" ?>"> <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Staff/changeStatus',{'staff_id':'<?=encode_param($staff->id)?>'})"
<i class="fa fa-cog"></i> De-activate status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Staff/changeStatus',{'staff_id':'<?= encode_param($staff->id) ?>'})"
<a class="btn btn-sm btn-success" href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/1" ?>"> status="<?= $status ?>" status_id="<?= $staff->id ?>">
<i class="fa fa-cog"></i> Activate <i class="fa fa-cog"><?= $btnName ?></i>
</a> </a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -51,26 +51,26 @@ ...@@ -51,26 +51,26 @@
<tr> <tr>
<th class="hidden"><?= $tag->tag_id ?></th> <th class="hidden"><?= $tag->tag_id ?></th>
<th class="center"><?= $tag->tag_name ?></th> <th class="center"><?= $tag->tag_name ?></th>
<th class="center"><?= ($tag->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $tag->tag_id ?>">
<?= ($tag->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="<?= base_url('Tag/editTags/'.encode_param($tag->tag_id))?>"> href="<?= base_url('Tag/editTags/'.encode_param($tag->tag_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Tag/changeStatus',{'tag_id':'<?= encode_param($tag->tag_id) ?>'})" status="2">
href="<?= base_url("Tag/changeStatus/".encode_param($tag->tag_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete <i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php if($tag->status == 1){ ?> <?php
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Tag/changeStatus/".encode_param($tag->tag_id))."/0" ?>"> $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
<i class="fa fa-cog"></i> De-activate if($tag->status != 1){
</a> $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
<?php } else { ?> }
<a class="btn btn-sm btn-success" href="<?= base_url("Tag/changeStatus/".encode_param($tag->tag_id))."/1" ?>"> ?>
<i class="fa fa-cog"></i> Activate <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Tag/changeStatus',{'tag_id':'<?= encode_param($tag->tag_id) ?>'})" status="<?= $status ?>" status_id="<?= $tag->tag_id ?>">
</a> <i class="fa fa-cog"><?= $btnName ?></i>
<?php } ?> </a>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -57,7 +57,9 @@ ...@@ -57,7 +57,9 @@
<th class="center"><?= $venue->region_name ?></th> <th class="center"><?= $venue->region_name ?></th>
<th class="center"><?= $venue->host_category ?></th> <th class="center"><?= $venue->host_category ?></th>
<th class="center"><?= $venue->location ?></th> <th class="center"><?= $venue->location ?></th>
<th class="center"><?= ($venue->status == 1)?'Active':'De-activate' ?></th> <th class="center" id="statusFlag_<?= $venue->venue_id ?>">
<?= ($venue->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center"> <td class="center">
<button class="btn btn-sm btn-info" id="viewVenueDetails" <button class="btn btn-sm btn-info" id="viewVenueDetails"
venue_id="<?= encode_param($venue->venue_id) ?>"> venue_id="<?= encode_param($venue->venue_id) ?>">
...@@ -67,20 +69,18 @@ ...@@ -67,20 +69,18 @@
href="<?= base_url('Venue/editVenues/'.encode_param($venue->venue_id))?>"> href="<?= base_url('Venue/editVenues/'.encode_param($venue->venue_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit <i class="fa fa-fw fa-edit"></i>Edit
</a> </a>
<a class="btn btn-sm btn-danger" <?php
href="<?= base_url("Venue/changeStatus/".encode_param($venue->venue_id))."/2" ?>" $status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
onClick="return doconfirm()"> if($venue->status != 1){
<i class="fa fa-fw fa-trash"></i>Delete $status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
</a> }
<?php if($venue->status == 1){ ?> ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Venue/changeStatus/".encode_param($venue->venue_id))."/0" ?>"> <a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Venue/changeStatus',{'venue_id':'<?=encode_param($venue->venue_id)?>'})"
<i class="fa fa-cog"></i> De-activate status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a> </a>
<?php } else { ?> <a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Venue/changeStatus',{'venue_id':'<?= encode_param($venue->venue_id) ?>'})" status="<?= $status ?>" status_id="<?= $venue->venue_id ?>">
<a class="btn btn-sm btn-success" href="<?= base_url("Venue/changeStatus/".encode_param($venue->venue_id))."/1" ?>"> <i class="fa fa-cog"><?= $btnName ?></i>
<i class="fa fa-cog"></i> Activate </a>
</a>
<?php } ?>
</td> </td>
</tr> </tr>
<?php } } ?> <?php } } ?>
......
...@@ -839,6 +839,10 @@ jQuery('#locPointerMap').locationpicker({ ...@@ -839,6 +839,10 @@ jQuery('#locPointerMap').locationpicker({
} }
}); });
jQuery('[aria-controls="mechanicUsers"]').on('click',function(event) {
jQuery('.datatable').DataTable().draw();
});
jQuery('[id="pushNotification"]').on('click',function(event) { jQuery('[id="pushNotification"]').on('click',function(event) {
event.preventDefault(); event.preventDefault();
var validation = jQuery('[name="pushNotifForm"]').parsley().validate(); var validation = jQuery('[name="pushNotifForm"]').parsley().validate();
...@@ -853,3 +857,73 @@ jQuery('[id="pushNotification"]').on('click',function(event) { ...@@ -853,3 +857,73 @@ jQuery('[id="pushNotification"]').on('click',function(event) {
jQuery('[name="pushNotifForm"]').submit(); jQuery('[name="pushNotifForm"]').submit();
} }
}); });
function updateStatus(thisObj,fnName,params){
var status = thisObj.attr('status'),
status_id = thisObj.attr('status_id');
if(status==undefined || status=='undefined' || status==null || status=='null' || status=='' ||
params==undefined || params=='undefined' || params==null || params=='null' || params=='' ||
fnName==undefined || fnName=='undefined' || fnName==null || fnName=='null' || fnName=='' ||
thisObj==undefined || thisObj=='undefined' || thisObj==null || thisObj=='null' || thisObj==''){
setErrModal('Status Upadting...','Something went wrong, please try again later...!');
return false;
}
params.status = status;
jQuery.ajax({
url : base_url+fnName,
type : 'POST',
data : params,
success: function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
setErrModal('Status Upadting...','Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == 0){
setErrModal('Status Upadting...','Something went wrong, please try again later...!');
return false;
}
if(status == 2){
var table = jQuery('.datatable').DataTable();
table.row(thisObj.parents('tr')).remove();
thisObj.parents('tr').remove();
return false;
}
if(status == 1){
thisObj.attr('status','0');
thisObj.addClass('btn-warning');
thisObj.removeClass('btn-success');
thisObj.find('i').html('De-activate');
jQuery('[id="statusFlag_'+status_id+'"]').html('Active');
return false;
}
if(status == 0){
thisObj.attr('status','1');
thisObj.addClass('btn-success');
thisObj.removeClass('btn-warning');
thisObj.find('i').html('Activate');
jQuery('[id="statusFlag_'+status_id+'"]').html('De-active');
return false;
}
},
fail: function(xhr, textStatus, errorThrown){
remFullScreenLoader();
setErrModal('Status Upadting...','Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remFullScreenLoader();
setErrModal('Status Upadting...','Something went wrong, please try again later...!');
}
});
}
function confirmDelete(thisObj,fnName,params){
if(confirm("Are you sure to delete permanently?")){
updateStatus(thisObj,fnName,params,status);
}
}
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