@extends('backend.layouts.app')
@section('title', @$data['title'])

@section('content')
    {!! breadcrumb([
        'title' => @$data['title'],
        route('admin.dashboard') => _trans('common.Dashboard'),
        '#' => @$data['title'],
    ]) !!}
    <div class="table-content table-basic">
        <div class="card">
            <div class="card-body">
                <div class="">
                    <div class="vertical-tab">
                        <div class="row no-gutters mt-4">
                            <div class="col-md-12 pl-md-3 pt-md-0 pt-sm-4 pt-4">
                                <div class="tab-content px-primary">
                                    <div id="General" class="tab-pane active">

                                        <div class="content py-primary">
                                            <div id="General-0">
                                                <form action="{{ route('company.settings.addon.status.update') }}" method="post"
                                                    enctype="multipart/form-data">
                                                    @csrf

                                                    <div class="form-group pt-0 px-3 mb-10">
                                                        <div class="row">
                                                            <div class="col-md-12">
                                                                @foreach ($addons as $addonName => $status)
                                                                    @php
                                                                        $isRestricted = in_array($addonName, ['Break', 'Notify', 'PushNotification', 'SpecialAttendance', 'Travel', 'Saas']);
                                                                    @endphp
                                                                    <div class="form-group row mb-3">
                                                                        <label class="col-sm-6 col-form-label">
                                                                            {{ _trans("settings.$addonName") }}
                                                                        </label>
                                                                        <div class="col-sm-6">
                                                                            <div>
                                                                                @if ($isRestricted)
                                                                                    <span class="badge badge-danger">{{ _trans('settings.Restricted') }}</span>
                                                                                @else
                                                                                    <div class="radio-button-group">
                                                                                        <div data-toggle="buttons" class="btn-group btn-group-toggle">
                                                                                            <label @class([
                                                                                                'btn border radio-checkbox-switch',
                                                                                                'radio-active' => $status,
                                                                                            ])>
                                                                                                <input class="d-none" type="radio"
                                                                                                    name="addons[{{ $addonName }}]"
                                                                                                    value="1"
                                                                                                    {{ $status ? 'checked' : '' }}>
                                                                                                <span>{{ _trans('settings.Enable') }}</span>
                                                                                            </label>
                                                                                            <label @class([
                                                                                                'btn border radio-checkbox-switch',
                                                                                                'radio-active' => !$status,
                                                                                            ])>
                                                                                                <input class="d-none" type="radio"
                                                                                                    name="addons[{{ $addonName }}]"
                                                                                                    value="0"
                                                                                                    {{ !$status ? 'checked' : '' }}>
                                                                                                <span>{{ _trans('settings.Disable') }}</span>
                                                                                            </label>
                                                                                        </div>
                                                                                    </div>
                                                                                @endif
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                @endforeach
                                                            </div>
                                                        </div>
                                                    </div>

                                                    <div>
                                                        @if (hasPermission('activation_read'))
                                                            <div class="d-flex justify-content-end">
                                                                <button class="btn btn-gradian mr-2">
                                                                    <span class="w-100"></span>
                                                                    {{ _trans('common.Save') }}
                                                                </button>
                                                            </div>
                                                        @endif
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="currencyInfo" value="{{ route('company.settings.currencyInfo') }}">
@endsection

@section('script')
    <script src="{{ url('backend/js/image_preview.js') }}"></script>
    <script>
        $(".radio-checkbox-switch").on("click", function() {
            $(this).closest('.btn-group').find(".radio-checkbox-switch").removeClass("radio-active");
            $(this).addClass("radio-active");
        });
    </script>
@endsection
