CHANGE_BUSINESS_LOGO_LETTER_HEADER_CONFLICT : AADHAVAN

This commit is contained in:
unknown 2024-06-12 12:08:54 +05:30
commit c98e034f00
7 changed files with 90 additions and 30 deletions

View File

@ -9,6 +9,7 @@ use App\Models\ClientDocsModel;
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
use App\Models\DocsStatusModel;
use CodeIgniter\API\ResponseTrait; use CodeIgniter\API\ResponseTrait;
@ -20,6 +21,7 @@ class ClientController extends BaseController
protected $BranchModel; protected $BranchModel;
protected $StaffModel; protected $StaffModel;
protected $ClientDocsModel; protected $ClientDocsModel;
protected $DocsStatusModel;
use ResponseTrait; use ResponseTrait;
@ -31,6 +33,7 @@ class ClientController extends BaseController
$this->BranchModel = new BranchModel(); $this->BranchModel = new BranchModel();
$this->StaffModel = new StaffModel(); $this->StaffModel = new StaffModel();
$this->ClientDocsModel = new ClientDocsModel(); $this->ClientDocsModel = new ClientDocsModel();
$this->DocsStatusModel = new DocsStatusModel();
} }
@ -245,6 +248,18 @@ class ClientController extends BaseController
if($id){ if($id){
$update =$this->ClientDocsModel->update($id, $data); $update =$this->ClientDocsModel->update($id, $data);
if($this->session->has('is_client_logged_in')){
$logged_user = $this->session->get('is_client_logged_in');
}else{
$logged_user = $this->session->get('is_staff_logged_in');
}
$statusData['client_docs_id'] = $id;
$statusData['is_staff'] = 1;
$statusData['created_by'] = $logged_user;
$statusData['status'] = 'Rejected';
$statusData['note'] = $this->request->getPost('rejection_reason');
$this->DocsStatusModel->insert($statusData);
if ($update) { if ($update) {
return json_encode(true); return json_encode(true);

View File

@ -266,12 +266,13 @@ class MasterController extends BaseController
$data['doc_list'] = $this->ClientDocsModel->getDocs(); $data['doc_list'] = $this->ClientDocsModel->getDocs();
$data['clientdata'] = $this->ClientBranchModel->select('client.name as client_name , client_branch.name as client_branch_name , client_branch.id as client_branch_id') $data['clientdata'] = $this->ClientBranchModel->select('client.name as client_name , client_branch.name as client_branch_name , client_branch.id as client_branch_id')
->join('client', 'client_branch.client_id = client.client_id', 'left') ->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client.business_id',$this->session->get('logged_in_staff_business_id')) ->where('client.business_id',$this->session->get('logged_in_staff_business_id'))
->findAll(); ->findAll();
$data['serviceGroupData'] = $this->ServiceGroupModel->findAll(); $data['serviceGroupData'] = $this->ServiceGroupModel->findAll();
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
echo view('layout/header', ['Data'=>$staffdata]); echo view('layout/header', ['Data'=>$staffdata]);
echo view('share_docs',$data); echo view('share_docs',$data);
@ -303,12 +304,21 @@ class MasterController extends BaseController
$docData = $this->request->getVar(); $docData = $this->request->getVar();
$docData['created_by'] = $this->session->has('is_staff_logged_in'); $docData['created_by'] = $this->session->has('is_staff_logged_in');
$docData['body_html'] = $this->TemplateModel->where('template_id',$this->request->getVar('template_id'))->get()->getRow()->body_html;
$insert = $this->ClientDocsModel->insert($docData); $insert = $this->ClientDocsModel->insert($docData);
if($insert) if($insert){
echo true;
else $data['client_docs_id'] = $insert;
echo false; $data['is_staff'] = 1;
$data['created_by'] = $this->session->get('is_staff_logged_in');
$data['status'] = 'Created';
$this->DocsStatusModel->insert($data);
echo true;
} else {
echo false;
}
} }
@ -326,7 +336,9 @@ class MasterController extends BaseController
$data['clientData'] = $this->ClientBranchModel->select('client.* , client_branch.*') $data['clientData'] = $this->ClientBranchModel->select('client.* , client_branch.*')
->join('client', 'client_branch.client_id = client.client_id', 'left') ->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client.business_id',$this->session->get('logged_in_staff_business_id')) ->where('client.business_id',$this->session->get('logged_in_staff_business_id'))
->where('id',$data['docData']->client_branch_id)->get()->getRow(); ->where('client_branch.id',$data['docData']->client_branch_id)->get()->getRow();
$data['body_html'] = $data['docData']->body_html; $data['body_html'] = $data['docData']->body_html;
foreach ($data['clientData'] as $key => $value) { foreach ($data['clientData'] as $key => $value) {
$placeHolder = '%'.$key.'%'; $placeHolder = '%'.$key.'%';
@ -351,9 +363,10 @@ class MasterController extends BaseController
if($is_active == 1){ if($is_active == 1){
$MailHelper = new MailHelper(); $MailHelper = new MailHelper();
$clientData = $this->ClientDocsModel $clientData = $this->ClientDocsModel->select('client.name , client_branch.email')
->join('client', 'client_docs.client_id = client.client_id', 'left') ->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->where('id', $doc_id)->get()->getRow(); ->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
$url = '<a href="'.base_url().'">Click here</a>'; $url = '<a href="'.base_url().'">Click here</a>';
@ -363,6 +376,18 @@ class MasterController extends BaseController
->get()->getRow(); ->get()->getRow();
$MailHelper->send_url_email($clientData->email , $url , $clientData->name , $businessData->business_name, $businessData->email); $MailHelper->send_url_email($clientData->email , $url , $clientData->name , $businessData->business_name, $businessData->email);
$statusData['client_docs_id'] = $doc_id;
$statusData['is_staff'] = 1;
$statusData['created_by'] = $this->session->get('is_staff_logged_in');
$statusData['status'] = 'Shared';
$this->DocsStatusModel->insert($statusData);
}else{
$statusData['client_docs_id'] = $doc_id;
$statusData['is_staff'] = 1;
$statusData['created_by'] = $this->session->get('is_staff_logged_in');
$statusData['status'] = 'Revert';
$this->DocsStatusModel->insert($statusData);
} }
$updated = $this->ClientDocsModel->update($doc_id, $data); $updated = $this->ClientDocsModel->update($doc_id, $data);
@ -391,8 +416,7 @@ class MasterController extends BaseController
$id = $this->request->getPost('doc_id'); $id = $this->request->getPost('doc_id');
$data = [ $data = [
'otp' => '123456' , 'otp' => '123456',
'ip_address' => $this->request->getPost('clientIp')
]; ];
$update = $this->ClientDocsModel->update($id, $data); $update = $this->ClientDocsModel->update($id, $data);
@ -419,8 +443,24 @@ class MasterController extends BaseController
$data = ['otp' =>'' ,'rejection_reason' =>'']; $data = ['otp' =>'' ,'rejection_reason' =>''];
if($client_doc_data){ if($client_doc_data){
$data['is_approved']=$this->request->getPost('is_approved');
$data['is_approved'] = $this->request->getPost('is_approved');
$data['ip_address'] = $this->request->getPost('clientIp');
$update = $this->ClientDocsModel->update($id , $data); $update = $this->ClientDocsModel->update($id , $data);
if($this->session->has('is_client_logged_in')){
$logged_user = $this->session->get('is_client_logged_in');
}else{
$logged_user = $this->session->get('is_staff_logged_in');
}
$statusData['client_docs_id'] = $id;
$statusData['is_staff'] = 1;
$statusData['created_by'] = $logged_user;
$statusData['status'] = 'Rejected';
$statusData['note'] = $this->request->getPost('clientIp');
$this->DocsStatusModel->insert($statusData);
if($update){ if($update){
return json_encode(true); return json_encode(true);
} }

View File

@ -26,9 +26,9 @@ class ClientDocsModel extends Model
public function getDocs(){ public function getDocs(){
$this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id ,client_docs.is_active, services.service_name'); $this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id ,client_docs.is_active , client_docs.document_name, services.service_name');
$this->join('template', 'template.template_id = client_docs.template_id'); $this->join('template', 'template.template_id = client_docs.template_id');
$this->join('services', 'services.service_id = template.service_id'); $this->join('services', 'services.service_id = template.service_id');
return $this->findAll(); return $this->findAll();
@ -37,10 +37,11 @@ class ClientDocsModel extends Model
public function docPreview($doc_id){ public function docPreview($doc_id){
$this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_branch_id ,client_docs.updated_at,client_docs.ip_address,template.template_name,template.body_html , services.service_name'); $this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_branch_id ,client_docs.updated_at,client_docs.ip_address,template.template_name,client_docs.body_html , services.service_name');
$this->join('template', 'template.template_id = client_docs.template_id'); $this->join('template', 'template.template_id = client_docs.template_id');
$this->join('services', 'services.service_id = template.service_id'); $this->join('services', 'services.service_id = template.service_id');
$this->where('client_docs.id', $doc_id); $this->where('client_docs.id', $doc_id);
return $this->get()->getRow(); return $this->get()->getRow();
} }

View File

@ -7,7 +7,7 @@ class DocsStatusModel extends Model
protected $table = 'docs_status'; protected $table = 'docs_status';
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $allowedFields = ['client_docs_id','is_approved','ip_address','rejection_reason','is_staff','is_active' ,'created_by','updated_by']; protected $allowedFields = ['client_docs_id','status','note','is_staff','is_active' ,'created_by','updated_by'];

View File

@ -149,16 +149,14 @@
event.preventDefault(); // Prevent form submission event.preventDefault(); // Prevent form submission
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$.getJSON('https://api.ipify.org?format=json', function(data) {
var clientIp = data.ip;
$.ajax({ $.ajax({
url: '<?php echo base_url()."doc_generate_otp"?>', url: '<?php echo base_url()."doc_generate_otp"?>',
method: 'POST', method: 'POST',
data: { data: {
mobile_no : $('#mobile_no').val(), mobile_no : $('#mobile_no').val(),
doc_id : $('#doc_id').val(), doc_id : $('#doc_id').val()
clientIp: clientIp
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
@ -183,19 +181,23 @@
console.error('Error generating OTP: ' + error); console.error('Error generating OTP: ' + error);
} }
}); });
})
}) })
$('#approve_submit_button').click(function (params) { $('#approve_submit_button').click(function (params) {
var formData ={
otp : $('#otp').val(),
doc_id : $('#doc_id').val(),
is_approved: 1
}
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$('#approve_error').html(''); $('#approve_error').html('');
$.getJSON('https://api.ipify.org?format=json', function(data) {
var clientIp = data.ip;
var formData ={
otp : $('#otp').val(),
doc_id : $('#doc_id').val(),
is_approved: 1,
clientIp : clientIp
}
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '<?php echo base_url()."doc_verify_otp"?>', url: '<?php echo base_url()."doc_verify_otp"?>',
@ -219,7 +221,7 @@
$('.loader-mask').fadeOut('slow'); $('.loader-mask').fadeOut('slow');
} }
}); });
});
}) })

