<x-master-layout :assets="$assets ?? []">
    <div>
        <?php $id = $id ?? null; ?>
        {!! Form::open(['route' => ['work-hour-manage.store'], 'method' => 'post']) !!}
        {{ Form::hidden('storeowner_id', $storeowner->id) }}
        {{ Form::hidden('store_detail_id', $storeowner->store_detail_id)}}
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header">
                        <h4 class="card-title">{{ $pageTitle }}</h4>
                    </div>
                    <div class="card-body">
                        <div class="new-user-info">
                            <div class="row mb-3">
                                <div class="col-md-3"><strong>{{ __('message.day_name') }}</strong></div>
                                <div class="col-md-2"><strong>{{ __('message.open/close') }}</strong></div>
                                <div class="col-md-3"><strong>{{ __('message.start_time') }}</strong></div>
                                <div class="col-md-3"><strong>{{ __('message.end_time') }}</strong></div>
                            </div>
                            @foreach(['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] as $day)
                                <div class="row align-items-center mb-2">
                                    <div class="col-md-3 d-flex align-items-center">
                                        <label for="{{ strtolower($day) }}" class="mb-0">{{ $day }}</label>
                                    </div>
                                    <div class="col-md-2">
                                        <div class="custom-switch custom-switch-color">
                                            {!! Form::checkbox(strtolower($day), 1, isset($data[strtolower($day)]->status) ? $data[strtolower($day)]->status : false, ['class' => 'custom-control-input bg-success', 'id' => 'switch_button_' . strtolower($day)]) !!}
                                            <label class="custom-control-label" for="switch_button_{{ strtolower($day) }}"></label>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        {!! Form::time(strtolower($day).'start_time', isset($data[strtolower($day)]->start_time) ? $data[strtolower($day)]->start_time : null, ['class' => 'form-control min-timerange-picker', 'id' => strtolower($day).'_start_time']) !!}
                                    </div>
                                    <div class="col-md-3">
                                        {!! Form::time(strtolower($day).'end_time', isset($data[strtolower($day)]->end_time) ? $data[strtolower($day)]->end_time : null, ['class' => 'form-control min-timerange-picker', 'id' => strtolower($day).'_end_time']) !!}
                                    </div>
                                </div>
                            @endforeach

                            {!! Form::submit(__('message.save'), ['class' => 'btn btn-md btn-primary float-right']) !!}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {!! Form::close() !!}
    </div>
    @section('bottom_script')
    <script>
        (function($) {
            $(document).ready(function() {
                $(".select2js").select2({
                    width: "100%",
                    tags: true
                });
            });
        })(jQuery);
    </script>
    @endsection
</x-master-layout>
