import { Component, Input } from '@angular/core';
import { AxoUtils } from '../../../../axo-utils/axo-utils';
import _ from 'lodash';
import { ChildRecord } from '../../../../forms/page/widgets/child-record';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
function FormObjectChildRecordsValueComponent_div_0_div_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 10);
    i0.ɵɵelementStart(1, "span", 11);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" +", ctx_r2.widgetValue.length - 1, "");
} }
function FormObjectChildRecordsValueComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div");
    i0.ɵɵelementStart(1, "mat-card", 1);
    i0.ɵɵelementStart(2, "div", 2);
    i0.ɵɵelementStart(3, "div", 3);
    i0.ɵɵelementStart(4, "div", 4);
    i0.ɵɵelement(5, "img", 5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "div", 6);
    i0.ɵɵelementStart(7, "div", 7);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "div", 8);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(11, FormObjectChildRecordsValueComponent_div_0_div_11_Template, 3, 1, "div", 9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(5);
    i0.ɵɵproperty("src", ctx_r0.baseUrl + ctx_r0.choiceRecordImageValue, i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(ctx_r0.widgetValue[0].title);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.widgetValue[0].subTitle);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.widgetValue.length > 1);
} }
function FormObjectChildRecordsValueComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 12);
    i0.ɵɵtext(2, "-");
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} }
export class FormObjectChildRecordsValueComponent {
    constructor() { }
    ngOnInit() {
        this.widgetValue = this.widget.getWidgetValue();
        if (this.widgetValue && !_.isEmpty(this.widgetValue) && this.widgetValue.length && !_.isEmpty(this.widgetValue[0].picture)) {
            this.choiceRecordImageValue = AxoUtils.removeSlashFromImageUrl(this.widgetValue[0].picture);
        }
        if (this.choiceRecordImageValue === undefined) {
            this.choiceRecordImageValue = 'images/media/default_icons/thumb_no-image-found.png';
        }
    }
}
FormObjectChildRecordsValueComponent.ɵfac = function FormObjectChildRecordsValueComponent_Factory(t) { return new (t || FormObjectChildRecordsValueComponent)(); };
FormObjectChildRecordsValueComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormObjectChildRecordsValueComponent, selectors: [["app-formobject-child-records-value"]], inputs: { widget: "widget", baseUrl: "baseUrl" }, decls: 2, vars: 2, consts: [[4, "ngIf"], [1, "customscroll"], [1, "row", "flex", "gap-3", "justify-start", "items-center", "child-record"], [1, "flex", "gap-4", "justify-start", "items-center"], [1, "col-4"], ["alt", "...", 1, "thumbnail", "rounded", 3, "src"], [1, "col-6"], [1, "form-child-record-title"], [1, "form-child-record-subtitle"], ["class", "flex justify-end align-center", 4, "ngIf"], [1, "flex", "justify-end", "align-center"], [1, "child-record-counter"], [1, "flex", "items-center", "justify-start"]], template: function FormObjectChildRecordsValueComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, FormObjectChildRecordsValueComponent_div_0_Template, 12, 4, "div", 0);
        i0.ɵɵtemplate(1, FormObjectChildRecordsValueComponent_ng_container_1_Template, 3, 0, "ng-container", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.widgetValue !== null && (ctx.widgetValue == null ? null : ctx.widgetValue.length) !== 0 && ctx.widgetValue !== undefined);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", !ctx.widget.value || ctx.widget.value.length <= 0);
    } }, directives: [i1.NgIf], styles: [".child-record-counter[_ngcontent-%COMP%]{border-radius:100%;background-color:#6554c0;min-width:1rem;max-width:1rem;min-height:1rem;max-height:1rem;line-height:1rem;text-align:center;margin-left:.5rem;color:#fff;font-size:8px;font-weight:500}.form-child-record-subtitle[_ngcontent-%COMP%]{font-size:.8rem}"] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormObjectChildRecordsValueComponent, [{
        type: Component,
        args: [{ selector: 'app-formobject-child-records-value', template: "<div *ngIf=\"widgetValue !== null && widgetValue?.length!==0 && widgetValue !== undefined\">\n    <mat-card class=\"customscroll\">\n        <div class=\"row flex gap-3 justify-start items-center child-record\">\n            \n            <div class=\"flex gap-4 justify-start items-center\">\n                <div class=\"col-4\">\n                    <img class=\"thumbnail rounded\" alt=\"...\" [src]=\"baseUrl +  choiceRecordImageValue\" />\n                </div>\n                <div class=\"col-6\">\n                    <div class=\"form-child-record-title\">{{widgetValue[0].title}}</div>\n                    <div class=\"form-child-record-subtitle\">{{widgetValue[0].subTitle}}</div>\n                </div>\n            </div>\n            <div *ngIf=\"widgetValue.length > 1\" class=\"flex justify-end align-center\">\n                \n                <span class=\"child-record-counter\"> +{{widgetValue.length-1}}</span>\n            </div>\n        </div>\n    </mat-card>\n</div>\n<ng-container *ngIf=\"!widget.value || widget.value.length <= 0\" >\n    <div class=\"flex items-center justify-start\">-</div>\n</ng-container>", styles: [".child-record-counter{border-radius:100%;background-color:#6554c0;min-width:1rem;max-width:1rem;min-height:1rem;max-height:1rem;line-height:1rem;text-align:center;margin-left:.5rem;color:#fff;font-size:8px;font-weight:500}.form-child-record-subtitle{font-size:.8rem}\n"] }]
    }], function () { return []; }, { widget: [{
            type: Input
        }], baseUrl: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 