CHANGE_ADVERTISEMENT_JWT_CHANGE: AADHAVAN
This commit is contained in:
parent
be69492e80
commit
1a5e6daaf8
@ -10,8 +10,16 @@ use CodeIgniter\Router\RouteCollection;
|
|||||||
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||||
|
|
||||||
// Reminder Mail Notification
|
// Reminder Mail Notification
|
||||||
|
|
||||||
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
||||||
|
|
||||||
|
|
||||||
|
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
|
||||||
|
$routes->get("add_image_index", "AppContentManagementController::add_image_index");
|
||||||
|
$routes->get("getAdvertiseImage/(:any)", "AppContentManagementController::getAdvertiseImage/$1");
|
||||||
|
$routes->get("frontend_content", "AppContentManagementController::frontend_content");
|
||||||
|
|
||||||
|
|
||||||
// $routes->get('/', 'LoginController::index');
|
// $routes->get('/', 'LoginController::index');
|
||||||
$routes->get('/test', 'Home::index');
|
$routes->get('/test', 'Home::index');
|
||||||
$routes->get('/login', 'LoginController::index'); ///auth/google
|
$routes->get('/login', 'LoginController::index'); ///auth/google
|
||||||
|
|||||||
96
app/Controllers/AppContentManagementController.php
Normal file
96
app/Controllers/AppContentManagementController.php
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
use App\Models\AddImgModel;
|
||||||
|
use App\Models\FEContentModel;
|
||||||
|
|
||||||
|
class AppContentManagementController extends AdminController
|
||||||
|
{
|
||||||
|
use ResponseTrait;
|
||||||
|
protected $myLogger;
|
||||||
|
protected $addImgModel;
|
||||||
|
protected $feContentModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
|
$this->addImgModel = new AddImgModel();
|
||||||
|
$this->feContentModel = new FEContentModel();
|
||||||
|
}
|
||||||
|
public function add_image_index()
|
||||||
|
{
|
||||||
|
$this->myLogger->logme('error','Addvertisement Image list function called');
|
||||||
|
$headerData['page_name'] = 'Addvertisement Image List';
|
||||||
|
$data['addImageList'] = $this->addImgModel->findAll();
|
||||||
|
|
||||||
|
// dd($data);
|
||||||
|
|
||||||
|
echo view('layout/header', $headerData);
|
||||||
|
echo view('add_image_list', $data);
|
||||||
|
echo view('layout/footer');
|
||||||
|
|
||||||
|
// $this->loadLayout('client_onboarding', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add_advertise_image(){
|
||||||
|
|
||||||
|
// print_r($this->request->getPost());die;
|
||||||
|
$uploadFilePath = ROOTPATH . 'public/uploads/advertiseImage/';
|
||||||
|
$file_name = file_Upload($this->request->getFile('advertise_image'), $uploadFilePath);
|
||||||
|
$data['id'] = $this->request->getPost('add_image_id');
|
||||||
|
// $data['created_by'] = get_session_userid();
|
||||||
|
$data['name'] = $file_name;
|
||||||
|
|
||||||
|
if($data['id'] == 0){
|
||||||
|
$insert = $this->addImgModel->insert($data);
|
||||||
|
if($insert){
|
||||||
|
return $this->respond(['status' => true,'code' => 200,'data' => "success"], 200);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$id = $data['id'];
|
||||||
|
$update = $this->addImgModel->update($id,$data);
|
||||||
|
if($update){
|
||||||
|
return $this->respond(['status' => true,'code' => 200,'data' => "success"], 200);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAdvertiseImage($image_id){
|
||||||
|
|
||||||
|
$image_data = $this->addImgModel->select('name')->where(['id' => $image_id])->first();
|
||||||
|
|
||||||
|
if($image_data){
|
||||||
|
return $image_data['name'];
|
||||||
|
}else{
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Front End Content Area
|
||||||
|
public function frontend_content(){
|
||||||
|
|
||||||
|
$data['test'] = $this->feContentModel->findAll();
|
||||||
|
$headerData['page_name'] = 'Front-End Content';
|
||||||
|
|
||||||
|
echo view('layout/header', $headerData);
|
||||||
|
echo view('frontend_content_list', $data);
|
||||||
|
echo view('layout/footer');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -622,13 +622,7 @@ class EmployeeRestController extends AdminController
|
|||||||
// Upload the Employee Detail in DB by Sheet Data
|
// Upload the Employee Detail in DB by Sheet Data
|
||||||
public function employeeUpload()
|
public function employeeUpload()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// echo $this->request->getPost('client_id');
|
|
||||||
// die;
|
|
||||||
$file = $this->request->getFile('file');
|
$file = $this->request->getFile('file');
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||||
@ -639,17 +633,12 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
$jwt = $this->request->getHeader('Authorization');
|
$jwt = $this->request->getHeader('Authorization');
|
||||||
$jwtParts = explode(' ', $jwt);
|
$jwtParts = explode(' ', $jwt);
|
||||||
// print_r($jwtParts);die;
|
|
||||||
$token = $jwtParts[2];
|
|
||||||
// return "hello";
|
|
||||||
|
|
||||||
|
$token = $jwtParts[2];
|
||||||
|
|
||||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||||
// get the employee id from token
|
// get the employee id from token
|
||||||
$employee_id = $decodedPayload['id'];
|
$employee_id = $decodedPayload['id'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
|
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
|
||||||
if ($client_policy) {
|
if ($client_policy) {
|
||||||
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
|
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
|
||||||
@ -701,13 +690,13 @@ class EmployeeRestController extends AdminController
|
|||||||
$check_miss_match[]=$data[0][$i];
|
$check_miss_match[]=$data[0][$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($check_miss_match) > 0) {
|
if (count($check_miss_match) > 0) {
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 200);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($data[0]) != 11){
|
if(count($data[0]) != 11){
|
||||||
|
return json_encode($data[0]);
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,18 +723,6 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
$dataToInsert = [];
|
$dataToInsert = [];
|
||||||
$basic_cover_si= [];
|
$basic_cover_si= [];
|
||||||
// if ($extra[9]) {
|
|
||||||
// $new_array = [];
|
|
||||||
// for ($i=0; $i < count($extra[9]); $i++) {
|
|
||||||
// if ($sum_insured_amount_for_check_employee_2 != $extra[9][$i] || $sum_insured_amount_for_check_employee_1 != $extra[9][$i]) {
|
|
||||||
// $new_array[] = $i+1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (count($new_array) > 0) {
|
|
||||||
// $count =count($new_array);
|
|
||||||
// return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "$count Employee Sum Insured is Not Match.. " , 'data' => $new_array], 200);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
foreach ($extra['0'] as $index => $id) {
|
foreach ($extra['0'] as $index => $id) {
|
||||||
$relation ='';
|
$relation ='';
|
||||||
if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') {
|
if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use ReflectionClass;
|
|||||||
require_once('../vendor/autoload.php');
|
require_once('../vendor/autoload.php');
|
||||||
|
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
|
use App\Models\LevelContactModel;
|
||||||
|
|
||||||
|
|
||||||
class AuthJWT implements FilterInterface
|
class AuthJWT implements FilterInterface
|
||||||
@ -20,7 +21,6 @@ class AuthJWT implements FilterInterface
|
|||||||
public function before(RequestInterface $request, $arguments = null)
|
public function before(RequestInterface $request, $arguments = null)
|
||||||
{
|
{
|
||||||
$jwt = $request->getHeader('Authorization');
|
$jwt = $request->getHeader('Authorization');
|
||||||
$model = new EmployeeModel();
|
|
||||||
|
|
||||||
if ($jwt) {
|
if ($jwt) {
|
||||||
if (JWTToken::validateJWT($jwt)) {
|
if (JWTToken::validateJWT($jwt)) {
|
||||||
@ -28,22 +28,44 @@ class AuthJWT implements FilterInterface
|
|||||||
$data = json_decode($data);
|
$data = json_decode($data);
|
||||||
|
|
||||||
$id = $data->decoded->id;
|
$id = $data->decoded->id;
|
||||||
$user_data = $model->where('id', $id)->first();
|
if(isset($data->decoded->emp_code)){
|
||||||
|
$model = new EmployeeModel();
|
||||||
|
$user_data = $model->where('id', $id)->first();
|
||||||
|
|
||||||
if($user_data['token_time_out'] > time()){
|
if($user_data['token_time_out'] > time()){
|
||||||
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
||||||
$model->update($id, $data);
|
$model->update($id, $data);
|
||||||
return true;
|
return true;
|
||||||
|
}else{
|
||||||
|
$data =["token_time_out" => ''];
|
||||||
|
$model->update($id, $data);
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
http_response_code(401);
|
||||||
|
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
||||||
|
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
||||||
|
echo $error;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$data =["token_time_out" => ''];
|
$model = new LevelContactModel();
|
||||||
$model->update($id, $data);
|
$hr_data = $model->where('id', $id)->first();
|
||||||
header('Content-Type: application/json');
|
|
||||||
http_response_code(401);
|
if($hr_data['token_time_out'] > time()){
|
||||||
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
||||||
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
$model->update($id, $data);
|
||||||
echo $error;
|
return true;
|
||||||
exit;
|
}else{
|
||||||
|
$data =["token_time_out" => ''];
|
||||||
|
$model->update($id, $data);
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
http_response_code(401);
|
||||||
|
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
||||||
|
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
||||||
|
echo $error;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use CodeIgniter\HTTP\RequestInterface;
|
|||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
|
use App\Models\LevelContactModel;
|
||||||
|
|
||||||
|
|
||||||
class JWTToken
|
class JWTToken
|
||||||
@ -25,13 +26,20 @@ class JWTToken
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
||||||
|
|
||||||
$model = new EmployeeModel();
|
|
||||||
$id = $request_data['id'];
|
$id = $request_data['id'];
|
||||||
$data =[
|
$data =[
|
||||||
"token_time_out" => time() + getenv('TOKENTIMEOUT')
|
"token_time_out" => time() + getenv('TOKENTIMEOUT')
|
||||||
];
|
];
|
||||||
$model->update($id, $data);
|
if(isset($data['emp_code'])){
|
||||||
|
$model = new EmployeeModel();
|
||||||
|
$model->update($id, $data);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$models = new LevelContactModel();
|
||||||
|
$models->update($id, $data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|||||||
210
app/Views/add_image_list.php
Normal file
210
app/Views/add_image_list.php
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<style>
|
||||||
|
.table th,
|
||||||
|
.table td {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable tbody td {
|
||||||
|
padding: 4px 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable thead th {
|
||||||
|
padding: 4px 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-12{
|
||||||
|
|
||||||
|
max-width: 98% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="row" id="client_list">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row" style="margin-bottom:1rem;">
|
||||||
|
<div class="col-6" style="align-self: center;">
|
||||||
|
<h4 style="position: relative;">Advertisement Image List</h4>
|
||||||
|
</div>
|
||||||
|
<div class="col-6" style="text-align: right; position: relative;top: 5px;">
|
||||||
|
<a data-toggle="modal" data-target="#bike_make_login-modal" href="#" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||||
|
id="tickets-table">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th class="font-weight-medium">Advertisement Image Name</th>
|
||||||
|
<th class="font-weight-medium">Status</th>
|
||||||
|
<th class="font-weight-medium">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($addImageList as $row){ ?>
|
||||||
|
<tr >
|
||||||
|
<td class="client_info" data-id="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></td>
|
||||||
|
<td>
|
||||||
|
<?php echo $row['is_active']; ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group dropdown">
|
||||||
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<a class="dropdown-item advertise_image_edit" href="#" data-toggle="modal" data-id="<?php echo $row['id']; ?>" data-target="#bike_make_login-modal"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
|
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- end col -->
|
||||||
|
</div>
|
||||||
|
<!-- end row -->
|
||||||
|
|
||||||
|
|
||||||
|
<div id="append_client_info"></div>
|
||||||
|
|
||||||
|
<div id="bike_make_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="text-center mt-2 mb-4">
|
||||||
|
<h4 id="advertise_add_edit">Add Advertise Image </h4>
|
||||||
|
</div>
|
||||||
|
<form id="model_form_data" class="px-4">
|
||||||
|
|
||||||
|
<input type="text" name="add_image_id" id="add_image_id" value="0" hidden>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="branchname">Image</label>
|
||||||
|
<input class="form-control" name="advertise_image" id="advertise_image" type="file" accept="image/*" onchange="PreviewImage();" required="">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6 float-left" style="position: relative;top: 0px;">
|
||||||
|
<img src=" " width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group text-center">
|
||||||
|
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitBranch(this)">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function submitBranch(params) {
|
||||||
|
|
||||||
|
// if ($('#add_image_id').val()) {
|
||||||
|
// var url = '<?= base_url("edit_advertise_image/"); ?>'+$('#add_image_id').val();
|
||||||
|
// }else{
|
||||||
|
var url = '<?= base_url("add_advertise_image"); ?>';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var formData = new FormData($('#model_form_data')[0]);
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: url,
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
$('#bike_model_login-modal').modal('hide');
|
||||||
|
$('#bike_make_name').val('');
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
// Handle error response here
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function PreviewImage() {
|
||||||
|
console.log('function called');
|
||||||
|
var fileInput = document.getElementById("advertise_image");
|
||||||
|
var file = fileInput.files[0];
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
var allowedExtensions = ["jpg", "jpeg", "png"];
|
||||||
|
var fileExtension = file.name.split('.').pop().toLowerCase();
|
||||||
|
|
||||||
|
if (!allowedExtensions.includes(fileExtension) || file.size > 200 * 1024) {
|
||||||
|
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
|
||||||
|
fileInput.value = ""; // Clear the file input
|
||||||
|
document.getElementById("uploadPreview").src = "<?= base_url()."public/assets/images/avatar_2x.png" ?>"; // Remove the preview image
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
|
||||||
|
reader.onload = function (event) {
|
||||||
|
var img = new Image();
|
||||||
|
img.src = event.target.result;
|
||||||
|
|
||||||
|
img.onload = function () {
|
||||||
|
if (img.width !== 1640 || img.height !== 664) {
|
||||||
|
toastr.warning('Image dimensions must be 1640x664 pixels.', 'Invalid image dimensions.');
|
||||||
|
fileInput.value = ""; // Clear the file input
|
||||||
|
document.getElementById("uploadPreview").src = "<?= base_url()."public/assets/images/avatar_2x.png" ?>"; // Remove the preview image
|
||||||
|
} else {
|
||||||
|
document.getElementById("uploadPreview").src = img.src;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#btnAdd').click(function () {
|
||||||
|
$('#add_image_id').val(0);
|
||||||
|
$('#advertise_add_edit').html('Add Advertise Image');
|
||||||
|
$('#uploadPreview').attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$('.advertise_image_edit').click(function (params) {
|
||||||
|
// console.log($(this).data('id'));
|
||||||
|
$('#add_image_id').val($(this).data('id'));
|
||||||
|
var url = '<?= base_url("getAdvertiseImage/"); ?>'+$(this).data('id') ;
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: url,
|
||||||
|
success: function (response) {
|
||||||
|
console.log(response);
|
||||||
|
$('#advertise_add_edit').html('Edit Advertise Image');
|
||||||
|
$('#uploadPreview').attr('src', '<?= base_url() . "public/uploads/advertiseImage/"?>' + response)
|
||||||
|
.on('error', function() {
|
||||||
|
$(this).attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-editable.css" rel="stylesheet" type="text/css" /> -->
|
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-editable.css" rel="stylesheet" type="text/css" /> -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/remixicon/fonts/remixicon.css" rel="stylesheet">
|
||||||
|
|
||||||
<!-- Jodit Css -->
|
<!-- Jodit Css -->
|
||||||
<link href="<?= base_url() . "public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
<link href="<?= base_url() . "public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
||||||
@ -69,6 +70,8 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
|
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
@ -288,6 +291,10 @@
|
|||||||
bottom: 5px;
|
bottom: 5px;
|
||||||
left: 60px;
|
left: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#app_content_management:hover {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -603,6 +610,28 @@
|
|||||||
<span> Users </span>
|
<span> Users </span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
|
||||||
|
<i class="fa fa-info-circle" aria-hidden="true"></i>
|
||||||
|
<span class="badge badge-success badge-pill float-right">2</span>
|
||||||
|
<span> App Content Management </span>
|
||||||
|
</a>
|
||||||
|
<div class="collapse" id="sidebarDashboardsmenu">
|
||||||
|
<ul class="nav-second-level">
|
||||||
|
<li>
|
||||||
|
<a href="<?= base_url('/add_image_index') ?>"> Advertisement Images </a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="<?= base_url('/frontend_content') ?>">Front-end Content</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<!-- <li class="menu-title mt-2">Apps</li> -->
|
<!-- <li class="menu-title mt-2">Apps</li> -->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user