intervention-pages
Version:
113 lines (108 loc) • 4.44 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { css, customElement, html, LitElement, property } from 'lit-element';
import { ResultStructureStyles } from './results-structure.styles';
import { gridLayoutStylesLit } from '../../common/styles/grid-layout-styles-lit';
import '@unicef-polymer/etools-data-table';
import '@polymer/iron-icons';
let CpOutputLevel = class CpOutputLevel extends LitElement {
constructor() {
super(...arguments);
this.showCPOLevel = false;
}
static get styles() {
// language=CSS
return [
gridLayoutStylesLit,
ResultStructureStyles,
css `
:host {
display: block;
}
:host([show-cpo-level]) {
border-top: 1px solid var(--main-border-color);
margin: 0 7px;
}
:host(:first-child) {
border-top: none;
}
.alert {
color: var(--error-color);
}
`
];
}
render() {
return html `
<style>
etools-data-table-row {
overflow: hidden;
--list-row-collapse-wrapper: {
padding: 0 ;
margin-bottom: 10px;
background-color: transparent ;
border: 1px solid var(--main-border-color) ;
border-bottom: 1px solid var(--main-border-color) ;
}
--list-row-wrapper: {
background-color: var(--primary-background-color) ;
border-bottom: none ;
padding: 5px 4px;
}
}
</style>
${this.showCPOLevel && this.resultLink
? html `
<etools-data-table-row>
<div slot="row-data" class="layout-horizontal">
<!-- If PD is associated with CP Output -->
${this.resultLink.cp_output
? html `
<div class="flex-1 flex-fix">
<div class="heading">Country Program output</div>
<div class="data">${this.resultLink.cp_output_name}</div>
</div>
<div class="flex-1 flex-fix">
<div class="heading">Ram Indicators</div>
<div class="data">
${this.resultLink.ram_indicator_names.map((name) => html `<div class="truncate">${name}</div>`)}
</div>
</div>
<div class="flex-none">
<div class="heading">Total Cache budget</div>
<div class="data">TTT 1231.144</div>
</div>
`
: html `
<!-- If PD is unassociated with CP Output -->
<div class="flex-1 flex-fix data alert">
Unassociated to CP Output! Please associate before moving forward
</div>
`}
</div>
<div slot="row-data-details">
<slot></slot>
<div class="add-pd row-h align-items-center" ?hidden="${!this.resultLink.cp_output}">
<iron-icon icon="add-box"></iron-icon>Add PD Output
</div>
</div>
</etools-data-table-row>
`
: html `<slot></slot>`}
`;
}
};
__decorate([
property()
], CpOutputLevel.prototype, "resultLink", void 0);
__decorate([
property({ type: Boolean, reflect: true, attribute: 'show-cpo-level' })
], CpOutputLevel.prototype, "showCPOLevel", void 0);
CpOutputLevel = __decorate([
customElement('cp-output-level')
], CpOutputLevel);
export { CpOutputLevel };