<! --
/**
* 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".
*/
-->
<ng-container>
    <div [ngClass]="isScrolled ? 'record-view-header-scrolled shadow-md': ''" class="record-view-header">
        <div *ngIf="loading" class="row mr-0">
            <div class="col-md-4 d-flex align-items-center">
                <scrm-module-title [title]="moduleTitle" class="record-view-title title-font"></scrm-module-title>
                <div class="record-view-name pt-3 pb-3"></div>
            </div>
        </div>
        <div *ngIf="!loading" class="row m-0 d-flex justify-content-between ml-1 mr-1">
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-7 col-xl-8 record-name-container">
                <div class="float-left p-0">
                    <div class="d-flex record-view-back-button justify-content-start" *ngIf="mode === 'detail' || mode === 'edit'">
                        <scrm-button *ngIf="backButtonConfig" [config]="backButtonConfig"></scrm-button>
                    </div>
                </div>
                <div class="record-view-name-wrapper d-flex justify-content-md-start align-items-center"
                     [class.justify-content-center]="mode === 'detail' || mode === 'edit'"
                     [class.justify-content-start]="!(mode === 'detail' || mode === 'edit')"
                     [class.record-view-name-wrapper-margin-left]="mode === 'detail' || mode === 'edit'"
                >
                    <div class="p-0 d-inline-block" [ngClass]="isScrolled ? 'record-view-name-scrolled' : 'record-view-name'">
                        <div *ngIf="record && record.fields && mode !== 'create'" class="float-right align-items-top d-flex">
                            <scrm-favorite-toggle [record]="record"
                                                  class="h-100 lh-100"></scrm-favorite-toggle>
                        </div>
                        <scrm-dynamic-label *ngIf="record && record.fields"
                                            class="record-view-name-label d-block p-0 lh-100"
                                            [fields]="record.fields"
                                            [labelKey]="getSummaryTemplate()">
                        </scrm-dynamic-label>

                    </div>
                </div>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-5 col-xl-4 align-items-center record-view-action-header">
                <div class="row mr-1 ml-1 justify-content-center justify-content-md-end">
                    <div *ngIf="record" class="">
                        <scrm-action-group-menu
                                [config]="actionsAdapter"
                                [actionContext]="getActionContext(record)"
                                [klass]="isScrolled ?  'record-view-actions-scrolled float-right' : 'record-view-actions float-right'"
                                buttonClass="settings-button"
                        >
                        </scrm-action-group-menu>
                    </div>
                </div>
            </div>
        </div>
    </div>
</ng-container>
