Initial commit - Upload Laravel POS
This commit is contained in:
parent
e6bb4fe9ad
commit
fae250a496
53
.env.example
53
.env.example
|
@ -1,53 +0,0 @@
|
||||||
APP_NAME="Triangle POS"
|
|
||||||
APP_ENV=local
|
|
||||||
APP_KEY=
|
|
||||||
APP_DEBUG=true
|
|
||||||
APP_URL=http://127.0.0.1:8000
|
|
||||||
|
|
||||||
DEBUGBAR_ENABLED=false
|
|
||||||
|
|
||||||
LOG_CHANNEL=stack
|
|
||||||
LOG_LEVEL=debug
|
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST=127.0.0.1
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_DATABASE=triangle_pos
|
|
||||||
DB_USERNAME=
|
|
||||||
DB_PASSWORD=
|
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
FILESYSTEM_DRIVER=local
|
|
||||||
QUEUE_CONNECTION=sync
|
|
||||||
SESSION_DRIVER=file
|
|
||||||
SESSION_LIFETIME=120
|
|
||||||
|
|
||||||
MEMCACHED_HOST=127.0.0.1
|
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
MAIL_MAILER=smtp
|
|
||||||
MAIL_HOST=mailhog
|
|
||||||
MAIL_PORT=1025
|
|
||||||
MAIL_USERNAME=null
|
|
||||||
MAIL_PASSWORD=null
|
|
||||||
MAIL_ENCRYPTION=null
|
|
||||||
MAIL_FROM_ADDRESS=null
|
|
||||||
MAIL_FROM_NAME="${APP_NAME}"
|
|
||||||
|
|
||||||
AWS_ACCESS_KEY_ID=
|
|
||||||
AWS_SECRET_ACCESS_KEY=
|
|
||||||
AWS_DEFAULT_REGION=us-east-1
|
|
||||||
AWS_BUCKET=
|
|
||||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
|
||||||
PUSHER_APP_KEY=
|
|
||||||
PUSHER_APP_SECRET=
|
|
||||||
PUSHER_APP_CLUSTER=mt1
|
|
||||||
|
|
||||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
|
||||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddWholesalePriceToProductsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('products', function (Blueprint $table) {
|
||||||
|
$table->integer('min_quantity_for_wholesale')->nullable()->after('product_price');
|
||||||
|
$table->integer('wholesale_discount_percentage')->nullable()->after('min_quantity_for_wholesale');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('products', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('min_quantity_for_wholesale');
|
||||||
|
$table->dropColumn('wholesale_discount_percentage');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,4 +48,16 @@ class Product extends Model implements HasMedia
|
||||||
public function getProductPriceAttribute($value) {
|
public function getProductPriceAttribute($value) {
|
||||||
return ($value / 100);
|
return ($value / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWholesalePrice($quantity) {
|
||||||
|
if ($this->min_quantity_for_wholesale && $quantity >= $this->min_quantity_for_wholesale) {
|
||||||
|
$discount = $this->wholesale_discount_percentage / 100;
|
||||||
|
return $this->product_price * (1 - $discount);
|
||||||
|
}
|
||||||
|
return $this->product_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isWholesalePrice($quantity) {
|
||||||
|
return $this->min_quantity_for_wholesale && $quantity >= $this->min_quantity_for_wholesale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ class StoreProductRequest extends FormRequest
|
||||||
'product_quantity' => ['required', 'integer', 'min:1'],
|
'product_quantity' => ['required', 'integer', 'min:1'],
|
||||||
'product_cost' => ['required', 'numeric', 'max:2147483647'],
|
'product_cost' => ['required', 'numeric', 'max:2147483647'],
|
||||||
'product_price' => ['required', 'numeric', 'max:2147483647'],
|
'product_price' => ['required', 'numeric', 'max:2147483647'],
|
||||||
|
'min_quantity_for_wholesale' => ['nullable', 'integer', 'min:0'],
|
||||||
|
'wholesale_discount_percentage' => ['nullable', 'integer', 'min:0', 'max:100'],
|
||||||
'product_stock_alert' => ['required', 'integer', 'min:0'],
|
'product_stock_alert' => ['required', 'integer', 'min:0'],
|
||||||
'product_order_tax' => ['nullable', 'integer', 'min:0', 'max:100'],
|
'product_order_tax' => ['nullable', 'integer', 'min:0', 'max:100'],
|
||||||
'product_tax_type' => ['nullable', 'integer'],
|
'product_tax_type' => ['nullable', 'integer'],
|
||||||
|
|
|
@ -23,6 +23,8 @@ class UpdateProductRequest extends FormRequest
|
||||||
'product_quantity' => ['required', 'integer', 'min:1'],
|
'product_quantity' => ['required', 'integer', 'min:1'],
|
||||||
'product_cost' => ['required', 'numeric', 'max:2147483647'],
|
'product_cost' => ['required', 'numeric', 'max:2147483647'],
|
||||||
'product_price' => ['required', 'numeric', 'max:2147483647'],
|
'product_price' => ['required', 'numeric', 'max:2147483647'],
|
||||||
|
'min_quantity_for_wholesale' => ['nullable', 'integer', 'min:0'],
|
||||||
|
'wholesale_discount_percentage' => ['nullable', 'integer', 'min:0', 'max:100'],
|
||||||
'product_stock_alert' => ['required', 'integer', 'min:0'],
|
'product_stock_alert' => ['required', 'integer', 'min:0'],
|
||||||
'product_order_tax' => ['nullable', 'integer', 'min:0', 'max:100'],
|
'product_order_tax' => ['nullable', 'integer', 'min:0', 'max:100'],
|
||||||
'product_tax_type' => ['nullable', 'integer'],
|
'product_tax_type' => ['nullable', 'integer'],
|
||||||
|
|
|
@ -131,6 +131,27 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="product_price">Price <span class="text-danger">*</span></label>
|
||||||
|
<input id="product_price" type="text" class="form-control" name="product_price" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="min_quantity_for_wholesale">Minimal Quantity for Wholesale</label>
|
||||||
|
<input id="min_quantity_for_wholesale" type="number" class="form-control" name="min_quantity_for_wholesale" min="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="wholesale_discount_percentage">Wholesale Discount (%)</label>
|
||||||
|
<input id="wholesale_discount_percentage" type="number" class="form-control" name="wholesale_discount_percentage" min="0" max="100">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="product_note">Note</label>
|
<label for="product_note">Note</label>
|
||||||
<textarea name="product_note" id="product_note" rows="4 " class="form-control"></textarea>
|
<textarea name="product_note" id="product_note" rows="4 " class="form-control"></textarea>
|
||||||
|
|
|
@ -73,10 +73,22 @@
|
||||||
<input id="product_cost" type="text" class="form-control" min="0" name="product_cost" required value="{{ $product->product_cost }}">
|
<input id="product_cost" type="text" class="form-control" min="0" name="product_cost" required value="{{ $product->product_cost }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-lg-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="product_price">Price <span class="text-danger">*</span></label>
|
<label for="product_price">Price <span class="text-danger">*</span></label>
|
||||||
<input id="product_price" type="text" class="form-control" min="0" name="product_price" required value="{{ $product->product_price }}">
|
<input id="product_price" type="text" class="form-control" name="product_price" required value="{{ $product->product_price }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="min_quantity_for_wholesale">Minimal Quantity for Wholesale</label>
|
||||||
|
<input id="min_quantity_for_wholesale" type="number" class="form-control" name="min_quantity_for_wholesale" min="0" value="{{ $product->min_quantity_for_wholesale }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="wholesale_discount_percentage">Wholesale Discount (%)</label>
|
||||||
|
<input id="wholesale_discount_percentage" type="number" class="form-control" name="wholesale_discount_percentage" min="0" max="100" value="{{ $product->wholesale_discount_percentage }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -213,6 +213,15 @@ class ProductCart extends Component
|
||||||
}
|
}
|
||||||
$product_price = $this->unit_price[$product['id']];
|
$product_price = $this->unit_price[$product['id']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if wholesale price should be applied
|
||||||
|
if (isset($product['min_quantity_for_wholesale']) &&
|
||||||
|
isset($product['wholesale_discount_percentage']) &&
|
||||||
|
$this->quantity[$product['id']] >= $product['min_quantity_for_wholesale']) {
|
||||||
|
$discount = $product['wholesale_discount_percentage'] / 100;
|
||||||
|
$product_price = $product_price * (1 - $discount);
|
||||||
|
}
|
||||||
|
|
||||||
$price = 0;
|
$price = 0;
|
||||||
$unit_price = 0;
|
$unit_price = 0;
|
||||||
$product_tax = 0;
|
$product_tax = 0;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 4.4 KiB |
|
@ -82,10 +82,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="text-center mt-5 lead">
|
{{-- <p class="text-center mt-5 lead">
|
||||||
Developed By
|
Developed By
|
||||||
<a href="https://fahimanzam.netlify.app" class="font-weight-bold text-primary">Fahim Anzam Dip</a>
|
<a href="https://fahimanzam.netlify.app" class="font-weight-bold text-primary">Fahim Anzam Dip</a>
|
||||||
</p>
|
</p> --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<footer class="c-footer">
|
<footer class="c-footer">
|
||||||
<div>Triangle Pos © {{ date('Y') }} || Developed by <strong><a target="_blank" href="https://fahimanzam.netlify.app">Fahim Anzam Dip</a></strong></div>
|
{{-- <div>Triangle Pos © {{ date('Y') }} || Developed by <strong><a target="_blank" href="https://fahimanzam.netlify.app">Fahim Anzam Dip</a></strong></div>
|
||||||
|
|
||||||
<div class="mfs-auto d-md-down-none">Version <strong class="text-danger">1.0</strong></div>
|
<div class="mfs-auto d-md-down-none">Version <strong class="text-danger">1.0</strong></div> --}}
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Reference in New Issue