diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 7770a63..493fbc9 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -291,7 +291,7 @@ class MasterController extends BaseController ->where('client.business_id',$this->session->get('logged_in_staff_business_id')) ->findAll(); $data['serviceGroupData'] = $this->ServiceGroupModel->findAll(); - // print_r($data['doc_list']);die; + $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); echo view('layout/header', ['Data'=>$staffdata]); echo view('share_docs',$data); @@ -351,10 +351,13 @@ class MasterController extends BaseController $doc_id = $this->request->getVar('doc_id'); $data['docData'] = $this->ClientDocsModel->docPreview($doc_id); - +// dd( $data['docData']); $data['clientData'] = $this->ClientBranchModel->select('client.* , client_branch.*') ->join('client', 'client_branch.client_id = client.client_id', 'left') - ->where('client_branch.id',$data['docData']->client_branch_id)->get()->getRow(); + ->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; @@ -364,6 +367,12 @@ class MasterController extends BaseController $data['body_html'] = str_replace($placeHolder,$value,$data['body_html']); } + + foreach ($DateAndYears as $key => $value) { + $placeHolder = '%'.$key.'%'; + $data['body_html'] = str_replace($placeHolder,$value,$data['body_html']); + + } echo view('layout/header', ['Data'=>$userData]); echo view('client_docs_preview',$data); @@ -371,6 +380,52 @@ class MasterController extends BaseController } + public function dateAndYearPlaceholder() + { + $currentDate = date('d-m-Y'); + + + $currentYear = date('Y'); + $currentMonth = date('m'); + + + if ($currentMonth >= 4) { + $financialYearStart = $currentYear . '-04-01'; + $financialYearEnd = ($currentYear + 1) . '-03-31'; + $financialYear = $currentYear . '-' . ($currentYear + 1); + $assessmentYear = ($currentYear + 1) . '-' . ($currentYear + 2); + $q1 = '01-04-' . $currentYear . ' to ' . '30-06-' . $currentYear; + $q2 = '01-07-' . $currentYear . ' to ' . '30-09-' . $currentYear; + $q3 = '01-10-' . $currentYear . ' to ' . '31-12-' . $currentYear; + $q4 = '01-01-' . ($currentYear + 1) . ' to ' . '31-03-' . ($currentYear + 1); + + } else { + $financialYearStart = ($currentYear - 1) . '-04-01'; + $financialYearEnd = $currentYear . '-03-31'; + $financialYear = ($currentYear - 1) . '-' . $currentYear; + $assessmentYear = $currentYear . '-' . ($currentYear + 1); + $q1 = '01-04-' . ($currentYear - 1) . ' to ' . '30-06-' . ($currentYear - 1); + $q2 = '01-07-' . ($currentYear - 1) . ' to ' . '30-09-' . ($currentYear - 1); + $q3 = '01-10-' . ($currentYear - 1) . ' to ' . '31-12-' . ($currentYear - 1); + $q4 = '01-01-' . $currentYear . ' to ' . '31-03-' . $currentYear; + } + + $DateAndYears = [ + "CD" => $currentDate, + "CY" => $currentYear, + "FY" => $financialYear, + "AY" => $assessmentYear, + "Q1" => $q1, + "Q2" => $q2, + "Q3" => $q3, + "Q4" => $q4, + + ]; + + return $DateAndYears; + + } + public function client_docs_histroy($doc_id) { if($this->session->has('is_staff_logged_in')){ diff --git a/app/Models/ClientDocsModel.php b/app/Models/ClientDocsModel.php index f1942ce..84b47a1 100644 --- a/app/Models/ClientDocsModel.php +++ b/app/Models/ClientDocsModel.php @@ -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 , 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, services.service_name , business.header_html, business.footer_html'); $this->join('template', 'template.template_id = client_docs.template_id'); $this->join('services', 'services.service_id = template.service_id'); $this->join('business', 'business.business_id = template.template_header_business'); diff --git a/app/Views/client_docs_preview.php b/app/Views/client_docs_preview.php index 85873a4..82eda90 100644 --- a/app/Views/client_docs_preview.php +++ b/app/Views/client_docs_preview.php @@ -31,6 +31,14 @@
Close + + is_active == 1 && $docData->is_approved == 0){ ?> + Revert + is_active == 0 ) { ?> + Share + + + is_approved != 1){ ?> Reject @@ -349,6 +357,40 @@ }); }); }); + + + function statusChange(params) { + console.log(params); + var status = params.getAttribute('data-isactive'); + var doc_id = params.getAttribute('data-id'); + if(status == 1){ + var is_active= 0; + }else{ + var is_active= 1; + } + + var formData = { + doc_id: doc_id, + is_active: is_active + }; + $.ajax({ + type: 'POST', + url: '', + data: formData, + dataType: 'json', + success: function(response) { + if (response.data) { + window.location.reload(); + } + }, + error: function(xhr, status, error) { + // Handle error response here + console.error(xhr.responseText); + } + }); + + + } diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index ff9bf5b..96e20e0 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -271,25 +271,18 @@ - - - - + + + + + +
+ + + + - - + diff --git a/app/Views/template_form.php b/app/Views/template_form.php index 55e96ad..4f8b995 100644 --- a/app/Views/template_form.php +++ b/app/Views/template_form.php @@ -127,6 +127,10 @@
PAN No
%pan_no%
+
+
GST
+
%gst_no%
+
Mobile No
%mobile_no%
@@ -161,6 +165,56 @@
+ + '> @@ -270,7 +324,7 @@ $(document).ready(function() { ['table', ['table']], ['insert', [ 'picture']], ['view', ['fullscreen', 'codeview', 'help']], - ['mybutton', ['customButton']] // Custom button group + ['mybutton', ['customButton','Years']] // Custom button group ], buttons: { @@ -278,13 +332,25 @@ $(document).ready(function() { var ui = $.summernote.ui; // create button var button = ui.button({ - contents: ' Place Holders', + contents: 'Client Details', tooltip: 'Client Details Place Holders', click: function() { $('#customModal').modal('show'); } }); return button.render(); + }, + Years: function() { + var ui = $.summernote.ui; + // create button + var button = ui.button({ + contents: 'Date & Year', + tooltip: 'Date & Year Place Holders', + click: function() { + $('#YearsCustomModal').modal('show'); + } + }); + return button.render(); } } });