This commit is contained in:
Felipe
2024-04-27 16:52:31 -05:00
parent 7250b4abf4
commit 374f3cbb69
6 changed files with 88 additions and 280 deletions
+2 -2
View File
@@ -153,10 +153,10 @@ class ShowConfiguracion extends Component
$nombreCatalogo = Str::random(10) . '.pdf';
$urlCatalogo = $this->catalogo->storeAs('storage', $nombreCatalogo);
} else {
$urlCatalogo = $configuracion->catalogoPDF;
$urlCatalogo = $configuracion->catalogo;
}
$configuracion->catalogoPDF = $urlCatalogo;
$configuracion->catalogo = $urlCatalogo;
$configuracion->save();
$this->alert('success', 'Catalogo actualizados correctamente!', [
+17 -15
View File
@@ -209,7 +209,7 @@ class ShowPromociones extends Component
{
$this->validate();
if ($this->cantidad_comprarPromo == 0){
if ($this->cantidad_comprarPromo == 0) {
$this->alert('error', 'La cantidad debe ser mayor a 0', [
'position' => 'top'
]);
@@ -331,21 +331,23 @@ class ShowPromociones extends Component
'confirmButtonText' => 'Sí, comprar.',
]);
}
}else{
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
$saldo_anterior = $descuento->valor;
$nuevo_saldo = $saldo_anterior - ($this->precioAhora *$this->cantidad_comprarPromo);
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
if ($cobro) {
$historial->update(['estado' => 'activo']);
$this->modalComprarPromo = false;
$this->credenciales($historial);
} else {
$eliminar = Historial_cuenta::whereIn('id',$this->n)->delete();
} else {
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
$saldo_anterior = $descuento->valor;
$nuevo_saldo = $saldo_anterior - ($this->precioAhora * $this->cantidad_comprarPromo);
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
if ($cobro) {
$historial->update(['estado' => 'activo']);
$this->modalComprarPromo = false;
$this->credenciales($historial);
} else {
$eliminar = Historial_cuenta::whereIn('id', $this->n)->delete();
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
'position' => 'top']);
}
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
'position' => 'top'
]);
}
}
}