Complete adaptation from BukidBountyApp to Philippine barangay governance: - Barangay models: Resident, Household, HouseholdMember, Blotter, BlotterHearing, DocumentRequest, RequestPayment, RequestType, BarangayProject, BarangayBudget - Controllers: ResidentController, HouseholdController, BlotterController, BlotterHearingController, DocumentRequestController, RequestTypeController, ProjectController, BudgetController, QRPHController, AdminConsoleController, UserController, FileController, ChapterController, LoginController - Vue pages: Home, ManageResidents, ResidentProfile, ManageHouseholds, ManageBlotters, BlotterDetail, RequestDocument, ManageDocumentRequests, DocumentRequestDetail, ManageRequestTypes, ManageProjects, BudgetLedger, AdminConsole - Barangay roles: PunongBarangay, Kagawad, Secretary, Treasurer, SK, Tanod, BHW, Staff, Resident - UserPermissions matrix rewritten with barangay-specific permission mappings - VueRouteMap replaced with barangay SPA routes - UserActions enum references corrected across all controllers - Removed all market/cooperative/POS/subscription code and models
70 lines
3.1 KiB
PHP
70 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Support\SystemSettingsHelper;
|
|
use App\Models\User;
|
|
use App\Enums\UserTypes;
|
|
use Hypervel\Support\Facades\Auth;
|
|
use Hypervel\Support\Facades\Response;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
class PwaManifestController
|
|
{
|
|
/**
|
|
* Serve the dynamic manifest.json
|
|
*/
|
|
public function manifest(): ResponseInterface
|
|
{
|
|
$user = Auth::user();
|
|
$isUltimate = $user && ($user->acct_type === UserTypes::SUPER_ADMIN || $user->acct_type === UserTypes::SUPER_ADMIN->value);
|
|
|
|
$appName = SystemSettingsHelper::appName();
|
|
$appDescription = SystemSettingsHelper::appDescription();
|
|
|
|
// Default CDN icons — served from obj-vault-3a via cdn_asset()
|
|
$icons = [
|
|
["sizes" => "48x48", "src" => cdn_asset('vendor/assets/icons/48x48.png'), "type" => "image/png"],
|
|
["sizes" => "72x72", "src" => cdn_asset('vendor/assets/icons/72x72.png'), "type" => "image/png"],
|
|
["sizes" => "96x96", "src" => cdn_asset('vendor/assets/icons/96x96.png'), "type" => "image/png"],
|
|
["sizes" => "144x144", "src" => cdn_asset('vendor/assets/icons/144x144.png'), "type" => "image/png"],
|
|
["sizes" => "192x192", "src" => cdn_asset('vendor/assets/icons/192x192.png'), "type" => "image/png"],
|
|
["sizes" => "512x512", "src" => cdn_asset('vendor/assets/icons/512x512.png'), "type" => "image/png"],
|
|
];
|
|
|
|
// Use the custom branding icon uploaded via Ultimate Console (System Settings) for everyone.
|
|
// Ultimate-tier users keep that override even when previewing the Ultimate Console persona.
|
|
$customLogoHash = \App\Models\SystemSetting::getValue('app_logo');
|
|
if ($customLogoHash && !$isUltimate) {
|
|
$customLogoUrl = \App\Http\Controllers\FilesMainController::generateURLforFileListHash($customLogoHash);
|
|
foreach ($icons as &$icon) {
|
|
$icon['src'] = $customLogoUrl;
|
|
$icon['type'] = 'image/png';
|
|
$icon['purpose'] = 'any maskable';
|
|
}
|
|
unset($icon);
|
|
} elseif ($isUltimate && $customLogoHash) {
|
|
$customLogoUrl = \App\Http\Controllers\FilesMainController::generateURLforFileListHash($customLogoHash);
|
|
foreach ($icons as &$icon) {
|
|
$icon['src'] = $customLogoUrl;
|
|
}
|
|
unset($icon);
|
|
}
|
|
|
|
$manifest = [
|
|
"name" => $isUltimate ? "Ultimate Console" : $appName,
|
|
"short_name" => $isUltimate ? "Ultimate" : explode(' ', $appName)[0],
|
|
"description" => $isUltimate ? "Premium Administrative Management" : $appDescription,
|
|
"lang" => "en-US",
|
|
"start_url" => "/",
|
|
"display" => "standalone",
|
|
"background_color" => $isUltimate ? "#020617" : SystemSettingsHelper::primaryColor(),
|
|
"theme_color" => $isUltimate ? "#0d6efd" : SystemSettingsHelper::primaryColor(),
|
|
"icons" => $icons
|
|
];
|
|
|
|
return Response::json($manifest)
|
|
->withHeader('Content-Type', 'application/manifest+json');
|
|
}
|
|
}
|