<! --
/**
* 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 of action bar section -->

<div class="global-action-bar row pb-2 pt-2 mr-0" *ngIf="(vm$ | async) as vm">
    <div class="col-6">
        <form name="global-search" class="global-search">
            <div class="input-group">
                <input [(ngModel)]="searchTerm"
                       type="text"
                       name="global-search-term"
                       class="form-control global-search-term"
                       placeholder="{{vm.appStrings['LBL_SEARCH'] || ''}}..."
                       aria-label="Search"
                       required>
                <div class="input-group-append">
                    <button class="btn btn-default search-button"
                            aria-label="Search"
                            scrm-button-loading
                            (click)="search()">
                        <scrm-image class="search-icon sicon" image="search"></scrm-image>
                    </button>
                </div>
            </div>
        </form>
    </div>
    <div class="col justify-content-right">
        <div class="action-group">
            <div
                *ngIf="notificationsEnabled && checkAppStrings(vm.appStrings) && arePreferencesInitialized(preferences)"
                class="action-alert dropdown">
                <button class="alerts-button dropdown-toggle" type="button" aria-label="Toggle Alerts"
                        (mouseenter)="markAsRead()">
                    <scrm-image class="action-btn-icon" image="alert"></scrm-image>
                </button>
                <ng-container *ngIf="(notificationCount$ | async) as notificationCount">
                    <span *ngIf="(notificationCount ?? false)"
                          class="badge badge-position rounded-pill bg-danger text-white">
                        <ng-container *ngIf="notificationCount > 0">{{notificationCount }}</ng-container>
                    </span>
                </ng-container>
                <div class="dropdown-menu dropdown-menu-right shadow-md">
                    <scrm-notifications></scrm-notifications>
                </div>
            </div>
            <div class="action-new dropdown">
                <button class="quickcreate-button dropdown-toggle" type="button" aria-label="Quick Create">
                    {{vm.appStrings['LBL_NEW'] || ''}}
                </button>
                <ul class="dropdown-menu dropdown-menu-right">
                    <li class="new-list-item" *ngFor="let createLink of actionBar.createLinks">
                        <a [routerLink]="createLink.route">
                            <scrm-image class="action-btn-icon" image="plus"></scrm-image>
                            {{vm.appListStrings.moduleList && vm.appListStrings.moduleList[createLink.label]}}
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>

<!-- End of action bar section -->
