@extends('components.app')
@section('styles')
@endsection
@section('title')
    Edit Device
@endsection

@section('content')
    <!-- Begin Page Content -->
    <div class="container">

        <!-- Page Heading -->
        {{-- <div class="d-sm-flex align-items-center justify-content-between mb-4">
        <h1 class="h3 mb-0 text-gray-800">Add User</h1>
        
    </div> --}}
        <div class="d-flex align-items-center p-3 my-3 text-white bg-primary rounded shadow-sm">
            <svg class="bd-placeholder-img flex-shrink-0 me-2 rounded" width="32" height="32"
                xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 32x32"
                preserveAspectRatio="xMidYMid slice" focusable="false">
                <title>Placeholder</title>
                <rect width="100%" height="100%" fill="var(--white)"></rect><text x="50%" y="50%"
                    fill="var(--white)" dy=".3em">32x32</text>
            </svg>

            <div class="ml-2">
                <h1 class="h6 mb-0 text-white lh-1">Edit Device</h1>
                <small><a class="text-white" href="{{ url('admin/dashboard') }}">dashboard</a> > Edit Device</small>
            </div>
        </div>
        <!-- Content Row -->
        <div class="row">
            <div class="col-sm-12">
                <div class="card mb-4 shadow">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-sm-4"></div>
                        <div class="col-sm-4">
                                <div class="card shadow">
                                    <div class="card-header">
                                        <div class="card-title">Edit Device</div>
                                    </div>
                                    <div class="card-body">
                                        <form action="{{ url($prefix . 'update') }}" method="post">
                                            @csrf
                                            <input type="hidden" name="id" value="{{ $data->id }}">
                                            <div class="form-group">
                                                <label class="small">Name <span class="text-danger">*</span></label>
                                                <input type="text" class="form-control @error('name') is-invalid @enderror"
                                                    value="{{ $data->name }}" name="name" aria-describedby="hostnameHelp"
                                                    id="name" placeholder="Enter Session Name (Any)" required>
                                                @error('name')
                                                    <span class="text-danger small">{{ $message }}</span>
                                                @enderror
                                            </div>
                                            <div class="form-group">
                                                <label class="small">Number <span class="text-danger">*</span></label>
                                                <input type="number" class="form-control @error('number') is-invalid @enderror"
                                                    value="{{ $data->number }}" name="number" aria-describedby="numberHelp"
                                                    id="number" placeholder="Enter WhatsApp Number" required>
                                                @error('number')
                                                    <span class="text-danger small">{{ $message }}</span>
                                                @enderror
                                            </div>
                                            <div class="form-group">
                                                <label class="small">Description</label>
                                                <textarea name="description" id="" cols="30" rows="3" class="form-control @error('description') is-invalid @enderror" placeholder="Enter Description (any)">{{$data->description}}</textarea>
                                                @error('description')
                                                    <span class="text-danger small">{{ $message }}</span>
                                                @enderror
                                            </div>
                                            <div class="form-group">
                                                <label class="small">Multi Device <span class="text-danger">*</span></label>
                                                <select name="multi_device" id="multi_device"
                                                    class="form-control @error('multi_device') is-invalid @enderror" required>
                                                    <option value="" selected disabled>Select Option*</option>
                                                    <option value="yes" @if($data->multi_device == 'yes') selected @endif>Yes</option>
                                                    <option value="no" @if($data->multi_device == 'no') selected @endif>No</option>
                                                </select>
                                                @error('multi_device')
                                                    <span class="text-danger small">{{ $message }}</span>
                                                @enderror
                                            </div>
                                            <div class="form-group">
                                                <label class="small">Message Delay Time <span class="text-danger">*</span></label>
                                                <input type="number" class="form-control @error('message_delay') is-invalid @enderror"
                                                    value="{{$data->message_delay }}" name="message_delay" aria-describedby="numberHelp"
                                                    id="message_delay" placeholder="Enter Message Delay Time In Seconds" required>
                                                @error('message_delay')
                                                    <span class="text-danger small">{{ $message }}</span>
                                                @enderror
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-12">
                                                    <div class="text-right mt-4">
                                                        <a class="btn btn-secondary text-uppercase font-weight-bold rounded pl-4 pr-4"
                                                            href="{{ url()->previous() }}">Cancel</a>
                                                        <button class="btn btn-primary text-uppercase font-weight-bold rounded pl-4 pr-4"
                                                            type="submit">Update Device</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <small class="d-block text-end mt-3">

        </small>
    </div>
    </div>
@endsection

@section('scripts')
    <script></script>
@endsection
