-
${group?.kpis?.map(
(k, i) => html`
- ` )}
import { html, css } from 'lit' import { customElement, state } from 'lit/decorators.js' import { PageView } from '@operato/shell' import { i18next } from '@operato/i18n' import { client } from '@operato/graphql' import gql from 'graphql-tag' const GET_KPI_OVERVIEW = gql` query { kpiCategories: kpisLevel1 { id name description active kpis: children { id name description formula active grades } } } ` @customElement('kpi-overview') export class KpiOverview extends PageView { static styles = css` :host { display: block; background: #f6f6f6; box-sizing: border-box; padding: 16px 24px; } .overview-container { display: block; margin: 8px 0 24px 0; } .overview-left { display: block; } .overview-title { color: #0c4da2; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.05em; margin: 0 0 8px 0; } .overview-desc { font-size: 0.875rem; color: #212529; letter-spacing: -0.05em; line-height: 1; } .group-tabs { display: flex; margin: 8px 0 0 0; justify-content: flex-start; } .group-tab { padding: 10px 15px; border-radius: 8px 8px 0 0; background: rgba(46, 164, 223, 0.1); cursor: pointer; font-size: 1rem; font-weight: 400; border: none; outline: none; transition: background 0.2s; } .group-tab[selected] { background: #0c4da2; color: #ffffff; font-weight: 700; box-shadow: 1px 0 0 0 rgba(0, 0, 0, 0.1); } .tab-icon { display: inline-block; width: 20px; height: 20px; border-radius: 2px; background: #35618e; vertical-align: middle; } .group-tab[selected] .tab-icon { background: #ffffff; } .tab-label { margin-left: 6px; vertical-align: middle; } .kpi-list { display: flex; gap: 8px; margin: 0 0 32px 0; justify-content: center; } .kpi-item { padding: 8px 20px; border-radius: 12px; background: #f5f5f5; cursor: pointer; font-size: 1rem; border: none; outline: none; transition: background 0.2s; } .kpi-item[selected] { background: #bdf; color: #222; font-weight: bold; } .main-content { display: flex; gap: 0; align-items: stretch; justify-content: stretch; background: #fff; border: 2px solid #0c4da2; overflow: hidden; } .markdown { background: #fff; padding: 25px; min-height: 240px; flex: 1 1 auto; font-size: 0.875rem; color: #212529; } .markdown p { line-height: 1.7142857142857142; margin: 0 0 12px 0; } .toc { flex: 0 0 240px; background: linear-gradient(180deg, rgba(137, 204, 237, 0.2) 0%, rgba(137, 204, 237, 0) 100%); border-left: 1px solid rgba(46, 164, 223, 0.1); padding: 30px 15px; font-size: 1rem; color: #212529; } .toc img { width: 25px; height: 25px; } .submenu-header { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; } .submenu-icon { width: 25.5px; height: 28.67px; border-radius: 2px; background: #02a8a2; flex: 0 0 auto; } .submenu-title { font-weight: 700; font-size: 1.25rem; color: #0c4da2; } .toc-title { color: #0c4da2; font-size: 20px; font-weight: 700; line-height: 20px; margin-bottom: 15px; margin-top: 3px; } .toc-list { margin: 0 0 8px 0; padding: 0; list-style: none; } .toc-list li { margin-bottom: 10px; } .toc-btn { display: block; margin: 0; padding: 8px 0 8px 12px; border: none; border-left: 3px solid transparent; border-radius: 0; background: transparent; color: #212529; cursor: pointer; font-size: 1rem; text-align: left; transition: background 0.2s; } .toc-btn:hover { background: rgba(0, 0, 0, 0.03); } .toc-btn[selected] { border-left-color: #4cbb49; font-weight: 700; color: #212529; } .kpi-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 8px; color: #02a8a2; } .kpi-formula { margin: 3px 0 20px 0; font-weight: 700; color: #212529; } .subtitle { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; font-weight: 700; color: #0c4da2; } .subtitle img { width: 15px; height: 15px; } .subtitle-icon { width: 20px; height: 20px; border-radius: 2px; background: #02a8a2; flex: 0 0 auto; } .grades-section { margin-top: 16px; background: #fff; border-radius: 8px; padding: 16px; border: 2px solid #0c4da2; } .grades-section b { display: block; margin-bottom: 8px; } ` get context() { return { title: i18next.t('title.kpi overview') } } @state() selectedGroup = 0 @state() selectedKpi = 0 @state() kpiCategories: any[] = [] @state() loading = true @state() error: Error | null = null async firstUpdated() { try { const { data } = await client.query({ query: GET_KPI_OVERVIEW }) this.kpiCategories = data.kpiCategories this.loading = false } catch (e) { this.error = e instanceof Error ? e : new Error(String(e)) this.loading = false } } render() { if (this.error) return html`