<?php
/**
 * Copyright (c) NMS PRIME GmbH ("NMS PRIME Community Version")
 * and others – powered by CableLabs. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
?>
{{--

@param $form_fields: the form fields to be displayed as  []
@param $save_button_name: the save button text

--}}

<?php
    $blade_type = 'form';
    $button_title = $save_button_title_key ? trans('messages.'.$save_button_title_key) : '';
    $second_button_title = $second_button_title_key ? trans('messages.'.$second_button_title_key) : '';
    $second_button_icon = $second_button_icon ?? 'refresh';
    $third_button_title = $third_button_title_key ? trans('messages.'.$third_button_title_key) : '';
    $third_button_icon = $third_button_icon ?? 'refresh';
    $fourth_button_title = $fourth_button_title_key ? trans('messages.'.$fourth_button_title_key) : '';
    $fourth_button_icon = $fourth_button_icon ?? 'refresh';
?>

{{-- Error Message --}}
<?php $col = Form::get_layout_form_col_md()['label'] ?>

<div id='top_message' class="note note-{{ Session::get('message_color')}} fade in m-b-15" style="display:none;">
    <h5>{{ Session::get('message') }}</h5>
</div>


@include('Generic.above_infos')

@foreach($form_fields as $fields)
    @foreach (Illuminate\Support\Arr::flatten($fields['html']) as $input)
        {{ $input }}
    @endforeach
@endforeach

@if(Bouncer::can($action, $model_name) || Bouncer::can($action, $view_var))
    <div class="flex flex-col md:flex-row justify-around d-print-none md:space-x-1">
        @if ($edit_view_save_button)
            <div class="text-center">
                <button type="submit" class="btn btn-primary mt-4 w-full" style="simple" name="_save" value="1" title="{{ $button_title }}">
                    <i class="fa fa-save fa-lg m-r-10" aria-hidden="true"></i>
                    {{ \App\Http\Controllers\BaseViewController::translate_view($save_button_name , 'Button') }}
                </button>
            </div>
        @endif
        @if ($edit_view_second_button)
            <div class="text-center">
                <button type="submit" class="btn btn-{{ $second_button_class }} mt-4 w-full" style="simple" name="_2nd_action" value="1" title="{{ $second_button_title }}">
                    <i class="fa fa-{{ $second_button_icon }} fa-lg m-r-10" aria-hidden="true"></i>
                    {{ \App\Http\Controllers\BaseViewController::translate_view($second_button_name , 'Button') }}
                </button>
            </div>
        @endif
        @if ($edit_view_third_button)
            <div class="text-center">
                <button type="submit" class="btn btn-{{ $third_button_class }} mt-4 w-full" style="simple" name="_3rd_action" value="1" title="{{ $third_button_title }}">
                    <i class="fa fa-{{ $third_button_icon }} fa-lg m-r-10" aria-hidden="true"></i>
                    {{ \App\Http\Controllers\BaseViewController::translate_view($third_button_name , 'Button') }}
                </button>
            </div>
        @endif
        @if ($edit_view_fourth_button)
            <div class="text-center">
                <button type="submit" class="btn btn-{{ $fourth_button_class }} mt-4 w-full" style="simple" name="_4th_action" value="1" title="{{ $fourth_button_title }}">
                    <i class="fa fa-{{ $fourth_button_icon }} fa-lg m-r-10" aria-hidden="true"></i>
                    {{ \App\Http\Controllers\BaseViewController::translate_view($fourth_button_name , 'Button') }}
                </button>
            </div>
        @endif
        @if ($printButton)
            <div class="text-center">
                <a href="javascript: window.print();" class="btn btn-primary mt-4 w-full" title="Print this Page">
                    <i class="fa fa-print fa-lg m-r-10" aria-hidden="true"></i>
                    {{ trans('view.jQuery_Print') }}
                </a>
            </div>
        @endif
    </div>
@endif
{{-- javascript--}}
@include('Generic.form-js')
