@php( $headerOption = \App\Http\Controllers\Controller::getHeaderOptions( $title ?? '', $subTitle ?? '', isset($filters) ? $filters : [], isset($advancedFilters) ? $advancedFilters : [] ) ) @extends('admin.layouts.layout', $headerOption) @section('content') @php($routePrefix = $routePrefix ?? 'configuration.branding') @php($childRoutePrefix = $childRoutePrefix ?? 'configuration.calendar-colors') @php($selectedTab = $selectedTab ?? request()->query('tab', 'calendar-colors')) @php( $title = $title ?? ( [ 'calendar-colors' => 'User colors', 'branding-assets' => 'Manage site domains', 'site-css' => 'Manage site css', ][$selectedTab] ?? 'Branding' ) ) @php( $headingOptions = [ // Add New button varies by tab (function() use ($selectedTab, $childRoutePrefix) { $map = [ 'branding-assets' => [ 'label' => 'Add New Domain & Logo', 'modal' => 'show-modal', 'createRoute' => $childRoutePrefix . '.create' ], ]; if (!isset($map[$selectedTab])) { return ''; } $cfg = $map[$selectedTab]; $btnClass = \Config::get('view.buttons.primary'); $addIcon = \Config::get('settings.icon_add'); return ' ' . $cfg['label'] . ''; })(), // Assign Random Colors button for Calendar Colors tab (function() use ($selectedTab, $childRoutePrefix, $routePrefix) { if ($selectedTab !== 'calendar-colors') { return ''; } $btnClass = \Config::get('view.buttons.secondary', 'btn btn-outline-secondary'); $icon = 'mdi mdi-palette'; $routePrefixLocal = $routePrefix; // use hub controller route $form = \html()->form('POST', route($routePrefixLocal . '.assign-random')) ->attributes(['id'=>'assign-random-form','style'=>'display:none']) ->open() . \html()->form()->close(); return '' . ' Assign Random Colors' . $form; })(), // Reset Site CSS button for Site CSS tab (visible only if a record exists) (function() use ($selectedTab, $routePrefix, $activeConfig) { if ($selectedTab !== 'site-css') { return ''; } try { $records = $activeConfig['model']->getListing(['company_id'=> (\Auth::user()->company_id ?? null), 'status'=>1, 'first'=>true]); } catch (\Exception $e) { $records = null; } if (!$records) { return ''; } $btnClass = \Config::get('view.buttons.secondary', 'btn btn-outline-secondary'); $icon = 'mdi mdi-backup-restore'; $routePrefixLocal = $routePrefix; // hub controller route for branding $form = \html()->form('POST', route($routePrefixLocal . '.site-colors.reset')) ->attributes(['id'=>'reset-site-css-form','style'=>'display:none']) ->open() . '' . \html()->form()->close(); return '' . ' Reset Site CSS' . $form; })(), ] )