Added: General Settings & Improvement: In all currency fields
This commit is contained in:
parent
08c1818a9d
commit
6bcfcc92bc
|
@ -20,7 +20,7 @@
|
||||||
{!! $barcode !!}
|
{!! $barcode !!}
|
||||||
</div>
|
</div>
|
||||||
<p style="font-size: 15px;color: #000;font-weight: bold;">
|
<p style="font-size: 15px;color: #000;font-weight: bold;">
|
||||||
Price:: {{ number_format($price) }}</p>
|
Price:: {{ format_currency($price) }}</p>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -41,11 +41,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Cost</th>
|
<th>Cost</th>
|
||||||
<td>{{ $product->product_cost }}</td>
|
<td>{{ format_currency($product->product_price) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Price</th>
|
<th>Price</th>
|
||||||
<td>{{ $product->product_price }}</td>
|
<td>{{ format_currency($product->product_price) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Quantity</th>
|
<th>Quantity</th>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'Setting'
|
||||||
|
];
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateSettingsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('settings', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('company_name');
|
||||||
|
$table->string('company_email');
|
||||||
|
$table->string('company_phone');
|
||||||
|
$table->string('site_logo')->nullable();
|
||||||
|
$table->integer('default_currency_id');
|
||||||
|
$table->string('default_currency_position');
|
||||||
|
$table->string('notification_email');
|
||||||
|
$table->string('footer_text');
|
||||||
|
$table->text('company_address');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('settings');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Setting\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\Setting\Entities\Setting;
|
||||||
|
|
||||||
|
class SettingDatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Setting::create([
|
||||||
|
'company_name' => 'Triangle POS',
|
||||||
|
'company_email' => 'company@test.com',
|
||||||
|
'company_phone' => '012345678901',
|
||||||
|
'notification_email' => 'notification@test.com',
|
||||||
|
'default_currency_id' => 1,
|
||||||
|
'default_currency_position' => 'prefix',
|
||||||
|
'footer_text' => 'Triangle Pos © 2021',
|
||||||
|
'company_address' => 'Tangail, Bangladesh'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Setting\Entities;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Modules\Currency\Entities\Currency;
|
||||||
|
|
||||||
|
class Setting extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
public function currency() {
|
||||||
|
return $this->belongsTo(Currency::class, 'default_currency_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Setting\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Modules\Setting\Entities\Setting;
|
||||||
|
|
||||||
|
class SettingController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
abort_if(Gate::denies('access_settings'), 403);
|
||||||
|
|
||||||
|
$settings = Setting::firstOrFail();
|
||||||
|
|
||||||
|
return view('setting::index', compact('settings'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request) {
|
||||||
|
abort_if(Gate::denies('access_settings'), 403);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'company_name' => 'required|string|max:255',
|
||||||
|
'company_email' => 'required|email|max:255',
|
||||||
|
'company_phone' => 'required|string|max:255',
|
||||||
|
'notification_email' => 'required|email|max:255',
|
||||||
|
'company_address' => 'required|string|max:500',
|
||||||
|
'default_currency_id' => 'required|numeric',
|
||||||
|
'default_currency_position' => 'required|string|max:255',
|
||||||
|
'footer_text' => 'required|string|max:255'
|
||||||
|
]);
|
||||||
|
|
||||||
|
Setting::firstOrFail()->update([
|
||||||
|
'company_name' => $request->company_name,
|
||||||
|
'company_email' => $request->company_email,
|
||||||
|
'company_phone' => $request->company_phone,
|
||||||
|
'notification_email' => $request->notification_email,
|
||||||
|
'company_address' => $request->company_address,
|
||||||
|
'default_currency_id' => $request->default_currency_id,
|
||||||
|
'default_currency_position' => $request->default_currency_position,
|
||||||
|
'footer_text' => $request->footer_text
|
||||||
|
]);
|
||||||
|
|
||||||
|
toast('Settings Updated!', 'info');
|
||||||
|
|
||||||
|
return redirect()->route('settings.index');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Setting\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The module namespace to assume when generating URLs to actions.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $moduleNamespace = 'Modules\Setting\Http\Controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before routes are registered.
|
||||||
|
*
|
||||||
|
* Register any model bindings or pattern based filters.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the routes for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function map()
|
||||||
|
{
|
||||||
|
$this->mapApiRoutes();
|
||||||
|
|
||||||
|
$this->mapWebRoutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "web" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes all receive session state, CSRF protection, etc.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapWebRoutes()
|
||||||
|
{
|
||||||
|
Route::middleware('web')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('Setting', '/Routes/web.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "api" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes are typically stateless.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapApiRoutes()
|
||||||
|
{
|
||||||
|
Route::prefix('api')
|
||||||
|
->middleware('api')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('Setting', '/Routes/api.php'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Setting\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
|
||||||
|
class SettingServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string $moduleName
|
||||||
|
*/
|
||||||
|
protected $moduleName = 'Setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $moduleNameLower
|
||||||
|
*/
|
||||||
|
protected $moduleNameLower = 'setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
$this->registerViews();
|
||||||
|
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$this->app->register(RouteServiceProvider::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function registerConfig()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||||
|
], 'config');
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register views.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerViews()
|
||||||
|
{
|
||||||
|
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||||
|
|
||||||
|
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||||
|
|
||||||
|
$this->publishes([
|
||||||
|
$sourcePath => $viewPath
|
||||||
|
], ['views', $this->moduleNameLower . '-module-views']);
|
||||||
|
|
||||||
|
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register translations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerTranslations()
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the services provided by the provider.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function provides()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPublishableViewPaths(): array
|
||||||
|
{
|
||||||
|
$paths = [];
|
||||||
|
foreach (\Config::get('view.paths') as $path) {
|
||||||
|
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||||
|
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $paths;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'Edit Settings')
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<ol class="breadcrumb border-0 m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
|
||||||
|
<li class="breadcrumb-item active">Settings</li>
|
||||||
|
</ol>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
@include('utils.alerts')
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header bg-info text-white">
|
||||||
|
<h5 class="mb-0">General Settings</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="{{ route('settings.update') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@method('patch')
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="company_name">Company Name <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="company_name" value="{{ $settings->company_name }}" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="company_email">Company Email <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="company_email" value="{{ $settings->company_email }}" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="company_phone">Company Phone <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="company_phone" value="{{ $settings->company_phone }}" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="default_currency_id">Default Currency <span class="text-danger">*</span></label>
|
||||||
|
<select name="default_currency_id" id="default_currency_id" class="form-control" required>
|
||||||
|
@foreach(\Modules\Currency\Entities\Currency::all() as $currency)
|
||||||
|
<option {{ $settings->default_currency_id == $currency->id ? 'selected' : '' }} value="{{ $currency->id }}">{{ $currency->currency_name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="default_currency_position">Default Currency Position <span class="text-danger">*</span></label>
|
||||||
|
<select name="default_currency_position" id="default_currency_position" class="form-control" required>
|
||||||
|
<option {{ $settings->default_currency_position == 'prefix' ? 'selected' : '' }} value="prefix">Prefix</option>
|
||||||
|
<option {{ $settings->default_currency_position == 'suffix' ? 'selected' : '' }} value="suffix">Suffix</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="notification_email">Notification Email <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="notification_email" value="{{ $settings->notification_email }}" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="company_address">Company Address <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="company_address" value="{{ $settings->company_address }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="footer_text">Footer Text <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="footer_text" value="{!! $settings->footer_text !!}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="btn btn-primary"><i class="bi bi-check"></i> Save Changes</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| API Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register API routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider within a group which
|
||||||
|
| is assigned the "api" middleware group. Enjoy building your API!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::middleware('auth:api')->get('/setting', function (Request $request) {
|
||||||
|
return $request->user();
|
||||||
|
});
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Web Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register web routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider within a group which
|
||||||
|
| contains the "web" middleware group. Now create something great!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::group(['middleware' => 'auth'], function () {
|
||||||
|
|
||||||
|
Route::get('/settings', 'SettingController@index')->name('settings.index');
|
||||||
|
Route::patch('/settings', 'SettingController@update')->name('settings.update');
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"name": "nwidart/setting",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Widart",
|
||||||
|
"email": "n.widart@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\Setting\\": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "Setting",
|
||||||
|
"alias": "setting",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"priority": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Setting\\Providers\\SettingServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "npm run development",
|
||||||
|
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"watch-poll": "npm run watch -- --watch-poll",
|
||||||
|
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"prod": "npm run production",
|
||||||
|
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"cross-env": "^7.0",
|
||||||
|
"laravel-mix": "^5.0.1",
|
||||||
|
"laravel-mix-merge-manifest": "^0.1.2"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
const dotenvExpand = require('dotenv-expand');
|
||||||
|
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||||
|
|
||||||
|
const mix = require('laravel-mix');
|
||||||
|
require('laravel-mix-merge-manifest');
|
||||||
|
|
||||||
|
mix.setPublicPath('../../public').mergeManifest();
|
||||||
|
|
||||||
|
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/setting.js')
|
||||||
|
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/setting.css');
|
||||||
|
|
||||||
|
if (mix.inProduction()) {
|
||||||
|
mix.version();
|
||||||
|
}
|
|
@ -57,6 +57,8 @@ class PermissionsTableSeeder extends Seeder
|
||||||
'create_currencies',
|
'create_currencies',
|
||||||
'edit_currencies',
|
'edit_currencies',
|
||||||
'delete_currencies',
|
'delete_currencies',
|
||||||
|
//Settings
|
||||||
|
'access_settings'
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($permissions as $permission) {
|
foreach ($permissions as $permission) {
|
||||||
|
|
|
@ -15,6 +15,9 @@ class ExpensesDataTable extends DataTable
|
||||||
public function dataTable($query) {
|
public function dataTable($query) {
|
||||||
return datatables()
|
return datatables()
|
||||||
->eloquent($query)
|
->eloquent($query)
|
||||||
|
->addColumn('amount', function ($data) {
|
||||||
|
return format_currency($data->amount);
|
||||||
|
})
|
||||||
->addColumn('action', function ($data) {
|
->addColumn('action', function ($data) {
|
||||||
return view('expense::expenses.partials.actions', compact('data'));
|
return view('expense::expenses.partials.actions', compact('data'));
|
||||||
});
|
});
|
||||||
|
@ -57,7 +60,7 @@ class ExpensesDataTable extends DataTable
|
||||||
->title('Category')
|
->title('Category')
|
||||||
->className('text-center align-middle'),
|
->className('text-center align-middle'),
|
||||||
|
|
||||||
Column::make('amount')
|
Column::computed('amount')
|
||||||
->className('text-center align-middle'),
|
->className('text-center align-middle'),
|
||||||
|
|
||||||
Column::make('details')
|
Column::make('details')
|
||||||
|
|
|
@ -21,7 +21,10 @@ class ProductDataTable extends DataTable
|
||||||
})
|
})
|
||||||
->addColumn('product_image', function ($data) {
|
->addColumn('product_image', function ($data) {
|
||||||
$url = $data->getFirstMediaUrl();
|
$url = $data->getFirstMediaUrl();
|
||||||
return '<img src="'.$url.'" border="0" width="50" class="img-thumbnail" align="center" />';
|
return '<img src="'.$url.'" border="0" width="50" class="img-thumbnail" align="center"/>';
|
||||||
|
})
|
||||||
|
->addColumn('product_price', function ($data) {
|
||||||
|
return format_currency($data->product_price);
|
||||||
})
|
})
|
||||||
->rawColumns(['product_image']);
|
->rawColumns(['product_image']);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +71,7 @@ class ProductDataTable extends DataTable
|
||||||
->title('Code')
|
->title('Code')
|
||||||
->className('text-center align-middle'),
|
->className('text-center align-middle'),
|
||||||
|
|
||||||
Column::make('product_price')
|
Column::computed('product_price')
|
||||||
->title('Price')
|
->title('Price')
|
||||||
->className('text-center align-middle'),
|
->className('text-center align-middle'),
|
||||||
|
|
||||||
|
|
|
@ -1 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if (!function_exists('settings')) {
|
||||||
|
function settings() {
|
||||||
|
return \Modules\Setting\Entities\Setting::firstOrFail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('format_currency')) {
|
||||||
|
function format_currency($value) {
|
||||||
|
if (settings()->default_currency_position == 'prefix') {
|
||||||
|
$formatted_value = settings()->currency->symbol . number_format($value, 2, settings()->currency->decimal_separator, settings()->currency->thousand_separator);
|
||||||
|
} else {
|
||||||
|
$formatted_value = number_format($value, 2, settings()->currency->decimal_separator, settings()->currency->thousand_separator) . settings()->currency->symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $formatted_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Modules\Setting\Database\Seeders\SettingDatabaseSeeder;
|
||||||
use Modules\User\Database\Seeders\PermissionsTableSeeder;
|
use Modules\User\Database\Seeders\PermissionsTableSeeder;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
|
@ -16,5 +17,6 @@ class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
$this->call(PermissionsTableSeeder::class);
|
$this->call(PermissionsTableSeeder::class);
|
||||||
$this->call(SuperUserSeeder::class);
|
$this->call(SuperUserSeeder::class);
|
||||||
|
$this->call(SettingDatabaseSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,6 @@
|
||||||
"Adjustment": true,
|
"Adjustment": true,
|
||||||
"Expense": true,
|
"Expense": true,
|
||||||
"People": true,
|
"People": true,
|
||||||
"Currency": true
|
"Currency": true,
|
||||||
|
"Setting": true
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
<footer class="c-footer">
|
<footer class="c-footer">
|
||||||
<div><a href="#">Triangle POS</a> © {{ date('Y') }} Developed by <strong><a target="_blank" href="https://fahim.codes">Fahim Anzam</a></strong>.</div>
|
<div>{!! settings()->footer_text !!} || Developed by <strong><a target="_blank" href="https://fahim.codes">Fahim Anzam</a></strong></div>
|
||||||
<div class="mfs-auto d-md-down-none">Powered by <a href="https://coreui.io/">CoreUI</a></div>
|
|
||||||
|
<div class="mfs-auto d-md-down-none">Powered by <a href="https://laravel.com" target="_blank">Laravel</a></div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -140,11 +140,12 @@
|
||||||
</li>
|
</li>
|
||||||
@endcan
|
@endcan
|
||||||
|
|
||||||
@can('access_currencies')
|
@can('access_currencies|access_settings')
|
||||||
<li class="c-sidebar-nav-item c-sidebar-nav-dropdown {{ request()->routeIs('currencies*') ? 'c-show' : '' }}">
|
<li class="c-sidebar-nav-item c-sidebar-nav-dropdown {{ request()->routeIs('currencies*') ? 'c-show' : '' }}">
|
||||||
<a class="c-sidebar-nav-link c-sidebar-nav-dropdown-toggle" href="#">
|
<a class="c-sidebar-nav-link c-sidebar-nav-dropdown-toggle" href="#">
|
||||||
<i class="c-sidebar-nav-icon bi bi-gear" style="line-height: 1;"></i> Settings
|
<i class="c-sidebar-nav-icon bi bi-gear" style="line-height: 1;"></i> Settings
|
||||||
</a>
|
</a>
|
||||||
|
@can('access_currencies')
|
||||||
<ul class="c-sidebar-nav-dropdown-items">
|
<ul class="c-sidebar-nav-dropdown-items">
|
||||||
<li class="c-sidebar-nav-item">
|
<li class="c-sidebar-nav-item">
|
||||||
<a class="c-sidebar-nav-link {{ request()->routeIs('currencies*') ? 'c-active' : '' }}" href="{{ route('currencies.index') }}">
|
<a class="c-sidebar-nav-link {{ request()->routeIs('currencies*') ? 'c-active' : '' }}" href="{{ route('currencies.index') }}">
|
||||||
|
@ -152,5 +153,15 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@endcan
|
||||||
|
@can('access_settings')
|
||||||
|
<ul class="c-sidebar-nav-dropdown-items">
|
||||||
|
<li class="c-sidebar-nav-item">
|
||||||
|
<a class="c-sidebar-nav-link {{ request()->routeIs('settings*') ? 'c-active' : '' }}" href="{{ route('settings.index') }}">
|
||||||
|
<i class="c-sidebar-nav-icon bi bi-sliders" style="line-height: 1;"></i> System Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
@endcan
|
||||||
</li>
|
</li>
|
||||||
@endcan
|
@endcan
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
{!! $barcode !!}
|
{!! $barcode !!}
|
||||||
</div>
|
</div>
|
||||||
<p style="font-size: 15px;color: #000;">
|
<p style="font-size: 15px;color: #000;">
|
||||||
Price:: {{ number_format($product->product_price) }}
|
Price:: {{ format_currency($product->product_price) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
Loading…
Reference in New Issue