@php use App\Models\Client;use Carbon\Carbon; @endphp
@extends('adminlte::page')

@section('title', 'IPRS | Services')

@section('content_header')
    <h3>Edit Service</h3>
@stop

@section('plugins.Datatables', true)

@section('content')

    <x-adminlte-modal id="editServicemodal" title="Edit Service" size="md" theme="info"
                      icon="fas fa-bell" v-centered static-backdrop scrollable>

        <form method="POST" action="{{ route('service.update', ['service'=>$service->id]) }}">
            @csrf
            @method("PATCH")
            <div style="height:300px;">

                <x-adminlte-input name="service_name" label="Title" placeholder="Service title"
                                  value="{{ $service->service_name }}"
                                  required
                                  fgroup-class=""/>

                <x-adminlte-input name="service_field_id" label="Field name" placeholder="Service field name"
                                  value="{{ $service->service_field_id }}"
                                  required
                                  fgroup-class=""/>

                <x-adminlte-select name="service_group_id" label="Select a Service Group" placeholder="Select a Service Group"
                                   fgroup-class="col-md-6">

                    <option value="{{ $service->iprsNewServiceGroup->id }}">{{ $service->iprsNewServiceGroup->service_name }}</option>

                    @foreach($service_groups as $service_group)
                        <option value="{{ $service_group->id }}">{{ $service_group->service_name }}</option>
                    @endforeach

                </x-adminlte-select>
            </div>
            <x-adminlte-button class="mr-auto" type="submit" theme="success" label="Update record"/>
            <x-slot name="footerSlot">
                <x-adminlte-button theme="danger" label="Dismiss" data-dismiss="modal"/>
            </x-slot>
        </form>

    </x-adminlte-modal>

@stop


@section('js')
    <script>
        $(window).on('load', function() {
            $('#editServicemodal').modal('show');
        });
    </script>
@stop
