Repo rebuild
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Pricing',
|
||||
'features' => [
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Pricing\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
final class PricingDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$plans = [
|
||||
[
|
||||
'code' => 'basic',
|
||||
'name' => 'Basic',
|
||||
'strapline' => 'Core warehouse visibility',
|
||||
'description' => 'Essential WMS tools for small warehouse operations and controlled stock visibility.',
|
||||
'monthly_amount' => 14900,
|
||||
'annual_amount' => 49000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Starter',
|
||||
'features' => [
|
||||
'Warehouse dashboard',
|
||||
'Inventory overview',
|
||||
'Basic audit trail',
|
||||
'Email support',
|
||||
],
|
||||
'sort_order' => 10,
|
||||
'is_featured' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'code' => 'advanced',
|
||||
'name' => 'Advanced',
|
||||
'strapline' => 'Operational control suite',
|
||||
'description' => 'Expanded controls for teams that need replenishment, reporting and integration monitoring.',
|
||||
'monthly_amount' => 9900,
|
||||
'annual_amount' => 99000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Popular',
|
||||
'features' => [
|
||||
'Everything in Basic',
|
||||
'Replenishment workflows',
|
||||
'Reporting workspace',
|
||||
'M3 integration status',
|
||||
'Priority support',
|
||||
],
|
||||
'sort_order' => 20,
|
||||
'is_featured' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'code' => 'pro',
|
||||
'name' => 'Pro',
|
||||
'strapline' => 'Enterprise-grade administration',
|
||||
'description' => 'Full platform administration for regulated warehouse, carrier and document operations.',
|
||||
'monthly_amount' => 19900,
|
||||
'annual_amount' => 199000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Enterprise',
|
||||
'features' => [
|
||||
'Everything in Advanced',
|
||||
'Multi-company administration',
|
||||
'Security and audit controls',
|
||||
'Document archive',
|
||||
'Carrier management',
|
||||
'Dedicated support',
|
||||
],
|
||||
'sort_order' => 30,
|
||||
'is_featured' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'code' => 'ultimate',
|
||||
'name' => 'Ultimate',
|
||||
'strapline' => 'Ultimate Enterprise Grade Administration',
|
||||
'description' => 'Full platform administration for regulated warehouse, unlimited warehouses and users, carrier and document operations.',
|
||||
'monthly_amount' => 1009900,
|
||||
'annual_amount' => 1000000,
|
||||
'currency' => 'gbp',
|
||||
'badge_label' => 'Enterprise',
|
||||
'features' => [
|
||||
'Everything in Pro',
|
||||
'Multi-company administration',
|
||||
'Security and audit controls',
|
||||
'Document archive',
|
||||
'Carrier management',
|
||||
'Dedicated support',
|
||||
],
|
||||
'sort_order' => 50,
|
||||
'is_featured' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($plans as $plan) {
|
||||
$exists = DB::table('platform_prices')
|
||||
->where('code', $plan['code'])
|
||||
->exists();
|
||||
|
||||
$payload = [
|
||||
'name' => $plan['name'],
|
||||
'strapline' => $plan['strapline'],
|
||||
'description' => $plan['description'],
|
||||
'monthly_amount' => $plan['monthly_amount'],
|
||||
'annual_amount' => $plan['annual_amount'],
|
||||
'currency' => $plan['currency'],
|
||||
'badge_label' => $plan['badge_label'],
|
||||
'features' => json_encode($plan['features'], JSON_THROW_ON_ERROR),
|
||||
'sort_order' => $plan['sort_order'],
|
||||
'is_featured' => $plan['is_featured'],
|
||||
'is_active' => $plan['is_active'],
|
||||
'updated_at' => now(),
|
||||
];
|
||||
|
||||
if (! $exists) {
|
||||
$payload['created_at'] = now();
|
||||
}
|
||||
|
||||
DB::table('platform_prices')->updateOrInsert(
|
||||
['code' => $plan['code']],
|
||||
$payload,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Modules\Pricing\Support\ModuleInfo;
|
||||
|
||||
if (! function_exists('pricing_feature_enabled')) {
|
||||
/**
|
||||
* Check if a feature is enabled in the config.
|
||||
*/
|
||||
function pricing_feature_enabled(string $key): bool
|
||||
{
|
||||
return (bool) config(ModuleInfo::nameLower() . ".features.{$key}", false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Pricing\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Modules\Platform\app\Models\PlatformPrice;
|
||||
|
||||
class PricingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the platform pricing cards from the shared Platform price model.
|
||||
*/
|
||||
public function index(): Renderable
|
||||
{
|
||||
return view('platform::prices.public', [
|
||||
'prices' => PlatformPrice::query()
|
||||
->where('is_active', true)
|
||||
->ordered()
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Pricing\Providers;
|
||||
|
||||
use Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Pricing\Support\ModuleInfo;
|
||||
|
||||
class PricingServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Pricing';
|
||||
|
||||
protected string $moduleNameLower = 'pricing';
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->registerHelpers();
|
||||
$this->registerCommands();
|
||||
$this->loadMigrationsFrom(module_path(ModuleInfo::name(), 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the helpers.
|
||||
*/
|
||||
protected function registerHelpers(): void
|
||||
{
|
||||
foreach (glob(__DIR__ . '/../Helpers/*.php') as $filename) {
|
||||
require_once $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically Register Commands.
|
||||
*/
|
||||
public function registerCommands(): void
|
||||
{
|
||||
if (! $this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
$commandPath = __DIR__ . '/../Console';
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(function ($file) {
|
||||
$class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension();
|
||||
|
||||
return $class;
|
||||
})
|
||||
->filter(function ($class) {
|
||||
return class_exists($class);
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
$this->commands($commands);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower() . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path(ModuleInfo::name(), 'Config/config.php'),
|
||||
ModuleInfo::nameLower(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . ModuleInfo::nameLower());
|
||||
$sourcePath = module_path(ModuleInfo::name(), 'Resources/views');
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath,
|
||||
], ['views', ModuleInfo::nameLower() . '-module-views']);
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path(ModuleInfo::name(), 'Resources/lang'), ModuleInfo::nameLower());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regsiter View Paths
|
||||
*/
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . ModuleInfo::nameLower())) {
|
||||
$paths[] = $path . '/modules/' . ModuleInfo::nameLower();
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Pricing\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = 'Modules\Pricing\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('Pricing', '/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('Pricing', '/Routes/api.php'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<x-layouts::app :title="__('Pricing')">
|
||||
<div class="space-y-6">
|
||||
<x-wms.page-hero eyebrow="MPBA WMS" title="Pricing"
|
||||
description="Platform pricing workspace for plan visibility and commercial administration."
|
||||
:stats="[['label' => 'Status', 'value' => 'Ready', 'icon' => 'fa-solid fa-circle-check']]" />
|
||||
|
||||
<section class="rounded-3xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
|
||||
<h2 class="text-lg font-bold text-zinc-900 dark:text-white">Pricing workspace</h2>
|
||||
<p class="mt-2 text-sm text-zinc-500 dark:text-zinc-400">Use the Platform pricing pages to maintain Basic,
|
||||
Advanced and Pro plan cards.</p>
|
||||
</section>
|
||||
</div>
|
||||
</x-layouts::app>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Module Pricing</title>
|
||||
|
||||
{{-- Laravel Mix - CSS File --}}
|
||||
{{-- <link rel="stylesheet" href="{{ mix('css/pricing.css') }}"> --}}
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div data-dusk="page-ready" style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);"
|
||||
aria-hidden="true"></div>
|
||||
@yield('content')
|
||||
|
||||
{{-- Laravel Mix - JS File --}}
|
||||
{{-- <script src="{{ mix('js/pricing.js') }}"></script> --}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -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('/pricing', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Pricing\Http\Controllers\PricingController;
|
||||
|
||||
Route::middleware(['auth', 'verified', 'tenant.assigned'])
|
||||
->prefix('pricing')
|
||||
->name('pricing.')
|
||||
->group(function (): void {
|
||||
Route::get('/', [PricingController::class, 'index'])->name('index');
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Pricing\Support;
|
||||
|
||||
class ModuleInfo
|
||||
{
|
||||
protected static string $moduleName = 'Pricing';
|
||||
|
||||
/**
|
||||
* defines the Module Name
|
||||
*/
|
||||
public static function name(): string
|
||||
{
|
||||
return static::$moduleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* define the lowercase version
|
||||
*/
|
||||
public static function nameLower(): string
|
||||
{
|
||||
return strtolower(static::$moduleName);
|
||||
}
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
url: https://wms.vm
|
||||
versions:
|
||||
"1.0.0":
|
||||
changed:
|
||||
- Initial Module Definition
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "mpba/pricing",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mark Gregory",
|
||||
"email": "mark.gregory@mpba.co.uk"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Pricing\\": ""
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/",
|
||||
"Modules\\Pricing\\Tests\\": "modules/Pricing/Tests/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "Pricing",
|
||||
"alias": "pricing",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Pricing\\Providers\\PricingServiceProvider"
|
||||
],
|
||||
"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,11 @@
|
||||
const dotenvExpand = require('dotenv-expand');
|
||||
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||
|
||||
const mix = require('laravel-mix');
|
||||
|
||||
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/pricing.js')
|
||||
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/pricing.css');
|
||||
|
||||
if (mix.inProduction()) {
|
||||
mix.version();
|
||||
}
|
||||
Reference in New Issue
Block a user