creo que pude instalar select2, create sales y crud client o casi crud
This commit is contained in:
@@ -1,5 +1,49 @@
|
||||
@extends('layouts.app')
|
||||
@section('main')
|
||||
<h1>formulario de crear cliente</h1>
|
||||
<x-layout title="Lauck - Nuevo Cliente">
|
||||
|
||||
@endsection
|
||||
<x-section-header subtitle="Gestión de Clientes" title="Nuevo " highlight="Cliente" />
|
||||
|
||||
<div class="w-full max-w-4xl mx-auto bg-panel-bg border border-neutral-800 rounded-xl p-8 shadow-lg">
|
||||
|
||||
<form action="{{ route('clients.store') }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<input type="hidden" name="origin" value="{{ request('origin') }}">
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-6">
|
||||
|
||||
<div class="md:col-span-4">
|
||||
<x-forms.label for="name" value="Nombre Completo" />
|
||||
<x-forms.input id="name" name="name" type="text" :value="old('name')" required autofocus placeholder="Ej: Sergio Lauck" :error="$errors->first('name')" />
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2">
|
||||
<x-forms.label for="phone" value="Teléfono / WhatsApp" />
|
||||
<x-forms.input id="phone" name="phone" type="text" :value="old('phone')" placeholder="Ej: 343 154..." :error="$errors->first('phone')" />
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2">
|
||||
<x-forms.label for="email" value="Correo Electrónico" />
|
||||
<x-forms.input id="email" name="email" type="email" :value="old('email')" placeholder="cliente@ejemplo.com" :error="$errors->first('email')" />
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-4">
|
||||
<x-forms.label for="address" value="Dirección / Domicilio" />
|
||||
<textarea id="address" name="address" rows="3" class="bg-neutral-800 border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5 placeholder-gray-500" placeholder="Calle, número, piso...">{{ old('address') }}</textarea>
|
||||
@error('address')
|
||||
<span class="text-red-500 text-xs mt-1">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between md:justify-end space-x-4 border-t border-neutral-800 pt-6">
|
||||
<a href="{{ route('sales.create') }}" class="text-gray-400 hover:text-white font-medium text-sm transition-colors">Cancelar</a>
|
||||
|
||||
<button type="submit" class="px-6 py-2.5 bg-neon-lime text-neutral-900 font-bold rounded-lg hover:bg-[#b3e600] transition-colors shadow-lg shadow-neon-lime/20">
|
||||
Guardar Cliente
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</x-layout>
|
||||
@@ -0,0 +1,79 @@
|
||||
<x-layout title="Lauck - Editar Cliente">
|
||||
|
||||
<x-section-header subtitle="Gestión de Clientes" title="Editar " highlight="Cliente" />
|
||||
|
||||
<div class="w-full max-w-4xl mx-auto bg-panel-bg border border-neutral-800 rounded-xl p-8 shadow-lg">
|
||||
|
||||
<form action="{{ route('clients.update', $client) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT') <div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-6">
|
||||
|
||||
<div class="md:col-span-4">
|
||||
<x-forms.label for="name" value="Nombre Completo" />
|
||||
<x-forms.input
|
||||
id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
:value="old('name', $client->name)"
|
||||
required
|
||||
autofocus
|
||||
placeholder="Ej: Sergio Lauck"
|
||||
:error="$errors->first('name')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2">
|
||||
<x-forms.label for="phone" value="Teléfono / WhatsApp" />
|
||||
<x-forms.input
|
||||
id="phone"
|
||||
name="phone"
|
||||
type="text"
|
||||
:value="old('phone', $client->phone)"
|
||||
placeholder="Ej: 343 154..."
|
||||
:error="$errors->first('phone')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2">
|
||||
<x-forms.label for="email" value="Correo Electrónico" />
|
||||
<x-forms.input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
:value="old('email', $client->email)"
|
||||
placeholder="cliente@ejemplo.com"
|
||||
:error="$errors->first('email')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-4">
|
||||
<x-forms.label for="address" value="Dirección / Domicilio" />
|
||||
<textarea
|
||||
id="address"
|
||||
name="address"
|
||||
rows="3"
|
||||
class="bg-neutral-800 border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5 placeholder-gray-500"
|
||||
placeholder="Calle, número, piso..."
|
||||
>{{ old('address', $client->address) }}</textarea>
|
||||
|
||||
@error('address')
|
||||
<span class="text-red-500 text-xs mt-1">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between md:justify-end space-x-4 border-t border-neutral-800 pt-6">
|
||||
|
||||
<a href="{{ route('clients.index') }}" class="text-gray-400 hover:text-white font-medium text-sm transition-colors">
|
||||
Cancelar
|
||||
</a>
|
||||
|
||||
<button type="submit" class="px-6 py-2.5 bg-neon-lime text-neutral-900 font-bold rounded-lg hover:bg-[#b3e600] transition-colors shadow-lg shadow-neon-lime/20">
|
||||
Actualizar Cliente
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</x-layout>
|
||||
@@ -0,0 +1,105 @@
|
||||
<x-layout title="Lauck - Clientes">
|
||||
|
||||
<x-section-header subtitle="Gestión de Clientes" title="Cartera de " highlight="Clientes" />
|
||||
|
||||
@if(session('success'))
|
||||
<div class="bg-green-900/50 border border-green-500 text-green-300 px-4 py-3 rounded-lg mb-6 shadow-sm">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="w-full flex flex-col md:flex-row justify-between items-center gap-4 mb-6">
|
||||
|
||||
<form action="{{ route('clients.index') }}" method="GET" class="w-full md:w-1/2">
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
||||
<svg class="w-4 h-4 text-gray-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<input type="text" name="search" value="{{ request('search') }}"
|
||||
class="block w-full p-3 ps-10 text-sm text-white border border-neutral-700 rounded-lg bg-neutral-800 focus:ring-neon-lime focus:border-neon-lime placeholder-gray-500"
|
||||
placeholder="Buscar por nombre, teléfono o email...">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<a href="{{ route('clients.create') }}" class="w-full md:w-auto text-center px-5 py-3 text-sm font-bold text-neutral-900 bg-neon-lime rounded-lg hover:bg-[#b3e600] transition-colors uppercase tracking-wide shadow-lg shadow-neon-lime/20">
|
||||
+ Nuevo Cliente
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="relative overflow-x-auto shadow-md sm:rounded-lg border border-neutral-800 w-full">
|
||||
<table class="w-full text-sm text-left rtl:text-right text-gray-400">
|
||||
<thead class="text-xs text-gray-300 uppercase bg-neutral-800 border-b border-neutral-700">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3">Cliente / Email</th>
|
||||
<th scope="col" class="px-6 py-3">Teléfono / WhatsApp</th>
|
||||
<th scope="col" class="px-6 py-3">Dirección</th>
|
||||
<th scope="col" class="px-6 py-3 text-right">Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($clients as $client)
|
||||
<tr class="bg-neutral-900/50 border-b border-neutral-800 hover:bg-neutral-800 transition-colors group">
|
||||
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="text-base font-bold text-white">{{ $client->name }}</div>
|
||||
<div class="text-xs text-gray-500 font-mono">
|
||||
{{ $client->email ?? 'Sin email registrado' }}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4">
|
||||
@if($client->phone)
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-mono text-gray-300">{{ $client->phone }}</span>
|
||||
<span class="text-green-500 text-xs bg-green-900/30 px-1.5 py-0.5 rounded">WA</span>
|
||||
</div>
|
||||
@else
|
||||
<span class="text-gray-600 italic">No registrado</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4">
|
||||
<span class="text-gray-400 truncate max-w-xs block" title="{{ $client->address }}">
|
||||
{{ $client->address ?? '-' }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4 text-right flex items-center justify-end gap-3">
|
||||
<a href="{{ route('clients.edit', $client) }}" class="font-medium text-blue-400 hover:text-blue-300 hover:underline transition-colors">
|
||||
Editar
|
||||
</a>
|
||||
|
||||
<form action="{{ route('clients.destroy', $client) }}" method="POST" class="inline-block" onsubmit="return confirm('¿Estás seguro de que deseas eliminar este cliente? Esta acción no se puede deshacer.');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
||||
<button type="submit" class="font-medium text-red-500 hover:text-red-400 hover:underline transition-colors cursor-pointer bg-transparent border-0 p-0">
|
||||
Eliminar
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="px-6 py-10 text-center text-gray-500">
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 mb-2 opacity-50" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" />
|
||||
</svg>
|
||||
<p>No se encontraron clientes.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 w-full">
|
||||
{{ $clients->links() }}
|
||||
</div>
|
||||
|
||||
</x-layout>
|
||||
Reference in New Issue
Block a user