diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 7770a63..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; @@ -288,10 +289,10 @@ 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(); - // 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 +352,14 @@ 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.*') ->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 +369,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 +382,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/Controllers/StaffController.php b/app/Controllers/StaffController.php index c01656c..01475a5 100644 --- a/app/Controllers/StaffController.php +++ b/app/Controllers/StaffController.php @@ -174,11 +174,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/Models/ClientDocsModel.php b/app/Models/ClientDocsModel.php index f1942ce..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); @@ -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/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 85873a4..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,29 +20,48 @@
- -
-
-
-
-

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

service_name; ?> + + +

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

+
@@ -68,7 +88,9 @@
-
+
+ +
@@ -349,6 +371,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/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 @@ + - @@ -62,7 +61,6 @@ -
Service Document Shared at Status
format('d-M-Y h:i A'); ?> 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 EmailShared Docs Status Action
Active @@ -82,7 +80,7 @@ Activate - Documents + diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index ff9bf5b..0496c27 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -271,27 +271,12 @@ - - - - - - - - + diff --git a/app/Views/share_docs.php b/app/Views/share_docs.php index 901efe2..ff4ea61 100644 --- a/app/Views/share_docs.php +++ b/app/Views/share_docs.php @@ -44,7 +44,7 @@ - + @@ -60,7 +60,7 @@ $value) { ?> - + diff --git a/app/Views/template_form.php b/app/Views/template_form.php index 55e96ad..2a3549b 100644 --- a/app/Views/template_form.php +++ b/app/Views/template_form.php @@ -2,7 +2,26 @@ +
@@ -37,7 +56,6 @@
-
$value) { ?> @@ -121,39 +139,43 @@
Client Name
-
%name%
+
%name%
PAN No
-
%pan_no%
+
%pan_no%
+
+
+
GST
+
%gst_no%
Mobile No
-
%mobile_no%
+
%mobile_no%
Email
-
%email%
+
%email%
Address
-
%address%
+
%address%
Country
-
%country%
+
%country%
State
-
%state%
+
%state%
City
-
%city%
+
%city%
PIN
-
%pin_code%
+
%pin_code%
@@ -161,6 +183,56 @@
+ + '> @@ -174,7 +246,13 @@
Client NameClient Name Client Branch Name Service Group Service Name