Superadmin fixes : ps

This commit is contained in:
VE10-Sanjeev 2023-12-16 13:29:13 +05:30
parent 15ac28a3bf
commit 7921bdf005
11 changed files with 71 additions and 161 deletions

View File

@ -12,6 +12,7 @@ class Customer extends BaseController
public function index()
{
helper('session');
if (is_session_active()) {
$session_role = get_user_role();
$session_bid = get_business_id();
@ -22,13 +23,11 @@ class Customer extends BaseController
$this->logger->info("Customer: Listing In Super-admin role .");
$where = ['isactive != ' => NULL];
}
$CustomerModel = new CustomerModel();
$CustomerModel = new CustomerModel();
$data['page_name'] = 'Customer Details';
$data['customer'] = $CustomerModel->where($where)->orderBy('customer_id', 'DESC')->findAll();
// print_r($data); die();
$this->render_page('customer_list', $data);
} else {
return redirect()->to('login');

View File

@ -32,6 +32,7 @@ class Home extends BaseController
// return $element['count'] !== '0' ;
// });
$data['book_published'] = $model->book_published_list();
$data['business_id'] = $session_bid;
$this->render_page('dashboard', $data);
}

View File

@ -572,7 +572,7 @@ class Invoice extends BaseController
$mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true;
// Set PDF properties
$mpdf->SetTitle('Invoice');
$mpdf->SetAuthor('VBP');
$mpdf->SetAuthor($data[0]->company_name);
$mpdf->SetCreator('');
// Generate the PDF content (HTML)
@ -613,7 +613,7 @@ class Invoice extends BaseController
];
$mpdf = new Mpdf($config);
$mpdf->SetTitle('Customer Address');
$mpdf->SetAuthor('Your Company Name');
$mpdf->SetAuthor($invoiceData[0]->company_name);
$mpdf->SetCreator('');
// Generate the PDF content (HTML) with customer and address data

View File

@ -25,10 +25,13 @@ class Users extends BaseController
}
$model = new UsersModel();
$model->setTable('users');
$user_details = $model->where($where)->orderBy('user_id', 'DESC')->findAll();
$user_details = $model->select('users.*,business.title as company_name')->where($where)->join('business', 'business.business_id = users.business_id','left')->orderBy('user_id', 'DESC')->findAll();
$this->logger->info("Users: Listing Count .".count($user_details));
$data['page_name'] = 'User Details';
$data['details'] = $user_details;
$data['session_role'] = $session_role;
$this->render_page('user_list', $data);
}
@ -86,6 +89,7 @@ class Users extends BaseController
}
$data['business_details'] = $business_details;
$data['session_bid'] = $session_bid;
$data['session_role'] = $session_role;
$this->render_page($render_page_name, $data);
}

View File

@ -127,8 +127,8 @@ public function updateData($table, $data, $where)
->join('customer_addresses as A','A.customer_id=invoice.customer_id and A.address_type=1','left')
->join('states', 'states.state_short_name = A.state AND A.country = "IN"', 'left')
->join('countries', 'countries.country_short_name = A.country', 'left')
->select('invoice.*,concat(C.first_name," ",C.last_name) as customer_name,A.address_1, A.address_2,A.postal_code,A.city, A.state,C.mobile_no as customer_mobile')
->select('B.title as ,B.business_logo,B.terms,B.address,B.city,B.state,B.postal_code,B.email,B.mobile_no')
->select('invoice.*,DATE_FORMAT(invoice.invoice_date, "%d/%m/%Y") AS formatted_invoice_date,DATE_FORMAT(invoice.due_date, "%d/%m/%Y") AS formatted_due_date ,concat(C.first_name," ",C.last_name) as customer_name,A.address_1, A.address_2,A.postal_code,A.city, A.state,C.mobile_no as customer_mobile')
->select('B.title as company_name,B.business_logo,B.terms as company_terms,B.address as company_address,B.city as company_city,B.state as company_state,B.postal_code as company_postal_code,B.email as company_email,B.mobile_no as company_mobile_no')
->select('COALESCE(NULLIF(states.state_name, ""), A.state) AS customer_bill_state')
->select('concat(A.address_1," ", A.address_2) as customer_bill_address,A.postal_code as customer_bill_postal_code ,A.city as customer_bill_city, countries.country_name as customer_bill_country')
->get()

View File

