<! --
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see http://www.gnu.org/licenses.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
-->
<!-- Start Record View Container Section -->

<div *ngIf="(vm$ | async) as vm"
     class="record-view-container view-container container-fluid pt-3 pb-3 small-font">
    <div class="row">
        <div class="col-lg-9" [ngClass]="{ 'col-lg-12': !vm.sidebarWidgetConfig.show }">

            <div class="container-fluid pl-0 pr-0">
                <div *ngIf="loading" class="row no-gutters">
                    <div class="col pb-3">
                        <div class="d-flex justify-content-center widget-bar rounded  pb-1 pt-3 box-loading">
                            <div class="d-flex justify-content-center align-items-baseline widget-bar-entry p-2">
                            </div>
                        </div>
                    </div>
                </div>
                <ng-container *ngIf="!loading">
                    <div *ngIf="vm.topWidgetConfig.show && hasTopWidgetMetadata(vm.topWidgetConfig.widget)"
                         class="row no-gutters">
                        <div class="col pb-3">
                            <scrm-top-widget [config]="vm.topWidgetConfig.widget"
                                             [context]="getViewContext()"
                                             [type]="vm.topWidgetConfig.widget.type">
                            </scrm-top-widget>
                        </div>
                    </div>
                </ng-container>


                <div class="row no-gutters">
                    <div class="col">
                        <ng-container *ngIf="loading">
                            <scrm-record-content-skeleton></scrm-record-content-skeleton>
                        </ng-container>
                        <ng-container *ngIf="!loading">
                            <scrm-record-content [dataSource]="getContentAdapter()"></scrm-record-content>
                        </ng-container>
                    </div>
                </div>

                <div *ngIf="vm.bottomWidgetConfig.show && vm.bottomWidgetConfig.widgets"
                     class="row no-gutters mt-4">
                    <div class="col">
                        <div *ngFor="let widget of vm.bottomWidgetConfig.widgets" class="mb-3">
                            <scrm-sidebar-widget [config]="widget"
                                                 [context$]="getViewContext$()"
                                                 [context]="getViewContext()"
                                                 [type]="widget.type">
                            </scrm-sidebar-widget>
                        </div>
                    </div>
                </div>

                <div *ngIf="vm.showSubpanels"
                     class="row no-gutters pt-1 pb-4">
                    <div class="col">
                        <scrm-subpanel-container [config]="getSubpanelsConfig()"></scrm-subpanel-container>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-lg-3 record-widget-container pl-0"
             *ngIf="vm.sidebarWidgetConfig.show && vm.sidebarWidgetConfig.widgets">
            <div class="mb-3" *ngFor="let widget of vm.sidebarWidgetConfig.widgets">
                <scrm-sidebar-widget [type]="widget.type"
                                     [context]="getViewContext()"
                                     [context$]="getViewContext$()"
                                     [config]="widget">
                </scrm-sidebar-widget>
            </div>
        </div>

    </div>
</div>

<!-- End Record View Container Section -->
