promociones validadas
This commit is contained in:
@@ -104,7 +104,7 @@ class ShowPromociones extends Component
|
|||||||
'nombre_comprarPromo' => 'required',
|
'nombre_comprarPromo' => 'required',
|
||||||
'celular_comprarPromo' => 'required',
|
'celular_comprarPromo' => 'required',
|
||||||
'email_comprarPromo' => 'required',
|
'email_comprarPromo' => 'required',
|
||||||
'cantidad_comprarPromo' => 'required',
|
'cantidad_comprarPromo' => 'required|numeric|min:1',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
@@ -207,9 +207,22 @@ class ShowPromociones extends Component
|
|||||||
|
|
||||||
public function pagar()
|
public function pagar()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->validate();
|
$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;
|
$usuario_existe = User::firstWhere('email', $this->email_comprarPromo)->id ?? null;
|
||||||
|
|
||||||
if (is_null($usuario_existe)) {
|
if (is_null($usuario_existe)) {
|
||||||
|
|||||||
@@ -808,10 +808,10 @@
|
|||||||
<label for="cantidad_comprarPromo"
|
<label for="cantidad_comprarPromo"
|
||||||
class="block text-gray-700 text-sm font-bold mb-2">Cantidad:</label>
|
class="block text-gray-700 text-sm font-bold mb-2">Cantidad:</label>
|
||||||
<input type="number" id="cantidad_comprarPromo" min="1"
|
<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">
|
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')
|
@error('cantidad_comprarPromo')
|
||||||
<span class="text-red-400 text-sm ">Requerido*</span>
|
<span class="text-red-400 text-sm block">Requerido*</span>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user