feat(chat): pedir cédula y celular al crear cuenta desde el chat
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a693ce2527
commit
5f06c27869
@@ -31,6 +31,8 @@ class PublicChat extends Component
|
|||||||
public string $paso = 'email'; // email | verificacion | registro | chat
|
public string $paso = 'email'; // email | verificacion | registro | chat
|
||||||
public string $email = '';
|
public string $email = '';
|
||||||
public string $nombreRegistro = '';
|
public string $nombreRegistro = '';
|
||||||
|
public string $cedulaRegistro = '';
|
||||||
|
public string $celularRegistro = '';
|
||||||
public string $codigoIngresado = '';
|
public string $codigoIngresado = '';
|
||||||
public ?string $emailMascarado = null;
|
public ?string $emailMascarado = null;
|
||||||
public ?int $contactIdPending = null; // contact.id mientras espera verificacion
|
public ?int $contactIdPending = null; // contact.id mientras espera verificacion
|
||||||
@@ -55,6 +57,8 @@ class PublicChat extends Component
|
|||||||
protected $rules = [
|
protected $rules = [
|
||||||
'email' => 'required|email|max:100',
|
'email' => 'required|email|max:100',
|
||||||
'nombreRegistro' => 'required|max:80',
|
'nombreRegistro' => 'required|max:80',
|
||||||
|
'cedulaRegistro' => 'nullable|max:20',
|
||||||
|
'celularRegistro' => 'nullable|max:20',
|
||||||
'codigoIngresado' => 'nullable|digits:6',
|
'codigoIngresado' => 'nullable|digits:6',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -95,14 +99,19 @@ class PublicChat extends Component
|
|||||||
public function crearCuenta(): void
|
public function crearCuenta(): void
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'email' => 'required|email|max:100',
|
'email' => 'required|email|max:100',
|
||||||
'nombreRegistro' => 'required|max:80',
|
'nombreRegistro' => 'required|max:80',
|
||||||
|
'cedulaRegistro' => 'nullable|max:20',
|
||||||
|
'celularRegistro' => 'nullable|max:20',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'name' => $this->nombreRegistro,
|
'name' => $this->nombreRegistro,
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
'password' => \Illuminate\Support\Facades\Hash::make(\Illuminate\Support\Str::random(16)),
|
'password' => Hash::make(Str::random(16)),
|
||||||
|
'cedula' => $this->cedulaRegistro ?: null,
|
||||||
|
'celular' => $this->celularRegistro ?: null,
|
||||||
|
'estado' => 'activo',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$contact = ChatContact::create([
|
$contact = ChatContact::create([
|
||||||
@@ -121,9 +130,11 @@ class PublicChat extends Component
|
|||||||
|
|
||||||
public function rechazarRegistro(): void
|
public function rechazarRegistro(): void
|
||||||
{
|
{
|
||||||
$this->email = '';
|
$this->email = '';
|
||||||
$this->nombreRegistro = '';
|
$this->nombreRegistro = '';
|
||||||
$this->paso = 'email';
|
$this->cedulaRegistro = '';
|
||||||
|
$this->celularRegistro = '';
|
||||||
|
$this->paso = 'email';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class User extends Authenticatable
|
|||||||
'parent_id',
|
'parent_id',
|
||||||
|
|
||||||
'rank_id',
|
'rank_id',
|
||||||
|
'celular',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@@ -58,13 +58,29 @@
|
|||||||
|
|
||||||
<form wire:submit.prevent="crearCuenta" class="space-y-4">
|
<form wire:submit.prevent="crearCuenta" class="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-[#8696a0] text-xs font-medium mb-1.5 uppercase tracking-wider">Tu nombre *</label>
|
<label class="block text-[#8696a0] text-xs font-medium mb-1.5 uppercase tracking-wider">Nombre completo *</label>
|
||||||
<input wire:model.defer="nombreRegistro" type="text" autocomplete="name"
|
<input wire:model.defer="nombreRegistro" type="text" autocomplete="name"
|
||||||
placeholder="¿Cómo te llamas?"
|
placeholder="¿Cómo te llamas?"
|
||||||
class="w-full bg-[#2a3942] text-white rounded-xl px-4 py-3.5 outline-none border border-transparent focus:border-[#00a884] transition placeholder-[#8696a0]"
|
class="w-full bg-[#2a3942] text-white rounded-xl px-4 py-3.5 outline-none border border-transparent focus:border-[#00a884] transition placeholder-[#8696a0]"
|
||||||
style="color-scheme: dark;">
|
style="color-scheme: dark;">
|
||||||
@error('nombreRegistro') <span class="text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
|
@error('nombreRegistro') <span class="text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-[#8696a0] text-xs font-medium mb-1.5 uppercase tracking-wider">Cédula</label>
|
||||||
|
<input wire:model.defer="cedulaRegistro" type="text" inputmode="numeric"
|
||||||
|
placeholder="Número de cédula"
|
||||||
|
class="w-full bg-[#2a3942] text-white rounded-xl px-4 py-3.5 outline-none border border-transparent focus:border-[#00a884] transition placeholder-[#8696a0]"
|
||||||
|
style="color-scheme: dark;">
|
||||||
|
@error('cedulaRegistro') <span class="text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-[#8696a0] text-xs font-medium mb-1.5 uppercase tracking-wider">Celular</label>
|
||||||
|
<input wire:model.defer="celularRegistro" type="tel" inputmode="tel" autocomplete="tel"
|
||||||
|
placeholder="Ej: 3001234567"
|
||||||
|
class="w-full bg-[#2a3942] text-white rounded-xl px-4 py-3.5 outline-none border border-transparent focus:border-[#00a884] transition placeholder-[#8696a0]"
|
||||||
|
style="color-scheme: dark;">
|
||||||
|
@error('celularRegistro') <span class="text-red-400 text-xs mt-1 block">{{ $message }}</span> @enderror
|
||||||
|
</div>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="w-full bg-[#00a884] active:bg-[#06cf9c] text-white font-semibold rounded-xl transition shadow-lg"
|
class="w-full bg-[#00a884] active:bg-[#06cf9c] text-white font-semibold rounded-xl transition shadow-lg"
|
||||||
style="min-height: 48px;">
|
style="min-height: 48px;">
|
||||||
|
|||||||
Reference in New Issue
Block a user