@ -14,7 +14,7 @@
width: 4in;
/* height: 6in; */
margin: 20px auto;
border: 1px solid #000;
border: 1px solid #fff;
padding:15px;
box-sizing: border-box;
}
@ -49,25 +49,23 @@
foreach ($invoiceData as $value) :
?>
<div class="invoice">
<div class="bill-details">
<?= $value->customer_name ?>
<?= $value->customer_bill_address ?>
<?= $value->customer_bill_city ?>&nbsp;<?= $value->customer_bill_state ?>
<?= $value->customer_bill_postal_code ?>
<?= $value->customer_bill_country ?>
<?= $value->customer_name ?><br>
<?= $value->customer_bill_address." ," ?><br>
<?= $value->customer_bill_city ?>&nbsp;<?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
<?= $value->customer_bill_postal_code ? " - ".$value->customer_bill_postal_code :""; ?>
<?= $value->customer_bill_country." ." ?>
</div>
<div class="header">
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
<div style="float:left; width:80px;margin-right:10px;"><img src="<?= base_url('public/uploads/vijayabharathampdf.png') ?>" alt="Business Logo" class="business-logo"/></div>
<div style="text-align:left;font-size:12px;">From<br/>
<?= $value->address ?>,<br><?= $value->city ?>, <?= $value->state ?>,
<?= $value->postal_code ?>
<div style="float:left; width:80px;margin-right:10px;"><img src="https://vbp.venbait.in/wp-content/uploads/2023/05/1111.png" alt="Business Logo" class="business-logo"/></div>
<div style="text-align:left;font-size:12px;">From<br/>
<?= $value->company_name; ?><br>
<?= $value->company_address; ?><br>
<?= $value->company_city; ?> - <?= $value->company_postal_code; ?>
<?= 'Mobile : '.$value->company_mobile_no; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</body>

View File

@ -1,85 +1,4 @@
<?php if ($loggedin_person_role === 'sadmin') : ?>
<div class="row">
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#1abc9c" data-bgColor="#d1f2eb" value="<?= $customer['percentage']; ?>" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<!-- <div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['active']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'Available ' . $customer['label']; ?></p>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['total']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'Total ' . $customer['label']; ?></p>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">268</span> </h3>
<p class="text-muted mb-0">New Customers</p>
</div> -->
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['today']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'New ' . $customer['label']; ?></p>
</div>
</div>
</div>
</div>
</div><!-- end col -->
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#3bafda" data-bgColor="#d8eff8" value="80" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">8574</span> </h3>
<p class="text-muted mb-0">Online Orders</p>
</div>
</div>
</div>
</div>
</div><!-- end col -->
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#f672a7" data-bgColor="#fde3ed" value="77" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">958.25</span> </h3>
<p class="text-muted mb-0">Revenue</p>
</div>
</div>
</div>
</div>
</div><!-- end col -->
<div class="col-xl-3 col-md-6">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#6c757d" data-bgColor="#e2e3e5" value="35" data-skin="tron" data-angleOffset="0" data-readOnly=true data-thickness=".15" />
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">89.25</span> </h3>
<p class="text-muted mb-1">Daily Average</p>
</div>
</div>
</div>
</div>
</div><!-- end col -->
</div>
<?php endif; ?>
<!-- end row -->
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($business_id == 1 && $loggedin_person_role !== 'manager') : ?>
<!-- <div class="row">
<div class="col-xl-6">
<div class="card bg-info border-info">

View File

