feat: initial scaffold

This commit is contained in:
2026-06-27 20:17:13 +00:00
parent 67aa1c5655
commit 09d36bdca1
15 changed files with 410 additions and 0 deletions
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<access component="com_mokosuiteresto">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" />
<action name="core.manage" title="JACTION_MANAGE" />
<action name="core.create" title="JACTION_CREATE" />
<action name="core.delete" title="JACTION_DELETE" />
<action name="core.edit" title="JACTION_EDIT" />
<action name="core.edit.state" title="JACTION_EDITSTATE" />
</section>
</access>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset name="component" label="COM_MOKOSUITERESTO_CONFIG">
<field name="items_per_page" type="number" default="20" label="Items Per Page" min="5" max="100" />
</fieldset>
</config>
@@ -0,0 +1,30 @@
<?php
/**
* @copyright (C) 2026 Moko Consulting
* @license GPL-3.0-or-later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\MVCComponent;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Router\ApiRouter;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
return new class implements ServiceProviderInterface
{
public function register(Container $container): void
{
$container->set(
ComponentInterface::class,
function (Container $container) {
$component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
return $component;
}
);
}
};
@@ -0,0 +1,16 @@
<?php
/**
* @copyright (C) 2026 Moko Consulting
* @license GPL-3.0-or-later
*/
namespace MokoConsulting\Component\MokoSuiteResto\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
class DisplayController extends BaseController
{
protected $default_view = 'restodashboard';
}
@@ -0,0 +1,15 @@
<?php
/**
* @copyright (C) 2026 Moko Consulting
* @license GPL-3.0-or-later
*/
namespace MokoConsulting\Component\MokoSuiteResto\Administrator\Model;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
class RestoDashboardModel extends BaseDatabaseModel
{
}
@@ -0,0 +1,21 @@
<?php
/**
* @copyright (C) 2026 Moko Consulting
* @license GPL-3.0-or-later
*/
namespace MokoConsulting\Component\MokoSuiteResto\Administrator\View\RestoDashboard;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
class HtmlView extends BaseHtmlView
{
public function display($tpl = null): void
{
ToolbarHelper::title('Dashboard', 'generic');
parent::display($tpl);
}
}
@@ -0,0 +1,15 @@
<?php
/**
* @copyright (C) 2026 Moko Consulting
* @license GPL-3.0-or-later
*/
defined('_JEXEC') or die;
?>
<div class="row">
<div class="col-12">
<h2>Dashboard</h2>
<p>Manage dashboard here.</p>
</div>
</div>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" method="upgrade">
<name>com_mokosuiteresto</name>
<version>0.0.0</version>
<creationDate>2026-06</creationDate>
<author>Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<copyright>(C) 2026 Moko Consulting</copyright>
<license>GPL-3.0-or-later</license>
<description>Layer 2 — Restaurant management, menus, tables, reservations, orders, and inventory</description>
<namespace path="src">MokoConsulting\Component\MokoSuiteResto</namespace>
<administration>
<files folder="admin">
<folder>services</folder>
<folder>src</folder>
<folder>tmpl</folder>
<folder>language</folder>
<filename>access.xml</filename>
<filename>config.xml</filename>
</files>
<menu>MokoSuiteResto</menu>
<submenu>
<menu link="option=com_mokosuiteresto&amp;view=restodashboard">Dashboard</menu>
<menu link="option=com_mokosuiteresto&amp;view=restomenus">Menus</menu>
<menu link="option=com_mokosuiteresto&amp;view=restomenuitems">Menu Items</menu>
<menu link="option=com_mokosuiteresto&amp;view=restotables">Tables</menu>
<menu link="option=com_mokosuiteresto&amp;view=restoreservations">Reservations</menu>
<menu link="option=com_mokosuiteresto&amp;view=restoorders">Orders</menu>
<menu link="option=com_mokosuiteresto&amp;view=restoinventory">Inventory</menu>
</submenu>
</administration>
</extension>
@@ -0,0 +1,3 @@
PLG_SYSTEM_MOKOSUITERESTO="Resto"
PLG_SYSTEM_MOKOSUITERESTO_DESCRIPTION="MokoSuiteResto system plugin"
PLG_SYSTEM_MOKOSUITERESTO_ENABLED="Enable MokoSuiteResto"
@@ -0,0 +1,3 @@
PLG_SYSTEM_MOKOSUITERESTO="Resto"
PLG_SYSTEM_MOKOSUITERESTO_DESCRIPTION="MokoSuiteResto system plugin"
PLG_SYSTEM_MOKOSUITERESTO_ENABLED="Enable MokoSuiteResto"
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>plg_system_mokosuiteresto</name>
<version>0.0.0</version>
<creationDate>2026-06</creationDate>
<author>Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<copyright>(C) 2026 Moko Consulting</copyright>
<license>GPL-3.0-or-later</license>
<description>MokoSuiteResto system plugin -- schema owner and bootstrap</description>
<namespace path="src">MokoConsulting\Plugin\System\MokoSuiteResto</namespace>
<files>
<folder>src</folder>
<folder>services</folder>
<folder>sql</folder>
<folder>language</folder>
</files>
<install>
<sql>
<file driver="mysql" charset="utf8mb4">sql/install.mysql.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8mb4">sql/uninstall.mysql.sql</file>
</sql>
</uninstall>
<languages folder="language">
<language tag="en-GB">en-GB/plg_system_mokosuiteresto.ini</language>
<language tag="en-GB">en-GB/plg_system_mokosuiteresto.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="enabled" type="radio" label="PLG_SYSTEM_MOKOSUITERESTO_ENABLED" default="1" class="btn-group">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
</fields>
</config>
</extension>
@@ -0,0 +1,31 @@
<?php
/**
* @copyright (C) 2026 Moko Consulting
* @license GPL-3.0-or-later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use MokoConsulting\Plugin\System\MokoSuiteResto\Extension\Resto;
return new class implements ServiceProviderInterface
{
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Resto($dispatcher, (array) PluginHelper::getPlugin('system', 'mokosuiteresto'));
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};
@@ -0,0 +1,154 @@
-- MokoSuiteResto Schema
-- Copyright (C) 2026 Moko Consulting
-- SPDX-License-Identifier: GPL-3.0-or-later
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_menus` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`description` TEXT NULL,
`menu_type` ENUM('food','drink','dessert','special') NOT NULL DEFAULT 'food',
`active` TINYINT(1) NOT NULL DEFAULT 1,
`ordering` INT NOT NULL DEFAULT 0,
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_active` (`active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_menu_items` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`menu_id` INT UNSIGNED NOT NULL,
`title` VARCHAR(255) NOT NULL,
`description` TEXT NULL,
`price` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
`category` VARCHAR(100) NULL,
`allergens` JSON NULL,
`calories` INT UNSIGNED NULL,
`image` VARCHAR(500) NULL,
`available` TINYINT(1) NOT NULL DEFAULT 1,
`ordering` INT NOT NULL DEFAULT 0,
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_menu` (`menu_id`),
KEY `idx_available` (`available`),
CONSTRAINT `fk_menuitem_menu` FOREIGN KEY (`menu_id`) REFERENCES `#__mokosuiteresto_menus`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_modifiers` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`menu_item_id` INT UNSIGNED NOT NULL,
`title` VARCHAR(255) NOT NULL,
`price_adjustment` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
`modifier_type` ENUM('add','remove','substitute') NOT NULL DEFAULT 'add',
`ordering` INT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_menu_item` (`menu_item_id`),
CONSTRAINT `fk_modifier_item` FOREIGN KEY (`menu_item_id`) REFERENCES `#__mokosuiteresto_menu_items`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_tables` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`table_number` VARCHAR(20) NOT NULL,
`section` VARCHAR(100) NULL,
`capacity` INT UNSIGNED NOT NULL DEFAULT 4,
`status` ENUM('available','occupied','reserved','maintenance') NOT NULL DEFAULT 'available',
`pos_x` INT NULL,
`pos_y` INT NULL,
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_table_number` (`table_number`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_reservations` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`contact_id` INT UNSIGNED NULL COMMENT 'FK to CRM contacts',
`table_id` INT UNSIGNED NULL,
`guest_name` VARCHAR(255) NOT NULL,
`guest_phone` VARCHAR(50) NULL,
`guest_email` VARCHAR(255) NULL,
`party_size` INT UNSIGNED NOT NULL DEFAULT 2,
`reservation_date` DATE NOT NULL,
`reservation_time` TIME NOT NULL,
`duration_minutes` INT UNSIGNED NOT NULL DEFAULT 90,
`status` ENUM('pending','confirmed','seated','completed','cancelled','no_show') NOT NULL DEFAULT 'pending',
`notes` TEXT NULL,
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_date` (`reservation_date`),
KEY `idx_status` (`status`),
KEY `idx_contact` (`contact_id`),
KEY `idx_table` (`table_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_orders` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`table_id` INT UNSIGNED NULL,
`reservation_id` INT UNSIGNED NULL,
`contact_id` INT UNSIGNED NULL COMMENT 'FK to CRM contacts',
`order_number` VARCHAR(50) NOT NULL,
`order_type` ENUM('dine_in','takeout','delivery') NOT NULL DEFAULT 'dine_in',
`status` ENUM('open','preparing','ready','served','closed','cancelled') NOT NULL DEFAULT 'open',
`subtotal` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
`tax` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
`tip` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
`total` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
`payment_method` VARCHAR(50) NULL,
`payment_status` ENUM('unpaid','partial','paid','refunded') NOT NULL DEFAULT 'unpaid',
`server_user_id` INT UNSIGNED NULL,
`notes` TEXT NULL,
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_order_number` (`order_number`),
KEY `idx_table` (`table_id`),
KEY `idx_status` (`status`),
KEY `idx_created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_order_items` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`order_id` INT UNSIGNED NOT NULL,
`menu_item_id` INT UNSIGNED NOT NULL,
`quantity` INT UNSIGNED NOT NULL DEFAULT 1,
`unit_price` DECIMAL(10,2) NOT NULL,
`modifiers` JSON NULL,
`notes` TEXT NULL,
`status` ENUM('pending','preparing','ready','served','cancelled') NOT NULL DEFAULT 'pending',
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_order` (`order_id`),
CONSTRAINT `fk_orderitem_order` FOREIGN KEY (`order_id`) REFERENCES `#__mokosuiteresto_orders`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_inventory` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`item_name` VARCHAR(255) NOT NULL,
`category` VARCHAR(100) NULL,
`unit` VARCHAR(50) NOT NULL DEFAULT 'each',
`quantity_on_hand` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
`reorder_level` DECIMAL(10,2) NULL,
`cost_per_unit` DECIMAL(10,2) NULL,
`supplier` VARCHAR(255) NULL,
`last_restocked` DATETIME NULL,
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_category` (`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__mokosuiteresto_inventory_transactions` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`inventory_id` INT UNSIGNED NOT NULL,
`transaction_type` ENUM('restock','usage','waste','adjustment') NOT NULL,
`quantity` DECIMAL(10,2) NOT NULL,
`notes` TEXT NULL,
`user_id` INT UNSIGNED NULL,
`created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_inventory` (`inventory_id`),
KEY `idx_type` (`transaction_type`),
CONSTRAINT `fk_invtx_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `#__mokosuiteresto_inventory`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -0,0 +1,9 @@
DROP TABLE IF EXISTS `#__mokosuiteresto_inventory_transactions`;
DROP TABLE IF EXISTS `#__mokosuiteresto_inventory`;
DROP TABLE IF EXISTS `#__mokosuiteresto_order_items`;
DROP TABLE IF EXISTS `#__mokosuiteresto_orders`;
DROP TABLE IF EXISTS `#__mokosuiteresto_reservations`;
DROP TABLE IF EXISTS `#__mokosuiteresto_tables`;
DROP TABLE IF EXISTS `#__mokosuiteresto_modifiers`;
DROP TABLE IF EXISTS `#__mokosuiteresto_menu_items`;
DROP TABLE IF EXISTS `#__mokosuiteresto_menus`;
@@ -0,0 +1,20 @@
<?php
/**
* @copyright (C) 2026 Moko Consulting
* @license GPL-3.0-or-later
*/
namespace MokoConsulting\Plugin\System\MokoSuiteResto\Extension;
defined('_JEXEC') or die;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\SubscriberInterface;
final class Resto extends CMSPlugin implements SubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [];
}
}