you don't have edit_warranty in your form
also, take 2 minutes to learn how to format your question
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
public function store(Request $request) { $data = $request->all(); if(isset($request->reference_no)) { $this->validate($request, [ 'reference_no' => [ 'max:191', 'required', 'unique:sales' ], ]); }
$data['user_id'] = Auth::id();
$cash_register_data = CashRegister::where([
['user_id', $data['user_id']],
['warehouse_id', $data['warehouse_id']],
['status', true]
])->first();
if($cash_register_data)
$data['cash_register_id'] = $cash_register_data->id;
if(isset($data['created_at']))
$data['created_at'] = date("Y-m-d H:i:s", strtotime($data['created_at']));
else
$data['created_at'] = date("Y-m-d H:i:s");
//return dd($data);
if($data['pos']) {
if(!isset($data['reference_no']))
$data['reference_no'] = 'posr-' . date("Ymd") . '-'. date("his");
$balance = $data['grand_total'] - $data['paid_amount'];
if($balance > 0 || $balance < 0)
$data['payment_status'] = 2;
else
$data['payment_status'] = 4;
if($data['draft']) {
$lims_sale_data = Sale::find($data['sale_id']);
$lims_product_sale_data = Product_Sale::where('sale_id', $data['sale_id'])->get();
foreach ($lims_product_sale_data as $product_sale_data) {
$product_sale_data->delete();
}
$lims_sale_data->delete();
}
}
else {
if(!isset($data['reference_no']))
$data['reference_no'] = 'sr-' . date("Ymd") . '-'. date("his");
}
$document = $request->document;
if ($document) {
$v = Validator::make(
[
'extension' => strtolower($request->document->getClientOriginalExtension()),
],
[
'extension' => 'in:jpg,jpeg,png,gif,pdf,csv,docx,xlsx,txt',
]
);
if ($v->fails())
return redirect()->back()->withErrors($v->errors());
$documentName = $document->getClientOriginalName();
$document->move('public/sale/documents', $documentName);
$data['document'] = $documentName;
}
if($data['coupon_active']) {
$lims_coupon_data = Coupon::find($data['coupon_id']);
$lims_coupon_data->used += 1;
$lims_coupon_data->save();
}
$lims_sale_data = Sale::create($data);
$lims_customer_data = Customer::find($data['customer_id']);
$lims_reward_point_setting_data = RewardPointSetting::latest()->first();
//checking if customer gets some points or not
if($lims_reward_point_setting_data->is_active && $data['grand_total'] >= $lims_reward_point_setting_data->minimum_amount) {
$point = (int)($data['grand_total'] / $lims_reward_point_setting_data->per_point_amount);
$lims_customer_data->points += $point;
$lims_customer_data->save();
}
//collecting male data
$mail_data['email'] = $lims_customer_data->email;
$mail_data['reference_no'] = $lims_sale_data->reference_no;
$mail_data['sale_status'] = $lims_sale_data->sale_status;
$mail_data['payment_status'] = $lims_sale_data->payment_status;
$mail_data['total_qty'] = $lims_sale_data->total_qty;
$mail_data['total_price'] = $lims_sale_data->total_price;
$mail_data['order_tax'] = $lims_sale_data->order_tax;
$mail_data['order_tax_rate'] = $lims_sale_data->order_tax_rate;
$mail_data['order_discount'] = $lims_sale_data->order_discount;
$mail_data['shipping_cost'] = $lims_sale_data->shipping_cost;
$mail_data['grand_total'] = $lims_sale_data->grand_total;
$mail_data['paid_amount'] = $lims_sale_data->paid_amount;
$product_id = $data['product_id'];
$product_batch_id = $data['product_batch_id'];
$imei_number = $data['imei_number'];
$product_code = $data['product_code'];
$qty = $data['qty'];
$sale_unit = $data['sale_unit'];
$net_unit_price = $data['net_unit_price'];
$discount = $data['discount'];
$tax_rate = $data['tax_rate'];
$tax = $data['tax'];
$total = $data['subtotal'];
$product_sale = [];
foreach ($product_id as $i => $id) {
$lims_product_data = Product::where('id', $id)->first();
$product_sale['variant_id'] = null;
$product_sale['product_batch_id'] = null;
if($lims_product_data->type == 'combo' && $data['sale_status'] == 1){
$product_list = explode(",", $lims_product_data->product_list);
$variant_list = explode(",", $lims_product_data->variant_list);
if($lims_product_data->variant_list)
$variant_list = explode(",", $lims_product_data->variant_list);
else
$variant_list = [];
$qty_list = explode(",", $lims_product_data->qty_list);
$price_list = explode(",", $lims_product_data->price_list);
foreach ($product_list as $key=>$child_id) {
$child_data = Product::find($child_id);
if(count($variant_list) && $variant_list[$key]) {
$child_product_variant_data = ProductVariant::where([
['product_id', $child_id],
['variant_id', $variant_list[$key]]
])->first();
$child_warehouse_data = Product_Warehouse::where([
['product_id', $child_id],
['variant_id', $variant_list[$key]],
['warehouse_id', $data['warehouse_id'] ],
])->first();
$child_product_variant_data->qty -= $qty[$i] * $qty_list[$key];
$child_product_variant_data->save();
}
else {
$child_warehouse_data = Product_Warehouse::where([
['product_id', $child_id],
['warehouse_id', $data['warehouse_id'] ],
])->first();
}
$child_data->qty -= $qty[$i] * $qty_list[$key];
$child_warehouse_data->qty -= $qty[$i] * $qty_list[$key];
$child_data->save();
$child_warehouse_data->save();
}
}
if($sale_unit[$i] != 'n/a') {
$lims_sale_unit_data = Unit::where('unit_name', $sale_unit[$i])->first();
$sale_unit_id = $lims_sale_unit_data->id;
if($lims_product_data->is_variant) {
$lims_product_variant_data = ProductVariant::select('id', 'variant_id', 'qty')->FindExactProductWithCode($id, $product_code[$i])->first();
$product_sale['variant_id'] = $lims_product_variant_data->variant_id;
}
if($lims_product_data->is_batch && $product_batch_id[$i]) {
$product_sale['product_batch_id'] = $product_batch_id[$i];
}
if($data['sale_status'] == 1) {
if($lims_sale_unit_data->operator == '*')
$quantity = $qty[$i] * $lims_sale_unit_data->operation_value;
elseif($lims_sale_unit_data->operator == '/')
$quantity = $qty[$i] / $lims_sale_unit_data->operation_value;
//deduct quantity
$lims_product_data->qty = $lims_product_data->qty - $quantity;
$lims_product_data->save();
//deduct product variant quantity if exist
if($lims_product_data->is_variant) {
$lims_product_variant_data->qty -= $quantity;
$lims_product_variant_data->save();
$lims_product_warehouse_data = Product_Warehouse::FindProductWithVariant($id, $lims_product_variant_data->variant_id, $data['warehouse_id'])->first();
}
elseif($product_batch_id[$i]) {
$lims_product_warehouse_data = Product_Warehouse::where([
['product_batch_id', $product_batch_id[$i] ],
['warehouse_id', $data['warehouse_id'] ]
])->first();
$lims_product_batch_data = ProductBatch::find($product_batch_id[$i]);
//deduct product batch quantity
$lims_product_batch_data->qty -= $quantity;
$lims_product_batch_data->save();
}
else {
$lims_product_warehouse_data = Product_Warehouse::FindProductWithoutVariant($id, $data['warehouse_id'])->first();
}
//deduct quantity from warehouse
$lims_product_warehouse_data->qty -= $quantity;
$lims_product_warehouse_data->save();
}
}
else
$sale_unit_id = 0;
if($product_sale['variant_id']) {
$variant_data = Variant::select('name')->find($product_sale['variant_id']);
$mail_data['products'][$i] = $lims_product_data->name . ' ['. $variant_data->name .']';
}
else
$mail_data['products'][$i] = $lims_product_data->name;
//deduct imei number if available
if($imei_number[$i]) {
$imei_numbers = explode(",", $imei_number[$i]);
$all_imei_numbers = explode(",", $lims_product_warehouse_data->imei_number);
foreach ($imei_numbers as $number) {
if (($j = array_search($number, $all_imei_numbers)) !== false) {
unset($all_imei_numbers[$j]);
}
}
$lims_product_warehouse_data->imei_number = implode(",", $all_imei_numbers);
$lims_product_warehouse_data->save();
}
if($lims_product_data->type == 'digital')
$mail_data['file'][$i] = url('/public/product/files').'/'.$lims_product_data->file;
else
$mail_data['file'][$i] = '';
if($sale_unit_id)
$mail_data['unit'][$i] = $lims_sale_unit_data->unit_code;
else
$mail_data['unit'][$i] = '';
$product_sale['sale_id'] = $lims_sale_data->id ;
$product_sale['product_id'] = $id;
$product_sale['imei_number'] = $imei_number[$i];
$product_sale['qty'] = $mail_data['qty'][$i] = $qty[$i];
$product_sale['sale_unit_id'] = $sale_unit_id;
$product_sale['net_unit_price'] = $net_unit_price[$i];
$product_sale['discount'] = $discount[$i];
$product_sale['tax_rate'] = $tax_rate[$i];
$product_sale['tax'] = $tax[$i];
$product_sale['total'] = $mail_data['total'][$i] = $total[$i];
$product_sale['edit_warranty'] = $data['edit_warranty'];
Product_Sale::create($product_sale);
}
if($data['sale_status'] == 3)
$message = 'Sale successfully added to draft';
else
$message = ' Sale created successfully';
if($mail_data['email'] && $data['sale_status'] == 1) {
try {
Mail::to($mail_data['email'])->send(new SaleDetails($mail_data));
}
catch(\Exception $e){
$message = ' Sale created successfully. Please setup your <a href="setting/mail_setting">mail setting</a> to send mail.';
}
}
if($data['payment_status'] == 3 || $data['payment_status'] == 4 || ($data['payment_status'] == 2 && $data['pos'] && $data['paid_amount'] > 0)) {
$lims_payment_data = new Payment();
$lims_payment_data->user_id = Auth::id();
if($data['paid_by_id'] == 1)
$paying_method = 'Cash';
elseif ($data['paid_by_id'] == 2) {
$paying_method = 'Gift Card';
}
elseif ($data['paid_by_id'] == 3)
$paying_method = 'Credit Card';
elseif ($data['paid_by_id'] == 4)
$paying_method = 'Cheque';
elseif ($data['paid_by_id'] == 5)
$paying_method = 'Paypal';
elseif($data['paid_by_id'] == 6)
$paying_method = 'Deposit';
elseif($data['paid_by_id'] == 7) {
$paying_method = 'Points';
$lims_payment_data->used_points = $data['used_points'];
}
if($cash_register_data)
$lims_payment_data->cash_register_id = $cash_register_data->id;
$lims_account_data = Account::where('is_default', true)->first();
$lims_payment_data->account_id = $lims_account_data->id;
$lims_payment_data->sale_id = $lims_sale_data->id;
$data['payment_reference'] = 'spr-'.date("Ymd").'-'.date("his");
$lims_payment_data->payment_reference = $data['payment_reference'];
$lims_payment_data->amount = $data['paid_amount'];
$lims_payment_data->change = $data['paying_amount'] - $data['paid_amount'];
$lims_payment_data->paying_method = $paying_method;
$lims_payment_data->payment_note = $data['payment_note'];
$lims_payment_data->save();
$lims_payment_data = Payment::latest()->first();
$data['payment_id'] = $lims_payment_data->id;
$lims_pos_setting_data = PosSetting::latest()->first();
if($paying_method == 'Credit Card' && (strlen($lims_pos_setting_data->stripe_public_key)>0) && (strlen($lims_pos_setting_data->stripe_secret_key )>0)){
Stripe::setApiKey($lims_pos_setting_data->stripe_secret_key);
$token = $data['stripeToken'];
$grand_total = $data['grand_total'];
$lims_payment_with_credit_card_data = PaymentWithCreditCard::where('customer_id', $data['customer_id'])->first();
if(!$lims_payment_with_credit_card_data) {
// Create a Customer:
$customer = \Stripe\Customer::create([
'source' => $token
]);
// Charge the Customer instead of the card:
$charge = \Stripe\Charge::create([
'amount' => $grand_total * 100,
'currency' => 'usd',
'customer' => $customer->id
]);
$data['customer_stripe_id'] = $customer->id;
}
else {
$customer_id =
$lims_payment_with_credit_card_data->customer_stripe_id;
$charge = \Stripe\Charge::create([
'amount' => $grand_total * 100,
'currency' => 'usd',
'customer' => $customer_id, // Previously stored, then retrieved
]);
$data['customer_stripe_id'] = $customer_id;
}
$data['charge_id'] = $charge->id;
PaymentWithCreditCard::create($data);
}
elseif ($paying_method == 'Gift Card') {
$lims_gift_card_data = GiftCard::find($data['gift_card_id']);
$lims_gift_card_data->expense += $data['paid_amount'];
$lims_gift_card_data->save();
PaymentWithGiftCard::create($data);
}
elseif ($paying_method == 'Cheque') {
PaymentWithCheque::create($data);
}
elseif ($paying_method == 'Paypal') {
$provider = new ExpressCheckout;
$paypal_data = [];
$paypal_data['items'] = [];
foreach ($data['product_id'] as $key => $product_id) {
$lims_product_data = Product::find($product_id);
$paypal_data['items'][] = [
'name' => $lims_product_data->name,
'price' => ($data['subtotal'][$key]/$data['qty'][$key]),
'qty' => $data['qty'][$key]
];
}
$paypal_data['items'][] = [
'name' => 'Order Tax',
'price' => $data['order_tax'],
'qty' => 1
];
$paypal_data['items'][] = [
'name' => 'Order Discount',
'price' => $data['order_discount'] * (-1),
'qty' => 1
];
$paypal_data['items'][] = [
'name' => 'Shipping Cost',
'price' => $data['shipping_cost'],
'qty' => 1
];
if($data['grand_total'] != $data['paid_amount']){
$paypal_data['items'][] = [
'name' => 'Due',
'price' => ($data['grand_total'] - $data['paid_amount']) * (-1),
'qty' => 1
];
}
//return $paypal_data;
$paypal_data['invoice_id'] = $lims_sale_data->reference_no;
$paypal_data['invoice_description'] = "Reference # {$paypal_data['invoice_id']} Invoice";
$paypal_data['return_url'] = url('/sale/paypalSuccess');
$paypal_data['cancel_url'] = url('/sale/create');
$total = 0;
foreach($paypal_data['items'] as $item) {
$total += $item['price']*$item['qty'];
}
$paypal_data['total'] = $total;
$response = $provider->setExpressCheckout($paypal_data);
// This will redirect user to PayPal
return redirect($response['paypal_link']);
}
elseif($paying_method == 'Deposit'){
$lims_customer_data->expense += $data['paid_amount'];
$lims_customer_data->save();
}
elseif($paying_method == 'Points'){
$lims_customer_data->points -= $data['used_points'];
$lims_customer_data->save();
}
}
if($lims_sale_data->sale_status == '1')
return redirect('sales/gen_invoice/' . $lims_sale_data->id)->with('message', $message);
elseif($data['pos'])
return redirect('pos')->with('message', $message);
else
return redirect('sales')->with('message', $message);
}
you don't have edit_warranty in your form
also, take 2 minutes to learn how to format your question
@Snapey ok
@snapey you find the error
@rifky49 Yes, he has found the error, when you are sending you data across from the front end to the backend, the $request doesn't contain edit_warranty. Maybe there is a spelling mistake or something you should check for. Also you want to refactor your code.
@Randy_Johnson spelling is also correct
@Randy_Johnson The error you're encountering indicates that the "edit_warranty" key is not defined in the $data array when trying to access it. To fix this issue, you should make sure that the "edit_warranty" key is set in the $data array before attempting to access it.
@Randy_Johnson Hello please check my last error message
To fix this issue, you should make sure that the "edit_warranty" key is set in the $data array
How much more information do you need?
Your $data array comes from $request->all(), which comes from YOUR form so you should check that YOUR form contains such an input value. We cannot check it for you.
If you want to know the most basic of diagnostic steps, place dd($request->all()); at the TOP of your controller store method and see if you have such a key posted to your controller.
what the data type of this edit_warranty ? date ? datetime ? text ? numeric ?
@tangtang text
is this edit_warranty included in your form ?
@tangtang yes
can you show this edit_warranty code ? or if you would, share the full code of this form too
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 id="modal_header" class="modal-title"></h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<form>
<div class="row modal-element">
<div class="col-md-4 form-group">
<label>{{trans('file.Quantity')}}</label>
<input type="text" name="edit_qty" class="form-control numkey">
</div>
<div class="col-md-4 form-group">
<label>{{trans('file.Unit Discount')}}</label>
<input type="text" name="edit_discount" class="form-control numkey">
</div>
<div class="col-md-4 form-group">
<label>{{trans('file.Unit Price')}}</label>
<input type="text" name="edit_unit_price" class="form-control numkey" step="any">
</div>
<?php
$tax_name_all[] = 'No Tax';
$tax_rate_all[] = 0;
foreach($lims_tax_list as $tax) {
$tax_name_all[] = $tax->name;
$tax_rate_all[] = $tax->rate;
}
?>
<div class="col-md-4 form-group">
<label>{{trans('file.Tax Rate')}}</label>
<select name="edit_tax_rate" class="form-control selectpicker">
@foreach($tax_name_all as $key => $name)
<option value="{{$key}}">{{$name}}</option>
@endforeach
</select>
</div>
<div id="edit_unit" class="col-md-4 form-group">
<label>{{trans('file.Product Unit')}}</label>
<select name="edit_unit" class="form-control selectpicker">
</select>
</div>
<?php
$warranty_title_all[] = 'No Warranty';
foreach($lims_warranty_list as $warranty) {
$warranty_title_all[] = $warranty->title;
}
?>
<div class="col-md-4 form-group">
<label>{{trans('file.Warranty')}}</label>
<select name="edit_warranty" class="form-control selectpicker">
@foreach($warranty_title_all as $key => $title)
<option value="{{$key}}">{{$title}}</option>
@endforeach
</select>
</div>
</div>
<button type="button" name="update_btn" class="btn btn-primary">{{trans('file.update')}}</button>
</form>
</div>
</div>
</div>
</div>'''
there no something like edit_warranty in this code.
is your form have something like this code snippet
<input type="text" name="edit_warranty" id="edit_warranty">
or
<textarea name="edit_warranty" id="edit_warranty"> </textarea>
or maybe you do it in script
if you have, show it here
and do the dd code in your code for temporary checkup
public function store(Request $request) {
$data = $request->all();
dd($data); // this is the new code
// your other code here . . .
}
after doing this, post new data again with the same form and show all the result here.
@rifky49 please learn to format the code you post here.
Three backticks ``` on their own line before and after the block of code
"_token" => "lXEa7HpNp9886I18OyWm4Vhi1mYgEfWfDfBcDXtE"
"created_at" => null
"reference_no" => null
"warehouse_id_hidden" => "1"
"warehouse_id" => "1"
"biller_id_hidden" => "1"
"biller_id" => "1"
"customer_id_hidden" => "1"
"customer_id" => "1"
"product_code_name" => null
"product_batch_id" => array:1 [▶]
"qty" => array:1 [▶]
"product_code" => array:1 [▶]
"product_id" => array:1 [▶]
"sale_unit" => array:1 [▶]
"net_unit_price" => array:1 [▶]
"discount" => array:1 [▶]
"tax_rate" => array:1 [▶]
"tax" => array:1 [▶]
"subtotal" => array:1 [▶]
"imei_number" => array:1 [▶]
"total_qty" => "1"
"total_discount" => "0.00"
"total_tax" => "0.00"
"total_price" => "5950.00"
"item" => "1"
"order_tax" => "0.00"
"grand_total" => "5950.00"
"used_points" => null
"coupon_discount" => null
"sale_status" => "1"
"coupon_active" => null
"coupon_id" => null
"pos" => "1"
"draft" => "0"
"paying_amount" => "5950.00"
"paid_amount" => "5950.00"
"paid_by_id" => "1"
"gift_card_id" => null
"cheque_no" => null
"payment_note" => null
"sale_note" => null
"staff_note" => null
"order_discount_type" => "Flat"
"order_discount_value" => null
"order_discount" => "0"
"order_tax_rate" => "0"
"shipping_cost" => null
]```
seems like you have two form or more in your blade ?
this edit_warranty is in modal form not in the main form, this edit_warranty will never post to same function store in your controller.
and from your form this edit_warranty is in update function, so this edit_warranty will work after the transaction data is added first, am I right ?
and to make sure, in the end of the dd result is shipping_cost => null ? is there another field ?
@tangtang My Form Page
'''@extends('backend.layout.top-head') @section('content') @if($errors->has('phone_number'))
<ul id="side-main-menu" class="side-menu list-unstyled">
<li><a href="{{url('/')}}"> <i class="dripicons-meter"></i><span>{{ __('file.dashboard') }}</span></a></li>
<?php
$role = DB::table('roles')->find(Auth::user()->role_id);
$index_permission = DB::table('permissions')->where('name', 'products-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
$print_barcode = DB::table('permissions')->where('name', 'print_barcode')->first();
$print_barcode_active = DB::table('role_has_permissions')->where([
['permission_id', $print_barcode->id],
['role_id', $role->id]
])->first();
$stock_count = DB::table('permissions')->where('name', 'stock_count')->first();
$stock_count_active = DB::table('role_has_permissions')->where([
['permission_id', $stock_count->id],
['role_id', $role->id]
])->first();
$adjustment = DB::table('permissions')->where('name', 'adjustment')->first();
$adjustment_active = DB::table('role_has_permissions')->where([
['permission_id', $adjustment->id],
['role_id', $role->id]
])->first();
?>
<li><a href="#product" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-list"></i><span>{{__('file.product')}}</span><span></a>
<ul id="product" class="collapse list-unstyled ">
<li id="category-menu"><a href="{{route('category.index')}}">{{__('file.category')}}</a></li>
@if($index_permission_active)
<li id="product-list-menu"><a href="{{route('products.index')}}">{{__('file.product_list')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'products-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li id="product-create-menu"><a href="{{route('products.create')}}">{{__('file.add_product')}}</a></li>
@endif
@endif
@if($print_barcode_active)
<li id="printBarcode-menu"><a href="{{route('product.printBarcode')}}">{{__('file.print_barcode')}}</a></li>
@endif
@if($adjustment_active)
<li id="adjustment-list-menu"><a href="{{route('qty_adjustment.index')}}">{{trans('file.Adjustment List')}}</a></li>
<li id="adjustment-create-menu"><a href="{{route('qty_adjustment.create')}}">{{trans('file.Add Adjustment')}}</a></li>
@endif
@if($stock_count_active)
<li id="stock-count-menu"><a href="{{route('stock-count.index')}}">{{trans('file.Stock Count')}}</a></li>
@endif
</ul>
</li>
<?php
$index_permission = DB::table('permissions')->where('name', 'purchases-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li><a href="#purchase" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-card"></i><span>{{trans('file.Purchase')}}</span></a>
<ul id="purchase" class="collapse list-unstyled ">
<li id="purchase-list-menu"><a href="{{route('purchases.index')}}">{{trans('file.Purchase List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'purchases-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li id="purchase-create-menu"><a href="{{route('purchases.create')}}">{{trans('file.Add Purchase')}}</a></li>
<li id="purchase-import-menu"><a href="{{url('purchases/purchase_by_csv')}}">{{trans('file.Import Purchase By CSV')}}</a></li>
@endif
</ul>
</li>
@endif
<?php
$index_permission = DB::table('permissions')->where('name', 'sales-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
$gift_card_permission = DB::table('permissions')->where('name', 'gift_card')->first();
$gift_card_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $gift_card_permission->id],
['role_id', $role->id]
])->first();
$coupon_permission = DB::table('permissions')->where('name', 'coupon')->first();
$coupon_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $coupon_permission->id],
['role_id', $role->id]
])->first();
?>
<li><a href="#sale" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-cart"></i><span>{{trans('file.Sale')}}</span></a>
<ul id="sale" class="collapse list-unstyled ">
@if($index_permission_active)
<li id="sale-list-menu"><a href="{{route('sales.index')}}">{{trans('file.Sale List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'sales-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li><a href="{{route('sale.pos')}}">POS</a></li>
<li id="sale-create-menu"><a href="{{route('sales.create')}}">{{trans('file.Add Sale')}}</a></li>
<li id="sale-import-menu"><a href="{{url('sales/sale_by_csv')}}">{{trans('file.Import Sale By CSV')}}</a></li>
@endif
@endif
@if($gift_card_permission_active)
<li id="gift-card-menu"><a href="{{route('gift_cards.index')}}">{{trans('file.Gift Card List')}}</a> </li>
@endif
@if($coupon_permission_active)
<li id="coupon-menu"><a href="{{route('coupons.index')}}">{{trans('file.Coupon List')}}</a> </li>
@endif
<li id="delivery-menu"><a href="{{route('delivery.index')}}">{{trans('file.Delivery List')}}</a></li>
</ul>
</li>
<?php
$index_permission = DB::table('permissions')->where('name', 'expenses-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li><a href="#expense" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-wallet"></i><span>{{trans('file.Expense')}}</span></a>
<ul id="expense" class="collapse list-unstyled ">
<li id="exp-cat-menu"><a href="{{route('expense_categories.index')}}">{{trans('file.Expense Category')}}</a></li>
<li id="exp-list-menu"><a href="{{route('expenses.index')}}">{{trans('file.Expense List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'expenses-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li><a id="add-expense" href=""> {{trans('file.Add Expense')}}</a></li>
@endif
</ul>
</li>
@endif
<?php
$index_permission = DB::table('permissions')->where('name', 'quotes-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li><a href="#quotation" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-document"></i><span>{{trans('file.Quotation')}}</span><span></a>
<ul id="quotation" class="collapse list-unstyled ">
<li id="quotation-list-menu"><a href="{{route('quotations.index')}}">{{trans('file.Quotation List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'quotes-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li id="quotation-create-menu"><a href="{{route('quotations.create')}}">{{trans('file.Add Quotation')}}</a></li>
@endif
</ul>
</li>
@endif
<?php
$index_permission = DB::table('permissions')->where('name', 'transfers-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li><a href="#transfer" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-export"></i><span>{{trans('file.Transfer')}}</span></a>
<ul id="transfer" class="collapse list-unstyled ">
<li id="transfer-list-menu"><a href="{{route('transfers.index')}}">{{trans('file.Transfer List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'transfers-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li id="transfer-create-menu"><a href="{{route('transfers.create')}}">{{trans('file.Add Transfer')}}</a></li>
<li id="transfer-import-menu"><a href="{{url('transfers/transfer_by_csv')}}">{{trans('file.Import Transfer By CSV')}}</a></li>
@endif
</ul>
</li>
@endif
<li><a href="#return" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-return"></i><span>{{trans('file.return')}}</span></a>
<ul id="return" class="collapse list-unstyled ">
<?php
$index_permission = DB::table('permissions')->where('name', 'returns-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li id="sale-return-menu"><a href="{{route('return-sale.index')}}">{{trans('file.Sale')}}</a></li>
@endif
<?php
$index_permission = DB::table('permissions')->where('name', 'purchase-return-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li id="purchase-return-menu"><a href="{{route('return-purchase.index')}}">{{trans('file.Purchase')}}</a></li>
@endif
</ul>
</li>
<?php
$index_permission = DB::table('permissions')->where('name', 'account-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
$money_transfer_permission = DB::table('permissions')->where('name', 'money-transfer')->first();
$money_transfer_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $money_transfer_permission->id],
['role_id', $role->id]
])->first();
$balance_sheet_permission = DB::table('permissions')->where('name', 'balance-sheet')->first();
$balance_sheet_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $balance_sheet_permission->id],
['role_id', $role->id]
])->first();
$account_statement_permission = DB::table('permissions')->where('name', 'account-statement')->first();
$account_statement_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $account_statement_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active || $balance_sheet_permission_active || $account_statement_permission_active)
<li class=""><a href="#account" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-briefcase"></i><span>{{trans('file.Accounting')}}</span></a>
<ul id="account" class="collapse list-unstyled ">
@if($index_permission_active)
<li id="account-list-menu"><a href="{{route('accounts.index')}}">{{trans('file.Account List')}}</a></li>
<li><a id="add-account" href="">{{trans('file.Add Account')}}</a></li>
@endif
@if($money_transfer_permission_active)
<li id="money-transfer-menu"><a href="{{route('money-transfers.index')}}">{{trans('file.Money Transfer')}}</a></li>
@endif
@if($balance_sheet_permission_active)
<li id="balance-sheet-menu"><a href="{{route('accounts.balancesheet')}}">{{trans('file.Balance Sheet')}}</a></li>
@endif
@if($account_statement_permission_active)
<li id="account-statement-menu"><a id="account-statement" href="">{{trans('file.Account Statement')}}</a></li>
@endif
</ul>
</li>
@endif
<?php
$department = DB::table('permissions')->where('name', 'department')->first();
$department_active = DB::table('role_has_permissions')->where([
['permission_id', $department->id],
['role_id', $role->id]
])->first();
$index_employee = DB::table('permissions')->where('name', 'employees-index')->first();
$index_employee_active = DB::table('role_has_permissions')->where([
['permission_id', $index_employee->id],
['role_id', $role->id]
])->first();
$attendance = DB::table('permissions')->where('name', 'attendance')->first();
$attendance_active = DB::table('role_has_permissions')->where([
['permission_id', $attendance->id],
['role_id', $role->id]
])->first();
$payroll = DB::table('permissions')->where('name', 'payroll')->first();
$payroll_active = DB::table('role_has_permissions')->where([
['permission_id', $payroll->id],
['role_id', $role->id]
])->first();
?>
<li class=""><a href="#hrm" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-user-group"></i><span>HRM</span></a>
<ul id="hrm" class="collapse list-unstyled ">
@if($department_active)
<li id="dept-menu"><a href="{{route('departments.index')}}">{{trans('file.Department')}}</a></li>
@endif
@if($index_employee_active)
<li id="employee-menu"><a href="{{route('employees.index')}}">{{trans('file.Employee')}}</a></li>
@endif
@if($attendance_active)
<li id="attendance-menu"><a href="{{route('attendance.index')}}">{{trans('file.Attendance')}}</a></li>
@endif
@if($payroll_active)
<li id="payroll-menu"><a href="{{route('payroll.index')}}">{{trans('file.Payroll')}}</a></li>
@endif
<li id="holiday-menu"><a href="{{route('holidays.index')}}">{{trans('file.Holiday')}}</a></li>
</ul>
</li>
<li><a href="#people" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-user"></i><span>{{trans('file.People')}}</span></a>
<ul id="people" class="collapse list-unstyled ">
<?php $index_permission_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'users-index'],
['role_id', $role->id] ])->first();
?>
@if($index_permission_active)
<li id="user-list-menu"><a href="{{route('user.index')}}">{{trans('file.User List')}}</a></li>
<?php $add_permission_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'users-add'],
['role_id', $role->id] ])->first();
?>
@if($add_permission_active)
<li id="user-create-menu"><a href="{{route('user.create')}}">{{trans('file.Add User')}}</a></li>
@endif
@endif
<?php
$index_permission = DB::table('permissions')->where('name', 'customers-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li id="customer-list-menu"><a href="{{route('customer.index')}}">{{trans('file.Customer List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'customers-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li id="customer-create-menu"><a href="{{route('customer.create')}}">{{trans('file.Add Customer')}}</a></li>
@endif
@endif
<?php
$index_permission = DB::table('permissions')->where('name', 'billers-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li id="biller-list-menu"><a href="{{route('biller.index')}}">{{trans('file.Biller List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'billers-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li id="biller-create-menu"><a href="{{route('biller.create')}}">{{trans('file.Add Biller')}}</a></li>
@endif
@endif
<?php
$index_permission = DB::table('permissions')->where('name', 'suppliers-index')->first();
$index_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $index_permission->id],
['role_id', $role->id]
])->first();
?>
@if($index_permission_active)
<li id="supplier-list-menu"><a href="{{route('supplier.index')}}">{{trans('file.Supplier List')}}</a></li>
<?php
$add_permission = DB::table('permissions')->where('name', 'suppliers-add')->first();
$add_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $add_permission->id],
['role_id', $role->id]
])->first();
?>
@if($add_permission_active)
<li id="supplier-create-menu"><a href="{{route('supplier.create')}}">{{trans('file.Add Supplier')}}</a></li>
@endif
@endif
</ul>
</li>
<li><a href="#report" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-document-remove"></i><span>{{trans('file.Reports')}}</span></a>
<?php
$profit_loss_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'profit-loss'],
['role_id', $role->id] ])->first();
$best_seller_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'best-seller'],
['role_id', $role->id] ])->first();
$warehouse_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'warehouse-report'],
['role_id', $role->id] ])->first();
$warehouse_stock_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'warehouse-stock-report'],
['role_id', $role->id] ])->first();
$product_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'product-report'],
['role_id', $role->id] ])->first();
$daily_sale_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'daily-sale'],
['role_id', $role->id] ])->first();
$monthly_sale_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'monthly-sale'],
['role_id', $role->id]])->first();
$daily_purchase_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'daily-purchase'],
['role_id', $role->id] ])->first();
$monthly_purchase_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'monthly-purchase'],
['role_id', $role->id] ])->first();
$purchase_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'purchase-report'],
['role_id', $role->id] ])->first();
$sale_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'sale-report'],
['role_id', $role->id] ])
->first();
$sale_report_chart_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'sale-report-chart'],
['role_id', $role->id]
])->first();
$payment_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'payment-report'],
['role_id', $role->id] ])->first();
$product_qty_alert_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'product-qty-alert'],
['role_id', $role->id] ])->first();
$dso_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'dso-report'],
['role_id', $role->id]
])->first();
$user_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'user-report'],
['role_id', $role->id] ])->first();
$customer_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'customer-report'],
['role_id', $role->id] ])->first();
$supplier_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'supplier-report'],
['role_id', $role->id] ])->first();
$due_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'due-report'],
['role_id', $role->id] ])->first();
$supplier_due_report_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'supplier-due-report'],
['role_id', $role->id]
])->first();
?>
<ul id="report" class="collapse list-unstyled ">
@if($profit_loss_active)
<li id="profit-loss-report-menu">
{!! Form::open(['route' => 'report.profitLoss', 'method' => 'post', 'id' => 'profitLoss-report-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m').'-'.'01'}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<a id="profitLoss-link" href="">{{trans('file.Summary Report')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($best_seller_active)
<li id="best-seller-report-menu">
<a href="{{url('report/best_seller')}}">{{trans('file.Best Seller')}}</a>
</li>
@endif
@if($product_report_active)
<li id="product-report-menu">
{!! Form::open(['route' => 'report.product', 'method' => 'get', 'id' => 'product-report-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m').'-'.'01'}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<input type="hidden" name="warehouse_id" value="0" />
<a id="report-link" href="">{{trans('file.Product Report')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($daily_sale_active)
<li id="daily-sale-report-menu">
<a href="{{url('report/daily_sale/'.date('Y').'/'.date('m'))}}">{{trans('file.Daily Sale')}}</a>
</li>
@endif
@if($monthly_sale_active)
<li id="monthly-sale-report-menu">
<a href="{{url('report/monthly_sale/'.date('Y'))}}">{{trans('file.Monthly Sale')}}</a>
</li>
@endif
@if($daily_purchase_active)
<li id="daily-purchase-report-menu">
<a href="{{url('report/daily_purchase/'.date('Y').'/'.date('m'))}}">{{trans('file.Daily Purchase')}}</a>
</li>
@endif
@if($monthly_purchase_active)
<li id="monthly-purchase-report-menu">
<a href="{{url('report/monthly_purchase/'.date('Y'))}}">{{trans('file.Monthly Purchase')}}</a>
</li>
@endif
@if($sale_report_active)
<li id="sale-report-menu">
{!! Form::open(['route' => 'report.sale', 'method' => 'post', 'id' => 'sale-report-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m').'-'.'01'}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<input type="hidden" name="warehouse_id" value="0" />
<a id="sale-report-link" href="">{{trans('file.Sale Report')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($sale_report_chart_active)
<li id="sale-report-chart-menu">
{!! Form::open(['route' => 'report.saleChart', 'method' => 'post', 'id' => 'sale-report-chart-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m').'-'.'01'}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<input type="hidden" name="warehouse_id" value="0" />
<input type="hidden" name="time_period" value="weekly" />
<a id="sale-report-chart-link" href="">{{trans('file.Sale Report Chart')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($payment_report_active)
<li id="payment-report-menu">
{!! Form::open(['route' => 'report.paymentByDate', 'method' => 'post', 'id' => 'payment-report-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m').'-'.'01'}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<a id="payment-report-link" href="">{{trans('file.Payment Report')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($purchase_report_active)
<li id="purchase-report-menu">
{!! Form::open(['route' => 'report.purchase', 'method' => 'post', 'id' => 'purchase-report-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m').'-'.'01'}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<input type="hidden" name="warehouse_id" value="0" />
<a id="purchase-report-link" href="">{{trans('file.Purchase Report')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($customer_report_active)
<li id="customer-report-menu">
<a id="customer-report-link" href="">{{trans('file.Customer Report')}}</a>
</li>
@endif
@if($due_report_active)
<li id="due-report-menu">
{!! Form::open(['route' => 'report.customerDueByDate', 'method' => 'post', 'id' => 'customer-due-report-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m-d', strtotime('-1 year'))}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<a id="due-report-link" href="">{{trans('file.Customer Due Report')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($supplier_report_active)
<li id="supplier-report-menu">
<a id="supplier-report-link" href="">{{trans('file.Supplier Report')}}</a>
</li>
@endif
@if($supplier_due_report_active)
<li id="supplier-due-report-menu">
{!! Form::open(['route' => 'report.supplierDueByDate', 'method' => 'post', 'id' => 'supplier-due-report-form']) !!}
<input type="hidden" name="start_date" value="{{date('Y-m-d', strtotime('-1 year'))}}" />
<input type="hidden" name="end_date" value="{{date('Y-m-d')}}" />
<a id="supplier-due-report-link" href="">{{trans('file.Supplier Due Report')}}</a>
{!! Form::close() !!}
</li>
@endif
@if($warehouse_report_active)
<li id="warehouse-report-menu">
<a id="warehouse-report-link" href="">{{trans('file.Warehouse Report')}}</a>
</li>
@endif
@if($warehouse_stock_report_active)
<li id="warehouse-stock-report-menu">
<a href="{{route('report.warehouseStock')}}">{{trans('file.Warehouse Stock Chart')}}</a>
</li>
@endif
@if($product_qty_alert_active)
<li id="qtyAlert-report-menu">
<a href="{{route('report.qtyAlert')}}">{{trans('file.Product Quantity Alert')}}</a>
</li>
@endif
@if($dso_report_active)
<li id="daily-sale-objective-menu">
<a href="{{route('report.dailySaleObjective')}}">{{trans('file.Daily Sale Objective Report')}}</a>
</li>
@endif
@if($user_report_active)
<li id="user-report-menu">
<a id="user-report-link" href="">{{trans('file.User Report')}}</a>
</li>
@endif
</ul>
</li>
<li><a href="#setting" aria-expanded="false" data-toggle="collapse"> <i class="dripicons-gear"></i><span>{{trans('file.settings')}}</span></a>
<ul id="setting" class="collapse list-unstyled ">
<?php
$all_notification_permission_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'all_notification'],
['role_id', $role->id]
])->first();
$send_notification_permission_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'send_notification'],
['role_id', $role->id]
])->first();
$warehouse_permission = DB::table('permissions')->where('name', 'warehouse')->first();
$warehouse_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $warehouse_permission->id],
['role_id', $role->id]
])->first();
$customer_group_permission = DB::table('permissions')->where('name', 'customer_group')->first();
$customer_group_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $customer_group_permission->id],
['role_id', $role->id]
])->first();
$brand_permission = DB::table('permissions')->where('name', 'brand')->first();
$brand_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $brand_permission->id],
['role_id', $role->id]
])->first();
$unit_permission = DB::table('permissions')->where('name', 'unit')->first();
$unit_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $unit_permission->id],
['role_id', $role->id]
])->first();
$tax_permission = DB::table('permissions')->where('name', 'tax')->first();
$tax_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $tax_permission->id],
['role_id', $role->id]
])->first();
$general_setting_permission = DB::table('permissions')->where('name', 'general_setting')->first();
$general_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $general_setting_permission->id],
['role_id', $role->id]
])->first();
$mail_setting_permission = DB::table('permissions')->where('name', 'mail_setting')->first();
$mail_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $mail_setting_permission->id],
['role_id', $role->id]
])->first();
$sms_setting_permission = DB::table('permissions')->where('name', 'sms_setting')->first();
$sms_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $sms_setting_permission->id],
['role_id', $role->id]
])->first();
$create_sms_permission = DB::table('permissions')->where('name', 'create_sms')->first();
$create_sms_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $create_sms_permission->id],
['role_id', $role->id]
])->first();
$pos_setting_permission = DB::table('permissions')->where('name', 'pos_setting')->first();
$pos_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $pos_setting_permission->id],
['role_id', $role->id]
])->first();
$hrm_setting_permission = DB::table('permissions')->where('name', 'hrm_setting')->first();
$hrm_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $hrm_setting_permission->id],
['role_id', $role->id]
])->first();
$reward_point_setting_permission = DB::table('permissions')->where('name', 'reward_point_setting')->first();
$reward_point_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $reward_point_setting_permission->id],
['role_id', $role->id]
])->first();
$discount_plan_permission_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'discount_plan'],
['role_id', $role->id]
])->first();
$discount_permission_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'discount'],
['role_id', $role->id]
])->first();
?>
@if($role->id <= 1)
<li id="role-menu"><a href="{{route('role.index')}}">{{trans('file.Role Permission')}}</a></li>
@endif
@if($discount_plan_permission_active)
<li id="discount-plan-list-menu"><a href="{{route('discount-plans.index')}}">{{trans('file.Discount Plan')}}</a></li>
@endif
@if($discount_permission_active)
<li id="discount-list-menu"><a href="{{route('discounts.index')}}">{{trans('file.Discount')}}</a></li>
@endif
@if($all_notification_permission_active)
<li id="notification-list-menu">
<a href="{{route('notifications.index')}}">{{trans('file.All Notification')}}</a>
</li>
@endif
@if($send_notification_permission_active)
<li id="notification-menu">
<a href="" id="send-notification">{{trans('file.Send Notification')}}</a>
</li>
@endif
@if($warehouse_permission_active)
<li id="warehouse-menu"><a href="{{route('warehouse.index')}}">{{trans('file.Warehouse')}}</a></li>
@endif
@if($customer_group_permission_active)
<li id="customer-group-menu"><a href="{{route('customer_group.index')}}">{{trans('file.Customer Group')}}</a></li>
@endif
@if($brand_permission_active)
<li id="brand-menu"><a href="{{route('brand.index')}}">{{trans('file.Brand')}}</a></li>
@endif
@if($unit_permission_active)
<li id="unit-menu"><a href="{{route('unit.index')}}">{{trans('file.Unit')}}</a></li>
@endif
@if($tax_permission_active)
<li id="tax-menu"><a href="{{route('tax.index')}}">{{trans('file.Tax')}}</a></li>
@endif
<li id="user-menu"><a href="{{route('user.profile', ['id' => Auth::id()])}}">{{trans('file.User Profile')}}</a></li>
@if($create_sms_permission_active)
<li id="create-sms-menu"><a href="{{route('setting.createSms')}}">{{trans('file.Create SMS')}}</a></li>
@endif
@if($general_setting_permission_active)
<li id="general-setting-menu"><a href="{{route('setting.general')}}">{{trans('file.General Setting')}}</a></li>
@endif
@if($mail_setting_permission_active)
<li id="mail-setting-menu"><a href="{{route('setting.mail')}}">{{trans('file.Mail Setting')}}</a></li>
@endif
@if($reward_point_setting_permission_active)
<li id="reward-point-setting-menu"><a href="{{route('setting.rewardPoint')}}">{{trans('file.Reward Point Setting')}}</a></li>
@endif
@if($sms_setting_permission_active)
<li id="sms-setting-menu"><a href="{{route('setting.sms')}}">{{trans('file.SMS Setting')}}</a></li>
@endif
@if($pos_setting_permission_active)
<li id="pos-setting-menu"><a href="{{route('setting.pos')}}">POS {{trans('file.settings')}}</a></li>
@endif
@if($hrm_setting_permission_active)
<li id="hrm-setting-menu"><a href="{{route('setting.hrm')}}"> {{trans('file.HRM Setting')}}</a></li>
@endif
</ul>
</li>
@if(Auth::user()->role_id != 5)
<!--<li><a href="{{url('public/read_me')}}"> <i class="dripicons-information"></i><span>{{trans('file.Documentation')}}</span></a></li>-->
@endif
</ul>
$customer_active = DB::table('permissions')
->join('role_has_permissions', 'permissions.id', '=', 'role_has_permissions.permission_id')
->where([
['permissions.name', 'customers-add'],
['role_id', \Auth::user()->role_id] ])->first();
@endphp
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<input type="text" name="created_at" class="form-control date" placeholder="Choose date" onkeyup='saveValue(this);'/>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<input type="text" id="reference-no" name="reference_no" class="form-control" placeholder="Type reference number" onkeyup='saveValue(this);'/>
</div>
@if($errors->has('reference_no'))
<span>
<strong>{{ $errors->first('reference_no') }}</strong>
</span>
@endif
</div>
<div class="col-md-4">
<div class="form-group">
@if($lims_pos_setting_data)
<input type="hidden" name="warehouse_id_hidden" value="{{$lims_pos_setting_data->warehouse_id}}">
@endif
<select required id="warehouse_id" name="warehouse_id" class="selectpicker form-control" data-live-search="true" data-live-search-style="begins" title="Select warehouse...">
@foreach($lims_warehouse_list as $warehouse)
<option value="{{$warehouse->id}}">{{$warehouse->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
@if($lims_pos_setting_data)
<input type="hidden" name="biller_id_hidden" value="{{$lims_pos_setting_data->biller_id}}">
@endif
<select required id="biller_id" name="biller_id" class="selectpicker form-control" data-live-search="true" data-live-search-style="begins" title="Select Biller...">
@foreach($lims_biller_list as $biller)
<option value="{{$biller->id}}">{{$biller->name . ' (' . $biller->company_name . ')'}}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
@if($lims_pos_setting_data)
<input type="hidden" name="customer_id_hidden" value="{{$lims_pos_setting_data->customer_id}}">
@endif
<div class="input-group pos">
@if($customer_active)
<select required name="customer_id" id="customer_id" class="selectpicker form-control" data-live-search="true" title="Select customer..." style="width: 100px">
<?php
$deposit = [];
$points = [];
?>
@foreach($lims_customer_list as $customer)
@php
$deposit[$customer->id] = $customer->deposit - $customer->expense;
$points[$customer->id] = $customer->points;
@endphp
<option value="{{$customer->id}}">{{$customer->name . ' (' . $customer->phone_number . ')'}}</option>
@endforeach
</select>
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#addCustomer"><i class="dripicons-plus"></i></button>
@else
<?php
$deposit = [];
$points = [];
?>
<select required name="customer_id" id="customer_id" class="selectpicker form-control" data-live-search="true" title="Select customer...">
@foreach($lims_customer_list as $customer)
@php
$deposit[$customer->id] = $customer->deposit - $customer->expense;
$points[$customer->id] = $customer->points;
@endphp
<option value="{{$customer->id}}">{{$customer->name . ' (' . $customer->phone_number . ')'}}</option>
@endforeach
</select>
@endif
</div>
</div>
</div>
<div class="col-md-12">
<div class="search-box form-group">
<input type="text" name="product_code_name" id="lims_productcodeSearch" placeholder="Scan/Search product by name/code" class="form-control" />
</div>
</div>
</div>
<div class="form-group">
<div class="table-responsive transaction-list">
<table id="myTable" class="table table-hover table-striped order-list table-fixed">
<thead>
<tr>
<th class="col-sm-2">{{trans('file.product')}}</th>
<th class="col-sm-2">{{trans('file.Batch No')}}</th>
<th class="col-sm-2">{{trans('file.Price')}}</th>
<th class="col-sm-3">{{trans('file.Quantity')}}</th>
<th class="col-sm-3">{{trans('file.Subtotal')}}</th>
</tr>
</thead>
<tbody id="tbody-id">
</tbody>
</table>
</div>
</div>
<div class="row" style="display: none;">
<div class="col-md-2">
<div class="form-group">
<input type="hidden" name="total_qty" />
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<input type="hidden" name="total_discount" value="{{number_format(0, $general_setting->decimal, '.', '')}}" />
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<input type="hidden" name="total_tax" value="{{number_format(0, $general_setting->decimal, '.', '')}}"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<input type="hidden" name="total_price" />
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<input type="hidden" name="item" />
<input type="hidden" name="order_tax" />
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<input type="hidden" name="grand_total" />
<input type="hidden" name="used_points" />
<input type="hidden" name="coupon_discount" />
<input type="hidden" name="sale_status" value="1" />
<input type="hidden" name="coupon_active">
<input type="hidden" name="coupon_id">
<input type="hidden" name="coupon_discount" />
<input type="hidden" name="pos" value="1" />
<input type="hidden" name="draft" value="0" />
</div>
</div>
</div>
<div class="col-12 totals" style="border-top: 2px solid #e4e6fc; padding-top: 10px;">
<div class="row">
<div class="col-sm-4">
<span class="totals-title">{{trans('file.Items')}}</span><span id="item">0</span>
</div>
<div class="col-sm-4">
<span class="totals-title">{{trans('file.Total')}}</span><span id="subtotal">{{number_format(0, $general_setting->decimal, '.', '')}}</span>
</div>
<div class="col-sm-4">
<span class="totals-title">{{trans('file.Discount')}} <button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#order-discount-modal"> <i class="dripicons-document-edit"></i></button></span><span id="discount">{{number_format(0, $general_setting->decimal, '.', '')}}</span>
</div>
<div class="col-sm-4">
<span class="totals-title">{{trans('file.Coupon')}} <button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#coupon-modal"><i class="dripicons-document-edit"></i></button></span><span id="coupon-text">{{number_format(0, $general_setting->decimal, '.', '')}}</span>
</div>
<div class="col-sm-4">
<span class="totals-title">{{trans('file.Tax')}} <button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#order-tax"><i class="dripicons-document-edit"></i></button></span><span id="tax">{{number_format(0, $general_setting->decimal, '.', '')}}</span>
</div>
<div class="col-sm-4">
<span class="totals-title">{{trans('file.Shipping')}} <button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#shipping-cost-modal"><i class="dripicons-document-edit"></i></button></span><span id="shipping-cost">{{number_format(0, $general_setting->decimal, '.', '')}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="payment-amount">
<h2>{{trans('file.grand total')}} <span id="grand-total">{{number_format(0, $general_setting->decimal, '.', '')}}</span></h2>
</div>
<div class="payment-options">
@if(in_array("card",$options))
<div class="column-5">
<button style="background: #0984e3" type="button" class="btn btn-sm btn-custom payment-btn" data-toggle="modal" data-target="#add-payment" id="credit-card-btn"><i class="fa fa-credit-card"></i> {{trans('file.Card')}}</button>
</div>
@endif
@if(in_array("cash",$options))
<div class="column-5">
<button style="background: #00cec9" type="button" class="btn btn-sm btn-custom payment-btn" data-toggle="modal" data-target="#add-payment" id="cash-btn"><i class="fa fa-money"></i> {{trans('file.Cash')}}</button>
</div>
@endif
@if(in_array("paypal",$options) && (strlen($lims_pos_setting_data->paypal_live_api_username)>0) && (strlen($lims_pos_setting_data->paypal_live_api_password)>0) && (strlen($lims_pos_setting_data->paypal_live_api_secret)>0))
<div class="column-5">
<button style="background-color: #213170" type="button" class="btn btn-sm btn-custom payment-btn" data-toggle="modal" data-target="#add-payment" id="paypal-btn"><i class="fa fa-paypal"></i> {{trans('file.PayPal')}}</button>
</div>
@endif
<div class="column-5">
<button style="background-color: #e28d02" type="button" class="btn btn-sm btn-custom" id="draft-btn"><i class="dripicons-flag"></i> {{trans('file.Draft')}}</button>
</div>
@if(in_array("cheque",$options))
<div class="column-5">
<button style="background-color: #fd7272" type="button" class="btn btn-sm btn-custom payment-btn" data-toggle="modal" data-target="#add-payment" id="cheque-btn"><i class="fa fa-money"></i> {{trans('file.Cheque')}}</button>
</div>
@endif
@if(in_array("gift_card",$options))
<div class="column-5">
<button style="background-color: #5f27cd" type="button" class="btn btn-sm btn-custom payment-btn" data-toggle="modal" data-target="#add-payment" id="gift-card-btn"><i class="fa fa-credit-card-alt"></i> {{trans('file.Gift Card')}}</button>
</div>
@endif
@if(in_array("deposit",$options))
<div class="column-5">
<button style="background-color: #b33771" type="button" class="btn btn-sm btn-custom payment-btn" data-toggle="modal" data-target="#add-payment" id="deposit-btn"><i class="fa fa-university"></i> {{trans('file.Deposit')}}</button>
</div>
@endif
@if($lims_reward_point_setting_data->is_active)
<div class="column-5">
<button style="background-color: #319398" type="button" class="btn btn-sm btn-custom payment-btn" data-toggle="modal" data-target="#add-payment" id="point-btn"><i class="dripicons-rocket"></i> {{trans('file.Points')}}</button>
</div>
@endif
<div class="column-5">
<button style="background-color: #d63031;" type="button" class="btn btn-sm btn-custom" id="cancel-btn" onclick="return confirmCancel()"><i class="fa fa-close"></i> {{trans('file.Cancel')}}</button>
</div>
<div class="column-5">
<button style="background-color: #ffc107;" type="button" class="btn btn-sm btn-custom" data-toggle="modal" data-target="#recentTransaction"><i class="dripicons-clock"></i> {{trans('file.Recent Transaction')}}</button>
</div>
</div>
</div>
</div>
<!-- payment modal -->
<div id="add-payment" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 id="exampleModalLabel" class="modal-title">{{trans('file.Finalize Sale')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-10">
<div class="row">
<div class="col-md-6 mt-1">
<label>{{trans('file.Recieved Amount')}} *</label>
<input type="text" name="paying_amount" class="form-control numkey" required step="any">
</div>
<div class="col-md-6 mt-1">
<label>{{trans('file.Paying Amount')}} *</label>
<input type="text" name="paid_amount" class="form-control numkey" step="any">
</div>
<div class="col-md-6 mt-1">
<label>{{trans('file.Change')}} : </label>
<p id="change" class="ml-2">{{number_format(0, $general_setting->decimal, '.', '')}}</p>
</div>
<div class="col-md-6 mt-1">
<input type="hidden" name="paid_by_id">
<label>{{trans('file.Paid By')}}</label>
<select name="paid_by_id_select" class="form-control selectpicker">
@if(in_array("cash",$options))
<option value="1">Cash</option>
@endif
@if(in_array("gift_card",$options))
<option value="2">Gift Card</option>
@endif
@if(in_array("card",$options))
<option value="3">Credit Card</option>
@endif
@if(in_array("cheque",$options))
<option value="4">Cheque</option>
@endif
@if(in_array("paypal",$options) && (strlen(env('PAYPAL_LIVE_API_USERNAME'))>0) && (strlen(env('PAYPAL_LIVE_API_PASSWORD'))>0) && (strlen(env('PAYPAL_LIVE_API_SECRET'))>0))
<option value="5">Paypal</option>
@endif
@if(in_array("deposit",$options))
<option value="6">Deposit</option>
@endif
@if($lims_reward_point_setting_data->is_active)
<option value="7">Points</option>
@endif
</select>
</div>
<div class="form-group col-md-12 mt-3">
<div class="card-element form-control">
</div>
<div class="card-errors" role="alert"></div>
</div>
<div class="form-group col-md-12 gift-card">
<label> {{trans('file.Gift Card')}} *</label>
<input type="hidden" name="gift_card_id">
<select id="gift_card_id_select" name="gift_card_id_select" class="selectpicker form-control" data-live-search="true" data-live-search-style="begins" title="Select Gift Card..."></select>
</div>
<div class="form-group col-md-12 cheque">
<label>{{trans('file.Cheque Number')}} *</label>
<input type="text" name="cheque_no" class="form-control">
</div>
<div class="form-group col-md-12">
<label>{{trans('file.Payment Note')}}</label>
<textarea id="payment_note" rows="2" class="form-control" name="payment_note"></textarea>
</div>
</div>
<div class="row">
<div class="col-md-6 form-group">
<label>{{trans('file.Sale Note')}}</label>
<textarea rows="3" class="form-control" name="sale_note"></textarea>
</div>
<div class="col-md-6 form-group">
<label>{{trans('file.Staff Note')}}</label>
<textarea rows="3" class="form-control" name="staff_note"></textarea>
</div>
</div>
<div class="mt-3">
<button id="submit-btn" type="button" class="btn btn-primary">{{trans('file.submit')}}</button>
</div>
</div>
<div class="col-md-2 qc" data-initial="1">
<h4><strong>{{trans('file.Quick Cash')}}</strong></h4>
<button class="btn btn-block btn-primary qc-btn sound-btn" data-amount="10" type="button">10</button>
<button class="btn btn-block btn-primary qc-btn sound-btn" data-amount="20" type="button">20</button>
<button class="btn btn-block btn-primary qc-btn sound-btn" data-amount="50" type="button">50</button>
<button class="btn btn-block btn-primary qc-btn sound-btn" data-amount="100" type="button">100</button>
<button class="btn btn-block btn-primary qc-btn sound-btn" data-amount="500" type="button">500</button>
<button class="btn btn-block btn-primary qc-btn sound-btn" data-amount="1000" type="button">1000</button>
<button class="btn btn-block btn-danger qc-btn sound-btn" data-amount="0" type="button">{{trans('file.Clear')}}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- order_discount modal -->
<div id="order-discount-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{trans('file.Order Discount')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6 form-group">
<label>{{trans('file.Order Discount Type')}}</label>
<select id="order-discount-type" name="order_discount_type_select" class="form-control">
<option value="Flat">{{trans('file.Flat')}}</option>
<option value="Percentage">{{trans('file.Percentage')}}</option>
</select>
<input type="hidden" name="order_discount_type">
</div>
<div class="col-md-6 form-group">
<label>{{trans('file.Value')}}</label>
<input type="text" name="order_discount_value" class="form-control numkey" id="order-discount-val" onkeyup='saveValue(this);'>
<input type="hidden" name="order_discount" class="form-control" id="order-discount" onkeyup='saveValue(this);'>
</div>
</div>
<button type="button" name="order_discount_btn" class="btn btn-primary" data-dismiss="modal">{{trans('file.submit')}}</button>
</div>
</div>
</div>
</div>
<!-- coupon modal -->
<div id="coupon-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{trans('file.Coupon Code')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" id="coupon-code" class="form-control" placeholder="Type Coupon Code...">
</div>
<button type="button" class="btn btn-primary coupon-check" data-dismiss="modal">{{trans('file.submit')}}</button>
</div>
</div>
</div>
</div>
<!-- order_tax modal -->
<div id="order-tax" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{trans('file.Order Tax')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<div class="form-group">
<input type="hidden" name="order_tax_rate">
<select class="form-control" name="order_tax_rate_select" id="order-tax-rate-select">
<option value="0">No Tax</option>
@foreach($lims_tax_list as $tax)
<option value="{{$tax->rate}}">{{$tax->name}}</option>
@endforeach
</select>
</div>
<button type="button" name="order_tax_btn" class="btn btn-primary" data-dismiss="modal">{{trans('file.submit')}}</button>
</div>
</div>
</div>
</div>
<!-- shipping_cost modal -->
<div id="shipping-cost-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{trans('file.Shipping Cost')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" name="shipping_cost" class="form-control numkey" id="shipping-cost-val" step="any" onkeyup='saveValue(this);'>
</div>
<button type="button" name="shipping_cost_btn" class="btn btn-primary" data-dismiss="modal">{{trans('file.submit')}}</button>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
<!-- product list -->
<div class="col-md-6">
<!-- navbar-->
<header>
<nav class="navbar">
<a id="toggle-btn" href="#" class="menu-btn"><i class="fa fa-bars"> </i></a>
<div class="navbar-header">
<ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
<li class="nav-item"><a id="btnFullscreen" data-toggle="tooltip" title="Full Screen"><i class="dripicons-expand"></i></a></li>
<?php
$general_setting_permission = DB::table('permissions')->where('name', 'general_setting')->first();
$general_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $general_setting_permission->id],
['role_id', Auth::user()->role_id]
])->first();
$pos_setting_permission = DB::table('permissions')->where('name', 'pos_setting')->first();
$pos_setting_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $pos_setting_permission->id],
['role_id', Auth::user()->role_id]
])->first();
?>
@if($pos_setting_permission_active)
<li class="nav-item"><a class="dropdown-item" data-toggle="tooltip" href="{{route('setting.pos')}}" title="{{trans('file.POS Setting')}}"><i class="dripicons-gear"></i></a> </li>
@endif
<li class="nav-item">
<a href="{{route('sales.printLastReciept')}}" data-toggle="tooltip" title="{{trans('file.Print Last Reciept')}}"><i class="dripicons-print"></i></a>
</li>
<li class="nav-item">
<a href="" id="register-details-btn" data-toggle="tooltip" title="{{trans('file.Cash Register Details')}}"><i class="dripicons-briefcase"></i></a>
</li>
<?php
$today_sale_permission = DB::table('permissions')->where('name', 'today_sale')->first();
$today_sale_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $today_sale_permission->id],
['role_id', Auth::user()->role_id]
])->first();
$today_profit_permission = DB::table('permissions')->where('name', 'today_profit')->first();
$today_profit_permission_active = DB::table('role_has_permissions')->where([
['permission_id', $today_profit_permission->id],
['role_id', Auth::user()->role_id]
])->first();
?>
@if($today_sale_permission_active)
<li class="nav-item">
<a href="" id="today-sale-btn" data-toggle="tooltip" title="{{trans('file.Today Sale')}}"><i class="dripicons-shopping-bag"></i></a>
</li>
@endif
@if($today_profit_permission_active)
<li class="nav-item">
<a href="" id="today-profit-btn" data-toggle="tooltip" title="{{trans('file.Today Profit')}}"><i class="dripicons-graph-line"></i></a>
</li>
@endif
@if(($alert_product + count(\Auth::user()->unreadNotifications)) > 0)
<li class="nav-item" id="notification-icon">
<a rel="nofollow" data-toggle="tooltip" title="{{__('Notifications')}}" class="nav-link dropdown-item"><i class="dripicons-bell"></i><span class="badge badge-danger notification-number">{{$alert_product + count(\Auth::user()->unreadNotifications)}}</span>
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</a>
<ul class="right-sidebar" user="menu">
<li class="notifications">
<a href="{{route('report.qtyAlert')}}" class="btn btn-link">{{$alert_product}} product exceeds alert quantity</a>
</li>
@foreach(\Auth::user()->unreadNotifications as $key => $notification)
<li class="notifications">
<a href="#" class="btn btn-link">{{ $notification->data['message'] }}</a>
</li>
@endforeach
</ul>
</li>
@endif
<li class="nav-item">
<a rel="nofollow" data-toggle="tooltip" class="nav-link dropdown-item"><i class="dripicons-user"></i> <span>{{ucfirst(Auth::user()->name)}}</span> <i class="fa fa-angle-down"></i>
</a>
<ul class="right-sidebar">
<li>
<a href="{{route('user.profile', ['id' => Auth::id()])}}"><i class="dripicons-user"></i> {{trans('file.profile')}}</a>
</li>
@if($general_setting_permission_active)
<li>
<a href="{{route('setting.general')}}"><i class="dripicons-gear"></i> {{trans('file.settings')}}</a>
</li>
@endif
<li>
<a href="{{url('my-transactions/'.date('Y').'/'.date('m'))}}"><i class="dripicons-swap"></i> {{trans('file.My Transaction')}}</a>
</li>
@if(Auth::user()->role_id != 5)
<li>
<a href="{{url('holidays/my-holiday/'.date('Y').'/'.date('m'))}}"><i class="dripicons-vibrate"></i> {{trans('file.My Holiday')}}</a>
</li>
@endif
<li>
<a href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();"><i class="dripicons-power"></i>
{{trans('file.logout')}}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
@csrf
</form>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<div class="filter-window">
<div class="category mt-3">
<div class="row ml-2 mr-2 px-2">
<div class="col-7">Choose category</div>
<div class="col-5 text-right">
<span class="btn btn-default btn-sm">
<i class="dripicons-cross"></i>
</span>
</div>
</div>
<div class="row ml-2 mt-3">
@foreach($lims_category_list as $category)
<div class="col-md-3 category-img text-center" data-category="{{$category->id}}">
@if($category->image)
<img src="{{url('public/images/category', $category->image)}}" />
@else
<img src="{{url('public/images/product/zummXD2dvAtI.png')}}" />
@endif
<p class="text-center">{{$category->name}}</p>
</div>
@endforeach
</div>
</div>
<div class="brand mt-3">
<div class="row ml-2 mr-2 px-2">
<div class="col-7">Choose brand</div>
<div class="col-5 text-right">
<span class="btn btn-default btn-sm">
<i class="dripicons-cross"></i>
</span>
</div>
</div>
<div class="row ml-2 mt-3">
@foreach($lims_brand_list as $brand)
@if($brand->image)
<div class="col-md-3 brand-img text-center" data-brand="{{$brand->id}}">
<img src="{{url('public/images/brand',$brand->image)}}" />
<p class="text-center">{{$brand->title}}</p>
</div>
@else
<div class="col-md-3 brand-img" data-brand="{{$brand->id}}">
<img src="{{url('public/images/product/zummXD2dvAtI.png')}}" />
<p class="text-center">{{$brand->title}}</p>
</div>
@endif
@endforeach
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<button class="btn btn-block btn-primary" id="category-filter">{{trans('file.category')}}</button>
</div>
<div class="col-md-4">
<button class="btn btn-block btn-info" id="brand-filter">{{trans('file.Brand')}}</button>
</div>
<div class="col-md-4">
<button class="btn btn-block btn-danger" id="featured-filter">{{trans('file.Featured')}}</button>
</div>
<div class="col-md-12 mt-1 table-container">
<table id="product-table" class="table no-shadow product-list">
<thead class="d-none">
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@for ($i=0; $i < ceil($product_number/5); $i++)
<tr>
<td class="product-img sound-btn" title="{{$lims_product_list[0+$i*5]->name}}" data-product ="{{$lims_product_list[0+$i*5]->code . ' (' . $lims_product_list[0+$i*5]->name . ')'}}"><img src="{{url('public/images/product',$lims_product_list[0+$i*5]->base_image)}}" width="100%" />
<p>{{$lims_product_list[0+$i*5]->name}}</p>
<span>{{$lims_product_list[0+$i*5]->code}}</span>
</td>
@if(!empty($lims_product_list[1+$i*5]))
<td class="product-img sound-btn" title="{{$lims_product_list[1+$i*5]->name}}" data-product ="{{$lims_product_list[1+$i*5]->code . ' (' . $lims_product_list[1+$i*5]->name . ')'}}"><img src="{{url('public/images/product',$lims_product_list[1+$i*5]->base_image)}}" width="100%" />
<p>{{$lims_product_list[1+$i*5]->name}}</p>
<span>{{$lims_product_list[1+$i*5]->code}}</span>
</td>
@else
<td style="border:none;"></td>
@endif
@if(!empty($lims_product_list[2+$i*5]))
<td class="product-img sound-btn" title="{{$lims_product_list[2+$i*5]->name}}" data-product ="{{$lims_product_list[2+$i*5]->code . ' (' . $lims_product_list[2+$i*5]->name . ')'}}"><img src="{{url('public/images/product',$lims_product_list[2+$i*5]->base_image)}}" width="100%" />
<p>{{$lims_product_list[2+$i*5]->name}}</p>
<span>{{$lims_product_list[2+$i*5]->code}}</span>
</td>
@else
<td style="border:none;"></td>
@endif
@if(!empty($lims_product_list[3+$i*5]))
<td class="product-img sound-btn" title="{{$lims_product_list[3+$i*5]->name}}" data-product ="{{$lims_product_list[3+$i*5]->code . ' (' . $lims_product_list[3+$i*5]->name . ')'}}"><img src="{{url('public/images/product',$lims_product_list[3+$i*5]->base_image)}}" width="100%" />
<p>{{$lims_product_list[3+$i*5]->name}}</p>
<span>{{$lims_product_list[3+$i*5]->code}}</span>
</td>
@else
<td style="border:none;"></td>
@endif
@if(!empty($lims_product_list[4+$i*5]))
<td class="product-img sound-btn" title="{{$lims_product_list[4+$i*5]->name}}" data-product ="{{$lims_product_list[4+$i*5]->code . ' (' . $lims_product_list[4+$i*5]->name . ')'}}"><img src="{{url('public/images/product',$lims_product_list[4+$i*5]->base_image)}}" width="100%" />
<p>{{$lims_product_list[4+$i*5]->name}}</p>
<span>{{$lims_product_list[4+$i*5]->code}}</span>
</td>
@else
<td style="border:none;"></td>
@endif
</tr>
@endfor
</tbody>
</table>
</div>
</div>
</div>
<!-- product edit modal -->
<div id="editModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 id="modal_header" class="modal-title"></h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<form>
<div class="row modal-element">
<div class="col-md-4 form-group">
<label>{{trans('file.Quantity')}}</label>
<input type="text" name="edit_qty" class="form-control numkey">
</div>
<div class="col-md-4 form-group">
<label>{{trans('file.Unit Discount')}}</label>
<input type="text" name="edit_discount" class="form-control numkey">
</div>
<div class="col-md-4 form-group">
<label>{{trans('file.Unit Price')}}</label>
<input type="text" name="edit_unit_price" class="form-control numkey" step="any">
</div>
<?php
$tax_name_all[] = 'No Tax';
$tax_rate_all[] = 0;
foreach($lims_tax_list as $tax) {
$tax_name_all[] = $tax->name;
$tax_rate_all[] = $tax->rate;
}
?>
<div class="col-md-4 form-group">
<label>{{trans('file.Tax Rate')}}</label>
<select name="edit_tax_rate" class="form-control selectpicker">
@foreach($tax_name_all as $key => $name)
<option value="{{$key}}">{{$name}}</option>
@endforeach
</select>
</div>
<div id="edit_unit" class="col-md-4 form-group">
<label>{{trans('file.Product Unit')}}</label>
<select name="edit_unit" class="form-control selectpicker">
</select>
</div>
<?php
$warranty_title_all[] = 'No Warranty';
foreach($lims_warranty_list as $warranty) {
$warranty_title_all[] = $warranty->title;
}
?>
<div class="col-md-4 form-group">
<label>{{trans('file.Warranty')}}</label>
<select name="edit_warranty" class="form-control selectpicker">
@foreach($warranty_title_all as $key => $title)
<option value="{{$key}}">{{$title}}</option>
@endforeach
</select>
</div>
</div>
<button type="button" name="update_btn" class="btn btn-primary">{{trans('file.update')}}</button>
</form>
</div>
</div>
</div>
</div>
<!-- add customer modal -->
<div id="addCustomer" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
{!! Form::open(['route' => 'customer.store', 'method' => 'post', 'files' => true]) !!}
<div class="modal-header">
<h5 id="exampleModalLabel" class="modal-title">{{trans('file.Add Customer')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<p class="italic"><small>{{trans('file.The field labels marked with * are required input fields')}}.</small></p>
<div class="form-group">
<label>{{trans('file.Customer Group')}} *</strong> </label>
<select required class="form-control selectpicker" name="customer_group_id">
@foreach($lims_customer_group_all as $customer_group)
<option value="{{$customer_group->id}}">{{$customer_group->name}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label>{{trans('file.name')}} *</strong> </label>
<input type="text" name="customer_name" required class="form-control">
</div>
<div class="form-group">
<label>{{trans('file.Email')}}</label>
<input type="text" name="email" placeholder="[email protected]" class="form-control">
</div>
<div class="form-group">
<label>{{trans('file.Phone Number')}} *</label>
<input type="text" name="phone_number" required class="form-control">
</div>
<div class="form-group">
<label>{{trans('file.Address')}} *</label>
<input type="text" name="address" required class="form-control">
</div>
<div class="form-group">
<label>{{trans('file.City')}} *</label>
<input type="text" name="city" required class="form-control">
</div>
<div class="form-group">
<input type="hidden" name="pos" value="1">
<input type="submit" value="{{trans('file.submit')}}" class="btn btn-primary">
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
<!-- recent transaction modal -->
<div id="recentTransaction" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 id="exampleModalLabel" class="modal-title">{{trans('file.Recent Transaction')}} <div class="badge badge-primary">{{trans('file.latest')}} 10</div></h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" href="#sale-latest" role="tab" data-toggle="tab">{{trans('file.Sale')}}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#draft-latest" role="tab" data-toggle="tab">{{trans('file.Draft')}}</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane show active" id="sale-latest">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{{trans('file.date')}}</th>
<th>{{trans('file.reference')}}</th>
<th>{{trans('file.customer')}}</th>
<th>{{trans('file.grand total')}}</th>
<th>{{trans('file.action')}}</th>
</tr>
</thead>
<tbody>
@foreach($recent_sale as $sale)
<?php $customer = DB::table('customers')->find($sale->customer_id); ?>
<tr>
<td>{{date('d-m-Y', strtotime($sale->created_at))}}</td>
<td>{{$sale->reference_no}}</td>
<td>{{$customer->name}}</td>
<td>{{$sale->grand_total}}</td>
<td>
<div class="btn-group">
@if(in_array("sales-edit", $all_permission))
<a href="{{ route('sales.edit', $sale->id) }}" class="btn btn-success btn-sm" title="Edit"><i class="dripicons-document-edit"></i></a>
@endif
@if(in_array("sales-delete", $all_permission))
{{ Form::open(['route' => ['sales.destroy', $sale->id], 'method' => 'DELETE'] ) }}
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirmDelete()" title="Delete"><i class="dripicons-trash"></i></button>
{{ Form::close() }}
@endif
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="draft-latest">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{{trans('file.date')}}</th>
<th>{{trans('file.reference')}}</th>
<th>{{trans('file.customer')}}</th>
<th>{{trans('file.grand total')}}</th>
<th>{{trans('file.action')}}</th>
</tr>
</thead>
<tbody>
@foreach($recent_draft as $draft)
<?php $customer = DB::table('customers')->find($draft->customer_id); ?>
<tr>
<td>{{date('d-m-Y', strtotime($draft->created_at))}}</td>
<td>{{$draft->reference_no}}</td>
<td>{{$customer->name}}</td>
<td>{{$draft->grand_total}}</td>
<td>
<div class="btn-group">
@if(in_array("sales-edit", $all_permission))
<a href="{{url('sales/'.$draft->id.'/create') }}" class="btn btn-success btn-sm" title="Edit"><i class="dripicons-document-edit"></i></a>
@endif
@if(in_array("sales-delete", $all_permission))
{{ Form::open(['route' => ['sales.destroy', $draft->id], 'method' => 'DELETE'] ) }}
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirmDelete()" title="Delete"><i class="dripicons-trash"></i></button>
{{ Form::close() }}
@endif
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- add cash register modal -->
<div id="cash-register-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
{!! Form::open(['route' => 'cashRegister.store', 'method' => 'post']) !!}
<div class="modal-header">
<h5 id="exampleModalLabel" class="modal-title">{{trans('file.Add Cash Register')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<p class="italic"><small>{{trans('file.The field labels marked with * are required input fields')}}.</small></p>
<div class="row">
<div class="col-md-6 form-group warehouse-section">
<label>{{trans('file.Warehouse')}} *</strong> </label>
<select required name="warehouse_id" class="selectpicker form-control" data-live-search="true" data-live-search-style="begins" title="Select warehouse...">
@foreach($lims_warehouse_list as $warehouse)
<option value="{{$warehouse->id}}">{{$warehouse->name}}</option>
@endforeach
</select>
</div>
<div class="col-md-6 form-group">
<label>{{trans('file.Cash in Hand')}} *</strong> </label>
<input type="number" name="cash_in_hand" required class="form-control">
</div>
<div class="col-md-12 form-group">
<button type="submit" class="btn btn-primary">{{trans('file.submit')}}</button>
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
<!-- cash register details modal -->
<div id="register-details-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 id="exampleModalLabel" class="modal-title">{{trans('file.Cash Register Details')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<p>{{trans('file.Please review the transaction and payments.')}}</p>
<div class="row">
<div class="col-md-12">
<table class="table table-hover">
<tbody>
<tr>
<td>{{trans('file.Cash in Hand')}}:</td>
<td id="cash_in_hand" class="text-right">0</td>
</tr>
<tr>
<td>{{trans('file.Total Sale Amount')}}:</td>
<td id="total_sale_amount" class="text-right"></td>
</tr>
<tr>
<td>{{trans('file.Total Payment')}}:</td>
<td id="total_payment" class="text-right"></td>
</tr>
@if(in_array("cash",$options))
<tr>
<td>{{trans('file.Cash Payment')}}:</td>
<td id="cash_payment" class="text-right"></td>
</tr>
@endif
@if(in_array("card",$options))
<tr>
<td>{{trans('file.Credit Card Payment')}}:</td>
<td id="credit_card_payment" class="text-right"></td>
</tr>
@endif
@if(in_array("cheque",$options))
<tr>
<td>{{trans('file.Cheque Payment')}}:</td>
<td id="cheque_payment" class="text-right"></td>
</tr>
@endif
@if(in_array("gift_card",$options))
<tr>
<td>{{trans('file.Gift Card Payment')}}:</td>
<td id="gift_card_payment" class="text-right"></td>
</tr>
@endif
@if(in_array("deposit",$options))
<tr>
<td>{{trans('file.Deposit Payment')}}:</td>
<td id="deposit_payment" class="text-right"></td>
</tr>
@endif
@if(in_array("paypal",$options) && (strlen(env('PAYPAL_LIVE_API_USERNAME'))>0) && (strlen(env('PAYPAL_LIVE_API_PASSWORD'))>0) && (strlen(env('PAYPAL_LIVE_API_SECRET'))>0))
<tr>
<td>{{trans('file.Paypal Payment')}}:</td>
<td id="paypal_payment" class="text-right"></td>
</tr>
@endif
<tr>
<td>{{trans('file.Total Sale Return')}}:</td>
<td id="total_sale_return" class="text-right"></td>
</tr>
<tr>
<td>{{trans('file.Total Expense')}}:</td>
<td id="total_expense" class="text-right"></td>
</tr>
<tr>
<td><strong>{{trans('file.Total Cash')}}:</strong></td>
<td id="total_cash" class="text-right"></td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-6" id="closing-section">
<form action="{{route('cashRegister.close')}}" method="POST">
@csrf
<input type="hidden" name="cash_register_id">
<button type="submit" class="btn btn-primary">{{trans('file.Close Register')}}</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- today sale modal -->
<div id="today-sale-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 id="exampleModalLabel" class="modal-title">{{trans('file.Today Sale')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<p>{{trans('file.Please review the transaction and payments.')}}</p>
<div class="row">
<div class="col-md-12">
<table class="table table-hover">
<tbody>
<tr>
<td>{{trans('file.Total Sale Amount')}}:</td>
<td class="total_sale_amount text-right"></td>
</tr>
<tr>
<td>{{trans('file.Cash Payment')}}:</td>
<td class="cash_payment text-right"></td>
</tr>
<tr>
<td>{{trans('file.Credit Card Payment')}}:</td>
<td class="credit_card_payment text-right"></td>
</tr>
<tr>
<td>{{trans('file.Cheque Payment')}}:</td>
<td class="cheque_payment text-right"></td>
</tr>
<tr>
<td>{{trans('file.Gift Card Payment')}}:</td>
<td class="gift_card_payment text-right"></td>
</tr>
<tr>
<td>{{trans('file.Deposit Payment')}}:</td>
<td class="deposit_payment text-right"></td>
</tr>
@if(in_array("paypal",$options) && (strlen(env('PAYPAL_LIVE_API_USERNAME'))>0) && (strlen(env('PAYPAL_LIVE_API_PASSWORD'))>0) && (strlen(env('PAYPAL_LIVE_API_SECRET'))>0))
<tr>
<td>{{trans('file.Paypal Payment')}}:</td>
<td class="paypal_payment text-right"></td>
</tr>
@endif
<tr>
<td>{{trans('file.Total Payment')}}:</td>
<td class="total_payment text-right"></td>
</tr>
<tr>
<td>{{trans('file.Total Sale Return')}}:</td>
<td class="total_sale_return text-right"></td>
</tr>
<tr>
<td>{{trans('file.Total Expense')}}:</td>
<td class="total_expense text-right"></td>
</tr>
<tr>
<td><strong>{{trans('file.Total Cash')}}:</strong></td>
<td class="total_cash text-right"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- today profit modal -->
<div id="today-profit-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 id="exampleModalLabel" class="modal-title">{{trans('file.Today Profit')}}</h5>
<button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<select required name="warehouseId" class="form-control">
<option value="0">{{trans('file.All Warehouse')}}</option>
@foreach($lims_warehouse_list as $warehouse)
<option value="{{$warehouse->id}}">{{$warehouse->name}}</option>
@endforeach
</select>
</div>
<div class="col-md-12 mt-2">
<table class="table table-hover">
<tbody>
<tr>
<td>{{trans('file.Product Revenue')}}:</td>
<td class="product_revenue text-right"></td>
</tr>
<tr>
<td>{{trans('file.Product Cost')}}:</td>
<td class="product_cost text-right"></td>
</tr>
<tr>
<td>{{trans('file.Expense')}}:</td>
<td class="expense_amount text-right"></td>
</tr>
<tr>
<td><strong>{{trans('file.Profit')}}:</strong></td>
<td class="profit text-right"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
newWin.document.close();
setTimeout(function(){newWin.close();},10);
});
$('body').on('click', function(e){ $('.filter-window').hide('slide', {direction: 'right'}, 'fast'); });
$('#category-filter').on('click', function(e){ e.stopPropagation(); $('.filter-window').show('slide', {direction: 'right'}, 'fast'); $('.category').show(); $('.brand').hide(); });
$('.category-img').on('click', function(){ var category_id = $(this).data('category'); var brand_id = 0;
$(".table-container").children().remove();
$.get('sales/getproduct/' + category_id + '/' + brand_id, function(data) {
populateProduct(data);
});
});
$('#brand-filter').on('click', function(e){ e.stopPropagation(); $('.filter-window').show('slide', {direction: 'right'}, 'fast'); $('.brand').show(); $('.category').hide(); });
$('.brand-img').on('click', function(){ var brand_id = $(this).data('brand'); var category_id = 0;
$(".table-container").children().remove();
$.get('sales/getproduct/' + category_id + '/' + brand_id, function(data) {
populateProduct(data);
});
});
$('#featured-filter').on('click', function(){ $(".table-container").children().remove(); $.get('sales/getfeatured', function(data) { populateProduct(data); }); });
function populateProduct(data) { var tableData = ' ';
if (Object.keys(data).length != 0) {
$.each(data['name'], function(index) {
var product_info = data['code'][index]+' (' + data['name'][index] + ')';
if(index % 5 == 0 && index != 0)
tableData += '</tr><tr><td class="product-img sound-btn" title="'+data['name'][index]+'" data-product = "'+product_info+'"><img src="public/images/product/'+data['image'][index]+'" width="100%" /><p>'+data['name'][index]+'</p><span>'+data['code'][index]+'</span></td>';
else
tableData += '<td class="product-img sound-btn" title="'+data['name'][index]+'" data-product = "'+product_info+'"><img src="public/images/product/'+data['image'][index]+'" width="100%" /><p>'+data['name'][index]+'</p><span>'+data['code'][index]+'</span></td>';
});
if(data['name'].length % 5){
var number = 5 - (data['name'].length % 5);
while(number > 0)
{
tableData += '<td style="border:none;"></td>';
number--;
}
}
tableData += '</tr></tbody></table>';
$(".table-container").html(tableData);
$('#product-table').DataTable( {
"order": [],
'pageLength': product_row_number,
'language': {
'paginate': {
'previous': '<i class="fa fa-angle-left"></i>',
'next': '<i class="fa fa-angle-right"></i>'
}
},
dom: 'tp'
});
$('table.product-list').hide();
$('table.product-list').show(500);
}
else{
tableData += '<td class="text-center">No data avaialable</td></tr></tbody></table>'
$(".table-container").html(tableData);
}
}
$('select[name="customer_id"]').on('change', function() { saveValue(this); var id = $(this).val(); $.get('sales/getcustomergroup/' + id, function(data) { customer_group_rate = (data / 100); }); });
$('select[name="biller_id"]').on('change', function() { saveValue(this); });
$('select[name="warehouse_id"]').on('change', function() { saveValue(this); warehouse_id = $(this).val(); $.get('sales/getproduct/' + warehouse_id, function(data) { lims_product_array = []; product_code = data[0]; product_name = data[1]; product_qty = data[2]; product_type = data[3]; product_id = data[4]; product_list = data[5]; qty_list = data[6]; product_warehouse_price = data[7]; batch_no = data[8]; product_batch_id = data[9]; is_embeded = data[11]; $.each(product_code, function(index) { if(is_embeded[index]) lims_product_array.push(product_code[index] + ' (' + product_name[index] + ')|' + is_embeded[index]); else lims_product_array.push(product_code[index] + ' (' + product_name[index] + ')'); }); });
isCashRegisterAvailable(warehouse_id);
});
var lims_productcodeSearch = $('#lims_productcodeSearch');
lims_productcodeSearch.autocomplete({ source: function(request, response) { var matcher = new RegExp(".?" + $.ui.autocomplete.escapeRegex(request.term), "i"); response($.grep(lims_product_array, function(item) { return matcher.test(item); })); }, response: function(event, ui) { if (ui.content.length == 1) { var data = ui.content[0].value; $(this).autocomplete( "close" ); productSearch(data); } else if(ui.content.length == 0 && $('#lims_productcodeSearch').val().length == 13) { productSearch($('#lims_productcodeSearch').val()+'|'+1); } }, select: function(event, ui) { var data = ui.item.value; productSearch(data); }, });
$('#myTable').keyboard({ accepted : function(event, keyboard, el) { checkQuantity(el.value, true); } });
$("#myTable").on('click', '.plus', function() { rowindex = $(this).closest('tr').index(); var qty = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .qty').val(); if(!qty) qty = 1; else qty = parseFloat(qty) + 1; if(is_variant[rowindex]) checkQuantity(String(qty), true); else checkDiscount(qty, true); });
$("#myTable").on('click', '.minus', function() { rowindex = $(this).closest('tr').index(); var qty = parseFloat($('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .qty').val()) - 1; if (qty > 0) { $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .qty').val(qty); } else { qty = 1; } if(is_variant[rowindex]) checkQuantity(String(qty), true); else checkDiscount(qty, true); });
$("#myTable").on("change", ".batch-no", function () { rowindex = $(this).closest('tr').index(); var product_id = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product-id').val(); var warehouse_id = $('#warehouse_id').val(); $.get('check-batch-availability/' + product_id + '/' + $(this).val() + '/' + warehouse_id, function(data) { if(data['message'] != 'ok') { alert(data['message']); $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.batch-no').val(''); $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product-batch-id').val(''); } else { $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product-batch-id').val(data['product_batch_id']); code = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product-code').val(); pos = product_code.indexOf(code); product_qty[pos] = data['qty']; } }); });
//Change quantity $("#myTable").on('input', '.qty', function() { rowindex = $(this).closest('tr').index(); if($(this).val() < 0 && $(this).val() != '') { $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .qty').val(1); alert("Quantity can't be less than 0"); } if(is_variant[rowindex]) checkQuantity($(this).val(), true); else checkDiscount($(this).val(), true); });
$("#myTable").on('click', '.qty', function() { rowindex = $(this).closest('tr').index(); });
$(document).on('click', '.sound-btn', function() { var audio = $("#mysoundclip1")[0]; audio.play(); });
$(document).on('click', '.product-img', function() { var customer_id = $('#customer_id').val(); var warehouse_id = $('select[name="warehouse_id"]').val(); if(!customer_id) alert('Please select Customer!'); else if(!warehouse_id) alert('Please select Warehouse!'); else{ var data = $(this).data('product'); product_info = data.split(" "); pos = product_code.indexOf(product_info[0]); if(pos < 0) alert('Product is not avaialable in the selected warehouse'); else{ productSearch(data); } } }); //Delete product $("table.order-list tbody").on("click", ".ibtnDel", function(event) { var audio = $("#mysoundclip2")[0]; audio.play(); rowindex = $(this).closest('tr').index(); product_price.splice(rowindex, 1); product_discount.splice(rowindex, 1); tax_rate.splice(rowindex, 1); tax_name.splice(rowindex, 1); tax_method.splice(rowindex, 1); unit_name.splice(rowindex, 1); unit_operator.splice(rowindex, 1); unit_operation_value.splice(rowindex, 1);
localStorageProductId.splice(rowindex, 1);
localStorageQty.splice(rowindex, 1);
localStorageSaleUnit.splice(rowindex, 1);
localStorageProductDiscount.splice(rowindex, 1);
localStorageTaxRate.splice(rowindex, 1);
localStorageNetUnitPrice.splice(rowindex, 1);
localStorageTaxValue.splice(rowindex, 1);
localStorageSubTotalUnit.splice(rowindex, 1);
localStorageSubTotal.splice(rowindex, 1);
localStorageProductCode.splice(rowindex, 1);
localStorageTaxName.splice(rowindex, 1);
localStorageTaxMethod.splice(rowindex, 1);
localStorageTempUnitName.splice(rowindex, 1);
localStorageSaleUnitOperator.splice(rowindex, 1);
localStorageSaleUnitOperationValue.splice(rowindex, 1);
localStorage.setItem("localStorageProductId", localStorageProductId);
localStorage.setItem("localStorageQty", localStorageQty);
localStorage.setItem("localStorageSaleUnit", localStorageSaleUnit);
localStorage.setItem("localStorageProductCode", localStorageProductCode);
localStorage.setItem("localStorageProductDiscount", localStorageProductDiscount);
localStorage.setItem("localStorageTaxRate", localStorageTaxRate);
localStorage.setItem("localStorageTaxName", localStorageTaxName);
localStorage.setItem("localStorageTaxMethod", localStorageTaxMethod);
localStorage.setItem("localStorageTempUnitName", localStorageTempUnitName);
localStorage.setItem("localStorageSaleUnitOperator", localStorageSaleUnitOperator);
localStorage.setItem("localStorageSaleUnitOperationValue", localStorageSaleUnitOperationValue);
localStorage.setItem("localStorageNetUnitPrice", localStorageNetUnitPrice);
localStorage.setItem("localStorageTaxValue", localStorageTaxValue);
localStorage.setItem("localStorageSubTotalUnit", localStorageSubTotalUnit);
localStorage.setItem("localStorageSubTotal", localStorageSubTotal);
$(this).closest("tr").remove();
localStorage.setItem("tbody-id", $("table.order-list tbody").html());
calculateTotal();
});
//Edit product $("table.order-list").on("click", ".edit-product", function() { rowindex = $(this).closest('tr').index(); edit(); });
//Update product $('button[name="update_btn"]').on("click", function() { if(is_imei[rowindex]) { var imeiNumbers = $("#editModal input[name=imei_numbers]").val(); $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.imei-number').val(imeiNumbers); }
var edit_discount = $('input[name="edit_discount"]').val();
var edit_qty = $('input[name="edit_qty"]').val();
var edit_unit_price = $('input[name="edit_unit_price"]').val();
if (parseFloat(edit_discount) > parseFloat(edit_unit_price)) {
alert('Invalid Discount Input!');
return;
}
if(edit_qty < 0) {
$('input[name="edit_qty"]').val(1);
edit_qty = 1;
alert("Quantity can't be less than 0");
}
var tax_rate_all = <?php echo json_encode($tax_rate_all) ?>;
tax_rate[rowindex] = localStorageTaxRate[rowindex] = parseFloat(tax_rate_all[$('select[name="edit_tax_rate"]').val()]);
product_discount[rowindex] = $('input[name="edit_discount"]').val();
if(product_type[pos] == 'standard'){
var row_unit_operator = unit_operator[rowindex].slice(0, unit_operator[rowindex].indexOf(","));
var row_unit_operation_value = unit_operation_value[rowindex].slice(0, unit_operation_value[rowindex].indexOf(","));
if (row_unit_operator == '*') {
product_price[rowindex] = $('input[name="edit_unit_price"]').val() / row_unit_operation_value;
} else {
product_price[rowindex] = $('input[name="edit_unit_price"]').val() * row_unit_operation_value;
}
var position = $('select[name="edit_unit"]').val();
var temp_operator = temp_unit_operator[position];
var temp_operation_value = temp_unit_operation_value[position];
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.sale-unit').val(temp_unit_name[position]);
temp_unit_name.splice(position, 1);
temp_unit_operator.splice(position, 1);
temp_unit_operation_value.splice(position, 1);
temp_unit_name.unshift($('select[name="edit_unit"] option:selected').text());
temp_unit_operator.unshift(temp_operator);
temp_unit_operation_value.unshift(temp_operation_value);
unit_name[rowindex] = localStorageTempUnitName[rowindex] = temp_unit_name.toString() + ',';
unit_operator[rowindex] = localStorageSaleUnitOperator[rowindex] = temp_unit_operator.toString() + ',';
unit_operation_value[rowindex] = localStorageSaleUnitOperationValue[rowindex] = temp_unit_operation_value.toString() + ',';
localStorage.setItem("localStorageTaxRate", localStorageTaxRate);
localStorage.setItem("localStorageTaxName", localStorageTaxName);
localStorage.setItem("localStorageTempUnitName", localStorageTempUnitName);
localStorage.setItem("localStorageSaleUnitOperator", localStorageSaleUnitOperator);
localStorage.setItem("localStorageSaleUnitOperationValue", localStorageSaleUnitOperationValue);
}
else {
product_price[rowindex] = $('input[name="edit_unit_price"]').val();
}
checkDiscount(edit_qty, false);
});
$('button[name="order_discount_btn"]').on("click", function() { calculateGrandTotal(); });
$('button[name="shipping_cost_btn"]').on("click", function() { calculateGrandTotal(); });
$('button[name="order_tax_btn"]').on("click", function() { calculateGrandTotal(); });
$(".coupon-check").on("click",function() { couponDiscount(); });
$(".payment-btn").on("click", function() { var audio = $("#mysoundclip2")[0]; audio.play(); $('input[name="paid_amount"]').val($("#grand-total").text()); $('input[name="paying_amount"]').val($("#grand-total").text()); $('.qc').data('initial', 1); });
$("#draft-btn").on("click",function(){ var audio = $("#mysoundclip2")[0]; audio.play(); $('input[name="sale_status"]').val(3); $('input[name="paying_amount"]').prop('required',false); $('input[name="paid_amount"]').prop('required',false); var rownumber = $('table.order-list tbody tr:last').index(); if (rownumber < 0) { alert("Please insert product to order table!") } else $('.payment-form').submit(); });
$("#submit-btn").on("click", function() { $('.payment-form').submit(); });
$("#gift-card-btn").on("click",function() { $('select[name="paid_by_id_select"]').val(2); $('.selectpicker').selectpicker('refresh'); $('div.qc').hide(); giftCard(); });
$("#credit-card-btn").on("click",function() { $('select[name="paid_by_id_select"]').val(3); $('.selectpicker').selectpicker('refresh'); $('div.qc').hide(); creditCard(); });
$("#cheque-btn").on("click",function() { $('select[name="paid_by_id_select"]').val(4); $('.selectpicker').selectpicker('refresh'); $('div.qc').hide(); cheque(); });
$("#cash-btn").on("click",function() { $('select[name="paid_by_id_select"]').val(1); $('.selectpicker').selectpicker('refresh'); $('div.qc').show(); hide(); });
$("#paypal-btn").on("click",function() { $('select[name="paid_by_id_select"]').val(5); $('.selectpicker').selectpicker('refresh'); $('div.qc').hide(); hide(); });
$("#deposit-btn").on("click",function() { $('select[name="paid_by_id_select"]').val(6); $('.selectpicker').selectpicker('refresh'); $('div.qc').hide(); hide(); deposits(); });
$("#point-btn").on("click",function() { $('select[name="paid_by_id_select"]').val(7); $('.selectpicker').selectpicker('refresh'); $('div.qc').hide(); hide(); pointCalculation(); });
$('select[name="paid_by_id_select"]').on("change", function() { var id = $(this).val(); $(".payment-form").off("submit"); if(id == 2) { $('div.qc').hide(); giftCard(); } else if (id == 3) { $('div.qc').hide(); creditCard(); } else if (id == 4) { $('div.qc').hide(); cheque(); } else { hide(); if(id == 1) $('div.qc').show(); else if(id == 6) { $('div.qc').hide(); deposits(); } else if(id == 7) { $('div.qc').hide(); pointCalculation(); } } });
$('#add-payment select[name="gift_card_id_select"]').on("change", function() { var balance = gift_card_amount[$(this).val()] - gift_card_expense[$(this).val()]; $('#add-payment input[name="gift_card_id"]').val($(this).val()); if($('input[name="paid_amount"]').val() > balance){ alert('Amount exceeds card balance! Gift Card balance: '+ balance); } });
$('#add-payment input[name="paying_amount"]').on("input", function() { change($(this).val(), $('input[name="paid_amount"]').val()); });
$('input[name="paid_amount"]').on("input", function() { if( $(this).val() > parseFloat($('input[name="paying_amount"]').val()) ) { alert('Paying amount cannot be bigger than recieved amount'); $(this).val(''); } else if( $(this).val() > parseFloat($('#grand-total').text()) ){ alert('Paying amount cannot be bigger than grand total'); $(this).val(''); }
change( $('input[name="paying_amount"]').val(), $(this).val() );
var id = $('select[name="paid_by_id_select"]').val();
if(id == 2){
var balance = gift_card_amount[$("#gift_card_id_select").val()] - gift_card_expense[$("#gift_card_id_select").val()];
if($(this).val() > balance)
alert('Amount exceeds card balance! Gift Card balance: '+ balance);
}
else if(id == 6){
if( $('input[name="paid_amount"]').val() > deposit[$('#customer_id').val()] )
alert('Amount exceeds customer deposit! Customer deposit : '+ deposit[$('#customer_id').val()]);
}
});
$('.transaction-btn-plus').on("click", function() { $(this).addClass('d-none'); $('.transaction-btn-close').removeClass('d-none'); });
$('.transaction-btn-close').on("click", function() { $(this).addClass('d-none'); $('.transaction-btn-plus').removeClass('d-none'); });
$('.coupon-btn-plus').on("click", function() { $(this).addClass('d-none'); $('.coupon-btn-close').removeClass('d-none'); });
$('.coupon-btn-close').on("click", function() { $(this).addClass('d-none'); $('.coupon-btn-plus').removeClass('d-none'); });
$(document).on('click', '.qc-btn', function(e) { if($(this).data('amount')) { if($('.qc').data('initial')) { $('input[name="paying_amount"]').val( $(this).data('amount').toFixed({{$general_setting->decimal}}) ); $('.qc').data('initial', 0); } else { $('input[name="paying_amount"]').val( (parseFloat($('input[name="paying_amount"]').val()) + $(this).data('amount')).toFixed({{$general_setting->decimal}}) ); } } else $('input[name="paying_amount"]').val('{{number_format(0, $general_setting->decimal, '.', '')}}'); change( $('input[name="paying_amount"]').val(), $('input[name="paid_amount"]').val() ); });
function change(paying_amount, paid_amount) { $("#change").text( parseFloat(paying_amount - paid_amount).toFixed({{$general_setting->decimal}}) ); }
function confirmDelete() { if (confirm("Are you sure want to delete?")) { return true; } return false; }
function productSearch(data) { var product_info = data.split(" "); var product_code = product_info[0]; var pre_qty = 0; $(".product-code").each(function(i) { if ($(this).val() == product_code) { rowindex = i; pre_qty = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .qty').val(); } }); data += '?'+$('#customer_id').val()+'?'+(parseFloat(pre_qty) + 1); $.ajax({ type: 'GET', url: 'sales/lims_product_search', data: { data: data }, success: function(data) { console.log(pre_qty); var flag = 1; if (pre_qty > 0) { /if(pre_qty) var qty = parseFloat(pre_qty) + data[15]; else/ var qty = data[15]; $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .qty').val(qty); pos = product_code.indexOf(data[1]); if(!data[11] && product_warehouse_price[pos]) { product_price[rowindex] = parseFloat(product_warehouse_price[pos] * currency['exchange_rate']) + parseFloat(product_warehouse_price[pos] * currency['exchange_rate'] * customer_group_rate); } else{ product_price[rowindex] = parseFloat(data[2] * currency['exchange_rate']) + parseFloat(data[2] * currency['exchange_rate'] * customer_group_rate); } flag = 0; checkQuantity(String(qty), true); flag = 0; localStorage.setItem("tbody-id", $("table.order-list tbody").html()); } $("input[name='product_code_name']").val(''); if(flag){ addNewProduct(data); } } }); }
function addNewProduct(data){ var newRow = $(""); var cols = ''; temp_unit_name = (data[6]).split(','); pos = product_code.indexOf(data[1]); cols += '' + data[0] + '' + data[1] + 'In Stock: '; if(data[12]) { cols += ' '; } else { cols += ' '; } cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += ''; cols += '';
newRow.append(cols);
if(keyboard_active==1) {
$("table.order-list tbody").prepend(newRow).find('.qty').keyboard({usePreview: false, layout: 'custom', display: { 'accept' : '✔', 'cancel' : '✖' }, customLayout : {
'normal' : ['1 2 3', '4 5 6', '7 8 9','0 {dec} {bksp}','{clear} {cancel} {accept}']}, restrictInput : true, preventPaste : true, autoAccept : true, css: { container: 'center-block dropdown-menu', buttonDefault: 'btn btn-default', buttonHover: 'btn-primary',buttonAction: 'active', buttonDisabled: 'disabled'},});
}
else
$("table.order-list tbody").prepend(newRow);
rowindex = newRow.index();
if(!data[11] && product_warehouse_price[pos]) {
product_price.splice(rowindex, 0, parseFloat(product_warehouse_price[pos] * currency['exchange_rate']) + parseFloat(product_warehouse_price[pos] * currency['exchange_rate'] * customer_group_rate));
}
else {
product_price.splice(rowindex, 0, parseFloat(data[2] * currency['exchange_rate']) + parseFloat(data[2] * currency['exchange_rate'] * customer_group_rate));
}
product_discount.splice(rowindex, 0, '{{number_format(0, $general_setting->decimal, '.', '')}}');
tax_rate.splice(rowindex, 0, parseFloat(data[3]));
tax_name.splice(rowindex, 0, data[4]);
tax_method.splice(rowindex, 0, data[5]);
unit_name.splice(rowindex, 0, data[6]);
unit_operator.splice(rowindex, 0, data[7]);
unit_operation_value.splice(rowindex, 0, data[8]);
is_imei.splice(rowindex, 0, data[13]);
is_variant.splice(rowindex, 0, data[14]);
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product_price').val(product_price[rowindex]);
localStorageQty.splice(rowindex, 0, data[15]);
localStorageProductId.splice(rowindex, 0, data[9]);
localStorageProductCode.splice(rowindex, 0, data[1]);
localStorageSaleUnit.splice(rowindex, 0, temp_unit_name[0]);
localStorageProductDiscount.splice(rowindex, 0, product_discount[rowindex]);
localStorageTaxRate.splice(rowindex, 0, tax_rate[rowindex].toFixed({{$general_setting->decimal}}));
localStorageTaxName.splice(rowindex, 0, data[4]);
localStorageTaxMethod.splice(rowindex, 0, data[5]);
localStorageTempUnitName.splice(rowindex, 0, data[6]);
localStorageSaleUnitOperator.splice(rowindex, 0, data[7]);
localStorageSaleUnitOperationValue.splice(rowindex, 0, data[8]);
//put some dummy value
localStorageNetUnitPrice.splice(rowindex, 0, '{{number_format(0, $general_setting->decimal, '.', '')}}');
localStorageTaxValue.splice(rowindex, 0, '{{number_format(0, $general_setting->decimal, '.', '')}}');
localStorageSubTotalUnit.splice(rowindex, 0, '{{number_format(0, $general_setting->decimal, '.', '')}}');
localStorageSubTotal.splice(rowindex, 0, '{{number_format(0, $general_setting->decimal, '.', '')}}');
localStorage.setItem("localStorageProductId", localStorageProductId);
localStorage.setItem("localStorageSaleUnit", localStorageSaleUnit);
localStorage.setItem("localStorageProductCode", localStorageProductCode);
localStorage.setItem("localStorageTaxName", localStorageTaxName);
localStorage.setItem("localStorageTaxMethod", localStorageTaxMethod);
localStorage.setItem("localStorageTempUnitName", localStorageTempUnitName);
localStorage.setItem("localStorageSaleUnitOperator", localStorageSaleUnitOperator);
localStorage.setItem("localStorageSaleUnitOperationValue", localStorageSaleUnitOperationValue);
checkQuantity(data[15], true);
localStorage.setItem("tbody-id", $("table.order-list tbody").html());
if(data[13]) {
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.edit-product').click();
}
}
function edit(){ $(".imei-section").remove(); if(is_imei[rowindex]) { var imeiNumbers = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.imei-number').val();
htmlText = '<div class="col-md-12 form-group imei-section"><label>IMEI or Serial Numbers</label><input type="text" name="imei_numbers" value="'+imeiNumbers+'" class="form-control imei_number" placeholder="Type imei or serial numbers and separate them by comma. Example:1001,2001" step="any"></div>';
$("#editModal .modal-element").append(htmlText);
}
var row_product_name_code = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('td:nth-child(1)').text();
$('#modal_header').text(row_product_name_code);
var qty = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.qty').val();
$('input[name="edit_qty"]').val(qty);
$('input[name="edit_discount"]').val(parseFloat(product_discount[rowindex]).toFixed({{$general_setting->decimal}}));
var tax_name_all = <?php echo json_encode($tax_name_all) ?>;
pos = tax_name_all.indexOf(tax_name[rowindex]);
$('select[name="edit_tax_rate"]').val(pos);
var row_product_code = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product-code').val();
pos = product_code.indexOf(row_product_code);
if(product_type[pos] == 'standard'){
unitConversion();
temp_unit_name = (unit_name[rowindex]).split(',');
temp_unit_name.pop();
temp_unit_operator = (unit_operator[rowindex]).split(',');
temp_unit_operator.pop();
temp_unit_operation_value = (unit_operation_value[rowindex]).split(',');
temp_unit_operation_value.pop();
$('select[name="edit_unit"]').empty();
$.each(temp_unit_name, function(key, value) {
$('select[name="edit_unit"]').append('<option value="' + key + '">' + value + '</option>');
});
$("#edit_unit").show();
}
else{
row_product_price = product_price[rowindex];
$("#edit_unit").hide();
}
$('input[name="edit_unit_price"]').val(row_product_price.toFixed({{$general_setting->decimal}}));
$('.selectpicker').selectpicker('refresh');
}
function couponDiscount() { var rownumber = $('table.order-list tbody tr:last').index(); if (rownumber < 0) { alert("Please insert product to order table!") } else if($("#coupon-code").val() != ''){ valid = 0; $.each(coupon_list, function(key, value) { if($("#coupon-code").val() == value['code']){ valid = 1; todyDate = ; if(parseFloat(value['quantity']) <= parseFloat(value['used'])) alert('This Coupon is no longer available'); else if(todyDate > value['expired_date']) alert('This Coupon has expired!'); else if(value['type'] == 'fixed'){ if(parseFloat($('input[name="grand_total"]').val()) >= value['minimum_amount']) { $('input[name="grand_total"]').val($('input[name="grand_total"]').val() - value['amount']); $('#grand-total').text(parseFloat($('input[name="grand_total"]').val()).toFixed({{$general_setting->decimal}})); if(!$('input[name="coupon_active"]').val()) alert('Congratulation! You got '+value['amount']+' '+currency+' discount'); $(".coupon-check").prop("disabled",true); $("#coupon-code").prop("disabled",true); $('input[name="coupon_active"]').val(1); $("#coupon-modal").modal('hide'); $('input[name="coupon_id"]').val(value['id']); $('input[name="coupon_discount"]').val(value['amount']); $('#coupon-text').text(parseFloat(value['amount']).toFixed({{$general_setting->decimal}})); } else alert('Grand Total is not sufficient for discount! Required '+value['minimum_amount']+' '+currency); } else{ var grand_total = $('input[name="grand_total"]').val(); var coupon_discount = grand_total * (value['amount'] / 100); grand_total = grand_total - coupon_discount; $('input[name="grand_total"]').val(grand_total); $('#grand-total').text(parseFloat(grand_total).toFixed({{$general_setting->decimal}})); if(!$('input[name="coupon_active"]').val()) alert('Congratulation! You got '+value['amount']+'% discount'); $(".coupon-check").prop("disabled",true); $("#coupon-code").prop("disabled",true); $('input[name="coupon_active"]').val(1); $("#coupon-modal").modal('hide'); $('input[name="coupon_id"]').val(value['id']); $('input[name="coupon_discount"]').val(coupon_discount); $('#coupon-text').text(parseFloat(coupon_discount).toFixed({{$general_setting->decimal}})); } } }); if(!valid) alert('Invalid coupon code!'); } }
function checkDiscount(qty, flag) { var customer_id = $('#customer_id').val(); var product_id = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .product-id').val(); if(flag) { $.ajax({ type: 'GET', async: false, url: 'sales/check-discount?qty='+qty+'&customer_id='+customer_id+'&product_id='+product_id, success: function(data) { //console.log(data); pos = product_code.indexOf($('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .product-code').val()); product_price[rowindex] = parseFloat(data[0] * currency['exchange_rate']) + parseFloat(data[0] * currency['exchange_rate'] * customer_group_rate); } }); } $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ') .qty').val(qty); checkQuantity(String(qty), flag); localStorage.setItem("tbody-id", $("table.order-list tbody").html()); }
function checkQuantity(sale_qty, flag) { var row_product_code = $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product-code').val(); pos = product_code.indexOf(row_product_code); $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.in-stock').text(product_qty[pos]); localStorageQty[rowindex] = sale_qty; localStorage.setItem("localStorageQty", localStorageQty); if(product_type[pos] == 'standard') { var operator = unit_operator[rowindex].split(','); var operation_value = unit_operation_value[rowindex].split(','); if(operator[0] == '*') total_qty = sale_qty * operation_value[0]; else if(operator[0] == '/') total_qty = sale_qty / operation_value[0]; if (total_qty > parseFloat(product_qty[pos])) { alert('Quantity exceeds stock quantity!'); if (flag) { sale_qty = sale_qty.substring(0, sale_qty.length - 1); localStorageQty[rowindex] = sale_qty; localStorage.setItem("localStorageQty", localStorageQty); checkQuantity(sale_qty, true); } else { localStorageQty[rowindex] = sale_qty; localStorage.setItem("localStorageQty", localStorageQty); edit(); return; } } $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.qty').val(sale_qty); } else if(product_type[pos] == 'combo'){ child_id = product_list[pos].split(','); child_qty = qty_list[pos].split(','); $(child_id).each(function(index) { var position = product_id.indexOf(parseInt(child_id[index])); if( parseFloat(sale_qty * child_qty[index]) > product_qty[position] ) { alert('Quantity exceeds stock quantity!'); if (flag) { sale_qty = sale_qty.substring(0, sale_qty.length - 1); $('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.qty').val(sale_qty); } else { edit(); flag = true; return false; } } }); }
if(!flag){
$('#editModal').modal('hide');
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.qty').val(sale_qty);
}
calculateRowProductData(sale_qty);
}
function unitConversion() { var row_unit_operator = unit_operator[rowindex].slice(0, unit_operator[rowindex].indexOf(",")); var row_unit_operation_value = unit_operation_value[rowindex].slice(0, unit_operation_value[rowindex].indexOf(","));
if (row_unit_operator == '*') {
row_product_price = product_price[rowindex] * row_unit_operation_value;
} else {
row_product_price = product_price[rowindex] / row_unit_operation_value;
}
}
function calculateRowProductData(quantity) { if(product_type[pos] == 'standard') unitConversion(); else row_product_price = product_price[rowindex]; if (tax_method[rowindex] == 1) { var net_unit_price = row_product_price - product_discount[rowindex]; var tax = net_unit_price * quantity * (tax_rate[rowindex] / 100); var sub_total = (net_unit_price * quantity) + tax;
if(parseFloat(quantity))
var sub_total_unit = sub_total / quantity;
else
var sub_total_unit = sub_total;
}
else {
var sub_total_unit = row_product_price - product_discount[rowindex];
var net_unit_price = (100 / (100 + tax_rate[rowindex])) * sub_total_unit;
var tax = (sub_total_unit - net_unit_price) * quantity;
var sub_total = sub_total_unit * quantity;
}
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.discount-value').val((product_discount[rowindex] * quantity).toFixed({{$general_setting->decimal}}));
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.tax-rate').val(tax_rate[rowindex].toFixed({{$general_setting->decimal}}));
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.net_unit_price').val(net_unit_price.toFixed({{$general_setting->decimal}}));
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.tax-value').val(tax.toFixed({{$general_setting->decimal}}));
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.product-price').text(sub_total_unit.toFixed({{$general_setting->decimal}}));
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.sub-total').text(sub_total.toFixed({{$general_setting->decimal}}));
$('table.order-list tbody tr:nth-child(' + (rowindex + 1) + ')').find('.subtotal-value').val(sub_total.toFixed({{$general_setting->decimal}}));
localStorageProductDiscount.splice(rowindex, 1, (product_discount[rowindex] * quantity).toFixed({{$general_setting->decimal}}));
localStorageTaxRate.splice(rowindex, 1, tax_rate[rowindex].toFixed({{$general_setting->decimal}}));
localStorageNetUnitPrice.splice(rowindex, 1, net_unit_price.toFixed({{$general_setting->decimal}}));
localStorageTaxValue.splice(rowindex, 1, tax.toFixed({{$general_setting->decimal}}));
localStorageSubTotalUnit.splice(rowindex, 1, sub_total_unit.toFixed({{$general_setting->decimal}}));
localStorageSubTotal.splice(rowindex, 1, sub_total.toFixed({{$general_setting->decimal}}));
localStorage.setItem("localStorageProductDiscount", localStorageProductDiscount);
localStorage.setItem("localStorageTaxRate", localStorageTaxRate);
localStorage.setItem("localStorageNetUnitPrice", localStorageNetUnitPrice);
localStorage.setItem("localStorageTaxValue", localStorageTaxValue);
localStorage.setItem("localStorageSubTotalUnit", localStorageSubTotalUnit);
localStorage.setItem("localStorageSubTotal", localStorageSubTotal);
calculateTotal();
}
function calculateTotal() { //Sum of quantity var total_qty = 0; $("table.order-list tbody .qty").each(function(index) { if ($(this).val() == '') { total_qty += 0; } else { total_qty += parseFloat($(this).val()); } }); $('input[name="total_qty"]').val(total_qty);
//Sum of discount
var total_discount = 0;
$("table.order-list tbody .discount-value").each(function() {
total_discount += parseFloat($(this).val());
});
$('input[name="total_discount"]').val(total_discount.toFixed({{$general_setting->decimal}}));
//Sum of tax
var total_tax = 0;
$(".tax-value").each(function() {
total_tax += parseFloat($(this).val());
});
$('input[name="total_tax"]').val(total_tax.toFixed({{$general_setting->decimal}}));
//Sum of subtotal
var total = 0;
$(".sub-total").each(function() {
total += parseFloat($(this).text());
});
$('input[name="total_price"]').val(total.toFixed({{$general_setting->decimal}}));
calculateGrandTotal();
}
function calculateGrandTotal() { var item = $('table.order-list tbody tr:last').index(); var total_qty = parseFloat($('input[name="total_qty"]').val()); var subtotal = parseFloat($('input[name="total_price"]').val()); var order_tax = parseFloat($('select[name="order_tax_rate_select"]').val()); var order_discount_type = $('select[name="order_discount_type_select"]').val(); var order_discount_value = parseFloat($('input[name="order_discount_value"]').val());
if (!order_discount_value)
order_discount_value = {{number_format(0, $general_setting->decimal, '.', '')}};
if(order_discount_type == 'Flat')
var order_discount = parseFloat(order_discount_value);
else
var order_discount = parseFloat(subtotal * (order_discount_value / 100));
localStorage.setItem("order-tax-rate-select", order_tax);
localStorage.setItem("order-discount-type", order_discount_type);
$("#discount").text(order_discount.toFixed({{$general_setting->decimal}}));
$('input[name="order_discount"]').val(order_discount);
$('input[name="order_discount_type"]').val(order_discount_type);
var shipping_cost = parseFloat($('input[name="shipping_cost"]').val());
if (!shipping_cost)
shipping_cost = {{number_format(0, $general_setting->decimal, '.', '')}};
item = ++item + '(' + total_qty + ')';
order_tax = (subtotal - order_discount) * (order_tax / 100);
var grand_total = (subtotal + order_tax + shipping_cost) - order_discount;
$('input[name="grand_total"]').val(grand_total.toFixed({{$general_setting->decimal}}));
couponDiscount();
var coupon_discount = parseFloat($('input[name="coupon_discount"]').val());
if (!coupon_discount)
coupon_discount = {{number_format(0, $general_setting->decimal, '.', '')}};
grand_total -= coupon_discount;
$('#item').text(item);
$('input[name="item"]').val($('table.order-list tbody tr:last').index() + 1);
$('#subtotal').text(subtotal.toFixed({{$general_setting->decimal}}));
$('#tax').text(order_tax.toFixed({{$general_setting->decimal}}));
$('input[name="order_tax"]').val(order_tax.toFixed({{$general_setting->decimal}}));
$('#shipping-cost').text(shipping_cost.toFixed({{$general_setting->decimal}}));
$('#grand-total').text(grand_total.toFixed({{$general_setting->decimal}}));
$('input[name="grand_total"]').val(grand_total.toFixed({{$general_setting->decimal}}));
}
function hide() { $(".card-element").hide(); $(".card-errors").hide(); $(".cheque").hide(); $(".gift-card").hide(); $('input[name="cheque_no"]').attr('required', false); }
function giftCard() { $(".gift-card").show(); $.ajax({ url: 'sales/get_gift_card', type: "GET", dataType: "json", success:function(data) { $('#add-payment select[name="gift_card_id_select"]').empty(); $.each(data, function(index) { gift_card_amount[data[index]['id']] = data[index]['amount']; gift_card_expense[data[index]['id']] = data[index]['expense']; $('#add-payment select[name="gift_card_id_select"]').append(''+ data[index]['card_no'] +''); }); $('.selectpicker').selectpicker('refresh'); $('.selectpicker').selectpicker(); } }); $(".card-element").hide(); $(".card-errors").hide(); $(".cheque").hide(); $('input[name="cheque_no"]').attr('required', false); }
function cheque() { $(".cheque").show(); $('input[name="cheque_no"]').attr('required', true); $(".card-element").hide(); $(".card-errors").hide(); $(".gift-card").hide(); }
function creditCard() { @if((strlen($lims_pos_setting_data->stripe_public_key)>0) && (strlen($lims_pos_setting_data->stripe_secret_key )>0)) $.getScript( "public/vendor/stripe/checkout.js" ); $(".card-element").show(); $(".card-errors").show(); @endif $(".cheque").hide(); $(".gift-card").hide(); $('input[name="cheque_no"]').attr('required', false); }
function deposits() { if($('input[name="paid_amount"]').val() > deposit[$('#customer_id').val()]){ alert('Amount exceeds customer deposit! Customer deposit : '+ deposit[$('#customer_id').val()]); } $('input[name="cheque_no"]').attr('required', false); $('#add-payment select[name="gift_card_id_select"]').attr('required', false); }
function pointCalculation() { paid_amount = $('input[name=paid_amount]').val(); required_point = Math.ceil(paid_amount / reward_point_setting['per_point_amount']); if(required_point > points[$('#customer_id').val()]) { alert('Customer does not have sufficient points. Available points: '+points[$('#customer_id').val()]); } else { $("input[name=used_points]").val(required_point); } }
function cancel(rownumber) { while(rownumber >= 0) { product_price.pop(); product_discount.pop(); tax_rate.pop(); tax_name.pop(); tax_method.pop(); unit_name.pop(); unit_operator.pop(); unit_operation_value.pop(); $('table.order-list tbody tr:last').remove(); rownumber--; } $('input[name="shipping_cost"]').val(''); $('input[name="order_discount"]').val(''); $('select[name="order_tax_rate_select"]').val(0); calculateTotal(); }
function confirmCancel() { var audio = $("#mysoundclip2")[0]; audio.play(); if (confirm("Are you sure want to cancel?")) { cancel($('table.order-list tbody tr:last').index()); } return false; }
$(document).on('submit', '.payment-form', function(e) { var rownumber = $('table.order-list tbody tr:last').index(); if (rownumber < 0) { alert("Please insert product to order table!") e.preventDefault(); } else if( parseFloat( $('input[name="paying_amount"]').val() ) < parseFloat( $('input[name="paid_amount"]').val() ) ){ alert('Paying amount cannot be bigger than recieved amount'); e.preventDefault(); } else { $("#submit-button").prop('disabled', true); } $('input[name="paid_by_id"]').val($('select[name="paid_by_id_select"]').val()); $('input[name="order_tax_rate"]').val($('select[name="order_tax_rate_select"]').val());
});
$('#product-table').DataTable( { "order": [], 'pageLength': product_row_number, 'language': { 'paginate': { 'previous': '', 'next': '' } }, dom: 'tp' });
@endpush '''
well boy, I have lost in somewhere universe with all this code. 🤣
and I don't really sure if the code you provided somehow not displayed correctly (because to much maybe, or a little typo when using typescript style).
but still, like what I say before this edit_warranty is not in same form that you post in the controller with function store so the key edit_warranty will undefined
but if you really want this edit_warranty read in your function store you can add it in your main form.
did you see this code {!! Form::close() !!} after the shipping_cost modal ?
you can add the edit_warranty and other this edit_xxx modal before this {!! Form::close() !!} line.
I assume this will be read as same form, base on your code.
-------------------------------------------------------------------------
if you don't want all the modal in same form, you can just add this select edit_warranty before input reference_no.
I don't really sure what this edit_warranty will do what. But it's up to you, if you want this field in your store function.
@rifky49 thats f****** crazy man
@rifky49 I suggest taking the free php and laravel lessons from here before proceeding.
@tangtang Hi, I get this edit_warranty data from warranties table?
Please or to participate in this conversation.