Commit 90058168 by Tobin

dc

parent 1a377254
......@@ -42,17 +42,16 @@ class Booking extends CI_Controller {
echo $viewPage;exit;
}
function changeStatus($booking_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($booking_id) || !is_numeric($booking_id = decode_param($booking_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Booking/viewBookings'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['booking_id']) || empty($_POST['booking_id'])){
echo json_encode(array('status'=>'0'));exit;
}
$status = $this->Booking_model->changeStatus($booking_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
$booking_id = decode_param($_POST['booking_id']);
$resp = $this->Booking_model->changeStatus($booking_id,'4');
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
redirect(base_url('Booking/viewBookings'));
echo json_encode(array('status'=>'0'));exit;
}
function generateReport(){
......
......@@ -189,18 +189,18 @@ class Category extends CI_Controller {
redirect(base_url('Category/editCategory/'.$category_id));
}
function changeStatus($category_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($category_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Category/listCategory'));
}
$category_id = decode_param($category_id);
$status = $this->Category_model->changeStatus($category_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Category/listCategory'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['category_id']) || empty($_POST['category_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $_POST['status'];
$category_id = decode_param($_POST['category_id']);
$resp = $this->Category_model->changeStatus($category_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
echo json_encode(array('status'=>'0'));exit;
}
}
?>
\ No newline at end of file
......@@ -107,18 +107,15 @@ class Checker extends CI_Controller {
redirect(base_url('Checker/addChecker'));
}
function changeStatus($checker_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($checker_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Checker/viewCheckers'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['checker_id']) || empty($_POST['checker_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$checker_id = decode_param($checker_id);
$status = $_POST['status'];
$checker_id = decode_param($_POST['checker_id']);
$resp = $this->Checker_model->changeStatus($checker_id,$status);
if(!$resp){
$this->session->set_flashdata('message',$flashMsg);
} else {
if($status == 1){
if($resp){
$this->load->model('Api_model');
$checkerData = $this->db->get_where('checker',array('id'=>$checker_id))->row();
......@@ -126,12 +123,8 @@ class Checker extends CI_Controller {
$subject = "Your Checker Account is now activated";
$email_id = $checkerData->username;
$message = "<html>
<body>
Your Checker Account for the username
<strong>".$email_id."</strong> is now activated.
</body>
</html>";
$message = "<html><body>Your Checker Account for the username
<strong>".$email_id."</strong> is now activated.</body></html>";
$template = getNotifTemplate();
if(isset($template['checker_activation_mail']) &&
......@@ -142,9 +135,9 @@ class Checker extends CI_Controller {
$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
......@@ -54,17 +54,18 @@ class Customer extends CI_Controller {
echo json_encode($resArr);exit;
}
function changeStatus($customer_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($customer_id) || !is_numeric($customer_id = decode_param($customer_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/viewCustomers'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['customer_id']) || empty($_POST['customer_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $this->Customer_model->changeStatus($customer_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
$status = $_POST['status'];
$customer_id = decode_param($_POST['customer_id']);
$resp = $this->Customer_model->changeStatus($customer_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
redirect(base_url('Customer/viewCustomers'));
echo json_encode(array('status'=>'0'));exit;
}
public function createCustomer(){
......@@ -84,7 +85,7 @@ class Customer extends CI_Controller {
}else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){
$err = 1;
$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;
$errMsg = 'Provide a City Name';
}else if($err == 0 && (!isset($_POST['gender']) || empty($_POST['gender']))){
......@@ -196,7 +197,7 @@ class Customer extends CI_Controller {
}else if($err == 0 && (!isset($_POST['phone']) || empty($_POST['phone']))){
$err = 1;
$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;
$errMsg = 'Provide a City Name';
}else if($err == 0 && (!isset($_POST['gender']) || empty($_POST['gender']))){
......
......@@ -379,18 +379,18 @@ class Event extends CI_Controller {
redirect(base_url('Event/listEvents'));
}
function changeStatus($event_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($event_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Event/listEvents'));
}
$event_id = decode_param($event_id);
$status = $this->Event_model->changeStatus($event_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Event/listEvents'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['event_id']) || empty($_POST['event_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $_POST['status'];
$event_id = decode_param($_POST['event_id']);
$resp = $this->Event_model->changeStatus($event_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
echo json_encode(array('status'=>'0'));exit;
}
function getEventData(){
......
......@@ -126,18 +126,18 @@ class Host extends CI_Controller {
redirect(base_url('Host/editHostCategory/'.$host_id));
}
function changeStatus($host_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($host_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Host/listHostCategory'));
}
$host_id = decode_param($host_id);
$status = $this->Host_model->changeStatus($host_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Host/listHostCategory'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['host_id']) || empty($_POST['host_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $_POST['status'];
$host_id = decode_param($_POST['host_id']);
$resp = $this->Host_model->changeStatus($host_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
echo json_encode(array('status'=>'0'));exit;
}
}
?>
\ No newline at end of file
......@@ -54,28 +54,27 @@ class Provider extends CI_Controller {
echo json_encode($resArr);exit;
}
function changeStatus($provider_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($provider_id) || !is_numeric($provider_id = decode_param($provider_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Provider/viewProviders'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['provider_id']) || empty($_POST['provider_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $_POST['status'];
$provider_id = decode_param($_POST['provider_id']);
$resp = $this->Provider_model->changeStatus($provider_id,$status);
if(!$resp){
$this->session->set_flashdata('message',$flashMsg);
} else {
if($status == 1){
if($resp){
$this->load->model('Api_model');
$providerData = $this->Provider_model->getProviderData($provider_id,'0,1');
if(!empty($providerData)){
$subject = "Your Organizer Account is now activated";
$email_id = $providerData->email;
$template = getNotifTemplate();
$message = "<html>
<body>
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.
Please use this link for access your account
<a href='".base_url()."'>".base_url()."</a><br>
</body>
</html>";
......@@ -86,11 +85,11 @@ class Provider extends CI_Controller {
array($providerData->username,base_url()),
$template['provider_activation_mail']);
}
$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(){
......
......@@ -186,18 +186,18 @@ class Region extends CI_Controller {
redirect(base_url('Region/editRegion/'.$region_id));
}
function changeStatus($region_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($region_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Region/listRegion'));
}
$region_id = decode_param($region_id);
$status = $this->Region_model->changeStatus($region_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Region/listRegion'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['region_id']) || empty($_POST['region_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $_POST['status'];
$region_id = decode_param($_POST['region_id']);
$resp = $this->Region_model->changeStatus($region_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
echo json_encode(array('status'=>'0'));exit;
}
}
?>
......@@ -36,17 +36,18 @@ class Staff extends CI_Controller {
$this->load->view('template',$template);
}
function changeStatus($staff_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($staff_id) || !is_numeric($staff_id = decode_param($staff_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Staff/viewStaffs'));
}
$status = $this->Staff_model->changeStatus($staff_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Staff/viewStaffs'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['staff_id']) || empty($_POST['staff_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $_POST['status'];
$staff_id = decode_param($_POST['staff_id']);
$resp = $this->Staff_model->changeStatus($staff_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
echo json_encode(array('status'=>'0'));exit;
}
public function createStaff(){
......
......@@ -107,18 +107,18 @@ class Tag extends CI_Controller {
redirect(base_url('Tag/editTags/'.$tag_id));
}
function changeStatus($tag_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($tag_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Tag/listTags'));
}
$tag_id = decode_param($tag_id);
$status = $this->Tag_model->changeStatus($tag_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Tag/listTags'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['tag_id']) || empty($_POST['tag_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$tag_id = decode_param($_POST['tag_id']);
$status = $_POST['status'];
$resp = $this->Tag_model->changeStatus($tag_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
echo json_encode(array('status'=>'0'));exit;
}
function getTagData(){
......
......@@ -242,18 +242,18 @@ class Venue extends CI_Controller {
redirect(base_url('Venue/editVenues/'.$venue_id));
}
function changeStatus($venue_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($venue_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Venue/listVenues'));
}
$venue_id = decode_param($venue_id);
$status = $this->Venue_model->changeStatus($venue_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Venue/listVenues'));
function changeStatus(){
if(!isset($_POST) || !isset($_POST['venue_id']) || empty($_POST['venue_id']) ||
!isset($_POST['status']) || $_POST['status'] == ''){
echo json_encode(array('status'=>'0'));exit;
}
$status = $_POST['status'];
$venue_id = decode_param($_POST['venue_id']);
$resp = $this->Venue_model->changeStatus($venue_id,$status);
if($resp){
echo json_encode(array('status'=>'1'));exit;
}
echo json_encode(array('status'=>'0'));exit;
}
function getVenueData(){
......
......@@ -9,7 +9,7 @@ class Customer_model extends CI_Model {
$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,
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
INNER JOIN users AS USR ON (USR.id=CUST.customer_id)
WHERE $cond";
......@@ -66,7 +66,7 @@ class Customer_model extends CI_Model {
$status = $this->db->insert('customer',
array('customer_id'=>$customer_id,
'dob'=>$customer_data['dob'],
'city'=>$customer_data['city'],
'profile_city'=>$customer_data['profile_city'],
'name'=>$customer_data['name'],
'email'=>$customer_data['email'],
'phone'=>$customer_data['phone'],
......@@ -97,7 +97,7 @@ class Customer_model extends CI_Model {
if(!empty($phoneChk) && $phoneChk->num_rows() > 0) { return 3; }
$upMecArr = array('dob'=>$customer_data['dob'],
'city'=>$customer_data['city'],
'profile_city'=>$customer_data['profile_city'],
'name'=>$customer_data['name'],
'phone'=>$customer_data['phone'],
'email'=>$customer_data['email'],
......
......@@ -83,9 +83,7 @@
<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
</a>
<a class="btn btn-sm btn-danger"
href="<?=base_url("Booking/changeStatus/".encode_param($booking->booking_id))."/4"?>"
onClick="return doconfirm()">
<a class="btn btn-sm btn-danger" status="2" onclick="confirmDelete(jQuery(this),'Booking/changeStatus',{'booking_id':'<?= encode_param($booking->booking_id) ?>'})">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php } ?>
......
......@@ -61,26 +61,26 @@
<th class="center"><?= $category->category ?></th>
<th class="center"><?= $category->category_ar ?></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">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Category/editCategory/'.encode_param($category->cat_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Category/changeStatus/".encode_param($category->cat_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php 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" ?>">
<i class="fa fa-cog"></i> De-activate
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Category/changeStatus',{'category_id':'<?=encode_param($category->cat_id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Category/changeStatus/".encode_param($category->cat_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
<?php
$status=0; $btnClass='btn-warning'; $btnName='De-activate';
if($category->status != 1){
$status=1; $btnClass='btn-success'; $btnName='Activate';
}
?>
<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 ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -84,22 +84,22 @@
<th class="hidden"><?= $checker->id ?></th>
<th class="center"><?= $checker->username ?></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">
<a class="btn btn-sm btn-danger"
href="<?= base_url("Checker/changeStatus/".encode_param($checker->id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Checker/changeStatus',{'checker_id':'<?=encode_param($checker->id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php 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" ?>">
<i class="fa fa-cog"></i> De-activate
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Checker/changeStatus/".encode_param($checker->id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
<?php
$status=0; $btnClass='btn-warning'; $btnName='De-activate';
if($checker->status != 1){
$status=1; $btnClass='btn-success'; $btnName='Activate';
}
?>
<a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Checker/changeStatus',{'checker_id':'<?= encode_param($checker->id)?>'})" status="<?= $status ?>" status_id="<?= $checker->id ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -56,7 +56,7 @@
<div class="form-group">
<label>City</label>
<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 class="col-md-6">
......
......@@ -56,8 +56,10 @@
<th class="center"><?= $customer->name ?></th>
<th class="center"><?= $customer->email ?></th>
<th class="center"><?= $customer->phone ?></th>
<th class="center"><?= $customer->city ?></th>
<th class="center"><?= ($customer->status == 1)?'Active':'De-activate' ?></th>
<th class="center"><?= $customer->profile_city ?></th>
<th class="center" id="statusFlag_<?= $customer->customer_id ?>">
<?= ($customer->status == 1)?'Active':'De-activate' ?>
</th>
<td class="center">
<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
......@@ -66,20 +68,18 @@
href="<?= base_url('Customer/editCustomers/'.encode_param($customer->customer_id)) ?>">
<i class="fa fa-fw fa-edit"></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
<?php
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
if($customer->status != 1){
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
}
?>
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Customer/changeStatus',{'customer_id':'<?=encode_param($customer->customer_id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</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 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 ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -43,7 +43,6 @@
<th>Category</th>
<th>Region</th>
<th>Venue</th>
<!-- <th>Location</th> -->
<th>Status</th>
<th width="330px">Action</th>
</tr>
......@@ -58,15 +57,22 @@
<td><?= $event->category ?></td>
<td><?= $event->region_name ?></td>
<td><?= $event->venue_name ?></td>
<td>
<?php
switch($event->event_status){
case 1 : echo 'Active'; break;
case 0 : echo 'De-activate'; break;
case 3 : echo 'Waiting For Approval'; break;
case 1 :
echo '<td class="center" id="statusFlag_'.$event->event_id.'">
Active
</td>'; break;
case 0 :
echo '<td class="center" id="statusFlag_'.$event->event_id.'">
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"
event_id="<?= encode_param($event->event_id) ?>">
......@@ -76,30 +82,25 @@
href="<?= base_url('Event/editEvents/'.encode_param($event->event_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Event/changeStatus/".encode_param($event->event_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Event/changeStatus',{'event_id':'<?=encode_param($event->event_id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php
switch($event->event_status){
case 1 : ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Event/changeStatus/".encode_param($event->event_id))."/0" ?>">
<i class="fa fa-cog"></i> De-activate
</a>
<?php break;
case 0 : ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Event/changeStatus/".encode_param($event->event_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
</a>
<?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;
case 1 :
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
break;
case 0 :
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
break;
case 3 :
$status = 1; $btnName = 'Approve'; $btnClass = 'btn-info';
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>
</tr>
<?php } } ?>
......
......@@ -55,26 +55,26 @@
<th class="center">
<?= ($host->show_layout == 0)?'NO':'YES' ?>
</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">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Host/editHostCategory/'.encode_param($host->host_cat_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Host/changeStatus/".encode_param($host->host_cat_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</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" ?>">
<i class="fa fa-cog"></i> De-activate
<?php
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
if($host->status != 1){
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
}
?>
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Host/changeStatus',{'host_id':'<?=encode_param($host->host_cat_id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Host/changeStatus/".encode_param($host->host_cat_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
<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 ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -57,7 +57,9 @@
<th class="center"><?= $provider->username ?></th>
<th class="center"><?= $provider->email ?></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">
<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
......@@ -66,20 +68,18 @@
href="<?= base_url('Provider/editProviders/'.encode_param($provider->provider_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Provider/changeStatus/".encode_param($provider->provider_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</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" ?>">
<i class="fa fa-cog"></i> De-activate
<?php
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
if($provider->status != 1){
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
}
?>
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Provider/changeStatus',{'provider_id':'<?=encode_param($provider->provider_id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Provider/changeStatus/".encode_param($provider->provider_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
<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 ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -59,26 +59,26 @@
</th>
<th class="center"><?= $region->name ?></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">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Region/editRegion/'.encode_param($region->id))?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Region/changeStatus/".encode_param($region->id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</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" ?>">
<i class="fa fa-cog"></i> De-activate
<?php
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
if($region->status != 1){
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
}
?>
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Region/changeStatus',{'region_id':'<?=encode_param($region->id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Region/changeStatus/".encode_param($region->id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
<a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Region/changeStatus',{'region_id':'<?= encode_param($region->id) ?>'})" status="<?= $status ?>" status_id="<?= $region->id ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -51,7 +51,7 @@
if(!empty($staff_data)){
foreach($staff_data as $staff) { ?>
<tr>
<th class="hidden"><?= $staff->staff_id ?></th>
<th class="hidden"><?= $staff->id ?></th>
<th class="center textCenterAlign">
<img id="image_id" src="<?= base_url($staff->profile_image) ?>"
onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';"
......@@ -59,26 +59,27 @@
</th>
<th class="center"><?= $staff->display_name ?></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">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Staff/editStaffs/'.encode_param($staff->id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</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" ?>">
<i class="fa fa-cog"></i> De-activate
<?php
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
if($staff->status != 1){
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
}
?>
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Staff/changeStatus',{'staff_id':'<?=encode_param($staff->id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
<a class="btn btn-sm <?= $btnClass ?>" onclick="updateStatus(jQuery(this),'Staff/changeStatus',{'staff_id':'<?= encode_param($staff->id) ?>'})"
status="<?= $status ?>" status_id="<?= $staff->id ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -51,26 +51,26 @@
<tr>
<th class="hidden"><?= $tag->tag_id ?></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">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Tag/editTags/'.encode_param($tag->tag_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Tag/changeStatus/".encode_param($tag->tag_id))."/2" ?>"
onClick="return doconfirm()">
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Tag/changeStatus',{'tag_id':'<?= encode_param($tag->tag_id) ?>'})" status="2">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php if($tag->status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Tag/changeStatus/".encode_param($tag->tag_id))."/0" ?>">
<i class="fa fa-cog"></i> De-activate
</a>
<?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
<?php
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
if($tag->status != 1){
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
}
?>
<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 ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -57,7 +57,9 @@
<th class="center"><?= $venue->region_name ?></th>
<th class="center"><?= $venue->host_category ?></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">
<button class="btn btn-sm btn-info" id="viewVenueDetails"
venue_id="<?= encode_param($venue->venue_id) ?>">
......@@ -67,20 +69,18 @@
href="<?= base_url('Venue/editVenues/'.encode_param($venue->venue_id))?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Venue/changeStatus/".encode_param($venue->venue_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</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" ?>">
<i class="fa fa-cog"></i> De-activate
<?php
$status = 0; $btnName = 'De-activate'; $btnClass = 'btn-warning';
if($venue->status != 1){
$status = 1; $btnName = 'Activate'; $btnClass = 'btn-success';
}
?>
<a class="btn btn-sm btn-danger" onclick="confirmDelete(jQuery(this),'Venue/changeStatus',{'venue_id':'<?=encode_param($venue->venue_id)?>'})"
status="2"><i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Venue/changeStatus/".encode_param($venue->venue_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
<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 ?>">
<i class="fa fa-cog"><?= $btnName ?></i>
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
......@@ -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) {
event.preventDefault();
var validation = jQuery('[name="pushNotifForm"]').parsley().validate();
......@@ -853,3 +857,73 @@ jQuery('[id="pushNotification"]').on('click',function(event) {
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