Merge : GWM
This commit is contained in:
parent
61b293bf04
commit
63b161d868
@ -11,7 +11,8 @@ use App\Models\ClientModel;
|
||||
use App\Models\BusinessModel;
|
||||
use App\Models\BranchModel;
|
||||
use App\Models\ServiceGroupModel;
|
||||
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\DocsStatusModel;
|
||||
|
||||
class MasterController extends BaseController
|
||||
{
|
||||
@ -24,6 +25,9 @@ class MasterController extends BaseController
|
||||
protected $BusinessModel;
|
||||
protected $BranchModel;
|
||||
protected $ServiceGroupModel;
|
||||
protected $ClientBranchModel;
|
||||
protected $DocsStatusModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -36,6 +40,8 @@ class MasterController extends BaseController
|
||||
$this->BusinessModel = new BusinessModel();
|
||||
$this->BranchModel = new BranchModel();
|
||||
$this->ServiceGroupModel = new ServiceGroupModel();
|
||||
$this->ClientBranchModel = new ClientBranchModel();
|
||||
$this->DocsStatusModel = new DocsStatusModel();
|
||||
|
||||
}
|
||||
|
||||
@ -260,7 +266,10 @@ class MasterController extends BaseController
|
||||
|
||||
|
||||
$data['doc_list'] = $this->ClientDocsModel->getDocs();
|
||||
$data['clientdata'] = $this->ClientModel->findAll();
|
||||
$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')
|
||||
->where('client.business_id',$this->session->get('logged_in_staff_business_id'))
|
||||
->findAll();
|
||||
$data['serviceGroupData'] = $this->ServiceGroupModel->findAll();
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
@ -291,11 +300,12 @@ class MasterController extends BaseController
|
||||
|
||||
public function create_docs()
|
||||
{
|
||||
|
||||
$docData = $this->request->getVar();
|
||||
$docData['created_by'] = $this->session->has('is_staff_logged_in');
|
||||
$insert = $this->ClientDocsModel->insert($docData);
|
||||
|
||||
if( $insert)
|
||||
if($insert)
|
||||
echo true;
|
||||
else
|
||||
echo false;
|
||||
@ -313,7 +323,10 @@ class MasterController extends BaseController
|
||||
$doc_id = $this->request->getVar('doc_id');
|
||||
$data['docData'] = $this->ClientDocsModel->docPreview($doc_id);
|
||||
|
||||
$data['clientData'] = $this->ClientModel->where('client_id',$data['docData']->client_id)->get()->getRow();
|
||||
$data['clientData'] = $this->ClientBranchModel->select('client.* , client_branch.*')
|
||||
->join('client', 'client_branch.client_id = client.client_id', 'left')
|
||||
->where('client.business_id',$this->session->get('logged_in_staff_business_id'))
|
||||
->where('id',$data['docData']->client_branch_id)->get()->getRow();
|
||||
$data['body_html'] = $data['docData']->body_html;
|
||||
foreach ($data['clientData'] as $key => $value) {
|
||||
$placeHolder = '%'.$key.'%';
|
||||
@ -395,14 +408,6 @@ class MasterController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function doc_verify_otp()
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ class ClientDocsModel extends Model
|
||||
protected $table = 'client_docs';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['client_id','template_id','rejection_reason','is_approved','otp','ip_address','is_active' ,'created_by','updated_by'];
|
||||
protected $allowedFields = ['client_branch_id','template_id','body_html','document_name','rejection_reason','is_approved','otp','ip_address','is_active' ,'created_by','updated_by'];
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class ClientDocsModel extends Model
|
||||
public function docPreview($doc_id){
|
||||
|
||||
|
||||
$this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_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,template.body_html , services.service_name');
|
||||
$this->join('template', 'template.template_id = client_docs.template_id');
|
||||
$this->join('services', 'services.service_id = template.service_id');
|
||||
$this->where('client_docs.id', $doc_id);
|
||||
|
||||
15
app/Models/DocsStatusModel.php
Normal file
15
app/Models/DocsStatusModel.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class DocsStatusModel extends Model
|
||||
{
|
||||
protected $table = 'docs_status';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['client_docs_id','is_approved','ip_address','rejection_reason','is_staff','is_active' ,'created_by','updated_by'];
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -21,11 +21,11 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Share Document</h4>
|
||||
<h4 class="page-title">Share Documents</h4>
|
||||
|
||||
<div class="page-title-right">
|
||||
<button type="reset" onclick="window.history.back()" class="btn btn-secondary waves-effect"> Back </button>
|
||||
<a href="javascript:void(0);" data-toggle="modal" data-target="#con-close-modal" class="btn btn-primary waves-effect waves-light">Share Docs </a>
|
||||
<a href="javascript:void(0);" data-toggle="modal" data-target="#bs-example-modal-lg" class="btn btn-primary waves-effect waves-light">Share Docs </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -112,8 +112,8 @@
|
||||
|
||||
|
||||
|
||||
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Create Docs </h4>
|
||||
@ -125,6 +125,18 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="field-2" class="control-label">Select Client</label>
|
||||
<select class="select2-dropdown form-control" name="client_branch_id" id="client_branch_id" required>
|
||||
<option value="">Select Client</option>
|
||||
<?php foreach ($clientdata as $key => $Value) { ?>
|
||||
<option value="<?php echo $Value['client_branch_id']; ?>" ><?php echo $Value['client_name']; ?> - <?php echo $Value['client_branch_name']; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="field-2" class="control-label">Service Group</label>
|
||||
<select class="select2-dropdown form-control" name="service_group_id" id="service_group_id" required>
|
||||
@ -137,7 +149,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Service</label>
|
||||
<select class="select2-dropdown form-control" name="service_id" id="service_id" required>
|
||||
@ -147,7 +159,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Template</label>
|
||||
<select class="select2-dropdown form-control" name="template_id" id="template_id" required>
|
||||
@ -157,6 +169,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Document Name</label>
|
||||
|
||||
<input type="text" class=" form-control" name="document_name" id="document_name" required>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" name="is_active" value="0">
|
||||
|
||||
@ -263,7 +284,7 @@
|
||||
|
||||
// Create a FormData object
|
||||
var formData = new FormData(this);
|
||||
|
||||
console.log(formData);
|
||||
// Make an AJAX POST request
|
||||
$.ajax({
|
||||
url: '<?= base_url()."create_docs"; ?>',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user