CHANGE_STAFF_FORM_CLIENT_BRANCH_GSTUNIQUE : AADHAVAN

This commit is contained in:
unknown 2024-06-15 12:01:23 +05:30
commit 704a4ae7d4
17 changed files with 531 additions and 80 deletions

View File

@ -39,6 +39,7 @@ use CodeIgniter\Router\RouteCollection;
$routes->post('doc_rejection','ClientController::doc_rejection');
$routes->match(['get','post'],'/client_branch_list','ClientController::client_branch_list');
$routes->post('add_client_branch','ClientController::add_client_branch');
$routes->post('edit_client_branch','ClientController::edit_client_branch');
$routes->get('get_client_branch/(:any)','ClientController::get_client_branch/$1');
$routes->post('status_client_branch','ClientController::status_client_branch');
$routes->post('client_upload','ClientController::client_upload');
@ -70,6 +71,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');

View File

@ -305,13 +305,32 @@ class ClientController extends BaseController
public function add_client_branch()
{
$data = $this->request->getPost();
$gst = $this->request->getPost('gst_no');
$client_branch = $this->ClientBranchModel->where('gst_no', $gst)->first();
if($client_branch){
return json_encode(false);
}else{
$data = $this->request->getPost();
$this->ClientBranchModel->insert($data);
return;
$this->ClientBranchModel->insert($data);
return json_encode(true);
}
}
public function edit_client_branch()
{
$id = $this->request->getPost('id');
$data = $this->request->getPost();
$this->ClientBranchModel->update($id, $data);
return json_encode('update');
}
public function get_client_branch($branch_id)
{
if ($branch_id) {

View File

@ -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()
{

View File

@ -37,10 +37,10 @@ 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 ,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');
$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','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();

View File

@ -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();

View File

@ -38,7 +38,7 @@
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Postal Code</th>
<th>PIN Code</th>
<th>Contact</th>
<th>Status</th>
<th>Action</th>
@ -56,7 +56,7 @@
<td><?= $value['address']; ?></td>
<td><?= $value['city']; ?></td>
<td><?= $value['state']; ?></td>
<td><?= $value['postal_code']; ?></td>
<td><?= $value['pin_code']; ?></td>
<td><?= $value['contact']; ?></td>
<td>
<?php if ($value['isactive'] == 0): ?>
@ -182,7 +182,7 @@
<div class="col-md-6">
<div class="form-group">
<label for="pincode">Pin Code</label>
<input class="form-control" name="postal_code" type="text" id="postal_code" required="" placeholder="Postal Code">
<input class="form-control" name="pin_code" type="text" id="pin_code" required="" placeholder="PIN Code">
</div>
</div>
</div>
@ -228,7 +228,7 @@
address: $('#address').val(),
city: $('#city').val(),
state: $('#state').val(),
postal_code: $('#postal_code').val(),
pin_code: $('#pin_code').val(),
mobile_no: $('#mobile_no').val()
};
@ -280,7 +280,7 @@
$('#address').val(response.address);
$('#branch_id').val(response.branch_id);
$('#city').val(response.city);
$('#postal_code').val(response.postal_code);
$('#pin_code').val(response.pin_code);
$('#state').val(response.state);
$('#country').val(response.country);
$('#state_code').val(response.state_code);

View File

@ -114,7 +114,7 @@
<div class="col-md-6">
<div class="form-group">
<label for="pincode">Pin Code</label>
<input class="form-control" name="postal_code" type="text" id="postal_code" value="<?php echo $branch['postal_code']; ?>" required="" placeholder="Postal Code">
<input class="form-control" name="pin_code" type="text" id="pin_code" value="<?php echo $branch['pin_code']; ?>" required="" placeholder="Pin Code">
</div>
</div>
<div class="col-md-6">

View File

@ -13,7 +13,7 @@
<h4 class="page-title">Client Branch List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="#" id="add_branch_model_open" data-toggle="modal" data-target="#bike_make_login-modal" class="btn btn-primary waves-effect">
<li class=""> <a href="#" id="add_branch_model_open" data-toggle="modal" data-target="#client_branch_modal" class="btn btn-primary waves-effect">
Add Branch
</a>
</ol>
@ -39,7 +39,7 @@
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Postal Code</th>
<th>Pin Code</th>
<th>Mobile No</th>
<th>Active</th>
<th>Action</th>
@ -67,7 +67,7 @@
<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 data-toggle="modal" data-target="#bike_make_login-modal" value="<?= $value['id']; ?>" onclick="editBranch(this)" class="edit-button dropdown-item"><i
<a data-toggle="modal" data-target="#client_branch_modal" value="<?= $value['id']; ?>" onclick="editBranch(this)" class="edit-button dropdown-item"><i
class="ri-pencil-line" style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
<?php if($value['is_active'] == 1): ?>
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="fas fa-building"></i><i class="fa fa-times" style="font-size: x-small;margin-right:10px"></i>Deactivate</a>
@ -94,7 +94,7 @@
</div> <!-- content -->
<div id="bike_make_login-modal" aria-hidden="true" aria-modal="true" data-backdrop="static" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div id="client_branch_modal" aria-hidden="true" aria-modal="true" data-backdrop="static" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
@ -105,14 +105,13 @@
</div>
<form id="model_form_data" class="px-4">
<input type="text" id="business_id" value="" hidden>
<input type="text" id="branch_id" hidden>
<input type="text" id="id" hidden>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="client">Client</label>
<select name="client" id="client" class="form-control" style="width: auto;">
<select name="client" id="client" class="form-control select2" style="width: auto;" required="true">
<option value="0">Select Client</option>
<?php foreach ($client_list as $key => $value) { ?>
<option value="<?php echo $value['client_id']; ?>"><?php echo $value['name']; ?></option>
@ -174,15 +173,15 @@
</div>
<div class="col-md-6">
<div class="form-group">
<label for="pincode">Pin Code</label>
<input class="form-control" name="postal_code" type="text" id="postal_code" required="" placeholder="Postal Code">
<label for="postalcode">Pin Code</label>
<input class="form-control" name="pin_code" type="text" id="pin_code" required="" placeholder="Pin Code">
</div>
</div>
</div>
<div class="form-group text-right">
<button class="btn btn-info waves-effect waves-light" type="submit" onclick="submitBranch(this)">Submit</button>
<button class="btn btn-info waves-effect waves-light" type="submit" onclick="submitBranch(event,this)">Submit</button>
</div>
</form>
@ -195,7 +194,7 @@
<script>
$(document).ready(function() {
$('#client').select2();
$('.select2').select2();
});
function statusChange(params) {
@ -235,14 +234,15 @@
$('#branch_type').html('Create Branch');
})
function submitBranch(params) {
function submitBranch(event,params) {
event.preventDefault();
if ($('#branch_id').val()) {
var url = '<?= base_url("edit_client_branch/"); ?>'+$('#branch_id').val();
}else{
var url = '<?= base_url("add_client_branch"); ?>';
console.log($('#client').val());
if ($('#client').val() == 0) {
toastr.warning('Select Client');
return;
}
var formData = {
client_id: $('#client').val(),
gst_no: $('#gst_no').val(),
@ -254,12 +254,19 @@
address: $('#address').val(),
city: $('#city').val(),
state: $('#state').val(),
postal_code: $('#postal_code').val(),
pin_code: $('#pin_code').val(),
mobile_no: $('#mobile_no').val()
};
if ($('#id').val()) {
var url = '<?= base_url("edit_client_branch"); ?>';
formData['id'] = $('#id').val();
}else{
var url = '<?= base_url("add_client_branch"); ?>';
}
var form = $(params).parent().parent();
// console.log(form);
var isValid = true;
form[0].querySelectorAll('[required]').forEach(function(element) {
if (!element.value.trim()) {
@ -270,7 +277,6 @@
if (!isValid) {
return;
}
var business_id = $('#business_id').val();
$.ajax({
type: 'POST',
@ -279,9 +285,19 @@
dataType: 'json',
success: function(response) {
console.log(response);
$('#bike_model_login-modal').modal('hide');
window.location.reload();
if(response == true){
toastr.success('Branch Added Successfully');
$('#client_branch_modal').modal('hide');
window.location.reload();
}else if(response == 'update'){
toastr.success('Branch Updated Successfully');
$('#client_branch_modal').modal('hide');
window.location.reload();
}else{
toastr.warning('GST Number Already Exists');
event.preventDefault();
}
},
error: function(xhr, status, error) {
// Handle error response here
@ -299,18 +315,17 @@
dataType: 'json',
success: function(response) {
console.log(response);
$('#client').val(response.client_id);
$('#client').val(response.client_id).trigger('change');
$('#branch_name').val(response.name);
$('#gst_no').val(response.gst_no);
$('#email').val(response.email);
$('#mobile_no').val(response.mobile_no);
$('#address').val(response.address);
$('#branch_id').val(response.branch_id);
$('#id').val(response.id);
$('#city').val(response.city);
$('#postal_code').val(response.pin_code);
$('#pin_code').val(response.pin_code);
$('#state').val(response.state);
$('#country').val(response.country);
$('#state_code').val(response.state_code);
},
error: function(xhr, status, error) {

View File

@ -326,11 +326,13 @@
<script>
document.addEventListener("DOMContentLoaded", function() {
document.querySelector(".download-btnn").addEventListener("click", async function() {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var element = document.querySelector(".card-body");
// Get the HTML content of the element as a string
var htmlContent = element.innerHTML;
$.ajax({
url: '<?php echo base_url()."download_doc"?>',
method: 'POST',
@ -353,7 +355,7 @@
// Create a link element
var link = document.createElement('a');
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
document.body.appendChild(link);
@ -362,6 +364,8 @@
// Remove the link from the document
document.body.removeChild(link);
}
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
},
error: function(xhr, status, error) {
$('.loader').fadeOut();

View File

@ -18,6 +18,7 @@
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Client List</h4>
<div class="page-title-right">
<a href="" id="downloadLink" > download Sample file </a>
<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();">
@ -167,13 +168,21 @@
<script>
$(document).ready(function() {
$('#datatable-buttonss').DataTable({
"ordering": false
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
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) {

View 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">&times;</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">&times;</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>

View File

@ -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>

View File

@ -37,7 +37,7 @@
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Personal Info</h5>
<form method="post"
<form method="post" id="staff_form"
<?php if(isset($staffData)){ ?> action="<?= base_url()."staff_edit"; ?>"
<?php } else { ?> action="<?= base_url()."staff_create"; ?>" <?php } ?>
class="parsley-examples">
@ -52,7 +52,7 @@
<div class="form-group col-md-4">
<label for="business">Business<span class="text-danger">*</span></label>
<select class="form-control slect2-dropdown" id="business_id" name="business_id" parsley-trigger="change" required >
<option >Select Business</option>
<option value="0">Select Business</option>
<?php foreach ($business as $key => $value) { ?>
<option value="<?php echo $value['business_id']; ?>" <?php if(isset($staffData)){ echo ($staffData->business_id == $value['business_id']) ? 'selected' : '';} ?>>
<?php echo $value['business_name']; ?>
@ -63,7 +63,7 @@
<div class="form-group col-md-4">
<label for="branch">Branch<span class="text-danger">*</span></label>
<select class="form-control slect2-dropdown" id="branch_id" name="branch_id" parsley-trigger="change" required >
<option >Select Branch</option>
<option value="0">Select Branch</option>
<?php if(isset($staffData)){ foreach ($branch as $key => $value) { ?>
<option value="<?php echo $value['branch_id']; ?>" <?php echo ($staffData->branch_id == $value['branch_id']) ? 'selected' : ''; ?>>
<?php echo $value['branch_name']; ?>
@ -115,16 +115,8 @@
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1" type="submit">
<button class="btn btn-primary waves-effect waves-light mr-1" id="staff_data_form_submit" type="submit">
Submit
</button>
@ -178,10 +170,25 @@
</div> <!-- container -->
</div> <!-- 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>
$('#staff_data_form_submit').click(function (event) {
event.preventDefault();
if($('#business_id').val() == 0){
toastr.warning('Select Business');
return;
}
if($('#branch_id').val() == 0){
console.log("branch");
toastr.warning('Select Branch');
return;
}
$('#staff_form').submit();
})
$(document).ready(function() {
$('.slect2-dropdown').select2();
@ -200,6 +207,7 @@
$('#branch_id option:not(:first)').remove();
$('#branch_id').append($('<option>', {
value: 0,
text: "Select Branch"
}));
$.each(filteredBranches, function(index, item) {

View File

@ -28,8 +28,8 @@
<!-- start page title -->
<div class="row">
<div class="col-lg-1"></div>
<div class="col-10">
<div class="col-lg-2"></div>
<div class="col-8">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> <?php if(isset($templateData)){ echo 'Edit'; }else{ echo 'Create'; } ?> Template</h4>
<div class="page-title-right">
@ -42,14 +42,14 @@
</div>
</div>
</div>
<div class="col-lg-1"></div>
<div class="col-lg-2"></div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-10">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="card">
<div class="card-body">
@ -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>
@ -114,7 +116,7 @@
</div>
</div> <!-- end card -->
</div>
<div class="col-lg-1"></div>
<div class="col-lg-2"></div>
<!-- end col -->
</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(),

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 KiB