@extends('layouts.app') @section('title','Security & Roles') @section('content')<div class="space-y-6"><h1 class="text-2xl font-black">Roles, Permissions & Attendance IP Rules</h1><div class="grid gap-6 lg:grid-cols-2"><div class="space-y-3">@foreach($roles as $role)<form class="card p-4" method="POST" action="{{ route('security.role.sync',$role) }}">@csrf @method('PATCH')<h2 class="font-bold">{{ $role->name }}</h2><div class="mt-3 grid grid-cols-2 gap-2">@foreach($permissions as $p)<label class="text-xs"><input type="checkbox" name="permissions[]" value="{{ $p->id }}" @checked($role->permissions->contains($p))> {{ $p->slug }}</label>@endforeach</div><button class="btn btn-soft mt-3">Save permissions</button></form>@endforeach</div><div><form class="card p-4" method="POST" action="{{ route('security.ip.store') }}">@csrf<h2 class="font-bold">Add approved office network</h2><select class="input mt-3 w-full" name="office_id">@foreach($offices as $o)<option value="{{ $o->id }}">{{ $o->name }}</option>@endforeach</select><input class="input mt-3 w-full" name="label" placeholder="Main office public IP" required><input class="input mt-3 w-full" name="cidr" placeholder="203.0.113.10 or 203.0.113.0/24" required><button class="btn btn-primary mt-3">Add rule</button></form>@foreach($offices as $o)<div class="card mt-3 p-4"><h3 class="font-bold">{{ $o->name }}</h3>@foreach($o->ipRules as $x)<div class="mt-2 flex justify-between text-sm"><span>{{ $x->label }} — <code>{{ $x->cidr }}</code></span><form method="POST" action="{{ route('security.ip.delete',$x) }}">@csrf @method('DELETE')<button class="text-red-600">Remove</button></form></div>@endforeach</div>@endforeach</div></div></div>@endsection