From 4ab65cbeef0824bcd3547779c108c8ebe3c0af68 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 13 Jun 2024 14:31:26 +0530 Subject: [PATCH 1/3] Changes in template preview : GWM --- app/Controllers/MasterController.php | 61 ++++++++++++++++++++++-- app/Models/ClientDocsModel.php | 2 +- app/Views/client_docs_preview.php | 42 +++++++++++++++++ app/Views/layout/header.php | 39 +++++----------- app/Views/template_form.php | 70 +++++++++++++++++++++++++++- 5 files changed, 180 insertions(+), 34 deletions(-) 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(); } } }); From 5c72e37b583845d004bac520731652c2904870d0 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 13 Jun 2024 14:43:12 +0530 Subject: [PATCH 2/3] GWm --- app/Controllers/MasterController.php | 2 +- app/Controllers/StaffController.php | 6 +----- app/Views/client_list.php | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 493fbc9..dd36702 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -288,7 +288,7 @@ class MasterController extends BaseController $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')) + // ->where('client.business_id',$this->session->get('logged_in_staff_business_id')) ->findAll(); $data['serviceGroupData'] = $this->ServiceGroupModel->findAll(); diff --git a/app/Controllers/StaffController.php b/app/Controllers/StaffController.php index 6c495f7..c919bb9 100644 --- a/app/Controllers/StaffController.php +++ b/app/Controllers/StaffController.php @@ -163,11 +163,7 @@ class StaffController extends BaseController if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); } - $data['clientList'] = $this->ClientModel->select('client.* , COUNT(client_docs.id) as docs_count') - ->join('client_docs', 'client.client_id = client_docs.client_branch_id', 'left') - ->where('client.branch_id',$this->session->get('logged_in_staff_branch_id')) - ->groupBy('client.client_id') - ->findAll(); + $data['clientList'] = $this->ClientModel->findAll(); $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); echo view('layout/header', ['Data'=>$staffdata]); diff --git a/app/Views/client_list.php b/app/Views/client_list.php index 1593c6c..10bb87b 100644 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -46,7 +46,6 @@ PAN Mobile Email - Shared Docs Status Action @@ -62,7 +61,6 @@ - Active @@ -82,7 +80,7 @@ Activate - Documents + From 9a18363b99255a49769f5c419a328d8c8ff8de03 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 13 Jun 2024 17:19:41 +0530 Subject: [PATCH 3/3] GWM --- app/Controllers/MasterController.php | 4 +- app/Models/ClientDocsModel.php | 2 +- app/Views/business_form.php | 30 +++++++++-- app/Views/client_docs_preview.php | 70 ++++++++++++++---------- app/Views/client_home.php | 2 + app/Views/layout/header.php | 15 +++--- app/Views/share_docs.php | 4 +- app/Views/template_form.php | 81 ++++++++++++++++++---------- app/Views/template_list.php | 2 +- app/Views/template_preview.php | 7 ++- 10 files changed, 142 insertions(+), 75 deletions(-) diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index dd36702..60cad9c 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -262,6 +262,7 @@ class MasterController extends BaseController $id = $this->request->getVar('template_id'); $data['templateData'] = $this->TemplateModel->where('md5(template_id)',$id)->get()->getRow(); $data['serviceData'] = $this->ServiceModel->where('service_id',$data['templateData']->service_id)->get()->getRow(); + $data['businessData'] = $this->BusinessModel->where('business_id',$data['templateData']->template_header_business)->get()->getRow(); $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); $data['body_html'] = $data['templateData']->body_html; @@ -351,11 +352,12 @@ 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(); + $DateAndYears = $this->dateAndYearPlaceholder(); diff --git a/app/Models/ClientDocsModel.php b/app/Models/ClientDocsModel.php index 84b47a1..df51a88 100644 --- a/app/Models/ClientDocsModel.php +++ b/app/Models/ClientDocsModel.php @@ -14,7 +14,7 @@ class ClientDocsModel extends Model public function getTemplate($client_id){ - $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->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id ,client_docs.created_at ,client_docs.document_name, 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.is_active', 1); diff --git a/app/Views/business_form.php b/app/Views/business_form.php index 6b8d1ca..9dd0ab4 100644 --- a/app/Views/business_form.php +++ b/app/Views/business_form.php @@ -80,12 +80,36 @@ $(document).ready(function() { $('#summernote-header').summernote({ height: 150, // set the height of the editor - placeholder: 'Write the header content here...' + toolbar: [ + + ['style', ['style']], + ['font', ['bold', 'italic', 'underline', 'clear' ]], + ['fontname', ['fontname']], + ['fontsize', ['fontsize']], + ['color', ['color']], + ['para', ['ul', 'ol', 'paragraph' , 'height']], + ['table', ['table']], + ['insert', [ 'picture']], + ['view', ['fullscreen', 'codeview', 'help']], + ['mybutton', ['customButton','Years']] // Custom button group + ], }); $('#summernote-footer').summernote({ height: 150, // set the height of the editor - placeholder: 'Write the footer content here...' + toolbar: [ + + ['style', ['style']], + ['font', ['bold', 'italic', 'underline', 'clear' ]], + ['fontname', ['fontname']], + ['fontsize', ['fontsize']], + ['color', ['color']], + ['para', ['ul', 'ol', 'paragraph' , 'height']], + ['table', ['table']], + ['insert', [ 'picture']], + ['view', ['fullscreen', 'codeview', 'help']], + ['mybutton', ['customButton','Years']] // Custom button group + ], }); @@ -94,7 +118,7 @@ $(document).ready(function() { $('#summernote-header').summernote('code', $('#header_html').val()); $('#summernote-footer').summernote('code', $('#footer_html').val()); - }, 1000); + }, 500); diff --git a/app/Views/client_docs_preview.php b/app/Views/client_docs_preview.php index 82eda90..215cd11 100644 --- a/app/Views/client_docs_preview.php +++ b/app/Views/client_docs_preview.php @@ -11,7 +11,8 @@ border-top: 1px dotted #000; padding-top: 3px; } - + + @@ -19,37 +20,48 @@
- -
-
-
-
-

service_name; ?> - - - + +
+ +
+ +
+ +
+
+

service_name; ?> + + +

-
- Close +
+ Close - is_active == 1 && $docData->is_approved == 0){ ?> - Revert - is_active == 0 ) { ?> - Share - + is_active == 1 && $docData->is_approved == 0){ ?> + Revert + is_active == 0 ) { ?> + Share + - - - is_approved != 1){ ?> - Reject - Approve - -
+ + + is_approved != 1){ ?> + Reject + Approve +
-
-
- +
+ + +
+ +
+ + +

+
@@ -76,7 +88,9 @@
-
+
+ +
diff --git a/app/Views/client_home.php b/app/Views/client_home.php index 26be776..c8bbd0e 100644 --- a/app/Views/client_home.php +++ b/app/Views/client_home.php @@ -32,6 +32,7 @@ + @@ -46,6 +47,7 @@ +
Service Document Shared at Status
format('d-M-Y h:i A'); ?> diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 96e20e0..0496c27 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -277,14 +277,6 @@ Share Docs - - - - - - - -