Client feedback : GWM
This commit is contained in:
parent
30c43de33f
commit
3c351f4f34
@ -70,6 +70,7 @@ use CodeIgniter\Router\RouteCollection;
|
||||
$routes->post('doc_generate_otp','MasterController::doc_generate_otp');
|
||||
$routes->post('doc_verify_otp','MasterController::doc_verify_otp');
|
||||
$routes->post('download_doc','MasterController::download_doc');
|
||||
$routes->match(['get','post'],'shared_document_edit','MasterController::shared_document_edit');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -300,6 +300,32 @@ class MasterController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function shared_document_edit()
|
||||
{
|
||||
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
|
||||
if($this->request->getmethod() == 'POST')
|
||||
{
|
||||
$data = $this->request->getVar();
|
||||
$id = $this->request->getVar('id');
|
||||
unset($data['id']);
|
||||
$this->ClientDocsModel->where('id', $id )->set($data)->update();
|
||||
return $this->response->setJSON(['success' => true ]);
|
||||
|
||||
}else{
|
||||
|
||||
$id = $this->request->getVar('doc_id');
|
||||
$data['templateData'] = $this->ClientDocsModel->where('md5(id)',$id)->get()->getRow();
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('edit_shared_doc',$data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function get_service_data()
|
||||
{
|
||||
|
||||
|
||||
@ -38,9 +38,9 @@ class ClientDocsModel extends Model
|
||||
|
||||
|
||||
$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->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');
|
||||
$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');
|
||||
$this->where('client_docs.id', $doc_id);
|
||||
|
||||
return $this->get()->getRow();
|
||||
|
||||
@ -49,8 +49,7 @@ class StaffModel extends Model
|
||||
->select('staff.*, business.business_name AS business_name, branches.branch_name AS branch_name')
|
||||
->join('business', 'business.business_id = staff.business_id')
|
||||
->join('branches', 'branches.branch_id = staff.branch_id')
|
||||
->where('staff.staff_id != ', $is_staff_logged_in)
|
||||
->where('staff.branch_id', $logged_in_staff_branch_id);
|
||||
->where('staff.staff_id != ', $is_staff_logged_in);
|
||||
|
||||
// Execute the query and fetch results as an array
|
||||
$result = $query->get()->getResultArray();
|
||||
|
||||
327
app/Views/edit_shared_doc.php
Normal file
327
app/Views/edit_shared_doc.php
Normal file
@ -0,0 +1,327 @@
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start Page Content here -->
|
||||
<!-- ============================================================== -->
|
||||
<style>
|
||||
.append-text-button {
|
||||
display: inline-block;
|
||||
padding: 10px 10px;
|
||||
font-size: 13px;
|
||||
color: black; /* Primary color */
|
||||
background-color: transparent;
|
||||
border: 2px solid #85a7c9; /* Border color */
|
||||
border-radius: 4px; /* Rounded corners */
|
||||
text-align: center;
|
||||
cursor: pointer; /* Pointer cursor to indicate it's clickable */
|
||||
transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
|
||||
}
|
||||
|
||||
.append-text-button:hover {
|
||||
background-color: #85a7c9; /* Background color on hover */
|
||||
color: #fff; /* Text color on hover */
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="content-page">
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-2"></div>
|
||||
<div class="col-8">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"> Edit Document</h4>
|
||||
<div class="page-title-right">
|
||||
<button type="reset" onclick="window.history.back()" class="btn btn-secondary waves-effect">
|
||||
Back
|
||||
</button>
|
||||
<ol class="breadcrumb m-0">
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2"></div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-2"></div>
|
||||
<div class="col-lg-8">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<form id="template-form">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="messageto-input">Document Name<span class="text-danger">*</span> </label>
|
||||
<input type="text" class="form-control" id="document_name" value="<?= $templateData->document_name; ?>" >
|
||||
<input type="hidden" id="doc_id" value='<?= $templateData->id; ?>'>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="subject-input">Body Content</label>
|
||||
<!-- basic summernote-->
|
||||
<div id="summernote-basic"></div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-light" onClick="history.back()" data-dismiss="modal">Close</button>
|
||||
<button type="button" id="savedata" class="btn btn-primary">Save </button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div>
|
||||
<div class="col-lg-2"></div>
|
||||
<!-- end col -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- container -->
|
||||
|
||||
</div> <!-- content -->
|
||||
|
||||
|
||||
<!-- Modal Structure -->
|
||||
<div class="modal fade" id="customModal" tabindex="-1" role="dialog" aria-labelledby="customModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="customModalLabel">Place Holder Variables</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="container">
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Client Name</div>
|
||||
<div class="col-sm-8 append-text-button">%name%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">PAN No</div>
|
||||
<div class="col-sm-8 append-text-button">%pan_no%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">GST</div>
|
||||
<div class="col-sm-8 append-text-button">%gst_no%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Mobile No</div>
|
||||
<div class="col-sm-8 append-text-button">%mobile_no%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Email</div>
|
||||
<div class="col-sm-8 append-text-button">%email%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Address</div>
|
||||
<div class="col-sm-8 append-text-button">%address%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Country</div>
|
||||
<div class="col-sm-8 append-text-button">%country%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">State</div>
|
||||
<div class="col-sm-8 append-text-button">%state%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">City</div>
|
||||
<div class="col-sm-8 append-text-button">%city%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">PIN</div>
|
||||
<div class="col-sm-8 append-text-button">%pin_code%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="YearsCustomModal" tabindex="-1" role="dialog" aria-labelledby="YearsCustomModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="YearsCustomModalLabel">Place Holder Variables</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="container">
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Current Date</div>
|
||||
<div class="col-sm-8 append-text-button">%CD%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Calandar Year</div>
|
||||
<div class="col-sm-8 append-text-button">%CY%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Financial Year</div>
|
||||
<div class="col-sm-8 append-text-button">%FY%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Accessment Year</div>
|
||||
<div class="col-sm-8 append-text-button">%AY%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Q1 Year</div>
|
||||
<div class="col-sm-8 append-text-button">%Q1%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Q2 Year</div>
|
||||
<div class="col-sm-8 append-text-button">%Q2%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Q3 Year</div>
|
||||
<div class="col-sm-8 append-text-button">%Q3%</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 font-weight-bold">Q4 Year</div>
|
||||
<div class="col-sm-8 append-text-button">%Q4%</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" id="body_html" value='<?= isset($templateData) ? $templateData->body_html : '' ?>'>
|
||||
<!-- ============================================================== -->
|
||||
<!-- End Page content -->
|
||||
<!-- ============================================================== -->
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"> </script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0/js/select2.min.js"> </script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.19.0/js/md5.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.append-text-button').on('click', function() {
|
||||
var textToInsert = $(this).text(); // Get the text content of the clicked element
|
||||
$('#summernote-basic').summernote('focus'); // Focus on the Summernote editor
|
||||
$('#summernote-basic').summernote('editor.insertText', textToInsert); // Insert the text at the cursor position
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#savedata").on("click", function()
|
||||
{
|
||||
var body_html = $('#summernote-basic').summernote('code');
|
||||
formData ={
|
||||
|
||||
id : $('#doc_id').val(),
|
||||
document_name : $('#document_name').val(),
|
||||
body_html : body_html,
|
||||
};
|
||||
|
||||
|
||||
|
||||
console.log(formData);
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url()."shared_document_edit"; ?>',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
json: true,
|
||||
success: function(response) {
|
||||
console.log(response.success);
|
||||
if(response.success){
|
||||
|
||||
toastr.success('Data saved successfully ', 'Success');
|
||||
window.location.href = '<?= base_url()."shared_docs_list"; ?>';
|
||||
|
||||
}else{
|
||||
toastr.warning('Something went wrong', 'Warning');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle errors here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
$('#summernote-basic').summernote({
|
||||
height: 750,
|
||||
toolbar: [
|
||||
// [groupName, [list of button]]
|
||||
['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
|
||||
],
|
||||
|
||||
buttons: {
|
||||
customButton: function() {
|
||||
var ui = $.summernote.ui;
|
||||
// create button
|
||||
var button = ui.button({
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(() =>
|
||||
{
|
||||
$('#summernote-basic').summernote('code', $('#body_html').val());
|
||||
|
||||
}, 500);
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
@ -85,8 +85,18 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?php echo base_url().'client_docs_preview?doc_id='.$value['id']; ?>" > <i class='mdi mdi-eye-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Preview</a>
|
||||
<a id="doc_history_button" data-id="<?php echo $value['id']; ?>" class="dropdown-item" data-toggle="modal" data-target="#bike_make_login-modal" data-title="Share"><i class="mdi mdi-history" style="margin-right: 16px !important;"></i>History</a>
|
||||
|
||||
<a class="dropdown-item" href="<?php echo base_url().'client_docs_preview?doc_id='.$value['id']; ?>" >
|
||||
<i class='mdi mdi-eye-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Preview
|
||||
</a>
|
||||
|
||||
<a class="dropdown-item" href="<?= base_url()."shared_document_edit?doc_id=".md5($value['id']); ?>">
|
||||
<i class="mdi mdi-pencil-outline mr-2 text-muted font-18 vertical-middle"></i> Edit
|
||||
</a>
|
||||
|
||||
<a id="doc_history_button" data-id="<?php echo $value['id']; ?>" class="dropdown-item" data-toggle="modal" data-target="#bike_make_login-modal" data-title="Share">
|
||||
<i class="mdi mdi-history" style="margin-right: 16px !important;"></i>History
|
||||
</a>
|
||||
|
||||
<?php if($value['is_active'] == 1 && $value['is_approved'] == 0){ ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Revert" onclick="statusChange(this)"><i class="mdi mdi-file-undo" style="margin-right: 16px !important;margin-left: 5px;"></i>Revert</a>
|
||||
|
||||
@ -76,11 +76,7 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="messageto-input">Template Name<span class="text-danger">*</span> </label>
|
||||
<input type="text" class="form-control" id="template_name" value="<?= isset($templateData) ? $templateData->template_name : '' ?>" >
|
||||
<input type="hidden" id="template_id" value='<?= isset($templateData) ? $templateData->template_id : 'null' ?>'>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="vs_category">Template Header and Footer<span class="text-danger">*</span></label>
|
||||
@ -92,6 +88,12 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="messageto-input">Template Name<span class="text-danger">*</span> </label>
|
||||
<input type="text" class="form-control" id="template_name" value="<?= isset($templateData) ? $templateData->template_name : '' ?>" >
|
||||
<input type="hidden" id="template_id" value='<?= isset($templateData) ? $templateData->template_id : 'null' ?>'>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@ -290,6 +292,32 @@ $("#service_group_id").on("change", function()
|
||||
|
||||
$("#savedata").on("click", function()
|
||||
{
|
||||
|
||||
|
||||
var service_group_id = $('#service_group_id').val();
|
||||
var service_id = $('#service_id').val();
|
||||
var template_name = $('#template_name').val();
|
||||
var template_header_business = $('#template_header_business').val();
|
||||
|
||||
|
||||
// Check if required fields are filled
|
||||
if (!service_group_id) {
|
||||
toastr.warning('Service Group is required', 'Warning');
|
||||
return;
|
||||
}
|
||||
if (!service_id) {
|
||||
toastr.warning('Service is required', 'Warning');
|
||||
return;
|
||||
}
|
||||
if (!template_header_business) {
|
||||
toastr.warning('Template Header and Footer is required', 'Warning');
|
||||
return;
|
||||
}
|
||||
if (!template_name) {
|
||||
toastr.warning('Template Name is required', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var body_html = $('#summernote-basic').summernote('code');
|
||||
formData ={
|
||||
service_group_id : $('#service_group_id').val(),
|
||||
|
||||
@ -58,12 +58,16 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url()."template_edit?template_id=".md5($value['template_id']); ?>"><i class="mdi mdi-pencil-outline mr-2 text-muted font-18 vertical-middle"></i> Edit </a>
|
||||
<!-- <a class="dropdown-item" href="<?= base_url()."template_preview?template_id=".md5($value['template_id']); ?>"><i class="mdi mdi-eye-outline mr-2 text-muted font-18 vertical-middle"></i> Preview </a> -->
|
||||
|
||||
|
||||
<a class="dropdown-item preview-button" href="#" data-template-id="<?= md5($value['template_id']); ?>">
|
||||
<i class="mdi mdi-eye-outline mr-2 text-muted font-18 vertical-middle"></i> Preview
|
||||
</a>
|
||||
|
||||
<a class="dropdown-item" href="<?= base_url()."template_edit?template_id=".md5($value['template_id']); ?>">
|
||||
<i class="mdi mdi-pencil-outline mr-2 text-muted font-18 vertical-middle"></i> Edit
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user