pendientes fixed
This commit is contained in:
@@ -317,21 +317,17 @@ class ShowPromociones extends Component
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
|
||||||
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
|
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
|
||||||
$saldo_anterior = $descuento->valor;
|
$saldo_anterior = $descuento->valor;
|
||||||
$nuevo_saldo = $saldo_anterior - ($this->precioAhora *$this->cantidad_comprarPromo);
|
$nuevo_saldo = $saldo_anterior - ($this->precioAhora *$this->cantidad_comprarPromo);
|
||||||
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
|
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
|
||||||
//dd($cobro);
|
|
||||||
if ($cobro) {
|
if ($cobro) {
|
||||||
$historial->update(['estado' => 'activo']);
|
$historial->update(['estado' => 'activo']);
|
||||||
$this->modalComprarPromo = false;
|
$this->modalComprarPromo = false;
|
||||||
$this->credenciales($historial);
|
$this->credenciales($historial);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$eliminar = Historial_cuenta::whereIn('id',$this->n)->delete();
|
$eliminar = Historial_cuenta::whereIn('id',$this->n)->delete();
|
||||||
//dd($eliminar);
|
|
||||||
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
|
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
|
||||||
'position' => 'top']);
|
'position' => 'top']);
|
||||||
}
|
}
|
||||||
@@ -350,12 +346,15 @@ class ShowPromociones extends Component
|
|||||||
$this->modalComprarPromo = false;
|
$this->modalComprarPromo = false;
|
||||||
|
|
||||||
foreach ($this->f as $serviceId) {
|
foreach ($this->f as $serviceId) {
|
||||||
$pendiente = new Pendientes();
|
|
||||||
$pendiente->historial_id = $this->historial->id;
|
for ($y = 0; $y < (int)$this->cantidad_comprarPromo; $y++) {
|
||||||
$pendiente->cantidad = $this->cantidad_comprarPromo;
|
$pendiente = new Pendientes();
|
||||||
$pendiente->estado = 'pendiente';
|
$pendiente->historial_id = $this->historial->id;
|
||||||
$pendiente->servicio_id = $serviceId;
|
$pendiente->cantidad = '1';
|
||||||
$pendiente->save();
|
$pendiente->estado = 'pendiente';
|
||||||
|
$pendiente->servicio_id = $serviceId;
|
||||||
|
$pendiente->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->credenciales($this->historial);
|
$this->credenciales($this->historial);
|
||||||
|
|||||||
Reference in New Issue
Block a user