update
This commit is contained in:
+2
-1
@@ -8,9 +8,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class Role extends Model
|
class Role extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'nombre',
|
'nombre',
|
||||||
|
'subvendedor_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function usuarios(){
|
public function usuarios(){
|
||||||
|
|||||||
+14
-25
@@ -12,11 +12,6 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
use HasApiTokens, HasFactory, Notifiable;
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that are mass assignable.
|
|
||||||
*
|
|
||||||
* @var array<int, string>
|
|
||||||
*/
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'email',
|
'email',
|
||||||
@@ -24,24 +19,16 @@ class User extends Authenticatable
|
|||||||
'cedula',
|
'cedula',
|
||||||
'estado',
|
'estado',
|
||||||
'img_perfil',
|
'img_perfil',
|
||||||
'rol_id'
|
'rol_id',
|
||||||
|
'subvendedor_id',
|
||||||
|
'subvendedor',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be hidden for serialization.
|
|
||||||
*
|
|
||||||
* @var array<int, string>
|
|
||||||
*/
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'password',
|
'password',
|
||||||
'remember_token',
|
'remember_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be cast.
|
|
||||||
*
|
|
||||||
* @var array<string, string>
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
];
|
];
|
||||||
@@ -51,46 +38,47 @@ class User extends Authenticatable
|
|||||||
return $this->belongsTo(Role::class);
|
return $this->belongsTo(Role::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saldo()
|
public function saldo()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Saldo::class, 'usuario_id');
|
return $this->hasOne(Saldo::class, 'usuario_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modificaciones()
|
public function modificaciones()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Configuracione::class, 'usermodifico_id');
|
return $this->hasOne(Configuracione::class, 'usermodifico_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function permisos()
|
public function permisos()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Permiso::class, 'usuario_id');
|
return $this->hasMany(Permiso::class, 'usuario_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preferenciales()
|
public function preferenciales()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Preferencial::class, 'usuario_id');
|
return $this->hasMany(Preferencial::class, 'usuario_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function historiales_venta()
|
public function historiales_venta()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Historiale::class, 'vendedor_id');
|
return $this->hasMany(Historiale::class, 'vendedor_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function historiales_compra()
|
public function historiales_compra()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Historiale::class, 'cliente_id');
|
return $this->hasMany(Historiale::class, 'cliente_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function recargas()
|
public function recargas()
|
||||||
{
|
{
|
||||||
return $this->hasMany(recarga::class, 'usuario_id');
|
return $this->hasMany(recarga::class, 'usuario_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function usuario_tarifas()
|
public function usuario_tarifas()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Usuario_tarifa::class, 'usuario_id');
|
return $this->hasMany(Usuario_tarifa::class, 'usuario_id');
|
||||||
}
|
}
|
||||||
public function usuario_promos()
|
|
||||||
|
public function usuario_promos()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Usuario_promo::class, 'usuario_id');
|
return $this->hasMany(Usuario_promo::class, 'usuario_id');
|
||||||
}
|
}
|
||||||
@@ -99,6 +87,7 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
return $this->usuario_tarifas()->where('visible', 'true')->count();
|
return $this->usuario_tarifas()->where('visible', 'true')->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countActivePromos()
|
public function countActivePromos()
|
||||||
{
|
{
|
||||||
return $this->usuario_promos()->where('visible', 'true')->count();
|
return $this->usuario_promos()->where('visible', 'true')->count();
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->string('subvendedor_id')->nullable()->after('visto');
|
||||||
|
$table->boolean('subvendedor')->default(true)->after('subvendedor_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['subvendedor_id', 'subvendedor']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
|
$table->string('subvendedor_id')->nullable()->after('nombre');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('subvendedor_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<x-slot name="tbody">
|
<x-slot name="tbody">
|
||||||
@foreach ($clientes as $cliente)
|
@foreach ($clientes as $cliente)
|
||||||
<tr class="table-row md:hidden border-gray-200 text-left" x-data="{ extraInfo: false, openOption: false, isOpen1: false, isOpen2: false }">
|
<tr class="table-row md:hidden border-gray-200 text-left" x-data="{ extraInfo: false, openOption: false, isOpen1: false, isOpen2: false }">
|
||||||
<td @click="extraInfo = true">{{ $cliente->nombre_cliente ?? $cliente->cliente->name }}</td>
|
<td @click="extraInfo = true">{{ $cliente->nombre_cliente ?? $cliente->cliente->name ?? '' }}</td>
|
||||||
<td @click="extraInfo = true" class="relative">
|
<td @click="extraInfo = true" class="relative">
|
||||||
@if (!empty($cliente->cuentas_obsoletas->unique()))
|
@if (!empty($cliente->cuentas_obsoletas->unique()))
|
||||||
@foreach ($cliente->cuentas_obsoletas->unique() as $cuenta)
|
@foreach ($cliente->cuentas_obsoletas->unique() as $cuenta)
|
||||||
@@ -331,15 +331,14 @@
|
|||||||
</td>
|
</td>
|
||||||
<td @click="extraInfo = true">{{ $this->consultaPassword($cliente->id) }}</td>
|
<td @click="extraInfo = true">{{ $this->consultaPassword($cliente->id) }}</td>
|
||||||
<td @click="extraInfo = true">
|
<td @click="extraInfo = true">
|
||||||
<p
|
<p class="rounded-md font-medium text-center @if ($cliente->estado == 'activo') bg-green-500 text-white @endif @if ($cliente->estado == 'pendiente') bg-yellow-500 @endif">
|
||||||
class="rounded-md font-medium text-center @if ($cliente->estado == 'activo') bg-green-500 text-white @endif @if ($cliente->estado == 'pendiente') bg-yellow-500 @endif">
|
|
||||||
{{ $cliente->estado ?? '' }}
|
{{ $cliente->estado ?? '' }}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr class="hidden md:table-row border-gray-200 text-left w-full" x-data="{ openOption: false, isOpen1: false, isOpen2: false }">
|
<tr class="hidden md:table-row border-gray-200 text-left w-full" x-data="{ openOption: false, isOpen1: false, isOpen2: false }">
|
||||||
<td>{{ $cliente->nombre_cliente ?? $cliente->cliente->name }}</td>
|
<td>{{ $cliente->nombre_cliente ?? $cliente->cliente->name ?? '' }}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
@if (!empty($cliente->cuentas_obsoletas->unique()))
|
@if (!empty($cliente->cuentas_obsoletas->unique()))
|
||||||
|
|||||||
Reference in New Issue
Block a user