update promociones

This commit is contained in:
lizandrogd
2024-05-28 19:49:53 -05:00
parent 3b15772c3c
commit d2f6db683e
+12 -6
View File
@@ -282,7 +282,7 @@ class ShowPromociones extends Component
->whereDate('inicio', '>=', $this->fecha)
->whereDate('vencimiento', '>=', $this->fecha_final_1)
->whereDate('vencimiento', '<=', $this->fecha_final_2)
->Orderby('created_at', 'ASC')->with('historiales')
->Orderby('inicio', 'ASC')->with('historiales')
->withCount('historiales')
->where('estado', 'pendiente')
->having('historiales_count', '==', 0)
@@ -290,7 +290,7 @@ class ShowPromociones extends Component
} else {
$cuenta = Cuentas::where('servicio_id', $servicio_id)
->whereDate('inicio', '>=', $this->fecha)
->Orderby('created_at', 'ASC')
->Orderby('inicio', 'ASC')
->with('historiales')
->withCount('historiales')
->where('estado', 'activo')
@@ -358,7 +358,7 @@ class ShowPromociones extends Component
$logsGeneral = new Log_general();
$logsGeneral->user_id = Auth::user()->id;
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha comprado la promocion ' . $this->consulta->nombre . ' - ' . $this->consulta->descripcion . ' cantidad de ' . $this->historial->cantidad ?? '' . ' por un valor de $' . $this->historial->valor ?? '';
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha comprado la promocion ' . $this->consulta->nombre . ' - ' . $this->consulta->descripcion . ' cantidad de ' . $this->historial->cantidad ?? '' . ' por un valor de $' . $this->historial->valor .', Saldo anterior: $'.$saldo_anterior.', Nuevo saldo disponible: $'.$nuevo_saldo;
$logsGeneral->save();
$this->modalComprarPromo = false;
@@ -398,13 +398,16 @@ class ShowPromociones extends Component
$logsGeneral = new Log_general();
$logsGeneral->user_id = Auth::user()->id;
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha comprado la promocion ' . $this->consulta->nombre . ' - ' . $this->consulta->descripcion . ' cantidad de ' . $this->historial->cantidad ?? '' . ' por un valor de $' . $this->historial->valor ?? '' . ' y algunos han quedado pendientes';
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha comprado la promocion ' . $this->consulta->nombre . ' - ' . $this->consulta->descripcion . ' cantidad de ' . $this->historial->cantidad ?? '' . ' por un valor de $' . $this->historial->valor ?? '' . ' y algunos han quedado pendientes'.', Saldo anterior: $'.$saldo_anterior.', Nuevo saldo disponible: $'.$nuevo_saldo;
$logsGeneral->save();
$this->credenciales($this->historial);
} else {
Historial_cuenta::whereIn('id', $this->n)->delete();
$logsGeneral = new Log_general();
$logsGeneral->user_id = Auth::user()->id;
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' Tuvo error en el cobro, Comprando la promoción ' . $this->consulta->nombre . ' cantidad de ' . $this->historial->cantidad . ' por un valor de $' . $this->historial->valor .' No se desconto el saldo, ni se asignaron cuentas.';
$logsGeneral->save();
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
'position' => 'top'
]);
@@ -423,7 +426,10 @@ class ShowPromociones extends Component
public function denegarCompra()
{
Historial_cuenta::whereIn('id', $this->n)->delete();
$logsGeneral = new Log_general();
$logsGeneral->user_id = Auth::user()->id;
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' Cancelo la compra del plan ' . $this->consulta->nombre . ' cantidad de ' . $this->historial->cantidad . ' por un valor de $' . $this->historial->valor.' No se desconto el saldo, ni se asignaron cuentas.';
$logsGeneral->save();
$this->alert('success', 'Compra cancelada!', [
'position' => 'top'
]);