This commit is contained in:
lizandrogd
2023-10-07 08:42:57 -05:00
parent 1124b737c6
commit 8e19bd129e
22 changed files with 727 additions and 523 deletions
+6 -3
View File
@@ -274,7 +274,7 @@ class ShowServicios extends Component
if ((int) $pantalla_servicio >= (int) $cantidad_solicitada && (int) $pantalla_servicio_completa != (int) $this->pantallas_tarjetaPlan) {
$suma = $pantalla_servicio - $cantidad_solicitada;
$cantidad_necesaria = 1;
$cantidad_necesaria = $this->cantidad_tarjetaPlan;
$cuenta = Cuentas::where('servicio_id', $this->servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'ASC')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', $suma)->get();
} elseif ((int) $pantalla_servicio_completa == (int) $this->pantallas_tarjetaPlan) {
@@ -292,10 +292,11 @@ class ShowServicios extends Component
$cuenta = null;
$cantidad_necesaria = null;
}
//dd($cuenta, $cantidad_necesaria);
for ($h = 0; $h < (int) $cantidad_necesaria; $h++) {
//dd($h);
if (!empty($cuenta)) {
$perfil = $cuenta[$h]->historiales_count;
for ($y = 0; $y < (int) $pantallas; $y++) {
@@ -315,6 +316,7 @@ class ShowServicios extends Component
}
}
//dd($historial->cuentas);
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
$saldo_anterior = $descuento->valor;
@@ -323,6 +325,7 @@ class ShowServicios extends Component
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
if ($cobro) {
$historial->update(['estado' => 'activo']);
$this->credenciales($historial);
} else {
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [