CHANGE_ACTIVE_DEACTIVE_FULL_JOB_CARD_CHANGES : AADHAVAN
This commit is contained in:
parent
49b76fec0c
commit
9e1dc43772
@ -21,6 +21,7 @@ $routes->post("change_password_forget", "Users::change_password_forget");
|
||||
$routes->post("add_account", "Users::add_account");
|
||||
$routes->match(['get','post'],'/forgot_password','Users::forgot_password');
|
||||
$routes->match(['get','post'],'/verify_otp','Users::verify_otp');
|
||||
$routes->post('status_user', 'Users::status_user');
|
||||
|
||||
|
||||
// $routes->get("new_user/(:any)", "Users::new_user/$1");
|
||||
@ -70,6 +71,7 @@ $routes->post("save_make", "Products::save_make");
|
||||
$routes->post("save_model", "Products::save_model");
|
||||
$routes->post("save_manufacturer", "Products::save_manufacturer");
|
||||
$routes->get("product_list_for_service", "Products::product_list_for_service");
|
||||
$routes->post('status_product', 'Products::status_product');
|
||||
//end products//
|
||||
|
||||
//Sales order //
|
||||
@ -113,6 +115,7 @@ $routes->get("new_vendor/(:any)", "Vendor::new_vendor/$1");
|
||||
$routes->get("delete_vendor/(:any)", "Vendor::delete_vendor/$1");
|
||||
$routes->get("get_product_by_vendor/(:any)", "Vendor::get_product_by_vendor/$1");
|
||||
$routes->post("fetch_models", "Vendor::fetch_models");
|
||||
$routes->post('status_vendor', 'Vendor::status_vendor');
|
||||
//end Vendor
|
||||
|
||||
//Vehicle//
|
||||
@ -122,6 +125,8 @@ $routes->get("new_vehicle/(:any)", "Vehicle::new_vehicle/$1");
|
||||
$routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1");
|
||||
$routes->post("get_models_vehicle", "Vehicle::get_models");
|
||||
$routes->post("checkRegisterNo", "Vehicle::checkRegisterNo");
|
||||
$routes->post('status_vehicle', 'Vehicle::status_vehicle');
|
||||
|
||||
//end Vehicle
|
||||
|
||||
|
||||
@ -162,6 +167,8 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
$routes->post("get_models_service", "Service::get_models");
|
||||
$routes->get("delete_service/(:any)", "Service::delete_service/$1");
|
||||
$routes->post("get_product_by_models", "Service::get_product_by_models");
|
||||
$routes->post('status_service', 'Service::status_service');
|
||||
|
||||
|
||||
// Service End's//
|
||||
|
||||
@ -170,6 +177,7 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
$routes->get('spare_manufacturer_index', 'Manufacturer::index');
|
||||
$routes->post('create_manufacturer/(:any)', 'Manufacturer::create_manufacturer/$1');
|
||||
$routes->post('create_manufacture_product_form', 'Manufacturer::create_manufacture_product_form');
|
||||
$routes->post('status_manufacturer', 'Manufacturer::status_manufacturer');
|
||||
|
||||
//Spare manufacturer End's//
|
||||
|
||||
@ -208,6 +216,8 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
$routes->post('create_complaint/(:any)', 'Complaint::create_complaint/$1');
|
||||
$routes->get('edit_complaint/(:any)', 'Complaint::edit_complaint/$1');
|
||||
$routes->get("delete_complaint/(:any)", "Complaint::delete_complaint/$1");
|
||||
$routes->post('status_complaint', 'Complaint::status_complaint');
|
||||
|
||||
// Complaint End's//
|
||||
|
||||
// Out sourcing
|
||||
@ -215,5 +225,6 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
$routes->post('create_os', 'Outsourcing::create_os');
|
||||
$routes->get('edit_os/(:any)', 'Outsourcing::edit_OS/$1');
|
||||
$routes->get("delete_outsource/(:any)", "Outsourcing::delete_outsource/$1");
|
||||
$routes->post('status_outsource', 'Outsourcing::status_outsource');
|
||||
|
||||
// Complaint End's
|
||||
|
||||
@ -94,5 +94,31 @@ class Complaint extends BaseController
|
||||
// Return error response if deletion fails
|
||||
return $this->response->setJSON(['success' => false]);
|
||||
}
|
||||
|
||||
public function status_complaint()
|
||||
{
|
||||
|
||||
try {
|
||||
$complaint_id = $this->request->getPost('complaint_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$ComplaintModel = new ComplaintModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
$updated = $ComplaintModel->update($complaint_id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -23,6 +23,7 @@ use App\Models\SalesOrderProductModel;
|
||||
use App\Models\UsersModel;
|
||||
use App\Models\RoleModel;
|
||||
use Mpdf\Mpdf;
|
||||
use DateTime;
|
||||
|
||||
class Jobcard extends BaseController
|
||||
{
|
||||
@ -84,9 +85,9 @@ class Jobcard extends BaseController
|
||||
public function download_jobcard_invoice($job_card_id)
|
||||
{
|
||||
$data['vehicle'] = $this->JobcardModel->get_jobcard_vehicle_details($job_card_id);
|
||||
// print_r($data['vehicle']);die;
|
||||
$bus_id = $this->session->get('logged_user_business_id');
|
||||
$data['job_card'] = $this->JobcardModel->where('job_card_id',$job_card_id)->findAll();
|
||||
|
||||
$data['company_address'] = $this->BranchModel->where('branch_id', $this->session->get('logged_user_branch_id'))->where('business_id', $bus_id)->where('isactive', 1)->findAll();
|
||||
// echo json_encode($data['company_address']);die;
|
||||
$productdata = $this->JobcardModel->get_jobcard_products_details($job_card_id);
|
||||
@ -158,8 +159,8 @@ class Jobcard extends BaseController
|
||||
$mpdf->SetTitle('Invoice');
|
||||
// $mpdf->SetAuthor($data[0]->branch_name);
|
||||
$mpdf->SetCreator('');
|
||||
|
||||
|
||||
// echo"<pre>";
|
||||
// print_r($data['job_card_products']);die;
|
||||
// Generate the PDF content (HTML) with data
|
||||
$html = view('invoice_pdf_template_jobcard', $data);
|
||||
// echo $html;die;
|
||||
@ -167,7 +168,7 @@ class Jobcard extends BaseController
|
||||
$mpdf->WriteHTML($html);
|
||||
|
||||
// Output the PDF to the browser for download
|
||||
$mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
$mpdf->Output( $data['job_card'][0]['order_number'] .'_'. date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
|
||||
}
|
||||
|
||||
@ -634,6 +635,11 @@ class Jobcard extends BaseController
|
||||
$this->delete_items($this->request->getPost('delete_items'));
|
||||
$rework = $this->request->getPost('rework');
|
||||
// Job card INSERT
|
||||
$deliveryDate = $this->request->getPost('delivery_date');
|
||||
|
||||
// Retrieve and validate the delivery date
|
||||
$deliveryDate = $this->request->getPost('delivery_date');
|
||||
|
||||
$job_card_data = [
|
||||
'client_name' => $this->request->getPost('client_id'),
|
||||
'client_mobile_no' => $this->request->getPost('mobile_no'),
|
||||
@ -645,7 +651,7 @@ class Jobcard extends BaseController
|
||||
'billing_postal_code' => $this->request->getPost('postalcode'),
|
||||
'fuel_qty'=> $this->request->getPost('fuel_qty'),
|
||||
'meter'=> $this->request->getPost('meter'),
|
||||
'delivery_date'=> $this->request->getPost('delivery_date'),
|
||||
'delivery_date' => !empty($deliveryDate) ? $deliveryDate : '0000-00-00',
|
||||
'note'=> $this->request->getPost('note'),
|
||||
'status'=> $this->request->getPost('status'),
|
||||
'assigned_to'=> json_encode($this->request->getPost('assigned_to')),
|
||||
@ -655,11 +661,17 @@ class Jobcard extends BaseController
|
||||
'total'=> $this->request->getPost('grand_total'), //(isset($rework) ? 0 : $this->request->getPost('grand_total') ),
|
||||
'isactive' => 1
|
||||
];
|
||||
// echo "<pre>";
|
||||
// print_r($job_card_data);die;
|
||||
$status = $this->request->getPost('status');
|
||||
// Insert or update sales order
|
||||
$job_card_id = $this->request->getPost('job_card_id');
|
||||
if (!empty($job_card_id)) {
|
||||
if($status == 'Cancelled')
|
||||
if ($status === "Paid") {
|
||||
$job_card_data = [];
|
||||
$job_card_data['status'] = $status;
|
||||
$job_card_data['mode_of_payment'] = $this->request->getPost('mode_of_payment');
|
||||
}else if($status == 'Cancelled')
|
||||
{
|
||||
// echo $status;die;
|
||||
$job_card_data = [];
|
||||
@ -694,7 +706,7 @@ class Jobcard extends BaseController
|
||||
$service['job_card_id'] = $job_card_id;
|
||||
$service['service_id'] = $item->service_id;
|
||||
$service['qty'] = $item->quality;
|
||||
$service['tax'] = $item->tax;
|
||||
$service['tax'] = (int)$item->tax;
|
||||
$service['labour_cost'] = $item->labour_cost; //(isset($rework) ? 0 : $item->labour_cost );
|
||||
$service['amount'] = $item->amount; //(isset($rework) ? 0 : $item->amount );
|
||||
|
||||
@ -726,7 +738,7 @@ class Jobcard extends BaseController
|
||||
$service['complaint_id'] = $item->complaint_id;
|
||||
$service['labour_cost'] = $item->amount;
|
||||
$service['qty'] = $item->quality;
|
||||
$service['tax'] = $item->tax;
|
||||
$service['tax'] = (int)$item->tax;
|
||||
$service['amount'] = $item->amount;
|
||||
if(empty($item->id)) {
|
||||
$JobcardComplaintModel->insert($service);
|
||||
|
||||
@ -107,4 +107,29 @@ class Manufacturer extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function status_manufacturer()
|
||||
{
|
||||
|
||||
try {
|
||||
$manufacturer_id = $this->request->getPost('manufacturer_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$ManufacturerModel = new ManufacturerModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
$updated = $ManufacturerModel->update($manufacturer_id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ class Outsourcing extends BaseController
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
$OutsourceModel = new OutsourceModel();
|
||||
$os_data = $OutsourceModel->where('is_active', 1)->findAll();
|
||||
$os_data = $OutsourceModel->findAll();
|
||||
$data['out_source'] = $os_data;
|
||||
return view('outsourcing_list', $data);
|
||||
}
|
||||
@ -91,5 +91,30 @@ class Outsourcing extends BaseController
|
||||
return $this->response->setJSON(['success' => false]);
|
||||
}
|
||||
|
||||
public function status_outsource()
|
||||
{
|
||||
|
||||
try {
|
||||
$id = $this->request->getPost('outsource_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$OutsourceModel = new OutsourceModel();
|
||||
$data = [
|
||||
'is_active' => $isactive
|
||||
];
|
||||
$updated = $OutsourceModel->update($id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -8,12 +8,15 @@ use App\Models\ProductModel;
|
||||
use App\Models\BikemodelsModel;
|
||||
use App\Models\ManufacturerModel;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
class Products extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@ -439,4 +442,30 @@ class Products extends BaseController
|
||||
return $this->response->setJSON($products);
|
||||
}
|
||||
|
||||
|
||||
public function status_product()
|
||||
{
|
||||
|
||||
try {
|
||||
$product_id = $this->request->getPost('product_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$ProductModel = new ProductModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
$updated = $ProductModel->update($product_id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -245,7 +245,8 @@ class Purchase extends BaseController
|
||||
$PurchaseOrderModel->insert($data);
|
||||
$purchase_order_id = $PurchaseOrderModel->getInsertID();
|
||||
}
|
||||
$orderNumber = 'PO' . str_pad($purchase_order_id, 8, '0', STR_PAD_LEFT);
|
||||
|
||||
$orderNumber = 'PO-' . date('md') . '-' . str_pad($purchase_order_id, 5, '0', STR_PAD_LEFT);
|
||||
// print_r($orderNumber);die;
|
||||
// Update sales order with generated order number
|
||||
$PurchaseOrderModel->update($purchase_order_id, ['order_number' => $orderNumber]);
|
||||
|
||||
@ -34,7 +34,7 @@ class Sales extends BaseController
|
||||
$data['sales']=$sales;
|
||||
|
||||
// echo"<pre>";
|
||||
// print_r($data);die;
|
||||
// print_r($sales);die;
|
||||
return view('sales_list',$data);
|
||||
}
|
||||
|
||||
@ -139,156 +139,157 @@ class Sales extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function add_sales()
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
$SalesOrderModel = new SalesOrderModel();
|
||||
$ProductModel = new ProductModel();
|
||||
$SalesOrderProductModel = new SalesOrderProductModel(); // Assuming you have a model for sales_order_product
|
||||
public function add_sales()
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
$SalesOrderModel = new SalesOrderModel();
|
||||
$ProductModel = new ProductModel();
|
||||
$SalesOrderProductModel = new SalesOrderProductModel(); // Assuming you have a model for sales_order_product
|
||||
|
||||
// Prepare data for sales order
|
||||
$data = [
|
||||
'client_name' => $this->request->getPost('client_id'),
|
||||
'vehicle_id'=>$this->request->getPost('vehicle_id'),
|
||||
'billing_address' => $this->request->getPost('billing_address'),
|
||||
'billing_city' => $this->request->getPost('city'),
|
||||
'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'),
|
||||
'terms_condition' => $this->request->getPost('terms_condition'),
|
||||
'subtotal' => $this->request->getPost('sub_total'),
|
||||
'tax' => $this->request->getPost('invoice_tax'),
|
||||
|
||||
'total'=> $this->request->getPost('grand_total'),
|
||||
'status'=> $this->request->getPost('status'),
|
||||
'isactive' => 1, // Assuming this is a default value or handled separately
|
||||
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
||||
];
|
||||
|
||||
// Insert or update sales order
|
||||
$sales_order_id = $this->request->getPost('sales_order_id');
|
||||
if (!empty($sales_order_id)) {
|
||||
// print_r("hello");die;
|
||||
if ($this->request->getPost('status') === "Paid") {
|
||||
$data['mode_of_payment'] = $this->request->getPost('mode_of_payment');
|
||||
}
|
||||
$SalesOrderModel->update($sales_order_id, $data);
|
||||
} else {
|
||||
$SalesOrderModel->insert($data);
|
||||
$sales_order_id = $SalesOrderModel->getInsertID(); // Get the last inserted ID
|
||||
}
|
||||
$orderNumber = 'SO' . str_pad($sales_order_id, 8, '0', STR_PAD_LEFT);
|
||||
|
||||
// Update sales order with generated order number
|
||||
$SalesOrderModel->update($sales_order_id, ['order_number' => $orderNumber]);
|
||||
|
||||
// Prepare data for sales order product
|
||||
$product_ids = $this->request->getPost('item_details');
|
||||
$quantities = $this->request->getPost('quantity');
|
||||
$discounts = $this->request->getPost('discount_amount');
|
||||
$discount_types = $this->request->getPost('discount_type');
|
||||
$amounts = $this->request->getPost('amount');
|
||||
$itemtax=$this->request->getPost('item-tax');
|
||||
$unitprice=$this->request->getPost('unit-price');
|
||||
$sales_product_id = $this->request->getPost('sales_order_product_id');
|
||||
|
||||
|
||||
|
||||
$status = $this->request->getPost('status');
|
||||
foreach ($product_ids as $key => $product_id) {
|
||||
$qty = isset($quantities[$key]) ? $quantities[$key] : 0;
|
||||
if ($status == 'Created') {
|
||||
// echo "hello";die;
|
||||
$this->updateProductQuantity($ProductModel, $product_id, $qty);
|
||||
}elseif ($status == 'Cancelled'){
|
||||
// echo "cancel";die;
|
||||
|
||||
// echo"hello";die;
|
||||
$this->addBackProductQuantity($ProductModel, $product_id, $qty);
|
||||
}
|
||||
|
||||
$discount = isset($discounts[$key]) ? $discounts[$key] : 0;
|
||||
$discount_type = isset($discount_types[$key]) ? $discount_types[$key] : '';
|
||||
$tax=isset($itemtax[$key]) ? $itemtax[$key] : 0;
|
||||
$rate=isset($unitprice[$key]) ? $unitprice[$key] : 0;
|
||||
$amount = isset($amounts[$key]) ? $amounts[$key] : 0;
|
||||
// $new_qty = $this->calculateUpdatedQuantity($ProductModel, $product_id, $qty);
|
||||
// print_r($discount_type);die;
|
||||
$product_data = [
|
||||
'sales_order_id' => $sales_order_id,
|
||||
'product_id' => $product_id,
|
||||
'qty' => $qty,
|
||||
'discount' => $discount,
|
||||
'discount_type' => $discount_type,
|
||||
'net_price'=>$rate,
|
||||
'tax'=>$tax,
|
||||
'amount' => $amount,
|
||||
'isactive'=>1,
|
||||
// Prepare data for sales order
|
||||
$data = [
|
||||
'client_name' => $this->request->getPost('client_id'),
|
||||
'vehicle_id'=>$this->request->getPost('vehicle_id'),
|
||||
'billing_address' => $this->request->getPost('billing_address'),
|
||||
'billing_city' => $this->request->getPost('city'),
|
||||
'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'),
|
||||
'terms_condition' => $this->request->getPost('terms_condition'),
|
||||
'subtotal' => $this->request->getPost('sub_total'),
|
||||
'tax' => $this->request->getPost('invoice_tax'),
|
||||
|
||||
'total'=> $this->request->getPost('grand_total'),
|
||||
'status'=> $this->request->getPost('status'),
|
||||
'isactive' => 1, // Assuming this is a default value or handled separately
|
||||
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
||||
];
|
||||
// print_r($product_data);die;
|
||||
if (!empty($sales_product_id[$key])) {
|
||||
|
||||
|
||||
$SalesOrderProductModel->update($sales_product_id[$key], $product_data);
|
||||
|
||||
|
||||
// Insert or update sales order
|
||||
$sales_order_id = $this->request->getPost('sales_order_id');
|
||||
if (!empty($sales_order_id)) {
|
||||
// print_r("hello");die;
|
||||
if ($this->request->getPost('status') === "Paid") {
|
||||
$data['mode_of_payment'] = $this->request->getPost('mode_of_payment');
|
||||
}
|
||||
$SalesOrderModel->update($sales_order_id, $data);
|
||||
} else {
|
||||
$SalesOrderProductModel->insert($product_data);
|
||||
|
||||
$SalesOrderModel->insert($data);
|
||||
$sales_order_id = $SalesOrderModel->getInsertID(); // Get the last inserted ID
|
||||
}
|
||||
|
||||
|
||||
$orderNumber = 'SO-' . date('md') . '-' . str_pad($sales_order_id, 5, '0', STR_PAD_LEFT);
|
||||
|
||||
// Update sales order with generated order number
|
||||
$SalesOrderModel->update($sales_order_id, ['order_number' => $orderNumber]);
|
||||
|
||||
// Prepare data for sales order product
|
||||
$product_ids = $this->request->getPost('item_details');
|
||||
$quantities = $this->request->getPost('quantity');
|
||||
$discounts = $this->request->getPost('discount_amount');
|
||||
$discount_types = $this->request->getPost('discount_type');
|
||||
$amounts = $this->request->getPost('amount');
|
||||
$itemtax=$this->request->getPost('item-tax');
|
||||
$unitprice=$this->request->getPost('unit-price');
|
||||
$sales_product_id = $this->request->getPost('sales_order_product_id');
|
||||
|
||||
|
||||
|
||||
$status = $this->request->getPost('status');
|
||||
foreach ($product_ids as $key => $product_id) {
|
||||
$qty = isset($quantities[$key]) ? $quantities[$key] : 0;
|
||||
if ($status == 'Created') {
|
||||
// echo "hello";die;
|
||||
$this->updateProductQuantity($ProductModel, $product_id, $qty);
|
||||
}elseif ($status == 'Cancelled'){
|
||||
// echo "cancel";die;
|
||||
|
||||
// echo"hello";die;
|
||||
$this->addBackProductQuantity($ProductModel, $product_id, $qty);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return redirect()->to('sales_order_index');
|
||||
}
|
||||
|
||||
private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
// Fetch current product quantity
|
||||
$product = $ProductModel->find($product_id);
|
||||
$current_qty = $product['qty_stock'];
|
||||
|
||||
// Calculate updated quantity
|
||||
$new_qty = $current_qty + $sold_qty;
|
||||
|
||||
// Update quantity in Product table
|
||||
$ProductModel->update($product_id, ['qty_stock' => $new_qty]);
|
||||
}
|
||||
private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
// Fetch current product quantity
|
||||
$product = $ProductModel->find($product_id);
|
||||
$current_qty = $product['qty_stock'];
|
||||
|
||||
// Calculate updated quantity
|
||||
$new_qty = $current_qty - $sold_qty;
|
||||
|
||||
// Update quantity in Product table
|
||||
$ProductModel->update($product_id, ['qty_stock' => $new_qty]);
|
||||
}
|
||||
|
||||
public function delete_sales_product()
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
$sales_order_product_id = $this->request->getPost('sales_order_product_id');
|
||||
|
||||
if (!empty($sales_order_product_id)) {
|
||||
$SalesOrderProductModel = new SalesOrderProductModel();
|
||||
$data['isactive'] = 0;
|
||||
$discount = isset($discounts[$key]) ? $discounts[$key] : 0;
|
||||
$discount_type = isset($discount_types[$key]) ? $discount_types[$key] : '';
|
||||
$tax=isset($itemtax[$key]) ? $itemtax[$key] : 0;
|
||||
$rate=isset($unitprice[$key]) ? $unitprice[$key] : 0;
|
||||
$amount = isset($amounts[$key]) ? $amounts[$key] : 0;
|
||||
// $new_qty = $this->calculateUpdatedQuantity($ProductModel, $product_id, $qty);
|
||||
// print_r($discount_type);die;
|
||||
$product_data = [
|
||||
'sales_order_id' => $sales_order_id,
|
||||
'product_id' => $product_id,
|
||||
'qty' => $qty,
|
||||
'discount' => $discount,
|
||||
'discount_type' => $discount_type,
|
||||
'net_price'=>$rate,
|
||||
'tax'=>$tax,
|
||||
'amount' => $amount,
|
||||
'isactive'=>1,
|
||||
];
|
||||
// print_r($product_data);die;
|
||||
if (!empty($sales_product_id[$key])) {
|
||||
|
||||
|
||||
$SalesOrderProductModel->update($sales_product_id[$key], $product_data);
|
||||
|
||||
} else {
|
||||
$SalesOrderProductModel->insert($product_data);
|
||||
|
||||
}
|
||||
|
||||
if ($SalesOrderProductModel->update($sales_order_product_id, $data)) {
|
||||
// Return success response
|
||||
return $this->response->setJSON(['success' => true]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return redirect()->to('sales_order_index');
|
||||
}
|
||||
|
||||
// Return error response if deletion fails
|
||||
return $this->response->setJSON(['success' => false]);
|
||||
}
|
||||
private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
// Fetch current product quantity
|
||||
$product = $ProductModel->find($product_id);
|
||||
$current_qty = $product['qty_stock'];
|
||||
|
||||
// Calculate updated quantity
|
||||
$new_qty = $current_qty + $sold_qty;
|
||||
|
||||
// Update quantity in Product table
|
||||
$ProductModel->update($product_id, ['qty_stock' => $new_qty]);
|
||||
}
|
||||
private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
// Fetch current product quantity
|
||||
$product = $ProductModel->find($product_id);
|
||||
$current_qty = $product['qty_stock'];
|
||||
|
||||
// Calculate updated quantity
|
||||
$new_qty = $current_qty - $sold_qty;
|
||||
|
||||
// Update quantity in Product table
|
||||
$ProductModel->update($product_id, ['qty_stock' => $new_qty]);
|
||||
}
|
||||
|
||||
public function delete_sales_product()
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
$sales_order_product_id = $this->request->getPost('sales_order_product_id');
|
||||
|
||||
if (!empty($sales_order_product_id)) {
|
||||
$SalesOrderProductModel = new SalesOrderProductModel();
|
||||
$data['isactive'] = 0;
|
||||
|
||||
if ($SalesOrderProductModel->update($sales_order_product_id, $data)) {
|
||||
// Return success response
|
||||
return $this->response->setJSON(['success' => true]);
|
||||
}
|
||||
}
|
||||
|
||||
// Return error response if deletion fails
|
||||
return $this->response->setJSON(['success' => false]);
|
||||
}
|
||||
|
||||
|
||||
public function delete_sale($sales_order_id)
|
||||
@ -374,9 +375,9 @@ public function delete_sales_product()
|
||||
// echo $html;die;
|
||||
// Load HTML into the mPDF instance
|
||||
$mpdf->WriteHTML($html);
|
||||
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
// Output the PDF to the browser for download
|
||||
$mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
$mpdf->Output($data[0]->order_number .'_' . date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
}
|
||||
|
||||
|
||||
@ -446,64 +447,64 @@ public function delete_sales_product()
|
||||
}
|
||||
}
|
||||
|
||||
public function get_vehicle_products(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function getProducts()
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
// Retrieve make_id and model_id from the request
|
||||
$makeId = $this->request->getPost('make_id');
|
||||
$modelId = $this->request->getPost('model_id');
|
||||
|
||||
// Encode the modelId before searching
|
||||
$encodedMakeId = json_encode([$makeId]);
|
||||
$encodedModelId = json_encode([$modelId]);
|
||||
|
||||
// Load the ProductModel
|
||||
$productModel = new ProductModel();
|
||||
$bikemodelsModel = new BikemodelsModel();
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
|
||||
$makeGeneral = $BikemakeModel->where('make' , 'General')->first();
|
||||
$modelGeneral = $bikemodelsModel->where('model_name' , 'General')->first();
|
||||
|
||||
|
||||
// Query the database to find the product based on make_id and model_id
|
||||
$makeproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->where('products.isactive', 1)
|
||||
->findAll();
|
||||
|
||||
$encodedMakeId = json_encode(['0']);
|
||||
$encodedModelId = json_encode(['0']);
|
||||
|
||||
$common_product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->where('products.isactive', 1)
|
||||
->findAll();
|
||||
$product = array_merge($common_product, $makeproduct);
|
||||
|
||||
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
|
||||
$makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;
|
||||
if($product){
|
||||
// Send JSON response
|
||||
return $this->response->setJSON(['product'=>$product , 'modelName'=>$modelName ,'makeName'=>$makeName] );
|
||||
} else {
|
||||
// If product is not found, return an empty response or appropriate message
|
||||
return $this->response->setJSON(['product'=>[] , 'modelName'=>$modelName ,'makeName'=>$makeName]);
|
||||
public function get_vehicle_products(){
|
||||
|
||||
}
|
||||
}
|
||||
// Check if product exists
|
||||
|
||||
|
||||
|
||||
|
||||
public function getProducts()
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
// Retrieve make_id and model_id from the request
|
||||
$makeId = $this->request->getPost('make_id');
|
||||
$modelId = $this->request->getPost('model_id');
|
||||
|
||||
// Encode the modelId before searching
|
||||
$encodedMakeId = json_encode([$makeId]);
|
||||
$encodedModelId = json_encode([$modelId]);
|
||||
|
||||
// Load the ProductModel
|
||||
$productModel = new ProductModel();
|
||||
$bikemodelsModel = new BikemodelsModel();
|
||||
$BikemakeModel = new BikemakeModel();
|
||||
|
||||
$makeGeneral = $BikemakeModel->where('make' , 'General')->first();
|
||||
$modelGeneral = $bikemodelsModel->where('model_name' , 'General')->first();
|
||||
|
||||
|
||||
// Query the database to find the product based on make_id and model_id
|
||||
$makeproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->where('products.isactive', 1)
|
||||
->findAll();
|
||||
|
||||
$encodedMakeId = json_encode(['0']);
|
||||
$encodedModelId = json_encode(['0']);
|
||||
|
||||
$common_product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->where('products.isactive', 1)
|
||||
->findAll();
|
||||
$product = array_merge($common_product, $makeproduct);
|
||||
|
||||
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
|
||||
$makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;
|
||||
if($product){
|
||||
// Send JSON response
|
||||
return $this->response->setJSON(['product'=>$product , 'modelName'=>$modelName ,'makeName'=>$makeName] );
|
||||
} else {
|
||||
// If product is not found, return an empty response or appropriate message
|
||||
return $this->response->setJSON(['product'=>[] , 'modelName'=>$modelName ,'makeName'=>$makeName]);
|
||||
}
|
||||
}
|
||||
// Check if product exists
|
||||
|
||||
}
|
||||
@ -8,10 +8,15 @@ use App\Models\VendorModel;
|
||||
use App\Models\BikemodelsModel;
|
||||
use App\Models\ProductModel;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class Service extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@ -294,4 +299,30 @@ class Service extends BaseController
|
||||
return $this->response->setJSON($formatted_models);
|
||||
}
|
||||
|
||||
|
||||
public function status_service()
|
||||
{
|
||||
|
||||
try {
|
||||
$service_id = $this->request->getPost('service_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$ServiceModel = new ServiceModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
$updated = $ServiceModel->update($service_id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -12,12 +12,16 @@ use App\Models\BikemodelsModel;
|
||||
use App\Models\BikemakeModel;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
class Users extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@ -335,16 +339,19 @@ class Users extends BaseController
|
||||
'branch_id' => $this->request->getPost('branch'),
|
||||
'isactive' => 1 // Assuming this is a default value or handled separately
|
||||
];
|
||||
$user_id = $this->request->getPost('user_id');
|
||||
|
||||
// Hash the password
|
||||
$password = $this->request->getPost('password');
|
||||
$hashedPassword = password_hash($password, PASSWORD_DEFAULT); // Use PASSWORD_DEFAULT for bcrypt hashing
|
||||
if($user_id == 0){
|
||||
// Hash the password
|
||||
$password = $this->request->getPost('password');
|
||||
$hashedPassword = password_hash($password, PASSWORD_DEFAULT); // Use PASSWORD_DEFAULT for bcrypt hashing
|
||||
|
||||
// Add hashed password to the data array
|
||||
$data['password'] = $hashedPassword;
|
||||
// Add hashed password to the data array
|
||||
$data['password'] = $hashedPassword;
|
||||
}
|
||||
|
||||
|
||||
// Get user_id from the form
|
||||
$user_id = $this->request->getPost('user_id');
|
||||
|
||||
// Check if user_id is provided
|
||||
if (!empty($user_id)) {
|
||||
@ -498,4 +505,29 @@ class Users extends BaseController
|
||||
return json_encode($response);
|
||||
}
|
||||
}
|
||||
|
||||
public function status_user()
|
||||
{
|
||||
|
||||
try {
|
||||
$user_id = $this->request->getPost('user_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$UsersModel = new UsersModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
$updated = $UsersModel->update($user_id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,12 +7,16 @@ use App\Models\RoleModel;
|
||||
use App\Models\BikemakeModel;
|
||||
use App\Models\BikemodelsModel;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class Vehicle extends BaseController
|
||||
{
|
||||
|
||||
|
||||
public $session;
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
protected $bikeMakeModel;
|
||||
protected $bikeModelsModel;
|
||||
public function __construct()
|
||||
@ -172,4 +176,31 @@ class Vehicle extends BaseController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function status_vehicle()
|
||||
{
|
||||
|
||||
try {
|
||||
$vehicle_id = $this->request->getPost('vehicle_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$VehicleModel = new VehicleModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
$updated = $VehicleModel->update($vehicle_id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,11 +10,15 @@ use App\Models\BikemodelsModel;
|
||||
use App\Models\ManufacturerModel;
|
||||
use App\Models\ProductModel;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
class Vendor extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
use ResponseTrait;
|
||||
|
||||
protected $UsersModel;
|
||||
public function __construct()
|
||||
{
|
||||
@ -165,6 +169,31 @@ class Vendor extends BaseController
|
||||
return json_encode($reorder);
|
||||
}
|
||||
|
||||
|
||||
public function status_vendor()
|
||||
{
|
||||
|
||||
try {
|
||||
$vendor_id = $this->request->getPost('vendor_id');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
|
||||
$VendorModel = new VendorModel();
|
||||
$data = [
|
||||
'isactive' => $isactive
|
||||
];
|
||||
$updated = $VendorModel->update($vendor_id, $data);
|
||||
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404],404);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -9,7 +9,7 @@ class JobcardModel extends Model
|
||||
'order_number','client_mobile_no','client_name',
|
||||
'billing_address','billing_city','billing_state','billing_country',
|
||||
'billing_postal_code','fuel_qty', 'meter', 'delivery_date', 'note',
|
||||
'status','assigned_to', 'is_rework','subtotal','tax', 'discount','total','isactive'];
|
||||
'status','assigned_to', 'is_rework','subtotal','tax', 'discount','total','isactive','mode_of_payment'];
|
||||
|
||||
|
||||
|
||||
@ -71,8 +71,9 @@ class JobcardModel extends Model
|
||||
|
||||
public function get_jobcard_vehicle_details($job_id)
|
||||
{
|
||||
$this->select('job_card.job_card_id, job_card.order_number, job_card.vehicle_id as jobcard_vehicle_id, vehicle.*, make.make as bike_company, model.model_name as bike_name');
|
||||
$this->select('job_card.job_card_id, job_card.order_number, job_card.vehicle_id as jobcard_vehicle_id, vehicle.*, make.make as bike_company, model.model_name as bike_name, client.client_name');
|
||||
$this->join('vehicle', 'vehicle.vehicle_id = job_card.vehicle_id');
|
||||
$this->join('client', 'client.client_id = vehicle.client_id');
|
||||
$this->join('make', 'make.make_id = vehicle.make');
|
||||
$this->join('model', 'model.model_id = vehicle.model');
|
||||
$this->where('job_card.job_card_id', $job_id);
|
||||
|
||||
@ -32,9 +32,8 @@ class SalesOrderModel extends Model
|
||||
$this->groupBy('sales_order.sales_order_id');
|
||||
|
||||
// Add condition to fetch only active sales orders
|
||||
$this->where('sales_order_product.isactive', 1);
|
||||
$this ->where('sales_order.branch_id',$logged_user_branch_id);
|
||||
$this->orderBy('sales_order.sales_order_id','DESC');
|
||||
$this->orderBy('sales_order.order_number','desc');
|
||||
// Get the results
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ class VehicleModel extends Model
|
||||
$this->join('make', 'make.make_id = vehicle.make');
|
||||
$this->join('model', 'model.model_id = vehicle.model');
|
||||
$this->where('vehicle.branch_id', $branch_id);
|
||||
$this->where('vehicle.isactive', 1);
|
||||
|
||||
// Get the results
|
||||
return $this->findAll();
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($model as $index => $item): ?>
|
||||
<tr class="tr_<?php echo $index+1;?>">
|
||||
<tr class="model_tr_<?php echo $index+1;?>">
|
||||
<td class="model_name"><?php echo $item['model_name']; ?></td>
|
||||
<td>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
@ -45,12 +45,12 @@
|
||||
<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_model_login-modal_1" data-value="<?php echo $item['model_id']; ?>" class="dropdown-item edit-button" onclick="editModel(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a data-value="<?php echo $item['model_id']; ?>" class="dropdown-item" onclick="deleteModel(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i style="color: #526dee;" class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a data-toggle="modal" data-target="#bike_model_login-modal_1" data-value="<?php echo $item['model_id']; ?>" class="dropdown-item edit-button" onclick="editModel(this), datatableBikeModel('model_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a data-value="<?php echo $item['model_id']; ?>" class="dropdown-item" onclick="deleteModel(this), datatableBikeModel('model_tr_<?php echo $index+1; ?>')"><i style="color: #526dee;" class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i>Deactivate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableBikeModel('model_tr_<?php echo $index+1; ?>')"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i class="fa fa-bicycle"></i>Activate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableBikeModel('model_tr_<?php echo $index+1; ?>')"><i class="fa fa-bicycle"></i>Activate</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -302,14 +302,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_bikeModel.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">GST No</label>
|
||||
<input type="text" class="form-control" name="gstno" placeholder="GSTNO"value="<?= isset($branch['gstno']) ? $branch['gstno'] : '' ?>" required>
|
||||
<input type="text" class="form-control" name="gstno" pattern="[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[0-9]{1}[Z]{1}[0-9A-Z]{1}" placeholder="GSTNO"value="<?= isset($branch['gstno']) ? $branch['gstno'] : '' ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
<tbody>
|
||||
<?php foreach ($client as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<tr class="client_tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
<td><?= $value['mobile_no']; ?></td>
|
||||
<td><?= $value['email']; ?></td>
|
||||
@ -37,7 +37,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 href="<?= "new_client/" . $value['client_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "new_client/" . $value['client_id']; ?>" class="dropdown-item edit-button" onclick="datatableClient('client_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_client/" . $value['client_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" style="font-size: 20px;"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -78,28 +78,37 @@
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
console.log(savedPage);
|
||||
console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_make.page.info().pages; // Total number of pages in the DataTable
|
||||
var totalPages = datatable_client.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_make.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
datatable_client.page(savedPage).draw(false);
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
@ -109,10 +118,11 @@
|
||||
|
||||
});
|
||||
|
||||
function datatableMake(value) {
|
||||
function datatableClient(value) {
|
||||
console.log("---------------");
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_make.page.info().page;
|
||||
var currentPage = datatable_client.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
|
||||
@ -28,9 +28,12 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($complaint as $index => $value) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['name']; ?></td>
|
||||
<?php foreach ($complaint as $index => $value) :
|
||||
$color = '';
|
||||
if($value['isactive'] == 0){
|
||||
$color ='red';
|
||||
}?>
|
||||
<tr class="complaint_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" > <td><?= $value['name']; ?></td>
|
||||
<td><?= $value['tax']; ?></td>
|
||||
<td><?= $value['labour_cost_with_tax']; ?></td>
|
||||
<td><?= $value['labour_charge']; ?></td>
|
||||
@ -45,11 +48,14 @@
|
||||
<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="#complaint-add-modal" data-value="<?php echo $value['complaint_id']; ?>" onclick="editComplaint(this), datatableComplaint('tr_<?php echo $index+1; ?>')" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_complaint/" . $value['complaint_id']; ?>" class="dropdown-item delete-button" onclick="datatableComplaint('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($value['isactive'] == 1){ ?>
|
||||
<a data-toggle="modal" data-target="#complaint-add-modal" data-value="<?php echo $value['complaint_id']; ?>" onclick="editComplaint(this), datatableComplaint('complaint_tr_<?php echo $index+1; ?>')" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<?php } if($value['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['complaint_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableComplaint('complaint_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user " style="font-size:20px"></i><i class="fa fa-times mr-2" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['complaint_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableComplaint('complaint_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
@ -221,14 +227,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_complaint.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
@ -243,4 +258,38 @@
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var complaint_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
complaint_id: complaint_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_complaint"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -218,7 +218,16 @@
|
||||
<td style="border: 0.5px solid black;" id="total_amount"><?= $sales[0]->total ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="11" style="border: 0.5px solid black;">Amount Chargeable (in words) <p id="amountInWords" style="float: right;"></p></td>
|
||||
<td colspan="7" style="border: 0.5px solid black;border-right: none;text-align: center;">Amount Chargeable (in words):
|
||||
<?php
|
||||
$formatter = new NumberFormatter("en", NumberFormatter::SPELLOUT);
|
||||
$words = $formatter->format(round($sales[0]->subtotal + $sales[0]->tax));
|
||||
?>
|
||||
</td>
|
||||
<td colspan="4" style="border: 0.5px solid black; border-left: none;text-align: center;">
|
||||
<?php echo ucfirst($words); ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td></td></tr>
|
||||
|
||||
@ -153,15 +153,15 @@ p {
|
||||
<td style="max-width: 50px;">
|
||||
<p><b>THE MECHANIC</b><br>
|
||||
<?= $value['address'] ?>,<br>
|
||||
<?= '<b>GSTNO: </b>'.$value['gstno'] ?><br>
|
||||
<?= '<b>State Name: </b>'.$value['state'].', code'.$value['state_code'] ?><br>
|
||||
<?= '<b>Contact: </b>'.$value['postal_code'] ?><br>
|
||||
<?= '<b>GST: </b>'.$value['gstno'] ?><br>
|
||||
<?= '<b>State: </b>'.$value['state'].', code'.$value['state_code'] ?><br>
|
||||
<?= '<b>Contact: </b>'.$value['contact_1'] ?><br>
|
||||
<?= '<b>Email: </b>'.$value['email'] ?></p>
|
||||
<br>
|
||||
<b>Buyer (Bill To)</b><br>
|
||||
<b>Buyer (Bill To) - <?= $vehicle[0]['client_name'] ?></b><br>
|
||||
<p><?= $job_card[0]['billing_address'].', '.$job_card[0]['billing_city'].', '.$job_card[0]['billing_state'].', '.$job_card[0]['billing_country'].', '.$job_card[0]['billing_postal_code'] ?>,<br>
|
||||
<?= '<b>GSTNO: </b>' ?><br>
|
||||
<?= '<b>State Name: </b>'.$job_card[0]['billing_state'] ?><br>
|
||||
<?= '<b>GST: </b>' ?><br>
|
||||
<?= '<b>State: </b>'.$job_card[0]['billing_state'] ?><br>
|
||||
<?= '<b>Place of Supply: </b>'.$value['state'] ?></p>
|
||||
</td>
|
||||
|
||||
@ -177,18 +177,18 @@ p {
|
||||
<td>Invoice No.</td>
|
||||
<td><?= $job_card[0]['inv_no'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vehicle No</td>
|
||||
<td><?= $vehicle[0]['reg_no'] ?></td>
|
||||
</tr>
|
||||
<tr style="border: 1px solid black;">
|
||||
<td>Bike Name</td>
|
||||
<td>Model</td>
|
||||
<td><?= $vehicle[0]['bike_company'].' '.$vehicle[0]['bike_name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Color</td>
|
||||
<td><?= $vehicle[0]['colour'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vehicle No</td>
|
||||
<td><?= $vehicle[0]['reg_no'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Contact No</td>
|
||||
<td><?= $vehicle[0]['mobile_no'] ?></td>
|
||||
@ -203,11 +203,33 @@ p {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Delivery Date</td>
|
||||
<td>04/06/2024</td>
|
||||
<?php
|
||||
$deliveryDate = $job_card[0]['delivery_date'] ?? null;
|
||||
if ($deliveryDate) {
|
||||
$dateTime = DateTime::createFromFormat('Y-m-d', $deliveryDate);
|
||||
// print_r($dateTime->format('Y-m-d'));die;
|
||||
|
||||
if ($dateTime && $dateTime->format('Y-m-d') == $deliveryDate) {
|
||||
echo '<td>' . $dateTime->format('d/m/Y') . '</td>';
|
||||
} else {
|
||||
echo '<td> No Date Provided</td>';
|
||||
}
|
||||
} else {
|
||||
echo '<td>No Date Provided</td>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mode of Payment</td>
|
||||
<td>Online</td>
|
||||
<td>
|
||||
<?php
|
||||
if($job_card[0]['status'] == 'Created'){
|
||||
echo 'Payment Not Done';
|
||||
}else if($job_card[0]['status'] == 'Paid'){
|
||||
echo 'Online';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -219,16 +241,16 @@ p {
|
||||
<table class="invoice-related-table">
|
||||
<thead>
|
||||
<tr style="border: 1px solid black;">
|
||||
<th style="border: 0.5px solid black;">S no</th>
|
||||
<th style="border: 0.5px solid black;">Description Of Goods</th>
|
||||
<th style="border: 0.5px solid black;">Amount with Tax</th>
|
||||
<th style="border: 0.5px solid black;">Quantity</th>
|
||||
<th style="border: 0.5px solid black;">Per</th>
|
||||
<th style="border: 0.5px solid black;">GST</th>
|
||||
<th style="border: 0.5px solid black;">CGST Amount</th>
|
||||
<th style="border: 0.5px solid black;">SGST Amount</th>
|
||||
<th style="border: 0.5px solid black;">Total Tax</th>
|
||||
<th style="border: 0.5px solid black;">Total</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">S no</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">Description Of Goods</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">Amount with Tax</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">Quantity</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">Per</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">GST</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">CGST Amount</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">SGST Amount</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">Total Tax</th>
|
||||
<th style="border: 0.5px solid black;text-align: center;">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -237,11 +259,31 @@ p {
|
||||
$sub_tot = 0;
|
||||
$tax = 0;
|
||||
$tot = 0;
|
||||
$total_CGST = 0; $total_SGST = 0;
|
||||
?>
|
||||
|
||||
<?php foreach ($job_card_products as $item) : $totalamount = 0; ?>
|
||||
<tr>
|
||||
|
||||
<?php
|
||||
if(isset($item['custom_amount']))
|
||||
{
|
||||
$taxable_amount = $item['custom_amount'] * $item['qty'];
|
||||
$custum_tax = 18;
|
||||
|
||||
$cgst = ($taxable_amount * $custum_tax / 100 ) /2;
|
||||
$sgst = ($taxable_amount * $custum_tax / 100 ) /2;
|
||||
|
||||
|
||||
}else{
|
||||
$taxable_amount = $item['amount'] * $item['qty'];
|
||||
$custum_tax = (int)$item['tax'];
|
||||
|
||||
$cgst = ($taxable_amount * $custum_tax / 100 ) /2;
|
||||
$sgst = ($taxable_amount * $custum_tax / 100 ) /2;
|
||||
}
|
||||
$total_CGST += $cgst;
|
||||
$total_SGST += $sgst;
|
||||
?>
|
||||
<td style="border: 1px solid black;">
|
||||
<?= $serialNumber++; ?>
|
||||
</td>
|
||||
@ -265,28 +307,29 @@ p {
|
||||
} ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= $item['qty'] ?></td>
|
||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_amount']) ? '-' : $item['per'] ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= ($item['tax']) ?>%</td>
|
||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? ($item['custom_tax'] / 2) : ($item['amount'] * ($item['tax'] / 2) / 100) ?></td>
|
||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? ($item['custom_tax'] / 2) : ($item['amount'] * ($item['tax'] / 2) / 100) ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= $tax ?>%</td>
|
||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? ($item['custom_amount'] * $custum_tax / 2)/100 : ($item['amount'] * ($custum_tax / 2) / 100) ?></td>
|
||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? ($item['custom_amount'] * $custum_tax / 2)/100 : ($item['amount'] * ($custum_tax / 2) / 100) ?></td>
|
||||
<td style="border: 0.5px solid black;">
|
||||
<?php if(isset($item['custom_tax'])) {
|
||||
$custom_amount = str_replace(',', '', $item['custom_amount']);
|
||||
$custom_amount = floatval($custom_amount);
|
||||
|
||||
$result = round((($custom_amount * $item['qty']) * $item['tax'] / 100));
|
||||
$result = (($custom_amount * $item['qty']) * $custum_tax / 100);
|
||||
// $result = round((($custom_amount * $item['qty']) * $custum_tax / 100));
|
||||
|
||||
echo $result;
|
||||
|
||||
$tax += $result;
|
||||
} else {
|
||||
echo ( ($item['amount']* $item['qty']) * $item['tax'] / 100);
|
||||
$tax+= ( ($item['amount']* $item['qty']) * $item['tax'] / 100);
|
||||
echo ( ($item['amount']* $item['qty']) * $custum_tax / 100);
|
||||
$tax+= ( ($item['amount']* $item['qty']) * $custum_tax / 100);
|
||||
} ?></td>
|
||||
<?php
|
||||
// Sanitize and convert custom_amount and amount
|
||||
$custom_amount = isset($item['custom_amount']) ? floatval(str_replace(',', '', $item['custom_amount'])) : 0;
|
||||
$amount = isset($item['amount']) ? floatval(str_replace(',', '', $item['amount'])) : 0;
|
||||
$tax = isset($item['tax']) ? floatval($item['tax']) : 0;
|
||||
$tax = isset($custum_tax) ? floatval($custum_tax) : 0;
|
||||
$qty = isset($item['qty']) ? intval($item['qty']) : 0;
|
||||
|
||||
// Calculate the custom total
|
||||
@ -303,23 +346,25 @@ p {
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td colspan="6" style="border-top: 0.5px solid black;border-left: 0.5px solid black;"></td>
|
||||
<td colspan="3" style="text-align:center;border: 0.5px solid black;">Subtotal</td>
|
||||
<td colspan="3" style="text-align:center;border: 0.5px solid black;">Sub Total</td>
|
||||
<td style="border: 0.5px solid black;"><?= round($sub_tot) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" style="border-left: 0.5px solid black;"></td>
|
||||
<td colspan="3" style="text-align:center;border: 0.5px solid black;">CGST</td>
|
||||
<td style="border: 0.5px solid black;"><?= round($tax) / 2 ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= round($total_CGST); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" style="border-left: 0.5px solid black;"></td>
|
||||
<td colspan="3" style="text-align:center;border: 0.5px solid black;">SGST</td>
|
||||
<td style="border: 0.5px solid black;"><?= round($tax) / 2 ?></td>
|
||||
<td style="border: 0.5px solid black;"><?= round($total_SGST); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- $estimate = isset($item['custom_tax']) ? ($item['custom_amount'] * 18 )/100 : 0; ?> -->
|
||||
<?php $estimate = $sub_tot + $total_CGST + $total_SGST ?>
|
||||
<td colspan="6" style="border-left: 0.5px solid black;"></td>
|
||||
<td colspan="3" style="text-align:center;border: 0.5px solid black;">Estimate</td>
|
||||
<td style="border: 0.5px solid black;"><?php echo ($job_card[0]['is_rework'] == 1) ? 0 : round($sub_tot + $tax) ?></td>
|
||||
<td style="border: 0.5px solid black;"><?php echo ($job_card[0]['is_rework'] == 1) ? 0 : round( $estimate) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" style="border-left: 0.5px solid black;"></td>
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form id="form-submit" action="<?= base_url() . "add_jobs"; ?>" method="post" style="line-height:0.5;">
|
||||
<input type="hidden" id="product_response" name="products" value="">
|
||||
<input type="hidden" id="delete_items" name="delete_items" value="">
|
||||
<input type="hidden" id="issued_items" name="issued_items" value="">
|
||||
<!-- <h4 class="header-title">Sales Order Details :</h4><br> -->
|
||||
<input type="hidden" id="product_response" name="products" value="">
|
||||
<input type="hidden" id="delete_items" name="delete_items" value="">
|
||||
<input type="hidden" id="issued_items" name="issued_items" value="">
|
||||
<!-- <h4 class="header-title">Sales Order Details :</h4><br> -->
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
@ -105,21 +105,23 @@
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Status<span class="text-danger">*</span>(<?php echo isset($jobs['status']) ? $jobs['status'] : '' ?>)</label>
|
||||
<select class="form-control status-select" name="status" required data-toggle="select2">
|
||||
<?php if (isset($jobs['status']) && $jobs['status'] != ""): ?>
|
||||
<?php if ($jobs['status'] === 'Cancelled'): ?>
|
||||
<?php else: ?>
|
||||
<?php if(session()->get('logged_user_role') == 'Store Manager') { ?>
|
||||
<option value="Issued" <?= $jobs['status'] === 'Issued' ? 'selected' : '' ?>>Issued</option>
|
||||
<?php } else { ?>
|
||||
<option value="Issued" <?= $jobs['status'] === 'Issued' ? 'selected' : '' ?> disabled>Issued</option>
|
||||
<option value="Created" <?= $jobs['status'] === 'Created' ? 'selected' : '' ?>>Created</option>
|
||||
<option value="Paid" <?= $jobs['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option>
|
||||
<option value="Cancelled" <?= $jobs['status'] === 'Cancelled' ? 'selected' : '' ?>>Cancelled</option>
|
||||
<?php } ?>
|
||||
<select class="form-control status-select status_class_for_change" name="status" required data-toggle="select2">
|
||||
<?php if (isset($jobs['status'])): ?>
|
||||
<?php if ($jobs['status'] === 'Cancelled'): ?>
|
||||
|
||||
<option value="Created" <?= $jobs['status'] === 'Created' ? 'selected' : '' ?>>Created </option>
|
||||
<option value="Paid" <?= $jobs['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<option value>Select Status</option>
|
||||
<option value="Paid" <?= $jobs['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option>
|
||||
<option value="Cancelled" <?= $jobs['status'] === 'Cancelled' ? 'selected' : '' ?>>Cancelled</option>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<option value="Created">Created</option>
|
||||
<option value="Created" selected>Created</option>
|
||||
<!-- <option value="Paid">Paid</option> -->
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -141,10 +143,21 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Note<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control job_card_basic_details" name="note" placeholder="Note"value="<?= isset($jobs['note']) ? $jobs['note'] : '' ?>" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<?php if (isset($jobs['status']) && $jobs['status'] !== ''): ?>
|
||||
|
||||
<div class="form-group col-md-4" id="mode_of_payment_parent_div_id" <?= $jobs['status'] === 'Paid' ? '' : 'style="display:none;"' ?>>
|
||||
<label for="mode_of_payment" class="col-form-label">Mode Of Payment<span class="text-danger">*</span>
|
||||
<select class="form-control" name="mode_of_payment" id="mode_of_payment" >
|
||||
<option value>Select Mode Of Payment</option>
|
||||
<option value="online" <?= $jobs['mode_of_payment'] === 'online' ? 'selected' : '' ?> >Online</option>
|
||||
<option value="cash" <?= $jobs['mode_of_payment'] === 'cash' ? 'selected' : '' ?>>Cash</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="form-row" id="itemTableContainer">
|
||||
<div class="form-group col-md-12">
|
||||
@ -223,8 +236,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ((isset($jobs['status']) && $jobs['status'] != 'Cancelled') || !isset($jobs['status'])) : ?>
|
||||
<button type="submit" id="submit-btn" class="btn btn-primary">Submit</button>
|
||||
|
||||
<?php if (!isset($jobs['status']) || $jobs['status'] !== 'Paid') : ?>
|
||||
<button type="submit" id="submit-btn" class="btn btn-primary">Submit</button>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($rework) && $rework = 'Paid') : ?>
|
||||
<button type="submit" id="submit-btn" class="btn btn-primary">Submit</button>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
@ -531,8 +548,8 @@ $(document).ready(async function() {
|
||||
function editlabourcost(data,cls) {
|
||||
console.log(data.labour_cost,'data.labour_cost');
|
||||
<?php if(isset($rework)) { ?> data.labour_cost = 0; <?php } ?>
|
||||
total_wih_tax = Number(data.labour_cost) + (Number(data.labour_cost) * (data.tax / 100));
|
||||
total_tax_amt = Number(data.labour_cost) * (data.tax / 100);
|
||||
total_wih_tax = Number(data.labour_cost) + (Number(data.labour_cost) * (18 / 100));
|
||||
total_tax_amt = Number(data.labour_cost) * (18 / 100);
|
||||
|
||||
|
||||
var newRow = '<tr class="'+cls+'"><td hidden><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fas fa-user-alt" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" readonly value="Labour Cost"></td>' +
|
||||
@ -542,7 +559,7 @@ $(document).ready(async function() {
|
||||
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
|
||||
newRow += '<td><input type="text" readonly value="NIL" type="number" class="form-control"/></td>';
|
||||
<?php } ?>
|
||||
newRow += '<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+data.tax+'" readonly /></td>' +
|
||||
newRow += '<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+18+'" readonly /></td>' +
|
||||
'<td><input type="text" class="form-control total-tax-amount" value="'+total_tax_amt.toFixed(2)+'" readonly /></td>' +
|
||||
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + Math.round(total_wih_tax).toFixed(2) + '" onblur="floatInput(event)" /></td>' +
|
||||
'<td hidden></td>' +
|
||||
@ -1349,13 +1366,13 @@ $(document).ready(function() {
|
||||
const labourcost = async (cost,tax,tr,cls) => {
|
||||
console.log(cost,tax,tr,cls);
|
||||
console.log('cost,tax,tr,cls');
|
||||
total_wih_tax = Number(cost) + (Number(cost) * (tax / 100));
|
||||
total_tax_amt = Number(cost) * (tax / 100);
|
||||
total_wih_tax = Number(cost) + (Number(cost) * (18 / 100));
|
||||
total_tax_amt = Number(cost) * (18 / 100);
|
||||
var newRow = '<tr class="'+cls+'"><td hidden><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fas fa-user-alt" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" readonly value="Labour Cost"></td>' +
|
||||
'<td><input type="text" class="form-control rate-d-only" value="'+Number(cost)+'" readonly /></td>' +
|
||||
'<td hidden><input type="text" class="form-control item-rate" name="unit-price[]" value="'+Number(cost)+'" /></td>' +
|
||||
'<td><input type="number" class="form-control item-quantity-'+cls+' item-quantity" min="0" name="quantity[]" value="'+1+'" /></td>' +
|
||||
'<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+tax+'" /></td>' +
|
||||
'<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+18+'" /></td>' +
|
||||
'<td><input type="text" class="form-control total-tax-amount" value="'+Number(total_tax_amt).toFixed(2)+'" readonly /></td>' +
|
||||
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + Math.round(total_wih_tax).toFixed(2) + '" onblur="floatInput(event)" /></td>' +
|
||||
'<td hidden></td>' +
|
||||
@ -2191,6 +2208,18 @@ $closestTR.remove();
|
||||
$('#create-clientMobile').val('');
|
||||
$('#create-clientType').val('');
|
||||
});
|
||||
|
||||
$('.status_class_for_change').change(function (params) {
|
||||
|
||||
if($(this).val() === 'Paid'){
|
||||
$('#mode_of_payment_parent_div_id').css('display','');
|
||||
$('#mode_of_payment').prop('required','required');
|
||||
}else{
|
||||
$('#mode_of_payment_parent_div_id').css('display','none');
|
||||
$('#mode_of_payment').removeAttr('required');
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($jobs as $index => $value) : if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<tr class="job_tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['client_name']; ?><br><?= $value['client_mobile_no']; ?></td>
|
||||
@ -84,7 +84,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 href="<?= "new_jobcard/" . $value['job_card_id']; ?>" class="dropdown-item edit-button" onclick="datatableJobCard('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "new_jobcard/" . $value['job_card_id']; ?>" class="dropdown-item edit-button" onclick="datatableJobCard('job_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
|
||||
<?php if($admins) { ?>
|
||||
<a href="<?= "download_jobcard_invoice/" . $value['job_card_id']; ?>" class="dropdown-item edit-button"><i class="ri-download-2-fill mr-2 text-muted font-18 vertical-middle"></i>Download Invoice</a>
|
||||
@ -122,7 +122,7 @@
|
||||
var datatable_jobcard ='';
|
||||
$(document).ready(function() {
|
||||
datatable_jobcard= $('#datatable-jobcard').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"order": [[0, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
@ -151,14 +151,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_jobcard.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($make as $index => $item): ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<tr class="make_tr_<?php echo $index+1; ?>">
|
||||
<td class="make"><?php echo $item['make']; ?></td>
|
||||
<td>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
@ -45,17 +45,17 @@
|
||||
<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" data-value="<?php echo $item['make_id']; ?>" class="dropdown-item edit-button" onclick="editMake(this), datatableMake('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" class="dropdown-item add-button" title="Add" data-id="<?php echo $item['make_id']; ?>" data-value="<?php echo $item['make']; ?>" onclick="setMakeName(this), dataTableMake('tr_<?php echo $index+1; ?>')">
|
||||
<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="<?php echo $item['make_id']; ?>" class="dropdown-item edit-button" onclick="editMake(this), datatableMake('make_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" class="dropdown-item add-button" title="Add" data-id="<?php echo $item['make_id']; ?>" data-value="<?php echo $item['make']; ?>" onclick="setMakeName(this), dataTableMake('make_tr_<?php echo $index+1; ?>')">
|
||||
<i class="ri-add-line mr-2 text-muted font-18 vertical-middle" ></i>Add Model
|
||||
</a>
|
||||
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="dropdown-item view-list-button" title="Model List" onclick="datatableMake('tr_<?php echo $index+1; ?>')">
|
||||
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="dropdown-item view-list-button" title="Model List" onclick="datatableMake('make_tr_<?php echo $index+1; ?>')">
|
||||
<i class="ri-list-check-2 mr-2 text-muted font-18 vertical-middle"></i>Model List
|
||||
</a>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableMake('tr_<?php echo $index+1; ?>')" ><i class="fa fa-bicycle " style="font-size:20px"></i><i class="fa fa-times" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableMake('make_tr_<?php echo $index+1; ?>')" ><i class="fa fa-bicycle " style="font-size:20px"></i><i class="fa fa-times" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableMake('tr_<?php echo $index+1; ?>')" ><i class="fa fa-bicycle" style="font-size:20px"></i>Activate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableMake('make_tr_<?php echo $index+1; ?>')" ><i class="fa fa-bicycle" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
@ -328,14 +328,24 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_make.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
|
||||
@ -29,22 +29,28 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($manufacturer as $index => $item): ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<?php foreach ($manufacturer as $index => $item):
|
||||
$color = '';
|
||||
if($item['isactive'] == 0){
|
||||
$color ='red';
|
||||
}?>
|
||||
<tr class="manufacturer_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
|
||||
<td class="manufacturer_name"><?php echo $item['manufacturer_name']; ?></td>
|
||||
<td class="quality"><?php echo $item['quality']; ?></td>
|
||||
<td>
|
||||
<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="#manufacturer_modal" data-value="<?php echo $item['manufacturer_id']; ?>" class="dropdown-item edit-button" onclick="editManufacturer(this), datatableManufacturer('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" ></i>Edit</a>
|
||||
<a href="<?= "product_index/" . $item['manufacturer_id']; ?>" class="dropdown-item view-list-button" title="Model List" onclick="datatableManufacturer('tr_<?php echo $index+1; ?>')">
|
||||
<i class="ri-list-check-2 mr-2 text-muted font-18 vertical-middle" ></i>Product List
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<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">
|
||||
<?php if($item['isactive'] == 1){ ?>
|
||||
<a data-toggle="modal" data-target="#manufacturer_modal" data-value="<?php echo $item['manufacturer_id']; ?>" class="dropdown-item edit-button" onclick="editManufacturer(this), datatableManufacturer('manufacturer_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" ></i>Edit</a>
|
||||
<a href="<?= "product_index/" . $item['manufacturer_id']; ?>" class="dropdown-item view-list-button" title="Model List" onclick="datatableManufacturer('manufacturer_tr_<?php echo $index+1; ?>')">
|
||||
<i class="ri-list-check-2 mr-2 text-muted font-18 vertical-middle" ></i>Product List
|
||||
</a> <?php } if($item['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['manufacturer_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableManufacturer('manufacturer_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user " style="font-size:20px"></i><i class="fa fa-times mr-2" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['manufacturer_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableManufacturer('manufacturer_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@ -186,14 +192,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_manufacturer.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
@ -209,4 +224,39 @@
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var manufacturer_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
manufacturer_id: manufacturer_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_manufacturer"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -29,8 +29,12 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($out_source as $index => $value) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<?php foreach ($out_source as $index => $value) :
|
||||
$color = '';
|
||||
if($value['is_active'] == 0){
|
||||
$color ='red';
|
||||
}?>
|
||||
<tr class="outsource_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
|
||||
<td><?= $value['name']; ?></td>
|
||||
<td><?= $value['tax']; ?></td>
|
||||
<td><?= $value['cost_with_tax']; ?></td>
|
||||
@ -47,9 +51,13 @@
|
||||
<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="#os-add-modal" data-value="<?php echo $value['id']; ?>" onclick="editOS(this), datatableOutSource('tr_<?php echo $index+1; ?>')" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_outsource/" . $value['id']; ?>" class="dropdown-item delete-button" onclick="datatableOutSource('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
<?php if($value['is_active'] == 1){ ?>
|
||||
<a data-toggle="modal" data-target="#os-add-modal" data-value="<?php echo $value['id']; ?>" onclick="editOS(this), datatableOutSource('outsource_tr_<?php echo $index+1; ?>')" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></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), datatableOutSource('outsource_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user " style="font-size:20px"></i><i class="fa fa-times mr-2" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Activate" onclick="statusChange(this), datatableOutSource('outsource_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -235,14 +243,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_outsource.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
@ -259,4 +276,39 @@
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var outsource_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
outsource_id: outsource_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_outsource"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -85,8 +85,12 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($products as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
if ($value) :
|
||||
$color = '';
|
||||
if($value['isactive'] == 0){
|
||||
$color ='red';
|
||||
}?>
|
||||
<tr class="product_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
|
||||
<td><?= $value['sku_id']; ?></td>
|
||||
<td><?= $value['product_name']; ?></td>
|
||||
<td><?= $value['manufacturer_name']; ?></td>
|
||||
@ -97,13 +101,17 @@
|
||||
<!-- Call the model method -->
|
||||
<?php if(!$manufacturer_id) { ?>
|
||||
<td>
|
||||
<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 href="<?= "new_product/" . $value['product_id']; ?>" class="dropdown-item edit-button" onclick="setSessionPagination('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_product/" . $value['product_id']; ?>" class="dropdown-item delete-button" onclick="setSessionPagination('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<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">
|
||||
<?php if($value['isactive'] == 1){ ?>
|
||||
<a href="<?= "new_product/" . $value['product_id']; ?>" class="dropdown-item edit-button" onclick="setSessionPagination('product_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<?php } if($value['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['product_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Deactivate" onclick="statusChange(this), setSessionPagination('product_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user " style="font-size:20px"></i><i class="fa fa-times mr-2" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['product_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this), setSessionPagination('product_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php endif?>
|
||||
@ -150,14 +158,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
data_table_set.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
@ -207,12 +224,43 @@
|
||||
});
|
||||
|
||||
function setSessionPagination(value) {
|
||||
var currentPage = data_table_set.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
}
|
||||
|
||||
console.log(value);
|
||||
var currentPage = data_table_set.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var product_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
}
|
||||
var formData = {
|
||||
product_id: product_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_product"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
|
||||
<?php foreach ($purchase as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1;?>">
|
||||
<tr class="purchase_tr_<?php echo $index+1;?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<td><?= date('j F Y', strtotime($value['order_date'])); ?></td>
|
||||
@ -93,12 +93,12 @@
|
||||
<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 href="<?= "new_purchase/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line"></i>Edit</a>
|
||||
<a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line"></i>Delete</a>
|
||||
<a href="<?= "new_purchase/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item" onclick="datatablePurchaseOrder('purchase_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line"></i>Edit</a>
|
||||
<a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button dropdown-item" onclick="datatablePurchaseOrder('purchase_tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line"></i>Delete</a>
|
||||
<?php if($value['status'] != "PO Issued") { ?>
|
||||
<a href="<?= "reorder_purchase/" . $value['purchase_order_id']; ?>" class="dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="fa fa-retweet"></i>Pending Reorder</a>
|
||||
<a href="<?= "reorder_purchase/" . $value['purchase_order_id']; ?>" class="dropdown-item" onclick="datatablePurchaseOrder('purchase_tr_<?php echo $index+1; ?>')"><i class="fa fa-retweet"></i>Pending Reorder</a>
|
||||
<?php } ?>
|
||||
<a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="ri-download-2-fill"></i>Download</a>
|
||||
<a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item" onclick="datatablePurchaseOrder('purchase_tr_<?php echo $index+1; ?>')"><i class="ri-download-2-fill"></i>Download</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -122,7 +122,7 @@
|
||||
var datatable_purchase_order ='';
|
||||
$(document).ready(function() {
|
||||
datatable_purchase_order = $('#datatable-purchase-order').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"order": [[0, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
@ -151,14 +151,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_purchase_order.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($return_order as $index => $value) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<tr class="return_tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<td><?= $value['order_date']; ?></td>
|
||||
@ -77,7 +77,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 href="<?= "edit_return_order/" . $value['return_order_id']; ?>" class="dropdown-item edit-button" title="Return" onclick="datatableReturnList('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "edit_return_order/" . $value['return_order_id']; ?>" class="dropdown-item edit-button" title="Return" onclick="datatableReturnList('return_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -129,14 +129,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_return_list.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
@ -70,44 +70,41 @@
|
||||
|
||||
|
||||
foreach ($sales as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="sale_tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
|
||||
<td><?= $value['product_count']; ?></td>
|
||||
<td><?= $value['product_qty']; ?></td>
|
||||
|
||||
<td><?= $value['total']; ?></td>
|
||||
<td class="<?php
|
||||
if ($value['status'] == 'Cancelled') {
|
||||
echo 'cancelled-status';
|
||||
} elseif ($value['status'] == 'Created') {
|
||||
echo 'created-status';
|
||||
} elseif ($value['status'] == 'Paid') {
|
||||
echo 'paid-status';
|
||||
}
|
||||
?>">
|
||||
<?= $value['status']; ?>
|
||||
</td>
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
|
||||
<td><?= $value['product_count']; ?></td>
|
||||
<td><?= $value['product_qty']; ?></td>
|
||||
|
||||
<td><?= $value['total']; ?></td>
|
||||
<td class="<?php
|
||||
if ($value['status'] == 'Cancelled') {
|
||||
echo 'cancelled-status';
|
||||
} elseif ($value['status'] == 'Created') {
|
||||
echo 'created-status';
|
||||
} elseif ($value['status'] == 'Paid') {
|
||||
echo 'paid-status';
|
||||
}
|
||||
?>">
|
||||
<?= $value['status']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<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 href="<?= "new_sale/" . $value['sales_order_id']; ?>" class="dropdown-item edit-button" onclick="datatableSalesOrder('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_sale/" . $value['sales_order_id']; ?>" class="dropdown-item delete-button" onclick="datatableSalesOrder('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="<?= "download_invoice/" . $value['sales_order_id']; ?>" class="dropdown-item edit-button"><i class="ri-download-2-fill mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
<?php endif?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tr>
|
||||
<td>
|
||||
<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 href="<?= "new_sale/" . $value['sales_order_id']; ?>" class="dropdown-item edit-button" onclick="datatableSalesOrder('sale_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_sale/" . $value['sales_order_id']; ?>" class="dropdown-item delete-button" onclick="datatableSalesOrder('sale_tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="<?= "download_invoice/" . $value['sales_order_id']; ?>" class="dropdown-item edit-button"><i class="ri-download-2-fill mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif?>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
@ -126,7 +123,7 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_sales_order = $('#datatable-sales-order').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"order": [[0, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
@ -155,15 +152,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_sales_order.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
// $('.'+hightlight_tr).css('background','#d2f9fa');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
|
||||
@ -31,8 +31,12 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($services as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
if ($value) :
|
||||
$color = '';
|
||||
if($value['isactive'] == 0){
|
||||
$color ='red';
|
||||
}?>
|
||||
<tr class="service_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
|
||||
<td><?= $value['service_name']; ?></td>
|
||||
<td><?= $value['price']; ?></td>
|
||||
<td><?= $value['cgst'] + $value['sgst']; ?></td>
|
||||
@ -41,9 +45,13 @@
|
||||
<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 href="<?= "new_service/" . $value['service_id']; ?>" class="dropdown-item edit-button" onclick="datatableService('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_service/" . $value['service_id']; ?>" class="dropdown-item delete-button" onclick="datatableService('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" ></i>Delete</a>
|
||||
</div>
|
||||
<?php if($value['isactive'] == 1){ ?>
|
||||
<a href="<?= "new_service/" . $value['service_id']; ?>" class="dropdown-item edit-button" onclick="datatableService('service_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<?php } if($value['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableService('service_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user " style="font-size:20px"></i><i class="fa fa-times mr-2" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableService('service_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -94,14 +102,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_service.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
@ -117,4 +134,39 @@
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var service_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
service_id: service_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_service"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -50,6 +50,11 @@
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
</div>
|
||||
<div class="form-group col-md-7">
|
||||
<h5 class="text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Personal Info</h5>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputEmail4" class="col-form-label">Name</label>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name" value="<?= isset($users['name']) ? $users['name'] : '' ?>" required>
|
||||
@ -68,11 +73,62 @@
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="user_id" name="user_id" value="<?= isset($users['user_id']) ? $users['user_id'] : '' ?>">
|
||||
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<di class="col-md-12">
|
||||
<button type="submit" style="float: inline-end;" class="btn btn-primary">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="password_change card-body">
|
||||
<div class="form-group col-md-7">
|
||||
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Change Password</h5>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="old_password">Old Password</label>
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" id="old_password" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">
|
||||
<i class="fa fa-eye" id="toggleOldPassword"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="new_password">New Password</label>
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" id="new_password" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">
|
||||
<i class="fa fa-eye" id="toggleNewPassword"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="confirm_password">Confirm Password</label>
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" id="confirm_password" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">
|
||||
<i class="fa fa-eye" id="toggleConfirmPassword"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6" style="margin-top: 27px;">
|
||||
<button type="submit" class="btn btn-primary" id="submit_password" style="float: inline-end;" onclick="changePassword(this)">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -109,12 +165,112 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var user_id = "<?php echo isset($user_id); ?>";
|
||||
var user_id = "<?php echo $user_id; ?>";
|
||||
|
||||
|
||||
if (user_id) {
|
||||
if (user_id != 0) {
|
||||
$('#password').prop('required' ,false);
|
||||
$('#password').parent().hide();
|
||||
}else{
|
||||
$('.password_change').hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function changePassword(params) {
|
||||
|
||||
|
||||
var formData = {
|
||||
old_password: $('#old_password').val(),
|
||||
new_password: $('#new_password').val(),
|
||||
confirm_password: $('#confirm_password').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."change_password/"?>' + user_id,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.status == 'error') {
|
||||
toastr.warning(response.message, 'Warning');
|
||||
}else{
|
||||
toastr.success(response.message, 'Success');
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var oldPasswordField = document.getElementById("old_password");
|
||||
var toggleOldPassword = document.getElementById("toggleOldPassword");
|
||||
|
||||
var newPasswordField = document.getElementById("new_password");
|
||||
var toggleNewPassword = document.getElementById("toggleNewPassword");
|
||||
|
||||
var confirmField = document.getElementById("confirm_password");
|
||||
var toggleConfirmPassword = document.getElementById("toggleConfirmPassword");
|
||||
|
||||
toggleOldPassword.addEventListener("click", function() {
|
||||
togglePasswordVisibility(oldPasswordField, toggleOldPassword);
|
||||
});
|
||||
|
||||
toggleNewPassword.addEventListener("click", function() {
|
||||
togglePasswordVisibility(newPasswordField, toggleNewPassword);
|
||||
});
|
||||
|
||||
toggleConfirmPassword.addEventListener("click", function() {
|
||||
togglePasswordVisibility(confirmField, toggleConfirmPassword);
|
||||
});
|
||||
|
||||
function togglePasswordVisibility(field, toggle) {
|
||||
if (field.type === "password") {
|
||||
field.type = "text";
|
||||
toggle.className = "fa fa-eye-slash";
|
||||
} else {
|
||||
field.type = "password";
|
||||
toggle.className = "fa fa-eye";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var oldPasswordField = document.getElementById('old_password');
|
||||
var newPasswordField = document.getElementById('new_password');
|
||||
var confirmPasswordField = document.getElementById('confirm_password');
|
||||
var submitButton = document.getElementById('submit_password');
|
||||
|
||||
// Function to validate the password fields
|
||||
function validatePasswords() {
|
||||
var oldPassword = oldPasswordField.value;
|
||||
var newPassword = newPasswordField.value;
|
||||
var confirmPassword = confirmPasswordField.value;
|
||||
|
||||
if(oldPassword !== newPassword && newPassword !== ''){
|
||||
console.log(oldPassword);
|
||||
console.log(newPassword);
|
||||
console.log(confirmPassword);
|
||||
if (newPassword === confirmPassword) {
|
||||
submitButton.disabled = false;
|
||||
} else {
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
}else{
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add event listeners to all relevant fields
|
||||
oldPasswordField.addEventListener('input', validatePasswords);
|
||||
newPasswordField.addEventListener('input', validatePasswords);
|
||||
confirmPasswordField.addEventListener('input', validatePasswords);
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -43,8 +43,14 @@
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($users as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
if ($value) :
|
||||
$color = '';
|
||||
if($value['isactive'] == 0){
|
||||
$color ='red';
|
||||
}
|
||||
?>
|
||||
|
||||
<tr class="user_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
|
||||
|
||||
<td><?= $value['name']; ?></td>
|
||||
<td><?= $value['email']; ?></td>
|
||||
@ -54,10 +60,15 @@
|
||||
<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 href="<?= "new_user/" . $value['user_id']; ?>" class="dropdown-item edit-button" onclick="datatableUser('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_user/" . $value['user_id']; ?>" class="dropdown-item delete-button" onclick="datatableUser('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
<?php if($value['isactive'] == 1){ ?>
|
||||
<a href="<?= "new_user/" . $value['user_id']; ?>" class="dropdown-item edit-button" onclick="datatableUser('user_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<?php } if($value['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['user_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableUser('user_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user" style="font-size:20px"></i><i class="fa fa-times mr-2 " style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['user_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableUser('user_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2 text-muted font-18 vertical-middle" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
<?php endif?>
|
||||
@ -108,14 +119,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_user.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
@ -132,4 +152,41 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var user_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
user_id: user_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_user"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -33,28 +33,33 @@
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($vehicle as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['make_name'].' '.$value['model_name']; ?></td>
|
||||
<td><?= $value['year_of_manufacturing']; ?></td>
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
<td><?= $value['mobile_no']; ?></td>
|
||||
<td>
|
||||
<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 href="<?= "new_vehicle/" . $value['vehicle_id']; ?>" class="dropdown-item edit-button" onclick="datatableVehicle('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_vehicle/" . $value['vehicle_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
<?php endif?>
|
||||
<?php endforeach; ?>
|
||||
$color = '';
|
||||
if($value['isactive'] == 0){
|
||||
$color ='red';
|
||||
}?>
|
||||
<tr class="vehicle_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['make_name'].' '.$value['model_name']; ?></td>
|
||||
<td><?= $value['year_of_manufacturing']; ?></td>
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
<td><?= $value['mobile_no']; ?></td>
|
||||
<td>
|
||||
<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">
|
||||
<?php if($value['isactive'] == 1){ ?>
|
||||
<a href="<?= "new_vehicle/" . $value['vehicle_id']; ?>" class="dropdown-item edit-button" onclick="datatableVehicle('vehicle_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<?php } if($value['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['vehicle_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableVehicle('vehicle_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user " style="font-size:20px"></i><i class="fa fa-times mr-2" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['vehicle_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableVehicle('vehicle_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
@ -101,14 +106,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_vehicle.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
@ -125,4 +139,38 @@
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var vehicle_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
vehicle_id: vehicle_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_vehicle"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -37,20 +37,28 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($vendor as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<?php foreach ($vendor as $index => $value) :
|
||||
if ($value) :
|
||||
$color = '';
|
||||
if($value['isactive'] == 0){
|
||||
$color ='red';
|
||||
}
|
||||
?>
|
||||
<tr class="vendor_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<td><?= $value['contact_person_mobile1']; ?></td>
|
||||
<td><?= $value['category']; ?></td> <!-- Call the model method -->
|
||||
<td>
|
||||
<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 href="<?= "new_vendor/" . $value['vendor_id']; ?>" class="dropdown-item edit-button" onclick="datatableVendor('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" style="font-size:20px;"></i>Edit</a>
|
||||
<a href="<?= "delete_vendor/" . $value['vendor_id']; ?>" class="dropdown-item delete-button"> <i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" style="font-size:20px;"></i>Delete</a>
|
||||
</div>
|
||||
<?php if($value['isactive'] == 1){ ?>
|
||||
<a href="<?= "new_vendor/" . $value['vendor_id']; ?>" class="dropdown-item edit-button" onclick="datatableVendor('vendor_tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" style="font-size:20px;"></i>Edit</a>
|
||||
<?php } if($value['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['vendor_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableVendor('vendor_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user" style="font-size:20px"></i><i class="fa fa-times mr-2 " style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['vendor_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableVendor('vendor_tr_<?php echo $index+1; ?>')" ><i class="fa fa-user mr-2 text-muted font-18 vertical-middle" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@ -101,14 +109,23 @@
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_vendor.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
|
||||
// Select the highlighted row
|
||||
var $row = $('.' + hightlight_tr);
|
||||
|
||||
// Smoothly scroll to the row and center it in the viewport
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
|
||||
}, 500, function() {
|
||||
|
||||
// After focusing, change background color
|
||||
$row.css('background', '#faf6ca');
|
||||
|
||||
// Remove background color after 4 seconds
|
||||
setTimeout(function() {
|
||||
$row.css('background', '');
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
@ -124,4 +141,42 @@
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var vendor_id = params.getAttribute('data-id');
|
||||
if(status == 1){
|
||||
var isactive= 0;
|
||||
}else{
|
||||
var isactive= 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
vendor_id: vendor_id,
|
||||
isactive: isactive
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."status_vendor"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.status == "success") {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user