update
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\Cuentas;
|
|||||||
use App\Models\Historiale;
|
use App\Models\Historiale;
|
||||||
use App\Models\Historial_cuenta;
|
use App\Models\Historial_cuenta;
|
||||||
use App\Models\Log_general;
|
use App\Models\Log_general;
|
||||||
|
use App\Models\Pendientes;
|
||||||
use App\Models\Role;
|
use App\Models\Role;
|
||||||
use App\Models\Servicio;
|
use App\Models\Servicio;
|
||||||
use App\Models\Tarifas;
|
use App\Models\Tarifas;
|
||||||
@@ -119,7 +120,6 @@ class ShowPlanes extends Component
|
|||||||
->where('servicio_id', $this->servicio_modTarifas)
|
->where('servicio_id', $this->servicio_modTarifas)
|
||||||
->where('estado', 'activo')
|
->where('estado', 'activo')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empezamos definiendo la consulta básica
|
// Empezamos definiendo la consulta básica
|
||||||
@@ -222,14 +222,15 @@ class ShowPlanes extends Component
|
|||||||
/* ------------- CREAR ------------- */
|
/* ------------- CREAR ------------- */
|
||||||
public function createNewCuenta()
|
public function createNewCuenta()
|
||||||
{
|
{
|
||||||
$this->validate([
|
// $this->validate([
|
||||||
'servicio_newCuenta' => 'required',
|
// 'servicio_newCuenta' => 'required',
|
||||||
'usuario_newCuenta' => 'required',
|
// 'usuario_newCuenta' => 'required',
|
||||||
'password_newCuenta' => 'required',
|
// 'password_newCuenta' => 'required',
|
||||||
'fecha_inicial' => 'required',
|
// 'fecha_inicial' => 'required',
|
||||||
'fecha_final' => 'required',
|
// 'fecha_final' => 'required',
|
||||||
'estado' => 'required',
|
// 'estado' => 'required',
|
||||||
]);
|
// ]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($consulta_cuenta = Cuentas::where('correo', $this->usuario_newCuenta)->exists()) {
|
if ($consulta_cuenta = Cuentas::where('correo', $this->usuario_newCuenta)->exists()) {
|
||||||
@@ -246,6 +247,21 @@ class ShowPlanes extends Component
|
|||||||
$cuenta->estado = $this->estado;
|
$cuenta->estado = $this->estado;
|
||||||
$cuenta->save();
|
$cuenta->save();
|
||||||
|
|
||||||
|
if ($this->estado === 'activo') {
|
||||||
|
$servicioPantallas = Servicio::find($this->servicio_newCuenta)->pantallas;
|
||||||
|
|
||||||
|
$cuentasPendientes = Pendientes::where('estado', 'pendiente')->where('servicio_id', $this->servicio_newCuenta)->take($servicioPantallas)->get();
|
||||||
|
|
||||||
|
foreach ($cuentasPendientes as $i => $cuentaPendiente) {
|
||||||
|
$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']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->alert('success', 'Cuenta creada correctamente!', [
|
$this->alert('success', 'Cuenta creada correctamente!', [
|
||||||
'position' => 'top'
|
'position' => 'top'
|
||||||
]);
|
]);
|
||||||
@@ -254,8 +270,6 @@ class ShowPlanes extends Component
|
|||||||
|
|
||||||
$this->newCuenta = false;
|
$this->newCuenta = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public function createServicio()
|
public function createServicio()
|
||||||
{
|
{
|
||||||
@@ -390,8 +404,6 @@ class ShowPlanes extends Component
|
|||||||
'position' => 'top'
|
'position' => 'top'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -434,19 +446,19 @@ class ShowPlanes extends Component
|
|||||||
$this->color_servicio = null;
|
$this->color_servicio = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eliminarCuentas(){
|
public function eliminarCuentas()
|
||||||
|
{
|
||||||
|
|
||||||
$consulta_cuentas = Cuentas::whereIn('id', $this->delete_1)->delete();
|
$consulta_cuentas = Cuentas::whereIn('id', $this->delete_1)->delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function openAdd(){
|
public function openAdd()
|
||||||
|
{
|
||||||
|
|
||||||
$this->addUser = true;
|
$this->addUser = true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public function saveUser(){
|
public function saveUser()
|
||||||
|
{
|
||||||
|
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'tarifa' => 'required',
|
'tarifa' => 'required',
|
||||||
@@ -500,17 +512,16 @@ class ShowPlanes extends Component
|
|||||||
|
|
||||||
$this->addUser = false;
|
$this->addUser = false;
|
||||||
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$historial->delete();
|
$historial->delete();
|
||||||
$this->alert('warning', 'El perfil ya se encuentra en uso!', [
|
$this->alert('warning', 'El perfil ya se encuentra en uso!', [
|
||||||
'position' => 'top'
|
'position' => 'top'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editar($tarifa){
|
public function editar($tarifa)
|
||||||
|
{
|
||||||
//dd($tarifa);
|
//dd($tarifa);
|
||||||
$this->editarTarifaRol = true;
|
$this->editarTarifaRol = true;
|
||||||
$this->informacionTarifaRol = $tarifa;
|
$this->informacionTarifaRol = $tarifa;
|
||||||
@@ -524,7 +535,8 @@ class ShowPlanes extends Component
|
|||||||
$this->servicio_modTarifas = $tarifa['servicio_id'];
|
$this->servicio_modTarifas = $tarifa['servicio_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actualizarTarifaRol($id){
|
public function actualizarTarifaRol($id)
|
||||||
|
{
|
||||||
//dd($id);
|
//dd($id);
|
||||||
$validateData = $this->validate([
|
$validateData = $this->validate([
|
||||||
'roles_modTarifas' => 'required',
|
'roles_modTarifas' => 'required',
|
||||||
@@ -549,6 +561,5 @@ class ShowPlanes extends Component
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->editarTarifaRol = false;
|
$this->editarTarifaRol = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user