update
This commit is contained in:
@@ -53,6 +53,9 @@ class MenuController extends Controller
|
||||
public function showperfil(){
|
||||
return view('menu/perfil');
|
||||
}
|
||||
public function showpendientes(){
|
||||
return view('menu/pendientes');
|
||||
}
|
||||
public function showconfiguracion(){
|
||||
return view('menu/configuracion');
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ use Livewire\WithFileUploads;
|
||||
use App\Models\Cuentas;
|
||||
use App\Models\Historial_cuenta;
|
||||
use App\Models\Historiale;
|
||||
use App\Models\Notificacion;
|
||||
use App\Models\User;
|
||||
use Intervention\Image\ImageManagerStatic as Img;
|
||||
use Illuminate\Support\Str;
|
||||
use Artisan;
|
||||
@@ -55,13 +57,13 @@ class ShowConfiguracion extends Component
|
||||
public $premio_8;
|
||||
public $premio_9;
|
||||
public $premio_10;
|
||||
|
||||
|
||||
|
||||
public $mensaje_top;
|
||||
public $img_top;
|
||||
public $mensaje_msj_compra;
|
||||
public $mensaje_msj_wp;
|
||||
|
||||
|
||||
public $clave_1;
|
||||
public $clave_2;
|
||||
public $clave_3;
|
||||
@@ -69,18 +71,22 @@ class ShowConfiguracion extends Component
|
||||
public $clave_5;
|
||||
public $clave_6;
|
||||
|
||||
public $iptv;
|
||||
public $notificacion;
|
||||
public $iptv;
|
||||
public $notificacion;
|
||||
|
||||
public $consulta_configuracion;
|
||||
|
||||
|
||||
public $titulo_noti;
|
||||
public $descripcion_noti;
|
||||
public $destinatario_noti;
|
||||
|
||||
public function render()
|
||||
{
|
||||
{
|
||||
//$consulta = Configuracione::with('usuario')->orderby('id','desc');
|
||||
$consulta_configuracion= Configuracione::with('usuario')->orderby('id','desc')->first();
|
||||
$consulta_configuracion = Configuracione::with('usuario')->orderby('id', 'desc')->first();
|
||||
$this->consulta_configuracion = $consulta_configuracion;
|
||||
//dd($consulta_configuraciones);
|
||||
if (empty($this->nombre) && empty($this->slogan) && empty($this->color_boton) ) {
|
||||
if (empty($this->nombre) && empty($this->slogan) && empty($this->color_boton)) {
|
||||
|
||||
$this->nombre = $consulta_configuracion->nombre;
|
||||
$this->slogan = $consulta_configuracion->slogan;
|
||||
@@ -117,9 +123,9 @@ class ShowConfiguracion extends Component
|
||||
|
||||
//msj
|
||||
|
||||
$this->mensaje_msj_compra= $consulta_configuracion->msj_compra;
|
||||
$this->mensaje_msj_wp= $consulta_configuracion->msj_wp;
|
||||
|
||||
$this->mensaje_msj_compra = $consulta_configuracion->msj_compra;
|
||||
$this->mensaje_msj_wp = $consulta_configuracion->msj_wp;
|
||||
|
||||
$this->clave_1 = $consulta_configuracion->clave_1;
|
||||
$this->clave_2 = $consulta_configuracion->clave_2;
|
||||
$this->clave_3 = $consulta_configuracion->clave_3;
|
||||
@@ -129,19 +135,44 @@ class ShowConfiguracion extends Component
|
||||
|
||||
$this->iptv = $consulta_configuracion->iptv;
|
||||
$this->notificacion = $consulta_configuracion->hora;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return view('livewire.show-configuracion',[
|
||||
return view('livewire.show-configuracion', [
|
||||
'sliders' => slider::get(),
|
||||
'usuarios' => User::get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function guardarclaves(){
|
||||
$claves=$this->consulta_configuracion->update([
|
||||
|
||||
public function guardarNoti()
|
||||
{
|
||||
$this->validate([
|
||||
'titulo_noti' => 'required',
|
||||
'descripcion_noti' => 'required',
|
||||
]);
|
||||
|
||||
$consulta = new Notificacion();
|
||||
$consulta->remitente_id = Auth::user()->id;
|
||||
$consulta->destinatario_id = $this->destinatario_noti == 'todos' ? Auth::user()->id : $this->destinatario_noti;
|
||||
$consulta->titulo = trim($this->titulo_noti);
|
||||
$consulta->descripcion = trim($this->descripcion_noti);
|
||||
$consulta->estado = true;
|
||||
$consulta->todos = $this->destinatario_noti == 'todos' || !$this->destinatario_noti ? true : false;
|
||||
$consulta->save();
|
||||
|
||||
$this->alert('success', 'Notificacion creada exitosamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
|
||||
$this->titulo_noti = null;
|
||||
$this->descripcion_noti = null;
|
||||
$this->destinatario_noti = null;
|
||||
}
|
||||
|
||||
public function guardarclaves()
|
||||
{
|
||||
$claves = $this->consulta_configuracion->update([
|
||||
'clave_1' => $this->clave_1,
|
||||
'clave_2' => $this->clave_2,
|
||||
'clave_3' => $this->clave_3,
|
||||
@@ -151,74 +182,72 @@ class ShowConfiguracion extends Component
|
||||
]);
|
||||
|
||||
if ($claves) {
|
||||
|
||||
|
||||
$this->alert('success', 'claves actualizado', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function guardar(){
|
||||
public function guardar()
|
||||
{
|
||||
|
||||
if (!empty($this->photo)) {
|
||||
$nombre=Str::random(10);
|
||||
|
||||
$img = img::make($this->photo)->orientate()->resize(1000, null, function($constraint){
|
||||
$nombre = Str::random(10);
|
||||
|
||||
$img = img::make($this->photo)->orientate()->resize(1000, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->encode('webp');
|
||||
|
||||
$location = "photos/".$nombre.".webp";
|
||||
|
||||
|
||||
$location = "photos/" . $nombre . ".webp";
|
||||
|
||||
Storage::disk('local')->put($location, $img);
|
||||
|
||||
|
||||
$url_logo = $location;
|
||||
}else{
|
||||
$url_logo = $this->url_logo ;
|
||||
} else {
|
||||
$url_logo = $this->url_logo;
|
||||
}
|
||||
|
||||
$configuracion=$this->consulta_configuracion->update([
|
||||
|
||||
$configuracion = $this->consulta_configuracion->update([
|
||||
'nombre' => $this->nombre,
|
||||
'slogan' => $this->slogan,
|
||||
'color_boton' => $this->color_boton,
|
||||
'url_logo' => $url_logo,
|
||||
'color_barra' => $this->color_barra,
|
||||
'color_menu'=> $this->color_menu,
|
||||
'usermodifico_id'=>Auth::user()->id,
|
||||
'color_menu' => $this->color_menu,
|
||||
'usermodifico_id' => Auth::user()->id,
|
||||
|
||||
]);
|
||||
if ($configuracion) {
|
||||
|
||||
|
||||
$this->alert('success', 'Configuración actualizada', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function guardarSlider(){
|
||||
public function guardarSlider()
|
||||
{
|
||||
|
||||
if (!empty($this->slider)) {
|
||||
|
||||
$nombre=Str::random(12);
|
||||
|
||||
$img = img::make($this->slider)->orientate()->resize(1000, null, function($constraint){
|
||||
|
||||
$nombre = Str::random(12);
|
||||
|
||||
$img = img::make($this->slider)->orientate()->resize(1000, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->encode('webp');
|
||||
|
||||
$location = "photos/".$nombre.".webp";
|
||||
|
||||
|
||||
$location = "photos/" . $nombre . ".webp";
|
||||
|
||||
Storage::disk('local')->put($location, $img);
|
||||
|
||||
|
||||
$url_slider = $location;
|
||||
}else{
|
||||
$url_slider = '' ;
|
||||
} else {
|
||||
$url_slider = '';
|
||||
}
|
||||
|
||||
|
||||
$guardar = new slider;
|
||||
$guardar->slider = $url_slider;
|
||||
$guardar->save();
|
||||
@@ -247,196 +276,200 @@ class ShowConfiguracion extends Component
|
||||
'onDismissed' => '',
|
||||
'cancelButtonText' => 'Salir',
|
||||
'confirmButtonText' => 'Si',
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
return [
|
||||
'confirmed'
|
||||
];
|
||||
return [
|
||||
'confirmed'
|
||||
];
|
||||
}
|
||||
|
||||
public function confirmed(){
|
||||
slider::where('id',$this->delete_slider)->delete();
|
||||
public function confirmed()
|
||||
{
|
||||
slider::where('id', $this->delete_slider)->delete();
|
||||
|
||||
$this->alert('success', 'Imagen eliminada correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
}
|
||||
|
||||
public function guardarTop(){
|
||||
public function guardarTop()
|
||||
{
|
||||
|
||||
if (!empty($this->photo_top)) {
|
||||
$nombre=Str::random(10);
|
||||
$img = img::make($this->photo_top)->orientate()->resize(1000, null, function($constraint){
|
||||
$nombre = Str::random(10);
|
||||
$img = img::make($this->photo_top)->orientate()->resize(1000, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->encode('webp');
|
||||
$location = "photos/".$nombre.".webp";
|
||||
Storage::disk('local')->put($location, $img);
|
||||
$photo_top = $location;
|
||||
|
||||
}else{
|
||||
$photo_top = $this->img_top ;
|
||||
$location = "photos/" . $nombre . ".webp";
|
||||
Storage::disk('local')->put($location, $img);
|
||||
$photo_top = $location;
|
||||
} else {
|
||||
$photo_top = $this->img_top;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP1)) {
|
||||
$imgP1=$this->imgP1->store('photos');
|
||||
}else{
|
||||
$imgP1 = $this->top_1 ;
|
||||
$imgP1 = $this->imgP1->store('photos');
|
||||
} else {
|
||||
$imgP1 = $this->top_1;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP2)) {
|
||||
$imgP2=$this->imgP2->store('photos');
|
||||
}else{
|
||||
$imgP2 = $this->top_2 ;
|
||||
$imgP2 = $this->imgP2->store('photos');
|
||||
} else {
|
||||
$imgP2 = $this->top_2;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP3)) {
|
||||
$imgP3=$this->imgP3->store('photos');
|
||||
}else{
|
||||
$imgP3 = $this->top_3 ;
|
||||
$imgP3 = $this->imgP3->store('photos');
|
||||
} else {
|
||||
$imgP3 = $this->top_3;
|
||||
}
|
||||
if (!empty($this->imgP4)) {
|
||||
$imgP4=$this->imgP4->store('photos');
|
||||
}else{
|
||||
$imgP4 = $this->top_4 ;
|
||||
$imgP4 = $this->imgP4->store('photos');
|
||||
} else {
|
||||
$imgP4 = $this->top_4;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP5)) {
|
||||
$imgP5=$this->imgP5->store('photos');
|
||||
}else{
|
||||
$imgP5 = $this->top_5 ;
|
||||
$imgP5 = $this->imgP5->store('photos');
|
||||
} else {
|
||||
$imgP5 = $this->top_5;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP6)) {
|
||||
$imgP6=$this->imgP6->store('photos');
|
||||
}else{
|
||||
$imgP6 = $this->top_6 ;
|
||||
$imgP6 = $this->imgP6->store('photos');
|
||||
} else {
|
||||
$imgP6 = $this->top_6;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP7)) {
|
||||
$imgP7=$this->imgP7->store('photos');
|
||||
}else{
|
||||
$imgP7 = $this->top_7 ;
|
||||
$imgP7 = $this->imgP7->store('photos');
|
||||
} else {
|
||||
$imgP7 = $this->top_7;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP8)) {
|
||||
$imgP8=$this->imgP8->store('photos');
|
||||
}else{
|
||||
$imgP8 = $this->top_8 ;
|
||||
$imgP8 = $this->imgP8->store('photos');
|
||||
} else {
|
||||
$imgP8 = $this->top_8;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP9)) {
|
||||
$imgP9=$this->imgP9->store('photos');
|
||||
}else{
|
||||
$imgP9 = $this->top_9 ;
|
||||
$imgP9 = $this->imgP9->store('photos');
|
||||
} else {
|
||||
$imgP9 = $this->top_9;
|
||||
}
|
||||
|
||||
if (!empty($this->imgP10)) {
|
||||
$imgP10=$this->imgP10->store('photos');
|
||||
}else{
|
||||
$imgP10 = $this->top_10 ;
|
||||
$imgP10 = $this->imgP10->store('photos');
|
||||
} else {
|
||||
$imgP10 = $this->top_10;
|
||||
}
|
||||
|
||||
|
||||
$top = $this->consulta_configuracion->update([
|
||||
|
||||
'top_1' => $imgP1,
|
||||
'top_2' => $imgP2,
|
||||
'top_3' => $imgP3,
|
||||
'top_4' => $imgP4,
|
||||
'top_5' => $imgP5,
|
||||
'top_6' => $imgP6,
|
||||
'top_7' => $imgP7,
|
||||
'top_8' => $imgP8,
|
||||
'top_9' => $imgP9,
|
||||
'top_10' => $imgP10,
|
||||
|
||||
'img_top' => $photo_top,
|
||||
'mensaje_top' => $this->mensaje_top,
|
||||
'premio_1' => $this->premio_1,
|
||||
'premio_2' => $this->premio_2,
|
||||
'premio_3' => $this->premio_3,
|
||||
'premio_4' => $this->premio_4,
|
||||
'premio_5' => $this->premio_5,
|
||||
'premio_6' => $this->premio_6,
|
||||
'premio_7' => $this->premio_7,
|
||||
'premio_8' => $this->premio_8,
|
||||
'premio_9' => $this->premio_9,
|
||||
'premio_10' => $this->premio_10,
|
||||
'top_1' => $imgP1,
|
||||
'top_2' => $imgP2,
|
||||
'top_3' => $imgP3,
|
||||
'top_4' => $imgP4,
|
||||
'top_5' => $imgP5,
|
||||
'top_6' => $imgP6,
|
||||
'top_7' => $imgP7,
|
||||
'top_8' => $imgP8,
|
||||
'top_9' => $imgP9,
|
||||
'top_10' => $imgP10,
|
||||
|
||||
'img_top' => $photo_top,
|
||||
'mensaje_top' => $this->mensaje_top,
|
||||
'premio_1' => $this->premio_1,
|
||||
'premio_2' => $this->premio_2,
|
||||
'premio_3' => $this->premio_3,
|
||||
'premio_4' => $this->premio_4,
|
||||
'premio_5' => $this->premio_5,
|
||||
'premio_6' => $this->premio_6,
|
||||
'premio_7' => $this->premio_7,
|
||||
'premio_8' => $this->premio_8,
|
||||
'premio_9' => $this->premio_9,
|
||||
'premio_10' => $this->premio_10,
|
||||
|
||||
|
||||
|
||||
]);
|
||||
|
||||
if($top){
|
||||
|
||||
if ($top) {
|
||||
$this->alert('success', 'Top distribuidores actualizado', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function guardarMsjCompra(){
|
||||
public function guardarMsjCompra()
|
||||
{
|
||||
$msj = $this->consulta_configuracion->update([
|
||||
'msj_compra' => $this->mensaje_msj_compra,
|
||||
'msj_wp' => $this->mensaje_msj_wp,
|
||||
]);
|
||||
|
||||
if ($msj) {
|
||||
|
||||
$this->alert('success', 'Mensaje actualizado', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
|
||||
$this->alert('success', 'Mensaje actualizado', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function guardariptv(){
|
||||
// dd($this->iptv);
|
||||
public function guardariptv()
|
||||
{
|
||||
// dd($this->iptv);
|
||||
$iptv = $this->consulta_configuracion->update([
|
||||
'iptv' => $this->iptv,
|
||||
]);
|
||||
|
||||
if ($iptv) {
|
||||
|
||||
$this->alert('success', 'iptv actualizado', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
|
||||
$this->alert('success', 'iptv actualizado', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function eliminarC(){
|
||||
public function eliminarC()
|
||||
{
|
||||
//$eliminar_cuentas = Cuentas::truncate();
|
||||
$this->alert('warning', 'Funcion deshabilitada ', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
]);
|
||||
}
|
||||
public function eliminarR(){
|
||||
// $eliminar_cuentas = Historial_cuenta::truncate();
|
||||
public function eliminarR()
|
||||
{
|
||||
// $eliminar_cuentas = Historial_cuenta::truncate();
|
||||
$this->alert('warning', 'Funcion deshabilitada ', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
]);
|
||||
}
|
||||
public function eliminarH(){
|
||||
public function eliminarH()
|
||||
{
|
||||
//$desasociar_cuentas = Historiale::truncate();
|
||||
$this->alert('warning', 'Funcion deshabilitada ', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
public function guardarnot(){
|
||||
public function guardarnot()
|
||||
{
|
||||
$notificacion = $this->consulta_configuracion->update([
|
||||
'hora' => $this->notificacion,
|
||||
]);
|
||||
$this->alert('success', 'La hora de notificación ha sido actualizada.', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
public function eliminarCache(){
|
||||
public function eliminarCache()
|
||||
{
|
||||
Artisan::call('cache:clear');
|
||||
Artisan::call('config:clear');
|
||||
Artisan::call('view:clear');
|
||||
@@ -445,7 +478,6 @@ class ShowConfiguracion extends Component
|
||||
|
||||
$this->alert('success', 'Cache removido correctamente', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Pendientes;
|
||||
use Livewire\Component;
|
||||
|
||||
class ShowPendientes extends Component
|
||||
{
|
||||
public $entradas = 10;
|
||||
|
||||
public function render()
|
||||
{
|
||||
$consulta = Pendientes::paginate($this->entradas);
|
||||
|
||||
return view('livewire.show-pendientes',[
|
||||
'consulta' => $consulta,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,15 @@ use App\Models\Cuentas;
|
||||
use App\Models\Historiale;
|
||||
use App\Models\Historial_cuenta;
|
||||
use App\Models\Log_general;
|
||||
use App\Models\Notificacion;
|
||||
use App\Models\Pendientes;
|
||||
use App\Models\Role;
|
||||
use App\Models\Servicio;
|
||||
use App\Models\Tarifas;
|
||||
use App\Models\user;
|
||||
use App\Notifications\NotificacionPendiente;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Component;
|
||||
use Jantinnerezo\LivewireAlert\LivewireAlert;
|
||||
use Livewire\WithFileUploads;
|
||||
@@ -242,12 +245,25 @@ class ShowPlanes extends Component
|
||||
$cuentasPendientes = Pendientes::where('estado', 'pendiente')->where('servicio_id', $this->servicio_newCuenta)->take($servicioPantallas)->get();
|
||||
|
||||
foreach ($cuentasPendientes as $i => $cuentaPendiente) {
|
||||
$servicioName = $cuentaPendiente->servicio->nombre;
|
||||
|
||||
$historial_cuenta = new Historial_cuenta();
|
||||
$historial_cuenta->historial_id = $cuentaPendiente->historial_id;
|
||||
$historial_cuenta->cuenta_id = $cuenta->id;
|
||||
$historial_cuenta->perfil = $i + 1;
|
||||
$historial_cuenta->save();
|
||||
$cuentaPendiente->update(['estado' => 'cerrado']);
|
||||
|
||||
$cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName));
|
||||
|
||||
$consulta = new Notificacion();
|
||||
$consulta->remitente_id = Auth::user()->id;
|
||||
$consulta->destinatario_id = $historial_cuenta->historial->vendedor_id;
|
||||
$consulta->titulo = "Licencia asignada para $servicioName";
|
||||
$consulta->descripcion = "La licencia de $servicioName ha sido activada y ahora puedes utilizar tu cuenta sin problemas.";
|
||||
$consulta->estado = true;
|
||||
$consulta->todos = false;
|
||||
$consulta->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user