promociones validadas

This commit is contained in:
Felipe
2024-01-17 17:25:49 -05:00
parent 88124183a4
commit 92a930cf0c
2 changed files with 21 additions and 8 deletions
+15 -2
View File
@@ -104,7 +104,7 @@ class ShowPromociones extends Component
'nombre_comprarPromo' => 'required',
'celular_comprarPromo' => 'required',
'email_comprarPromo' => 'required',
'cantidad_comprarPromo' => 'required',
'cantidad_comprarPromo' => 'required|numeric|min:1',
];
public function render()
@@ -207,9 +207,22 @@ class ShowPromociones extends Component
public function pagar()
{
$this->validate();
if ($this->cantidad_comprarPromo == 0){
$this->alert('error', 'La cantidad debe ser mayor a 0', [
'position' => 'top'
]);
return;
}
if (auth()->user()->saldo->valor < $this->precioAhora * $this->cantidad_comprarPromo) {
$this->alert('error', 'Saldo insuficiente', [
'position' => 'top'
]);
return;
}
$usuario_existe = User::firstWhere('email', $this->email_comprarPromo)->id ?? null;
if (is_null($usuario_existe)) {
@@ -448,7 +448,7 @@
<label for="imagen_categoria"
class="text-white bg-[#B221FD] hover:bg-[#7a02b8] px-3 py-1 rounded-md cursor-pointer">Subir
img</label>
<input type="file" accept="image" id="imagen_categoria" wire:model="categoria_photo"
<input type="file" accept="image" id="imagen_categoria" wire:model="categoria_photo"
class="hidden border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div>
@@ -456,7 +456,7 @@
@if ($categoria_photo)
<img src="{{$categoria_photo->temporaryUrl()}}" alt="" class="rounded-xl border-2 border-neutral-200 shadow-md w-28 h-20">
@endif
</div>
</div>
@@ -808,10 +808,10 @@
<label for="cantidad_comprarPromo"
class="block text-gray-700 text-sm font-bold mb-2">Cantidad:</label>
<input type="number" id="cantidad_comprarPromo" min="1"
wire:model="cantidad_comprarPromo"
wire:model="cantidad_comprarPromo" name="cantidad_comprarPromo"
class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 w-1/2 py-2 px-3 focus:ring-0 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
@error('cantidad_comprarPromo')
<span class="text-red-400 text-sm ">Requerido*</span>
<span class="text-red-400 text-sm block">Requerido*</span>
@enderror
</div>
</div>
@@ -1037,13 +1037,13 @@
@endswitch
@endif
@endif
@endforeach
@endforeach
*Usuario:* {{ $cuenta->correo }}
*Contraseña:* {{ $cuenta->password }}
@endif
@endforeach
</textarea>
<div class="w-full text-center">