<?php
declare(strict_types=1);
/**
 * gov-portal-strip 공통 페이지 셸 (상단 호버 메뉴 + 프로필 + 가로 MY MENU + 본문)
 *
 * @var string $stripInnerView  본문 partial 경로 (home/...)
 * @var bool $stripIncludeWorkCss  NDMS 작업화면 CSS 포함 여부
 */
helper('admin');
$govPortalNavPartial   = gov_portal_nav_partial_vars(get_defined_vars());
$activeVariant         = $activeVariant ?? 'strip';
$stripInnerView        = (string) ($stripInnerView ?? '');
$stripIncludeWorkCss   = ! empty($stripIncludeWorkCss);
$stripShowProfileLinks = ($stripShowProfileLinks ?? true) !== false;
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<?= view('home/_dashboard_gov_portal_head') ?>
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css"/>
  <?php if (! $stripIncludeWorkCss): ?>
  <?= view('home/_dashboard_gov_portal_map_leaflet_assets') ?>
  <?php endif; ?>
  <style>
<?php include __DIR__ . '/_dashboard_gov_portal_brand_css.php'; ?>
<?php include __DIR__ . '/_dashboard_gov_portal_topnav_css.php'; ?>
<?php include __DIR__ . '/_dashboard_gov_portal_strip_styles.php'; ?>
<?php if (! $stripIncludeWorkCss): ?>
<?php include __DIR__ . '/_dashboard_gov_portal_map_css.php'; ?>
<?php include __DIR__ . '/_dashboard_gov_portal_menu_search_css.php'; ?>
<?php include __DIR__ . '/_dashboard_gov_portal_stock_cards_css.php'; ?>
<?php endif; ?>
<?php if ($stripIncludeWorkCss): ?>
<?php include __DIR__ . '/_dashboard_gov_portal_workpage_css.php'; ?>
    .page.strip-work-page .work-main { padding:0; background:transparent; }
<?php endif; ?>
  </style>
</head>
<body>
  <header class="portal-header">
    <div class="portal-header-inner">
      <?= view('home/_dashboard_gov_portal_brand', ['brandHref' => base_url('dashboard/gov-portal-strip')]) ?>
      <?= view('home/_dashboard_gov_portal_topnav_hover', $govPortalNavPartial) ?>
      <?= view('home/_dashboard_gov_portal_header_utils', [
          'activeVariant'  => $activeVariant,
          'portalVariants' => $portalVariants,
          'mbName'         => $mbName,
          'levelName'      => $levelName,
          'lgLabel'        => $lgLabel,
      ]) ?>
    </div>
  </header>

  <div class="page<?= $stripIncludeWorkCss ? ' strip-work-page' : '' ?>">
    <div class="profile-inline">
      <div>
        <div class="name"><?= esc($mbName) ?>님, 환영합니다</div>
        <div class="sub"><?= esc($lgLabel) ?> · <?= esc($levelName) ?> · 최근접속 <?= date('Y.m.d H:i') ?></div>
      </div>
      <?php if ($stripShowProfileLinks): ?>
      <div style="display:flex;gap:.35rem;flex-wrap:wrap;">
        <a href="<?= base_url('dashboard/simple') ?>">마이페이지</a>
        <a href="<?= base_url('logout') ?>">로그아웃</a>
      </div>
      <?php endif; ?>
    </div>

    <?= view('home/_dashboard_gov_portal_strip_my_menu', $govPortalNavPartial) ?>

    <?php if ($stripInnerView !== ''): ?>
    <div class="<?= $stripIncludeWorkCss ? 'work-main' : 'strip-page-body' ?>">
      <?= view($stripInnerView, get_defined_vars()) ?>
    </div>
    <?php endif; ?>
  </div>

  <?= view('home/_dashboard_gov_portal_nav_script_base', $govPortalNavPartial) ?>
  <?= view('home/_dashboard_gov_portal_font_zoom_script') ?>
</body>
</html>
