Merge branch 'main' of bitbucket.org:venbainformationtechnology/bb_sign

This commit is contained in:
aadhavan valli 2024-06-05 14:51:41 +05:30
commit f8d2769d99
10 changed files with 60 additions and 79 deletions

View File

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

View File

@ -8,6 +8,8 @@ use App\Models\TemplateModel;
use App\Models\StaffModel; use App\Models\StaffModel;
use App\Models\ClientDocsModel; use App\Models\ClientDocsModel;
use App\Models\ClientModel; use App\Models\ClientModel;
use App\Models\BusinessModel;
use App\Models\BranchModel;
class MasterController extends BaseController class MasterController extends BaseController
@ -18,6 +20,8 @@ class MasterController extends BaseController
protected $StaffModel; protected $StaffModel;
protected $ClientDocsModel; protected $ClientDocsModel;
protected $ClientModel; protected $ClientModel;
protected $BusinessModel;
protected $BranchModel;
public function __construct() public function __construct()
{ {
@ -27,18 +31,18 @@ class MasterController extends BaseController
$this->StaffModel = new StaffModel(); $this->StaffModel = new StaffModel();
$this->ClientDocsModel = new ClientDocsModel(); $this->ClientDocsModel = new ClientDocsModel();
$this->ClientModel = new ClientModel(); $this->ClientModel = new ClientModel();
$this->BusinessModel = new BusinessModel();
$this->BranchModel = new BranchModel();
} }
public function test() public function test()
{ {
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); } $businessData = $this->BranchModel->select('branches.* , business.business_name ')
$data['serviceList'] = $this->ServiceModel->findAll(); ->join('business', 'branches.business_id = business.business_id', 'left')
->where('branches.branch_id',$this->session->get('logged_in_staff_branch_id'))
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); ->get()->getRow();
echo view('layout/header', ['Data'=>$staffdata]); dd($businessData);
echo view('test',$data);
echo view('layout/footer');
} }
@ -274,11 +278,19 @@ class MasterController extends BaseController
]; ];
if($is_active == 1){ if($is_active == 1){
$MailHelper = new MailHelper(); $MailHelper = new MailHelper();
$email = $this->ClientDocsModel
$clientData = $this->ClientDocsModel
->join('client', 'client_docs.client_id = client.client_id', 'left') ->join('client', 'client_docs.client_id = client.client_id', 'left')
->where('id', $doc_id)->get()->getRow()->email; ->where('id', $doc_id)->get()->getRow();
$url = '<a href="'.base_url().'">Click here</a>'; $url = '<a href="'.base_url().'">Click here</a>';
$MailHelper->send_url_email($email , $url );
$businessData = $this->BranchModel->select('branches.* , business.business_name ')
->join('business', 'branches.business_id = business.business_id', 'left')
->where('branches.branch_id',$this->session->get('logged_in_staff_branch_id'))
->get()->getRow();
$MailHelper->send_url_email($clientData->email , $url , $clientData->name , $businessData->business_name, $businessData->email);
} }
$updated = $this->ClientDocsModel->update($doc_id, $data); $updated = $this->ClientDocsModel->update($doc_id, $data);

View File

@ -1,22 +1,18 @@
<?php <?php
namespace App\Helpers; namespace App\Helpers;
use Psr\Log\LoggerInterface;
use App\Controllers\BaseController;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
use App\Models\VisaRequestModel;
use App\Models\NotesModel;
class MailHelper class MailHelper
{ {
protected static $logger;
public static function initLogger() {
if (self::$logger === null) {
self::$logger = \Config\Services::logger();
}
}
public static function send_otp_email($email_id,$otp) public static function send_otp_email($email_id,$otp)
{ {
@ -52,24 +48,23 @@ class MailHelper
} }
} }
public static function send_url_email($email_id,$url) public static function send_url_email($email_id,$url,$client_name,$business_name,$branch_email)
{ {
self::initLogger();
$subject = 'BB-Sign Verify Document'; $subject = 'BB-Sign Verify Document';
$message = "Hai ,
</br> $message = "Dear " . $client_name . ",<br>" . $business_name . " has requested your approval for a document. Please click the link below to preview and approve.<br><br>" . $url;
We have a request for document verification.
</br>
</br>
".$url;
try { try {
$email = \Config\Services::email(); $email = \Config\Services::email();
$email->setMailType('html'); $email->setMailType('html');
$email->setFrom('bbone@venbait.in', 'BB-Sign'); $email->setFrom($branch_email, 'BB-Sign');
$email->setTo($email_id); $email->setTo($email_id);
@ -77,8 +72,10 @@ class MailHelper
$email->setMessage($message); $email->setMessage($message);
if ($email->send()) { if ($email->send()) {
self::$logger->info('Email Sent Successfully');
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $email_id,],200); return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $email_id,],200);
} else { } else {
self::$logger->error('Email Sent Failed');
return json_encode(['status' => 'failed','code' => 404,'message'=>'Email Sent Failed...','data' => $email_id ],404); return json_encode(['status' => 'failed','code' => 404,'message'=>'Email Sent Failed...','data' => $email_id ],404);
} }

