@extends('layout.app')

@section('content')

    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h3 class="card-title" style="color:#115548;">Add Smart Device
                            </h3>
                        </div>
                        <div class="card-body">
                            <form action="{{ route('smartdevice.store') }}" method="POST">
                                @csrf
                                <div class="row">
                                    <div class="col-md-3">
                                        <div class="form-group">
                                            <label for="name">Smart Device Name<span
                                                    style="color: red;">*</span></label>
                                            <input type="text" class="form-control" id="name" name="name"
                                                placeholder="Enter Smart Device Name" required>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        <div class="form-group">
                                            <label for="status">Status<span
                                                    style="color: red;">*</span></label>
                                            <select class="form-control" id="status" name="status" required>
                                                <option value="Active">Active</option>
                                                <option value="Inactive">Inactive</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        <button type="submit" class="btn btn-primary mt-4">Submit</button>
                                    </div>
                                </div>
                            </form>
                            
                        </div>
                    </div>
                </div>
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h3 class="card-title" style="color:#115548;">Smart Device List
                            </h3>
                        </div>
                        <div class="card-body">
                            <table id="example1" class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        <th>SL</th>
                                        <th>Smart Device Name</th>
                                        <th>Status</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($smartDevices as $key => $smartDevice)
                                        <tr>
                                            <td>{{ $key + 1 }}</td>
                                            <td>{{ $smartDevice->name }}</td>
                                            <td>{{ $smartDevice->status }}</td>
                                            <td>
                                                <!-- Action buttons can be added here -->
                                                <a href="{{ route('smartdevice.edit', $smartDevice->id) }}" class="btn btn-sm btn-primary">Edit</a>
                                            </td>
                                        </tr>
                                    @endforeach
                                </tbody>
                            </table>                            
                        </div>
                    </div>
                </div>

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

@endsection

@section('js')

@endsection
@push('script')
@endpush

@section('ajax')
    

@endsection
