sanjeev
This commit is contained in:
parent
66a9163422
commit
1eacb69177
@ -45,12 +45,6 @@ class Notifications extends BaseController
|
|||||||
public function send_whatsapp_message() {
|
public function send_whatsapp_message() {
|
||||||
helper('apiIntegration');
|
helper('apiIntegration');
|
||||||
$params = (object) Null;
|
$params = (object) Null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->logger->info("Whatsapp : sending message instance id = ".$this->instance_id);
|
$this->logger->info("Whatsapp : sending message instance id = ".$this->instance_id);
|
||||||
$params->number = 916369084112;
|
$params->number = 916369084112;
|
||||||
|
|||||||
@ -67,10 +67,11 @@ class Users extends BaseController
|
|||||||
## For inserting/updating details of user
|
## For inserting/updating details of user
|
||||||
public function insert_users()
|
public function insert_users()
|
||||||
{
|
{
|
||||||
|
// print_r($this->request->getPost());die();
|
||||||
helper('session');
|
helper('session');
|
||||||
$session_uid = get_logged_user_id();
|
$session_uid = get_logged_user_id();
|
||||||
$session_bid = get_business_id();
|
$session_bid = get_business_id();
|
||||||
|
try {
|
||||||
// print_r($_FILES);die();
|
// print_r($_FILES);die();
|
||||||
$validationRule = [
|
$validationRule = [
|
||||||
'userfile' => [
|
'userfile' => [
|
||||||
@ -85,9 +86,8 @@ class Users extends BaseController
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (!$this->validate($validationRule) && $this->request->getPost('profile_picture') === '') {
|
if (!$this->validate($validationRule) && $this->request->getPost('profile_picture') === '') {
|
||||||
$data = ['errors' => $this->validator->getErrors()];
|
$error = $this->validator->getErrors();
|
||||||
print_r($data);
|
throw new \Exception((string)$error);
|
||||||
return 'hello';
|
|
||||||
}
|
}
|
||||||
$img = $this->request->getFile('profile_picture');
|
$img = $this->request->getFile('profile_picture');
|
||||||
$user_id = $this->request->getPost('user_id');
|
$user_id = $this->request->getPost('user_id');
|
||||||
@ -104,11 +104,11 @@ class Users extends BaseController
|
|||||||
if ($user_id) {
|
if ($user_id) {
|
||||||
$previousFileName = $this->request->getPost('previous_ufile');
|
$previousFileName = $this->request->getPost('previous_ufile');
|
||||||
if ($previousFileName && is_file('public/uploads/' . $previousFileName)) {
|
if ($previousFileName && is_file('public/uploads/' . $previousFileName)) {
|
||||||
link('public/uploads/' . $previousFileName);
|
link('public/uploads/'.$previousFileName,'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$fileName = $this->request->getPost('previous_ufile', ''); // Use the previous filename if no new image is provided
|
$fileName = $this->request->getPost('previous_ufile')?$this->request->getPost('previous_ufile'):""; // Use the previous filename if no new image is provided
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,13 +141,20 @@ class Users extends BaseController
|
|||||||
$data['password'] = $hash_password;
|
$data['password'] = $hash_password;
|
||||||
$data['created_by'] = $session_uid;
|
$data['created_by'] = $session_uid;
|
||||||
//print_r($data);die;
|
//print_r($data);die;
|
||||||
$UsersModel->insert($data);
|
($UsersModel->insert($data)) ? session()->setFlashdata('success', 'User has been added successfully.')
|
||||||
|
: session()->setFlashdata('error', 'User could not be added. Please try again.');
|
||||||
} else {
|
} else {
|
||||||
// It's an update operation
|
// It's an update operation
|
||||||
$isactive = $this->request->getPost('isactive');
|
$isactive = $this->request->getPost('isactive');
|
||||||
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
||||||
$data['updated_by'] = $session_uid;
|
$data['updated_by'] = $session_uid;
|
||||||
$UsersModel->update($user_id, $data);
|
// $UsersModel->update($user_id, $data);
|
||||||
|
($UsersModel->update($user_id, $data)) ? session()->setFlashdata('success', 'User has been updated successfully.')
|
||||||
|
: session()->setFlashdata('error', 'User update failed. Please try again.');
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch(\Exception $e) {
|
||||||
|
session()->setFlashdata('error', 'Message: ' .$e->getMessage());
|
||||||
}
|
}
|
||||||
return redirect()->route('user_list');
|
return redirect()->route('user_list');
|
||||||
}
|
}
|
||||||
@ -155,20 +162,24 @@ class Users extends BaseController
|
|||||||
## For delete the user details (Which means inactive the details)
|
## For delete the user details (Which means inactive the details)
|
||||||
public function delete_user($id)
|
public function delete_user($id)
|
||||||
{
|
{
|
||||||
|
|
||||||
helper('session');
|
helper('session');
|
||||||
$session_uid = get_logged_user_id();
|
$session_uid = get_logged_user_id();
|
||||||
|
try {
|
||||||
$model = new UsersModel();
|
$model = new UsersModel();
|
||||||
|
|
||||||
$existingBook = $model->find($id);
|
$existingBook = $model->find($id);
|
||||||
if (!$existingBook) {
|
if ($existingBook) {
|
||||||
return redirect()->route('user_list');
|
// $data=[];
|
||||||
}
|
|
||||||
|
|
||||||
$data['isactive'] = 0;
|
$data['isactive'] = 0;
|
||||||
$data['updated_by'] = $session_uid;
|
$data['updated_by'] = $session_uid;
|
||||||
$model->update($id, $data);
|
($model->update($id, $data)) ? session()->setFlashdata('success', 'Deleted successfully.')
|
||||||
|
: throw new \Exception("Data Not able to Deleted");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw new \Exception("Data Not Available");
|
||||||
|
}
|
||||||
|
}catch(\Exception $e) {
|
||||||
|
session()->setFlashdata('error', 'Message: ' .$e->getMessage());
|
||||||
|
}
|
||||||
return redirect()->route('user_list');
|
return redirect()->route('user_list');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,13 +39,21 @@
|
|||||||
<span class="widget-simple text-center">
|
<span class="widget-simple text-center">
|
||||||
<div class="media-body align-self-center font-24 avatar-title">
|
<div class="media-body align-self-center font-24 avatar-title">
|
||||||
<?php if (isset($validationErrors)) { ?>
|
<?php if (isset($validationErrors)) { ?>
|
||||||
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
<?= $validationErrors ?>
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<?php } elseif (isset($successMessage)) { ?>
|
<?php } elseif (isset($successMessage)) { ?>
|
||||||
<p style="color: #0aef14!important;" class="mt-0" style><?= $successMessage; ?></p>
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
<?php } else { ?>
|
<?= $successMessage ?>
|
||||||
<p style="color: #0a0a0a!important;" class="mt-0" style><?= "Please Choose Your Choice....."; ?></p>
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<p style="color: #0a0a0a!important;" class="mt-0" style><?= "Please Choose Your Choice....."; ?></p>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -473,6 +473,13 @@
|
|||||||
<!-- Init js -->
|
<!-- Init js -->
|
||||||
<script src="<?= base_url()."public/assets/js/pages/form-summernote.init.js" ?>"></script>
|
<script src="<?= base_url()."public/assets/js/pages/form-summernote.init.js" ?>"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Automatically close both success and error messages after 5 seconds (5000 milliseconds)
|
||||||
|
setTimeout(function () {
|
||||||
|
document.querySelectorAll('.alert').forEach(function (alert) {
|
||||||
|
alert.classList.add('d-none');
|
||||||
|
});
|
||||||
|
}, 5000); // Adjust the time (in milliseconds) as needed
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -7,9 +7,25 @@
|
|||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
<br>
|
<br>
|
||||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||||
|
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
|
||||||
<?php if (session()->getFlashdata('success')) : ?>
|
<?php if (session()->getFlashdata('success')) : ?>
|
||||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
|
<?= session('success') ?>
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if (session()->getFlashdata('error')) : ?>
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
<?= session('error') ?>
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<!-- <table id="datatable-buttons" class="table dt-responsive w-100"> -->
|
<!-- <table id="datatable-buttons" class="table dt-responsive w-100"> -->
|
||||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 139 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 139 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 256 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 256 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 366 KiB |
Loading…
Reference in New Issue
Block a user