View File

@ -14,7 +14,7 @@ class ClientDocsModel extends Model
public function getTemplate($client_id){ public function getTemplate($client_id){
$this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id , services.service_name'); $this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id ,client_docs.created_at , 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.is_active', 1); $this->where('client_docs.is_active', 1);

View File

@ -7,6 +7,10 @@
text-align: center; text-align: center;
letter-spacing: 0.5rem; letter-spacing: 0.5rem;
} }
.file_approved {
border-top: 1px dotted #000;
padding-top: 3px;
}
</style> </style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
@ -56,7 +60,7 @@
</div> </div>
<div > <div >
<?php if($docData->is_approved == 1){ echo 'Approved at '.date('d-m-Y H:i:s', strtotime($docData->updated_at)).' through OTP sent to '.$clientData->mobile_no.' from ip address '.$docData->ip_address; } ?> <?php if($docData->is_approved == 1){ echo ' <div class="file_approved"> Approved at '.date('d-m-Y H:i:s', strtotime($docData->updated_at)).' through OTP sent to '.$clientData->mobile_no.' from ip address '.$docData->ip_address.'</div>'; } ?>
</div> </div>
</div> </div>

View File

@ -94,12 +94,12 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="state">State </label> <label for="state">State </label>
<input type="text" name="state" value="<?php if(isset($clientData)){ echo $clientData->state; } ?>" placeholder="Enter State" class="form-control" id="state"> <input type="text" name="state" value="<?php if(isset($clientData)){ echo $clientData->state; }else{ echo 'Tamil Nadu';} ?>" placeholder="Enter State" class="form-control" id="state">
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="country">Country</label> <label for="country">Country</label>
<input type="text" name="country" value="<?php if(isset($clientData)){ echo $clientData->country; } ?>" placeholder="Enter country" class="form-control" id="country"> <input type="text" name="country" value="<?php if(isset($clientData)){ echo $clientData->country; }else{ echo 'India';} ?>" placeholder="Enter country" class="form-control" id="country">
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">

View File

