import { AxoUtils } from './../../../axo-utils/axo-utils';
import { SectionType, MetaFieldsIdentifier } from './../../../forms/page/common/widget-enums';
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Section } from '../../../forms/page/data-detail-view/section';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/material/card";
import * as i3 from "@angular/flex-layout/flex";
import * as i4 from "@angular/flex-layout/extended";
function MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_ng_container_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtext(1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const sectionField_r2 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r4.returnStatus(ctx_r4.taskDetailsMap[sectionField_r2.identifier][0]), " ");
} }
function MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_ng_container_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtext(1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const sectionField_r2 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r5 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r5.returnFormattedDateValue(ctx_r5.taskDetailsMap[sectionField_r2.identifier][0]), " ");
} }
function MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_ng_container_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtext(1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const sectionField_r2 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r6 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r6.taskDetailsMap[sectionField_r2.identifier][0], " ");
} }
function MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0, 6);
    i0.ɵɵelementStart(1, "mat-card", 7);
    i0.ɵɵelementStart(2, "div", 8);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 9);
    i0.ɵɵtemplate(5, MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_ng_container_5_Template, 2, 1, "ng-container", 0);
    i0.ɵɵtemplate(6, MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_ng_container_6_Template, 2, 1, "ng-container", 0);
    i0.ɵɵtemplate(7, MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_ng_container_7_Template, 2, 1, "ng-container", 0);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const sectionField_r2 = i0.ɵɵnextContext().$implicit;
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("fxFlex.gt-md", sectionField_r2.colSpan == 100 ? 100 : sectionField_r2.colSpan == 50 ? 49.75 : 33);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", ctx_r3.taskDetailsMap[sectionField_r2.identifier][1], " ");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", sectionField_r2.identifier == ctx_r3.MetaFieldsIdentifier.status);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", sectionField_r2.identifier == ctx_r3.MetaFieldsIdentifier.date);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", sectionField_r2.identifier != ctx_r3.MetaFieldsIdentifier.status && sectionField_r2.identifier != ctx_r3.MetaFieldsIdentifier.date);
} }
function MetaSectionComponent_ng_container_0_ng_container_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, MetaSectionComponent_ng_container_0_ng_container_4_ng_container_1_Template, 8, 5, "ng-container", 5);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const sectionField_r2 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", sectionField_r2.type === ctx_r1.sectionType.sectionField);
} }
const _c0 = function (a0) { return { "border-1 ": a0 }; };
function MetaSectionComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "mat-card", 1);
    i0.ɵɵelementStart(2, "div", 2);
    i0.ɵɵelementStart(3, "div", 3);
    i0.ɵɵtemplate(4, MetaSectionComponent_ng_container_0_ng_container_4_Template, 2, 1, "ng-container", 4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(2, _c0, ctx_r0.section.showBorder));
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngForOf", ctx_r0.section == null ? null : ctx_r0.section.sections);
} }
export class MetaSectionComponent {
    constructor() { }
    /**
     * section type enum
     */
    get sectionType() {
        return SectionType;
    }
    /**
     * Meta Fields Identifier enum
     */
    get MetaFieldsIdentifier() {
        return MetaFieldsIdentifier;
    }
    /**
     * return the status
     * @param status
     * @returns
     */
    returnStatus(status) {
        switch (status) {
            case 0:
                return "To do";
            case 1:
                return "Delivered";
            case 2:
                return "Done";
            case 3:
                return "Rejected";
            case 4:
                return "Failed";
            case 5:
                return "Unassigned";
            case 6:
                return "Cancelled";
            case 8:
                return "Overdue";
            default:
                return "-";
        }
    }
    /**
     * returns formatted date
     * @param date
     * @returns
     */
    returnFormattedDateValue(date) {
        return AxoUtils.formatDateFromUTCToLocal(date);
    }
}
MetaSectionComponent.ɵfac = function MetaSectionComponent_Factory(t) { return new (t || MetaSectionComponent)(); };
MetaSectionComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MetaSectionComponent, selectors: [["app-meta-section"]], inputs: { section: "section", taskDetailsMap: "taskDetailsMap" }, decls: 1, vars: 1, consts: [[4, "ngIf"], ["fxLayout", "row wrap", "fxLayoutAlign", "start center", "fxFlex", "100", 1, "flex-row-gap", "customscroll", 3, "ngClass"], [1, "task-details-container"], [1, "mat-card-wrapper"], [4, "ngFor", "ngForOf"], ["class", "border-box ", 4, "ngIf"], [1, "border-box"], ["fxLayout", "row wrap", "fxLayoutAlign", "start center", "fxFlex.lt-md", "100", 1, "flex-row-gap", "border-0", "m-0", 3, "fxFlex.gt-md"], [1, "task-detail-title"], [1, "task-detail-value"]], template: function MetaSectionComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, MetaSectionComponent_ng_container_0_Template, 5, 4, "ng-container", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.section.sections.length);
    } }, directives: [i1.NgIf, i2.MatCard, i3.DefaultLayoutDirective, i3.DefaultLayoutAlignDirective, i3.DefaultFlexDirective, i1.NgClass, i4.DefaultClassDirective, i1.NgForOf], styles: ["app-meta-section .task-details-container{border-radius:10px;column-gap:1rem;width:100%;display:flex}app-meta-section .task-details-container .mat-card-wrapper{flex-wrap:wrap;width:100%;column-gap:.5%;row-gap:1rem}app-meta-section .task-details-container .mat-card-wrapper mat-card{column-gap:.5%;flex-wrap:nowrap!important;column-gap:12px!important;min-width:auto!important;padding:0!important;align-items:center}app-meta-section .task-details-container .mat-card-wrapper mat-card .task-detail-title{color:#172b4d;font-family:Roboto,sans-serif;font-style:normal;font-weight:500;font-size:.8rem!important;width:20%;min-width:20%}app-meta-section .task-details-container .mat-card-wrapper mat-card .task-detail-value{color:#6c798f;font-family:Roboto,sans-serif;font-style:normal;font-weight:400;font-size:.8rem!important}app-meta-section .task-details-container .flex-row-gap{row-gap:25px}\n"], encapsulation: 2 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MetaSectionComponent, [{
        type: Component,
        args: [{ selector: 'app-meta-section', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"section.sections.length\">\n    <mat-card [ngClass]=\"{ 'border-1 ': section.showBorder}\" fxLayout=\"row wrap\"  fxLayoutAlign=\"start center\" fxFlex=\"100\" class=\"flex-row-gap customscroll\">\n        <div class=\"task-details-container\">\n            <div class=\"mat-card-wrapper\">\n                <ng-container *ngFor=\"let sectionField of section?.sections\">\n                    <!-- if its a sectionField type section -->\n                    <ng-container *ngIf=\"sectionField.type === sectionType.sectionField\"   class=\"border-box \">\n                            <!--\n                                this condition basically check the colspan and set the width and flex width accordingly (sectionField.colSpan==100?100:sectionField.colSpan==50?49.75:33)\n                                example:\n                                - if colSpan is 100% than width is 100%\n                                - if colSpan is 50% than width is 49.75% . Row will have 2 columns and the column gap can be 0.5%.\n                                - if colSpan is not 100% or 50% than width is 33% . Row will have 3 columns and the column gap can be 0.5%.\n                            -->\n                            <mat-card  fxLayout=\"row wrap\"  fxLayoutAlign=\"start center\" [fxFlex.gt-md]=\"sectionField.colSpan==100?100:sectionField.colSpan==50?49.75:33\"  fxFlex.lt-md=\"100\" class=\"flex-row-gap border-0 m-0\">\n                                <!-- task detail title -->\n                                <div class=\"task-detail-title\">\n                                    {{taskDetailsMap[sectionField.identifier][1]}}\n                                </div>\n                                <!-- task detail value -->\n                                <div class=\"task-detail-value\">\n                                    <!-- return after converting integer status to stringified status -->\n                                    <ng-container *ngIf=\"sectionField.identifier == MetaFieldsIdentifier.status\">\n                                        {{returnStatus(taskDetailsMap[sectionField.identifier][0])}}\n                                    </ng-container>\n\n                                    <!-- returns the date after formatting -->\n                                    <ng-container *ngIf=\"sectionField.identifier == MetaFieldsIdentifier.date\">\n                                        {{returnFormattedDateValue(taskDetailsMap[sectionField.identifier][0])}}\n                                    </ng-container>\n\n                                    <ng-container *ngIf=\"sectionField.identifier != MetaFieldsIdentifier.status && sectionField.identifier != MetaFieldsIdentifier.date\">\n                                        {{taskDetailsMap[sectionField.identifier][0]}}\n                                    </ng-container>\n                                </div>\n                            </mat-card>\n                    </ng-container>\n                </ng-container>\n            </div>\n        </div>\n    </mat-card>\n</ng-container>\n", styles: ["app-meta-section .task-details-container{border-radius:10px;column-gap:1rem;width:100%;display:flex}app-meta-section .task-details-container .mat-card-wrapper{flex-wrap:wrap;width:100%;column-gap:.5%;row-gap:1rem}app-meta-section .task-details-container .mat-card-wrapper mat-card{column-gap:.5%;flex-wrap:nowrap!important;column-gap:12px!important;min-width:auto!important;padding:0!important;align-items:center}app-meta-section .task-details-container .mat-card-wrapper mat-card .task-detail-title{color:#172b4d;font-family:Roboto,sans-serif;font-style:normal;font-weight:500;font-size:.8rem!important;width:20%;min-width:20%}app-meta-section .task-details-container .mat-card-wrapper mat-card .task-detail-value{color:#6c798f;font-family:Roboto,sans-serif;font-style:normal;font-weight:400;font-size:.8rem!important}app-meta-section .task-details-container .flex-row-gap{row-gap:25px}\n"] }]
    }], function () { return []; }, { section: [{
            type: Input
        }], taskDetailsMap: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 