/**
 * @fileoverview added by tsickle
 * Generated from: lib/fhir/goal/details/goal-details/goal-details.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, Output, EventEmitter } from '@angular/core';
import { AbstractDetailsComponent } from '../../../../shared/abstracts/details/abstract-details/abstract-details.component';
import { ActionSheetController } from '@ionic/angular';
import { TranslatePipe } from '../../../../shared/translate/pipes/translate.pipe';
import { stringToGoalView } from '../../../functions/goal.function';
/** @type {?} */
var COLS = [
    { name: 'NAME', colSize: 3 },
    { name: 'VALUE', colSize: 8.3 },
];
var GoalDetailsComponent = /** @class */ (function (_super) {
    tslib_1.__extends(GoalDetailsComponent, _super);
    function GoalDetailsComponent(actionSheetController, translatePipe) {
        var _this = _super.call(this) || this;
        _this.actionSheetController = actionSheetController;
        _this.translatePipe = translatePipe;
        _this.callDelete = new EventEmitter();
        _this.callUpdate = new EventEmitter();
        _this.cols = COLS;
        return _this;
    }
    /**
     * @return {?}
     */
    GoalDetailsComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        this.setGoalViews();
    };
    /**
     * @return {?}
     */
    GoalDetailsComponent.prototype.setGoalViews = /**
     * @return {?}
     */
    function () {
        this.goalViews = stringToGoalView(this.inData, this.translatePipe);
    };
    /**
     * @param {?} data
     * @return {?}
     */
    GoalDetailsComponent.prototype.delete = /**
     * @param {?} data
     * @return {?}
     */
    function (data) {
        this.callDelete.emit(data);
    };
    /**
     * @param {?} data
     * @return {?}
     */
    GoalDetailsComponent.prototype.update = /**
     * @param {?} data
     * @return {?}
     */
    function (data) {
        this.callUpdate.emit({ data: data });
    };
    /**
     * @param {?} reference
     * @return {?}
     */
    GoalDetailsComponent.prototype.openActionSheet = /**
     * @param {?} reference
     * @return {?}
     */
    function (reference) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var actionSheet;
            var _this = this;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.actionSheetController.create({
                            buttons: [{
                                    text: this.translatePipe.transform('EDIT_L'),
                                    icon: 'create',
                                    handler: (/**
                                     * @return {?}
                                     */
                                    function () { _this.update(_this.inData.filter((/**
                                     * @param {?} data
                                     * @return {?}
                                     */
                                    function (data) { return data.reference === reference; }))[0]); })
                                },
                                {
                                    text: this.translatePipe.transform('DELETE_L'),
                                    icon: 'trash',
                                    handler: (/**
                                     * @return {?}
                                     */
                                    function () { _this.delete(_this.inData.filter((/**
                                     * @param {?} data
                                     * @return {?}
                                     */
                                    function (data) { return data.reference === reference; }))[0]); })
                                }]
                        })];
                    case 1:
                        actionSheet = _a.sent();
                        return [4 /*yield*/, actionSheet.present()];
                    case 2:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    GoalDetailsComponent.decorators = [
        { type: Component, args: [{
                    selector: 'inc-goal-details',
                    template: "<ion-grid class=\"ion-no-padding\">\r\n  <ion-row class=\"title\">\r\n    <ion-col *ngFor=\"let col of cols;\" [size]=\"col.colSize\">\r\n      <ion-text>{{col.name | translate}}</ion-text>\r\n    </ion-col>\r\n  </ion-row>\r\n  <ion-row class=\"row-data\" *ngFor=\"let goal of goalViews\" (click)=\"openActionSheet(goal.reference)\">\r\n    <ion-col *ngFor=\"let col of cols; let i = index\" [size]=\"col.colSize\">\r\n      <ion-text>{{goal.values[i]}}</ion-text>\r\n    </ion-col>\r\n    <ion-col size=\"0.7\">\r\n      <ion-buttons>\r\n        <ion-button fill=\"clear\" size=\"small\">\r\n          <ion-icon name=\"more\"></ion-icon>\r\n        </ion-button>\r\n      </ion-buttons>\r\n    </ion-col>\r\n  </ion-row>\r\n</ion-grid>",
                    styles: [".title ion-col:first-child ion-text{font-weight:700}.title ion-col{padding-top:0;padding-bottom:0}.title ion-col ion-text{word-break:break-all;color:var(--ion-color-primary);padding-top:7px;display:flex}.row-data{cursor:pointer}.row-data ion-buttons{visibility:hidden}.row-data ion-col:first-child ion-text{font-weight:700}.row-data ion-col{padding-top:0;padding-bottom:0}.row-data ion-col ion-text{word-break:break-all;padding-top:7px;display:flex}.row-data:hover ion-buttons{visibility:visible}"]
                }] }
    ];
    /** @nocollapse */
    GoalDetailsComponent.ctorParameters = function () { return [
        { type: ActionSheetController },
        { type: TranslatePipe }
    ]; };
    GoalDetailsComponent.propDecorators = {
        callDelete: [{ type: Output }],
        callUpdate: [{ type: Output }]
    };
    return GoalDetailsComponent;
}(AbstractDetailsComponent));
export { GoalDetailsComponent };
if (false) {
    /** @type {?} */
    GoalDetailsComponent.prototype.callDelete;
    /** @type {?} */
    GoalDetailsComponent.prototype.callUpdate;
    /** @type {?} */
    GoalDetailsComponent.prototype.cols;
    /** @type {?} */
    GoalDetailsComponent.prototype.goalViews;
    /**
     * @type {?}
     * @private
     */
    GoalDetailsComponent.prototype.actionSheetController;
    /**
     * @type {?}
     * @private
     */
    GoalDetailsComponent.prototype.translatePipe;
}
//# sourceMappingURL=data:application/json;base64, 