This commit is contained in:
bitbucket 2024-06-14 09:54:17 +05:30
parent 11b2f95593
commit 30c43de33f
5 changed files with 22 additions and 9 deletions

View File

@ -37,7 +37,7 @@ class ClientDocsModel extends Model
public function docPreview($doc_id){ 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 ,client_docs.is_active, 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,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('template', 'template.template_id = client_docs.template_id');
$this->join('services', 'services.service_id = template.service_id'); $this->join('services', 'services.service_id = template.service_id');
$this->join('business', 'business.business_id = template.template_header_business'); $this->join('business', 'business.business_id = template.template_header_business');

View File

@ -326,6 +326,8 @@
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
document.querySelector(".download-btnn").addEventListener("click", async function() { document.querySelector(".download-btnn").addEventListener("click", async function() {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var element = document.querySelector(".card-body"); var element = document.querySelector(".card-body");
// Get the HTML content of the element as a string // Get the HTML content of the element as a string
@ -353,7 +355,7 @@
// Create a link element // Create a link element
var link = document.createElement('a'); var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob); link.href = window.URL.createObjectURL(blob);
link.download = '<?php echo $docData->service_name; ?>.pdf'; link.download = '<?php echo $docData->document_name; ?>.pdf';
// Append the link to the body // Append the link to the body
document.body.appendChild(link); document.body.appendChild(link);
@ -362,6 +364,8 @@
// Remove the link from the document // Remove the link from the document
document.body.removeChild(link); document.body.removeChild(link);
} }
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
$('.loader').fadeOut(); $('.loader').fadeOut();

View File

@ -18,6 +18,7 @@
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Client List</h4> <h4 class="page-title">Client List</h4>
<div class="page-title-right"> <div class="page-title-right">
<a href="" id="downloadLink" > download Sample file </a>
<input type="file" id="clientFileUpload" style="display: none;" /> <input type="file" id="clientFileUpload" style="display: none;" />
<a id="upload_client_button" class="btn btn-primary waves-effect waves-light" onclick="document.getElementById('clientFileUpload').click();"> <a id="upload_client_button" class="btn btn-primary waves-effect waves-light" onclick="document.getElementById('clientFileUpload').click();">
@ -167,13 +168,21 @@
<script> <script>
$(document).ready(function() {
$('#datatable-buttonss').DataTable({
document.getElementById('downloadLink').addEventListener('click', function(event)
{
event.preventDefault();
const serverUrl = window.location.origin; // Get the server URL
const projectFolder = window.location.pathname.split('/')[1]; // Get the project folder name
const filePath = `/${projectFolder}/public/uploads/client_upload_sample_file.xlsx`; // Construct the path to your file
"ordering": false const fullUrl = serverUrl + filePath; // Construct the full URL
var link = document.createElement('a');
link.href = fullUrl;
link.download = 'client_upload_sample_file.xlsx';
link.click();
}); });
});
function submitBranch(params) { function submitBranch(params) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 KiB