product-client-sales
This commit is contained in:
parent
6eff5a0157
commit
236505cbf9
@ -48,6 +48,7 @@ $routes->get("new_sale/(:any)", "Sales::new_sale/$1");
|
||||
$routes->get("delete_sale/(:any)", "Sales::delete_sale/$1");
|
||||
$routes->post("delete_sales_product", "Sales::delete_sales_product");
|
||||
$routes->get("download_invoice/(:any)", "Sales::download_invoice/$1");
|
||||
$routes->post("save_client", "Sales::save_client");
|
||||
//end salle order//
|
||||
|
||||
//Client//
|
||||
@ -56,6 +57,12 @@ $routes->post("add_client", "Client::add_client");
|
||||
$routes->get("new_client/(:any)", "Client::new_client/$1");
|
||||
$routes->get("delete_client/(:any)", "Client::delete_client/$1");
|
||||
//end clent
|
||||
//Vendor//
|
||||
$routes->get('vendor_index/', 'Vendor::vendor_index');
|
||||
$routes->post("add_vendor", "Vendor::add_vendor");
|
||||
$routes->get("new_vendor/(:any)", "Vendor::new_vendor/$1");
|
||||
$routes->get("delete_vendor/(:any)", "Vendor::delete_vendor/$1");
|
||||
//end Vendor
|
||||
|
||||
//Vehicle//
|
||||
$routes->get('vehicle_index/', 'Vehicle::vehicle_index');
|
||||
|
||||
@ -65,7 +65,7 @@ class Client extends BaseController
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state'),
|
||||
'postal_code' => $this->request->getPost('postalcode'),
|
||||
'country' => $this->request->getPost('country'),
|
||||
|
||||
'isactive' => 1 ,
|
||||
'branch_id' => $this->session->get('logged_user_branch_id')
|
||||
];
|
||||
|
||||
@ -84,7 +84,7 @@ $data['product']=$product;
|
||||
'mobile_no' => $this->request->getPost('mobile_no'),
|
||||
'billing_state' => $this->request->getPost('state'),
|
||||
'billing_postal_code' => $this->request->getPost('postalcode'),
|
||||
'billing_country' => $this->request->getPost('country'),
|
||||
// 'billing_country' => $this->request->getPost('country'),
|
||||
'terms_condition' => $this->request->getPost('terms_condition'),
|
||||
'subtotal' => $this->request->getPost('sub_total'),
|
||||
'tax' => $this->request->getPost('invoice_tax'),
|
||||
@ -273,12 +273,46 @@ public function delete_sales_product()
|
||||
|
||||
// Generate the PDF content (HTML) with data
|
||||
$html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]);
|
||||
// echo $html;die;
|
||||
// echo $html;die;
|
||||
// Load HTML into the mPDF instance
|
||||
$mpdf->WriteHTML($html);
|
||||
|
||||
// Output the PDF to the browser for download
|
||||
$mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
}
|
||||
public function save_client(){
|
||||
// Load ClientModel
|
||||
$ClientModel = new ClientModel();
|
||||
|
||||
// Validate inputs
|
||||
$validationRules = [
|
||||
'client_name' => 'required|max_length[100]',
|
||||
'mobile_no' => 'required' // Assuming mobile number is 10 digits long
|
||||
];
|
||||
|
||||
if (!$this->validate($validationRules)) {
|
||||
// If validation fails, return validation errors
|
||||
return $this->response->setJSON(['success' => false, 'errors' => $this->validator->getErrors()]);
|
||||
}
|
||||
|
||||
// If validation passes, proceed to save the client
|
||||
$data = [
|
||||
'client_name' => $this->request->getPost('client_name'),
|
||||
'mobile_no' => $this->request->getPost('mobile_no'),
|
||||
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
||||
'city'=>'Chennai',
|
||||
'state'=>'Tamil Nadu',
|
||||
'isactive' => 1
|
||||
];
|
||||
|
||||
// Attempt to insert the client data
|
||||
if ($ClientModel->insert($data)) {
|
||||
// If insertion succeeds, return success response
|
||||
return $this->response->setJSON(['success' => true, 'message' => 'Client saved successfully.']);
|
||||
} else {
|
||||
// If insertion fails, return error response
|
||||
return $this->response->setJSON(['success' => false, 'message' => 'Failed to save client.']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
109
app/Controllers/Vendor.php
Normal file
109
app/Controllers/Vendor.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\VendorModel;
|
||||
|
||||
use App\Models\UsersModel;
|
||||
|
||||
|
||||
class Vendor extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->UsersModel = new UsersModel();
|
||||
}
|
||||
|
||||
public function vendor_index()
|
||||
{
|
||||
// print_r("hi");die;
|
||||
$VendorModel = new VendorModel();
|
||||
$vendor = $VendorModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
||||
$data['vendor']=$vendor;
|
||||
|
||||
return view('vendor_list',$data);
|
||||
}
|
||||
|
||||
|
||||
public function new_vendor($vendor_id)
|
||||
{
|
||||
|
||||
|
||||
if ($vendor_id === '0') {
|
||||
|
||||
$data['vendor'] = [];
|
||||
$data['page_name']="Add Vendor";
|
||||
} else if ($vendor_id !== '0') {
|
||||
$data['page_name']="Edit Vendor";
|
||||
$VendorModel = new VendorModel();
|
||||
|
||||
$vendor=$VendorModel->where('vendor_id', $vendor_id)->get()->getRowArray();
|
||||
|
||||
$data['vendor']=$vendor;
|
||||
}
|
||||
$data['vendor_id'] = $vendor_id;
|
||||
|
||||
return view('vendor_form',$data);
|
||||
}
|
||||
|
||||
|
||||
public function add_vendor()
|
||||
{
|
||||
|
||||
$VendorModel = new VendorModel();
|
||||
|
||||
|
||||
$data = [
|
||||
'vendor_name' => $this->request->getPost('vendor_name'),
|
||||
'vendor_email' => $this->request->getPost('email'),
|
||||
'address' => $this->request->getPost('address'),
|
||||
'vendor_mobile' => $this->request->getPost('mobile'),
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state'),
|
||||
'postal_code' => $this->request->getPost('postalcode'),
|
||||
'country' => $this->request->getPost('country'),
|
||||
'category' => $this->request->getPost('category'),
|
||||
'website' => $this->request->getPost('website'),
|
||||
'isactive' => 1 ,
|
||||
'branch_id' => $this->session->get('logged_user_branch_id')
|
||||
];
|
||||
// print_r($data);die;
|
||||
|
||||
$vendor_id = $this->request->getPost('vendor_id');
|
||||
|
||||
|
||||
if (!empty($vendor_id)) {
|
||||
|
||||
$VendorModel->update($vendor_id, $data);
|
||||
} else {
|
||||
|
||||
$VendorModel->insert($data);
|
||||
}
|
||||
|
||||
|
||||
return redirect()->to('vendor_index');
|
||||
}
|
||||
public function delete_vendor($vendor_id)
|
||||
{
|
||||
$model = new VendorModel();
|
||||
$where = ['vendor_id' => $vendor_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database
|
||||
$existingBusiness = $model->where($where)->first();
|
||||
|
||||
if ($existingBusiness) {
|
||||
$data['isactive'] = 0;
|
||||
|
||||
if ($model->update($vendor_id, $data)) {
|
||||
session()->setFlashdata('success', 'Deleted successfully.');
|
||||
$this->logger->info("Users: has been Inactivated successfully. Inactivated ID = ".$vendor_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return redirect()->to('vendor_index');
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,7 +5,7 @@ class VendorModel extends Model
|
||||
{
|
||||
protected $table = 'vendor';
|
||||
protected $primaryKey = 'vendor_id';
|
||||
protected $allowedFields = ['vendor_id','vendor_name','vendor_email','vendor_mobile','website','gl_account','category','address','state','posta_code','city','country','description','isactive'];
|
||||
protected $allowedFields = ['vendor_id','branch_id','vendor_name','vendor_email','vendor_mobile','website','gl_account','category','address','state','posta_code','city','country','description','isactive'];
|
||||
|
||||
|
||||
}
|
||||
@ -47,17 +47,14 @@
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">City</label>
|
||||
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($client['city']) ? $client['city'] : '' ?>" >
|
||||
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($client['city']) ? $client['city'] : 'Chennai' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">State</label>
|
||||
<input type="text" class="form-control" name="state" placeholder="State"value="<?= isset($client['state']) ? $client['state'] : '' ?>" >
|
||||
<input type="text" class="form-control" name="state" placeholder="State"value="<?= isset($client['state']) ? $client['state'] : 'Tamil Nadu' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Country</label>
|
||||
<input type="text" class="form-control" name="country" placeholder="Country"value="<?= isset($client['country']) ? $client['country'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Pin Code</label>
|
||||
<input type="text" class="form-control" name="postalcode" placeholder="Pin Code"value="<?= isset($client['postal_code']) ? $client['postal_code'] : '' ?>" maxlength="6" minlength="6">
|
||||
</div>
|
||||
|
||||
@ -145,9 +145,10 @@ p {
|
||||
|
||||
<?php foreach ($sales as $value) : ?>
|
||||
<tr>
|
||||
<td class="business-logo-container"style="font-size: 20px;font-weight: bold;">
|
||||
<td class="business-logo-container"style="font-size: 16px;font-weight: bold;">
|
||||
THE MECHANIC
|
||||
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"> -->
|
||||
THE MECHANIC
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -187,13 +188,14 @@ p {
|
||||
</tr>
|
||||
<tr >
|
||||
<td class="billing-address">
|
||||
|
||||
<?php foreach ($sales as $value) : ?>
|
||||
<?= $value->client_name ?><br>
|
||||
<?= $value->address." ," ?><br>
|
||||
<?= $value->city ?> <?= $value->state?>
|
||||
<?= $value->billing_postal_code ." - "?>
|
||||
<?= $value->billing_country ? $value->billing_country . "." : $value->billing_country ?><br>
|
||||
|
||||
<?= $value->billing_address != '' ? $value->billing_address." , <br>" : ''; ?>
|
||||
<?= $value->billing_city ?> <?= $value->billing_state." "?>
|
||||
<?php if ($value->billing_postal_code!=0): ?>
|
||||
<?= $value->billing_postal_code ?><br>
|
||||
<?php endif; ?>
|
||||
<?= $value->mobile_no." ." ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
@ -210,8 +212,9 @@ p {
|
||||
<th>S.no</th>
|
||||
<th>Item Name</th>
|
||||
|
||||
<th>Rate</th>
|
||||
<th>MRP</th>
|
||||
<th>Qty</th>
|
||||
<th>Discount</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -227,7 +230,7 @@ p {
|
||||
<td><?= $item->product_name ?></td>
|
||||
<td>₹<?= number_format($item->net_price, 2, '.', ',') ?></td>
|
||||
<td><?= $item->qty ?></td>
|
||||
|
||||
<td><?= $item->discount_type == '₹' ? $item->discount_type.$item->discount : $item->discount.$item->discount_type; ?></td>
|
||||
|
||||
|
||||
<td>₹<?= number_format($item->amount, 2, '.', ',') ?></td>
|
||||
@ -273,11 +276,14 @@ p {
|
||||
|
||||
|
||||
<div class="terms">
|
||||
<p>Thank you!</p>
|
||||
<!-- <if(!empty($value->notes)){
|
||||
<br><p style="text-align: left !important;"><b>Notes:</b> $value->notes; ?></p>
|
||||
} ?> -->
|
||||
|
||||
|
||||
<?php if ($value->discount!=0): ?>
|
||||
<br><p >"You have saved ₹<?= $value->discount; ?>- in this purchase"</p><br>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
<p style=text-align:left><?= $value->terms_condition;?></p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ... (your existing HTML template) -->
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Mechanics</title>
|
||||
<title>Mechanic</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
@ -116,6 +116,9 @@
|
||||
<li>
|
||||
<a href="<?php echo base_url('sales_order_index') ?>">Sales Order</a>
|
||||
</li>
|
||||
<!-- <li>
|
||||
<a href="<?php echo base_url('vendor_index') ?>">Vendor</a>
|
||||
</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@ -26,6 +26,8 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputEmail4" class="col-form-label">Client Name<span class="text-danger">*</span></label>
|
||||
<i type="button" class="fe-plus-circle" id="addClientModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addClientModal" title="Add Client"></i>
|
||||
|
||||
<select class="form-control cleint-select SelExample" name="client_id" id="SelExample" <?= isset($sales['client_id']) ? '' : 'required' ?>>
|
||||
<?= isset($sales['client_id']) ? '' : '<option value="">Select a Client</option>' ?>
|
||||
<?php foreach ($client as $value) : ?>
|
||||
@ -50,31 +52,28 @@
|
||||
<h4 class="header-title">Billing Address Details :</h4><br>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Address<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="billing_address" placeholder="Address"value="<?= isset($sales['billing_address']) ? $sales['billing_address'] : '' ?>" required>
|
||||
<label for="inputPassword4" class="col-form-label">Address<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="billing_address" placeholder="Address"value="<?= isset($sales['billing_address']) ? $sales['billing_address'] : '' ?>" >
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" id="sales_order_id" name="sales_order_id" value="<?= isset($sales['sales_order_id']) ? $sales['sales_order_id'] : '' ?>"readonly>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">City<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($sales['billing_city']) ? $sales['billing_city'] : '' ?>" required>
|
||||
<label for="inputPassword4" class="col-form-label">City<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($sales['billing_city']) ? $sales['billing_city'] : 'Chennai' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="state" placeholder="State"value="<?= isset($sales['billing_state']) ? $sales['billing_state'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Country<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="country" placeholder="Country"value="<?= isset($sales['billing_country']) ? $sales['billing_country'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Pin Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="postalcode" placeholder="Pin Code"value="<?= isset($sales['billing_postal_code']) ? $sales['billing_postal_code'] : '' ?>" maxlength="6" minlength="6" required>
|
||||
<label for="inputPassword4" class="col-form-label">State<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="state" placeholder="State"value="<?= isset($sales['billing_state']) ? $sales['billing_state'] : 'Tamil Nadu' ?>" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Pin Code<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="postalcode" placeholder="Pin Code"value="<?= isset($sales['billing_postal_code']) ? $sales['billing_postal_code'] : '' ?>" maxlength="6" minlength="6" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Mobile No<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($sales['mobile_no']) ? $sales['mobile_no'] : '' ?>" maxlength="10" minlength="10" onkeypress = "return onlyNumbers(event)" required>
|
||||
</div>
|
||||
@ -195,8 +194,10 @@
|
||||
|
||||
|
||||
<label for="inputPassword4" class="col-form-label">Terms & Condition</label>
|
||||
<textarea class="form-control" name="terms_condition" placeholder="Terms & Condition"value="<?= isset($sales['terms_condition']) ? $sales['terms_condition'] : '' ?>" >
|
||||
</textarea>
|
||||
<textarea class="form-control" name="terms_condition" placeholder="Terms & Condition" >
|
||||
<?= isset($sales['terms_condition']) ? $sales['terms_condition'] : 'Please check the products properly before purchase. Products once sold cannot be returned.' ?>
|
||||
</textarea>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!isset($sales['status']) || $sales['status'] !== 'Paid') : ?>
|
||||
@ -210,6 +211,35 @@
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
</div>
|
||||
<div class="modal fade" id="addClientModal" tabindex="-1" role="dialog" aria-labelledby="addClientModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addClientModalLabel">Add New Client</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="addClientForm">
|
||||
<div class="form-group">
|
||||
<label for="clientName">Client Name</label>
|
||||
<input type="text" class="form-control" id="clientName" placeholder="Enter client name"required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="clientMobile">Mobile</label>
|
||||
<input type="text" class="form-control" id="clientMobile" placeholder="Enter mobile number" maxlength="10" minlength="10"onkeypress = "return onlyNumbers(event)"required>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="saveClientBtn">Save Client</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
<?php
|
||||
@ -447,7 +477,56 @@ $(document).ready(function(){
|
||||
$(".SelExample").select2();
|
||||
$(".SelExample").select2("val", "4");
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Show the modal when the "add-circle-button" is clicked
|
||||
$('#add-circle-button').click(function() {
|
||||
$('#addClientModal').modal('show');
|
||||
});
|
||||
|
||||
// AJAX request to save client
|
||||
$('#saveClientBtn').click(function() {
|
||||
var clientName = $('#clientName').val();
|
||||
var clientMobile = $('#clientMobile').val();
|
||||
|
||||
// Send AJAX request to save the client
|
||||
$.ajax({
|
||||
url: '<?php echo base_url().'save_client'?>', // URL to your save_client method
|
||||
method: 'POST',
|
||||
data: {
|
||||
client_name: clientName,
|
||||
mobile_no: clientMobile
|
||||
},
|
||||
success: function(response) {
|
||||
// Check if the operation was successful
|
||||
if (response.success) {
|
||||
// Client saved successfully, close the modal and do any additional actions
|
||||
$('#addClientModal').modal('hide');
|
||||
// Optionally, you can update the client dropdown or show a success message
|
||||
toastr.success("Client saved successfully!");
|
||||
window.location.reload(); // Reload the page
|
||||
|
||||
} else {
|
||||
// Client save operation failed, display error message
|
||||
alert('Failed to save client. Please try again.');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// AJAX request failed, display error message
|
||||
console.error('Error occurred while saving client:', error);
|
||||
alert('Failed to save client. Please try again.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.select2-container--default .select2-results__option--highlighted[aria-selected]{
|
||||
color:#ffffff;
|
||||
|
||||
89
app/Views/vendor_form.php
Normal file
89
app/Views/vendor_form.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"><?php echo $page_name?></h4>
|
||||
<div class="page-title-right">
|
||||
<a href="<?= base_url() . "vendor_index"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<ol class="breadcrumb m-0">
|
||||
|
||||
</li>
|
||||
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
|
||||
<li class="breadcrumb-item active">Datatables</li> -->
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<form action="<?= base_url() . "add_vendor"; ?>" method="post">
|
||||
<h4 class="header-title">Vendor Details :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Vendor Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="vendor_name" placeholder="Vendor Name" value="<?= isset($vendor['vendor_name']) ? $vendor['vendor_name'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputAddress" class="col-form-label">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?= isset($vendor['vendor_mobile']) ? $vendor['vendor_mobile'] : '' ?>" maxlength="10" minlength="10" onkeypress = "return onlyNumbers(event)" required/>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Email</label>
|
||||
<input type="email" class="form-control" name="email" placeholder="Email" value="<?= isset($vendor['vendor_email']) ? $vendor['vendor_email'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Website<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="website" placeholder="Website" value="<?= isset($vendor['website']) ? $vendor['website'] : '' ?>" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Category<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="category" placeholder="Category" value="<?= isset($vendor['category']) ? $vendor['category'] : '' ?>" >
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="hidden" id="vendor_id" name="vendor_id" value="<?= isset($vendor['vendor_id']) ? $vendor['vendor_id'] : '' ?>">
|
||||
<h4 class="header-title">Address Information :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Address</label>
|
||||
<input type="text" class="form-control" name="address" placeholder="Address"value="<?= isset($vendor['address']) ? $vendor['address'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">City</label>
|
||||
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($vendor['city']) ? $vendor['city'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">State</label>
|
||||
<input type="text" class="form-control" name="state" placeholder="State"value="<?= isset($vendor['state']) ? $vendor['state'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Country</label>
|
||||
<input type="text" class="form-control" name="country" placeholder="Country"value="<?= isset($vendor['country']) ? $vendor['country'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Pin Code</label>
|
||||
<input type="text" class="form-control" name="postalcode" placeholder="Pin Code"value="<?= isset($vendor['postal_code']) ? $vendor['postal_code'] : '' ?>" maxlength="6" minlength="6">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include('layout/footer.php'); ?>
|
||||
</div>
|
||||
<script>
|
||||
function onlyNumbers(event){
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
72
app/Views/vendor_list.php
Normal file
72
app/Views/vendor_list.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Vendor List</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="">
|
||||
<a href="<?= base_url() . "new_vendor/0"; ?>" class="btn btn-primary waves-effect" > <i class="ri-add-line"></i></a></li>
|
||||
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
|
||||
<li class="breadcrumb-item active">Datatables</li> -->
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <h4 class="header-title">User List</h4> -->
|
||||
<!--
|
||||
<a href="<?= base_url() . "new_user/0"; ?>" class="btn btn-primary waves-effect" style="margin-top: -48px;
|
||||
margin-left: 823px;"> <i class="ri-add-line"></i></a> -->
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons" class="table dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Vendor Name</th>
|
||||
<th>Email</th>
|
||||
<th>Mobile</th>
|
||||
<th>Category</th>
|
||||
<th>Action</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($vendor as $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<td><?= $value['vendor_id']; ?></td>
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<td><?= $value['vendor_email']; ?></td>
|
||||
<td><?= $value['vendor_mobile']; ?></td>
|
||||
<td><?= $value['category']; ?></td> <!-- Call the model method -->
|
||||
<td>
|
||||
<a href="<?= "new_vendor/" . $value['vendor_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||
<a href="<?= "delete_vendor/" . $value['vendor_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
</td>
|
||||
|
||||
<?php endif?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
<?php include('layout/footer.php'); ?>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user