intervention-pages
Version:
132 lines (131 loc) • 4.71 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 { LitElement, customElement, html, property } from 'lit-element';
import '@unicef-polymer/etools-content-panel/etools-content-panel';
import { sharedStyles } from '../../common/styles/shared-styles-lit';
import { gridLayoutStylesLit } from '../../common/styles/grid-layout-styles-lit';
import { elevationStyles } from '../../common/styles/elevation-styles';
import { selectInterventionOverview } from './interventionOverview.selectors';
import { getStore } from '../../utils/redux-store-access';
import { connect } from 'pwa-helpers/connect-mixin';
import { layoutFlex } from '../../common/styles/flex-layout-styles';
/**
* @customElement
*/
let DetailsOverview = class DetailsOverview extends connect(getStore())(LitElement) {
static get styles() {
return [gridLayoutStylesLit, elevationStyles];
}
render() {
// language=HTML
if (!this.interventionOverview) {
return html ` <style>
${sharedStyles}
</style>
<etools-loading loading-text="Loading..." active></etools-loading>`;
}
return html `
<style>
${sharedStyles} :host {
display: block;
margin-bottom: 24px;
}
.container-width {
width: 70%;
${layoutFlex}
}
(max-width: 900px) {
.container-width {
width: 100%;
}
}
</style>
<section class="elevation content-wrapper" elevation="1">
<div class="container-width">
<div class="layout-horizontal">
<div class="flex-2">
<span>
<label class="paper-label">Document Type</label>
</span>
</div>
<div class="flex-1">
<span>
<label class="paper-label">CFEI Number</label>
</span>
</div>
<div class="flex-1">
<span>
<label class="paper-label">Humanitarian</label>
</span>
</div>
<div class="flex-1">
<span>
<label class="paper-label">Contingency</label>
</span>
</div>
</div>
<div class="layout-horizontal">
<div class="flex-2">
<span>
<label class="input-label" ?empty="${!this.interventionOverview.document_type}">
${this.interventionOverview.document_type}
</label>
</span>
</div>
<div class="flex-1">
<span>
<label class="input-label" ?empty="${!this.interventionOverview.cfei_number}">
${this.interventionOverview.cfei_number}
</label>
</span>
</div>
<div class="flex-1">
<span>
<label class="input-label">
${this._getText(this.interventionOverview.contingency_pd)}
</label>
</span>
</div>
<div class="flex-1">
<span>
<label class="input-label">
${this._getText(this.interventionOverview.humanitarian_flag)}
</label>
</span>
</div>
</div>
</div>
</section>
`;
}
connectedCallback() {
super.connectedCallback();
}
stateChanged(state) {
if (state.interventions.current) {
this.interventionOverview = selectInterventionOverview(state);
}
}
_getText(value) {
if (value === undefined) {
return '-';
}
if (value) {
return 'Yes';
}
else {
return 'No';
}
}
};
__decorate([
property({ type: Object })
], DetailsOverview.prototype, "interventionOverview", void 0);
DetailsOverview = __decorate([
customElement('details-overview')
], DetailsOverview);
export { DetailsOverview };