Add public campaign analytics functionality
- Add PublicCampaignsController for public campaign analytics
- Add public routes for /public/analytics/{slug} and /api/campaigns/{slug}
- Add public campaign analytics view with charts and KPIs
- Support for campaign sharing via custom slugs
- Real-time analytics with ApexCharts integration
This commit is contained in:
1 parent
16cfc1f7f0
commit
8542395fbe
415 files changed
+40643
-275
No files matched your search
@@ -0,0 +1,5 @@
|
||||
# Netscape HTTP Cookie File
|
||||
# https://curl.se/docs/http-cookies.html
|
||||
# This file was generated by libcurl! Edit at your own risk.
|
||||
|
||||
redirect.moneyflix.com FALSE / FALSE 0 PHPSESSID 8f75ad7bbb4022f56783efc274588ea6
|
||||
+4
-74
@@ -2,37 +2,14 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
// app/Config/branding.php
|
||||
// Configuração exclusiva para MoneyFlix
|
||||
|
||||
return [
|
||||
/**
|
||||
* Hostname-specific configurations.
|
||||
* Usa string única (hostnames separados por vírgula) como chave para evitar erro de offset.
|
||||
* O sistema de matching deve explodir a chave e fazer fnmatch para cada entrada.
|
||||
* Configuração única para MoneyFlix
|
||||
* Este projeto é exclusivamente para o cliente MoneyFlix
|
||||
*/
|
||||
|
||||
// WDMI branding para wdmi.pt, subdomínios, localhost (dev) e servidor WDMI
|
||||
'wdmi.pt,www.wdmi.pt,*.wdmi.pt,localhost,192.168.1.69' => [
|
||||
'client_id' => 'wdmi',
|
||||
'company_name' => 'WDMI',
|
||||
'logo_url' => 'https://static.lvengine.net/wdmi2024/interface/imgs/logo-white.png',
|
||||
'favicon_url' => '/assets/images/favicon.ico',
|
||||
'theme_color' => '#405189',
|
||||
'theme_variants' => [
|
||||
'data-layout' => 'vertical',
|
||||
'data-bs-theme' => 'light',
|
||||
'data-sidebar' => 'gradient',
|
||||
'data-sidebar-size' => 'lg',
|
||||
'data-layout-style' => 'default',
|
||||
'data-topbar' => 'dark',
|
||||
'data-layout-width' => 'fluid',
|
||||
'data-layout-position' => 'fixed',
|
||||
'data-sidebar-image' => 'none',
|
||||
'data-preloader' => 'enable'
|
||||
]
|
||||
],
|
||||
|
||||
// MoneyFlix
|
||||
'moneyflix.pt,www.moneyflix.pt,*.moneyflix.pt,*.moneyflix.com,redirect.moneyflix.com,localhost-moneyflix' => [
|
||||
'default' => [
|
||||
'client_id' => 'moneyflix',
|
||||
'company_name' => 'MoneyFlix',
|
||||
'logo_url' => '/assets/images/moneyflix-dark.png',
|
||||
@@ -54,52 +31,5 @@ return [
|
||||
'data-sidebar-image' => 'none',
|
||||
'data-preloader' => 'enable'
|
||||
]
|
||||
],
|
||||
|
||||
// Performix (inclui BetZoo - adquirido)
|
||||
'analytics.performix.com,*.performix.com,performixmedia.com,*.performixmedia.com,*.betzoo.com,betzoo.com,localhost-performix,localhost-betzoo' => [
|
||||
'client_id' => 'performix',
|
||||
'company_name' => 'Performix',
|
||||
'logo_url' => '/assets/images/performix-logo.png',
|
||||
'logo_light' => '/assets/images/performix-logo-light.png',
|
||||
'logo_dark' => '/assets/images/performix-logo-dark.png',
|
||||
'favicon_url' => '/assets/images/clients/performix-favicon.ico',
|
||||
'theme_color' => '#3b82f6',
|
||||
'theme_variants' => [
|
||||
'data-layout' => 'vertical',
|
||||
'data-bs-theme' => 'light',
|
||||
'data-sidebar' => 'light',
|
||||
'data-sidebar-size' => 'lg',
|
||||
'data-layout-style' => 'default',
|
||||
'data-topbar' => 'light',
|
||||
'data-layout-width' => 'fluid',
|
||||
'data-layout-position' => 'fixed',
|
||||
'data-sidebar-image' => 'none',
|
||||
'data-preloader' => 'enable'
|
||||
]
|
||||
],
|
||||
|
||||
/**
|
||||
* Fallback configuration for unmatched hostnames.
|
||||
* Alterado para usar WDMI como padrão
|
||||
*/
|
||||
'default' => [
|
||||
'client_id' => 'wdmi',
|
||||
'company_name' => 'WDMI',
|
||||
'logo_url' => 'https://static.lvengine.net/wdmi2024/interface/imgs/logo-white.png',
|
||||
'favicon_url' => '/assets/images/favicon.ico',
|
||||
'theme_color' => '#405189',
|
||||
'theme_variants' => [
|
||||
'data-layout' => 'vertical',
|
||||
'data-bs-theme' => 'light',
|
||||
'data-sidebar' => 'gradient',
|
||||
'data-sidebar-size' => 'lg',
|
||||
'data-layout-style' => 'default',
|
||||
'data-topbar' => 'dark',
|
||||
'data-layout-width' => 'fluid',
|
||||
'data-layout-position' => 'fixed',
|
||||
'data-sidebar-image' => 'none',
|
||||
'data-preloader' => 'enable'
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -17,6 +17,29 @@ class AuthMiddleware
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API or Auth: allow if logged in OR if Authorization Bearer matches env key
|
||||
*/
|
||||
public static function apiOrAuth(): void
|
||||
{
|
||||
if (Auth::check()) {
|
||||
return;
|
||||
}
|
||||
$authHeader = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
|
||||
$token = null;
|
||||
if (stripos($authHeader, 'Bearer ') === 0) {
|
||||
$token = trim(substr($authHeader, 7));
|
||||
}
|
||||
$expected = $_ENV['REDIRECTS_API_KEY'] ?? getenv('REDIRECTS_API_KEY') ?? '';
|
||||
if ($expected && $token && hash_equals($expected, $token)) {
|
||||
return;
|
||||
}
|
||||
http_response_code(401);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['success' => false, 'message' => 'Unauthorized']);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has a specific role.
|
||||
*/
|
||||
|
||||
@@ -296,9 +296,11 @@ class MigrationManager
|
||||
private function getLastBatchMigrations(int $steps = 1): array
|
||||
{
|
||||
try {
|
||||
// Sanitize steps to prevent SQL injection
|
||||
$steps = max(1, min(100, (int)$steps));
|
||||
|
||||
$result = $this->db->fetchAll(
|
||||
"SELECT migration FROM migrations ORDER BY batch DESC, executed_at DESC LIMIT ?",
|
||||
[$steps]
|
||||
"SELECT migration FROM migrations ORDER BY batch DESC, executed_at DESC LIMIT " . $steps
|
||||
);
|
||||
return array_column($result, 'migration');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Core\Database\Migrations;
|
||||
|
||||
use App\Core\Database\Migration;
|
||||
|
||||
class AddRawRequestToRedirectStats extends Migration
|
||||
{
|
||||
protected ?string $connection = null;
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
// Add JSON/LONGTEXT column to persist full request metadata for each hit
|
||||
$this->addColumn('redirect_stats', 'raw_request', 'LONGTEXT NULL COMMENT "Raw request payload (headers, query, meta)"');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$this->dropColumn('redirect_stats', 'raw_request');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -157,4 +157,17 @@ class InputSanitizer
|
||||
self::$sanitizedInputs = [];
|
||||
self::$initialized = false;
|
||||
}
|
||||
/**
|
||||
* Converte vários formatos para boolean seguro
|
||||
*/
|
||||
public static function toBoolean($value, bool $default = false): bool
|
||||
{
|
||||
if ($value === null || $value === '') return $default;
|
||||
if (is_bool($value)) return $value;
|
||||
if (is_int($value)) return $value === 1;
|
||||
$normalized = strtolower(trim((string)$value));
|
||||
if (in_array($normalized, ['1','true','on','yes'], true)) return true;
|
||||
if (in_array($normalized, ['0','false','off','no'], true)) return false;
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,15 @@ class PathManager
|
||||
self::$rootPath = self::findRootPath();
|
||||
|
||||
// Define all other paths relative to root
|
||||
// Check if we're in the crm structure or app structure
|
||||
if (is_dir(self::$rootPath . '/crm')) {
|
||||
// CRM structure: root/crm/
|
||||
self::$appPath = self::$rootPath . '/crm';
|
||||
} else {
|
||||
// App structure: root/app/
|
||||
self::$appPath = self::$rootPath . '/app';
|
||||
}
|
||||
|
||||
self::$modulesPath = self::$appPath . '/Modules';
|
||||
self::$storagePath = self::$rootPath . '/storage';
|
||||
self::$publicPath = self::$rootPath . '/public';
|
||||
@@ -46,11 +54,13 @@ class PathManager
|
||||
*/
|
||||
private static function findRootPath(): string
|
||||
{
|
||||
// Force root path to be the directory containing the app folder
|
||||
// This fixes the issue where composer.json exists in both root and app directories
|
||||
$currentPath = __DIR__;
|
||||
|
||||
// Go up directories until we find composer.json
|
||||
// Go up directories until we find the directory that contains both composer.json and app folder
|
||||
while ($currentPath !== '/' && $currentPath !== '') {
|
||||
if (file_exists($currentPath . '/composer.json')) {
|
||||
if (file_exists($currentPath . '/composer.json') && is_dir($currentPath . '/app')) {
|
||||
return $currentPath;
|
||||
}
|
||||
$currentPath = dirname($currentPath);
|
||||
|
||||
+14
-1
@@ -208,7 +208,20 @@ class Validate
|
||||
*/
|
||||
public static function boolean($value): bool
|
||||
{
|
||||
return is_bool($value) || in_array($value, [0, 1, '0', '1', true, false], true);
|
||||
// Permitir nulo/vazio quando usado com 'nullable'
|
||||
if ($value === null || $value === '') return true;
|
||||
if (is_bool($value)) return true;
|
||||
// Aceitar valores comuns de formulários web
|
||||
if (is_string($value)) {
|
||||
$normalized = strtolower(trim($value));
|
||||
if (in_array($normalized, ['1','0','true','false','on','off','yes','no'], true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (is_int($value)) {
|
||||
return in_array($value, [0,1], true);
|
||||
}
|
||||
return in_array($value, ['0','1', 0, 1, true, false], true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+11
-11
@@ -248,8 +248,8 @@ class Validator
|
||||
$messages = [
|
||||
'required' => "O campo {$fieldName} é obrigatório.",
|
||||
'email' => "O campo {$fieldName} deve ser um email válido.",
|
||||
'min' => "O campo {$fieldName} deve ter pelo menos {$params[0]} caracteres.",
|
||||
'max' => "O campo {$fieldName} deve ter no máximo {$params[0]} caracteres.",
|
||||
'min' => "O campo {$fieldName} deve ter pelo menos " . (isset($params[0]) ? $params[0] : '0') . " caracteres.",
|
||||
'max' => "O campo {$fieldName} deve ter no máximo " . (isset($params[0]) ? $params[0] : '0') . " caracteres.",
|
||||
'numeric' => "O campo {$fieldName} deve ser numérico.",
|
||||
'integer' => "O campo {$fieldName} deve ser um número inteiro.",
|
||||
'decimal' => "O campo {$fieldName} deve ser um número decimal.",
|
||||
@@ -258,21 +258,21 @@ class Validator
|
||||
'date' => "O campo {$fieldName} deve ser uma data válida.",
|
||||
'alpha' => "O campo {$fieldName} deve conter apenas letras.",
|
||||
'alphanumeric' => "O campo {$fieldName} deve conter apenas letras e números.",
|
||||
'in' => "O campo {$fieldName} deve ser um dos valores: " . implode(', ', $params),
|
||||
'not_in' => "O campo {$fieldName} não pode ser um dos valores: " . implode(', ', $params),
|
||||
'in' => "O campo {$fieldName} deve ser um dos valores: " . (empty($params) ? '' : implode(', ', $params)),
|
||||
'not_in' => "O campo {$fieldName} não pode ser um dos valores: " . (empty($params) ? '' : implode(', ', $params)),
|
||||
'unique' => "O valor do campo {$fieldName} já existe.",
|
||||
'exists' => "O valor do campo {$fieldName} não existe.",
|
||||
'confirmed' => "A confirmação do campo {$fieldName} não coincide.",
|
||||
'different' => "O campo {$fieldName} deve ser diferente de {$params[0]}.",
|
||||
'same' => "O campo {$fieldName} deve ser igual a {$params[0]}.",
|
||||
'different' => "O campo {$fieldName} deve ser diferente de " . (isset($params[0]) ? $params[0] : 'outro campo') . ".",
|
||||
'same' => "O campo {$fieldName} deve ser igual a " . (isset($params[0]) ? $params[0] : 'outro campo') . ".",
|
||||
'regex' => "O formato do campo {$fieldName} é inválido.",
|
||||
'file' => "O campo {$fieldName} deve ser um arquivo válido.",
|
||||
'image' => "O campo {$fieldName} deve ser uma imagem válida.",
|
||||
'mimes' => "O campo {$fieldName} deve ser um arquivo do tipo: " . implode(', ', $params),
|
||||
'size' => "O campo {$fieldName} deve ter no máximo {$params[0]} KB.",
|
||||
'between' => "O campo {$fieldName} deve estar entre {$params[0]} e {$params[1]}.",
|
||||
'min_value' => "O campo {$fieldName} deve ser pelo menos {$params[0]}.",
|
||||
'max_value' => "O campo {$fieldName} deve ser no máximo {$params[0]}.",
|
||||
'mimes' => "O campo {$fieldName} deve ser um arquivo do tipo: " . (empty($params) ? '' : implode(', ', $params)),
|
||||
'size' => "O campo {$fieldName} deve ter no máximo " . (isset($params[0]) ? $params[0] : '0') . " KB.",
|
||||
'between' => "O campo {$fieldName} deve estar entre " . (isset($params[0]) ? $params[0] : '0') . " e " . (isset($params[1]) ? $params[1] : '0') . ".",
|
||||
'min_value' => "O campo {$fieldName} deve ser pelo menos " . (isset($params[0]) ? $params[0] : '0') . ".",
|
||||
'max_value' => "O campo {$fieldName} deve ser no máximo " . (isset($params[0]) ? $params[0] : '0') . ".",
|
||||
'strong_password' => "O campo {$fieldName} deve ter pelo menos 8 caracteres, incluindo maiúscula, minúscula e número."
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
<?php
|
||||
namespace App\Modules\Controllers;
|
||||
|
||||
use App\Core\InputSanitizer;
|
||||
use App\Core\Sanitize;
|
||||
use App\Core\View;
|
||||
use App\Core\Auth;
|
||||
|
||||
class PagesController
|
||||
{
|
||||
public static function starter(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Starter Page',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Starter'
|
||||
]);
|
||||
// A página starter é uma tela em branco por design.
|
||||
// Não há mais nada a renderizar aqui para evitar o ciclo.
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function profile(): void
|
||||
{
|
||||
try {
|
||||
// Get current user ID from session
|
||||
$userId = \App\Core\Auth::id();
|
||||
if (!$userId) {
|
||||
header('Location: /auth/login');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Load user data from database (fallback if Users module not available)
|
||||
$userData = null;
|
||||
if (class_exists('\\App\\Modules\\Users\\Models\\UserModel')) {
|
||||
$userModel = new \App\Modules\Users\Models\UserModel();
|
||||
$userData = $userModel->find($userId);
|
||||
} else {
|
||||
// Fallback: create basic user data from Auth
|
||||
$authUser = Auth::user();
|
||||
$userData = $authUser ?: [
|
||||
'first_name' => 'User',
|
||||
'last_name' => 'Name',
|
||||
'email' => '[email protected]',
|
||||
'username' => 'user',
|
||||
'job_title' => '',
|
||||
'company_name' => '',
|
||||
'city' => '',
|
||||
'country' => '',
|
||||
'phone' => '',
|
||||
'website' => '',
|
||||
'avatar' => '/assets/images/users/avatar-1.jpg',
|
||||
'profile_bg' => '/assets/images/small/img-4.jpg',
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'followers_count' => 0,
|
||||
'following_count' => 0,
|
||||
'bio' => 'No bio available.',
|
||||
'location' => 'N/A',
|
||||
'skills' => '[]',
|
||||
'social_links' => '{}',
|
||||
'profile_completion' => 50
|
||||
];
|
||||
}
|
||||
|
||||
if (!$userData) {
|
||||
throw new \Exception('User not found');
|
||||
}
|
||||
|
||||
// Prepare user data
|
||||
$user = [
|
||||
'id' => $userId,
|
||||
'first_name' => Sanitize::string($userData['first_name'] ?? ''),
|
||||
'last_name' => Sanitize::string($userData['last_name'] ?? ''),
|
||||
'username' => Sanitize::string($userData['username'] ?? ''),
|
||||
'email' => Sanitize::email($userData['email'] ?? ''),
|
||||
'job_title' => Sanitize::string($userData['job_title'] ?? ''),
|
||||
'company_name' => Sanitize::string($userData['company_name'] ?? ''),
|
||||
'city' => Sanitize::string($userData['city'] ?? ''),
|
||||
'country' => Sanitize::string($userData['country'] ?? ''),
|
||||
'phone' => Sanitize::string($userData['phone'] ?? ''),
|
||||
'website' => Sanitize::url($userData['website'] ?? ''),
|
||||
'avatar' => Sanitize::string($userData['avatar'] ?? '/assets/images/users/avatar-1.jpg'),
|
||||
'profile_bg' => Sanitize::string($userData['profile_bg'] ?? '/assets/images/small/img-4.jpg'),
|
||||
'created_at' => $userData['created_at'] ?? '',
|
||||
'followers_count' => $userData['followers_count'] ?? 0,
|
||||
'following_count' => $userData['following_count'] ?? 0
|
||||
];
|
||||
|
||||
// Load profile data from database
|
||||
$profile = [
|
||||
'bio' => Sanitize::string($userData['bio'] ?? 'No bio available.'),
|
||||
'location' => Sanitize::string($userData['location'] ?? 'N/A'),
|
||||
'skills' => json_decode($userData['skills'] ?? '[]', true) ?: [],
|
||||
'social_links' => json_decode($userData['social_links'] ?? '{}', true) ?: [],
|
||||
'profile_completion' => $userData['profile_completion'] ?? 50
|
||||
];
|
||||
|
||||
// Load recent activities from database (with fallback)
|
||||
$db = \App\Core\DatabaseManager::getInstance();
|
||||
$recentActivities = [];
|
||||
$recentProjects = [];
|
||||
$recentDocuments = [];
|
||||
|
||||
try {
|
||||
$recentActivities = $db->fetchAll("
|
||||
SELECT
|
||||
a.id,
|
||||
a.activity_type,
|
||||
a.description,
|
||||
a.created_at,
|
||||
u.first_name,
|
||||
u.last_name,
|
||||
u.avatar
|
||||
FROM user_activities a
|
||||
LEFT JOIN users u ON a.user_id = u.id
|
||||
WHERE a.user_id = ? OR a.target_user_id = ?
|
||||
ORDER BY a.created_at DESC
|
||||
LIMIT 10
|
||||
", [$userId, $userId]) ?: [];
|
||||
} catch (\Exception $e) {
|
||||
// Table might not exist, use empty array
|
||||
}
|
||||
|
||||
try {
|
||||
$recentProjects = $db->fetchAll("
|
||||
SELECT
|
||||
p.id,
|
||||
p.name,
|
||||
p.description,
|
||||
p.status,
|
||||
p.created_at,
|
||||
p.updated_at
|
||||
FROM projects p
|
||||
WHERE p.user_id = ?
|
||||
ORDER BY p.updated_at DESC
|
||||
LIMIT 5
|
||||
", [$userId]) ?: [];
|
||||
} catch (\Exception $e) {
|
||||
// Table might not exist, use empty array
|
||||
}
|
||||
|
||||
try {
|
||||
$recentDocuments = $db->fetchAll("
|
||||
SELECT
|
||||
d.id,
|
||||
d.filename,
|
||||
d.file_type,
|
||||
d.file_size,
|
||||
d.uploaded_at
|
||||
FROM user_documents d
|
||||
WHERE d.user_id = ?
|
||||
ORDER BY d.uploaded_at DESC
|
||||
LIMIT 10
|
||||
", [$userId]) ?: [];
|
||||
} catch (\Exception $e) {
|
||||
// Table might not exist, use empty array
|
||||
}
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Profile',
|
||||
'page_content' => function() use ($user, $profile, $recentActivities, $recentProjects, $recentDocuments) {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Profile'
|
||||
]);
|
||||
View::render('@pages/profile', [
|
||||
'user' => $user,
|
||||
'profile' => $profile,
|
||||
'recentActivities' => $recentActivities,
|
||||
'recentProjects' => $recentProjects,
|
||||
'recentDocuments' => $recentDocuments
|
||||
]);
|
||||
}
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
\App\Core\ErrorReporter::report($e, ['context' => 'pages_profile', 'user_id' => $userId ?? 0]);
|
||||
|
||||
if (strpos($e->getMessage(), 'Authentication required') !== false) {
|
||||
header('Location: /auth/login');
|
||||
exit;
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo 'Erro interno do servidor';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function team(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Team',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Team'
|
||||
]);
|
||||
View::render('@pages/team');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function timeline(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Timeline',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Timeline'
|
||||
]);
|
||||
View::render('@pages/timeline');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function faqs(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'FAQs',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'FAQs'
|
||||
]);
|
||||
View::render('@pages/faqs');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function pricing(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Pricing',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Pricing'
|
||||
]);
|
||||
View::render('@pages/pricing');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function gallery(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Gallery',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Gallery'
|
||||
]);
|
||||
View::render('@pages/gallery');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function maintenance(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Maintenance',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Maintenance'
|
||||
]);
|
||||
View::render('@pages/maintenance');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function comingSoon(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Coming Soon',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Coming Soon'
|
||||
]);
|
||||
View::render('@pages/coming/soon');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function sitemap(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Sitemap',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Sitemap'
|
||||
]);
|
||||
View::render('@pages/sitemap');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function searchResults(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Search Results',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Search Results'
|
||||
]);
|
||||
View::render('@pages/search/results');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function privacyPolicy(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Privacy Policy',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Privacy Policy'
|
||||
]);
|
||||
View::render('@pages/privacy/policy');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function termsOfService(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Terms of Service',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Terms of Service'
|
||||
]);
|
||||
View::render('@pages/term/conditions');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function pagesProfileSettingsPage(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Profile Settings',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Profile Settings'
|
||||
]);
|
||||
View::render('@pages/profile/settings');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function pagesBlogOverviewPage(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Blog Overview',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Blog Overview'
|
||||
]);
|
||||
View::render('@pages/blog/overview');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function pagesBlogGridPage(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Blog Grid',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Blog Grid'
|
||||
]);
|
||||
View::render('@pages/blog/grid');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public static function pagesBlogListPage(): void
|
||||
{
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Blog List',
|
||||
'page_content' => function() {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Pages',
|
||||
'title' => 'Blog List'
|
||||
]);
|
||||
View::render('@pages/blog/list');
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
<?php
|
||||
namespace App\Modules\Controllers;
|
||||
|
||||
use App\Core\BaseController;
|
||||
use App\Core\View;
|
||||
use App\Core\DatabaseManager;
|
||||
use App\Core\Branding;
|
||||
|
||||
class PublicCampaignsController extends BaseController
|
||||
{
|
||||
private DatabaseManager $db;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db = DatabaseManager::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the public campaign analytics page.
|
||||
*/
|
||||
public function analytics(string $slug): void
|
||||
{
|
||||
if (empty($slug)) {
|
||||
http_response_code(404);
|
||||
echo "Campaign slug is required.";
|
||||
return;
|
||||
}
|
||||
|
||||
$branding = Branding::get();
|
||||
$page_title = ($branding['company_name'] ?? 'Analytics') . ' - Campaign Dashboard';
|
||||
|
||||
View::render('layouts/public-blank.php', [
|
||||
'title' => $page_title,
|
||||
'page_name' => 'public-campaign-analytics',
|
||||
'branding' => $branding,
|
||||
'slug' => $slug,
|
||||
'page_content' => function() use ($branding, $slug) {
|
||||
View::render('layouts/page-title.php', [
|
||||
'pagetitle' => 'Campaign Analytics',
|
||||
'title' => 'Campaign Performance'
|
||||
]);
|
||||
View::render('@modules/public-campaign-analytics', [
|
||||
'branding' => $branding,
|
||||
'slug' => $slug
|
||||
]);
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* API endpoint: Get campaign stats by slug and optional filters.
|
||||
*/
|
||||
public function getCampaignStats(string $slug): void
|
||||
{
|
||||
header('Content-Type: application/json');
|
||||
if (empty($slug)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['success' => false, 'message' => 'Missing campaign slug']);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get query parameters
|
||||
$startDate = $_GET['startDate'] ?? date('Y-m-d', strtotime('-30 days'));
|
||||
$endDate = $_GET['endDate'] ?? date('Y-m-d');
|
||||
$domain = $_GET['domain'] ?? '';
|
||||
|
||||
try {
|
||||
// Buscar campanha por cuid (slug)
|
||||
$campaign = $this->getCampaignByCuid($slug);
|
||||
if (!$campaign) {
|
||||
http_response_code(404);
|
||||
echo json_encode(['success' => false, 'message' => 'Campaign not found']);
|
||||
return;
|
||||
}
|
||||
|
||||
// Buscar dados reais da campanha
|
||||
$data = $this->getRealCampaignData($campaign['id'], $startDate, $endDate, $domain);
|
||||
|
||||
echo json_encode(['success' => true, 'data' => $data]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['success' => false, 'message' => 'Error fetching campaign data']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get campaign by cuid (slug)
|
||||
*/
|
||||
private function getCampaignByCuid(string $cuid): ?array
|
||||
{
|
||||
$sql = "SELECT
|
||||
c.id AS campaign_id,
|
||||
c.name AS campaign_name,
|
||||
c.description AS campaign_description,
|
||||
c.cuid AS campaign_cuid,
|
||||
c.status AS campaign_status,
|
||||
c.budget AS campaign_budget,
|
||||
c.start_date AS start_date,
|
||||
c.end_date AS end_date,
|
||||
c.site_group_id AS site_group_id,
|
||||
c.created_at AS created_date,
|
||||
c.updated_at AS updated_date
|
||||
FROM
|
||||
advertising_campaigns c
|
||||
WHERE
|
||||
c.cuid = :cuid AND c.status >= 0";
|
||||
return $this->db->fetch($sql, [':cuid' => $cuid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get real campaign data from database
|
||||
*/
|
||||
private function getRealCampaignData(int $campaignId, string $startDate, string $endDate, string $domain): array
|
||||
{
|
||||
// Buscar formatos da campanha
|
||||
$formats = $this->getCampaignFormats($campaignId);
|
||||
|
||||
// Buscar estatísticas reais
|
||||
$stats = $this->getCampaignStatsData($campaignId, $startDate, $endDate);
|
||||
|
||||
// Buscar dados de gráficos
|
||||
$charts = $this->getCampaignCharts($campaignId, $startDate, $endDate);
|
||||
|
||||
// Buscar dados de tabelas
|
||||
$tables = $this->getCampaignTables($campaignId, $startDate, $endDate);
|
||||
|
||||
// Buscar domínios disponíveis
|
||||
$domains = $this->getAvailableDomains($campaignId);
|
||||
|
||||
return [
|
||||
'slug' => $campaignId,
|
||||
'filters' => [
|
||||
'domains' => $domains
|
||||
],
|
||||
'scriptInfo' => [
|
||||
'estimatedRevenue' => $stats['total_revenue'] ?? 0,
|
||||
'scriptStatusClass' => $this->getStatusClass($stats['status'] ?? 'active'),
|
||||
'scriptStatusDisplay' => $this->getStatusDisplay($stats['status'] ?? 'active'),
|
||||
'totalViewsAllTime' => $stats['total_views'] ?? 0,
|
||||
'firstHit' => $stats['first_hit'] ?? date('Y-m-d'),
|
||||
'dealType' => 'CPM',
|
||||
'scriptId' => 'script_' . $campaignId
|
||||
],
|
||||
'kpis' => [
|
||||
'impressions' => ['value' => $stats['total_views'] ?? 0],
|
||||
'clicks' => ['value' => $stats['total_clicks'] ?? 0],
|
||||
'ctr' => ['value' => $stats['avg_ctr'] ?? 0]
|
||||
],
|
||||
'charts' => $charts,
|
||||
'tables' => $tables
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get campaign formats
|
||||
*/
|
||||
private function getCampaignFormats(int $campaignId): array
|
||||
{
|
||||
$sql = "SELECT
|
||||
f.id AS format_id,
|
||||
f.name AS format_name,
|
||||
f.type AS format_type,
|
||||
f.width AS format_width,
|
||||
f.height AS format_height,
|
||||
f.weight AS format_weight,
|
||||
f.is_active AS is_active,
|
||||
f.campaign_id AS campaign_id,
|
||||
f.settings AS format_settings,
|
||||
f.created_at AS created_date,
|
||||
f.updated_at AS updated_date
|
||||
FROM
|
||||
advertising_formats f
|
||||
WHERE
|
||||
f.campaign_id = :campaign_id AND f.is_active = 1";
|
||||
return $this->db->fetchAll($sql, [':campaign_id' => $campaignId]) ?: [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get campaign statistics data
|
||||
*/
|
||||
private function getCampaignStatsData(int $campaignId, string $startDate, string $endDate): array
|
||||
{
|
||||
$sql = "SELECT
|
||||
c.id,
|
||||
c.name,
|
||||
c.status,
|
||||
COUNT(DISTINCT f.id) as formats_count,
|
||||
COUNT(DISTINCT cr.id) as creatives_count,
|
||||
SUM(r.views) as total_views,
|
||||
SUM(r.clicks) as total_clicks,
|
||||
SUM(r.registers) as total_registers,
|
||||
SUM(r.revenue) as total_revenue,
|
||||
AVG(r.ctr) as avg_ctr,
|
||||
AVG(r.cpm) as avg_cpm,
|
||||
AVG(r.epc) as avg_epc,
|
||||
MIN(r.date) as first_hit
|
||||
FROM advertising_campaigns c
|
||||
LEFT JOIN advertising_formats f ON c.id = f.campaign_id
|
||||
LEFT JOIN advertising_creatives cr ON f.id = cr.format_id
|
||||
LEFT JOIN advertising_reports_daily r ON c.id = r.campaign_id
|
||||
WHERE c.id = :campaign_id AND c.status >= 0";
|
||||
|
||||
$params = [':campaign_id' => $campaignId];
|
||||
|
||||
if ($startDate) {
|
||||
$sql .= " AND r.date >= :start_date";
|
||||
$params[':start_date'] = $startDate;
|
||||
}
|
||||
|
||||
if ($endDate) {
|
||||
$sql .= " AND r.date <= :end_date";
|
||||
$params[':end_date'] = $endDate;
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY c.id";
|
||||
|
||||
return $this->db->fetch($sql, $params) ?: [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get campaign charts data
|
||||
*/
|
||||
private function getCampaignCharts(int $campaignId, string $startDate, string $endDate): array
|
||||
{
|
||||
// Dados de impressions e clicks por dia
|
||||
$impressionsClicks = $this->getImpressionsClicksData($campaignId, $startDate, $endDate);
|
||||
|
||||
// Dados geográficos
|
||||
$geos = $this->getGeosData($campaignId, $startDate, $endDate);
|
||||
|
||||
// Dados de dispositivos
|
||||
$devices = $this->getDevicesData($campaignId, $startDate, $endDate);
|
||||
|
||||
return [
|
||||
'impressionsAndClicks' => $impressionsClicks,
|
||||
'geos' => $geos,
|
||||
'devices' => $devices
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get impressions and clicks data for charts
|
||||
*/
|
||||
private function getImpressionsClicksData(int $campaignId, string $startDate, string $endDate): array
|
||||
{
|
||||
$sql = "SELECT
|
||||
DATE(r.date) as date,
|
||||
SUM(r.views) as impressions,
|
||||
SUM(r.clicks) as clicks
|
||||
FROM advertising_reports_daily r
|
||||
WHERE r.campaign_id = :campaign_id
|
||||
AND r.date BETWEEN :start_date AND :end_date
|
||||
GROUP BY DATE(r.date)
|
||||
ORDER BY r.date";
|
||||
|
||||
$result = $this->db->fetchAll($sql, [
|
||||
':campaign_id' => $campaignId,
|
||||
':start_date' => $startDate,
|
||||
':end_date' => $endDate
|
||||
]) ?: [];
|
||||
|
||||
$categories = [];
|
||||
$impressionsData = [];
|
||||
$clicksData = [];
|
||||
|
||||
foreach ($result as $row) {
|
||||
$categories[] = $row['date'];
|
||||
$impressionsData[] = (int)$row['impressions'];
|
||||
$clicksData[] = (int)$row['clicks'];
|
||||
}
|
||||
|
||||
return [
|
||||
'series' => [
|
||||
['name' => 'Impressions', 'data' => $impressionsData],
|
||||
['name' => 'Clicks', 'data' => $clicksData]
|
||||
],
|
||||
'categories' => $categories
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get geographical data for charts
|
||||
*/
|
||||
private function getGeosData(int $campaignId, string $startDate, string $endDate): array
|
||||
{
|
||||
$sql = "SELECT
|
||||
r.country_code,
|
||||
SUM(r.views) as impressions
|
||||
FROM advertising_reports_daily r
|
||||
WHERE r.campaign_id = :campaign_id
|
||||
AND r.date BETWEEN :start_date AND :end_date
|
||||
AND r.country_code IS NOT NULL
|
||||
GROUP BY r.country_code
|
||||
ORDER BY impressions DESC
|
||||
LIMIT 10";
|
||||
|
||||
$result = $this->db->fetchAll($sql, [
|
||||
':campaign_id' => $campaignId,
|
||||
':start_date' => $startDate,
|
||||
':end_date' => $endDate
|
||||
]) ?: [];
|
||||
|
||||
$series = [];
|
||||
$labels = [];
|
||||
|
||||
foreach ($result as $row) {
|
||||
$labels[] = $row['country_code'];
|
||||
$series[] = (int)$row['impressions'];
|
||||
}
|
||||
|
||||
return [
|
||||
'series' => $series,
|
||||
'labels' => $labels
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get devices data for charts
|
||||
*/
|
||||
private function getDevicesData(int $campaignId, string $startDate, string $endDate): array
|
||||
{
|
||||
$sql = "SELECT
|
||||
r.device_type,
|
||||
SUM(r.views) as impressions
|
||||
FROM advertising_reports_daily r
|
||||
WHERE r.campaign_id = :campaign_id
|
||||
AND r.date BETWEEN :start_date AND :end_date
|
||||
AND r.device_type IS NOT NULL
|
||||
GROUP BY r.device_type
|
||||
ORDER BY impressions DESC";
|
||||
|
||||
$result = $this->db->fetchAll($sql, [
|
||||
':campaign_id' => $campaignId,
|
||||
':start_date' => $startDate,
|
||||
':end_date' => $endDate
|
||||
]) ?: [];
|
||||
|
||||
$series = [];
|
||||
$labels = [];
|
||||
|
||||
foreach ($result as $row) {
|
||||
$labels[] = ucfirst($row['device_type']);
|
||||
$series[] = (int)$row['impressions'];
|
||||
}
|
||||
|
||||
return [
|
||||
'series' => $series,
|
||||
'labels' => $labels
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get campaign tables data
|
||||
*/
|
||||
private function getCampaignTables(int $campaignId, string $startDate, string $endDate): array
|
||||
{
|
||||
$sql = "SELECT
|
||||
r.date,
|
||||
r.country_code,
|
||||
r.views,
|
||||
r.clicks,
|
||||
r.ctr
|
||||
FROM advertising_reports_daily r
|
||||
WHERE r.campaign_id = :campaign_id
|
||||
AND r.date BETWEEN :start_date AND :end_date
|
||||
ORDER BY r.date DESC, r.views DESC
|
||||
LIMIT 20";
|
||||
|
||||
$result = $this->db->fetchAll($sql, [
|
||||
':campaign_id' => $campaignId,
|
||||
':start_date' => $startDate,
|
||||
':end_date' => $endDate
|
||||
]) ?: [];
|
||||
|
||||
$dailyStats = [];
|
||||
foreach ($result as $row) {
|
||||
$dailyStats[] = [
|
||||
$row['date'],
|
||||
$row['country_code'] ?? 'Unknown',
|
||||
number_format($row['views']),
|
||||
number_format($row['clicks']),
|
||||
number_format($row['ctr'], 2) . '%'
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'dailyStats' => $dailyStats
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available domains for the campaign
|
||||
*/
|
||||
private function getAvailableDomains(int $campaignId): array
|
||||
{
|
||||
try {
|
||||
// Buscar domínios reais das campanhas
|
||||
$domains = $this->db->fetchAll("SELECT DISTINCT
|
||||
domain
|
||||
FROM advertising_campaigns
|
||||
WHERE domain IS NOT NULL AND domain != '' AND deleted_at IS NULL
|
||||
ORDER BY domain");
|
||||
|
||||
if (empty($domains)) {
|
||||
return ['performix.pt', 'bitreport.pt', 'crm.local'];
|
||||
}
|
||||
|
||||
return array_column($domains, 'domain');
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return ['performix.pt', 'bitreport.pt', 'crm.local'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status class for display
|
||||
*/
|
||||
private function getStatusClass(string $status): string
|
||||
{
|
||||
return match($status) {
|
||||
'active' => 'badge bg-success-subtle text-success',
|
||||
'paused' => 'badge bg-warning-subtle text-warning',
|
||||
'completed' => 'badge bg-info-subtle text-info',
|
||||
'archived' => 'badge bg-secondary-subtle text-secondary',
|
||||
default => 'badge bg-secondary-subtle text-secondary'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status display text
|
||||
*/
|
||||
private function getStatusDisplay(string $status): string
|
||||
{
|
||||
return match($status) {
|
||||
'active' => 'Ativo',
|
||||
'paused' => 'Pausado',
|
||||
'completed' => 'Concluído',
|
||||
'archived' => 'Arquivado',
|
||||
default => 'Desconhecido'
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
use App\Modules\Controllers\PublicCampaignsController;
|
||||
|
||||
// Rotas públicas do módulo de campanhas
|
||||
$router->get('/public/analytics/{slug}', [PublicCampaignsController::class, 'analytics']);
|
||||
$router->get('/api/campaigns/{slug}', [PublicCampaignsController::class, 'getCampaignStats']);
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
use App\Core\Router;
|
||||
use App\Modules\Controllers\PagesController;
|
||||
|
||||
$router = Router::getInstance();
|
||||
|
||||
// --- PAGES ROUTES ---
|
||||
$router->get('/apps/pages/starter', [PagesController::class, 'starter']);
|
||||
$router->get('/apps/pages/profile', [PagesController::class, 'profile']);
|
||||
$router->get('/apps/pages/profile-settings/', [PagesController::class, 'pagesProfileSettingsPage']);
|
||||
$router->get('/apps/pages/team', [PagesController::class, 'team']);
|
||||
$router->get('/apps/pages/timeline', [PagesController::class, 'timeline']);
|
||||
$router->get('/apps/pages/faqs', [PagesController::class, 'faqs']);
|
||||
$router->get('/apps/pages/pricing', [PagesController::class, 'pricing']);
|
||||
$router->get('/apps/pages/gallery', [PagesController::class, 'gallery']);
|
||||
$router->get('/apps/pages/maintenance', [PagesController::class, 'maintenance']);
|
||||
$router->get('/apps/pages/coming-soon', [PagesController::class, 'comingSoon']);
|
||||
$router->get('/apps/pages/sitemap', [PagesController::class, 'sitemap']);
|
||||
$router->get('/apps/pages/search/results', [PagesController::class, 'searchResults']);
|
||||
$router->get('/apps/pages/privacy-policy', [PagesController::class, 'privacyPolicy']);
|
||||
$router->get('/apps/pages/terms-of-service', [PagesController::class, 'termsOfService']);
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'Erro 404 - Página não encontrada',
|
||||
'page_content' => function() {
|
||||
// Simple, styled 404 message (Portuguese)
|
||||
echo '<div class="row justify-content-center align-items-center" style="min-height:60vh;">';
|
||||
echo '<div class="col-md-8 text-center">';
|
||||
echo '<img src="' . View::asset('/assets/images/404-error.png') . '" alt="404" style="max-width:220px; margin-bottom:2rem;">';
|
||||
echo '<h1 class="display-4 mb-3">Erro 404</h1>';
|
||||
echo '<p class="lead mb-4">A página que procura não existe ou foi movida.</p>';
|
||||
echo '<a href="/" class="btn btn-primary">Voltar à página inicial</a>';
|
||||
echo '</div></div>';
|
||||
}
|
||||
]);
|
||||
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Definir variáveis para o layout
|
||||
$page_title = "Blog Grid View";
|
||||
$page_description = "Blog grid view page";
|
||||
|
||||
// Incluir o layout principal
|
||||
View::render("layouts/main.php", [
|
||||
"title" => $page_title,
|
||||
"description" => $page_description,
|
||||
"page_content" => function() {
|
||||
?>
|
||||
|
||||
<div class="row g-4 mb-3">
|
||||
<div class="col-sm-auto">
|
||||
<div>
|
||||
<a href="/apps/projects/create" class="btn btn-success"><i
|
||||
class="ri-add-line align-bottom me-1"></i> Add New</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="d-flex justify-content-sm-end gap-2">
|
||||
<div class="search-box ms-2">
|
||||
<input type="text" class="form-control" placeholder="Search...">
|
||||
<i class="ri-search-line search-icon"></i>
|
||||
</div>
|
||||
|
||||
<select class="form-control w-md" data-choices data-choices-search-false>
|
||||
<option value="All">All</option>
|
||||
<option value="Today">Today</option>
|
||||
<option value="Yesterday" selected>Yesterday</option>
|
||||
<option value="Last 7 Days">Last 7 Days</option>
|
||||
<option value="Last 30 Days">Last 30 Days</option>
|
||||
<option value="This Month">This Month</option>
|
||||
<option value="Last Year">Last Year</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-1.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">The
|
||||
Mindful Journal</a></h5>
|
||||
<p class="text-muted mb-2">Exploring the beauty of slow living and intentional
|
||||
growth. Discover tips on mindfulness, wellness, and living a balanced life.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-2.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">Next Gen
|
||||
Creators</a></h5>
|
||||
<p class="text-muted mb-2">Empowering the creators A platform for sharing creative
|
||||
projects, tech solutions, and future-thinking ideas to shape the next
|
||||
generation.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-3.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">The
|
||||
Thought Canvas</a></h5>
|
||||
<p class="text-muted mb-2">Where ideas come to life through words and design.
|
||||
Exploring the intersection of creativity, technology, and thoughtful living to
|
||||
fuel your next big idea.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-4.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">The
|
||||
Insight Collective</a></h5>
|
||||
<p class="text-muted mb-2">Curated perspectives on creativity, innovation, and
|
||||
lifestyle. A blend of expert insights, stories, and tips to inspire personal
|
||||
growth and creative thinking.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-5.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">Life by
|
||||
Design</a></h5>
|
||||
<p class="text-muted mb-2">Crafting a life full of intention Explore ideas on
|
||||
mindful living, personal development, and how to design a life that truly
|
||||
inspires you.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-6.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">Crafted
|
||||
Perspectives</a></h5>
|
||||
<p class="text-muted mb-2">Where thoughtful design meets meaningful storytelling.
|
||||
Sharing unique viewpoints on creativity, innovation, and the art of crafting a
|
||||
fulfilling life.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-4.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">Beyond
|
||||
the Blueprint</a></h5>
|
||||
<p class="text-muted mb-2">Designing a life of creativity A space for creators,
|
||||
dreamers, and innovators to explore ideas and strategies for building a
|
||||
meaningful life.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-3 col-lg-6">
|
||||
<div class="card overflow-hidden blog-grid-card">
|
||||
<div class="position-relative overflow-hidden">
|
||||
<img src="<?php echo View::asset("/assets/images/blog/img-4.jpg"); ?>" alt="" class="blog-img object-fit-cover">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a href="/pages-blog-overview/" class="text-reset">The
|
||||
Imagination Engine</a></h5>
|
||||
<p class="text-muted mb-2">A hub for artists, tech enthusiasts, and creatives
|
||||
looking to stay ahead of the curve and bring ideas to life ideas, trends, and
|
||||
inspiration.</p>
|
||||
<a href="/pages-blog-overview/"
|
||||
class="link link-primary text-decoration-underline link-offset-1">Read Post <i
|
||||
class="ri-arrow-right-up-line"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
<div class="row g-0 text-center text-sm-start align-items-center mb-4">
|
||||
<div class="col-sm-6">
|
||||
<div>
|
||||
<p class="mb-sm-0 text-muted">Showing <span class="fw-semibold">1</span> to <span
|
||||
class="fw-semibold">8</span> of <span
|
||||
class="fw-semibold text-decoration-underline">33</span> entries</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
<div class="col-sm-6">
|
||||
<ul
|
||||
class="pagination pagination-separated justify-content-center justify-content-sm-end mb-sm-0">
|
||||
<li class="page-item disabled">
|
||||
<a href="#" class="page-link">Previous</a>
|
||||
</li>
|
||||
<li class="page-item active">
|
||||
<a href="#" class="page-link">1</a>
|
||||
</li>
|
||||
<li class="page-item ">
|
||||
<a href="#" class="page-link">2</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a href="#" class="page-link">3</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a href="#" class="page-link">4</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a href="#" class="page-link">5</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a href="#" class="page-link">Next</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Definir variáveis para o layout
|
||||
$page_title = 'Pages blog list';
|
||||
$page_description = 'Página Pages blog list';
|
||||
|
||||
// Incluir o layout principal
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
?>
|
||||
<?php ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="row">
|
||||
<?php View::include('@blog/components/blog/filters.php'); ?>
|
||||
|
||||
<?php View::include('@blog/components/blog/post-list.php'); ?>
|
||||
|
||||
<?php View::include('@blog/components/blog/pagination.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<?php View::include('@blog/components/blog/sidebar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,305 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Definir variáveis para o layout
|
||||
$page_title = "Blog Overview";
|
||||
$page_description = "Blog overview page";
|
||||
|
||||
// Incluir o layout principal
|
||||
View::render("layouts/main.php", [
|
||||
"title" => $page_title,
|
||||
"description" => $page_description,
|
||||
"page_content" => function() {
|
||||
?>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xxl-10">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="text-center mb-4">
|
||||
<p class="text-success text-uppercase mb-2">Art & Design</p>
|
||||
<h4 class="mb-2">The Art of Storytelling in Design</h4>
|
||||
<p class="text-muted mb-4">How to create impactful narratives through visual
|
||||
elements.</p>
|
||||
<div class="d-flex align-items-center justify-content-center flex-wrap gap-2">
|
||||
<span
|
||||
class="badge bg-primary-subtle text-primary">CraftedPerspectives</span>
|
||||
<span class="badge bg-primary-subtle text-primary">DesignInspiration</span>
|
||||
<span class="badge bg-primary-subtle text-primary">ArtAndDesign</span>
|
||||
</div>
|
||||
</div>
|
||||
<img src="<?php echo View::asset("/assets/images/blog/overview.jpg"); ?>" alt="" class="img-thumbnail">
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-lg-3">
|
||||
<h6 class="pb-1">Contributor By:</h6>
|
||||
<div class="d-flex gap-2 mb-3">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo View::asset("/assets/images/users/avatar-2.jpg"); ?>" alt=""
|
||||
class="avatar-sm rounded">
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h5 class="mb-1"><a href="#!">Nancy Martino</a></h5>
|
||||
<p class="mb-2">Creative Designer</p>
|
||||
<p class="text-muted mb-0">2 hours ago</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-lg-9">
|
||||
<p class="text-muted mb-3">Storytelling has always been a powerful way to
|
||||
communicate, and in the world of design, it is no different. Visual
|
||||
storytelling allows designers to go beyond aesthetics and create
|
||||
meaningful connections with their audience. It transforms static designs
|
||||
into engaging narratives that leave a lasting impression. In this post,
|
||||
we will explore the art of storytelling in design, how it enhances user
|
||||
experiences, and how you can incorporate it into your creative work.</p>
|
||||
<h6>Introduction:</h6>
|
||||
<p class="text-muted mb-3">Design is more than just making things look
|
||||
good—it is about conveying a message and creating an experience. And the
|
||||
best designs tell a story. From logos and branding to websites and
|
||||
product design, storytelling is woven into every aspect of successful
|
||||
design projects. When you integrate storytelling into your design, you
|
||||
give your audience something to connect with emotionally, making your
|
||||
work more memorable and impactful.</p>
|
||||
<h5 class="fw-semibold">1. Why Storytelling Matters in Design:</h5>
|
||||
<p class="text-muted mb-2">At its core, storytelling in design helps to
|
||||
create a deeper emotional connection between the user and the product or
|
||||
brand. It provides context, helps communicate values, and drives
|
||||
engagement by making the user feel like they are part of the narrative.
|
||||
Here are a few reasons why storytelling is a vital part of design:</p>
|
||||
<ul>
|
||||
<li class="pb-1"><strong>Emotional Connection:</strong> <span
|
||||
class="text-muted">Stories evoke emotions, and emotions drive
|
||||
decisions. Whether you are designing a brand or a user interface,
|
||||
the emotions tied to your design influence how users engage with
|
||||
it.</span></li>
|
||||
<li class="pb-1"><strong>Memorability:</strong> <span
|
||||
class="text-muted">People are more likely to remember a story
|
||||
than a simple image or message. By embedding a narrative into
|
||||
your design, you help your audience recall your brand, product,
|
||||
or message more effectively.</span></li>
|
||||
<li><strong>Clarity of Message:</strong> <span class="text-muted">Good
|
||||
storytelling clarifies your message. It can take a complex idea
|
||||
and distill it into something easily digestible through visuals,
|
||||
layout, and interactions.</span></li>
|
||||
</ul>
|
||||
<blockquote
|
||||
class="blockquote custom-blockquote blockquote-secondary rounded mb-3">
|
||||
<p class="text-body mb-2">"Storytelling in design turns a simple visual
|
||||
into an experience. It transforms static elements into living
|
||||
narratives that engage, inspire, and resonate with those who
|
||||
interact with them."</p>
|
||||
<footer class="blockquote-footer mt-0"><cite title="Source Title">Liam
|
||||
Huxley</cite></footer>
|
||||
</blockquote>
|
||||
<h5 class="fw-semibold">2. Elements of Storytelling in Design:</h5>
|
||||
<p class="text-muted mb-2">To tell a story through design, you need to
|
||||
incorporate several key elements:</p>
|
||||
<ul>
|
||||
<li class="pb-1"><strong>Characters:</strong> <span
|
||||
class="text-muted">Every story has characters, and in design,
|
||||
your characters might be users, brand mascots, or even products
|
||||
themselves. Think about how your design can personify or
|
||||
represent these characters to engage your audience.</span></li>
|
||||
<li class="pb-1"><strong>Plot:</strong> <span class="text-muted">Your
|
||||
design should have a logical flow, leading the viewer through a
|
||||
narrative. This could be the journey of interacting with a
|
||||
product, the evolution of a brand, or even the progression of
|
||||
scrolling through a website.</span></li>
|
||||
<li class="pb-1"><strong>Conflict & Resolution:</strong> <span
|
||||
class="text-muted">A good story includes a challenge and how
|
||||
it is overcome. In design, this might be highlighting a problem
|
||||
your product solves or guiding users through a process that
|
||||
resolves a pain point.</span></li>
|
||||
<li><strong>Setting:</strong> <span class="text-muted">Visual design
|
||||
creates the "world" in which your story takes place. Think about
|
||||
how color, typography, and layout set the tone, mood, and
|
||||
context for your narrative.</span></li>
|
||||
</ul>
|
||||
<h5 class="fw-semibold">3. Techniques to Incorporate Storytelling in Design:</h5>
|
||||
<ul>
|
||||
<li class="pb-1"><strong>Consistent Visual Language:</strong> <span
|
||||
class="text-muted">Develop a cohesive visual language that
|
||||
aligns with the story you are telling. This includes color
|
||||
schemes, typography, and iconography that reflect the brand is
|
||||
identity and the message being conveyed.</span></li>
|
||||
<li class="pb-1"><strong>Journey Mapping:</strong> <span
|
||||
class="text-muted">Especially in user interface design, the
|
||||
user is journey is a key aspect of storytelling. Map out how
|
||||
users interact with your product or website and craft that
|
||||
journey to be intuitive, engaging, and narrative-driven.</span>
|
||||
</li>
|
||||
<li class="pb-1"><strong>Imagery and Metaphor:</strong> <span
|
||||
class="text-muted">Use images and icons to reinforce your story.
|
||||
Visual metaphors are powerful tools for conveying complex ideas
|
||||
simply. For example, a tree might represent growth, while a
|
||||
bridge can symbolize connection.</span></li>
|
||||
<li class="pb-1"><strong>Microinteractions:</strong> <span
|
||||
class="text-muted">Small animations and interactions can add a
|
||||
dynamic layer to your story. Think about how users react to
|
||||
certain actions, like hovering over a button or scrolling
|
||||
through content. These interactions should feel natural and
|
||||
enhance the narrative.</span></li>
|
||||
<li><strong>Typography as a Voice:</strong> <span class="text-muted">The
|
||||
font you choose can help set the tone for your story. Whether
|
||||
it is bold and loud for a dramatic message or elegant and minimal
|
||||
for something more refined, typography plays a major role in how
|
||||
your story is perceived.</span></li>
|
||||
</ul>
|
||||
<h5 class="fw-semibold">4. Examples of Storytelling in Design:</h5>
|
||||
<ul>
|
||||
<li class="pb-1"><strong>Apple:</strong> <span class="text-muted">Apple
|
||||
is known for weaving storytelling into its product designs and
|
||||
marketing campaigns. Their product pages often take the user on
|
||||
a journey, explaining not just what the product is but how it
|
||||
fits into their lives, solving problems they did not even know
|
||||
they had.</span></li>
|
||||
<li class="pb-1"><strong>Airbnb:</strong> <span
|
||||
class="text-muted">Airbnb uses storytelling extensively through
|
||||
user-generated content, allowing travelers to share their
|
||||
personal stories. Their website design reflects this,
|
||||
highlighting real people, real places, and the unique
|
||||
experiences that come with using their service.</span></li>
|
||||
<li><strong>Nike:</strong> <span class="text-muted">Nike is use of
|
||||
storytelling in design is legendary. Their branding, from
|
||||
product design to advertisements, is centered around stories of
|
||||
athletes overcoming obstacles, which mirrors their tagline,
|
||||
"Just Do It." The design reflects these stories through bold
|
||||
imagery and inspiring copy.</span></li>
|
||||
</ul>
|
||||
<div>
|
||||
<h5 class="fw-semibold mb-3">Comments:</h5>
|
||||
<div data-simplebar style="height: 300px;" class="px-3 mx-n3 mb-2">
|
||||
<div class="d-flex mb-4">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo View::asset("/assets/images/users/avatar-8.jpg"); ?>" alt=""
|
||||
class="avatar-xs rounded-circle" />
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h5 class="fs-13">Joseph Parker <small
|
||||
class="text-muted ms-2">20 Dec 2021 -
|
||||
05:47AM</small></h5>
|
||||
<p class="text-muted">I am getting message from customers
|
||||
that when they place order always get error message .
|
||||
</p>
|
||||
<a href="javascript: void(0);"
|
||||
class="badge text-muted bg-light"><i
|
||||
class="mdi mdi-reply"></i> Reply</a>
|
||||
<div class="d-flex mt-4">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo View::asset("/assets/images/users/avatar-10.jpg"); ?>" alt=""
|
||||
class="avatar-xs rounded-circle" />
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h5 class="fs-13">Alexis Clarke <small
|
||||
class="text-muted ms-2">22 Dec 2021 -
|
||||
02:32PM</small></h5>
|
||||
<p class="text-muted">Please be sure to check your
|
||||
Spam mailbox to see if your email filters have
|
||||
identified the email from Dell as spam.</p>
|
||||
<a href="javascript: void(0);"
|
||||
class="badge text-muted bg-light"><i
|
||||
class="mdi mdi-reply"></i> Reply</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex mb-4">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo View::asset("/assets/images/users/avatar-2.jpg"); ?>" alt=""
|
||||
class="avatar-xs rounded-circle" />
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h5 class="fs-13">Donald Hervey <small
|
||||
class="text-muted ms-2">24 Dec 2021 -
|
||||
10:24AM</small></h5>
|
||||
<p class="text-muted">There are many variations of passages
|
||||
of Lorem Ipsum available, but the majority have suffered
|
||||
alteration in some form, by injected humour, or
|
||||
randomised words which do not look even slightly
|
||||
believable.</p>
|
||||
<a href="javascript: void(0);"
|
||||
class="badge text-muted bg-light"><i
|
||||
class="mdi mdi-reply"></i> Reply</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex mb-4">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo View::asset("/assets/images/users/avatar-1.jpg"); ?>" alt=""
|
||||
class="avatar-xs rounded-circle" />
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h5 class="fs-13">Herbert Stokes <small
|
||||
class="text-muted ms-2">26 Dec 2021 -
|
||||
04:56PM</small></h5>
|
||||
<p class="text-muted">If you are going to use a passage of
|
||||
Lorem Ipsum, you need to be sure there is not anything
|
||||
embarrassing hidden in the middle of text.</p>
|
||||
<a href="javascript: void(0);"
|
||||
class="badge text-muted bg-light"><i
|
||||
class="mdi mdi-reply"></i> Reply</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo View::asset("/assets/images/users/avatar-6.jpg"); ?>" alt=""
|
||||
class="avatar-xs rounded-circle" />
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h5 class="fs-13">Tonya Noble <small
|
||||
class="text-muted ms-2">28 Dec 2021 -
|
||||
06:39PM</small></h5>
|
||||
<p class="text-muted">The standard chunk of Lorem Ipsum used
|
||||
since the 1500s is reproduced below for those interested.
|
||||
Sections 1.10.32 and 1.10.33.</p>
|
||||
<a href="javascript: void(0);"
|
||||
class="badge text-muted bg-light"><i
|
||||
class="mdi mdi-reply"></i> Reply</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<h5 class="fw-semibold mb-3">Leave a Comment:</h5>
|
||||
<form>
|
||||
<div class="row g-3">
|
||||
<div class="col-lg-12">
|
||||
<label for="message" class="form-label">Message</label>
|
||||
<textarea class="form-control" id="message" rows="3"
|
||||
placeholder="Your comments..."></textarea>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label for="name" class="form-label">Name *</label>
|
||||
<input type="text" class="form-control" id="name"
|
||||
placeholder="Your name...">
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label for="email" class="form-label">Email *</label>
|
||||
<input type="email" class="form-control" id="email"
|
||||
placeholder="Your email...">
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-success">Post
|
||||
Comment</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
use App\Core\AssetManager;
|
||||
|
||||
// Definir variáveis para o layout
|
||||
$page_title = 'Pages coming soon';
|
||||
$page_description = 'Página Pages coming soon';
|
||||
|
||||
// Incluir o layout principal
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
?>
|
||||
<?php
|
||||
View::include('layouts/main.php'; ?>
|
||||
<?php View::include('layouts/head-css.php');?>
|
||||
<div class="auth-page-wrapper pt-5">
|
||||
<!-- auth page bg -->
|
||||
<div class="auth-one-bg-position auth-one-bg" id="auth-particles">
|
||||
<div class="bg-overlay"></div>
|
||||
|
||||
<div class="shape">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1440 120">
|
||||
<path d="M 0,36 C 144,53.6 432,123.2 720,124 C 1008,124.8 1296,56.8 1440,40L1440 140L0 140z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- auth page content -->
|
||||
<div class="auth-page-content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="text-center mt-sm-5 pt-4 mb-4">
|
||||
<div class="mb-sm-5 pb-sm-4 pb-5">
|
||||
<img src="<?php echo View::asset('/assets/images/comingsoon.png'); ?>" alt="" height="120" class="move-animation">
|
||||
</div>
|
||||
<div class="mb-5">
|
||||
<h1 class="display-2 coming-soon-text">Coming Soon</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="row justify-content-center mt-5">
|
||||
<div class="col-lg-8">
|
||||
<div id="countdown" class="countdownlist"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5">
|
||||
<h4>Get notified when we launch</h4>
|
||||
<p class="text-muted">Don't worry we will not spam you 😊</p>
|
||||
</div>
|
||||
|
||||
<div class="input-group countdown-input-group mx-auto my-4">
|
||||
<input type="email" class="form-control border-light shadow" placeholder="Enter your email address" aria-label="search result" aria-describedby="button-email">
|
||||
<button class="btn btn-success" type="button" id="button-email">Send<i class="ri-send-plane-2-fill align-bottom ms-2"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end auth page content -->
|
||||
|
||||
<!-- footer -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="text-center">
|
||||
<p class="mb-0 text-muted">©
|
||||
<script>document.write(new Date().getFullYear(])</script> <?php echo \App\Core\AppConfig::getCompanyName(); ?>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- end Footer -->
|
||||
</div>
|
||||
<!-- end auth-page-wrapper -->
|
||||
|
||||
<!-- particles js -->
|
||||
|
||||
<!-- particles app js -->
|
||||
|
||||
<!-- Countdown js -->
|
||||
<script src="<?php echo View::asset('/assets/js/pages/coming-soon.init.js']; ?>"></script>
|
||||
<?php,
|
||||
'scripts' => function() {
|
||||
AssetManager::addFooterJs(View::asset('/assets/libs/particles.js/particles.js'));
|
||||
AssetManager::addFooterJs(View::asset('/assets/js/pages/particles.app.js'));
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'page_title' => 'Frequently Asked Questions',
|
||||
'page_content' => function() {
|
||||
View::include('components/faqs/header.php');
|
||||
View::include('components/faqs/general-questions.php');
|
||||
View::include('components/faqs/manage-account.php');
|
||||
View::include('components/faqs/privacy-security.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<script src="<?php echo View::asset('/assets/js/pages/faqs.init.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
$page_title = 'Pages gallery';
|
||||
$page_description = 'Página Pages gallery';
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
View::include('components/gallery/filters.php');
|
||||
View::include('components/gallery/grid.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<!-- Gallery init -->
|
||||
<script src="<?php echo View::asset('/assets/libs/isotope-layout/isotope.pkgd.min.js'); ?>"></script>
|
||||
<script src="<?php echo View::asset('/assets/libs/lightbox2/js/lightbox.min.js'); ?>"></script>
|
||||
<script src="<?php echo View::asset('/assets/js/pages/gallery.init.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
$page_title = 'Pages maintenance';
|
||||
$page_description = 'Página Pages maintenance';
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
View::include('components/maintenance/content.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<script src="<?php echo View::asset('/assets/libs/particles.js/particles.js'); ?>"></script>
|
||||
<script src="<?php echo View::asset('/assets/js/pages/particles.app.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Definir variáveis para o layout
|
||||
$page_title = 'Pricing';
|
||||
$page_description = 'Página de Pricing';
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
View::include('components/pricing/header.php');
|
||||
View::include('components/pricing/plans.php');
|
||||
View::include('components/pricing/faq.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<!-- Pricing init -->
|
||||
<script src="<?php echo View::asset('/assets/js/pages/pricing.init.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Definir variáveis para o layout
|
||||
$page_title = 'Pages privacy policy';
|
||||
$page_description = 'Página Pages privacy policy';
|
||||
|
||||
// Incluir o layout principal
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
?>
|
||||
<?php
|
||||
View::include('layouts/main.php'); ?>
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<?php View::include('layouts/menu.php'); ?>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start right Content here -->
|
||||
<!-- ============================================================== -->
|
||||
|
||||
<?php ?>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-10">
|
||||
<div class="card">
|
||||
<div class="bg-warning-subtle position-relative">
|
||||
<div class="card-body p-5">
|
||||
<div class="text-center">
|
||||
<h3>Privacy Policy</h3>
|
||||
<p class="mb-0 text-muted">Last update: 16 Sept, 2022</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shape">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="1440" height="60" preserveAspectRatio="none" viewBox="0 0 1440 60">
|
||||
<g mask="url("#SvgjsMask1001")" fill="none">
|
||||
<path d="M 0,4 C 144,13 432,48 720,49 C 1008,50 1296,17 1440,9L1440 60L0 60z" style="fill: var(--vz-secondary-bg);"></path>
|
||||
</g>
|
||||
<defs>
|
||||
<mask id="SvgjsMask1001">
|
||||
<rect width="1440" height="60" fill="#ffffff"></rect>
|
||||
</mask>
|
||||
</defs>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<div class="d-flex">
|
||||
<div class="flex-shrink-0 me-3">
|
||||
<i data-feather="check-circle" class="text-success icon-dual-success icon-xs"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h5>Privacy Policy for <?php echo \App\Core\AppConfig::getCompanyName(); ?></h5>
|
||||
<p class="text-muted">At Website Name, accessible at Website.com, one of our main priorities is the privacy of our visitors. This Privacy Policy document contains types of information that is collected and recorded by Website Name and how we use it.</p>
|
||||
<p class="text-muted">If you have additional questions or require more information about our Privacy Policy, do not hesitate to contact us through email at [email protected]</p>
|
||||
<p class="text-muted">This privacy policy applies only to our online activities and is valid for visitors to our website with regards to the information that they shared and/or collect in Website Name. This policy is not applicable to any information collected offline or via channels other than this website.</p>
|
||||
<p class="text-muted">How we use your information:</p>
|
||||
<ul class="text-muted">
|
||||
<li>
|
||||
<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
<div class="flex-shrink-0 me-3">
|
||||
<i data-feather="check-circle" class="text-success icon-dual-success icon-xs"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h5>How we use your information</h5>
|
||||
<p class="text-muted">If you contact us directly, we may receive additional information about you such as your name, email address, phone number, the contents of the message and/or attachments you may send us, and any other information you may choose to provide.</p>
|
||||
<p class="text-muted">Communicate with you, either directly or through one of our partners, including for customer service, to provide you with updates and other information relating to the website, and for marketing and promotional purposes.</p>
|
||||
<p class="text-muted">When you register for an Account, we may ask for your contact information, including items such as name, company name, address, email address, and telephone number.</p>
|
||||
<p class="text-muted">We use the information we collect in various ways, including to:</p>
|
||||
<ul class="text-muted vstack gap-2">
|
||||
<li>
|
||||
Provide, operate, and maintain our website
|
||||
</li>
|
||||
<li>
|
||||
Improve, personalize, and expand our website
|
||||
</li>
|
||||
<li>
|
||||
Understand and analyze how you use our website
|
||||
</li>
|
||||
<li>
|
||||
Develop new products, services, features, and functionality
|
||||
</li>
|
||||
<li>
|
||||
Send you emails
|
||||
</li>
|
||||
<li>
|
||||
Find and prevent fraud
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted">Like any other website, Website Name uses ‘cookies'. These cookies are used to store information including visitors' preferences, and the pages on the website that the visitor accessed or visited. The information is used to optimize the users' experience by customizing our web page content based on visitors' browser type and/or other information.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
<div class="flex-shrink-0 me-3">
|
||||
<i data-feather="check-circle" class="text-success icon-dual-success icon-xs"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<p class="text-muted">Some of advertisers on our site may use cookies and web beacons. Our advertising partners are listed below. Each of our advertising partners has their own Privacy Policy for their policies on user data. For easier access, we hyperlinked to their Privacy Policies below.</p>
|
||||
<p class="text-muted"><b>Website Name's Privacy Policy does not apply to other advertisers or websites. Thus, we are advising you to consult the respective Privacy Policies of these third-party ad servers for more detailed information. It may include their practices and instructions about how to opt-out of certain options. You may find a complete list of these Privacy Policies and their links here: Privacy Policy Links.</b></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-end">
|
||||
<a href="#!" class="btn btn-danger">I'm Understand</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
<!-- End Page-content -->
|
||||
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
<script src="<?php echo View::asset('/assets/js/app.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,150 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title mb-0">Edit Profile</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="/users/profile/update" method="POST">
|
||||
<!-- Personal Information -->
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h5 class="mb-3">Personal Information</h5>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="first_name" class="form-label">First Name</label>
|
||||
<input type="text" class="form-control" id="first_name" name="first_name" value="<?php echo htmlspecialchars($user['first_name']); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="last_name" class="form-label">Last Name</label>
|
||||
<input type="text" class="form-control" id="last_name" name="last_name" value="<?php echo htmlspecialchars($user['last_name']); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" id="email" name="email" value="<?php echo htmlspecialchars($user['email']); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Phone</label>
|
||||
<input type="tel" class="form-control" id="phone" name="phone" value="<?php echo htmlspecialchars($user['phone']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<h5 class="mb-3">Professional Information</h5>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="job_title" class="form-label">Job Title</label>
|
||||
<input type="text" class="form-control" id="job_title" name="job_title" value="<?php echo htmlspecialchars($user['job_title']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="company_name" class="form-label">Company</label>
|
||||
<input type="text" class="form-control" id="company_name" name="company_name" value="<?php echo htmlspecialchars($user['company_name']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="website" class="form-label">Website</label>
|
||||
<input type="url" class="form-control" id="website" name="website" value="<?php echo htmlspecialchars($user['website']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="description" class="form-label">Description</label>
|
||||
<textarea class="form-control" id="description" name="description" rows="3"><?php echo htmlspecialchars($user['description']); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location Information -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h5 class="mb-3">Location</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="city" class="form-label">City</label>
|
||||
<input type="text" class="form-control" id="city" name="city" value="<?php echo htmlspecialchars($user['city']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="country" class="form-label">Country</label>
|
||||
<input type="text" class="form-control" id="country" name="country" value="<?php echo htmlspecialchars($user['country']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="zipcode" class="form-label">Zip Code</label>
|
||||
<input type="text" class="form-control" id="zipcode" name="zipcode" value="<?php echo htmlspecialchars($user['zipcode']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Profile Information -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h5 class="mb-3">Profile Information</h5>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="bio" class="form-label">Bio</label>
|
||||
<textarea class="form-control" id="bio" name="bio" rows="4"><?php echo htmlspecialchars($profile['bio']); ?></textarea>
|
||||
<small class="text-muted">Tell us about yourself...</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="location" class="form-label">Location</label>
|
||||
<input type="text" class="form-control" id="location" name="location" value="<?php echo htmlspecialchars($profile['location']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="skills" class="form-label">Skills</label>
|
||||
<input type="text" class="form-control" id="skills" name="skills" value="<?php echo htmlspecialchars(implode(', ', $profile['skills'])); ?>">
|
||||
<small class="text-muted">Separate skills with commas (e.g., PHP, MySQL, JavaScript)</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Social Links -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h5 class="mb-3">Social Links</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="linkedin" class="form-label">LinkedIn</label>
|
||||
<input type="url" class="form-control" id="linkedin" name="linkedin" value="<?php echo htmlspecialchars($profile['social_links']['linkedin'] ?? ''); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="github" class="form-label">GitHub</label>
|
||||
<input type="url" class="form-control" id="github" name="github" value="<?php echo htmlspecialchars($profile['social_links']['github'] ?? ''); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label for="twitter" class="form-label">Twitter</label>
|
||||
<input type="url" class="form-control" id="twitter" name="twitter" value="<?php echo htmlspecialchars($profile['social_links']['twitter'] ?? ''); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Submit Buttons -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||
<a href="/apps/users/profile" class="btn btn-secondary">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,543 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Use real data passed from controller instead of dummy data
|
||||
// $user and $profile variables are passed from UserController
|
||||
|
||||
// Ensure we have default values if data is missing
|
||||
$user = $user ?? [];
|
||||
$profile = $profile ?? [];
|
||||
$recentActivities = $recentActivities ?? [];
|
||||
$recentProjects = $recentProjects ?? [];
|
||||
$recentDocuments = $recentDocuments ?? [];
|
||||
|
||||
// Set default avatar if not provided
|
||||
if (empty($user['avatar'])) {
|
||||
$user['avatar'] = '/assets/images/users/avatar-1.jpg';
|
||||
}
|
||||
|
||||
// Set default profile background if not provided
|
||||
if (empty($user['profile_bg'])) {
|
||||
$user['profile_bg'] = '/assets/images/small/img-4.jpg';
|
||||
}
|
||||
|
||||
// Parse skills from JSON if needed
|
||||
if (isset($profile['skills']) && is_string($profile['skills'])) {
|
||||
$profile['skills'] = json_decode($profile['skills'], true) ?: [];
|
||||
}
|
||||
|
||||
// Parse social links from JSON if needed
|
||||
if (isset($profile['social_links']) && is_string($profile['social_links'])) {
|
||||
$profile['social_links'] = json_decode($profile['social_links'], true) ?: [];
|
||||
}
|
||||
|
||||
// Esta view já está sendo renderizada dentro do main.php pelo controlador
|
||||
// Não precisamos de chamar View::render('layouts/main.php') aqui
|
||||
?>
|
||||
<div class="profile-foreground position-relative mx-n4 mt-n4">
|
||||
<div class="profile-wid-bg">
|
||||
<img src="<?php echo \App\Core\View::asset($user['profile_bg']); ?>" alt="" class="profile-wid-img" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt-4 mb-4 mb-lg-3 pb-lg-4 profile-wrapper">
|
||||
<div class="row g-4">
|
||||
<div class="col-auto">
|
||||
<div class="avatar-lg">
|
||||
<img src="<?php echo \App\Core\View::asset($user['avatar']); ?>" alt="user-img" class="img-thumbnail rounded-circle" />
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col">
|
||||
<div class="p-2">
|
||||
<h3 class="text-white mb-1"><?php echo htmlspecialchars(($user['first_name'] ?? 'First') . ' ' . ($user['last_name'] ?? 'Last')); ?></h3>
|
||||
<p class="text-white text-opacity-75 mb-2 fs-14"><?php echo htmlspecialchars($user['job_title'] ?? 'User'); ?></p>
|
||||
<p class="text-white-50 mb-4"><?php echo htmlspecialchars(($user['city'] ?? 'Unknown') . ', ' . ($user['country'] ?? 'Unknown')); ?></p>
|
||||
<div class="hstack text-white-50 gap-1">
|
||||
<div class="me-2"><i class="ri-map-pin-user-line me-1 text-white text-opacity-75 fs-16 align-middle"></i><?php echo htmlspecialchars($user['city'] ?? 'Unknown'); ?></div>
|
||||
<div><i class="ri-building-line me-1 text-white text-opacity-75 fs-16 align-middle"></i>BitReport</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-12 col-lg-auto order-last order-lg-0">
|
||||
<div class="row text-white-50 text-center">
|
||||
<div class="col-lg-6 col-4">
|
||||
<div class="p-2">
|
||||
<h4 class="text-white mb-1"><?php echo htmlspecialchars($user['followers_count'] ?? '0'); ?></h4>
|
||||
<p class="fs-14 mb-0">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-4">
|
||||
<div class="p-2">
|
||||
<h4 class="text-white mb-1"><?php echo htmlspecialchars($user['following_count'] ?? '0'); ?></h4>
|
||||
<p class="fs-14 mb-0">Following</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div>
|
||||
<div class="d-flex profile-wrapper">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-pills animation-nav profile-nav gap-2 gap-lg-3 flex-grow-1" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-14 active" data-bs-toggle="tab" href="#overview-tab" role="tab">
|
||||
<i class="ri-airplay-fill d-inline-block d-md-none"></i>
|
||||
<span class="d-none d-md-inline-block">Overview</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-14" data-bs-toggle="tab" href="#activities" role="tab">
|
||||
<i class="ri-list-unordered d-inline-block d-md-none"></i>
|
||||
<span class="d-none d-md-inline-block">Activities</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-14" data-bs-toggle="tab" href="#projects" role="tab">
|
||||
<i class="ri-price-tag-line d-inline-block d-md-none"></i>
|
||||
<span class="d-none d-md-inline-block">Projects</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-14" data-bs-toggle="tab" href="#documents" role="tab">
|
||||
<i class="ri-folder-4-line d-inline-block d-md-none"></i>
|
||||
<span class="d-none d-md-inline-block">Documents</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="/apps/users/profile/edit" class="btn btn-success"><i class="ri-edit-box-line align-bottom"></i> Edit Profile</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content pt-4 text-muted">
|
||||
<div class="tab-pane active" id="overview-tab" role="tabpanel">
|
||||
<div class="row">
|
||||
<div class="col-xxl-3">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-5">Complete Your Profile</h5>
|
||||
<div class="progress animated-progress custom-progress progress-label">
|
||||
<?php $completion = $profile['profile_completion'] ?? 50; ?>
|
||||
<div class="progress-bar bg-danger" role="progressbar" style="width: <?php echo $completion; ?>%" aria-valuenow="<?php echo $completion; ?>" aria-valuemin="0" aria-valuemax="100">
|
||||
<div class="label"><?php echo $completion; ?>%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-3">Info</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless mb-0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="ps-0" scope="row">Full Name :</th>
|
||||
<td class="text-muted"><?php echo htmlspecialchars(($user['first_name'] ?? '') . ' ' . ($user['last_name'] ?? '')); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="ps-0" scope="row">Mobile :</th>
|
||||
<td class="text-muted"><?php echo htmlspecialchars($user['phone'] ?? 'Not provided'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="ps-0" scope="row">E-mail :</th>
|
||||
<td class="text-muted"><?php echo htmlspecialchars($user['email'] ?? 'Not provided'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="ps-0" scope="row">Location :</th>
|
||||
<td class="text-muted"><?php echo htmlspecialchars(($user['city'] ?? 'Unknown') . ', ' . ($user['country'] ?? 'Unknown')); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="ps-0" scope="row">Joining Date</th>
|
||||
<td class="text-muted"><?php echo htmlspecialchars($user['created_at'] ?? 'Unknown'); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- end card body -->
|
||||
</div><!-- end card -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-3">Skills</h5>
|
||||
<div class="d-flex flex-wrap gap-2 fs-15">
|
||||
<?php if (!empty($profile['skills']) && is_array($profile['skills'])): ?>
|
||||
<?php foreach ($profile['skills'] as $skill): ?>
|
||||
<a href="javascript:void(0);" class="badge bg-primary-subtle text-primary"><?php echo htmlspecialchars($skill); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<span class="text-muted">No skills added yet</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div><!-- end card body -->
|
||||
</div><!-- end card -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-3">Suggestions</h5>
|
||||
<div class="avatar-group">
|
||||
<div class="avatar-group-item">
|
||||
<div class="avatar-xs">
|
||||
<img src="<?php echo \App\Core\View::asset('/assets/images/users/avatar-4.jpg'); ?>" alt="" class="rounded-circle img-fluid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="avatar-group-item">
|
||||
<div class="avatar-xs">
|
||||
<img src="<?php echo \App\Core\View::asset('/assets/images/users/avatar-5.jpg'); ?>" alt="" class="rounded-circle img-fluid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="avatar-group-item">
|
||||
<div class="avatar-xs">
|
||||
<div class="avatar-title rounded-circle bg-light text-primary">
|
||||
A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="avatar-group-item">
|
||||
<div class="avatar-xs">
|
||||
<img src="<?php echo \App\Core\View::asset('/assets/images/users/avatar-2.jpg'); ?>" alt="" class="rounded-circle img-fluid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="avatar-group-item">
|
||||
<div class="avatar-xs">
|
||||
<div class="avatar-title rounded-circle bg-primary">
|
||||
2+
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end card body -->
|
||||
</div>
|
||||
<!--end card-->
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-xxl-9">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-3">About</h5>
|
||||
<p><?php echo htmlspecialchars($profile['bio'] ?? 'No bio available'); ?></p>
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-4">
|
||||
<div class="d-flex mt-4">
|
||||
<div class="flex-shrink-0 avatar-xs align-self-center me-3">
|
||||
<div class="avatar-title bg-light rounded-circle fs-16 text-primary">
|
||||
<i class="rf-user-6"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-grow-1 overflow-hidden">
|
||||
<p class="mb-1">Designation :</p>
|
||||
<h6 class="text-truncate mb-0"><?php echo htmlspecialchars($user['job_title'] ?? 'User'); ?></h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-6 col-md-4">
|
||||
<div class="d-flex mt-4">
|
||||
<div class="flex-shrink-0 avatar-xs align-self-center me-3">
|
||||
<div class="avatar-title bg-light rounded-circle fs-16 text-primary">
|
||||
<i class="ri-global-line"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-grow-1 overflow-hidden">
|
||||
<p class="mb-1">Website :</p>
|
||||
<?php if (!empty($user['website'])): ?>
|
||||
<a href="<?php echo htmlspecialchars($user['website']); ?>" target="_blank" class="fw-semibold"><?php echo htmlspecialchars($user['website']); ?></a>
|
||||
<?php else: ?>
|
||||
<span class="text-muted">Not provided</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div><!-- end card body -->
|
||||
</div><!-- end card -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h4 class="card-title mb-0 me-2">Recent Activity</h4>
|
||||
<div class="flex-shrink-0 ms-auto">
|
||||
<ul class="nav justify-content-end nav-tabs-custom rounded card-header-tabs border-bottom-0" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-bs-toggle="tab" href="#today" role="tab">
|
||||
Today
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="tab" href="#weekly" role="tab">
|
||||
Weekly
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="tab" href="#monthly" role="tab">
|
||||
Monthly
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="tab-content text-muted">
|
||||
<div class="tab-pane active" id="today" role="tabpanel">
|
||||
<div class="profile-timeline">
|
||||
<?php if (empty($recentActivities)): ?>
|
||||
<div class="text-center p-4">
|
||||
<h6 class="text-muted">No recent activities</h6>
|
||||
<p class="text-muted mb-0">Your recent activities will appear here</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="accordion accordion-flush" id="todayExample">
|
||||
<?php foreach ($recentActivities as $index => $activity): ?>
|
||||
<div class="accordion-item border-0">
|
||||
<div class="accordion-header" id="heading<?php echo $index; ?>">
|
||||
<a class="accordion-button p-2 shadow-none" data-bs-toggle="collapse" href="#collapse<?php echo $index; ?>" aria-expanded="<?php echo $index === 0 ? 'true' : 'false'; ?>">
|
||||
<div class="d-flex">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo \App\Core\View::asset($activity['avatar'] ?: '/assets/images/users/avatar-1.jpg'); ?>" alt="" class="avatar-xs rounded-circle" />
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h6 class="fs-14 mb-1">
|
||||
<?php echo htmlspecialchars(($activity['first_name'] ?? '') . ' ' . ($activity['last_name'] ?? '')); ?>
|
||||
</h6>
|
||||
<small class="text-muted"><?php echo htmlspecialchars($activity['description'] ?? 'Activity'); ?> - <?php echo date('H:i', strtotime($activity['created_at'])); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div id="collapse<?php echo $index; ?>" class="accordion-collapse collapse <?php echo $index === 0 ? 'show' : ''; ?>" data-bs-parent="#todayExample">
|
||||
<div class="accordion-body ms-2 ps-5">
|
||||
<?php echo htmlspecialchars($activity['description'] ?? 'No additional details available.'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!--end accordion-->
|
||||
</div>
|
||||
</div>
|
||||
<!--end tab-pane-->
|
||||
</div>
|
||||
<!--end tab-content-->
|
||||
</div>
|
||||
</div>
|
||||
<!--end card-->
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
<div class="tab-pane fade" id="activities" role="tabpanel">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-3">Activities</h5>
|
||||
<?php if (empty($recentActivities)): ?>
|
||||
<div class="text-center p-4">
|
||||
<h6 class="text-muted">No activities yet</h6>
|
||||
<p class="text-muted mb-0">Your activities will appear here as you use the system</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="acitivity-timeline">
|
||||
<?php foreach ($recentActivities as $activity): ?>
|
||||
<div class="acitivity-item d-flex">
|
||||
<div class="flex-shrink-0">
|
||||
<img src="<?php echo \App\Core\View::asset($activity['avatar'] ?: '/assets/images/users/avatar-1.jpg'); ?>" alt="" class="avatar-xs rounded-circle acitivity-avatar" />
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h6 class="mb-1">
|
||||
<?php echo htmlspecialchars(($activity['first_name'] ?? '') . ' ' . ($activity['last_name'] ?? '')); ?>
|
||||
<span class="badge bg-primary-subtle text-primary align-middle"><?php echo htmlspecialchars($activity['activity_type'] ?? 'Activity'); ?></span>
|
||||
</h6>
|
||||
<p class="text-muted mb-2"><?php echo htmlspecialchars($activity['description'] ?? 'No description available'); ?></p>
|
||||
<small class="mb-0 text-muted"><?php echo date('M j, Y H:i', strtotime($activity['created_at'])); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<!--end card-body-->
|
||||
</div>
|
||||
<!--end card-->
|
||||
</div>
|
||||
<!--end tab-pane-->
|
||||
<div class="tab-pane fade" id="projects" role="tabpanel">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if (empty($recentProjects)): ?>
|
||||
<div class="text-center p-4">
|
||||
<h6 class="text-muted">No projects yet</h6>
|
||||
<p class="text-muted mb-0">Your projects will appear here when you create them</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<?php foreach ($recentProjects as $project): ?>
|
||||
<div class="col-xxl-3 col-sm-6">
|
||||
<div class="card profile-project-card shadow-none profile-project-warning">
|
||||
<div class="card-body p-4">
|
||||
<div class="d-flex">
|
||||
<div class="flex-grow-1 text-muted overflow-hidden">
|
||||
<h5 class="fs-14 text-truncate"><a href="#" class="text-body"><?php echo htmlspecialchars($project['name'] ?? 'Unnamed Project'); ?></a></h5>
|
||||
<p class="text-muted text-truncate mb-0">Last Update : <span class="fw-semibold text-body"><?php echo date('M j, Y', strtotime($project['updated_at'] ?? $project['created_at'])); ?></span></p>
|
||||
</div>
|
||||
<div class="flex-shrink-0 ms-2">
|
||||
<?php
|
||||
$statusClass = 'bg-secondary-subtle text-secondary';
|
||||
$statusText = 'Unknown';
|
||||
switch ($project['status'] ?? '') {
|
||||
case 'active':
|
||||
case 'in_progress':
|
||||
$statusClass = 'bg-warning-subtle text-warning';
|
||||
$statusText = 'In Progress';
|
||||
break;
|
||||
case 'completed':
|
||||
$statusClass = 'bg-success-subtle text-success';
|
||||
$statusText = 'Completed';
|
||||
break;
|
||||
case 'pending':
|
||||
$statusClass = 'bg-info-subtle text-info';
|
||||
$statusText = 'Pending';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<div class="badge <?php echo $statusClass; ?> fs-10"><?php echo $statusText; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex mt-4">
|
||||
<div class="flex-grow-1">
|
||||
<p class="text-muted mb-0"><?php echo htmlspecialchars($project['description'] ?? 'No description available'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
</div>
|
||||
<!--end col-->
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<!--end row-->
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<!--end card-body-->
|
||||
</div>
|
||||
<!--end card-->
|
||||
</div>
|
||||
<!--end tab-pane-->
|
||||
<div class="tab-pane fade" id="documents" role="tabpanel">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center mb-4">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Documents</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<input class="form-control d-none" type="file" id="formFile">
|
||||
<label for="formFile" class="btn btn-danger"><i class="ri-upload-2-fill me-1 align-bottom"></i> Upload File</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (empty($recentDocuments)): ?>
|
||||
<div class="text-center p-4">
|
||||
<h6 class="text-muted">No documents yet</h6>
|
||||
<p class="text-muted mb-0">Your uploaded documents will appear here</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th scope="col">File Name</th>
|
||||
<th scope="col">Type</th>
|
||||
<th scope="col">Size</th>
|
||||
<th scope="col">Upload Date</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($recentDocuments as $document): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="avatar-sm">
|
||||
<?php
|
||||
$fileIcon = 'ri-file-line';
|
||||
$fileClass = 'bg-primary-subtle text-primary';
|
||||
$fileType = $document['file_type'] ?? '';
|
||||
if (strpos($fileType, 'pdf') !== false) {
|
||||
$fileIcon = 'ri-file-pdf-fill';
|
||||
$fileClass = 'bg-danger-subtle text-danger';
|
||||
} elseif (strpos($fileType, 'image') !== false) {
|
||||
$fileIcon = 'ri-image-fill';
|
||||
$fileClass = 'bg-success-subtle text-success';
|
||||
} elseif (strpos($fileType, 'zip') !== false || strpos($fileType, 'rar') !== false) {
|
||||
$fileIcon = 'ri-file-zip-fill';
|
||||
$fileClass = 'bg-warning-subtle text-warning';
|
||||
} elseif (strpos($fileType, 'word') !== false || strpos($fileType, 'document') !== false) {
|
||||
$fileIcon = 'ri-file-word-fill';
|
||||
$fileClass = 'bg-info-subtle text-info';
|
||||
}
|
||||
?>
|
||||
<div class="avatar-title <?php echo $fileClass; ?> rounded fs-20">
|
||||
<i class="<?php echo $fileIcon; ?>"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-3 flex-grow-1">
|
||||
<h6 class="fs-15 mb-0"><a href="javascript:void(0)"><?php echo htmlspecialchars($document['filename'] ?? 'Unknown file'); ?></a></h6>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($fileType ?: 'Unknown'); ?></td>
|
||||
<td><?php echo htmlspecialchars($document['file_size'] ?? 'Unknown'); ?></td>
|
||||
<td><?php echo date('M j, Y', strtotime($document['uploaded_at'] ?? 'now')); ?></td>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<a href="javascript:void(0);" class="btn btn-light btn-icon" id="dropdownMenuLink<?php echo $document['id'] ?? rand(); ?>" data-bs-toggle="dropdown" aria-expanded="true">
|
||||
<i class="ri-equalizer-fill"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuLink<?php echo $document['id'] ?? rand(); ?>">
|
||||
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-eye-fill me-2 align-middle text-muted"></i>View</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-download-2-fill me-2 align-middle text-muted"></i>Download</a></li>
|
||||
<li class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-5-line me-2 align-middle text-muted"></i>Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="text-center mt-3">
|
||||
<a href="javascript:void(0);" class="text-success"><i class="mdi mdi-loading mdi-spin me-2 text-success"></i> Load more </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<!--end card-body-->
|
||||
</div>
|
||||
<!--end card-->
|
||||
</div>
|
||||
<!--end tab-pane-->
|
||||
</div>
|
||||
<!--end tab-content-->
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
$page_title = 'Pages profile settings';
|
||||
$page_description = 'Página Pages profile settings';
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
View::include('components/profile-settings/header.php');
|
||||
View::include('components/profile-settings/sidebar.php');
|
||||
View::include('components/profile-settings/content.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<script src="<?php echo View::asset('/assets/js/pages/profile-settings.init.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,325 @@
|
||||
<div x-data="publicCampaignAnalytics('<?php echo $slug ?>')">
|
||||
<!-- Header -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title mb-0">
|
||||
<i class="ri-bar-chart-line me-2"></i>
|
||||
Campaign Performance: <span x-text="slug"></span>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<i class="ri-space-ship-line display-6 text-muted"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h5 class="text-muted text-uppercase fs-13">Campaign Status</h5>
|
||||
<span x-text="scriptInfo.scriptStatusDisplay"
|
||||
:class="scriptInfo.scriptStatusClass"
|
||||
class="badge"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<i class="ri-calendar-line display-6 text-muted"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h5 class="text-muted text-uppercase fs-13">First Hit</h5>
|
||||
<h6 class="mb-0" x-text="scriptInfo.firstHit"></h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- KPIs -->
|
||||
<div class="row">
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<p class="text-truncate font-size-14 mb-2">Total Impressions</p>
|
||||
<h4 class="mb-0" x-text="formatNumber(kpis.impressions.value)">0</h4>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<div class="avatar-sm rounded-circle bg-primary-subtle">
|
||||
<span class="avatar-title rounded-circle bg-primary">
|
||||
<i class="ri-eye-line font-size-20"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<p class="text-truncate font-size-14 mb-2">Total Clicks</p>
|
||||
<h4 class="mb-0" x-text="formatNumber(kpis.clicks.value)">0</h4>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<div class="avatar-sm rounded-circle bg-success-subtle">
|
||||
<span class="avatar-title rounded-circle bg-success">
|
||||
<i class="ri-mouse-line font-size-20"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<p class="text-truncate font-size-14 mb-2">CTR</p>
|
||||
<h4 class="mb-0" x-text="formatPercentage(kpis.ctr.value)">0%</h4>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<div class="avatar-sm rounded-circle bg-info-subtle">
|
||||
<span class="avatar-title rounded-circle bg-info">
|
||||
<i class="ri-percent-line font-size-20"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Charts -->
|
||||
<div class="row">
|
||||
<div class="col-xl-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title mb-0">Impressions & Clicks Over Time</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="impressions-clicks-chart" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title mb-0">Top Countries</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="countries-chart" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Devices Chart -->
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title mb-0">Device Distribution</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="devices-chart" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title mb-0">Revenue</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="text-center">
|
||||
<h2 class="text-primary" x-text="formatCurrency(scriptInfo.estimatedRevenue)">€0.00</h2>
|
||||
<p class="text-muted">Estimated Revenue</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Daily Stats Table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title mb-0">Daily Statistics</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Country</th>
|
||||
<th>Impressions</th>
|
||||
<th>Clicks</th>
|
||||
<th>CTR</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template x-for="row in tables.dailyStats" :key="row[0]">
|
||||
<tr>
|
||||
<td x-text="row[0]"></td>
|
||||
<td x-text="row[1]"></td>
|
||||
<td x-text="row[2]"></td>
|
||||
<td x-text="row[3]"></td>
|
||||
<td x-text="row[4]"></td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Loading State -->
|
||||
<div x-show="loading" class="text-center py-5">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<p class="mt-2">Loading campaign data...</p>
|
||||
</div>
|
||||
|
||||
<!-- Error State -->
|
||||
<div x-show="error" class="alert alert-danger" role="alert">
|
||||
<h4 class="alert-heading">Error!</h4>
|
||||
<p x-text="errorMessage">An error occurred while loading the campaign data.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('alpine:init', () => {
|
||||
Alpine.data('publicCampaignAnalytics', (slug) => ({
|
||||
slug: slug,
|
||||
loading: true,
|
||||
error: false,
|
||||
errorMessage: '',
|
||||
scriptInfo: {},
|
||||
kpis: {},
|
||||
charts: {},
|
||||
tables: {},
|
||||
|
||||
init() {
|
||||
console.log(`Initializing public campaign analytics for ${this.slug}`);
|
||||
this.loadCampaignData();
|
||||
},
|
||||
|
||||
async loadCampaignData() {
|
||||
try {
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
|
||||
const response = await fetch(`/api/campaigns/${this.slug}`);
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
this.scriptInfo = data.data.scriptInfo;
|
||||
this.kpis = data.data.kpis;
|
||||
this.charts = data.data.charts;
|
||||
this.tables = data.data.tables;
|
||||
|
||||
// Initialize charts after data is loaded
|
||||
this.$nextTick(() => {
|
||||
this.initCharts();
|
||||
});
|
||||
} else {
|
||||
this.error = true;
|
||||
this.errorMessage = data.message || 'Error loading campaign data';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading campaign data:', error);
|
||||
this.error = true;
|
||||
this.errorMessage = 'Network error occurred';
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
initCharts() {
|
||||
// Impressions & Clicks Chart
|
||||
if (this.charts.impressionsAndClicks) {
|
||||
const options = {
|
||||
series: this.charts.impressionsAndClicks.series,
|
||||
chart: {
|
||||
type: 'line',
|
||||
height: 300
|
||||
},
|
||||
xaxis: {
|
||||
categories: this.charts.impressionsAndClicks.categories
|
||||
},
|
||||
colors: ['#556ee6', '#34c38f']
|
||||
};
|
||||
new ApexCharts(document.querySelector("#impressions-clicks-chart"), options).render();
|
||||
}
|
||||
|
||||
// Countries Chart
|
||||
if (this.charts.geos) {
|
||||
const options = {
|
||||
series: this.charts.geos.series,
|
||||
chart: {
|
||||
type: 'pie',
|
||||
height: 300
|
||||
},
|
||||
labels: this.charts.geos.labels,
|
||||
colors: ['#556ee6', '#34c38f', '#f1b44c', '#f46a6a', '#50a5f1']
|
||||
};
|
||||
new ApexCharts(document.querySelector("#countries-chart"), options).render();
|
||||
}
|
||||
|
||||
// Devices Chart
|
||||
if (this.charts.devices) {
|
||||
const options = {
|
||||
series: this.charts.devices.series,
|
||||
chart: {
|
||||
type: 'donut',
|
||||
height: 300
|
||||
},
|
||||
labels: this.charts.devices.labels,
|
||||
colors: ['#556ee6', '#34c38f', '#f1b44c']
|
||||
};
|
||||
new ApexCharts(document.querySelector("#devices-chart"), options).render();
|
||||
}
|
||||
},
|
||||
|
||||
formatNumber(num) {
|
||||
if (num === null || num === undefined) return '0';
|
||||
return new Intl.NumberFormat('pt-PT').format(num);
|
||||
},
|
||||
|
||||
formatCurrency(amount) {
|
||||
if (amount === null || amount === undefined) return '€0,00';
|
||||
return new Intl.NumberFormat('pt-PT', {
|
||||
style: 'currency',
|
||||
currency: 'EUR'
|
||||
}).format(amount);
|
||||
},
|
||||
|
||||
formatPercentage(value) {
|
||||
if (value === null || value === undefined) return '0%';
|
||||
return new Intl.NumberFormat('pt-PT', {
|
||||
style: 'percent',
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
}).format(value / 100);
|
||||
}
|
||||
}));
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
$page_title = "Pages search results";
|
||||
$page_description = "Página Pages search results";
|
||||
|
||||
View::render("layouts/main.php", [
|
||||
"title" => $page_title,
|
||||
"description" => $page_description,
|
||||
"page_content" => function() {
|
||||
View::include("components/search-results/header.php");
|
||||
View::include("components/search-results/tabs.php");
|
||||
View::include("components/search-results/content.php");
|
||||
},
|
||||
"scripts" => function() {
|
||||
?>
|
||||
<script src="<?php echo View::asset("/assets/js/pages/search-results.init.js"); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
$page_title = 'Pages sitemap';
|
||||
$page_description = 'Página Pages sitemap';
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
View::include('components/sitemap/responsive.php');
|
||||
View::include('components/sitemap/horizontal.php');
|
||||
View::include('components/sitemap/vertical.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<script src="<?php echo View::asset('/assets/js/pages/sitemap.init.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Refatorado para usar o sistema de layout corretamente
|
||||
View::render('layouts/main.php', [
|
||||
'page_title' => 'Starter',
|
||||
'page_content' => function() {
|
||||
?>
|
||||
|
||||
<?php ?>
|
||||
|
||||
<!-- Conteúdo específico da página viria aqui, mas a starter page é vazia por definição -->
|
||||
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
$page_title = 'Pages team';
|
||||
$page_description = 'Página Pages team';
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
View::include('components/team/header.php');
|
||||
View::include('components/team/member-list.php');
|
||||
View::include('components/team/add-member-modal.php');
|
||||
View::include('components/team/member-overview.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<script src="<?php echo View::asset('/assets/js/pages/team.init.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
// Definir variáveis para o layout
|
||||
$page_title = 'Pages term conditions';
|
||||
$page_description = 'Página Pages term conditions';
|
||||
|
||||
// Incluir o layout principal
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
?>
|
||||
<?php
|
||||
View::include('layouts/main.php'); ?>
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<?php View::include('layouts/menu.php'); ?>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start right Content here -->
|
||||
<!-- ============================================================== -->
|
||||
|
||||
<?php ?>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-10">
|
||||
<div class="card">
|
||||
<div class="bg-warning-subtle position-relative">
|
||||
<div class="card-body p-5">
|
||||
<div class="text-center">
|
||||
<h3>Term & Conditions</h3>
|
||||
<p class="mb-0 text-muted">Last update: 16 Sept, 2022</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shape">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="1440" height="60" preserveAspectRatio="none" viewBox="0 0 1440 60">
|
||||
<g mask="url("#SvgjsMask1001")" fill="none">
|
||||
<path d="M 0,4 C 144,13 432,48 720,49 C 1008,50 1296,17 1440,9L1440 60L0 60z" style="fill: var(--vz-secondary-bg);"></path>
|
||||
</g>
|
||||
<defs>
|
||||
<mask id="SvgjsMask1001">
|
||||
<rect width="1440" height="60" fill="#ffffff"></rect>
|
||||
</mask>
|
||||
</defs>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<div>
|
||||
<h5>Welcome to <?php echo \App\Core\AppConfig::getCompanyName(); ?>!</h5>
|
||||
<p class="text-muted">These terms and conditions outline the rules and regulations for the use of Company Name's Website, located at Website.com.</p>
|
||||
<p class="text-muted">By accessing this website we assume you accept these terms and conditions. Do not continue to use Website Name if you do not agree to take all of the terms and conditions stated on this page.</p>
|
||||
<p class="text-muted">Most interactive websites use cookies to let us retrieve the user's details for each visit. Cookies are used by our website to enable the functionality of certain areas to make it easier for people visiting our website. Some of our affiliate/advertising partners may also use cookies.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h5>License</h5>
|
||||
<p class="text-muted">Unless otherwise stated, Company Name and/or its licensors own the intellectual property rights for all material on Website Name. All intellectual property rights are reserved. You may access this from Website Name for your own personal use subjected to restrictions set in these terms and conditions.</p>
|
||||
<p class="text-muted">You must not:</p>
|
||||
<ul class="text-muted vstack gap-2">
|
||||
<li>
|
||||
Republish material from Website Name
|
||||
</li>
|
||||
<li>
|
||||
Sell, rent or sub-license material from Website Name
|
||||
</li>
|
||||
<li>
|
||||
Reproduce, duplicate or copy material from Website Name
|
||||
</li>
|
||||
<li>
|
||||
Redistribute content from Website Name
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted">This Agreement shall begin on the date hereof.</p>
|
||||
<p class="text-muted">Parts of this website offer an opportunity for users to post and exchange opinions and information in certain areas of the website. Company Name does not filter, edit, publish or review Comments prior to their presence on the website. Comments do not reflect the views and opinions of Company Name,its agents and/or affiliates.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p class="text-muted">Company Name reserves the right to monitor all Comments and to remove any Comments which can be considered inappropriate, offensive or causes breach of these Terms and Conditions.</p>
|
||||
<p class="text-muted">You warrant and represent that:</p>
|
||||
<ul class="text-muted vstack gap-2">
|
||||
<li>
|
||||
You are entitled to post the Comments on our website and have all necessary licenses and consents to do so;
|
||||
</li>
|
||||
<li>
|
||||
The Comments do not invade any intellectual property right, including without limitation copyright, patent or trademark of any third party;
|
||||
</li>
|
||||
<li>
|
||||
The Comments do not contain any defamatory, libelous, offensive, indecent or otherwise unlawful material which is an invasion of privacy
|
||||
</li>
|
||||
<li>
|
||||
The Comments will not be used to solicit or promote business or custom or present commercial activities or unlawful activity.
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted">You hereby grant Company Name a non-exclusive license to use, reproduce, edit and authorize others to use, reproduce and edit any of your Comments in any and all forms, formats or media.</p>
|
||||
<p class="text-muted">Approved organizations may hyperlink to our Website as follows:</p>
|
||||
<ul class="text-muted vstack gap-2">
|
||||
<li>
|
||||
By use of our corporate name; or
|
||||
</li>
|
||||
<li>
|
||||
By use of the uniform resource locator being linked to; or
|
||||
</li>
|
||||
<li>
|
||||
By use of any other description of our Website being linked to that makes sense within the context and format of content on the linking party's site.
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted fw-semibold">No use of Company Name's logo or other artwork will be allowed for linking absent a trademark license agreement.</p>
|
||||
</div>
|
||||
|
||||
<div class="text-end">
|
||||
<a href="#!" class="btn btn-success">Accept</a>
|
||||
<a href="#!" class="btn btn-outline-danger"><i class="ri-close-line align-bottom me-1"></i> Decline</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--end col-->
|
||||
</div><!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
<!-- End Page-content -->
|
||||
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
<script src="<?php echo View::asset('/assets/js/app.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
use App\Core\View;
|
||||
|
||||
$page_title = 'Pages timeline';
|
||||
$page_description = 'Página Pages timeline';
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => $page_title,
|
||||
'description' => $page_description,
|
||||
'page_content' => function() {
|
||||
View::include('components/timeline/center-timeline.php');
|
||||
View::include('components/timeline/left-timeline.php');
|
||||
View::include('components/timeline/right-timeline.php');
|
||||
},
|
||||
'scripts' => function() {
|
||||
?>
|
||||
<script src="<?php echo View::asset('/assets/js/pages/timeline.init.js'); ?>"></script>
|
||||
<?php
|
||||
}
|
||||
]);
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
use App\Core\MenuManager;
|
||||
|
||||
// Menu principal do Pages (apenas desenvolvimento)
|
||||
MenuManager::registerMenu('Pages', [
|
||||
'id' => 95,
|
||||
'label' => 'Páginas',
|
||||
'icon' => 'ri-pages-line',
|
||||
'url' => '/apps/pages/starter',
|
||||
'order' => 95,
|
||||
'parent_id' => null,
|
||||
'dev' => 1,
|
||||
]);
|
||||
|
||||
// Submenus do Pages
|
||||
MenuManager::registerMenus('Pages', [
|
||||
[
|
||||
'id' => 951,
|
||||
'label' => 'Página Inicial',
|
||||
'icon' => 'ri-home-line',
|
||||
'url' => '/apps/pages/starter',
|
||||
'order' => 1,
|
||||
'parent_id' => 95,
|
||||
'dev' => 1,
|
||||
],
|
||||
[
|
||||
'id' => 952,
|
||||
'label' => 'Perfil',
|
||||
'icon' => 'ri-user-line',
|
||||
'url' => '/apps/pages/profile',
|
||||
'order' => 2,
|
||||
'parent_id' => 95,
|
||||
'dev' => 1,
|
||||
],
|
||||
]);
|
||||
@@ -148,11 +148,12 @@ class PublicRedirectsController extends BaseController
|
||||
// Get stats by country
|
||||
$sql = "SELECT
|
||||
country_code,
|
||||
COALESCE(NULLIF(country_name, ''), country_code) AS country_name,
|
||||
COUNT(*) as clicks,
|
||||
COUNT(DISTINCT session_id) as unique_clicks
|
||||
FROM redirect_stats
|
||||
WHERE country_code IS NOT NULL AND country_code != ''
|
||||
GROUP BY country_code
|
||||
GROUP BY country_code, country_name
|
||||
ORDER BY clicks DESC
|
||||
LIMIT 10";
|
||||
$countryStats = $this->statsModel->getDb()->fetchAll($sql) ?: [];
|
||||
@@ -282,11 +283,12 @@ class PublicRedirectsController extends BaseController
|
||||
$countryWhereClause = "WHERE " . implode(" AND ", $countryWhereConditions);
|
||||
$sql = "SELECT
|
||||
country_code,
|
||||
COALESCE(NULLIF(country_name, ''), country_code) AS country_name,
|
||||
COUNT(*) as clicks,
|
||||
COUNT(DISTINCT session_id) as unique_clicks
|
||||
FROM redirect_stats
|
||||
$countryWhereClause
|
||||
GROUP BY country_code
|
||||
GROUP BY country_code, country_name
|
||||
ORDER BY clicks DESC
|
||||
LIMIT 10";
|
||||
$countryStats = $this->statsModel->getDb()->fetchAll($sql, $params) ?: [];
|
||||
|
||||
@@ -76,6 +76,40 @@ class RedirectsApiController extends BaseController
|
||||
public function index(): void
|
||||
{
|
||||
try {
|
||||
// Bearer token auth for server-to-server
|
||||
$authHeader = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
|
||||
$token = null;
|
||||
if (stripos($authHeader, 'Bearer ') === 0) {
|
||||
$token = trim(substr($authHeader, 7));
|
||||
}
|
||||
|
||||
// Load expected key from env or fallback by parsing .env
|
||||
$expectedKey = $_ENV['REDIRECTS_API_KEY'] ?? getenv('REDIRECTS_API_KEY') ?? '';
|
||||
if (!$expectedKey) {
|
||||
$candidates = [
|
||||
realpath(__DIR__ . '/../../../../.env') ?: '',
|
||||
realpath(__DIR__ . '/../../../.env') ?: '',
|
||||
'/data/wwwroot/redirect.moneyflix.com/.env'
|
||||
];
|
||||
foreach ($candidates as $envPath) {
|
||||
if ($envPath && is_file($envPath)) {
|
||||
$lines = @file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [];
|
||||
foreach ($lines as $line) {
|
||||
if (strpos($line, 'REDIRECTS_API_KEY=') === 0) {
|
||||
$expectedKey = trim(substr($line, strlen('REDIRECTS_API_KEY=')));
|
||||
$expectedKey = trim($expectedKey, "\"' ");
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$expectedKey || !$token || !hash_equals($expectedKey, $token)) {
|
||||
$this->errorResponse('Unauthorized', 401);
|
||||
return;
|
||||
}
|
||||
|
||||
$filters = [
|
||||
'status' => $_GET['status'] ?? '',
|
||||
'search' => $_GET['search'] ?? ''
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Modules\Redirects\Models\RedirectModel;
|
||||
use App\Modules\Redirects\Models\RedirectFilterModel;
|
||||
use App\Modules\Redirects\Models\RedirectStatsModel;
|
||||
use App\Modules\Redirects\Services\RedirectProcessor;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
class RedirectsController extends BaseController
|
||||
{
|
||||
@@ -148,7 +149,7 @@ class RedirectsController extends BaseController
|
||||
|
||||
$filters = $this->filterModel->getByRedirectId($id);
|
||||
$stats = $this->statsModel->getStatsByRedirect($id);
|
||||
$recentActivity = $this->statsModel->getRecentActivity($id);
|
||||
$recentActivity = $this->statsModel->getRecentActivity($id, 10);
|
||||
|
||||
View::render('layouts/main.php', [
|
||||
'title' => 'View Redirect',
|
||||
@@ -269,6 +270,18 @@ class RedirectsController extends BaseController
|
||||
{
|
||||
try {
|
||||
header('Content-Type: application/json');
|
||||
// Simple API key validation for server-to-server calls
|
||||
$authHeader = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
|
||||
$token = null;
|
||||
if (stripos($authHeader, 'Bearer ') === 0) {
|
||||
$token = trim(substr($authHeader, 7));
|
||||
}
|
||||
$expectedKey = $_ENV['REDIRECTS_API_KEY'] ?? getenv('REDIRECTS_API_KEY');
|
||||
if (!$expectedKey || !$token || !hash_equals($expectedKey, $token)) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['success' => false, 'message' => 'Unauthorized']);
|
||||
return;
|
||||
}
|
||||
|
||||
$db = DatabaseManager::getInstance();
|
||||
// Query explícita, sem SELECT * e sem dummy data
|
||||
@@ -451,7 +464,7 @@ class RedirectsController extends BaseController
|
||||
{
|
||||
$data = [
|
||||
'redirect_id' => $redirectId,
|
||||
'session_id' => session_id() ?: (string) new \Visus\Cuid2\Cuid2(),
|
||||
'session_id' => session_id() ?: (string) new Cuid2(),
|
||||
'ip_address' => $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0',
|
||||
'ip_long' => ip2long($_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'),
|
||||
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? null,
|
||||
@@ -498,10 +511,13 @@ class RedirectsController extends BaseController
|
||||
ORDER BY name
|
||||
");
|
||||
|
||||
// Get available countries
|
||||
// Get available countries (fallback to code when name is null/empty)
|
||||
$countries = $db->fetchAll("
|
||||
SELECT DISTINCT country_code, country_name
|
||||
SELECT DISTINCT
|
||||
country_code,
|
||||
COALESCE(NULLIF(country_name, ''), country_code) AS country_name
|
||||
FROM redirect_stats
|
||||
WHERE country_code IS NOT NULL AND country_code != ''
|
||||
ORDER BY country_name
|
||||
");
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ class RedirectStatsModel
|
||||
country_code, country_name, city, region_code, region_name, timezone,
|
||||
asn, isp, browser, browser_version, os, os_version, device_type,
|
||||
language, hour_of_day, day_of_week, month, year,
|
||||
response_time_ms, target_url_used, filter_matched
|
||||
response_time_ms, target_url_used, filter_matched, raw_request
|
||||
) VALUES (
|
||||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
)";
|
||||
|
||||
$params = [
|
||||
@@ -51,7 +51,8 @@ class RedirectStatsModel
|
||||
$data['year'],
|
||||
$data['response_time_ms'] ?? null,
|
||||
$data['target_url_used'] ?? null,
|
||||
$data['filter_matched'] ?? null
|
||||
$data['filter_matched'] ?? null,
|
||||
$data['raw_request'] ?? null
|
||||
];
|
||||
|
||||
return $this->db->query($sql, $params) > 0;
|
||||
@@ -188,15 +189,18 @@ class RedirectStatsModel
|
||||
|
||||
public function getRecentActivity(int $redirectId, int $limit = 10): array
|
||||
{
|
||||
// Sanitize limit to prevent SQL injection
|
||||
$limit = max(1, min(1000, (int)$limit));
|
||||
|
||||
$sql = "SELECT
|
||||
ip_address, user_agent, browser, os, device_type,
|
||||
country_code, city, timestamp, target_url_used
|
||||
FROM redirect_stats
|
||||
WHERE redirect_id = ?
|
||||
ORDER BY timestamp DESC
|
||||
LIMIT ?";
|
||||
LIMIT " . $limit;
|
||||
|
||||
return $this->db->fetchAll($sql, [$redirectId, $limit]) ?: [];
|
||||
return $this->db->fetchAll($sql, [$redirectId]) ?: [];
|
||||
}
|
||||
|
||||
public function getDb(): DatabaseManager
|
||||
|
||||
@@ -69,6 +69,10 @@ class Module
|
||||
|
||||
public static function registerMenu(): void
|
||||
{
|
||||
// Compatibilidade: não faz nada, menu já registado via menu.php
|
||||
// Carregar ficheiro de menu do módulo
|
||||
$menuFile = __DIR__ . '/menu.php';
|
||||
if (file_exists($menuFile)) {
|
||||
require $menuFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ $router->get('/api/redirects/settings', [RedirectsApiController::class, 'getSett
|
||||
$router->post('/api/redirects/settings', [RedirectsApiController::class, 'updateSettings']);
|
||||
|
||||
// CRUD endpoints
|
||||
$router->get('/api/redirects', [RedirectsApiController::class, 'index']);
|
||||
$router->get('/api/redirects', [RedirectsApiController::class, 'index'], [\App\Core\AuthMiddleware::class, 'apiOrAuth']);
|
||||
$router->post('/api/redirects', [RedirectsApiController::class, 'create']);
|
||||
$router->get('/api/redirects/{id}', [RedirectsApiController::class, 'show']);
|
||||
$router->put('/api/redirects/{id}', [RedirectsApiController::class, 'update']);
|
||||
|
||||
@@ -67,7 +67,8 @@ class RedirectCreativeService
|
||||
// Find the creative associated with this redirect
|
||||
$creative = $this->getCreativeByRedirectId($redirectId);
|
||||
if (!$creative) {
|
||||
return false;
|
||||
// If no creative exists, create one
|
||||
return $this->createCreativeFromRedirect($redirectData);
|
||||
}
|
||||
|
||||
$sql = "UPDATE advertising_creatives SET
|
||||
@@ -129,12 +130,18 @@ class RedirectCreativeService
|
||||
*/
|
||||
public function getCreativeByRedirectId(int $redirectId): ?array
|
||||
{
|
||||
// First, get the redirect to find its target_url
|
||||
$redirect = $this->db->fetch("SELECT target_url FROM redirects WHERE id = ?", [$redirectId]);
|
||||
if (!$redirect) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find creative by view_url (which should match target_url)
|
||||
$sql = "SELECT * FROM advertising_creatives
|
||||
WHERE creative_type = 'redirect'
|
||||
AND description LIKE ?";
|
||||
AND view_url = ?";
|
||||
|
||||
$searchTerm = '%Redirect from ' . $redirectId . '%';
|
||||
return $this->db->fetch($sql, [$searchTerm]) ?: null;
|
||||
return $this->db->fetch($sql, [$redirect['target_url']]) ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form id="redirectForm" class="needs-validation" x-data="redirectCreate()" x-init="init()" novalidate>
|
||||
<form id="redirectForm" class="needs-validation" novalidate>
|
||||
<div class="row">
|
||||
<!-- Basic Information -->
|
||||
<div class="col-md-8">
|
||||
@@ -104,8 +104,11 @@
|
||||
<small>Add filters to target specific users based on their location, browser, device, etc.</small>
|
||||
</div>
|
||||
|
||||
<div id="filtersContainer">
|
||||
<div id="filtersContainer" class="d-none">
|
||||
<h6>Active Filters</h6>
|
||||
<ul id="filtersPreview" class="list-unstyled">
|
||||
<!-- Filters will be added here dynamically -->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-outline-primary btn-sm" id="addFilterBtn">
|
||||
@@ -224,6 +227,56 @@
|
||||
<script>
|
||||
let filters = [];
|
||||
|
||||
// Load form options on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadRedirectTypes();
|
||||
loadStatuses();
|
||||
setupEventListeners();
|
||||
});
|
||||
|
||||
function loadRedirectTypes() {
|
||||
fetch('/api/redirects/types')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
const select = document.getElementById('redirect_type');
|
||||
select.innerHTML = '<option value="">Selecionar tipo</option>';
|
||||
data.data.forEach(type => {
|
||||
const option = document.createElement('option');
|
||||
option.value = type.value;
|
||||
option.textContent = type.label;
|
||||
select.appendChild(option);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error loading redirect types:', error));
|
||||
}
|
||||
|
||||
function loadStatuses() {
|
||||
fetch('/api/redirects/statuses')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
const select = document.getElementById('status');
|
||||
select.innerHTML = '<option value="">Selecionar status</option>';
|
||||
data.data.forEach(status => {
|
||||
const option = document.createElement('option');
|
||||
option.value = status.value;
|
||||
option.textContent = status.label;
|
||||
select.appendChild(option);
|
||||
});
|
||||
// Set default to active
|
||||
select.value = '1';
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error loading statuses:', error));
|
||||
}
|
||||
|
||||
function setupEventListeners() {
|
||||
// Add filter button
|
||||
document.getElementById('addFilterBtn').addEventListener('click', showAddFilterModal);
|
||||
}
|
||||
|
||||
// Filter type help text
|
||||
const filterHelp = {
|
||||
'country': 'Enter country code (e.g., PT, US, BR)',
|
||||
@@ -282,7 +335,7 @@ function removeFilter(filterId) {
|
||||
}
|
||||
|
||||
function updateFiltersPreview() {
|
||||
const container = document.getElementById('filtersList');
|
||||
const container = document.getElementById('filtersContainer');
|
||||
const list = document.getElementById('filtersPreview');
|
||||
|
||||
if (filters.length === 0) {
|
||||
@@ -311,7 +364,7 @@ function updateFiltersPreview() {
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('createRedirectForm').addEventListener('submit', function(e) {
|
||||
document.getElementById('redirectForm').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!this.checkValidity()) {
|
||||
|
||||
@@ -3,17 +3,17 @@ declare(strict_types=1);
|
||||
|
||||
use App\Core\View;
|
||||
use App\Core\Auth;
|
||||
use App\Modules\Users\Models\UserModel;
|
||||
use App\Core\InputSanitizer;
|
||||
use App\Core\DatabaseManager;
|
||||
|
||||
// Garantir base correta
|
||||
DatabaseManager::getInstance()->useDatabase('crm');
|
||||
$userModel = new UserModel();
|
||||
$user = $userModel->find(1);
|
||||
|
||||
// Get current user info
|
||||
// Get current user info (supports absence of Users module)
|
||||
$currentUser = null;
|
||||
if (class_exists('App\\Modules\\Users\\Models\\UserModel')) {
|
||||
$userModelClass = 'App\\Modules\\Users\\Models\\UserModel';
|
||||
$userModel = new $userModelClass();
|
||||
if (Auth::check()) {
|
||||
$userData = $userModel->find(Auth::id());
|
||||
if ($userData) {
|
||||
@@ -25,6 +25,17 @@ if (Auth::check()) {
|
||||
];
|
||||
}
|
||||
}
|
||||
} elseif (Auth::check()) {
|
||||
$userData = Auth::user();
|
||||
if ($userData) {
|
||||
$currentUser = [
|
||||
'username' => ($userData['first_name'] ?? '') . ' ' . ($userData['last_name'] ?? ''),
|
||||
'email' => $userData['email'] ?? '',
|
||||
'role' => $userData['role'] ?? 'user',
|
||||
'avatar' => $userData['avatar'] ?? '/assets/images/users/avatar-1.jpg'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$alertStats = $alertStats ?? [];
|
||||
|
||||
@@ -421,7 +432,7 @@ $editMode = (null !== $editmenuValue) && $editmenuValue == 1;
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<!-- item-->
|
||||
<h6 class="dropdown-header">Welcome <?php echo $currentUser ? htmlspecialchars($currentUser['username']) : 'Guest'; ?>!</h6>
|
||||
<a class="dropdown-item" href="/apps/users/profile"><i class="mdi mdi-account-circle text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Profile</span></a>
|
||||
<a class="dropdown-item" href="/apps/pages/profile"><i class="mdi mdi-account-circle text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Profile</span></a>
|
||||
<?php if (\App\Core\ModuleConfig::getInstance()->isModuleActive('Chat', \App\Core\Branding::getClientId())): ?>
|
||||
<a class="dropdown-item" href="/apps/chat/"><i class="mdi mdi-message-text-outline text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Messages</span></a>
|
||||
<?php endif; ?>
|
||||
@@ -430,8 +441,7 @@ $editMode = (null !== $editmenuValue) && $editmenuValue == 1;
|
||||
<?php endif; ?>
|
||||
<a class="dropdown-item" href="/apps/pages/faqs"><i class="mdi mdi-lifebuoy text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Help</span></a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="/apps/pages/profile"><i class="mdi mdi-wallet text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Balance : <b>$5971.67</b></span></a>
|
||||
<a class="dropdown-item" href="/apps/users/profile/edit"><span class="badge bg-success-subtle text-success mt-1 float-end">New</span><i class="mdi mdi-cog-outline text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Settings</span></a>
|
||||
<a class="dropdown-item" href="/apps/pages/profile-settings/"><i class="mdi mdi-cog-outline text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Settings</span></a>
|
||||
<a class="dropdown-item" href="/auth-lockscreen-basic/"><i class="mdi mdi-lock text-muted fs-16 align-middle me-1"></i> <span class="align-middle">Lock screen</span></a>
|
||||
<a class="dropdown-item" href="/logout" id="logoutBtn"><i class="mdi mdi-logout text-muted fs-16 align-middle me-1"></i> <span class="align-middle" x-text="$t('t-logout')">Logout</span></a>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// Simple CLI entrypoint to run all pending migrations safely on the server
|
||||
// Usage: php crm/tools/run_migrations.php
|
||||
|
||||
// Resolve base path to CRM
|
||||
$basePath = dirname(__DIR__);
|
||||
|
||||
require $basePath . '/Core/Database/MigrationManager.php';
|
||||
|
||||
$manager = new App\Core\Database\MigrationManager();
|
||||
$results = $manager->migrate();
|
||||
|
||||
// Output as JSON for automation
|
||||
echo json_encode($results, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
require_once "/data/wwwroot/redirect.moneyflix.com/vendor/autoload.php";
|
||||
\App\Core\EnvironmentLoader::load();
|
||||
|
||||
echo "=== DEBUG MENU ===\n";
|
||||
echo "Client ID: " . \App\Core\Branding::getClientId() . "\n";
|
||||
|
||||
echo "\n=== PATH MANAGER ===\n";
|
||||
echo "Modules Path: " . \App\Core\PathManager::getModulesPath() . "\n";
|
||||
echo "Config file exists: " . (file_exists(\App\Core\PathManager::getModulesPath() . "/config.php") ? "YES" : "NO") . "\n";
|
||||
|
||||
echo "\n=== MODULE CONFIG ===\n";
|
||||
$configPath = \App\Core\PathManager::getModulesPath() . "/config.php";
|
||||
if (file_exists($configPath)) {
|
||||
$config = require $configPath;
|
||||
echo "Config loaded: " . json_encode($config, JSON_PRETTY_PRINT) . "\n";
|
||||
} else {
|
||||
echo "Config file not found!\n";
|
||||
}
|
||||
|
||||
$moduleConfig = \App\Core\ModuleConfig::getInstance();
|
||||
echo "Redirects active: " . ($moduleConfig->isModuleActive("Redirects", "moneyflix") ? "YES" : "NO") . "\n";
|
||||
echo "Users active: " . ($moduleConfig->isModuleActive("Users", "moneyflix") ? "YES" : "NO") . "\n";
|
||||
|
||||
echo "\n=== MENU MANAGER ===\n";
|
||||
$menus = \App\Core\MenuManager::getMenus();
|
||||
echo "Registered menus: " . json_encode($menus, JSON_PRETTY_PRINT) . "\n";
|
||||
|
||||
echo "\n=== FINAL MENU ===\n";
|
||||
$finalMenu = \App\Core\MenuManager::getFinalMenu();
|
||||
echo "Final menu: " . json_encode($finalMenu, JSON_PRETTY_PRINT) . "\n";
|
||||
+24
-117
@@ -1,11 +1,14 @@
|
||||
#!/bin/bash
|
||||
# bin/deploy-moneyflix-php.sh
|
||||
|
||||
set -e
|
||||
# MoneyFlix PHP Client Deploy Script
|
||||
# Deploy apenas do código PHP do CRM
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
REMOTE_HOST="94.23.75.89"
|
||||
REMOTE_USER="root"
|
||||
REMOTE_PATH="/data/wwwroot/redirect.moneyflix.com"
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
echo "🚀 MoneyFlix PHP Client Deploy Script"
|
||||
echo "====================================="
|
||||
@@ -18,25 +21,18 @@ cd "$PROJECT_ROOT"
|
||||
|
||||
# 1. Pre-deployment checks
|
||||
echo "📋 Pre-deployment checks..."
|
||||
if [ ! -d "app" ] || [ ! -d "public" ]; then
|
||||
echo "❌ Required directories (app, public) not found in project root!"
|
||||
if [ ! -d "crm" ]; then
|
||||
echo "❌ Required directory (crm) not found in project root!"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Pre-deployment checks passed"
|
||||
echo ""
|
||||
|
||||
# 2. Build local assets
|
||||
echo "🏗️ Building local assets..."
|
||||
npm run build
|
||||
echo "✅ Local assets built"
|
||||
echo ""
|
||||
|
||||
# 3. Deploy core system files (NO --delete to preserve existing files)
|
||||
# 2. Deploy core system files
|
||||
echo "📦 Deploying core system files..."
|
||||
rsync -avz \
|
||||
--exclude='node_modules' --exclude='.git' --exclude='storage/logs' --exclude='storage/cache' --exclude='vendor' \
|
||||
--exclude='.env' --exclude='config.env' --exclude='config.moneyflix.env' \
|
||||
--exclude='projects/' \
|
||||
--exclude='docs/' \
|
||||
--exclude='tools/' \
|
||||
--exclude='bin/' \
|
||||
@@ -45,121 +41,32 @@ rsync -avz \
|
||||
--exclude='package.json' \
|
||||
--exclude='package-lock.json' \
|
||||
--exclude='webpack.config.js' \
|
||||
app/ root@$REMOTE_HOST:$REMOTE_PATH/app/
|
||||
crm/ root@$REMOTE_HOST:$REMOTE_PATH/app/
|
||||
echo "✅ Core system deployed"
|
||||
echo ""
|
||||
|
||||
# 4. Deploy public assets
|
||||
# 3. Deploy public assets
|
||||
echo "📦 Deploying public assets..."
|
||||
rsync -avz public/ root@$REMOTE_HOST:$REMOTE_PATH/public/
|
||||
rsync -avz crm/Views/ root@$REMOTE_HOST:$REMOTE_PATH/public/
|
||||
echo "✅ Public assets deployed"
|
||||
echo ""
|
||||
|
||||
# 5. Deploy MoneyFlix-specific modules only (Advertising + Redirects)
|
||||
echo "📦 Deploying MoneyFlix modules (Advertising + Redirects)..."
|
||||
rsync -avz app/Modules/Advertising/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/Advertising/
|
||||
rsync -avz app/Modules/Redirects/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/Redirects/
|
||||
echo "✅ MoneyFlix modules deployed"
|
||||
echo ""
|
||||
|
||||
# 6. Deploy core modules required by MoneyFlix
|
||||
echo "📦 Deploying required core modules..."
|
||||
rsync -avz app/Modules/Auth/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/Auth/
|
||||
rsync -avz app/Modules/Dashboard/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/Dashboard/
|
||||
rsync -avz app/Modules/ErrorMonitoring/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/ErrorMonitoring/
|
||||
rsync -avz app/Modules/Core/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/Core/
|
||||
rsync -avz app/Modules/Public/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/Public/
|
||||
rsync -avz app/Modules/Layouts/ root@$REMOTE_HOST:$REMOTE_PATH/app/Modules/Layouts/
|
||||
echo "✅ Core modules deployed"
|
||||
echo ""
|
||||
|
||||
# 7. Deploy configuration files
|
||||
echo "📦 Deploying configuration files..."
|
||||
rsync -avz app/Config/ root@$REMOTE_HOST:$REMOTE_PATH/app/Config/
|
||||
rsync -avz app/Routes/ root@$REMOTE_HOST:$REMOTE_PATH/app/Routes/
|
||||
rsync -avz app/Views/layouts/ root@$REMOTE_HOST:$REMOTE_PATH/app/Views/layouts/
|
||||
rsync -avz app/Views/public/ root@$REMOTE_HOST:$REMOTE_PATH/app/Views/public/
|
||||
echo "✅ Configuration files deployed"
|
||||
echo ""
|
||||
|
||||
# 8. Deploy composer files
|
||||
echo "📦 Deploying composer files..."
|
||||
rsync -avz composer.json root@$REMOTE_HOST:$REMOTE_PATH/
|
||||
echo "✅ Composer files deployed"
|
||||
echo ""
|
||||
|
||||
# 9. Install PHP dependencies on server
|
||||
echo "📦 Installing PHP dependencies on server..."
|
||||
ssh root@$REMOTE_HOST "cd $REMOTE_PATH && composer install --no-dev --optimize-autoloader"
|
||||
echo "✅ Dependencies installed"
|
||||
echo ""
|
||||
|
||||
# 10. Set permissions
|
||||
echo "🔒 Setting permissions..."
|
||||
ssh root@$REMOTE_HOST "chmod -R 755 $REMOTE_PATH/storage"
|
||||
ssh root@$REMOTE_HOST "chmod -R 755 $REMOTE_PATH/public/assets"
|
||||
ssh root@$REMOTE_HOST "chmod -R 644 $REMOTE_PATH/storage/cache"
|
||||
ssh root@$REMOTE_HOST "chown -R www-data:www-data $REMOTE_PATH"
|
||||
# 4. Set permissions
|
||||
echo "🔐 Setting permissions..."
|
||||
ssh root@$REMOTE_HOST "chown -R www-data:www-data $REMOTE_PATH && chmod -R 755 $REMOTE_PATH"
|
||||
echo "✅ Permissions set"
|
||||
echo ""
|
||||
|
||||
# 11. Clear application cache
|
||||
echo "🧹 Clearing application cache..."
|
||||
ssh root@$REMOTE_HOST "cd $REMOTE_PATH && php public/clear-cache.php"
|
||||
echo "✅ Application cache cleared"
|
||||
# 5. Restart services
|
||||
echo "🔄 Restarting services..."
|
||||
ssh root@$REMOTE_HOST "systemctl reload php-fpm && systemctl reload nginx"
|
||||
echo "✅ Services restarted"
|
||||
echo ""
|
||||
|
||||
# 12. Restart PHP-FPM
|
||||
echo "🔄 Restarting PHP-FPM..."
|
||||
ssh root@$REMOTE_HOST "systemctl restart php-fpm"
|
||||
echo "✅ PHP-FPM restarted"
|
||||
echo "🎉 Deploy completed successfully!"
|
||||
echo ""
|
||||
|
||||
# 13. Reload Nginx
|
||||
echo "🔄 Reloading Nginx..."
|
||||
ssh root@$REMOTE_HOST "nginx -s reload"
|
||||
echo "✅ Nginx reloaded"
|
||||
echo "📋 Next steps:"
|
||||
echo "1. Test the redirect creation form"
|
||||
echo "2. Check error monitoring at https://redirect.moneyflix.com/error-monitoring/errors"
|
||||
echo "3. Verify redirect functionality"
|
||||
echo ""
|
||||
|
||||
# 14. Verify deployment
|
||||
echo "🔍 Verifying deployment..."
|
||||
sleep 3
|
||||
|
||||
# Test main page
|
||||
MAIN_RESPONSE=$(curl -s -I "http://redirect.moneyflix.com/" | head -1 || echo "FAILED")
|
||||
if [[ "$MAIN_RESPONSE" == *"200"* ]] || [[ "$MAIN_RESPONSE" == *"302"* ]]; then
|
||||
echo "✅ Main page check passed"
|
||||
else
|
||||
echo "❌ Main page check failed: $MAIN_RESPONSE"
|
||||
fi
|
||||
|
||||
# Test health endpoint (Node.js)
|
||||
HEALTH_RESPONSE=$(curl -s "http://redirect.moneyflix.com/health" || echo "FAILED")
|
||||
if [[ "$HEALTH_RESPONSE" == *"healthy"* ]]; then
|
||||
echo "✅ Node.js health check passed"
|
||||
else
|
||||
echo "❌ Node.js health check failed: $HEALTH_RESPONSE"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 MoneyFlix PHP client deployment completed successfully!"
|
||||
echo ""
|
||||
echo "📊 Deployed modules:"
|
||||
echo " ✅ Advertising (redirects management)"
|
||||
echo " ✅ Redirects (public interface)"
|
||||
echo " ✅ Auth (authentication)"
|
||||
echo " ✅ Dashboard (main interface)"
|
||||
echo " ✅ ErrorMonitoring (error tracking)"
|
||||
echo " ✅ Core (foundation system)"
|
||||
echo " ✅ Public (public pages)"
|
||||
echo " ✅ Layouts (page layouts)"
|
||||
echo ""
|
||||
echo "🌐 Access URLs:"
|
||||
echo " Main: http://redirect.moneyflix.com"
|
||||
echo " Redirects: http://redirect.moneyflix.com/redirects"
|
||||
echo " API: http://redirect.moneyflix.com/api/redirects"
|
||||
echo ""
|
||||
echo "🔧 Server Commands:"
|
||||
echo " pm2 logs moneyflix-redirector # View Node.js logs"
|
||||
echo " tail -f /data/wwwlogs/redirect.moneyflix.com.error.log # View PHP logs"
|
||||
echo " nginx -s reload # Reload Nginx"
|
||||
@@ -0,0 +1,119 @@
|
||||
# MoneyFlix Redirector - Deployment Documentation
|
||||
|
||||
## 📍 Localização do Redirector em Produção
|
||||
|
||||
O redirector Node.js está localizado em:
|
||||
```
|
||||
/opt/moneyflix-redirector/
|
||||
```
|
||||
|
||||
### Estrutura de Diretórios
|
||||
```
|
||||
/opt/moneyflix-redirector/
|
||||
├── index.mjs # Ficheiro principal do redirector
|
||||
├── db/
|
||||
│ └── logUser.mjs # Sistema de logging de hits
|
||||
├── helpers/
|
||||
│ ├── helpers.mjs # Funções auxiliares
|
||||
│ └── userAgentParser.mjs # Parser de User Agent
|
||||
├── config/ # Diretório para configurações futuras
|
||||
└── logs/ # Logs do PM2
|
||||
```
|
||||
|
||||
## 🚀 Deploy do Redirector
|
||||
|
||||
### 1. Upload dos Ficheiros
|
||||
```bash
|
||||
# Ficheiro principal
|
||||
scp nodejs-redirector/index.mjs [email protected]:/opt/moneyflix-redirector/
|
||||
|
||||
# Sistema de logging
|
||||
scp nodejs-redirector/db/logUser.mjs [email protected]:/opt/moneyflix-redirector/db/
|
||||
|
||||
# Ficheiros de configuração (se existirem)
|
||||
# # scp nodejs-redirector/config/*.json [email protected]:/opt/moneyflix-redirector/config/
|
||||
|
||||
# Helpers
|
||||
scp nodejs-redirector/helpers/*.mjs [email protected]:/opt/moneyflix-redirector/helpers/
|
||||
```
|
||||
|
||||
### 2. Reiniciar o Serviço
|
||||
```bash
|
||||
ssh [email protected] "pm2 restart moneyflix-redirector"
|
||||
```
|
||||
|
||||
### 3. Verificar Status
|
||||
```bash
|
||||
ssh [email protected] "pm2 status"
|
||||
ssh [email protected] "pm2 logs moneyflix-redirector --lines 10"
|
||||
```
|
||||
|
||||
## 🔧 Configuração do Nginx
|
||||
|
||||
O nginx está configurado para passar todos os headers do CloudFlare:
|
||||
- `CF-Connecting-IP` - IP real do cliente
|
||||
- `CF-IPCountry` - País do cliente
|
||||
- `CF-IPCITY` - Cidade do cliente
|
||||
- `CF-IPREGION` - Região do cliente
|
||||
- `CF-Ray` - ID único do CloudFlare
|
||||
- `CF-Visitor` - Informações do visitante
|
||||
- `CF-Cache-Status` - Status do cache
|
||||
|
||||
## 📊 Sistema de Logging
|
||||
|
||||
### Base de Dados
|
||||
- **Tabela**: `redirect_stats`
|
||||
- **Base de dados**: `redirects_moneyflix`
|
||||
- **Sistema de queue**: Processamento em batch a cada 5 segundos
|
||||
|
||||
### Campos Capturados
|
||||
- IP real do cliente (via CloudFlare)
|
||||
- Geolocalização (país, cidade, região)
|
||||
- Informações do browser/OS
|
||||
- Timestamp original do hit
|
||||
- Dados de rede (ASN, ISP)
|
||||
- Tempo de resposta
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Verificar Logs
|
||||
```bash
|
||||
ssh [email protected] "pm2 logs moneyflix-redirector --lines 50"
|
||||
```
|
||||
|
||||
### Verificar Base de Dados
|
||||
```bash
|
||||
ssh [email protected] "/usr/local/mariadb/bin/mariadb -u root -pD_mLves_ab0i -e 'SELECT * FROM redirects_moneyflix.redirect_stats ORDER BY id DESC LIMIT 5;'"
|
||||
```
|
||||
|
||||
### Testar Redirector
|
||||
```bash
|
||||
curl -I "https://redirect.moneyflix.com/r/evento18outubro25"
|
||||
```
|
||||
|
||||
## 📝 Notas Importantes
|
||||
|
||||
1. **IP do Cliente**: O sistema captura o IP real via `CF-Connecting-IP` do CloudFlare
|
||||
2. **Timestamps**: Cada hit mantém o timestamp original, não o de processamento
|
||||
3. **Dados CloudFlare**: Grava exatamente o que o CloudFlare envia (códigos de país/região)
|
||||
4. **Queue System**: Hits são processados em batch para melhor performance
|
||||
5. **Fallback**: Sistema tem fallback para casos onde CloudFlare não está disponível
|
||||
|
||||
## 🔄 Processo de Deploy Completo
|
||||
|
||||
```bash
|
||||
# 1. Fazer upload de todos os ficheiros
|
||||
scp nodejs-redirector/index.mjs [email protected]:/opt/moneyflix-redirector/
|
||||
scp nodejs-redirector/db/logUser.mjs [email protected]:/opt/moneyflix-redirector/db/
|
||||
# scp nodejs-redirector/config/*.json [email protected]:/opt/moneyflix-redirector/config/
|
||||
scp nodejs-redirector/helpers/*.mjs [email protected]:/opt/moneyflix-redirector/helpers/
|
||||
|
||||
# 2. Reiniciar o serviço
|
||||
ssh [email protected] "pm2 restart moneyflix-redirector"
|
||||
|
||||
# 3. Verificar se está funcionando
|
||||
curl -I "https://redirect.moneyflix.com/r/evento18outubro25"
|
||||
|
||||
# 4. Verificar logs
|
||||
ssh [email protected] "pm2 logs moneyflix-redirector --lines 10"
|
||||
```
|
||||
@@ -56,8 +56,8 @@ export async function getPool() {
|
||||
|
||||
const queue = {
|
||||
hits: [],
|
||||
maxSize: 1000,
|
||||
flushInterval: 5000, // 5 segundos
|
||||
maxSize: parseInt(process.env.QUEUE_MAX_SIZE || '1000', 10),
|
||||
flushInterval: parseInt(process.env.QUEUE_FLUSH_INTERVAL || '5000', 10), // ms
|
||||
isProcessing: false
|
||||
};
|
||||
|
||||
@@ -124,11 +124,12 @@ export async function logHit(hitData) {
|
||||
os: uaData.os.split(' ')[0] || null,
|
||||
os_version: uaData.os.split(' ')[1] || null,
|
||||
device_type: uaData.device.toLowerCase() || 'desktop',
|
||||
language: hitData.language || null,
|
||||
response_time: hitData.response_time || null,
|
||||
destination_url: hitData.destination_url || null,
|
||||
language: (hitData.language ? String(hitData.language).substring(0, 50) : null),
|
||||
response_time: Number.isFinite(hitData.response_time) ? hitData.response_time : null,
|
||||
destination_url: (hitData.destination_url ? String(hitData.destination_url).substring(0, 500) : null),
|
||||
filter_matched: hitData.filter_matched || null,
|
||||
redirect_type: hitData.redirect_type || '302'
|
||||
redirect_type: ['301','302','meta','javascript'].includes(hitData.redirect_type) ? hitData.redirect_type : '302',
|
||||
timestamp: hitData.timestamp ? new Date(hitData.timestamp) : new Date()
|
||||
};
|
||||
|
||||
// Adicionar à queue
|
||||
@@ -167,7 +168,7 @@ export async function processQueue() {
|
||||
|
||||
// Preparar query de inserção em batch
|
||||
const values = hitsToProcess.map(() =>
|
||||
'(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||
'(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||
).join(', ');
|
||||
|
||||
const query = `
|
||||
@@ -176,12 +177,13 @@ export async function processQueue() {
|
||||
country_code, country_name, city, region_code, region_name, timezone,
|
||||
asn, isp, browser, browser_version, os, os_version, device_type,
|
||||
language, hour_of_day, day_of_week, month, year,
|
||||
response_time_ms, target_url_used, filter_matched, timestamp
|
||||
response_time_ms, target_url_used, filter_matched, timestamp, raw_request
|
||||
) VALUES ${values}
|
||||
`;
|
||||
|
||||
const params = hitsToProcess.flatMap(hit => {
|
||||
const now = new Date();
|
||||
// Usar a data original do hit, não a data atual do processamento
|
||||
const hitDate = hit.timestamp ? new Date(hit.timestamp) : new Date();
|
||||
const ipLong = hit.ip_address ? ip2long(hit.ip_address) : 0;
|
||||
|
||||
return [
|
||||
@@ -206,14 +208,15 @@ export async function processQueue() {
|
||||
hit.os_version || null, // os_version
|
||||
hit.device_type || 'desktop', // device_type
|
||||
hit.language || null, // language
|
||||
now.getHours(), // hour_of_day
|
||||
now.getDay(), // day_of_week
|
||||
now.getMonth() + 1, // month
|
||||
now.getFullYear(), // year
|
||||
hitDate.getHours(), // hour_of_day
|
||||
hitDate.getDay(), // day_of_week
|
||||
hitDate.getMonth() + 1, // month
|
||||
hitDate.getFullYear(), // year
|
||||
hit.response_time || null, // response_time_ms
|
||||
hit.destination_url || null, // target_url_used
|
||||
hit.filter_matched || null, // filter_matched
|
||||
now // timestamp
|
||||
hitDate, // timestamp
|
||||
JSON.stringify(hit.raw_request || null)
|
||||
];
|
||||
});
|
||||
|
||||
@@ -260,16 +263,16 @@ export async function logHitDirect(hitData) {
|
||||
country_code, country_name, city, region_code, region_name, timezone,
|
||||
asn, isp, browser, browser_version, os, os_version, device_type,
|
||||
language, hour_of_day, day_of_week, month, year,
|
||||
response_time_ms, target_url_used, filter_matched, timestamp
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
response_time_ms, target_url_used, filter_matched, timestamp, raw_request
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`;
|
||||
|
||||
const now = new Date();
|
||||
const now = hitData.timestamp ? new Date(hitData.timestamp) : new Date();
|
||||
const ipLong = ip2long(hitData.ip_address || '0.0.0.0');
|
||||
|
||||
const params = [
|
||||
hitData.campaign_id, // redirect_id
|
||||
hitData.redirect_type || '302', // redirect_type
|
||||
(['301','302','meta','javascript'].includes(hitData.redirect_type) ? hitData.redirect_type : '302'), // redirect_type
|
||||
hitData.session_id || generateSessionId(), // session_id
|
||||
hitData.ip_address || '0.0.0.0', // ip_address
|
||||
ipLong, // ip_long
|
||||
@@ -288,15 +291,16 @@ export async function logHitDirect(hitData) {
|
||||
uaData.os.split(' ')[0] || null, // os
|
||||
uaData.os.split(' ')[1] || null, // os_version
|
||||
uaData.device.toLowerCase() || 'desktop', // device_type
|
||||
hitData.language || null, // language
|
||||
(hitData.language ? String(hitData.language).substring(0, 50) : null), // language
|
||||
now.getHours(), // hour_of_day
|
||||
now.getDay(), // day_of_week
|
||||
now.getMonth() + 1, // month
|
||||
now.getFullYear(), // year
|
||||
hitData.response_time || null, // response_time_ms
|
||||
hitData.destination_url || null, // target_url_used
|
||||
(Number.isFinite(hitData.response_time) ? hitData.response_time : null), // response_time_ms
|
||||
(hitData.destination_url ? String(hitData.destination_url).substring(0, 500) : null), // target_url_used
|
||||
hitData.filter_matched || null, // filter_matched
|
||||
now // timestamp
|
||||
now, // timestamp
|
||||
JSON.stringify(hitData.raw_request || null)
|
||||
];
|
||||
|
||||
await connection.execute(query, params);
|
||||
|
||||
@@ -4,7 +4,6 @@ module.exports = {
|
||||
script: 'index.mjs',
|
||||
instances: 1,
|
||||
exec_mode: 'cluster',
|
||||
user: 'nodejs',
|
||||
version: '2.0.1',
|
||||
env_file: '.env',
|
||||
env: {
|
||||
@@ -16,7 +15,8 @@ module.exports = {
|
||||
DB_PASSWORD: 'nodejs123',
|
||||
DB_DATABASE: 'redirects_moneyflix',
|
||||
CRM_API_URL: 'https://redirect.moneyflix.com/api/redirects',
|
||||
CRM_API_KEY: 'moneyflix-api-key-2024'
|
||||
CRM_API_KEY: 'moneyflix-api-key-2024',
|
||||
TZ: 'Europe/Lisbon'
|
||||
},
|
||||
// PM2 Configuration
|
||||
max_memory_restart: '500M',
|
||||
|
||||
@@ -6,7 +6,7 @@ import axios from 'axios';
|
||||
|
||||
// Aceder diretamente ao IP do servidor para evitar CloudFlare
|
||||
const CRM_API_URL = process.env.CRM_API_URL || 'http://94.23.75.89/api/redirects';
|
||||
const API_KEY = process.env.CRM_API_KEY || 'moneyflix-api-key-2024';
|
||||
const API_KEY = process.env.CRM_API_KEY || '';
|
||||
|
||||
// ============================================================================
|
||||
// FETCH REDIRECTS
|
||||
@@ -20,13 +20,17 @@ export async function fetchRedirects() {
|
||||
try {
|
||||
console.log(`🔄 Fetching redirects from: ${CRM_API_URL}`);
|
||||
|
||||
const response = await axios.get(CRM_API_URL, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${API_KEY}`,
|
||||
const headers = {
|
||||
'User-Agent': 'MoneyFlix-Redirector/1.0',
|
||||
'Accept': 'application/json',
|
||||
'Host': 'redirect.moneyflix.com'
|
||||
},
|
||||
};
|
||||
if (API_KEY) {
|
||||
headers['Authorization'] = `Bearer ${API_KEY}`;
|
||||
}
|
||||
|
||||
const response = await axios.get(CRM_API_URL, {
|
||||
headers,
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
|
||||
+57
-11
@@ -9,6 +9,15 @@ dotenv.config();
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// ============================================================================
|
||||
// FUNÇÕES AUXILIARES
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Grava exatamente o que o CloudFlare envia - sem traduções
|
||||
* As traduções podem ser feitas posteriormente na base de dados se necessário
|
||||
*/
|
||||
|
||||
// ============================================================================
|
||||
// CONFIGURAÇÃO E MIDDLEWARE
|
||||
// ============================================================================
|
||||
@@ -16,6 +25,9 @@ const PORT = process.env.PORT || 3000;
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
// Configurar para confiar em proxies (CloudFlare + Nginx)
|
||||
app.set('trust proxy', true);
|
||||
|
||||
// CORS headers
|
||||
app.use((req, res, next) => {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
@@ -83,23 +95,57 @@ async function processRedirect(req, res) {
|
||||
}
|
||||
|
||||
// Log hit para analytics (não bloqueia o redirect)
|
||||
logHit({
|
||||
campaign_id: redirect.id,
|
||||
ip_address: req.ip || req.connection.remoteAddress || '0.0.0.0',
|
||||
user_agent: req.get('User-Agent') || null,
|
||||
referer: req.get('Referer') || null,
|
||||
destination_url: redirect.url,
|
||||
response_time: Date.now() - startTime,
|
||||
redirect_type: redirect.type,
|
||||
// Capturar IP real do cliente (CloudFlare -> Nginx -> Node.js)
|
||||
const clientIP = req.get('CF-Connecting-IP') ||
|
||||
req.get('X-Forwarded-For')?.split(',')[0]?.trim() ||
|
||||
req.get('X-Real-IP') ||
|
||||
req.connection.remoteAddress ||
|
||||
'0.0.0.0';
|
||||
|
||||
// Capturar todos os dados do CloudFlare
|
||||
const cloudflareData = {
|
||||
// IP e localização
|
||||
ip_address: clientIP,
|
||||
country_code: req.get('CF-IPCountry') || null,
|
||||
country_name: null, // Será preenchido pelo processor
|
||||
country_name: req.get('CF-IPCountry') || null, // Gravar código do país como está
|
||||
city: req.get('CF-IPCITY') || null,
|
||||
region_code: req.get('CF-IPREGION') || null,
|
||||
region_name: null, // Será preenchido pelo processor
|
||||
region_name: req.get('CF-IPREGION') || null, // Gravar código da região como está
|
||||
timezone: req.get('CF-IPTIMEZONE') || null,
|
||||
|
||||
// Dados de rede
|
||||
asn: req.get('CF-IPASN') || null,
|
||||
isp: req.get('CF-IPISP') || null,
|
||||
language: req.get('Accept-Language') || null
|
||||
|
||||
// Headers de segurança CloudFlare
|
||||
cf_ray: req.get('CF-Ray') || null,
|
||||
cf_visitor: req.get('CF-Visitor') || null,
|
||||
cf_cache_status: req.get('CF-Cache-Status') || null,
|
||||
|
||||
// Dados do cliente
|
||||
user_agent: req.get('User-Agent') || null,
|
||||
referer: req.get('Referer') || null,
|
||||
language: req.get('Accept-Language') || null,
|
||||
|
||||
// Dados do redirect
|
||||
destination_url: redirect.url,
|
||||
response_time: Date.now() - startTime,
|
||||
redirect_type: redirect.type
|
||||
};
|
||||
|
||||
logHit({
|
||||
campaign_id: redirect.id,
|
||||
timestamp: new Date(), // Adicionar timestamp original do hit
|
||||
...cloudflareData,
|
||||
raw_request: {
|
||||
headers: req.headers,
|
||||
query: req.query,
|
||||
url: req.originalUrl,
|
||||
method: req.method,
|
||||
protocol: req.protocol,
|
||||
httpVersion: req.httpVersion,
|
||||
cookies: req.headers?.cookie || null
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('❌ Error logging hit:', error.message);
|
||||
});
|
||||
|
||||
Generated
+6922
File diff suppressed because it is too large.
Load diff
Executable
+77
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "bitreport-js",
|
||||
"version": "1.0.0",
|
||||
"description": "Frontend JS for BitReport CRM, modular and modern.",
|
||||
"main": "src/js/main.js",
|
||||
"scripts": {
|
||||
"clean:js": "rm -f public/assets/js/app.*.js public/assets/js/public.*.js",
|
||||
"clean:css": "rm -f public/assets/css/app.*.css public/assets/css/public.*.css",
|
||||
"build": "npm run clean:js && npm run clean:css && webpack --mode production && npm run build:css && npm run build:public-css && npm run build:modular-css",
|
||||
"build:css": "npx sass --load-path=node_modules public/assets/scss/app.scss public/assets/css/app.min.css --style=compressed",
|
||||
"build:public-css": "npx sass --load-path=node_modules public/assets/scss/public.scss public/assets/css/public.min.css --style=compressed",
|
||||
"build:modular-css": "php tools/build-modular-css.php build",
|
||||
"clean:modular-css": "php tools/build-modular-css.php clean",
|
||||
"rebuild:modular-css": "php tools/build-modular-css.php rebuild",
|
||||
"dev": "webpack --mode development --watch",
|
||||
"build:analyze": "webpack --mode production --analyze",
|
||||
"clean": "rm -rf public/assets/js/*",
|
||||
"lint": "eslint src/js/**/*.js",
|
||||
"lint:fix": "eslint src/js/**/*.js --fix"
|
||||
},
|
||||
"author": "BitReport",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.9",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/preset-env": "^7.22.9",
|
||||
"apexcharts": "^4.7.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
"copy-webpack-plugin": "^13.0.0",
|
||||
"css-loader": "^7.1.2",
|
||||
"eslint": "^8.57.0",
|
||||
"flatpickr": "^4.6.13",
|
||||
"gridjs": "^6.2.0",
|
||||
"sass": "^1.89.2",
|
||||
"style-loader": "^4.0.0",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-bundle-analyzer": "^4.10.1",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"alpinejs": "^3.14.9",
|
||||
"apexcharts": "^4.7.0",
|
||||
"bootstrap": "^5.3.7",
|
||||
"chart.js": "^4.4.0",
|
||||
"choices.js": "^11.1.0",
|
||||
"core-js": "^3.36.0",
|
||||
"datatables.net": "^2.3.2",
|
||||
"datatables.net-bs5": "^2.3.2",
|
||||
"datatables.net-buttons": "^3.2.3",
|
||||
"datatables.net-buttons-bs5": "^3.2.3",
|
||||
"datatables.net-responsive": "^3.0.4",
|
||||
"datatables.net-responsive-bs5": "^3.0.4",
|
||||
"dragula": "^3.7.3",
|
||||
"dropzone": "^6.0.0-beta.2",
|
||||
"echarts": "^5.6.0",
|
||||
"feather-icons": "^4.29.2",
|
||||
"flatpickr": "^4.6.13",
|
||||
"fullcalendar": "^6.1.10",
|
||||
"jsvectormap": "^1.7.0",
|
||||
"jszip": "^3.10.1",
|
||||
"leaflet": "^1.9.4",
|
||||
"lord-icon-element": "^4.1.2",
|
||||
"masonry-layout": "^4.2.2",
|
||||
"moment": "^2.29.4",
|
||||
"node-waves": "^0.7.6",
|
||||
"nouislider": "^15.7.1",
|
||||
"particles.js": "^2.0.0",
|
||||
"pdfmake": "^0.2.20",
|
||||
"prismjs": "^1.29.0",
|
||||
"quill": "^2.0.3",
|
||||
"shepherd.js": "^11.1.1",
|
||||
"simplebar": "^6.3.1",
|
||||
"sortablejs": "^1.15.6",
|
||||
"sweetalert2": "^11.6.13",
|
||||
"swiper": "^11.2.10"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export default function campaignEditViewModel(){return{campaign:{},trackers:[],brands:[],formats:[],topCountries:[],allCountries:[],countrySearch:"",currentTracker:null,formData:{name:"",status:"1",start_date:"",end_date:"",no_end_date:!1},loading:!0,saving:!1,error:null,get filteredCountries(){if(!this.countrySearch)return this.allCountries;const t=this.countrySearch.toLowerCase();return this.allCountries.filter(a=>a.name?.toLowerCase().includes(t)||a.full_name?.toLowerCase().includes(t)||a.code.toLowerCase().includes(t))},init(){this.loadCampaignData(),this.loadFormats(),this.loadCountries()},async loadCampaignData(){try{this.loading=!0,this.error=null;const t=window.location.pathname.split("/"),a=t[t.length-2],[n,i,e]=await Promise.all([fetch(`/api/advertising/campaigns/${a}`),fetch("/api/advertising/brands"),fetch(`/api/advertising/campaigns/${a}/trackers`)]);if(n.ok){const t=await n.json();t.success&&(this.campaign=t.data,this.formData={name:this.campaign.name||"",status:this.campaign.status?.toString()||"1",start_date:this.campaign.start_date||"",end_date:this.campaign.end_date||"",no_end_date:!this.campaign.end_date})}if(i.ok){const t=await i.json();t.success&&(this.brands=t.data)}if(e.ok){const t=await e.json();if(t.success){this.trackers=t.data.map(t=>({...t,landingTypes:[],countries:t.countries?t.countries.split(","):["PT"],format:t.format||"sticky-bottom"}));for(let t=0;t<this.trackers.length;t++)this.trackers[t].brand_id&&await this.updateLandingTypes(t)}}}catch(t){console.error("Erro ao carregar dados da campanha:",t),this.error="Erro de conexão ao carregar dados"}finally{this.loading=!1}},async loadFormats(){try{const t=await fetch("/api/advertising/formats"),a=await t.json();a.success&&(this.formats=a.data||[])}catch(t){console.error("Erro ao carregar formatos:",t)}},async loadCountries(){try{const t=await fetch("/api/advertising/countries"),a=await t.json();a.success&&(this.allCountries=a.data||[],this.topCountries=this.allCountries.slice(0,8))}catch(t){console.error("Erro ao carregar países:",t)}},addNewTracker(){const t={id:"temp_"+Date.now(),name:"",brand_id:"",landing_type_id:"",landingTypes:[],countries:["PT"],format:this.formats.length>0?this.formats[0].id:"",is_active:!0};this.trackers.push(t)},async removeTracker(t){(await Swal.fire({title:this.$t("common.confirm_title"),text:this.$t("common.confirm_text"),icon:"question",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#6c757d",confirmButtonText:this.$t("common.confirm_button"),cancelButtonText:this.$t("common.cancel"),customClass:{confirmButton:"btn btn-primary w-xs me-2 mt-2",cancelButton:"btn btn-secondary w-xs mt-2"},buttonsStyling:!1,showCloseButton:!0})).isConfirmed&&this.trackers.splice(t,1)},async updateLandingTypes(t){const a=this.trackers[t],n=a.brand_id;if(!n)return a.landingTypes=[],void(a.landing_type_id="");try{const t=await fetch(`/api/advertising/brands-landing/${n}`),i=await t.json();i.success&&(a.landingTypes=i.data||[],a.landing_type_id="")}catch(t){console.error("Erro ao carregar landing types:",t),a.landingTypes=[]}},updateTrackerUrl(t){const a=this.trackers[t],n=a.landing_type_id;if(n){const t=a.landingTypes.find(t=>t.id==n);if(t){let n=t.template_url||"";const i={"{tracker_id}":a.id,"{campaign_id}":this.campaign.id,"{campaign_alias}":this.campaign.alias||"","{code}":this.generateCode(),"{timestamp}":Date.now(),"{random}":Math.random().toString(36).substring(7)};Object.entries(i).forEach(([t,a])=>{n=n.replace(new RegExp(t,"g"),a)}),a.final_tracking_url=n}}else a.final_tracking_url=""},generateCode:()=>"tr_"+Date.now().toString(36)+Math.random().toString(36).substring(2,7),isCountrySelected:(t,a)=>a.countries.includes(t),toggleCountry(t,a){const n=a.countries.indexOf(t);n>-1?a.countries.splice(n,1):a.countries.push(t)},openCountryModal(t){this.currentTracker=t,this.countrySearch="",new bootstrap.Modal(document.getElementById("countryModal")).show()},selectFormat(t,a){t.format=a},async saveCampaign(){try{this.saving=!0;const t=window.location.pathname.split("/"),a=t[t.length-2],n={...this.formData,end_date:this.formData.no_end_date?null:this.formData.end_date,trackers:this.trackers.map(t=>({id:t.id,name:t.name,brand_id:t.brand_id,landing_type_id:t.landing_type_id,final_tracking_url:t.final_tracking_url,countries:t.countries.join(","),format:t.format,is_active:t.is_active?1:0}))},i=await fetch(`/api/advertising/campaigns/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),e=await i.json();e.success?window.Swal?window.Swal.fire({icon:"success",title:"Sucesso!",text:"Campanha atualizada com sucesso.",timer:2e3}).then(()=>{window.location.href="/advertising/campaigns"}):(alert("Campanha atualizada com sucesso!"),window.location.href="/advertising/campaigns"):this.error=e.message||"Erro ao atualizar campanha"}catch(t){console.error("Erro:",t),this.error="Erro ao processar a solicitação"}finally{this.saving=!1}}}}
|
||||
@@ -0,0 +1 @@
|
||||
export default function advertisingDashboard(){return{stats:{},campaigns:[],topCampaigns:[],recentActivity:[],loading:!0,error:null,init(){this.loadDashboardData()},async loadDashboardData(){try{this.loading=!0,this.error=null;const[a,t,s,e]=await Promise.all([fetch("/api/advertising/dashboard-stats"),fetch("/api/advertising/campaigns?limit=10"),fetch("/api/advertising/top-campaigns"),fetch("/api/advertising/recent-activity")]);if(a.ok){const t=await a.json();t.success&&(this.stats=t.data)}if(t.ok){const a=await t.json();a.success&&(this.campaigns=a.data)}if(s.ok){const a=await s.json();a.success&&(this.topCampaigns=a.data)}if(e.ok){const a=await e.json();a.success&&(this.recentActivity=a.data)}}catch(a){console.error("Erro ao carregar dados do dashboard:",a),this.error="Erro de conexão ao carregar dados"}finally{this.loading=!1}},getStatusBadgeClass:a=>({1:"bg-soft-success text-success",0:"bg-soft-warning text-warning",active:"bg-soft-success text-success",paused:"bg-soft-warning text-warning",inactive:"bg-soft-danger text-danger"}[a]||"bg-soft-secondary text-secondary"),getStatusDisplay:a=>({1:"Ativa",0:"Pausada",active:"Ativa",paused:"Pausada",inactive:"Inativa"}[a]||"Desconhecido"),getCategoryDisplay:a=>a?a.charAt(0).toUpperCase()+a.slice(1):"N/A",getActivityMarkerClass:a=>({campaign_created:"bg-success",campaign_updated:"bg-info",campaign_paused:"bg-warning",campaign_activated:"bg-success",creative_uploaded:"bg-primary",tracker_created:"bg-info",report_generated:"bg-secondary"}[a]||"bg-secondary"),formatDate:a=>a?new Date(a).toLocaleDateString("pt-PT",{year:"numeric",month:"2-digit",day:"2-digit"}):"--",formatPercentage:a=>!a||isNaN(a)?"0.00%":parseFloat(a).toFixed(2)+"%",formatNumber:a=>!a||isNaN(a)?"0":parseInt(a).toLocaleString("pt-PT")}}
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({siteGroup:null,campaigns:[],trackers:[],domains:[],stats:{},loading:!0,error:null,siteGroupId:null,init(){const t=window.location.pathname.split("/");this.siteGroupId=t[t.length-2],this.siteGroupId&&!isNaN(this.siteGroupId)?this.loadSiteGroup():(this.error="ID do site group não especificado",this.loading=!1)},async loadSiteGroup(){try{this.loading=!0,this.error=null,console.log("🔍 Carregando site group ID:",this.siteGroupId);const t=await fetch(`/api/advertising/site-groups/${this.siteGroupId}`),o=await t.json();console.log("📊 Resposta da API:",o),o.success?(this.siteGroup=o.data,this.campaigns=o.data.campaigns||[],this.trackers=o.data.trackers||[],this.domains=o.data.domains||[],this.stats=o.data.stats||{},console.log("✅ Dados carregados:",{siteGroup:this.siteGroup?.name,campaigns:this.campaigns.length,trackers:this.trackers.length,domains:this.domains.length,stats:this.stats})):(this.error=o.message||"Erro ao carregar site group",console.error("❌ Erro da API:",o.message))}catch(t){console.error("❌ Erro ao carregar site group:",t),this.error="Erro de conexão"}finally{this.loading=!1}},async editDomain(t){const{value:o}=await Swal.fire({title:"Editar domínio",html:`<input id="swal-domain" class="swal2-input" placeholder="domínio" value="${t.domain||""}"><input id="swal-subdomain" class="swal2-input" placeholder="subdomínio" value="${t.subdomain||""}"><label class="mt-2"><input type="checkbox" id="swal-primary" ${t.is_primary?"checked":""}> Primário</label>`,focusConfirm:!1,showCancelButton:!0,confirmButtonText:"Guardar",cancelButtonText:"Cancelar",preConfirm:()=>({domain:document.getElementById("swal-domain").value.trim(),subdomain:document.getElementById("swal-subdomain").value.trim(),is_primary:document.getElementById("swal-primary").checked?1:0})});if(o)try{const i=await fetch(`/api/advertising/site-groups/${this.siteGroupId}/domains/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),a=await i.json();a.success?(await this.loadSiteGroup(),Swal.fire({icon:"success",title:"Guardado"})):Swal.fire({icon:"error",title:"Erro",text:a.message||"Falha ao guardar"})}catch(t){console.error("Erro a atualizar domínio",t),Swal.fire({icon:"error",title:"Erro de conexão"})}},async removeDomain(t){if(console.log("🗑️ Removendo domínio:",t),(await Swal.fire({title:this.$t("common.confirm_title"),text:this.$t("common.confirm_text"),icon:"question",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#6c757d",confirmButtonText:this.$t("common.confirm_button"),cancelButtonText:this.$t("common.cancel"),customClass:{confirmButton:"btn btn-primary w-xs me-2 mt-2",cancelButton:"btn btn-secondary w-xs mt-2"},buttonsStyling:!1,showCloseButton:!0})).isConfirmed)try{const o=await fetch(`/api/advertising/site-groups/${this.siteGroupId}/domains/${t.id}`,{method:"DELETE"}),i=await o.json();i.success?(await this.loadSiteGroup(),Swal.fire({icon:"success",title:"Removido"})):Swal.fire({icon:"error",title:"Erro",text:i.message||"Falha ao remover"})}catch(t){console.error("Erro a remover domínio",t),Swal.fire({icon:"error",title:"Erro de conexão"})}},editCampaign(t){console.log("🔧 Editando campanha:",t),window.location.href=`/advertising/campaigns/${t.id}/edit`},viewCampaign(t){console.log("👁️ Visualizando campanha:",t),window.location.href=`/advertising/campaigns/${t.id}`},editTracker(t){console.log("🔧 Editando tracker:",t),window.location.href=`/advertising/trackers/${t.id}/edit`},viewTracker(t){console.log("👁️ Visualizando tracker:",t),window.location.href=`/advertising/trackers/${t.id}`},getStatusText:t=>"active"===t?"Ativo":"inactive"===t?"Inativo":"pending"===t?"Pendente":"Desconhecido",formatDate:t=>t?new Date(t).toLocaleDateString("pt-PT",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"--",formatCurrency:t=>!t||t<=0?"0,00 €":new Intl.NumberFormat("pt-PT",{style:"currency",currency:"EUR"}).format(t)});
|
||||
@@ -0,0 +1 @@
|
||||
export default function trackerEditViewModel(){return{tracker:{},brands:[],landingTypes:[],creatives:[],formData:{name:"",brand_id:"",landing_type_id:"",final_tracking_url:"",creative_id:"",is_active:!0},loading:!0,saving:!1,error:null,get selectedLandingType(){return this.landingTypes.find(a=>a.id==this.formData.landing_type_id)},get selectedCreative(){return this.creatives.find(a=>a.id==this.formData.creative_id)},init(){this.loadTrackerData()},async loadTrackerData(){try{this.loading=!0,this.error=null;const a=window.location.pathname.split("/"),t=a[a.length-2],[i,e]=await Promise.all([fetch(`/api/advertising/trackers/${t}`),fetch("/api/advertising/brands")]);if(i.ok){const a=await i.json();a.success&&(this.tracker=a.data,this.formData={name:this.tracker.tracker_name||"",brand_id:this.tracker.brand_id||"",landing_type_id:this.tracker.landing_type_id||"",final_tracking_url:this.tracker.final_tracking_url||"",creative_id:this.tracker.creative_id||"",is_active:1==this.tracker.is_active},this.formData.brand_id&&(await this.loadLandingTypes(this.formData.brand_id,this.formData.landing_type_id),await this.loadCreatives(this.formData.brand_id,this.formData.landing_type_id,this.formData.creative_id)))}if(e.ok){const a=await e.json();a.success&&(this.brands=a.data)}}catch(a){console.error("Erro ao carregar dados do tracker:",a),this.error="Erro de conexão ao carregar dados"}finally{this.loading=!1}},async onBrandChange(){const a=this.formData.brand_id;this.formData.landing_type_id="",this.formData.creative_id="",this.landingTypes=[],this.creatives=[],a&&(await this.loadLandingTypes(a),await this.loadCreatives(a))},async onLandingTypeChange(){const a=this.formData.landing_type_id,t=this.formData.brand_id;a&&this.selectedLandingType?(this.processTemplateUrl(this.selectedLandingType.template_url),t&&await this.loadCreatives(t,a)):(this.formData.final_tracking_url="",t&&await this.loadCreatives(t))},onCreativeChange(){},async loadLandingTypes(a,t=null){try{const i=await fetch(`/api/advertising/brand/${a}/landing-types`),e=await i.json();e.success&&(this.landingTypes=e.data||[],t&&this.landingTypes.find(a=>a.id==t)&&(this.formData.landing_type_id=t,this.selectedLandingType&&this.processTemplateUrl(this.selectedLandingType.template_url)))}catch(a){console.error("Erro ao carregar landing types:",a)}},async loadCreatives(a,t=null,i=null){try{const a=await fetch("/api/advertising/creatives"),t=await a.json();t.success?(this.creatives=t.data||[],i&&this.creatives.find(a=>a.id==i)&&(this.formData.creative_id=i)):(this.creatives=[],this.formData.creative_id="")}catch(a){console.error("Erro ao carregar criativos:",a),this.creatives=[],this.formData.creative_id=""}},processTemplateUrl(a){if(!a)return;let t=a;const i={"{tracker_id}":this.tracker.id||"","{campaign_id}":this.tracker.campaign_id||"","{campaign_alias}":this.tracker.campaign_alias||"","{code}":this.generateCode(),"{timestamp}":Date.now(),"{random}":Math.random().toString(36).substring(7)};Object.entries(i).forEach(([a,i])=>{t=t.replace(new RegExp(a,"g"),i)}),this.formData.final_tracking_url=t},generateCode:()=>"tr_"+Date.now().toString(36)+Math.random().toString(36).substring(2,7),copyToClipboard(a){a.select(),document.execCommand("copy");const t=a.nextElementSibling,i=t.innerHTML;t.innerHTML='<i class="ri-check-line"></i> Copiado!',t.classList.add("btn-success"),t.classList.remove("btn-outline-secondary"),setTimeout(()=>{t.innerHTML=i,t.classList.remove("btn-success"),t.classList.add("btn-outline-secondary")},2e3)},async saveTracker(){try{this.saving=!0;const a=window.location.pathname.split("/"),t=a[a.length-2],i=await fetch(`/api/advertising/trackers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.formData,is_active:this.formData.is_active?1:0})}),e=await i.json();e.success?window.Swal?window.Swal.fire({icon:"success",title:"Sucesso!",text:"Tracker atualizado com sucesso.",timer:2e3}).then(()=>{window.location.href="/advertising/tracking"}):(alert("Tracker atualizado com sucesso!"),window.location.href="/advertising/tracking"):this.error=e.message||"Erro ao atualizar tracker"}catch(a){console.error("Erro:",a),this.error="Erro ao processar a solicitação"}finally{this.saving=!1}},formatDate:a=>a?new Date(a).toLocaleDateString("pt-PT",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"--"}}
|
||||
@@ -0,0 +1 @@
|
||||
export default function trackingViewModel(){return{trackers:[],campaigns:[],filters:{search:"",type:"",status:"",campaign:""},pagination:{page:1,limit:50,total:0,pages:0,has_more:!1},loading:!0,error:null,init(){this.loadCampaigns(),this.loadTrackers(1)},async loadTrackers(t=1){try{this.loading=!0,this.error=null;const a=new URLSearchParams({page:t,limit:this.pagination.limit,...this.filters}),e=await fetch(`/api/advertising/trackers?${a}`),i=await e.json();i.success?(this.trackers=i.data,this.pagination=i.pagination,this.pagination.page=t):this.error=i.message||"Erro ao carregar trackers"}catch(t){console.error("Erro ao carregar trackers:",t),this.error="Erro de conexão"}finally{this.loading=!1}},async loadCampaigns(){try{const t=await fetch("/api/advertising/campaigns?limit=100"),a=await t.json();a.success&&(this.campaigns=a.data)}catch(t){console.error("Erro ao carregar campanhas:",t)}},async deleteTracker(t){if((await Swal.fire({title:this.$t("common.confirm_title"),text:this.$t("common.confirm_text"),icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:this.$t("common.confirm_button"),cancelButtonText:this.$t("common.cancel"),customClass:{confirmButton:"btn btn-danger w-xs me-2 mt-2",cancelButton:"btn btn-secondary w-xs mt-2"},buttonsStyling:!1,showCloseButton:!0})).isConfirmed)try{const a=await fetch(`/api/advertising/trackers/${t}`,{method:"DELETE"}),e=await a.json();e.success?await this.loadTrackers(this.pagination.page):alert(e.message||"Erro ao eliminar tracker")}catch(t){console.error("Erro ao eliminar tracker:",t),alert("Erro de conexão")}},getTypeBadgeClass:t=>({view:"bg-info",click:"bg-success",register:"bg-warning",purchase:"bg-primary",custom:"bg-secondary"}[t]||"bg-secondary"),getTypeDisplay:t=>({view:"Visualização",click:"Clique",register:"Registo",purchase:"Compra",custom:"Personalizado"}[t]||t),getStatusBadgeClass:t=>({active:"bg-success",inactive:"bg-secondary",paused:"bg-warning"}[t]||"bg-secondary"),getStatusDisplay:t=>({active:"Ativo",inactive:"Inativo",paused:"Pausado"}[t]||t),formatDate:t=>t?new Date(t).toLocaleDateString("pt-PT",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"--",getPageNumbers(){const t=[],a=this.pagination.page,e=this.pagination.pages;let i=Math.max(1,a-2),r=Math.min(e,a+2);r-i<4&&(1===i?r=Math.min(e,i+4):i=Math.max(1,r-4));for(let a=i;a<=r;a++)t.push(a);return t}}}export function copyTrackingCode(){const t=document.querySelector("pre code"),a=document.createElement("textarea");a.value=t.textContent,document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a);const e=document.querySelector('button[onclick="copyTrackingCode()"]'),i=e.innerHTML;e.innerHTML='<i class="ri-check-line me-1"></i> Copiado!',e.classList.remove("btn-primary"),e.classList.add("btn-success"),setTimeout(()=>{e.innerHTML=i,e.classList.remove("btn-success"),e.classList.add("btn-primary")},2e3)}
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({isLoading:!0,selectedDomain:"",availableDomains:[],data:{stats:{users:{value:0,change:0},sessions:{value:0,change:0},avg_duration:{min:0,sec:0,change:0},bounce_rate:{value:0,change:0}},liveUsersByCountry:{markers:[],lines:[]},sessionsByCountry:{data:[],labels:[]},topReferrals:[],topPages:[]},init(){console.log("Alpine analytics component initialized."),this.loadAvailableDomains(),this.fetchDashboardData()},async loadAvailableDomains(){try{const e=await fetch("/api/analytics/domains"),a=await e.json();a.success&&(this.availableDomains=a.data)}catch(e){console.error("Error loading available domains:",e)}},async fetchDashboardData(){this.isLoading=!0;try{const e=this.selectedDomain?`/api/analytics/dashboard?domain=${encodeURIComponent(this.selectedDomain)}`:"/api/analytics/dashboard",a=await fetch(e),s=await a.json();s.success&&(this.data=s.data,this.initLiveUsersByCountry(),this.initSessionsByCountryChart())}catch(e){console.error("Error fetching dashboard data:",e)}finally{this.isLoading=!1}},onDomainChange(){this.fetchDashboardData()},formatNumber:e=>e>=1e3?(e/1e3).toFixed(2)+"k":e,getChangeHtml(e){const a=e>=0;return`<span class="text-${a?"success":"danger"} fs-12 ms-1"><i class="align-middle ${a?"ri-arrow-up-s-line":"ri-arrow-down-s-line"}"></i>${Math.abs(e)}%</span>`},initLiveUsersByCountry(){if("undefined"==typeof jsVectorMap||!document.getElementById("live-users-by-country"))return void console.error("jsVectorMap library or target element is not available.");const e=document.getElementById("live-users-by-country");e.querySelector(".jvm-container")&&(e.innerHTML=""),new jsVectorMap({selector:"#live-users-by-country",map:"world_merc",zoomOnScroll:!1,zoomButtons:!1,regionStyle:{initial:{fill:"#f0f2f5"}},markerStyle:{initial:{fill:"var(--bs-primary)"}},markers:this.data.liveUsersByCountry.markers,lines:this.data.liveUsersByCountry.lines,lineStyle:{animation:!0,strokeDasharray:"6 3 6"}})},initSessionsByCountryChart(){if("undefined"==typeof ApexCharts||!document.getElementById("sessions-by-countries"))return void console.error("ApexCharts library or target element is not available.");const e=document.getElementById("sessions-by-countries");if(e.hasAttribute("_echarts_instance_"))return;const a={series:[{data:this.data.sessionsByCountry.data}],chart:{type:"bar",height:436,toolbar:{show:!1}},plotOptions:{bar:{borderRadius:4,horizontal:!0,distributed:!0,dataLabels:{position:"top"}}},colors:["#405189","#3577f1","#83a6f3","#a8c5f5","#cddcf8"],dataLabels:{enabled:!0,formatter:e=>this.formatNumber(e),offsetX:32,style:{fontSize:"12px",fontWeight:400,colors:["#adb5bd"]}},legend:{show:!1},grid:{show:!1},xaxis:{categories:this.data.sessionsByCountry.labels}};new ApexCharts(e,a).render()}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({charts:{},chartData:{},init(){this.initializeAreaCharts()},async initializeAreaCharts(){const t=document.querySelectorAll('[data-chart="area"]');for(const a of t)await this.createAreaChart(a)},async createAreaChart(t){const a=t.id;if(!a)return;const e=await this.loadChartData(t),r=this.getAreaChartOptions(t,e);this.charts[a]=new ApexCharts(t,r),this.charts[a].render(),this.chartData[a]=e},async loadChartData(t){const a=t.getAttribute("data-api-url"),e=this.getFallbackData(t);if(a)try{const t=await fetch(a);if(t.ok){const r=await t.json();return console.log(`📊 Loaded area chart data from API: ${a}`,r),this.mergeWithFallback(r,e)}}catch(t){console.warn(`⚠️ API failed for ${a}, using fallback data:`,t)}return console.log(`📊 Using fallback data for area chart: ${t.id}`),e},mergeWithFallback:(t,a)=>({series:t.series||a.series,categories:t.categories||a.categories,colors:t.colors||a.colors,config:{...a.config,...t.config}}),getFallbackData(t){const a={revenue:{series:[{name:"Receitas",data:[31,40,28,51,42,109,100]},{name:"Despesas",data:[11,32,45,32,34,52,41]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul"],colors:["#3577f1","#f06548"]},traffic:{series:[{name:"Tráfego",data:[45,52,38,24,33,26,21,20,6,8,15,10]},{name:"Conversões",data:[35,41,62,42,13,18,29,37,36,51,32,35]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],colors:["#f1b44c","#5ac7fa"]},growth:{series:[{name:"Crescimento",data:[25,35,45,55,65,75,85,95,105,115,125,135]},{name:"Meta",data:[20,30,40,50,60,70,80,90,100,110,120,130]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],colors:["#51bb25","#6c757d"]}};return a[t.getAttribute("data-chart-type")||"revenue"]||a.revenue},getAreaChartOptions(t,a){const e=this.getColors(t,a.colors);return{series:a.series,chart:{type:"area",height:parseInt(t.getAttribute("data-height"))||350,toolbar:{show:"false"!==t.getAttribute("data-toolbar")},zoom:{enabled:"false"!==t.getAttribute("data-zoom")}},colors:e,dataLabels:{enabled:"false"!==t.getAttribute("data-labels")},stroke:{curve:t.getAttribute("data-curve")||"smooth",width:parseInt(t.getAttribute("data-stroke-width"))||2},fill:{type:t.getAttribute("data-fill-type")||"gradient",gradient:{shadeIntensity:1,opacityFrom:.7,opacityTo:.9,stops:[0,90,100]}},markers:{size:parseInt(t.getAttribute("data-marker-size"))||4,hover:{size:parseInt(t.getAttribute("data-marker-hover-size"))||6}},xaxis:{categories:a.categories,labels:{style:{colors:"#6c757d"}}},yaxis:{labels:{style:{colors:"#6c757d"}}},grid:{borderColor:"#f1f1f1"},tooltip:{theme:"dark",x:{show:!0}},legend:{position:t.getAttribute("data-legend-position")||"top",horizontalAlign:t.getAttribute("data-legend-align")||"left"}}},getColors(t,a=null){const e=t.getAttribute("data-colors");return e?e.split(",").map(t=>t.trim()):a||["#3577f1","#51bb25","#f1b44c","#f06548","#5ac7fa"]},async refreshChartData(t){const a=document.getElementById(t);if(!a)return;const e=await this.loadChartData(a);this.updateChartData(t,e),this.chartData[t]=e},updateChartData(t,a){this.charts[t]&&(this.charts[t].updateSeries(a.series),a.categories&&this.charts[t].updateOptions({xaxis:{categories:a.categories}}))},addDataPoint(t,a,e,r=null){if(this.charts[t]){const s=this.charts[t],i=s.w.config.series;if(i[a]&&(i[a].data.push(e),s.updateSeries(i),r)){const t=s.w.config.xaxis.categories;t.push(r),s.updateOptions({xaxis:{categories:t}})}}},removeDataPoint(t,a,e){if(this.charts[t]){const r=this.charts[t],s=r.w.config.series;s[a]&&s[a].data[e]&&(s[a].data.splice(e,1),r.updateSeries(s))}},animateChart(t){this.charts[t]&&this.charts[t].updateSeries([],!0,!0)},getChart(t){return this.charts[t]},getChartData(t){return this.chartData[t]},createStackedAreaChart(t){const a=t.id;if(!a)return;const e=this.getStackedAreaOptions(t);this.charts[a]=new ApexCharts(t,e),this.charts[a].render()},getStackedAreaOptions(t){const a=this.getAreaChartOptions(t,this.getChartData(t));return{...a,chart:{...a.chart,stacked:!0},fill:{type:"solid",opacity:.8}}},create100StackedAreaChart(t){const a=t.id;if(!a)return;const e=this.get100StackedAreaOptions(t);this.charts[a]=new ApexCharts(t,e),this.charts[a].render()},get100StackedAreaOptions(t){const a=this.getAreaChartOptions(t,this.getChartData(t));return{...a,chart:{...a.chart,stacked:!0},fill:{type:"solid",opacity:.8},yaxis:{...a.yaxis,labels:{...a.yaxis.labels,formatter:function(t){return t.toFixed(0)+"%"}}}}},createNegativeAreaChart(t){const a=t.id;if(!a)return;const e=this.getNegativeAreaOptions(t);this.charts[a]=new ApexCharts(t,e),this.charts[a].render()},getNegativeAreaOptions(t){return{...this.getAreaChartOptions(t,this.getChartData(t)),fill:{type:"gradient",gradient:{shadeIntensity:1,opacityFrom:.7,opacityTo:.9,stops:[0,90,100],colorStops:[{offset:0,color:"#3577f1",opacity:1},{offset:50,color:"#f06548",opacity:1},{offset:100,color:"#51bb25",opacity:1}]}}}},getAllCharts(){return this.charts},handleResize(){Object.Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({charts:{},chartData:{},init(){this.initializeBarCharts()},async initializeBarCharts(){const t=document.querySelectorAll('[data-chart="bar"]');for(const a of t)await this.createBarChart(a)},async createBarChart(t){const a=t.id;if(!a)return;const e=await this.loadChartData(t),r=this.getBarChartOptions(t,e);this.charts[a]=new ApexCharts(t,r),this.charts[a].render(),this.chartData[a]=e},async loadChartData(t){const a=t.getAttribute("data-api-url"),e=this.getFallbackData(t);if(a)try{const t=await fetch(a);if(t.ok){const r=await t.json();return console.log(`📊 Loaded bar chart data from API: ${a}`,r),this.mergeWithFallback(r,e)}}catch(t){console.warn(`⚠️ API failed for ${a}, using fallback data:`,t)}return console.log(`📊 Using fallback data for bar chart: ${t.id}`),e},mergeWithFallback:(t,a)=>({series:t.series||a.series,categories:t.categories||a.categories,colors:t.colors||a.colors,config:{...a.config,...t.config}}),getFallbackData(t){const a={sales:{series:[{name:"Vendas",data:[44,55,57,56,61,58,63,60,66]},{name:"Receitas",data:[76,85,101,98,87,105,91,114,94]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],colors:["#3577f1","#51bb25"]},products:{series:[{name:"Produtos",data:[35,41,62,42,13,18,29,37,36,51,32,35]},{name:"Vendas",data:[87,57,74,99,75,38,62,47,82,56,45,47]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],colors:["#f1b44c","#f06548"]},performance:{series:[{name:"Performance",data:[25,35,45,55,65,75,85,95,105,115,125,135]},{name:"Meta",data:[20,30,40,50,60,70,80,90,100,110,120,130]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],colors:["#5ac7fa","#6c757d"]}};return a[t.getAttribute("data-chart-type")||"sales"]||a.sales},getBarChartOptions(t,a){const e=this.getColors(t,a.colors);return{series:a.series,chart:{type:"bar",height:parseInt(t.getAttribute("data-height"))||350,toolbar:{show:"false"!==t.getAttribute("data-toolbar")},zoom:{enabled:"false"!==t.getAttribute("data-zoom")}},colors:e,dataLabels:{enabled:"false"!==t.getAttribute("data-labels")},plotOptions:{bar:{horizontal:"true"===t.getAttribute("data-horizontal"),columnWidth:t.getAttribute("data-column-width")||"55%",borderRadius:parseInt(t.getAttribute("data-border-radius"))||4}},xaxis:{categories:a.categories,labels:{style:{colors:"#6c757d"}}},yaxis:{labels:{style:{colors:"#6c757d"}}},grid:{borderColor:"#f1f1f1"},tooltip:{theme:"dark",x:{show:!0}},legend:{position:t.getAttribute("data-legend-position")||"top",horizontalAlign:t.getAttribute("data-legend-align")||"left"}}},getColors(t,a=null){const e=t.getAttribute("data-colors");return e?e.split(",").map(t=>t.trim()):a||["#3577f1","#51bb25","#f1b44c","#f06548","#5ac7fa"]},async refreshChartData(t){const a=document.getElementById(t);if(!a)return;const e=await this.loadChartData(a);this.updateChartData(t,e),this.chartData[t]=e},updateChartData(t,a){this.charts[t]&&(this.charts[t].updateSeries(a.series),a.categories&&this.charts[t].updateOptions({xaxis:{categories:a.categories}}))},addDataPoint(t,a,e,r=null){if(this.charts[t]){const s=this.charts[t],i=s.w.config.series;if(i[a]&&(i[a].data.push(e),s.updateSeries(i),r)){const t=s.w.config.xaxis.categories;t.push(r),s.updateOptions({xaxis:{categories:t}})}}},removeDataPoint(t,a,e){if(this.charts[t]){const r=this.charts[t],s=r.w.config.series;s[a]&&s[a].data[e]&&(s[a].data.splice(e,1),r.updateSeries(s))}},animateChart(t){this.charts[t]&&this.charts[t].updateSeries([],!0,!0)},getChart(t){return this.charts[t]},getChartData(t){return this.chartData[t]}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsBoxplot component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsBubble component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsCandlestick component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsColumn component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsFunnel component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsHeatmap component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({charts:{},chartData:{},init(){this.$nextTick(()=>{"undefined"!=typeof ApexCharts?this.initializeLineCharts():(console.error("ApexCharts not found. Deferring initialization."),setTimeout(()=>this.initializeLineCharts(),500))})},async initializeLineCharts(){const t=document.querySelectorAll('[data-chart="line"]');for(const a of t)await this.createLineChart(a)},async createLineChart(t){const a=t.id;if(!a)return;const e=await this.loadChartData(t),s=this.getLineChartOptions(t,e);this.charts[a]=new ApexCharts(t,s),this.charts[a].render(),this.chartData[a]=e},async loadChartData(t){const a=t.getAttribute("data-api-url"),e=this.getFallbackData(t);if(a)try{const t=await fetch(a);if(t.ok){const s=await t.json();return console.log(`📊 Loaded data from API: ${a}`,s),this.mergeWithFallback(s,e)}}catch(t){console.warn(`⚠️ API failed for ${a}, using fallback data:`,t)}return console.log(`📊 Using fallback data for chart: ${t.id}`),e},mergeWithFallback:(t,a)=>({series:t.series||a.series,categories:t.categories||a.categories,colors:t.colors||a.colors,config:{...a.config,...t.config}}),getFallbackData(t){const a={sales:{series:[{name:"Vendas",data:[30,40,35,50,49,60,70,91,125]},{name:"Receitas",data:[20,29,37,36,44,45,50,58,60]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],colors:["#3577f1","#51bb25"]},analytics:{series:[{name:"Utilizadores",data:[45,52,38,24,33,26,21,20,6,8,15,10]},{name:"Sessões",data:[35,41,62,42,13,18,29,37,36,51,32,35]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],colors:["#f1b44c","#f06548"]},crm:{series:[{name:"Leads",data:[25,35,45,55,65,75,85,95,105,115,125,135]},{name:"Conversões",data:[15,25,35,45,55,65,75,85,95,105,115,125]}],categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],colors:["#5ac7fa","#6c757d"]}};return a[t.getAttribute("data-chart-type")||"sales"]||a.sales},getLineChartOptions(t,a){const e=this.getColors(t,a.colors);return{series:a.series,chart:{type:"line",height:parseInt(t.getAttribute("data-height"))||350,toolbar:{show:"false"!==t.getAttribute("data-toolbar")},zoom:{enabled:"false"!==t.getAttribute("data-zoom")}},colors:e,dataLabels:{enabled:"false"!==t.getAttribute("data-labels")},stroke:{curve:t.getAttribute("data-curve")||"smooth",width:parseInt(t.getAttribute("data-stroke-width"))||2},markers:{size:parseInt(t.getAttribute("data-marker-size"))||4,hover:{size:parseInt(t.getAttribute("data-marker-hover-size"))||6}},xaxis:{categories:a.categories,labels:{style:{colors:"#6c757d"}}},yaxis:{labels:{style:{colors:"#6c757d"}}},grid:{borderColor:"#f1f1f1"},tooltip:{theme:"dark",x:{show:!0}},legend:{position:t.getAttribute("data-legend-position")||"top",horizontalAlign:t.getAttribute("data-legend-align")||"left"}}},getColors(t,a=null){const e=t.getAttribute("data-colors");return e?e.split(",").map(t=>t.trim()):a||["#3577f1","#51bb25","#f1b44c","#f06548","#5ac7fa"]},async refreshChartData(t){const a=document.getElementById(t);if(!a)return;const e=await this.loadChartData(a);this.updateChartData(t,e),this.chartData[t]=e},updateChartData(t,a){this.charts[t]&&(this.charts[t].updateSeries(a.series),a.categories&&this.charts[t].updateOptions({xaxis:{categories:a.categories}}))},addDataPoint(t,a,e,s=null){if(this.charts[t]){const r=this.charts[t],i=r.w.config.series;if(i[a]&&(i[a].data.push(e),r.updateSeries(i),s)){const t=r.w.config.xaxis.categories;t.push(s),r.updateOptions({xaxis:{categories:t}})}}},removeDataPoint(t,a,e){if(this.charts[t]){const s=this.charts[t],r=s.w.config.series;r[a]&&r[a].data[e]&&(r[a].data.splice(e,1),s.updateSeries(r))}},animateChart(t){this.charts[t]&&this.charts[t].updateSeries([],!0,!0)},getChart(t){return this.charts[t]},getChartData(t){return this.chartData[t]}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsMixed component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({charts:{},chartData:{},init(){this.initializePieCharts()},async initializePieCharts(){const t=document.querySelectorAll('[data-chart="pie"]');for(const a of t)await this.createPieChart(a)},async createPieChart(t){const a=t.id;if(!a)return;const e=await this.loadChartData(t),s=this.getPieChartOptions(t,e);this.charts[a]=new ApexCharts(t,s),this.charts[a].render(),this.chartData[a]=e},async loadChartData(t){const a=t.getAttribute("data-api-url"),e=this.getFallbackData(t);if(a)try{const t=await fetch(a);if(t.ok){const s=await t.json();return console.log(`📊 Loaded pie chart data from API: ${a}`,s),this.mergeWithFallback(s,e)}}catch(t){console.warn(`⚠️ API failed for ${a}, using fallback data:`,t)}return console.log(`📊 Using fallback data for pie chart: ${t.id}`),e},mergeWithFallback:(t,a)=>({series:t.series||a.series,labels:t.labels||a.labels,colors:t.colors||a.colors,config:{...a.config,...t.config}}),getFallbackData(t){const a={sales:{series:[44,55,13,43,22],labels:["Vendas","Marketing","Desenvolvimento","Suporte","Outros"],colors:["#3577f1","#51bb25","#f1b44c","#f06548","#5ac7fa"]},traffic:{series:[35,41,62,42,13,18],labels:["Direto","Orgânico","Referral","Social","Email","Outros"],colors:["#3577f1","#51bb25","#f1b44c","#f06548","#5ac7fa","#6c757d"]},revenue:{series:[25,35,45,55,65],labels:["Produto A","Produto B","Produto C","Produto D","Produto E"],colors:["#3577f1","#51bb25","#f1b44c","#f06548","#5ac7fa"]}};return a[t.getAttribute("data-chart-type")||"sales"]||a.sales},getPieChartOptions(t,a){const e=this.getColors(t,a.colors);return{series:a.series,chart:{type:"pie",height:parseInt(t.getAttribute("data-height"))||350,toolbar:{show:"false"!==t.getAttribute("data-toolbar")}},colors:e,labels:a.labels,dataLabels:{enabled:"false"!==t.getAttribute("data-labels"),formatter:function(t,a){return a.w.globals.seriesTotals[a.seriesIndex]+"%"}},plotOptions:{pie:{donut:{size:t.getAttribute("data-donut-size")||"0%",labels:{show:"false"!==t.getAttribute("data-donut-labels"),name:{show:!0,fontSize:"22px",fontFamily:"Helvetica, Arial, sans-serif",fontWeight:600,color:"#6c757d"},value:{show:!0,fontSize:"16px",fontFamily:"Helvetica, Arial, sans-serif",fontWeight:400,color:"#6c757d",formatter:function(t){return t}},total:{show:"false"!==t.getAttribute("data-show-total"),label:t.getAttribute("data-total-label")||"Total",fontSize:"16px",fontWeight:600,color:"#6c757d",formatter:function(t){return t.globals.seriesTotals.reduce((t,a)=>t+a,0)}}}}}},legend:{position:t.getAttribute("data-legend-position")||"bottom",horizontalAlign:t.getAttribute("data-legend-align")||"center"},tooltip:{theme:"dark",y:{formatter:function(t){return t+"%"}}},responsive:[{breakpoint:480,options:{chart:{width:200},legend:{position:"bottom"}}}]}},getColors(t,a=null){const e=t.getAttribute("data-colors");return e?e.split(",").map(t=>t.trim()):a||["#3577f1","#51bb25","#f1b44c","#f06548","#5ac7fa"]},async refreshChartData(t){const a=document.getElementById(t);if(!a)return;const e=await this.loadChartData(a);this.updateChartData(t,e),this.chartData[t]=e},updateChartData(t,a){this.charts[t]&&(this.charts[t].updateSeries(a.series),a.labels&&this.charts[t].updateOptions({labels:a.labels}))},addDataPoint(t,a,e){if(this.charts[t]){const s=this.charts[t],r=s.w.config.series,i=s.w.config.labels;r.push(a),i.push(e),s.updateSeries(r),s.updateOptions({labels:i})}},removeDataPoint(t,a){if(this.charts[t]){const e=this.charts[t],s=e.w.config.series,r=e.w.config.labels;s[a]&&r[a]&&(s.splice(a,1),r.splice(a,1),e.updateSeries(s),e.updateOptions({labels:r}))}},animateChart(t){this.charts[t]&&this.charts[t].updateSeries([],!0,!0)},getChart(t){return this.charts[t]},getChartData(t){return this.chartData[t]}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsPolararea component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsRadar component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsRadialbar component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsRangeArea component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsScatter component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsSlope component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsTimeline component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("apexchartsTreemap component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({charts:{},initChart(t,e={}){if("undefined"==typeof ApexCharts)return void console.error("ApexCharts library not loaded");const r=document.getElementById(t);if(!r)return void console.error(`Chart element with id "${t}" not found`);if(r.hasAttribute("_apexcharts_instance_"))return;const a={chart:{toolbar:{show:!1},animations:{enabled:!0}},colors:this.getChartColors(t),dataLabels:{enabled:!1},legend:{show:!0},grid:{show:!0}},s=this.mergeDeep(a,e);this.charts[t]=new ApexCharts(r,s),this.charts[t].render(),console.log(`Chart "${t}" initialized successfully`)},getChartColors(t){const e=document.getElementById(t);if(!e)return[];const r=e.getAttribute("data-colors");if(!r)return[];try{return JSON.parse(r).map(t=>t.startsWith("--")?getComputedStyle(document.documentElement).getPropertyValue(t):t)}catch(e){return console.error(`Error parsing colors for chart "${t}":`,e),[]}},mergeDeep(t,e){const r={...t};for(const t in e)e[t]&&"object"==typeof e[t]&&!Array.isArray(e[t])?r[t]=this.mergeDeep(r[t]||{},e[t]):r[t]=e[t];return r},updateChart(t,e){this.charts[t]&&this.charts[t].updateSeries(e)},destroyChart(t){this.charts[t]&&(this.charts[t].destroy(),delete this.charts[t])},createLineChart(t,e,r,a={}){const s={series:e,chart:{type:"line",height:350},xaxis:{categories:r},stroke:{curve:"smooth",width:3},...a};this.initChart(t,s)},createBarChart(t,e,r,a={}){const s={series:e,chart:{type:"bar",height:350},xaxis:{categories:r},plotOptions:{bar:{horizontal:!1,columnWidth:"55%"}},...a};this.initChart(t,s)},createPieChart(t,e,r={}){const a={series:e,chart:{type:"pie",height:350},labels:r.labels||[],...r};this.initChart(t,a)},createAreaChart(t,e,r,a={}){const s={series:e,chart:{type:"area",height:350},xaxis:{categories:r},stroke:{curve:"smooth"},fill:{opacity:.3},...a};this.initChart(t,s)},createRadarChart(t,e,r,a={}){const s={series:e,chart:{type:"radar",height:350},xaxis:{categories:r},stroke:{width:2},fill:{opacity:.2},...a};this.initChart(t,s)}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("chartjs component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("echarts component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
function activitiesList(t){return{activities:[],showing:0,total:0,loading:!0,error:null,async fetchActivities(){try{this.loading=!0,this.error=null;const i=await fetch(t);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const s=await i.json();s&&Array.isArray(s)?(this.activities=s,this.total=s.length,this.showing=Math.min(s.length,5)):s&&s.activities?(this.activities=s.activities,this.total=s.total||s.activities.length,this.showing=s.showing||Math.min(s.activities.length,5)):(this.activities=[],this.total=0,this.showing=0)}catch(t){console.error("Error fetching activities data:",t),this.error=t.message,this.activities=[],this.total=0,this.showing=0}finally{this.loading=!1}},init(){this.fetchActivities(),setInterval(()=>{this.fetchActivities()},12e4)}}}export default activitiesList;
|
||||
@@ -0,0 +1 @@
|
||||
function activitiesSummary(t){return{activities:[],showing:0,total:0,loading:!0,error:null,async fetchActivitiesSummary(){try{this.loading=!0,this.error=null;const i=await fetch(t);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const s=await i.json();s&&Array.isArray(s)?(this.activities=s,this.total=s.length,this.showing=Math.min(s.length,10)):s&&s.activities?(this.activities=s.activities,this.total=s.total||s.activities.length,this.showing=s.showing||Math.min(s.activities.length,10)):(this.activities=[],this.total=0,this.showing=0)}catch(t){console.error("Error fetching activities summary data:",t),this.error=t.message,this.activities=[],this.total=0,this.showing=0}finally{this.loading=!1}},init(){this.fetchActivitiesSummary(),setInterval(()=>{this.fetchActivitiesSummary()},12e4)}}}export default activitiesSummary;
|
||||
@@ -0,0 +1 @@
|
||||
function closingDealsTable(t){return{deals:[],loading:!0,error:null,showing:0,total:0,async fetchClosingDeals(){try{this.loading=!0,this.error=null;const s=await fetch(t);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const l=await s.json();l&&Array.isArray(l)?(this.deals=l,this.total=l.length,this.showing=Math.min(l.length,10)):l&&l.deals?(this.deals=l.deals,this.total=l.total||l.deals.length,this.showing=l.showing||Math.min(l.deals.length,10)):(this.deals=[],this.total=0,this.showing=0)}catch(t){console.error("Error fetching closing deals data:",t),this.error=t.message,this.deals=[],this.total=0,this.showing=0}finally{this.loading=!1}},init(){this.fetchClosingDeals(),setInterval(()=>{this.fetchClosingDeals()},12e4)}}}export default closingDealsTable;
|
||||
@@ -0,0 +1 @@
|
||||
function dealsTable(t){return{deals:[],loading:!0,error:null,showing:0,total:0,async fetchDeals(){try{this.loading=!0,this.error=null;const s=await fetch(t);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const a=await s.json();a&&Array.isArray(a)?(this.deals=a,this.total=a.length,this.showing=Math.min(a.length,10)):a&&a.deals?(this.deals=a.deals,this.total=a.total||a.deals.length,this.showing=a.showing||Math.min(a.deals.length,10)):(this.deals=[],this.total=0,this.showing=0)}catch(t){console.error("Error fetching deals data:",t),this.error=t.message,this.deals=[],this.total=0,this.showing=0}finally{this.loading=!1}},init(){this.fetchDeals(),setInterval(()=>{this.fetchDeals()},12e4)}}}export default dealsTable;
|
||||
@@ -0,0 +1 @@
|
||||
function kpiCard(t,e){return{value:0,change:0,loading:!0,error:null,formatValue(t,e=""){if(!t&&0!==t)return"0"+e;const a=parseFloat(t);return isNaN(a)?"0"+e:a>=1e6?(a/1e6).toFixed(1)+"M"+e:a>=1e3?(a/1e3).toFixed(1)+"k"+e:a.toString()+e},getChangeInfo:t=>t>0?{icon:"ri-arrow-up-s-line",class:"text-success"}:t<0?{icon:"ri-arrow-down-s-line",class:"text-danger"}:{icon:"",class:"text-muted"},async fetchData(){try{this.loading=!0,this.error=null;const a=await fetch(t);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const r=await a.json();r&&r[e]?(this.value=r[e].value||r[e],this.change=r[e].change||0):r&&"object"==typeof r?(this.value=r[e]||0,this.change=0):(this.value=r||0,this.change=0)}catch(t){console.error("Error fetching KPI data:",t),this.error=t.message,this.value=0,this.change=0}finally{this.loading=!1}},init(){this.fetchData()}}}export default kpiCard;
|
||||
@@ -0,0 +1 @@
|
||||
function tasksSummary(t){return{tasks:[],completed:0,total:0,loading:!0,error:null,async fetchTasks(){try{this.loading=!0,this.error=null;const s=await fetch(t);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const a=await s.json();a&&Array.isArray(a)?(this.tasks=a,this.total=a.length,this.completed=a.filter(t=>t.completed).length):a&&a.tasks?(this.tasks=a.tasks,this.total=a.total||a.tasks.length,this.completed=a.completed||a.tasks.filter(t=>t.completed).length):(this.tasks=[],this.total=0,this.completed=0)}catch(t){console.error("Error fetching tasks data:",t),this.error=t.message,this.tasks=[],this.total=0,this.completed=0}finally{this.loading=!1}},init(){this.fetchTasks(),setInterval(()=>{this.fetchTasks()},18e4)}}}export default tasksSummary;
|
||||
@@ -0,0 +1 @@
|
||||
export default function crmCalendar(){return{currentYear:(new Date).getFullYear(),currentMonth:(new Date).getMonth()+1,events:[],loading:!1,showAddModal:!1,selectedDate:null,newEvent:{title:"",description:"",event_type:"meeting",start_date:"",start_time:"",end_date:"",end_time:"",all_day:!1,location:"",color:"#3788d8",priority:"medium",status:"scheduled"},init(){const t=new URLSearchParams(window.location.search);this.currentYear=parseInt(t.get("year"))||this.currentYear,this.currentMonth=parseInt(t.get("month"))||this.currentMonth,this.loadEvents()},get monthNames(){return["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"]},get currentMonthName(){return`${this.monthNames[this.currentMonth-1]} ${this.currentYear}`},get calendarDays(){const t=new Date(this.currentYear,this.currentMonth-1,1),e=(new Date(this.currentYear,this.currentMonth,0),new Date(t));e.setDate(e.getDate()-t.getDay());const r=[],n=new Date;for(let t=0;t<42;t++){const o=new Date(e);o.setDate(e.getDate()+t);const a=o.getDate(),s=o.getMonth()===this.currentMonth-1,i=o.toDateString()===n.toDateString(),c=o.toISOString().split("T")[0],h=this.getEventsForDate(c);r.push({date:o,dayNumber:a,isCurrentMonth:s,isToday:i,dateString:c,events:h})}return r},getEventsForDate(t){return this.events.filter(e=>e.start_date===t)},async loadEvents(){this.loading=!0;try{const t=new Date(this.currentYear,this.currentMonth-1,1).toISOString().split("T")[0],e=new Date(this.currentYear,this.currentMonth,0).toISOString().split("T")[0],r=await fetch(`/api/crm/calendar/events?start=${t}&end=${e}`);if(r.ok){const t=await r.json();this.events=t||[]}}catch(t){console.error("Erro ao carregar eventos:",t),this.showAlert("Erro ao carregar eventos","error")}finally{this.loading=!1}},previousMonth(){1===this.currentMonth?(this.currentMonth=12,this.currentYear--):this.currentMonth--,this.updateURL(),this.loadEvents()},nextMonth(){12===this.currentMonth?(this.currentMonth=1,this.currentYear++):this.currentMonth++,this.updateURL(),this.loadEvents()},goToToday(){const t=new Date;this.currentYear=t.getFullYear(),this.currentMonth=t.getMonth()+1,this.updateURL(),this.loadEvents()},changeView(t){let e;switch(t){case"month":default:e="/apps/crm/calendar";break;case"week":e="/apps/crm/calendar/week";break;case"day":e="/apps/crm/calendar/day"}window.location.href=e},updateURL(){const t=new URL(window.location);t.searchParams.set("year",this.currentYear),t.searchParams.set("month",this.currentMonth),window.history.pushState({},"",t)},showAddEventModal(t=null){this.selectedDate=t,t&&(this.newEvent.start_date=t),this.showAddModal=!0},async addEvent(){try{const t=await fetch("/api/crm/calendar/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.newEvent)});if(t.ok)this.showAlert("Evento criado com sucesso","success"),this.showAddModal=!1,this.resetNewEvent(),this.loadEvents();else{const e=await t.json();this.showAlert(e.message||"Erro ao criar evento","error")}}catch(t){console.error("Erro ao criar evento:",t),this.showAlert("Erro ao criar evento","error")}},resetNewEvent(){this.newEvent={title:"",description:"",event_type:"meeting",start_date:"",start_time:"",end_date:"",end_time:"",all_day:!1,location:"",color:"#3788d8",priority:"medium",status:"scheduled"}},showEventDetails(t){window.Swal?window.Swal.fire({title:t.title,html:`\n <div class="text-start">\n <p><strong>Descrição:</strong> ${t.description||"N/A"}</p>\n <p><strong>Tipo:</strong> ${t.event_type}</p>\n <p><strong>Data:</strong> ${t.start_date}</p>\n <p><strong>Hora:</strong> ${t.start_time||"Todo o dia"}</p>\n <p><strong>Local:</strong> ${t.location||"N/A"}</p>\n <p><strong>Prioridade:</strong> ${t.priority}</p>\n <p><strong>Status:</strong> ${t.status}</p>\n </div>\n `,icon:"info",confirmButtonText:"Editar",showCancelButton:!0,cancelButtonText:"Fechar",showDenyButton:!0,denyButtonText:"Eliminar"}).then(e=>{e.isConfirmed?this.editEvent(t.id):e.isDenied&&this.deleteEvent(t.id)}):alert(`Evento: ${t.title}\nDescrição: ${t.description||"N/A"}`)},showAlert(t,e="info"){window.Swal?window.Swal.fire({title:"success"===e?"Sucesso!":"Atenção",text:t,icon:e,confirmButtonText:"OK"}):alert(t)},getEventClass(t){const e=["calendar-event"];return"high"===t.priority?e.push("high-priority"):"medium"===t.priority?e.push("medium-priority"):"low"===t.priority&&e.push("low-priority"),e.join(" ")},async loadTodayEvents(){try{const t=await fetch("/api/crm/calendar/today");if(t.ok)return(await t.json()).events||[]}catch(t){console.error("Erro ao carregar eventos de hoje:",t)}return[]},async loadUpcomingEvents(){try{const t=await fetch("/api/crm/calendar/upcoming?limit=5");if(t.ok)return(await t.jLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({totalContacts:null,activeLeads:null,newThisMonth:null,conversionRate:null,async init(){try{const e=await fetch("/api/dashboard/crm/summary");if(e.ok){const t=await e.json();this.totalContacts=t.total_contactos,this.activeLeads=t.leads_ativos,this.newThisMonth=t.novos_mes,this.conversionRate=t.taxa_conversao}}catch(e){}this.initSalesForecastChart(),this.initDealTypeChart(),this.initRevenueExpensesChart()},initSalesForecastChart(){const e={series:[{name:"Goal",data:[37]},{name:"Pending Forecast",data:[12]},{name:"Revenue",data:[18]}],chart:{type:"bar",height:341,toolbar:{show:!1}},plotOptions:{bar:{horizontal:!1,columnWidth:"65%"}},stroke:{show:!0,width:5,colors:["transparent"]},xaxis:{categories:[""],axisTicks:{show:!1,borderType:"solid",color:"#78909C",height:6,offsetX:0,offsetY:0},title:{text:"Total Forecasted Value",offsetX:0,offsetY:-30,style:{color:"#78909C",fontSize:"12px",fontWeight:400}}},yaxis:{labels:{formatter:e=>`$${e}k`},tickAmount:4,min:0},fill:{opacity:1},legend:{show:!0,position:"bottom",horizontalAlign:"center",fontWeight:500,offsetX:0,offsetY:-14,itemMargin:{horizontal:8,vertical:0},markers:{width:10,height:10}}};this.$nextTick(()=>{window.ApexCharts&&document.getElementById("sales-forecast-chart")&&new ApexCharts(document.getElementById("sales-forecast-chart"),e).render()})},initDealTypeChart(){const e={series:[{name:"Pending",data:[80,50,30,40,100,20]},{name:"Loss",data:[20,30,40,80,20,80]},{name:"Won",data:[44,76,78,13,43,10]}],chart:{height:341,type:"radar",dropShadow:{enabled:!0,blur:1,left:1,top:1},toolbar:{show:!1}},stroke:{width:2},fill:{opacity:.2},legend:{show:!0,fontWeight:500,offsetX:0,offsetY:-8,markers:{width:8,height:8,radius:6},itemMargin:{horizontal:10,vertical:0}},markers:{size:0},xaxis:{categories:["2016","2017","2018","2019","2020","2021"]}};this.$nextTick(()=>{window.ApexCharts&&document.getElementById("deal-type-charts")&&new ApexCharts(document.getElementById("deal-type-charts"),e).render()})},initRevenueExpensesChart(){const e={series:[{name:"Revenue",data:[20,25,30,35,40,55,70,110,150,180,210,250]},{name:"Expenses",data:[12,17,45,42,24,35,42,75,102,108,156,199]}],chart:{height:290,type:"area",toolbar:{show:!1}},stroke:{curve:"smooth",width:2},fill:{type:"gradient",gradient:{shadeIntensity:1,opacityFrom:.7,opacityTo:.2,stops:[0,90,100]}},xaxis:{categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},yaxis:{labels:{formatter:e=>`$${e}k`}},legend:{position:"top",horizontalAlign:"right"}};this.$nextTick(()=>{window.ApexCharts&&document.getElementById("revenue-expenses-charts")&&new ApexCharts(document.getElementById("revenue-expenses-charts"),e).render()})}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({isLoading:!0,stats:{},liveUsers:{count:0,countries:[]},sessionsByCountry:{series:[],categories:[]},topReferrals:[],topPages:[],init(){this.fetchData()},fetchData(){this.isLoading=!0,fetch("/api/analytics/dashboard").then(e=>e.json()).then(e=>{if(e.success&&e.data){const s=e.data;this.stats=s.stats||{},this.liveUsers=s.liveUsers||{count:0,countries:[]},this.sessionsByCountry=s.sessionsByCountry||{series:[],categories:[]},this.topReferrals=s.topReferrals||[],this.topPages=s.topPages||[],this.isLoading=!1,this.$dispatch("update-sessions-by-country-chart",{series:this.sessionsByCountry.series,categories:this.sessionsByCountry.categories}),this.$dispatch("update-live-users-map",{data:this.liveUsers.countries})}else console.error("Failed to fetch valid analytics data:",e.error||"Unknown error"),this.isLoading=!1}).catch(e=>{console.error("Error fetching analytics data:",e),this.isLoading=!1})},renderSessionsByCountryChart(e){if("undefined"==typeof ApexCharts)return void setTimeout(()=>this.renderSessionsByCountryChart(e),50);if(!e.series||!e.categories)return;var s={series:e.series,chart:{type:"bar",height:436,toolbar:{show:!1}},plotOptions:{bar:{borderRadius:4,horizontal:!0,distributed:!0,dataLabels:{position:"bottom"}}},colors:["#405189","#0AB39C","#F7B84B","#F06548","#299CDB"],dataLabels:{enabled:!0,textAnchor:"start",style:{colors:["#fff"]},formatter:function(e,s){return s.w.globals.labels[s.dataPointIndex]+": "+e},offsetX:0,dropShadow:{enabled:!0}},xaxis:{categories:e.categories},yaxis:{labels:{show:!1}},tooltip:{theme:"dark",x:{show:!1},y:{title:{formatter:function(){return""}}}}};const t=document.getElementById("sessions-by-countries");t.innerHTML&&(t.innerHTML=""),new ApexCharts(t,s).render()},renderLiveUsersMap(e){if("undefined"==typeof jsVectorMap||!e.data)return;const s=document.getElementById("live-users-by-country");s.innerHTML&&(s.innerHTML="");var t=e.data.map(e=>({name:e.name,coords:[e.latitude,e.longitude],style:{fill:"#405189"},value:e.value}));new jsVectorMap({map:"world_merc",selector:"#live-users-by-country",zoomOnScroll:!1,zoomButtons:!1,regionStyle:{initial:{fill:"#e9e9ef"}},markers:t.map(e=>({name:e.name,coords:e.coords,style:e.style})),markerLabelStyle:{initial:{fontWeight:"500",fontSize:13}},labels:{markers:{render:function(e){const s=t.find(s=>s.name===e.name);return s?`${s.name} (${s.value})`:e.name}}}})},formatNumber:(e,s="")=>null==e?"0":e.toLocaleString("en-US")+s,getChangeHtml(e){if(0===e||null==e)return'<span class="text-muted">0%</span>';const s=e>0;return`<span class="text-${s?"success":"danger"} fs-13"><i class="align-middle ${s?"ri-arrow-right-up-line":"ri-arrow-right-down-line"}"></i> ${Math.abs(e)}%</span>`}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("dashboardBlog component initialized")}});
|
||||
@@ -0,0 +1 @@
|
||||
export default function dashboardEcommerce(){return{isLoading:!0,products:[],categories:[],brands:[],stats:{all:0,published:0,draft:0},init(){window.addEventListener("load",()=>{this.fetchData()})},fetchData(){this.isLoading=!0,fetch("/api/ecommerce/dashboard").then(t=>{if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}).then(t=>{t.success&&t.data?(this.products=t.data.products||[],this.categories=t.data.categories||[],this.brands=t.data.brands||[],this.stats=t.data.stats||{all:0,published:0,draft:0}):console.error("API response was not successful or data is missing.")}).catch(t=>{console.error("Error fetching ecommerce data:",t)}).finally(()=>{this.isLoading=!1,this.waitForGridJsAndRender()})},waitForGridJsAndRender(){const t=setInterval(()=>{"undefined"!=typeof gridjs&&(clearInterval(t),this.renderProductsTable())},50)},renderProductsTable(){if(!this.products.length||"undefined"==typeof gridjs)return;const t=document.getElementById("table-product-list-all");t&&(t.innerHTML="",new gridjs.Grid({columns:[{name:"Product",formatter:(t,e)=>gridjs.html(`<div class="d-flex align-items-center"><img src="${e.cells[0].data.image}" alt="" class="avatar-sm rounded-circle me-2" /><a href="#" class="text-body">${e.cells[0].data.name}</a></div>`)},"Category","Stock",{name:"Price",formatter:t=>this.formatPrice(t)},"Orders","Rating","Published",{name:"Actions",width:"80px",formatter:(t,e)=>gridjs.html('<ul class="list-inline hstack gap-2 mb-0">\n <li class="list-inline-item" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-placement="top" title="View">\n <a href="#" class="text-primary d-inline-block"><i class="ri-eye-fill fs-16"></i></a>\n </li>\n <li class="list-inline-item edit" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-placement="top" title="Edit">\n <a href="#" class="text-primary d-inline-block"><i class="ri-pencil-fill fs-16"></i></a>\n </li>\n <li class="list-inline-item" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-placement="top" title="Remove">\n <a href="#" class="text-danger d-inline-block"><i class="ri-delete-bin-5-fill fs-16"></i></a>\n </li>\n </ul>')}],server:{data:()=>new Promise(t=>{t(this.products.map(t=>[{name:t.name,image:t.image},t.category,t.stock,t.price,t.orders,t.rating,t.published?"Yes":"No"]))})},pagination:{limit:10},sort:!0,search:document.getElementById("searchProductList")}).render(t))},formatNumber:t=>(new Intl.NumberFormat).format(t),formatPrice:t=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(t)}}
|
||||
@@ -0,0 +1 @@
|
||||
function getChartColorsArray(e){const t=document.getElementById(e);if(!t)return console.warn(`Chart element with id "${e}" not found.`),[];const a=t.getAttribute("data-colors");return a?JSON.parse(a).map(e=>{const t=e.replace(" ","");if(-1===t.indexOf(","))return getComputedStyle(document.documentElement).getPropertyValue(t)||t;{const a=e.split(",");if(2===a.length){let e=getComputedStyle(document.documentElement).getPropertyValue(a[0]);return e=`rgba(${e}, ${a[1]})`,e}return t}}):(console.warn(`data-colors attribute not found on chart with id "${e}".`),[])}import Alpine from"alpinejs";Alpine.data("dashboardJob",()=>({jobs:[],loading:!0,async fetchJobs(){this.loading=!0;try{const e=await fetch("/api/job/list"),t=await e.json();this.jobs=t.jobs||[]}catch(e){this.jobs=[]}this.loading=!1},init(){this.fetchJobs()}}));export default()=>({init(){console.log("Initializing dashboard-job component...");const e=getChartColorsArray("total_jobs");if(e.length>0){const t={series:[98],chart:{type:"radialBar",width:72,height:72,sparkline:{enabled:!0}},dataLabels:{enabled:!1},plotOptions:{radialBar:{hollow:{margin:0,size:"60%"},track:{margin:0},dataLabels:{show:!1}}},colors:e};new ApexCharts(document.querySelector("#total_jobs"),t).render()}const t=getChartColorsArray("apply_jobs");if(t.length>0){const e={series:[85],chart:{type:"radialBar",width:72,height:72,sparkline:{enabled:!0}},dataLabels:{enabled:!1},plotOptions:{radialBar:{hollow:{margin:0,size:"60%"},track:{margin:0},dataLabels:{show:!1}}},colors:t};new ApexCharts(document.querySelector("#apply_jobs"),e).render()}const a=getChartColorsArray("new_jobs_chart");if(a.length>0){const e={series:[60],chart:{type:"radialBar",width:72,height:72,sparkline:{enabled:!0}},dataLabels:{enabled:!1},plotOptions:{radialBar:{hollow:{margin:0,size:"60%"},track:{margin:0},dataLabels:{show:!1}}},colors:a};new ApexCharts(document.querySelector("#new_jobs_chart"),e).render()}const r=getChartColorsArray("interview_chart");if(r.length>0){const e={series:[30],chart:{type:"radialBar",width:72,height:72,sparkline:{enabled:!0}},dataLabels:{enabled:!1},plotOptions:{radialBar:{hollow:{margin:0,size:"60%"},track:{margin:0},dataLabels:{show:!1}}},colors:r};new ApexCharts(document.querySelector("#interview_chart"),e).render()}const o=getChartColorsArray("hired_chart");if(o.length>0){const e={series:[75],chart:{type:"radialBar",width:72,height:72,sparkline:{enabled:!0}},dataLabels:{enabled:!1},plotOptions:{radialBar:{hollow:{margin:0,size:"60%"},track:{margin:0},dataLabels:{show:!1}}},colors:o};new ApexCharts(document.querySelector("#hired_chart"),e).render()}const l=getChartColorsArray("rejected_chart");if(l.length>0){const e={series:[25],chart:{type:"radialBar",width:72,height:72,sparkline:{enabled:!0}},dataLabels:{enabled:!1},plotOptions:{radialBar:{hollow:{margin:0,size:"60%"},track:{margin:0},dataLabels:{show:!1}}},colors:l};new ApexCharts(document.querySelector("#rejected_chart"),e).render()}const n=getChartColorsArray("sales-by-locations");n.length>0&&(document.getElementById("sales-by-locations").innerHTML="",new jsVectorMap({map:"world_merc",selector:"#sales-by-locations",zoomOnScroll:!1,zoomButtons:!1,selectedMarkers:[0,5],regionStyle:{initial:{stroke:"#9599ad",strokeWidth:.25,fill:n[0],fillOpacity:1}},markersSelectable:!0,markers:[{name:"Palestine",coords:[31.9474,35.2272]},{name:"Russia",coords:[61.524,105.3188]},{name:"Canada",coords:[56.1304,-106.3468]},{name:"Greenland",coords:[71.7069,-42.6043]}],markerStyle:{initial:{fill:n[1]},selected:{fill:n[2]}},labels:{markers:{render:e=>e.name}}}))}});
|
||||
@@ -0,0 +1 @@
|
||||
function dashboardNft(){return{recentSales:[],topCollections:[],trendingCollections:[],totalVolume:0,activeUsers:0,loading:!0,error:null,async init(){this.loading=!0;try{await this.loadDashboardData()}catch(t){console.error("Error initializing NFT dashboard:",t),this.error="Failed to load dashboard data"}finally{this.loading=!1}},async loadDashboardData(){try{const[t,a,o]=await Promise.all([fetch("/api/nft/dashboard/recent-sales"),fetch("/api/nft/dashboard/top-collections"),fetch("/api/nft/dashboard/summary")]);if(t.ok?this.recentSales=await t.json():(this.recentSales=[],console.warn("Failed to load recent sales")),a.ok?this.topCollections=await a.json():(this.topCollections=[],console.warn("Failed to load top collections")),o.ok){const t=await o.json();this.totalVolume=t.total_volume||0,this.activeUsers=t.active_users||0,this.trendingCollections=t.trending_collections||[]}else console.warn("Failed to load NFT summary")}catch(t){console.error("Error loading NFT dashboard data:",t),this.recentSales=[],this.topCollections=[],this.trendingCollections=[],this.totalVolume=0,this.activeUsers=0}},async refresh(){await this.loadDashboardData()},formatCurrency:t=>new Intl.NumberFormat("pt-PT",{style:"currency",currency:"EUR"}).format(t),formatNumber:t=>t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":t.toString(),formatDate:t=>new Date(t).toLocaleDateString("pt-PT",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}}export default dashboardNft;
|
||||
@@ -0,0 +1 @@
|
||||
import Alpine from"alpinejs";Alpine.data("dashboardProjects",()=>({projects:[],loading:!0,async fetchProjects(){this.loading=!0;try{const t=await fetch("/api/projects/list"),s=await t.json();this.projects=s.projects||[]}catch(t){this.projects=[]}this.loading=!1},init(){this.fetchProjects()}}));
|
||||
@@ -0,0 +1 @@
|
||||
export function editRedirect(){return{redirect:null,loading:!0,error:null,saving:!1,success:!1,get redirectId(){const e=window.location.pathname.match(/\/redirects\/redirects\/(\d+)\/edit/);return e?e[1]:null},async loadRedirect(){if(!this.redirectId)return this.error="ID do redirect não encontrado",void(this.loading=!1);try{const e=await fetch(`/api/redirects/${this.redirectId}`),t=await e.json();t.success?(this.redirect=t.data.redirect,this.redirect={name:this.redirect.name||"",source_url:this.redirect.source_url||"",target_url:this.redirect.target_url||"",fallback_url:this.redirect.fallback_url||"",status:void 0!==this.redirect.status?this.redirect.status:1,redirect_type:this.redirect.redirect_type||"302",tracking_enabled:void 0!==this.redirect.tracking_enabled?this.redirect.tracking_enabled:1,max_clicks:this.redirect.max_clicks||null,expires_at:this.redirect.expires_at||null,...this.redirect}):this.error=t.message||"Erro ao carregar dados do redirect"}catch(e){this.error="Erro de ligação ao servidor",console.error("Error loading redirect:",e)}finally{this.loading=!1}},async updateRedirect(){if(this.redirect){this.saving=!0,this.error=null,this.success=!1;try{const e=document.getElementById("editRedirectForm"),t=new FormData(e),r=document.getElementById("status-toggle"),i=r&&"boolean"==typeof r.checked?r.checked?1:0:this.redirect?.status?1:0;t.set("status",i);const s={name:t.get("name"),source_url:t.get("source_url"),target_url:t.get("target_url"),fallback_url:t.get("fallback_url")||"",status:parseInt(t.get("status"),10),redirect_type:t.get("redirect_type"),tracking_enabled:t.get("tracking_enabled")?1:0,max_clicks:t.get("max_clicks")?parseInt(t.get("max_clicks")):null,expires_at:t.get("expires_at")||null},c=await fetch(`/api/redirects/${this.redirectId}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await c.json();a.success?(this.success=!0,this.redirect={...this.redirect,...s},setTimeout(()=>{this.success=!1},3e3)):this.error=a.message||"Erro ao atualizar redirect"}catch(e){this.error="Erro de ligação ao servidor",console.error("Error updating redirect:",e)}finally{this.saving=!1}}},formatDateForInput:e=>e?new Date(e).toISOString().slice(0,16):"",goBack(){window.location.href="/redirects/redirects"}}}
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({multiSelects:{},autoCompletes:{},selectedOptions:{},searchResults:{},init(){console.log("formAdvanced component initialized"),this.setupMultiSelects(),this.setupAutoCompletes()},setupMultiSelects(){const e=document.getElementById("multiselect-basic");e&&"undefined"!=typeof multi&&(this.multiSelects.basic=multi(e,{enable_search:!1}));const t=document.getElementById("multiselect-header");t&&"undefined"!=typeof multi&&(this.multiSelects.header=multi(t,{non_selected_header:"Cars",selected_header:"Favorite Cars"}));const s=document.getElementById("multiselect-optiongroup");s&&"undefined"!=typeof multi&&(this.multiSelects.optGroup=multi(s,{enable_search:!0})),document.querySelectorAll("[data-multiselect]").forEach((e,t)=>{if("undefined"!=typeof multi){const s=this.parseMultiSelectConfig(e);this.multiSelects[`custom_${t}`]=multi(e,s)}})},parseMultiSelectConfig(e){const t={};return e.hasAttribute("data-enable-search")&&(t.enable_search="true"===e.getAttribute("data-enable-search")),e.hasAttribute("data-non-selected-header")&&(t.non_selected_header=e.getAttribute("data-non-selected-header")),e.hasAttribute("data-selected-header")&&(t.selected_header=e.getAttribute("data-selected-header")),e.hasAttribute("data-max-items")&&(t.max_items=parseInt(e.getAttribute("data-max-items"))),e.hasAttribute("data-search-option")&&(t.search_option="true"===e.getAttribute("data-search-option")),t},setupAutoCompletes(){document.getElementById("autoCompleteFruit")&&"undefined"!=typeof autoComplete&&(this.autoCompletes.fruit=new autoComplete({selector:"#autoCompleteFruit",placeHolder:"Search for Fruits...",data:{src:["Apple","Banana","Blueberry","Cherry","Coconut","Kiwi","Lemon","Lime","Mango","Orange"],cache:!0},resultsList:{element:(e,t)=>{if(!t.results.length){const s=document.createElement("div");s.setAttribute("class","no_result"),s.innerHTML=`<span>Found No Results for "${t.query}"</span>`,e.prepend(s)}},noResults:!0},resultItem:{highlight:!0},events:{input:{selection:e=>{const t=e.detail.selection.value;this.autoCompletes.fruit.input.value=t,this.selectedOptions.fruit=t}}}})),document.getElementById("autoCompleteCars")&&"undefined"!=typeof autoComplete&&(this.autoCompletes.cars=new autoComplete({selector:"#autoCompleteCars",placeHolder:"Search for Cars...",data:{src:["Chevrolet","Fiat","Ford","Honda","Hyundai","Kia","Mahindra","Maruti","Mitsubishi","MG","Nissan","Renault","Skoda","Tata","Toyota","Volkswagen"],cache:!0},resultsList:{element:(e,t)=>{if(!t.results.length){const s=document.createElement("div");s.setAttribute("class","no_result"),s.innerHTML=`<span>Found No Results for "${t.query}"</span>`,e.prepend(s)}},noResults:!0},resultItem:{highlight:!0},events:{input:{selection:e=>{const t=e.detail.selection.value;this.autoCompletes.cars.input.value=t,this.selectedOptions.cars=t}}}})),document.querySelectorAll("[data-autocomplete]").forEach((e,t)=>{if("undefined"!=typeof autoComplete){const s=this.parseAutocompleteConfig(e);this.autoCompletes[`custom_${t}`]=new autoComplete(s)}})},parseAutocompleteConfig(e){return{selector:`#${e.id}`,placeHolder:e.getAttribute("data-placeholder")||"Search...",data:{src:this.parseDataSrc(e),cache:!0},resultsList:{element:(e,t)=>{if(!t.results.length){const s=document.createElement("div");s.setAttribute("class","no_result"),s.innerHTML=`<span>Found No Results for "${t.query}"</span>`,e.prepend(s)}},noResults:!0},resultItem:{highlight:!0},events:{input:{selection:t=>{const s=t.detail.selection.value;e.value=s,this.selectedOptions[e.id]=s}}}}},parseDataSrc(e){if(e.hasAttribute("data-src"))try{return JSON.parse(e.getAttribute("data-src"))}catch(t){return e.getAttribute("data-src").split(",")}return[]},getMultiSelectValues(e){const t=this.multiSelects[e];return t?t.getSelected():[]},setMultiSelectValues(e,t){const s=this.multiSelects[e];s&&s.setSelectedByValue(t)},getAutocompleteValue(e){return this.selectedOptions[e]||""},setAutocompleteValue(e,t){const s=this.autoCompletes[e];s&&(s.input.value=t,this.selectedOptions[e]=t)},clearMultiSelect(e){const t=this.multiSelects[e];t&&t.deselect_all()},clearAutocomplete(e){const t=this.autoCompletes[e];t&&(t.input.value="",delete this.selectedOptions[e])},addMultiSelectOption(e,t,s){const l=document.getElementById(e);if(l){const a=document.createElement("option");a.value=t,a.textContent=s,l.appendChild(a);const o=this.multiSelects[e];o&&o.refresh()}},removeMultiSelectOption(e,t){const s=document.getElementById(e);if(s){const l=s.querySelector(`option[value="${t}"]`);if(l){l.remove();const t=this.multiSelects[e];t&&t.refresh()}}},updateAutocompleteData(e,t){const s=this.autoCompletes[e];s&&(s.data.src=t,s.refresh())},validateMultiSelect(e,t=1,s=null){const l=this.getMultiSelectValues(e);return l.length<t?{valid:!1,message:`Please select at least ${t} item(s)`}:s&&l.length>s?{valid:!1,message:`Please select no more than ${s} item(s)`}:{valid:!0,values:l}},validateAutocomplete(e,t=!0){const s=this.getAutocompleteValue(e);return t&&!s?{validLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({ckEditors:{},quillEditors:{},editorContent:{},init(){console.log("formEditor component initialized"),this.setupCKEditors(),this.setupQuillEditors()},setupCKEditors(){document.querySelectorAll(".ckeditor-classic").forEach((t,e)=>{"undefined"!=typeof ClassicEditor&&ClassicEditor.create(t,{toolbar:{items:["heading","|","bold","italic","link","bulletedList","numberedList","|","outdent","indent","|","imageUpload","blockQuote","insertTable","mediaEmbed","undo","redo"]},language:"en",image:{toolbar:["imageTextAlternative","imageStyle:full","imageStyle:side"]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells"]},licenseKey:""}).then(t=>{this.ckEditors[`classic_${e}`]=t,t.ui.view.editable.element.style.height="200px",this.editorContent[`classic_${e}`]=t.getData(),t.model.document.on("change:data",()=>{this.editorContent[`classic_${e}`]=t.getData()})}).catch(t=>{console.error("CKEditor error:",t)})}),document.querySelectorAll("[data-ckeditor]").forEach((t,e)=>{if("undefined"!=typeof ClassicEditor){const i=this.parseCKEditorConfig(t);ClassicEditor.create(t,i).then(t=>{this.ckEditors[`custom_${e}`]=t,this.editorContent[`custom_${e}`]=t.getData(),t.model.document.on("change:data",()=>{this.editorContent[`custom_${e}`]=t.getData()})}).catch(t=>{console.error("Custom CKEditor error:",t)})}})},parseCKEditorConfig(t){const e={toolbar:{items:["heading","|","bold","italic","link","bulletedList","numberedList","|","outdent","indent","|","imageUpload","blockQuote","insertTable","mediaEmbed","undo","redo"]},language:"en"};if(t.hasAttribute("data-toolbar"))try{e.toolbar=JSON.parse(t.getAttribute("data-toolbar"))}catch(t){console.warn("Invalid toolbar configuration")}return t.hasAttribute("data-height")&&(e.height=t.getAttribute("data-height")),t.hasAttribute("data-language")&&(e.language=t.getAttribute("data-language")),e},setupQuillEditors(){document.querySelectorAll(".snow-editor").forEach((t,e)=>{if("undefined"!=typeof Quill){const i={theme:"snow",modules:{toolbar:[[{font:[]},{size:[]}],["bold","italic","underline","strike"],[{color:[]},{background:[]}],[{script:"super"},{script:"sub"}],[{header:[!1,1,2,3,4,5,6]},"blockquote","code-block"],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"}],["direction",{align:[]}],["link","image","video"],["clean"]]}};this.quillEditors[`snow_${e}`]=new Quill(t,i),this.editorContent[`snow_${e}`]=this.quillEditors[`snow_${e}`].root.innerHTML,this.quillEditors[`snow_${e}`].on("text-change",()=>{this.editorContent[`snow_${e}`]=this.quillEditors[`snow_${e}`].root.innerHTML})}}),document.querySelectorAll(".bubble-editor").forEach((t,e)=>{if("undefined"!=typeof Quill){const i={theme:"bubble",modules:{toolbar:[["bold","italic","underline"],["link","image"],["clean"]]}};this.quillEditors[`bubble_${e}`]=new Quill(t,i),this.editorContent[`bubble_${e}`]=this.quillEditors[`bubble_${e}`].root.innerHTML,this.quillEditors[`bubble_${e}`].on("text-change",()=>{this.editorContent[`bubble_${e}`]=this.quillEditors[`bubble_${e}`].root.innerHTML})}}),document.querySelectorAll("[data-quill]").forEach((t,e)=>{if("undefined"!=typeof Quill){const i=this.parseQuillConfig(t);this.quillEditors[`custom_${e}`]=new Quill(t,i),this.editorContent[`custom_${e}`]=this.quillEditors[`custom_${e}`].root.innerHTML,this.quillEditors[`custom_${e}`].on("text-change",()=>{this.editorContent[`custom_${e}`]=this.quillEditors[`custom_${e}`].root.innerHTML})}})},parseQuillConfig(t){const e={theme:"snow",modules:{toolbar:[["bold","italic","underline"],["link","image"],["clean"]]}};if(t.hasAttribute("data-theme")&&(e.theme=t.getAttribute("data-theme")),t.hasAttribute("data-toolbar"))try{e.modules.toolbar=JSON.parse(t.getAttribute("data-toolbar"))}catch(t){console.warn("Invalid toolbar configuration")}return t.hasAttribute("data-placeholder")&&(e.placeholder=t.getAttribute("data-placeholder")),e},getEditorContent(t){return this.editorContent[t]||""},setEditorContent(t,e){const i=this.ckEditors[t],o=this.quillEditors[t];i&&(i.setData(e),this.editorContent[t]=e),o&&(o.root.innerHTML=e,this.editorContent[t]=e)},getPlainText(t){const e=this.ckEditors[t],i=this.quillEditors[t];return e?e.getData().replace(/<[^>]*>/g,""):i?i.getText():""},insertContent(t,e){const i=this.ckEditors[t],o=this.quillEditors[t];if(i){const t=i.data.processor.toView(e),o=i.data.toModel(t);i.model.insertContent(o)}if(o){const t=o.getSelection();t&&o.insertEmbed(t.index,"image",e)}},clearEditor(t){this.setEditorContent(t,"")},setEditorReadOnly(t,e){const i=this.ckEditors[t],o=this.quillEditors[t];i&&(i.isReadOnly=e),o&&o.enable(!e)},focusEditor(t){const e=this.ckEditors[t],i=this.quillEditors[t];e&&e.focus(),i&&i.focus()},getEditorStats(t){const e=this.getEditorContent(t),i=this.getPlainText(t);return{characters:i.length,words:i.split(/\s+/).filter(t=>t.length>0).length,paragraphs:(e.match(/<p[^>]*>/g)||[]).length,images:(e.match(/<img[^>]*>/g)||[]).length,links:(e.match(/<a[^>]*>/g)||[]).length}},destroyEditor(t){const e=this.cLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({uploadedFiles:[],isUploading:!1,uploadProgress:0,init(){this.setupDropzone(),this.setupFilePond(),this.setupCustomUploads()},setupDropzone(){const e=document.querySelector("#dropzone-preview-list");if(e&&"undefined"!=typeof Dropzone){e.id="";const o=e.parentNode.innerHTML;e.parentNode.removeChild(e),new Dropzone(".dropzone",{url:"https://httpbin.org/post",method:"post",previewTemplate:o,previewsContainer:"#dropzone-preview",maxFiles:10,maxFilesize:5,acceptedFiles:"image/*,.pdf,.doc,.docx",addRemoveLinks:!0,dictDefaultMessage:"Drop files here or click to upload",dictFileTooBig:"File is too big ({{filesize}}MB). Max filesize: {{maxFilesize}}MB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictMaxFilesExceeded:"You can not upload any more files.",init:function(){this.on("addedfile",e=>{console.log("File added:",e.name)}),this.on("success",(e,o)=>{console.log("File uploaded successfully:",e.name)}),this.on("error",(e,o)=>{console.error("Upload error:",o)})}})}},setupFilePond(){if("undefined"!=typeof FilePond){"undefined"!=typeof FilePondPluginFileEncode&&FilePond.registerPlugin(FilePondPluginFileEncode,FilePondPluginFileValidateSize,FilePondPluginImageExifOrientation,FilePondPluginImagePreview),document.querySelectorAll("input.filepond-input-multiple").forEach(e=>{FilePond.create(e,{server:{url:"https://httpbin.org/post",process:{method:"POST",withCredentials:!1,headers:{},timeout:7e3,onload:e=>JSON.parse(e).files.file,onerror:e=>e.data,ondata:e=>e}},maxFiles:10,maxFileSize:"5MB",acceptedFileTypes:["image/*",".pdf",".doc",".docx"],labelIdle:'Drag & Drop files or <span class="filepond--label-action">Browse</span>',labelFileProcessing:"Uploading",labelFileProcessingComplete:"Upload complete",labelTapToCancel:"Tap to cancel",labelTapToRetry:"Tap to retry",labelTapToUndo:"Tap to undo"})});const e=document.querySelector(".filepond-input-circle");e&&FilePond.create(e,{labelIdle:'Drag & Drop your picture or <span class="filepond--label-action">Browse</span>',imagePreviewHeight:170,imageCropAspectRatio:"1:1",imageResizeTargetWidth:200,imageResizeTargetHeight:200,stylePanelLayout:"compact circle",styleLoadIndicatorPosition:"center bottom",styleProgressIndicatorPosition:"right bottom",styleButtonRemoveItemPosition:"left bottom",styleButtonProcessItemPosition:"right bottom",server:{url:"https://httpbin.org/post",process:{method:"POST",withCredentials:!1,headers:{},timeout:7e3,onload:e=>JSON.parse(e).files.file}}})}},setupCustomUploads(){const e=document.querySelector("#profile-img-file-input");e&&e.addEventListener("change",e=>{this.handleProfileImageUpload(e)}),document.querySelectorAll(".custom-file-input").forEach(e=>{e.addEventListener("change",e=>{this.handleCustomFileUpload(e)})})},handleProfileImageUpload(e){const o=e.target.files[0],t=document.querySelector(".user-profile-image");if(o&&t){if(!o.type.startsWith("image/"))return void alert("Please select an image file.");if(o.size>5242880)return void alert("File size must be less than 5MB.");const e=new FileReader;e.onload=e=>{t.src=e.target.result,console.log("Profile image updated")},e.readAsDataURL(o)}},handleCustomFileUpload(e){const o=e.target.files[0],t=e.target.nextElementSibling;o?(t.textContent=o.name,this.uploadedFiles.push({name:o.name,size:o.size,type:o.type,file:o})):t.textContent="Choose file"},async uploadFiles(e,o="/api/upload"){this.isUploading=!0,this.uploadProgress=0;const t=new FormData;e.forEach((e,o)=>{t.append(`file_${o}`,e)});try{const e=await fetch(o,{method:"POST",body:t});if(e.ok){const o=await e.json();return console.log("Files uploaded successfully:",o),this.uploadedFiles=[],o}throw new Error("Upload failed")}catch(e){throw console.error("Upload error:",e),e}finally{this.isUploading=!1,this.uploadProgress=0}},removeFile(e){this.uploadedFiles.splice(e,1)},formatFileSize(e){if(0===e)return"0 Bytes";const o=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,o)).toFixed(2))+" "+["Bytes","KB","MB","GB"][o]}});
|
||||
@@ -0,0 +1 @@
|
||||
export default()=>({init(){console.log("formInputSpin component initialized"),this.setupSpinInputs()},setupSpinInputs(){document.querySelectorAll(".plus").forEach((t,e)=>{t.addEventListener("click",t=>{this.incrementValue(t.target)})}),document.querySelectorAll(".minus").forEach((t,e)=>{t.addEventListener("click",t=>{this.decrementValue(t.target)})}),document.querySelectorAll("[data-spin]").forEach((t,e)=>{this.setupCustomSpinInput(t,e)}),document.querySelectorAll(".product").forEach((t,e)=>{this.setupProductInput(t,e)})},setupCustomSpinInput(t,e){const n=this.parseSpinConfig(t),s=`custom_${e}`;this.spinInputs[s]={element:t,config:n,value:parseInt(t.value)||n.default||0},this.currentValues[s]=this.spinInputs[s].value,t.nextElementSibling&&t.nextElementSibling.classList.contains("spin-buttons")||this.createSpinButtons(t,s)},setupProductInput(t,e){const n=`product_${e}`;this.spinInputs[n]={element:t,config:{min:parseInt(t.getAttribute("min"))||0,max:parseInt(t.getAttribute("max"))||999,step:parseInt(t.getAttribute("step"))||1,default:parseInt(t.value)||0},value:parseInt(t.value)||0},this.currentValues[n]=this.spinInputs[n].value,t.addEventListener("input",t=>{this.updateProductQuantity(t.target)})},parseSpinConfig:t=>({min:parseInt(t.getAttribute("data-min"))||0,max:parseInt(t.getAttribute("data-max"))||999,step:parseInt(t.getAttribute("data-step"))||1,default:parseInt(t.getAttribute("data-default"))||0,decimals:parseInt(t.getAttribute("data-decimals"))||0}),createSpinButtons(t,e){const n=document.createElement("div");n.className="spin-buttons d-flex flex-column",n.style.cssText="position: absolute; right: 0; top: 0; height: 100%; z-index: 10;";const s=document.createElement("button");s.type="button",s.className="btn btn-sm btn-outline-secondary plus-spin",s.innerHTML='<i class="bx bx-plus"></i>',s.style.cssText="border-radius: 0; border-left: 0; border-bottom: 0; flex: 1;";const a=document.createElement("button");a.type="button",a.className="btn btn-sm btn-outline-secondary minus-spin",a.innerHTML='<i class="bx bx-minus"></i>',a.style.cssText="border-radius: 0; border-left: 0; flex: 1;",n.appendChild(s),n.appendChild(a);const i=t.parentElement;i&&(i.style.position="relative",i.appendChild(n)),s.addEventListener("click",()=>{this.incrementCustomValue(e)}),a.addEventListener("click",()=>{this.decrementCustomValue(e)})},incrementValue(t){const e=t.previousElementSibling;if(e){const n=parseInt(e.value)||0;n<(parseInt(e.getAttribute("max"))||999)&&(e.value=n+1,this.updateQuantity(t))}},decrementValue(t){const e=t.nextElementSibling;if(e){const n=parseInt(e.value)||0;n>(parseInt(e.getAttribute("min"))||0)&&(e.value=n-1,this.updateQuantity(t))}},incrementCustomValue(t){const e=this.spinInputs[t];if(e){const n=e.value+e.config.step;n<=e.config.max&&(e.value=n,e.element.value=this.formatValue(n,e.config.decimals),this.currentValues[t]=n,this.triggerChangeEvent(e.element))}},decrementCustomValue(t){const e=this.spinInputs[t];if(e){const n=e.value-e.config.step;n>=e.config.min&&(e.value=n,e.element.value=this.formatValue(n,e.config.decimals),this.currentValues[t]=n,this.triggerChangeEvent(e.element))}},formatValue:(t,e)=>e>0?t.toFixed(e):t.toString(),updateQuantity(t){document.querySelectorAll(".product").forEach(t=>{this.updateProductQuantity(t)})},updateProductQuantity(t){const e=parseInt(t.value)||0,n=parseInt(t.getAttribute("min"))||0,s=parseInt(t.getAttribute("max"))||999;e<n?t.value=n:e>s&&(t.value=s),this.updateProductCalculations(t)},updateProductCalculations(t){const e=t.closest(".product-row, tr, .item-row");if(e){const n=parseInt(t.value)||0,s=e.querySelector(".product-price, .price"),a=e.querySelector(".product-total, .total");if(s&&a){const t=n*(parseFloat(s.getAttribute("data-price")||s.textContent.replace(/[^\d.-]/g,""))||0);a.textContent=this.formatCurrency(t),a.setAttribute("data-total",t)}}this.updateCartTotal()},updateCartTotal(){const t=document.querySelectorAll("[data-total]");let e=0;t.forEach(t=>{const n=parseFloat(t.getAttribute("data-total"))||0;e+=n});const n=document.querySelector(".cart-total, .total-amount");n&&(n.textContent=this.formatCurrency(e))},formatCurrency:t=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(t),triggerChangeEvent(t){const e=new Event("change",{bubbles:!0});t.dispatchEvent(e)},setValue(t,e){const n=this.spinInputs[t];if(n){const s=n.config,a=Math.max(s.min,Math.min(s.max,e));n.value=a,n.element.value=this.formatValue(a,s.decimals),this.currentValues[t]=a,this.triggerChangeEvent(n.element)}},getValue(t){return this.currentValues[t]||0},resetToDefault(t){const e=this.spinInputs[t];e&&this.setValue(t,e.config.default)},setSpinEnabled(t,e){const n=this.spinInputs[t];n&&(n.element.disabled=!e,n.element.parentElement.querySelectorAll(".plus-spin, .minus-spin").forEach(t=>{t.disabled=!e}))}});
|
||||
Loaded 100 of 415 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user