CHANGE_ assign docs to client : GWM

This commit is contained in:
bitbucket 2024-05-31 11:43:37 +05:30
parent b2f7c2b067
commit c8e0588592
5 changed files with 148 additions and 2 deletions

View File

@ -42,6 +42,7 @@ use CodeIgniter\Router\RouteCollection;
$routes->match(['get','post'],'/template_create','MasterController::template_create');
$routes->match(['get','post'],'/template_edit','MasterController::template_edit');
$routes->match(['get','post'],'/template_preview','MasterController::template_preview');
$routes->match(['get','post'],'/shared_docs_list','MasterController::shared_docs_list');
$routes->match(['get','post'],'/test','MasterController::test');

View File

@ -6,6 +6,8 @@ use App\Helpers\MailHelper;
use App\Models\ServiceModel;
use App\Models\TemplateModel;
use App\Models\StaffModel;
use App\Models\ClientDocsModel;
use App\Models\ClientModel;
class MasterController extends BaseController
@ -14,6 +16,8 @@ class MasterController extends BaseController
protected $ServiceModel;
protected $TemplateModel;
protected $StaffModel;
protected $ClientDocsModel;
protected $ClientModel;
public function __construct()
{
@ -21,6 +25,8 @@ class MasterController extends BaseController
$this->ServiceModel = new ServiceModel();
$this->TemplateModel = new TemplateModel();
$this->StaffModel = new StaffModel();
$this->ClientDocsModel = new ClientDocsModel();
$this->ClientModel = new ClientModel();
}
@ -190,6 +196,41 @@ class MasterController extends BaseController
}
public function shared_docs_list()
{
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
if($this->request->getmethod() == 'POST')
{
$templateData = $this->request->getVar();
if($this->request->getVar('template_id') != 'null'){
$id = $this->request->getVar('template_id');
unset($templateData['template_id']);
$this->TemplateModel->where('template_id', $id )->set($templateData)->update();
return $this->response->setJSON(['success' => true , 'service_id' =>$this->request->getVar('service_id')]);
}else{
unset($templateData['template_id']);
$this->TemplateModel->insert($templateData);
return $this->response->setJSON(['success' => true , 'service_id' =>$this->request->getVar('service_id')]);
}
}else{
$client_id = $this->request->getVar('client_id');
$data['doc_list'] = $this->ClientDocsModel->getTemplate($client_id);
$data['clientdata'] = $this->ClientModel->where('client_id', $client_id)->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('docs_shared_with_client',$data);
echo view('layout/footer');
}
}
// str_replace("%name%","Gowtham",$data['templateData']->body_html);

View File

@ -156,7 +156,9 @@ class StaffController extends BaseController
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
$data['clientList'] = $this->ClientModel->findAll();
$data['clientList'] = $this->ClientModel->select('client.* , COUNT(client_docs.id) as docs_count')
->join('client_docs', 'client.client_id = client_docs.client_id', 'left')
->findAll();
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
echo view('layout/header', ['Data'=>$staffdata]);

View File

@ -35,6 +35,7 @@
<th>PAN</th>
<th>Mobile</th>
<th>Email</th>
<th>Shared Docs</th>
<th>Status</th>
<th>Action</th>
</tr>
@ -50,6 +51,7 @@
<td> <?php echo $value['pan_no']; ?></td>
<td><?php echo $value['mobile_no']; ?></td>
<td><?php echo $value['email']; ?></td>
<td><?php echo $value['docs_count']; ?></td>
<td>
<?php if($value['is_active'] == 1): ?>
<span style="color:green">Active</span>
@ -66,7 +68,8 @@
<a class="dropdown-item" data-id="<?php echo $value['client_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;margin-right:10px"></i>Deactivate</a>
<?php else: ?>
<a class="dropdown-item" data-id="<?php echo $value['client_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Activate" onclick="statusChange(this)"><i class="fa fa-bicycle" style="margin-right:10px"></i>Activate</a>
<?php endif; ?>
<?php endif; ?>
<a class="dropdown-item" href="<?= base_url()."shared_docs_list?client_id=".$value['client_id']; ?>" > <i class='mdi mdi-file-document-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Documents</a>
</div>
</div>

View File

@ -0,0 +1,99 @@
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div class="content-page">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Docs Shared With <?= $clientdata->name; ?></h4>
</div>
</div>
<div class="col-6" style="margin-top: 19px;margin-left: -21px;">
<button style="float: right;" class="btn btn-primary waves-effect waves-light mr-1" href="#" onclick="window.history.back()">Back to List</button>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100 display">
<thead>
<tr>
<th>Template</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($doc_list as $key => $value) { ?>
<tr>
<td> <?php echo $value['template_name']; ?></td>
<td>
<?php if ($value['is_approved'] == 1): ?>
<span style="color:green">Approved</span>
<?php elseif ($value['is_approved'] == 0): ?>
<span style="color:orange">Pending Approval</span>
<?php elseif ($value['is_approved'] == 2): ?>
<span style="color:red">Rejected</span>
<?php endif; ?>
</td>
<td><a href="#"><i class='mdi mdi-eye-outline mr-1'></i>Preview</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div> <!-- container -->
</div> <!-- content -->
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
<script>
$(document).ready(function() {
$('#datatable-buttons').DataTable({
"ordering": false,
"paging": false,
"info": false,
"searching": true,
"lengthChange": false,
"dom": 'Bfrtip',
});
});
</script>