@ -145,11 +145,12 @@ td.invoice-number {
</tr>
<tr>
<td>
<p><?= $value->address ?>,<br><?= $value->city ?>, <?= $value->state ?>,</p>
<p><?= $value->postal_code ?></p><br>
<p><?= $value->email ?></p>
<p><?= $value->mobile_no ?></p>
<p><?= $value->company_address ?>,<br>
<?= $value->company_city ?>,
<?= $value->company_state ?>
<?= $value->company_postal_code ? " - ".$value->company_postal_code:"" ?>.</p><br>
<p><?= $value->company_email ?></p>
<p><?= $value->company_mobile_no ?></p>
</td>
</tr>
<?php endforeach; ?>
@ -160,56 +161,30 @@ td.invoice-number {
<?php foreach ($data as $value) : ?>
<tr>
<th>Invoice # <?= $value->invoice_number ?></th>
</tr>
<tr>
<?php
// Assuming $value->invoice_date is in yyyy-mm-dd format
$invoiceDateParts = explode('-', $value->invoice_date);
if (count($invoiceDateParts) === 3) {
$formattedInvoiceDate = $invoiceDateParts[2] . '/' . $invoiceDateParts[1] . '/' . $invoiceDateParts[0];
} else {
$formattedInvoiceDate = 'Invalid Date'; // Handle invalid dates gracefully
}
?>
<th>Invoice Date : <?= $formattedInvoiceDate ?></th>
<!-- Display the formatted invoice date -->
<td></td>
<th>Invoice Date : <?= $value->formatted_invoice_date ?></th>
</tr>
<tr>
<th>Order Number : <?= $value->order_number ?></th>
<th>Order Number : <?= $value->order_number ? $value->order_number : "-" ?></th>
</tr>
<?php if ($value->due_date) : ?>
<tr>
<?php $invoiceDateParts = explode('-', $value->due_date);
if (count($invoiceDateParts) === 3) {
$formattedDueDate = $invoiceDateParts[2] . '/' . $invoiceDateParts[1] . '/' . $invoiceDateParts[0];
} else {
$formattedDueDate = ''; // Handle invalid dates gracefully
}
?>
<th>Due Date : <?= $formattedDueDate ?></th>
<!-- Display the formatted invoice date -->
<th>Due Date : <?= $value->formatted_due_date ?></th>
</tr>
<tr>
<?php if ($invoice_type === '1') : ?>
<?php endif; ?>
<?php if ($invoice_type === '2') : ?>
<?php foreach ($invoiceItems as $item) : ?>
<th>From Subscription : <?= date('d/m/y', strtotime($item->from_subscription)) ?></th>
</tr>
<tr>
<th>To Subscription : <?= date('d/m/y', strtotime($item->to_subscription)) ?></th>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
<tr>
<th>From Subscription : <?= date('d/m/y', strtotime($item->from_subscription)) ?></th>
</tr>
<tr>
<th>To Subscription : <?= date('d/m/y', strtotime($item->to_subscription)) ?></th>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</td>
</tr>

View File

@ -124,25 +124,31 @@
<span> Dashboard </span>
</a>
</li>
<?php if ($loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."customer_list"; ?>">
<i class="ri-map-pin-user-fill"></i>
<span> Customer </span>
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."invoice_list"; ?>">
<i class="fe-file-text"></i>
<span> Invoices </span>
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."subscribers_list"; ?>">
<i class="ri-shield-user-line"></i>
<span>Membership </span>
</a>
</li>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."scheme_list"; ?>">
<i class="ri-currency-line"></i>
@ -150,7 +156,7 @@
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($loggedin_person_role !== 'manager'&& $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."book_list"; ?>">
<i class="ri-book-open-line"></i>
@ -173,8 +179,14 @@
<span> Site Setting </span>
</a>
</li>
<li>
<a href="<?= base_url()."business_list"; ?>">
<i class="ri-briefcase-4-fill"></i>
<span> Business </span>
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."event_list"; ?>">
@ -183,7 +195,7 @@
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin' ) : ?>
<li>
<a href="<?= base_url()."invoice_number_format/1"; ?>">
<i class="fe-check-square"></i>
@ -191,7 +203,7 @@
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="<?= base_url()."customer_group"; ?>">
<i class="ri-team-line"></i>
@ -200,7 +212,7 @@
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="#reportLayouts" data-toggle="collapse">
<i class="ri-file-chart-fill"></i>
@ -223,7 +235,7 @@
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<li>
<a href="#notificationsLayouts" data-toggle="collapse">
<i class="ri-notification-3-line"></i>

View File

@ -74,7 +74,7 @@
<i class="ri-account-circle-line"></i>
<span>My Account</span>
</a>
<?php if ($loggedin_person_role !== 'manager') : ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<a href="<?= base_url()."new_bussiness/".$bid; ?>"class="dropdown-item notify-item">
<i class="ri-briefcase-4-fill"></i><span> Business Setting </span>
</a>

View File

@ -36,6 +36,7 @@
<th>Email</th>
<th>Mobile Number</th>
<th>Role</th>
<?php if($session_role === 'sadmin'){ ?> <th>Company</th> <?php } ?>
<th>Status</th>
<th>Action</th>
</tr>
@ -66,6 +67,7 @@
<td><?php echo $row['email'] ; ?></td>
<td><?php echo $row['mobile_no'] ; ?></td>
<td><?php echo $row['role'] ; ?></td>
<?php if($session_role === 'sadmin'){ ?> <td><?php echo $row['company_name'] ; ?></td> <?php } ?>
<td>
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
</td>