This commit is contained in:
Lizandro Guarnizo
2024-04-30 22:09:19 -05:00
parent 405b27178f
commit 9d3f9ff3d5
2 changed files with 52 additions and 36 deletions
+24 -6
View File
@@ -197,7 +197,9 @@ class ShowPromociones extends Component
public function getListeners() public function getListeners()
{ {
return [ return [
'confirmed', 'confirmarCompra', 'denegarCompra' 'confirmed',
'confirmarCompra',
'denegarCompra'
]; ];
} }
@@ -276,11 +278,24 @@ class ShowPromociones extends Component
$this->fecha_final_1 = $today = Carbon::now()->addDays($tarifa->dias - 20); $this->fecha_final_1 = $today = Carbon::now()->addDays($tarifa->dias - 20);
$this->fecha_final_2 = $today = Carbon::now()->addDays($tarifa->dias + 20); $this->fecha_final_2 = $today = Carbon::now()->addDays($tarifa->dias + 20);
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->whereDate('vencimiento', '>=', $this->fecha_final_1) $cuenta = Cuentas::where('servicio_id', $servicio_id)
->whereDate('inicio', '>=', $this->fecha)
->whereDate('vencimiento', '>=', $this->fecha_final_1)
->whereDate('vencimiento', '<=', $this->fecha_final_2) ->whereDate('vencimiento', '<=', $this->fecha_final_2)
->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'pendiente')->having('historiales_count', '==', 0)->first(); ->Orderby('created_at', 'ASC')->with('historiales')
->withCount('historiales')
->where('estado', 'pendiente')
->having('historiales_count', '==', 0)
->first();
} else { } else {
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', (int)$faltante)->first(); $cuenta = Cuentas::where('servicio_id', $servicio_id)
->whereDate('inicio', '>=', $this->fecha)
->Orderby('created_at', 'ASC')
->with('historiales')
->withCount('historiales')
->where('estado', 'activo')
->having('historiales_count', '<=', (int) $faltante)
->first();
} }
if (!is_null($cuenta)) { if (!is_null($cuenta)) {
@@ -463,7 +478,9 @@ class ShowPromociones extends Component
$curl = curl_init(); $curl = curl_init();
curl_setopt_array($curl, array( curl_setopt_array(
$curl,
array(
CURLOPT_URL => "https://api.labsmobile.com/json/send", CURLOPT_URL => "https://api.labsmobile.com/json/send",
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "", CURLOPT_ENCODING => "",
@@ -477,7 +494,8 @@ class ShowPromociones extends Component
"Cache-Control: no-cache", "Cache-Control: no-cache",
"Content-Type: application/json" "Content-Type: application/json"
), ),
)); )
);
$response = curl_exec($curl); $response = curl_exec($curl);
$err = curl_error($curl); $err = curl_error($curl);
-2
View File
@@ -285,8 +285,6 @@ class ShowServicios extends Component
if ((int) $pantalla_servicio >= (int) $cantidad_solicitada && (int) $pantalla_servicio_completa != (int) $this->pantallas_tarjetaPlan) { if ((int) $pantalla_servicio >= (int) $cantidad_solicitada && (int) $pantalla_servicio_completa != (int) $this->pantallas_tarjetaPlan) {
$suma = $pantalla_servicio - $cantidad_solicitada; $suma = $pantalla_servicio - $cantidad_solicitada;
$cantidad_necesaria = $this->cantidad_tarjetaPlan; $cantidad_necesaria = $this->cantidad_tarjetaPlan;
$cuenta = Cuentas::where('servicio_id', $this->servicio_id) $cuenta = Cuentas::where('servicio_id', $this->servicio_id)
->whereDate('inicio', '>=', $this->fecha) ->whereDate('inicio', '>=', $this->fecha)