update: filtro por precios personalizados
This commit is contained in:
@@ -81,7 +81,7 @@ class ShowTop extends Component
|
|||||||
|
|
||||||
$notificacion = new Notificacion();
|
$notificacion = new Notificacion();
|
||||||
$notificacion->remitente_id = Auth::user()->id;
|
$notificacion->remitente_id = Auth::user()->id;
|
||||||
// $notificacion->destinatario_id = 410;
|
// $notificacion->destinatario_id = 410;`
|
||||||
$notificacion->destinatario_id = $vendedor->id;
|
$notificacion->destinatario_id = $vendedor->id;
|
||||||
$notificacion->titulo = 'Felicidades ' . $vendedor->name ?? '' . ' 🎊';
|
$notificacion->titulo = 'Felicidades ' . $vendedor->name ?? '' . ' 🎊';
|
||||||
$notificacion->descripcion = 'Quedaste ' . $rangos[$index] . ' en el #Top10MejoresDistribuidores del mes de ' . date('M', strtotime('last month'));
|
$notificacion->descripcion = 'Quedaste ' . $rangos[$index] . ' en el #Top10MejoresDistribuidores del mes de ' . date('M', strtotime('last month'));
|
||||||
@@ -98,7 +98,7 @@ class ShowTop extends Component
|
|||||||
|
|
||||||
PremioEntregado::create([
|
PremioEntregado::create([
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'fecha' => $year,
|
'fecha' => $month . '-' . $year,
|
||||||
'entregado' => 1
|
'entregado' => 1
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ class ShowUsuarios extends Component
|
|||||||
|
|
||||||
public $entradas = false;
|
public $entradas = false;
|
||||||
|
|
||||||
|
public $verPreciosPersonalizados = false;
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'nombre' => 'required',
|
'nombre' => 'required',
|
||||||
'email' => 'required',
|
'email' => 'required',
|
||||||
@@ -101,7 +103,35 @@ class ShowUsuarios extends Component
|
|||||||
|
|
||||||
$consulta_tarifas = TarifaPromo::take(1);
|
$consulta_tarifas = TarifaPromo::take(1);
|
||||||
|
|
||||||
$consulta_usuarios = User::where('name', 'LIKE', '%' . $this->buscar . '%')->orWhere('email', 'LIKE', '%' . $this->buscar . '%')->with('rol', 'saldo')->orderBy('id', 'DESC')->withCount('historiales_venta')->paginate($this->entradas);
|
$consulta_usuarios = User::withCount(['usuario_tarifas as active_tarifas' => function ($query) {
|
||||||
|
$query->where('visible', 'true');
|
||||||
|
}])
|
||||||
|
->withCount(['usuario_promos as active_promos' => function ($query) {
|
||||||
|
$query->where('visible', 'true');
|
||||||
|
}])
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->where('name', 'LIKE', '%' . $this->buscar . '%')
|
||||||
|
->orWhere('email', 'LIKE', '%' . $this->buscar . '%');
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($this->verPreciosPersonalizados) {
|
||||||
|
$consulta_usuarios = $consulta_usuarios->havingRaw('active_tarifas > 0 OR active_promos > 0');
|
||||||
|
}
|
||||||
|
|
||||||
|
$consulta_usuarios = $consulta_usuarios
|
||||||
|
->with('rol', 'saldo')
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->withCount('historiales_venta')
|
||||||
|
->paginate($this->entradas);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($this->buscar_servicio)) {
|
if (!empty($this->buscar_servicio)) {
|
||||||
$this->consulta_tarifas = Tarifas::where('rol_id', $this->rol_usuario)->with([
|
$this->consulta_tarifas = Tarifas::where('rol_id', $this->rol_usuario)->with([
|
||||||
@@ -125,7 +155,7 @@ class ShowUsuarios extends Component
|
|||||||
if (Auth::user()->rol->nombre == "super") {
|
if (Auth::user()->rol->nombre == "super") {
|
||||||
|
|
||||||
$this->roles = Role::get();
|
$this->roles = Role::get();
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
$this->roles = Role::where('nombre', '=', 'distribuidor')->get();
|
$this->roles = Role::where('nombre', '=', 'distribuidor')->get();
|
||||||
}
|
}
|
||||||
@@ -235,7 +265,7 @@ class ShowUsuarios extends Component
|
|||||||
//Log de recarga de saldo s
|
//Log de recarga de saldo s
|
||||||
$logsGeneral = new Log_general();
|
$logsGeneral = new Log_general();
|
||||||
$logsGeneral->user_id = Auth::user()->id;
|
$logsGeneral->user_id = Auth::user()->id;
|
||||||
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha recargado a ' . $nombre. ' - ' . $email . ' la cantidad de $' . $this->valor_recargar.', Saldo anterior: $'.$this->saldo_actual.', Nuevo saldo disponible: $'.$nuevo_saldo;
|
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha recargado a ' . $nombre . ' - ' . $email . ' la cantidad de $' . $this->valor_recargar . ', Saldo anterior: $' . $this->saldo_actual . ', Nuevo saldo disponible: $' . $nuevo_saldo;
|
||||||
$logsGeneral->save();
|
$logsGeneral->save();
|
||||||
|
|
||||||
$this->alert('success', 'Saldo actualizado con exito!', [
|
$this->alert('success', 'Saldo actualizado con exito!', [
|
||||||
|
|||||||
@@ -61,6 +61,17 @@
|
|||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<input id="verPreciosPersonalizados" type="checkbox" wire:model="verPreciosPersonalizados"
|
||||||
|
class="h-4 w-4 text-[#B221FD] border-gray-300 rounded">
|
||||||
|
<label for="verPreciosPersonalizados" class="ml-2 block
|
||||||
|
text-sm text-gray-900">
|
||||||
|
Precios personalizados
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<x-ver-entrada />
|
<x-ver-entrada />
|
||||||
|
|||||||
Reference in New Issue
Block a user