diff --git a/source/packages/plg_system_mokosuitesight/language/en-GB/plg_system_mokosuitesight.ini b/source/packages/plg_system_mokosuitesight/language/en-GB/plg_system_mokosuitesight.ini new file mode 100644 index 0000000..5d134f6 --- /dev/null +++ b/source/packages/plg_system_mokosuitesight/language/en-GB/plg_system_mokosuitesight.ini @@ -0,0 +1,2 @@ +PLG_SYSTEM_MOKOSUITESIGHT="System - MokoSuite Insight" +PLG_SYSTEM_MOKOSUITESIGHT_DESC="Real-time dashboards, KPI monitoring, and alerting with Chart.js 4 rendering." diff --git a/source/packages/plg_system_mokosuitesight/language/en-GB/plg_system_mokosuitesight.sys.ini b/source/packages/plg_system_mokosuitesight/language/en-GB/plg_system_mokosuitesight.sys.ini new file mode 100644 index 0000000..5d134f6 --- /dev/null +++ b/source/packages/plg_system_mokosuitesight/language/en-GB/plg_system_mokosuitesight.sys.ini @@ -0,0 +1,2 @@ +PLG_SYSTEM_MOKOSUITESIGHT="System - MokoSuite Insight" +PLG_SYSTEM_MOKOSUITESIGHT_DESC="Real-time dashboards, KPI monitoring, and alerting with Chart.js 4 rendering." diff --git a/source/packages/plg_system_mokosuitesight/mokosuitesight.xml b/source/packages/plg_system_mokosuitesight/mokosuitesight.xml new file mode 100644 index 0000000..3ee9696 --- /dev/null +++ b/source/packages/plg_system_mokosuitesight/mokosuitesight.xml @@ -0,0 +1,35 @@ + + + System - MokoSuite Insight + mokosuitesight + Moko Consulting + 2026-06-22 + Copyright (C) 2026 Moko Consulting. All rights reserved. + GPL-3.0-or-later + hello@mokoconsulting.tech + https://mokoconsulting.tech + 01.00.00 + 8.3 + PLG_SYSTEM_MOKOSUITESIGHT_DESC + Moko\Plugin\System\MokoSuiteSight + + src + services + language + sql + + + en-GB/plg_system_mokosuitesight.ini + en-GB/plg_system_mokosuitesight.sys.ini + + sql/install.mysql.sql + sql/uninstall.mysql.sql + + +
+ + +
+
+
+
diff --git a/source/packages/plg_system_mokosuitesight/services/provider.php b/source/packages/plg_system_mokosuitesight/services/provider.php new file mode 100644 index 0000000..54395fa --- /dev/null +++ b/source/packages/plg_system_mokosuitesight/services/provider.php @@ -0,0 +1,27 @@ +set( + PluginInterface::class, + function (Container $container) { + $dispatcher = $container->get(DispatcherInterface::class); + $plugin = new Insight($dispatcher, (array) PluginHelper::getPlugin('system', 'mokosuitesight')); + $plugin->setApplication(Factory::getApplication()); + return $plugin; + } + ); + } +}; diff --git a/source/packages/plg_system_mokosuitesight/sql/install.mysql.sql b/source/packages/plg_system_mokosuitesight/sql/install.mysql.sql new file mode 100644 index 0000000..b557144 --- /dev/null +++ b/source/packages/plg_system_mokosuitesight/sql/install.mysql.sql @@ -0,0 +1,101 @@ +-- +-- MokoSuite Insight Tables +-- + +CREATE TABLE IF NOT EXISTS `#__mokosuitesight_dashboards` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `title` VARCHAR(255) NOT NULL, + `description` TEXT, + `user_id` INT NOT NULL, + `is_shared` TINYINT NOT NULL DEFAULT 0, + `layout` JSON DEFAULT NULL, + `auto_refresh_seconds` INT UNSIGNED NOT NULL DEFAULT 60, + `published` TINYINT NOT NULL DEFAULT 1, + `ordering` INT NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL, + `modified` DATETIME DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx_user` (`user_id`), + KEY `idx_shared` (`is_shared`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__mokosuitesight_widgets` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `dashboard_id` INT UNSIGNED NOT NULL, + `title` VARCHAR(255) NOT NULL, + `type` ENUM('counter','line_chart','bar_chart','pie_chart','gauge','table','sparkline','heatmap','funnel') NOT NULL DEFAULT 'counter', + `data_source` VARCHAR(255) NOT NULL, + `config` JSON DEFAULT NULL, + `position_x` INT UNSIGNED NOT NULL DEFAULT 0, + `position_y` INT UNSIGNED NOT NULL DEFAULT 0, + `width` INT UNSIGNED NOT NULL DEFAULT 4, + `height` INT UNSIGNED NOT NULL DEFAULT 3, + `ordering` INT NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL, + PRIMARY KEY (`id`), + KEY `idx_dashboard` (`dashboard_id`), + KEY `idx_source` (`data_source`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__mokosuitesight_data_sources` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `name` VARCHAR(255) NOT NULL, + `module` VARCHAR(100) NOT NULL, + `type` ENUM('scalar','list','timeseries') NOT NULL DEFAULT 'scalar', + `query_class` VARCHAR(500) NOT NULL DEFAULT '', + `description` TEXT, + `active` TINYINT NOT NULL DEFAULT 1, + `created` DATETIME NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `idx_name` (`name`), + KEY `idx_module` (`module`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +INSERT IGNORE INTO `#__mokosuitesight_data_sources` + (`name`, `module`, `type`, `description`, `active`, `created`) VALUES + ('crm.contact_count', 'crm', 'scalar', 'Total CRM contacts', 1, NOW()), + ('crm.deals_pipeline', 'crm', 'list', 'Deals by pipeline stage', 1, NOW()), + ('crm.revenue_monthly', 'crm', 'timeseries', 'Monthly revenue (12 months)', 1, NOW()), + ('pos.daily_sales', 'pos', 'scalar', 'Today total sales', 1, NOW()), + ('hrm.headcount', 'hrm', 'scalar', 'Active employee count', 1, NOW()); + +CREATE TABLE IF NOT EXISTS `#__mokosuitesight_alerts` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `title` VARCHAR(255) NOT NULL, + `data_source` VARCHAR(255) NOT NULL, + `operator` ENUM('gt','gte','lt','lte','eq','neq') NOT NULL DEFAULT 'gt', + `threshold` DECIMAL(15,2) NOT NULL, + `cooldown_minutes` INT UNSIGNED NOT NULL DEFAULT 60, + `notify_user_id` INT DEFAULT NULL, + `active` TINYINT NOT NULL DEFAULT 1, + `last_triggered` DATETIME DEFAULT NULL, + `created` DATETIME NOT NULL, + PRIMARY KEY (`id`), + KEY `idx_source` (`data_source`), + KEY `idx_active` (`active`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__mokosuitesight_alert_log` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `alert_id` INT UNSIGNED NOT NULL, + `value` DECIMAL(15,2) NOT NULL, + `threshold` DECIMAL(15,2) NOT NULL, + `acknowledged` TINYINT NOT NULL DEFAULT 0, + `acknowledged_by` INT DEFAULT NULL, + `acknowledged_at` DATETIME DEFAULT NULL, + `triggered_at` DATETIME NOT NULL, + PRIMARY KEY (`id`), + KEY `idx_alert` (`alert_id`), + KEY `idx_ack` (`acknowledged`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__mokosuitesight_snapshots` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `dashboard_id` INT UNSIGNED NOT NULL, + `data` JSON NOT NULL, + `captured_at` DATETIME NOT NULL, + `captured_by` INT NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_dashboard` (`dashboard_id`), + KEY `idx_date` (`captured_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/source/packages/plg_system_mokosuitesight/sql/uninstall.mysql.sql b/source/packages/plg_system_mokosuitesight/sql/uninstall.mysql.sql new file mode 100644 index 0000000..3761a7f --- /dev/null +++ b/source/packages/plg_system_mokosuitesight/sql/uninstall.mysql.sql @@ -0,0 +1,10 @@ +-- +-- MokoSuite Insight — Uninstall +-- + +DROP TABLE IF EXISTS `#__mokosuitesight_snapshots`; +DROP TABLE IF EXISTS `#__mokosuitesight_alert_log`; +DROP TABLE IF EXISTS `#__mokosuitesight_alerts`; +DROP TABLE IF EXISTS `#__mokosuitesight_data_sources`; +DROP TABLE IF EXISTS `#__mokosuitesight_widgets`; +DROP TABLE IF EXISTS `#__mokosuitesight_dashboards`; diff --git a/source/packages/plg_system_mokosuitesight/src/Extension/Insight.php b/source/packages/plg_system_mokosuitesight/src/Extension/Insight.php new file mode 100644 index 0000000..d9bfaa5 --- /dev/null +++ b/source/packages/plg_system_mokosuitesight/src/Extension/Insight.php @@ -0,0 +1,18 @@ +