diff --git a/app/Http/Livewire/ShowRoles.php b/app/Http/Livewire/ShowRoles.php index 4b052eb..3301e74 100755 --- a/app/Http/Livewire/ShowRoles.php +++ b/app/Http/Livewire/ShowRoles.php @@ -2,6 +2,7 @@ namespace App\Http\Livewire; +use App\Models\Configuracione; use App\Models\Role; use App\Models\User; use Livewire\Component; @@ -22,7 +23,6 @@ class ShowRoles extends Component public function render() { if (auth()->user()->rol_id == 5) { - $query = Role::withCount('usuarios'); if ($this->filtro_id) { $query->where('subvendedor_id', $this->filtro_id); @@ -37,7 +37,8 @@ class ShowRoles extends Component return view('livewire.show-roles', [ 'roles' => $consulta_roles, - 'usuarios' => $consulta_usuarios + 'usuarios' => $consulta_usuarios, + 'config' => Configuracione::with('usuario')->orderby('id', 'desc')->first(), ]); } diff --git a/app/Http/Livewire/ShowTarifas.php b/app/Http/Livewire/ShowTarifas.php index 6f54749..8157bf7 100644 --- a/app/Http/Livewire/ShowTarifas.php +++ b/app/Http/Livewire/ShowTarifas.php @@ -2,6 +2,7 @@ namespace App\Http\Livewire; +use App\Models\Configuracione; use App\Models\Promociones; use App\Models\Role; use App\Models\Servicio; @@ -62,6 +63,7 @@ class ShowTarifas extends Component 'roles' => Role::where('subvendedor_id', auth()->user()->id)->get(), 'promo' => Promociones::where('visible', 'true')->get(), 'servicios' => Servicio::where('estado', 'activo')->get(), + 'config' => Configuracione::with('usuario')->orderby('id', 'desc')->first(), ]); } diff --git a/app/Http/Livewire/ShowUsuarios.php b/app/Http/Livewire/ShowUsuarios.php index 8f627b2..18536c8 100755 --- a/app/Http/Livewire/ShowUsuarios.php +++ b/app/Http/Livewire/ShowUsuarios.php @@ -2,6 +2,7 @@ namespace App\Http\Livewire; +use App\Models\Configuracione; use App\Models\Historiale; use App\Models\Log_general; use App\Models\Promociones; @@ -167,6 +168,7 @@ class ShowUsuarios extends Component 'usuarios' => $consulta_usuarios, 'tarifas' => $consulta_tarifas, 'promo' => Promociones::where('visible', 'true')->get(), + 'config' => Configuracione::with('usuario')->orderby('id', 'desc')->first(), ]); } diff --git a/database/migrations/2025_08_22_111239_add_subvendedor_to_configuraciones_table.php b/database/migrations/2025_08_22_111239_add_subvendedor_to_configuraciones_table.php new file mode 100644 index 0000000..58cd647 --- /dev/null +++ b/database/migrations/2025_08_22_111239_add_subvendedor_to_configuraciones_table.php @@ -0,0 +1,22 @@ +boolean('subvendedor')->default(false)->after('catalogo'); + }); + } + + public function down() + { + Schema::table('configuraciones', function (Blueprint $table) { + $table->dropColumn('subvendedor'); + }); + } +}; diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index 5ab6059..6b6183f 100755 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -2,7 +2,7 @@
@php - $config = \App\Models\Configuracione::orderby('id', 'desc')->first(); + $config = \App\Models\Configuracione::orderby('id', 'desc')->first(); @endphp
@if (!empty($config->catalogo)) -
- @endif @if (auth()->user()->rol->nombre != 'editor' && auth()->user()->rol->nombre != 'administrador') -
- - - - - - - - {{ __('Reportes') }} - -
+
+ + + + + + + + {{ __('Reportes') }} + +
@endif
- @if (auth()->user()->subvendedor || auth()->user()->rol->nombre == 'super' || auth()->user()->rol->nombre == 'administrador' || auth()->user()->rol->nombre == 'editor') - + @if (in_array(auth()->user()->rol->nombre, ['super', 'administrador'])) + Gestión Pendientes + Log general + Log cuentas + + @if (auth()->user()->rol->nombre == 'super') + {{-- Solo super --}} + Gestión Tarifas + Log historial + Log recargas + Gestión Promociones + Gestión Servicios + Gestión Categorias + Utilidades + Configuración + @endif + @endif + @endif +

