initial commit

This commit is contained in:
Benjamin Nussbaum 2025-02-12 22:15:57 +01:00
parent 32d63c09e7
commit 01655b413e
37 changed files with 2564 additions and 283 deletions

View file

@ -0,0 +1,94 @@
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-semibold dark:text-gray-100">Devices</h2>
<x-primary-button
wire:click="toggleDeviceForm">{{ $showDeviceForm ? 'Cancel' : 'New Device' }}</x-primary-button>
</div>
@if (session()->has('message'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4">
{{ session('message') }}
</div>
@endif
@if ($showDeviceForm)
<div class="bg-gray-50 dark:bg-gray-800 p-6 mb-6 rounded-lg">
<form wire:submit="createDevice">
<div class="mb-4">
<x-input-label for="name" :value="__('Name')"/>
<x-text-input wire:model="name" id="name" class="block mt-1 w-full" type="text" name="name"
autofocus/>
@error('name') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
</div>
<div class="mb-4">
<x-input-label for="mac_address" :value="__('Mac Adress')"/>
<x-text-input wire:model="mac_address" id="mac_address" class="block mt-1 w-full"
type="text" name="mac_address" autofocus/>
@error('mac_address') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
</div>
<div class="mb-4">
<x-input-label for="api_key" :value="__('API Key')"/>
<x-text-input wire:model="api_key" id="api_key" class="block mt-1 w-full" type="text"
name="api_key" autofocus/>
@error('api_key') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
</div>
<div class="mb-4">
<x-input-label for="friendly_id" :value="__('Friendly Id')"/>
<x-text-input wire:model="friendly_id" id="friendly_id" class="block mt-1 w-full"
type="text" name="friendly_id" autofocus/>
@error('friendly_id') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
</div>
<div class="mb-4">
<x-input-label for="default_refresh_interval" :value="__('Refresh Rate (seconds)')"/>
<x-text-input wire:model="default_refresh_interval" id="default_refresh_interval"
class="block mt-1 w-full" type="text" name="default_refresh_interval"
autofocus/>
@error('default_refresh_interval') <span
class="text-red-500 text-xs">{{ $message }}</span> @enderror
</div>
<x-primary-button type="submit">Create Device</x-primary-button>
</form>
</div>
@endif
<div class="overflow-x-auto">
<table class="min-w-full table-auto">
<thead>
<tr class="bg-gray-100 dark:bg-gray-800 ">
<th class="px-6 py-3 text-left dark:text-gray-100">Name</th>
<th class="px-6 py-3 text-left dark:text-gray-100">Friendly ID</th>
<th class="px-6 py-3 text-left dark:text-gray-100">Mac Address</th>
<th class="px-6 py-3 text-left dark:text-gray-100">Refresh</th>
<th class="px-6 py-3 text-left dark:text-gray-100">Actions</th>
</tr>
</thead>
<tbody>
@foreach ($devices as $device)
<tr class="border-b">
<td class="px-6 py-4 dark:text-gray-100">{{ $device->name }}</td>
<td class="px-6 py-4 dark:text-gray-100">{{ $device->friendly_id }}</td>
<td class="px-6 py-4 dark:text-gray-100">{{ $device->mac_address }}</td>
<td class="px-6 py-4 dark:text-gray-100">{{ $device->default_refresh_interval }}</td>
<td class="px-6 py-4 dark:text-gray-100">
<x-secondary-button href="{{ route('devices.configure', $device) }}" wire:navigate>
View
</x-secondary-button>
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="mt-4">
{{ $devices->links() }}
</div>
</div>
</div>
</div>
</div>

View file

@ -30,8 +30,11 @@ new class extends Component
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
{{ __('Dashboard') }}
{{-- <x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>--}}
{{-- {{ __('Dashboard') }}--}}
{{-- </x-nav-link>--}}
<x-nav-link :href="route('devices')" :active="request()->routeIs('devices')" wire:navigate>
{{ __('Devices') }}
</x-nav-link>
</div>
</div>
@ -81,8 +84,11 @@ new class extends Component
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
{{ __('Dashboard') }}
{{-- <x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>--}}
{{-- {{ __('Dashboard') }}--}}
{{-- </x-responsive-nav-link>--}}
<x-responsive-nav-link :href="route('devices')" :active="request()->routeIs('devices')" wire:navigate>
{{ __('Devices') }}
</x-responsive-nav-link>
</div>

View file

@ -51,14 +51,14 @@ new #[Layout('layouts.guest')] class extends Component
<!-- Remember Me -->
<div class="block mt-4">
<label for="remember" class="inline-flex items-center">
<input wire:model="form.remember" id="remember" type="checkbox" class="rounded dark:bg-gray-900 border-gray-300 dark:border-gray-700 text-indigo-600 shadow-sm focus:ring-indigo-500 dark:focus:ring-indigo-600 dark:focus:ring-offset-gray-800" name="remember">
<input wire:model="form.remember" id="remember" type="checkbox" class="rounded dark:bg-gray-900 border-gray-300 dark:border-gray-700 text-orange-600 shadow-sm focus:ring-orange-500 dark:focus:ring-orange-600 dark:focus:ring-offset-gray-800" name="remember">
<span class="ms-2 text-sm text-gray-600 dark:text-gray-400">{{ __('Remember me') }}</span>
</label>
</div>
<div class="flex items-center justify-end mt-4">
@if (Route::has('password.request'))
<a class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800" href="{{ route('password.request') }}" wire:navigate>
<a class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500 dark:focus:ring-offset-gray-800" href="{{ route('password.request') }}" wire:navigate>
{{ __('Forgot your password?') }}
</a>
@endif