@ -32,7 +32,8 @@
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100 display"> <table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100 display">
<thead> <thead>
<tr> <tr>
<th>Template</th> <th>Document</th>
<th>Shared at</th>
<th>Status</th> <th>Status</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
@ -44,7 +45,8 @@
<?php foreach ($doc_list as $key => $value) { ?> <?php foreach ($doc_list as $key => $value) { ?>
<tr> <tr>
<td> <?php echo $value['template_name']; ?></td> <td> <?php echo $value['service_name']; ?></td>
<td> <?php $date = new DateTime($value['created_at']); echo $date->format('d-M-Y h:i A'); ?></td>
<td> <td>
<?php if ($value['is_approved'] == 1): ?> <?php if ($value['is_approved'] == 1): ?>
<span style="color:green">Approved</span> <span style="color:green">Approved</span>

View File

@ -80,11 +80,11 @@
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="<?php echo base_url().'client_docs_preview?doc_id='.$value['doc_id']; ?>" > <i class='mdi mdi-eye-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Preview</a> <a class="dropdown-item" href="<?php echo base_url().'client_docs_preview?doc_id='.$value['doc_id']; ?>" > <i class='mdi mdi-eye-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Preview</a>
<?php if($value['is_active'] == 1): ?> <?php if($value['is_active'] == 1 && $value['is_approved'] == 0){ ?>
<a class="dropdown-item" data-id="<?php echo $value['doc_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Revert" onclick="statusChange(this)"><i class="mdi mdi-file-undo" style="margin-right: 16px !important;margin-left: 5px;"></i>Revert</a> <a class="dropdown-item" data-id="<?php echo $value['doc_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Revert" onclick="statusChange(this)"><i class="mdi mdi-file-undo" style="margin-right: 16px !important;margin-left: 5px;"></i>Revert</a>
<?php else: ?> <?php } else if($value['is_active'] == 0 ) { ?>
<a class="dropdown-item" data-id="<?php echo $value['doc_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Share" onclick="statusChange(this)"><i class="mdi mdi-share-all-outline" style="margin-right: 16px !important;margin-left: 5px;"></i>Share</a> <a class="dropdown-item" data-id="<?php echo $value['doc_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Share" onclick="statusChange(this)"><i class="mdi mdi-share-all-outline" style="margin-right: 16px !important;margin-left: 5px;"></i>Share</a>
<?php endif; ?> <?php } ?>
</div> </div>
</div> </div>

View File

@ -91,37 +91,6 @@
</div> </div>
<div class="form-row">
<div class="form-group col-md-8">
<label for="address">Address</label>
<input type="text" name="address" value="<?php if(isset($staffData)){ echo $staffData->address; } ?>" parsley-trigger="change" placeholder="Enter Address" class="form-control" id="address">
</div>
<div class="form-group col-md-4">
<label for="city">City</label>
<input type="text" value="<?php if(isset($staffData)){ echo $staffData->city; } ?>" placeholder="Enter City" name="city" class="form-control" id="city">
</div>
<div class="form-group col-md-4">
<label for="state">State </label>
<input type="text" name="state" value="<?php if(isset($staffData)){ echo $staffData->state; } ?>" placeholder="Enter State" class="form-control" id="state">
</div>
<div class="form-group col-md-4">
<label for="country">Country</label>
<input type="text" name="country" value="<?php if(isset($staffData)){ echo $staffData->country; } ?>" placeholder="Enter country" class="form-control" id="country">
</div>
<div class="form-group col-md-4">
<label for="pin_code">PIN </label>
<input type="text" name="pin_code" value="<?php if(isset($staffData)){ echo $staffData->pin_code; } ?>" placeholder="Enter PIN" class="form-control" id="pin_code">
</div>
</div>

View File

@ -34,22 +34,19 @@
<form id="template-form"> <form id="template-form">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-6">
<label for="messageto-input">Service </label> <label for="messageto-input">Service </label>
<input type="text" class="form-control" value="<?= $serviceData->service_name; ?>" readonly> <input type="text" class="form-control" value="<?= $serviceData->service_name; ?>" readonly>
<input type="hidden" class="form-control" value="<?= $serviceData->service_id; ?>" id="service_id"> <input type="hidden" class="form-control" value="<?= $serviceData->service_id; ?>" id="service_id">
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-6">
<label for="messageto-input">Template </label> <label for="messageto-input">Template </label>
<input type="text" class="form-control" id="template_name" value="<?= isset($templateData) ? $templateData->template_name : '' ?>" > <input type="text" class="form-control" id="template_name" value="<?= isset($templateData) ? $templateData->template_name : '' ?>" >
<input type="hidden" id="template_id" value='<?= isset($templateData) ? $templateData->template_id : 'null' ?>'> <input type="hidden" id="template_id" value='<?= isset($templateData) ? $templateData->template_id : 'null' ?>'>
</div> </div>
<div class="form-group col-md-4">
<label for="subject-input">Header type</label>
<input type="text" class="form-control" id="header_type" value="<?= isset($templateData) ? $templateData->header_type : '' ?>" >
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -156,7 +153,6 @@ $("#savedata").on("click", function()
service_id : $('#service_id').val(), service_id : $('#service_id').val(),
template_id : $('#template_id').val(), template_id : $('#template_id').val(),
template_name : $('#template_name').val(), template_name : $('#template_name').val(),
header_type : $('#header_type').val(),
body_text : $('.note-editable > p:first').text(), body_text : $('.note-editable > p:first').text(),
body_html : $('.note-codable').val(), body_html : $('.note-codable').val(),
}; };
@ -207,7 +203,7 @@ $(document).ready(function() {
['color', ['color']], ['color', ['color']],
['para', ['ul', 'ol', 'paragraph' , 'height']], ['para', ['ul', 'ol', 'paragraph' , 'height']],
['table', ['table']], ['table', ['table']],
// ['insert', ['link', 'picture', 'video']], ['insert', [ 'picture']],
['view', ['fullscreen', 'codeview', 'help']], ['view', ['fullscreen', 'codeview', 'help']],
['mybutton', ['customButton']] // Custom button group ['mybutton', ['customButton']] // Custom button group
], ],