From 5ed8e9ab0e71de66c7a9758e4d9e370f43d664bb Mon Sep 17 00:00:00 2001 From: bitbucket Date: Sat, 15 Jun 2024 12:02:23 +0530 Subject: [PATCH] GWM : placeholder auto append --- app/Controllers/MasterController.php | 27 ++++--- app/Views/client_docs_preview.php | 15 ++-- app/Views/edit_shared_doc.php | 85 ++++++++++++------- app/Views/layout/header.php | 78 +++++++++--------- app/Views/template_form.php | 117 ++++++++++++++++----------- 5 files changed, 188 insertions(+), 134 deletions(-) diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 4e45857..b37b584 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -379,28 +379,37 @@ class MasterController extends BaseController $doc_id = $this->request->getVar('doc_id'); $data['docData'] = $this->ClientDocsModel->docPreview($doc_id); - $data['clientData'] = $this->ClientBranchModel->select('client.* , client_branch.*') + $data['clientData'] = $this->ClientBranchModel->select('client.name , client.pan_no ,client_branch.gst_no , client_branch.mobile_no , client_branch.email , client_branch.address , client_branch.country , client_branch.state , client_branch.city , client_branch.pin_code ') ->join('client', 'client_branch.client_id = client.client_id', 'left') ->where('client_branch.id',$data['docData']->client_branch_id) ->get()->getRow(); - + $DateAndYears = $this->dateAndYearPlaceholder(); $data['header_html'] = $data['docData']->header_html; $data['footer_html'] = $data['docData']->footer_html; $data['body_html'] = $data['docData']->body_html; + //replace client details in template content foreach ($data['clientData'] as $key => $value) { $placeHolder = '%'.$key.'%'; $data['body_html'] = str_replace($placeHolder,$value,$data['body_html']); - } - + //replace Date and Year values in template content foreach ($DateAndYears 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); @@ -410,9 +419,7 @@ class MasterController extends BaseController public function dateAndYearPlaceholder() { - $currentDate = date('d-m-Y'); - - + $currentYear = date('Y'); $currentMonth = date('m'); @@ -439,7 +446,6 @@ class MasterController extends BaseController } $DateAndYears = [ - "CD" => $currentDate, "CY" => $currentYear, "FY" => $financialYear, "AY" => $assessmentYear, @@ -447,7 +453,6 @@ class MasterController extends BaseController "Q2" => $q2, "Q3" => $q3, "Q4" => $q4, - ]; return $DateAndYears; diff --git a/app/Views/client_docs_preview.php b/app/Views/client_docs_preview.php index d03e067..f33c769 100644 --- a/app/Views/client_docs_preview.php +++ b/app/Views/client_docs_preview.php @@ -12,7 +12,10 @@ padding-top: 3px; } - + + + + @@ -326,8 +329,7 @@