GWM : template place holder value

This commit is contained in:
bitbucket 2024-06-15 16:51:26 +05:30
parent 0ee352a6ad
commit 1d59c5b416
7 changed files with 37 additions and 33 deletions

View File

@ -384,7 +384,7 @@ class MasterController extends BaseController
->where('client_branch.id',$data['docData']->client_branch_id)
->get()->getRow();
$DateAndYears = $this->dateAndYearPlaceholder();
$data['header_html'] = $data['docData']->header_html;
@ -395,22 +395,20 @@ class MasterController extends BaseController
$placeHolder = '%'.$key.'%';
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
}
if($data['docData']->is_active == 1){
$DateAndYears = $data['docData']->place_holder_object;
}else{
$DateAndYears = $this->dateAndYearPlaceholder();
}
//replace Date and Year values in template content
foreach ($DateAndYears as $key => $value) {
foreach (json_decode($DateAndYears,true) as $key => $value) {
$placeHolder = '%'.$key.'%';
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
}
$sharedDate = $this->DocsStatusModel->where('client_docs_id',$doc_id)->where('status','Shared')->get()->getRow()->created_at;
if($sharedDate){
$date = \DateTime::createFromFormat('Y-m-d H:i:s', $sharedDate);
$formattedDate = $date->format('d-m-Y');
$data['body_html'] = str_replace('%CD%',$formattedDate,$data['body_html']);
}
echo view('layout/header', ['Data'=>$userData]);
echo view('client_docs_preview',$data);
echo view('layout/footer');
@ -419,7 +417,7 @@ class MasterController extends BaseController
public function dateAndYearPlaceholder()
{
$currentDate = date('d-m-Y');
$currentYear = date('Y');
$currentMonth = date('m');
@ -446,6 +444,7 @@ class MasterController extends BaseController
}
$DateAndYears = [
"CD" => $currentDate,
"CY" => $currentYear,
"FY" => $financialYear,
"AY" => $assessmentYear,
@ -455,7 +454,7 @@ class MasterController extends BaseController
"Q4" => $q4,
];
return $DateAndYears;
return json_encode($DateAndYears);
}
@ -522,10 +521,13 @@ class MasterController extends BaseController
try {
$doc_id = $this->request->getPost('doc_id');
$is_active = $this->request->getPost('is_active');
$data = [
'is_active' => $is_active
];
$data['is_active'] = $is_active;
if($is_active == 1){
$DateAndYears = $this->dateAndYearPlaceholder();
$data['place_holder_object'] = $DateAndYears;
$MailHelper = new MailHelper();
$clientData = $this->ClientDocsModel->select('client.name , client_branch.email')
@ -542,6 +544,7 @@ class MasterController extends BaseController
$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');

View File

@ -64,7 +64,7 @@ class MailHelper
$email = \Config\Services::email();
$email->setMailType('html');
$email->setFrom($branch_email, 'BB-Sign');
$email->setFrom('bbone@venbait.in', 'BB-Sign');
$email->setTo($email_id);

View File

@ -7,7 +7,7 @@ class ClientDocsModel extends Model
protected $table = 'client_docs';
protected $primaryKey = 'id';
protected $allowedFields = ['client_branch_id','template_id','template_name','body_html','document_name','rejection_reason','is_approved','otp','ip_address','is_active' ,'created_by','updated_by'];
protected $allowedFields = ['client_branch_id','template_id','template_name','body_html','document_name','rejection_reason','is_approved','otp','ip_address','is_active' ,'place_holder_object','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_branch_id ,client_docs.updated_at,client_docs.ip_address,template.template_name,client_docs.body_html ,client_docs.is_active,client_docs.document_name, services.service_name , business.header_html, business.footer_html');
$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 ,client_docs.is_active,client_docs.document_name,client_docs.place_holder_object, services.service_name , business.header_html, business.footer_html');
$this->join('template', 'template.template_id = client_docs.template_id','left');
$this->join('services', 'services.service_id = template.service_id','left');
$this->join('business', 'business.business_id = template.template_header_business','left');

View File

@ -48,8 +48,7 @@
<tbody>
<?php foreach ($branch as $value) :
?>
<?php foreach ($branch as $value) : ?>
<tr>
<td><?= $value['branch_name']; ?></td>
<td><?= $value['gstno']; ?></td>
@ -84,10 +83,10 @@
</div>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>

View File

@ -30,10 +30,9 @@
<div class="card-body">
<table id="datatable-buttonss" class="table table-striped dt-responsive nowrap w-100">
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
<thead>
<tr>
<th>#</th>
<th>Business Name</th>
<th>Status</th>
<th>Action</th>
@ -43,10 +42,9 @@
<tbody>
<?php foreach ($business as $value) :
?>
<?php foreach ($business as $value) : ?>
<tr>
<td><?= $value['business_id']; ?></td>
<td><?= $value['business_name']; ?></td>
<td>
<?php if($value['isactive'] == 1): ?>
@ -73,9 +71,9 @@
</div>
</div>
</td>
<?php endforeach; ?>
</tr>
</tr>
<?php endforeach; ?>
</tbody>
@ -104,6 +102,7 @@
<script>
function statusChange(params) {
var status = params.getAttribute('data-isactive');
var business_id = params.getAttribute('data-id');

View File

@ -12,13 +12,12 @@
padding-top: 3px;
}
</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/html2canvas/1.4.1/html2canvas.min.js"></script>
<div class="content-page">
<!-- Start Content-->
<div class="container-fluid">

View File

@ -12,7 +12,9 @@
.select2-container--default .select2-selection--single .select2-selection__arrow{
top:4px;
}
</style>
<div class="content-page">
<!-- Start Content-->
<div class="container-fluid">
@ -338,6 +340,8 @@
$('#share-docs').submit(function(e) {
e.preventDefault(); // Prevent the form from submitting normally
// Create a FormData object