View File

@ -215,7 +215,7 @@
<!-- LOGO --> <!-- LOGO -->
<div class="logo-box"> <div class="logo-box">
<a href="index.html" class="logo logo-dark text-center"> <a class="logo logo-dark text-center">
<span class="logo-sm"> <span class="logo-sm">
<img src="<?= base_url()."public"; ?>/assets/images/logo_white_sm.png" alt="" height="24"> <img src="<?= base_url()."public"; ?>/assets/images/logo_white_sm.png" alt="" height="24">
<!-- <span class="logo-lg-text-light">Minton</span> --> <!-- <span class="logo-lg-text-light">Minton</span> -->
@ -226,7 +226,7 @@
</span> </span>
</a> </a>
<a href="index.html" class="logo logo-light text-center"> <a class="logo logo-light text-center">
<span class="logo-sm"> <span class="logo-sm">
<img src="<?= base_url()."public"; ?>/assets/images/logo_white_sm.png" alt="" height="24"> <img src="<?= base_url()."public"; ?>/assets/images/logo_white_sm.png" alt="" height="24">
</span> </span>

View File

@ -46,6 +46,7 @@
<thead> <thead>
<tr> <tr>
<th>Service</th> <th>Service</th>
<th>Document Name</th>
<th>Doc Status</th> <th>Doc Status</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
@ -58,6 +59,7 @@
<tr> <tr>
<td> <?php echo $value['service_name']; ?></td> <td> <?php echo $value['service_name']; ?></td>
<td> <?php echo $value['document_name']; ?></td>
<td> <td>
<?php if ($value['is_active'] == 1){ ?> <?php if ($value['is_active'] == 1){ ?>