star-cloud/resources/views/admin/app/ui-machines/index.blade.php
terrylee 888db7ffe7 feat(app-ui): UI組合編輯/機台設定 也加每頁筆數+搜尋+分頁
抽共用元件 x-app-list-controls(3頁共用);bundles 依名稱、machines 依名稱/序號搜尋 paginate

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 10:38:44 +08:00

55 lines
3.1 KiB
PHP

@extends('layouts.admin')
@section('content')
<div class="px-6 py-8">
<x-app-tabs active="machines" />
<x-app-list-controls :route="route('admin.app.ui-machines')" :perPage="$perPage" :search="$search" :placeholder="__('Search machine or serial...')" />
<div class="overflow-x-auto">
<table class="min-w-full bg-white dark:bg-gray-800 rounded-lg overflow-hidden">
<thead class="bg-gray-100 dark:bg-gray-700">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-400 uppercase">{{ __('Machine') }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-400 uppercase">{{ __('Current Bundle') }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-400 uppercase">{{ __('Bind UI Bundle') }}</th>
</tr>
</thead>
<tbody class="divide-y border-gray-200 dark:border-gray-700">
@forelse($machines as $machine)
@php
$currentId = data_get($machine->settings, 'ui_bundle_id');
$currentName = $currentId ? ($bundleNames[$currentId] ?? __('(deleted)')) : '—';
@endphp
<tr>
<td class="px-6 py-4">
<div class="font-medium text-gray-900 dark:text-gray-200">{{ $machine->name }}</div>
<div class="text-xs text-gray-400">{{ $machine->serial_no }}</div>
</td>
<td class="px-6 py-4 text-gray-900 dark:text-gray-200">{{ $currentName }}</td>
<td class="px-6 py-4">
<form action="{{ route('admin.app.ui-machines.update', $machine) }}" method="POST" class="flex gap-2 items-center max-w-md">
@csrf @method('PUT')
<select name="ui_bundle_id" class="flex-1 px-3 py-2 bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 border rounded-md text-gray-900 dark:text-gray-200 text-sm focus:ring-2 focus:ring-cyan-500">
<option value="">{{ __('Not set') }}</option>
@foreach($bundles as $bundle)
<option value="{{ $bundle->id }}" {{ (string)$currentId === (string)$bundle->id ? 'selected' : '' }}>{{ $bundle->name }}</option>
@endforeach
</select>
<button type="submit" class="btn-luxury-primary">{{ __('Save') }}</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="3" class="px-6 py-4 text-center text-gray-600 dark:text-gray-400">{{ __('No data') }}</td></tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4">
{{ $machines->links() }}
</div>
</div>
@endsection