tracker issue
This commit is contained in:
parent
ee7ff31b95
commit
85e541f6ad
@ -124,7 +124,7 @@ class Customer extends BaseController
|
||||
}
|
||||
} else {
|
||||
// It's an update operation
|
||||
if ($session_role !== 'manager') {
|
||||
if ($session_role !== 'volunteer') {
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ class Invoice extends BaseController
|
||||
}
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($data['invoice_number_formatting']);die;
|
||||
print_r($data['receipt_details']);
|
||||
$this->render_page('invoice_form', $data);
|
||||
}
|
||||
|
||||
|
||||
@ -83,13 +83,13 @@ class Users extends BaseController
|
||||
// print_r($branches);die;
|
||||
break;
|
||||
|
||||
case "manager":
|
||||
case "volunteer":
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
if ($session_uid === $id && $session_role === "manager") {
|
||||
if ($session_uid === $id && $session_role === "volunteer") {
|
||||
$data['page_name'] = 'Edit User';
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
print_r($branches);die;
|
||||
|
||||
$render_page_name = 'user_form';
|
||||
|
||||
} else {
|
||||
|
||||
@ -42,9 +42,10 @@
|
||||
<input type="text" class="form-control" id="org_name_field" name="org_name" value="<?= isset($customer['org_name']) ? $customer['org_name'] : '' ?>" placeholder="Organization Name"/>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4" id="org_name">
|
||||
<label for="csname" class="col-form-label">Organization Reg Details<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="org_reg_details" name="org_reg_Details" value="<?= isset($customer['org_reg_Details']) ? $customer['org_reg_Details'] : '' ?>" placeholder="Organization Reg details"/>
|
||||
<input type="text" class="form-control" id="org_reg_details" name="org_reg_Details" value="<?= isset($customer['org_reg_details']) ? $customer['org_reg_details'] : '' ?>" placeholder="Organization Reg details"/>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ $(document).ready(function(){
|
||||
|
||||
if(DonorType === 'option2'){
|
||||
$('#org_details_form').show();
|
||||
$('#org_name_field').prop('required', true);
|
||||
$('#org_name_fie').prop('required', true);
|
||||
$('#pan_no_org').prop('required', true);
|
||||
$('#org_reg_details').prop('required', true);
|
||||
$('#pan_no').prop('required', false);
|
||||
@ -279,7 +279,7 @@ $(document).ready(function(){
|
||||
}
|
||||
else{
|
||||
$('#org_details_form').hide();
|
||||
$('#org_name_field').prop('required', false);
|
||||
$('#org_name_fie').prop('required', false);
|
||||
$('#pan_no_org').prop('required', false);
|
||||
$('#org_reg_details').prop('required', false);
|
||||
$('#pan_no').prop('required', true);
|
||||
@ -321,7 +321,7 @@ $(document).ready(function(){
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="csname" class="col-form-label">Organization Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="org_name_field" name="org_name" value="" placeholder="Organization Name" required>
|
||||
<input type="text" class="form-control" id="org_name_fie" name="org_name" value="" placeholder="Organization Name" >
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
@ -329,7 +329,7 @@ $(document).ready(function(){
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="csname" class="col-form-label"><span class="contactPerson">Organization PAN Number<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="pan_no_org" name="pan_no" value="" placeholder="PAN Number" />
|
||||
<input type="text" class="form-control" id="pan_no_org" name="o_pan_no" value="" placeholder="PAN Number" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
@ -374,7 +374,7 @@ $(document).ready(function(){
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">+91</div>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="cmobile" value="<?= isset($receipt_details['mobile_no']) ? $receipt_details['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required maxlength="10" onkeypress="return restriction(event)" />
|
||||
<input type="text" class="form-control" name="mobile" value="<?= isset($receipt_details['mobile_no']) ? $receipt_details['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required maxlength="10" onkeypress="return restriction(event)" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -124,7 +124,19 @@
|
||||
<span> Dashboard </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."receipt_list"; ?>">
|
||||
<i class="fe-file-text"></i>
|
||||
<span> Receipts </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."Donor_list"; ?>">
|
||||
<i class="ri-map-pin-user-fill"></i>
|
||||
<span> Donors </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."audit_history"; ?>">
|
||||
<i class="ri-history-fill"></i>
|
||||
@ -132,23 +144,9 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."Donor_list"; ?>">
|
||||
<i class="ri-map-pin-user-fill"></i>
|
||||
<span> Donors </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."receipt_list"; ?>">
|
||||
<i class="fe-file-text"></i>
|
||||
<span> Receipts </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
|
||||
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."donations_accepted"; ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
@ -156,7 +154,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."causes_list"; ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
@ -172,7 +170,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."user_list"; ?>">
|
||||
<i class="ri-user-line"></i>
|
||||
@ -196,7 +194,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."campaign_list"; ?>">
|
||||
|
||||
@ -205,7 +203,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<!-- <li>
|
||||
<a href="<?= base_url()."invoice_number_format/1"; ?>">
|
||||
<i class="fe-check-square"></i>
|
||||
@ -214,7 +212,7 @@
|
||||
</li> -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<!-- <li>
|
||||
<a href="#reportLayouts" data-toggle="collapse">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
@ -237,7 +235,7 @@
|
||||
</li> -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="#notificationsLayouts" data-toggle="collapse">
|
||||
<i class="ri-notification-3-line"></i>
|
||||
@ -246,7 +244,7 @@
|
||||
</a>
|
||||
<div class="collapse" id="notificationsLayouts">
|
||||
<ul class="nav-second-level">
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."donor_group"; ?>">
|
||||
<i class="ri-team-line"></i>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<select id="role" name="role" class="form-control" required>
|
||||
<option value="">Select Role</option>
|
||||
<option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option>
|
||||
<option value="manager" <?= isset($details['role']) && $details['role'] === 'manager' ? 'selected' : '' ?>>Manager</option>
|
||||
<option value="volunteer" <?= isset($details['role']) && $details['role'] === 'volunteer' ? 'selected' : '' ?>>Volunteer</option>
|
||||
<option value="accounts" <?= isset($details['role']) && $details['role'] === 'accounts' ? 'selected' : '' ?>>Accounts Staff</option>
|
||||
<option value="auditor" <?= isset($details['role']) && $details['role'] === 'auditor' ? 'selected' : '' ?>>Auditor</option>
|
||||
</select>
|
||||
@ -94,20 +94,20 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="branch" class="col-form-label">Branch<span class="text-danger"></span></label>
|
||||
<select id="branch" name="branch" class="form-control">
|
||||
<option value="">Select Branch</option>
|
||||
<?php
|
||||
// Check if branches are available
|
||||
if (!empty($branches)) {
|
||||
foreach ($branches as $branch) {
|
||||
?>
|
||||
<option data-business-id="<?= $branch['business_id']; ?>" value="<?= $branch['id']; ?>" <?= isset($details['branch_id']) && ($details['branch_id'] == $branch['id']) ? 'selected' : '' ?>>
|
||||
<?= $branch['branch_name']; ?>
|
||||
</option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<option value="">Select Branch</option>
|
||||
<?php
|
||||
// Check if branches are available
|
||||
if (!empty($branches)) {
|
||||
foreach ($branches as $branch) {
|
||||
?>
|
||||
<option data-business-id="<?= $branch['business_id']; ?>" value="<?= $branch['id']; ?>" <?= isset($details['branch_id']) && ($details['branch_id'] == $branch['id']) ? 'selected' : '' ?>>
|
||||
<?= $branch['branch_name']; ?>
|
||||
</option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($details['profile_picture'])) { ?>
|
||||
@ -124,7 +124,7 @@
|
||||
<?php } ?>
|
||||
</div>
|
||||
<input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id" value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" />
|
||||
<?php if (!empty($details) && $loggedin_person_role !== 'manager') { ?>
|
||||
<?php if (!empty($details) && $loggedin_person_role !== 'volunteer') { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($details) && $details['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
@ -138,7 +138,7 @@
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">
|
||||
Reset
|
||||
</button>
|
||||
<?php if ($loggedin_person_role !== 'manager') : ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer') : ?>
|
||||
<a href="<?= base_url() . "user_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -226,96 +226,65 @@
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Function to fetch branches based on selected organization
|
||||
function fetchBranches(selectedBusinessId) {
|
||||
var businessBranchDropdown = $('#branch_id');
|
||||
|
||||
// Clear existing options
|
||||
businessBranchDropdown.empty().append('<option value="">Choose Organization Branch</option>');
|
||||
|
||||
// Fetch branches via AJAX
|
||||
$.ajax({
|
||||
url: '<?= base_url('users/get_branches') ?>/' + selectedBusinessId,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
console.log('Response from server:', response); // Log the response for debugging
|
||||
|
||||
if (response && response.length > 0) {
|
||||
console.log('Number of branches:', response.length); // Log the number of branches
|
||||
|
||||
$.each(response, function (index, branch) {
|
||||
console.log('Appending option:', branch); // Log each branch before appending
|
||||
|
||||
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
|
||||
businessBranchDropdown.append(option);
|
||||
});
|
||||
} else {
|
||||
console.log('No branches available.'); // Log if no branches are available
|
||||
businessBranchDropdown.append('<option value="">No branches available</option>');
|
||||
$(document).ready(function () {
|
||||
// Function to fetch branches based on selected organization
|
||||
function fetchBranches(selectedBusinessId, preSelectedBranchId) {
|
||||
var businessBranchDropdown = $('#branch_id');
|
||||
|
||||
// Clear existing options
|
||||
businessBranchDropdown.empty().append('<option value="">Choose Organization Branch</option>');
|
||||
|
||||
// Fetch branches via AJAX
|
||||
$.ajax({
|
||||
url: '<?= base_url('users/get_branches') ?>/' + selectedBusinessId,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
console.log('Response from server:', response); // Log the response for debugging
|
||||
|
||||
if (response && response.length > 0) {
|
||||
console.log('Number of branches:', response.length); // Log the number of branches
|
||||
|
||||
$.each(response, function (index, branch) {
|
||||
console.log('Appending option:', branch); // Log each branch before appending
|
||||
|
||||
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
|
||||
|
||||
// Set selected attribute if the branch ID matches the pre-selected branch ID
|
||||
if (branch.id == preSelectedBranchId) {
|
||||
option.attr('selected', 'selected');
|
||||
}
|
||||
|
||||
businessBranchDropdown.append(option);
|
||||
});
|
||||
} else {
|
||||
console.log('No branches available.'); // Log if no branches are available
|
||||
businessBranchDropdown.append('<option value="">No branches available</option>');
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.error('Error fetching branches:', error);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.error('Error fetching branches:', error);
|
||||
});
|
||||
}
|
||||
|
||||
// Change event handler for the organization dropdown
|
||||
$('#business_id').change(function () {
|
||||
var selectedBusinessId = $(this).val();
|
||||
console.log('Selected Business ID:', selectedBusinessId); // Log the selected business ID
|
||||
|
||||
// Call the function to fetch branches
|
||||
if (selectedBusinessId) {
|
||||
fetchBranches(selectedBusinessId, <?= json_encode($details['branch_id'] ?? null) ?>);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Change event handler for the organization dropdown
|
||||
$('#business_id').change(function () {
|
||||
var selectedBusinessId = $(this).val();
|
||||
console.log('Selected Business ID:', selectedBusinessId); // Log the selected business ID
|
||||
|
||||
// Call the function to fetch branches
|
||||
if (selectedBusinessId) {
|
||||
fetchBranches(selectedBusinessId);
|
||||
|
||||
// Trigger the change event if the organization is pre-selected (e.g., during edit)
|
||||
var preSelectedBusinessId = $('#business_id').val();
|
||||
if (preSelectedBusinessId) {
|
||||
fetchBranches(preSelectedBusinessId, <?= json_encode($details['branch_id'] ?? null) ?>);
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger the change event if the organization is pre-selected (e.g., during edit)
|
||||
var preSelectedBusinessId = $('#business_id').val();
|
||||
if (preSelectedBusinessId) {
|
||||
fetchBranches(preSelectedBusinessId);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
// JavaScript to show/hide branches based on selected business
|
||||
$(document).ready(function () {
|
||||
var branchDropdown = $('#branch');
|
||||
var branches = <?= json_encode($branches); ?>; // Assuming $branches is available
|
||||
|
||||
// Initial branches
|
||||
var initialBranches = branches.filter(branch => branch.business_id == '<?= $session_bid ?? '' ?>');
|
||||
|
||||
// Populate the dropdown with initial branches
|
||||
populateBranchDropdown(initialBranches);
|
||||
|
||||
// Change event handler for the business dropdown
|
||||
$('#business_id').change(function () {
|
||||
var selectedBusinessId = $(this).val();
|
||||
|
||||
// Filter branches based on selected business
|
||||
var filteredBranches = branches.filter(branch => branch.business_id == selectedBusinessId);
|
||||
|
||||
// Populate the dropdown with filtered branches
|
||||
populateBranchDropdown(filteredBranches);
|
||||
});
|
||||
|
||||
// Function to populate the branch dropdown
|
||||
function populateBranchDropdown(branchesToDisplay) {
|
||||
branchDropdown.empty().append('<option value="">Select Branch</option>');
|
||||
|
||||
if (branchesToDisplay.length > 0) {
|
||||
branchesToDisplay.forEach(branch => {
|
||||
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
|
||||
branchDropdown.append(option);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!-- <script>
|
||||
// JavaScript to show/hide branches based on selected business
|
||||
|
||||
Loading…
Reference in New Issue
Block a user