@extends('layout')
@section('content')
    


<!-- begin::main content -->

<main class="main-content">

    <div class="container">

        <!-- begin::page header -->
        <div class="page-header">
            <h3>{{(!empty($role))?$role->role:"Admin Module"}}</h3>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="#">Dashboard</a></li>                    
                    <li class="breadcrumb-item active" aria-current="page">Admin Module</li>
                </ol>
            </nav>
        </div>
        <!-- end::page header -->

        <div class="row">
            <div class="col-md-6">
                
                <x-flashMessage/>
                <div class="card">
                    <div class="card-body">
                        <a href="{{asset('superadmin/admin-modules/'.Request::segment(4))}}" class="btn btn-primary pull-right text-white"><i class="fa fa-list"></i>&nbsp;Module List</a>
                        <h6 class="card-title">Edit Module</h6>
                        <form action="{{asset('superadmin/edit-admin-module/'.Request::segment(3).'/'.Request::segment(4))}}" method="post">
                            @csrf
                            <div class="form-group">
                                <label for="moduleName">Select Module</label>

                                <select class="js-example-basic-single"  name="moduleName">
                                    <option></option>
                                    @if(!empty($modules))
                                    @foreach($modules as $module)
                                    <option value="{{$module->id}}" {{($editmodule->module == $module->id)?"selected":""}}>{{$module->module}}</option>
                                    @endforeach
                                    @endif
                                   
                                </select>

                                @if ($errors->has('moduleName'))
                                <div class="error">
                                    {{ $errors->first('moduleName') }}
                                </div>
                                @endif
                            </div>

                            <div class="form-group">
                                <label for="institute">Permission</label>
                                <select class="js-example-basic-single"  name="permission">
                                    <option value="">Select Permission</option>
                                    <option value="read" {{($editmodule->default_permission == 'read')?"selected":""}}>Read</option>
                                    <option value="write" {{($editmodule->default_permission == 'write')?"selected":""}}>Write</option>
                                    <option value="delete" {{($editmodule->default_permission == 'delete')?"selected":""}}>Delete</option>
                                   
                                   
                                </select>

                                @if ($errors->has('permission'))
                                <div class="error">
                                    {{ $errors->first('permission') }}
                                </div>
                                @endif
                            </div>   
                           
                            <button type="submit" class="btn btn-primary">Submit</button>
                        </form>
                    </div>
                </div>



            </div>
           
        </div>

    </div>

</main>
<!-- end::main content -->

@endsection
@push('footer-script')


<link rel="stylesheet" href="{{asset('public/admin/vendors/select2/css/select2.min.css')}}" type="text/css">
      <!-- end::select2 -->
  
<script src="{{asset('public/admin/vendors/select2/js/select2.min.js')}}"></script>
<script src="{{asset('public/admin/js/examples/select2.js')}}"></script>

    
@endpush