+ + @endif
@@ -285,30 +290,30 @@
@if (!empty($config->catalogo)) -
- - - - - -
+
+ + + + + +
@endif @if (auth()->user()->rol->nombre != 'editor' && auth()->user()->rol->nombre != 'administrador') -
- - - - - - - - -
+
+ + + + + + + + +
@endif
diff --git a/resources/views/livewire/logs-recargas.blade.php b/resources/views/livewire/logs-recargas.blade.php index 4726dc5..62e3997 100755 --- a/resources/views/livewire/logs-recargas.blade.php +++ b/resources/views/livewire/logs-recargas.blade.php @@ -1,39 +1,34 @@
-
-
- - - -
+
+
+ + + +
+ + + + + + + + + -
CompraUsuarioEmailValor pagadoEstadoSaldo
- - - - - - - - - @foreach($historial_recargas as $item) - - - - - - - - - - - - @endforeach - -
CompraUsuarioEmailValor pagadoEstadoSaldo
{{\Carbon\Carbon::parse($item->created_at)->format('y/m/d h:i a')}}{{$item->usuario?->name ?? 'N/A'}}{{$item->usuario?->email ?? 'N/A'}}{{$item->monto ?? 'N/A'}}{{$item->status ?? 'N/A'}}{{$item->valor_recarga ?? 'N/A'}}
-
- {{ $historial_recargas->links( )}} + @foreach ($historial_recargas as $item) + + {{ \Carbon\Carbon::parse($item->created_at)->format('y/m/d h:i a') }} + {{ $item->usuario?->name ?? 'N/A' }} + {{ $item->usuario?->email ?? 'N/A' }} + {{ $item->monto ?? 'N/A' }} + {{ $item->status ?? 'N/A' }} + {{ $item->valor_recarga ?? 'N/A' }} + + @endforeach + +
+ {{ $historial_recargas->links() }} +
- -
diff --git a/resources/views/livewire/show-configuracion.blade.php b/resources/views/livewire/show-configuracion.blade.php index 913577e..9b1b9e2 100755 --- a/resources/views/livewire/show-configuracion.blade.php +++ b/resources/views/livewire/show-configuracion.blade.php @@ -92,6 +92,23 @@
+ {{-- Subvendedor --}} +
+
+ Subvendedores + +
+ + {{-- Boton para guardar subvendedor --}} +
+ +
+
+ {{-- Slider --}}
@@ -626,10 +643,6 @@
- - - -
- @if (auth()->user()->subvendedor) + @if (auth()->user()->subvendedor && $config->subvendedor) Añadir rol @@ -41,9 +41,9 @@ this.search = ''; this.selectedId = null; } - }" + }" class="relative w-full max-w-md sm:max-w-xs"> - +
@@ -224,4 +224,4 @@
- \ No newline at end of file + diff --git a/resources/views/livewire/show-tarifas.blade.php b/resources/views/livewire/show-tarifas.blade.php index de47cad..7115364 100644 --- a/resources/views/livewire/show-tarifas.blade.php +++ b/resources/views/livewire/show-tarifas.blade.php @@ -24,7 +24,7 @@ editarTarifaPromo: @entangle('editarTarifaPromo'),
- @if (auth()->user()->subvendedor) + @if (auth()->user()->subvendedor && $config->subvendedor) Tarifas servicios @@ -34,7 +34,7 @@ editarTarifaPromo: @entangle('editarTarifaPromo'), @endif - @if (auth()->user()->subvendedor) + @if (auth()->user()->subvendedor && $config->subvendedor) Tarifas promociones diff --git a/resources/views/livewire/show-usuarios.blade.php b/resources/views/livewire/show-usuarios.blade.php index 939fdd0..f0306fb 100755 --- a/resources/views/livewire/show-usuarios.blade.php +++ b/resources/views/livewire/show-usuarios.blade.php @@ -26,7 +26,7 @@ Usuario
- @if (auth()->user()->subvendedor || auth()->user()->rol->nombre === 'administrador' || auth()->user()->rol->nombre === 'editor' || auth()->user()->rol->nombre === 'super') + @if ((auth()->user()->subvendedor && $config->subvendedor) || in_array(auth()->user()->rol->nombre, ['administrador', 'editor', 'super'])) Añadir usuario @@ -35,7 +35,7 @@ @endif - @if (auth()->user()->rol->nombre === 'super' || auth()->user()->rol->nombre === 'administrador') + @if (in_array(auth()->user()->rol->nombre, ['super', 'administrador'])) Mod. tarifas promos @@ -107,7 +107,7 @@ @if (auth()->user()->rol->nombre == 'super') @else - @if (Auth::user()->subvendedor) + @if (auth()->user()->subvendedor && $config->subvendedor) @endif @endif @@ -131,7 +131,7 @@
- @elseif (Auth::user()->subvendedor) + @elseif (Auth::user()->subvendedor && $config->subvendedor)