@extends('Admin.layouts.master')

@section('content')
<?php $currentPage = "sub-admins" ?>
<style>
        .error-message {
            color: #FF0000;
        }

        form .error-message {
            color: red;
            /* Set your desired color here */
        }

        form .input_class.error-message {
            color: #0e1726;
        }
    </style>
<div class="layout-px-spacing">
    <div class="middle-content container-xxl p-0">
        <div class="row layout-top-spacing ">
            <div class="top-tabel">
                <div class="row">
                    <div class="col-md-4">
                        <!-- <h6 class="card-title">Edit Manage Customers</h6> -->
                        <a class="d-flex align-items-center justify-content-center pl-2"
                            href="{{ route('manage.subAdmin') }}">
                            <img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg')}}">
                            <h6 class="card-title p-0">Edit Sub Admins</h6>
                        </a>
                    </div>
                    <div class="col-md-8">

                    </div>
                </div>
            </div>
            <div class="col-xl-12 col-lg-12 col-sm-12  layout-spacing">
                <div class="widget-content widget-content-area br-8 position-btn h-10">
                    <div class="view-details Article">
                        <form id="update_sub_admin">
                            <input type="hidden" class="form-control" value="{{$edit_sub_admin->id}}" name="sub_admin_id">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group ">
                                        <label for="company-name" class="label">First Name</label>
                                        <input type="text" class="form-control" value="{{$edit_sub_admin->first_name}}" name="sub_admin_name">
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group ">
                                        <label for="company-name" class="label">Last Name</label>
                                        <input type="text" class="form-control" value="{{$edit_sub_admin->last_name}}" name="sub_admin_lname">
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group ">
                                        <label for="company-name" class="label">Email ID</label>
                                        <input type="text" class="form-control" value="{{$edit_sub_admin->email_address}}" name="sub_admin_email">
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group ">
                                        <label class="label">Password</label>
                                        <input type="text" class="form-control" value="{{$edit_sub_admin->password}}" disabled>
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <div class="form-group mb-0">
                                        <label class="label">Permissions</label>
                                    </div>
                                    <div class="row">
                                        @foreach ($sub_admins_module as $sub_admin_module)
                                            <div class="form-group subadmin-option col-md-3">
                                                <input id="customers{{$sub_admin_module->id}}" type="checkbox" name="module_id[]" class="form-control" value="{{$sub_admin_module->id}}"
                                                    @if($edit_sub_admin->moduleLinks->contains('manage_modules_xid', $sub_admin_module->id)) checked @endif>
                                                <label for="customers{{$sub_admin_module->id}}" class="label mb-0">{{ $sub_admin_module->name }}</label>
                                            </div>
                                        @endforeach
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <button class="download-btn-custom mt-3 custom-width-10" id="update_admin_btn" type="submit">Save</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

@endsection


@section('section_script')
<script src="{{ asset('assets/js/admin/manage_customer/main.js')}}"></script>
<script src="{{ asset('public/assets/js/admin/manage_sub_admin/edit.js')}}"></script>

@endsection
