Carga inicial

This commit is contained in:
IvanAS94
2025-12-26 17:21:11 -08:00
parent 45d9afc951
commit 51880798ca
359 changed files with 42159 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests\Administrador;
use App\Models\Cliente;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ClientesDomiciliosRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'nombre_sucursal'=>'string|required|max:191',
'numero_sucursal' => 'numeric|required',
'nombre_responsable_sucursal'=>'string|required|max:191',
'calle'=>'string|required|max:191',
'entre_calles'=>'max:191',
'num_ext'=>'string|required|max:10',
'num_int'=>'nullable|max:10',
'colonia'=>'string|required|max:191',
'ciudad'=>'string|required|max:191',
'cp'=>'max:191',
'telefono' => 'alpha_num|required|max:10',
'celular_responsable' => 'alpha_num|required|max:10',
//'lat' => 'numeric|required',
//'lng' => 'numeric|required'
];
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class ClientesRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['cliente'];
return [
'denominacion' => 'string|required|max:191|unique:clientes,denominacion,'.$id.',id',
'asesor_id' => 'alpha_num|required|exists:users,id',
'requiere_factura' => 'boolean|required',
'datos_fiscales.razon_social'=>'string|max:191|unique:clientes_datos_fiscales,razon_social,'.$id.',cliente_id',
'datos_fiscales.rfc'=>'string|min:12|max:13',
'datos_fiscales.email'=>'string|email|max:191',
'datos_fiscales.calle'=>'string|max:191',
'datos_fiscales.num_ext'=>'string|max:10',
'datos_fiscales.num_int'=>'nullable|max:10',
'datos_fiscales.colonia'=>'string|max:191',
'datos_fiscales.localidad'=>'string|max:191',
'datos_fiscales.municipio'=>'string|max:191',
'datos_fiscales.estado'=>'string|max:191',
'datos_fiscales.pais'=>'string|max:191',
'datos_fiscales.cp'=>'string|max:191',
'datos_fiscales.factura_uso_cfdi_id' => 'alpha_num|exists:facturas_uso_cfdi,id',
'datos_fiscales.factura_tipo_comprobante_id' => 'alpha_num|exists:facturas_tipo_comprobante,id',
'datos_fiscales.factura_metodos_pago_id' => 'alpha_num|exists:facturas_metodos_pago,id',
'datos_fiscales.factura_formas_pago_id' => 'alpha_num|exists:facturas_formas_pago,id',
'datos_fiscales.condicion_pago'=>'string|max:191',
'datos_fiscales.retencion_iva'=>'boolean',
'datos_fiscales.observacion'=>'max:191'
];
}else{
return [
'denominacion' => 'string|required|max:191|unique:clientes,denominacion',
'asesor_id' => 'alpha_num|required|exists:users,id',
'requiere_factura' => 'boolean|required',
'datos_fiscales.razon_social'=>'string|max:191|unique:clientes_datos_fiscales,razon_social',
'datos_fiscales.rfc'=>'string|min:12|max:13|unique:clientes_datos_fiscales,rfc',
'datos_fiscales.email'=>'string|email|max:191',
'datos_fiscales.calle'=>'string|max:191',
'datos_fiscales.num_ext'=>'string|max:10',
'datos_fiscales.num_int'=>'nullable|max:10',
'datos_fiscales.colonia'=>'string|max:191',
'datos_fiscales.localidad'=>'string|max:191',
'datos_fiscales.municipio'=>'string|max:191',
'datos_fiscales.estado'=>'string|max:191',
'datos_fiscales.pais'=>'string|max:191',
'datos_fiscales.cp'=>'string|max:191',
'datos_fiscales.factura_uso_cfdi_id' => 'alpha_num|exists:facturas_uso_cfdi,id',
'datos_fiscales.factura_tipo_comprobante_id' => 'alpha_num|exists:facturas_tipo_comprobante,id',
'datos_fiscales.factura_metodos_pago_id' => 'alpha_num|exists:facturas_metodos_pago,id',
'datos_fiscales.factura_formas_pago_id' => 'alpha_num|exists:facturas_formas_pago,id',
'datos_fiscales.condicion_pago'=>'string|max:191',
'datos_fiscales.retencion_iva'=>'boolean',
'datos_fiscales.observacion'=>'max:191'
];
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class EstatusServiciosRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['estatus_servicio'];
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_estatus_servicios,nombre,'.$id.',id',
'color_1' => 'required|regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
'color_2' => 'regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
];
}else{
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_estatus_servicios,nombre',
'color_1' => 'required|regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
'color_2' => 'regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
];
}
}
public function messages()
{
$messages = [
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class FormasPagosRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['formas_pago'];
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_formas_pagos,nombre,'.$id.',id',
'zeros' => 'string|min:1|max:1',
];
}else{
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_formas_pagos,nombre',
'zeros' => 'string|min:1|max:1',
];
}
}
public function messages()
{
$messages = [
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class RolesRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if ($this->method() == "PUT") {
$params = $this->route()->parameters();
$id = $params['role'];
return [
'name' => "string|required|min:1|max:128|unique:roles,name,$id,id",
'slug' => "string|required|min:1|max:128|unique:roles,slug,$id,id",
'movil' => 'boolean',
'web' => 'boolean',
];
} else {
return [
'name' => 'string|required|min:1|max:128|unique:roles,name',
'slug' => 'string|required|min:1|max:128|unique:roles,slug',
'movil' => 'boolean',
'web' => 'boolean',
];
}
}
public function messages()
{
$messages = [
'name.string' => 'El nombre del rol debe tener caracteres.',
'name.required' => 'El nombre del rol es requerido.',
'name.min' => 'El tamaño mínimo del nombre del rol es 1.',
'name.max' => 'El tamaño máximo del nombre del rol es 128.',
'slug.string' => 'El slug del rol debe tener caracteres.',
'slug.required' => 'El slug del rol es requerido.',
'slug.min' => 'El tamaño mínimo del slug del rol es 1.',
'slug.max' => 'El tamaño máximo del slug del rol es 128.',
'slug.unique' => 'El slug ya está en uso.',
'name.unique' => 'El nombre ya está en uso.'
];
return $messages;
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class ServiciosRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['servicio'];
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_servicios,nombre,'.$id.',id',
];
}else{
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_servicios,nombre',
];
}
}
public function messages()
{
$messages = [
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class SucursalesRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['sucursale'];
return [
'nombre' => 'string|required|min:1|max:191|unique:sucursales,nombre,'.$id.',id',
'calle' => 'string|required|min:1|max:191',
'num_ext' => 'string|required|min:1|max:191',
'num_int' => 'string|nullable|min:1|max:191',
'colonia' => 'string|required|min:1|max:191',
'cp' => 'string|required|min:1|max:191',
'telefono' => 'alpha_num|required|max:10',
'gerente' => 'string|required|min:1|max:191',
'encargado' => 'string|required|min:1|max:191',
];
}else{
return [
'nombre' => 'string|required|min:1|max:191|unique:sucursales,nombre',
'calle' => 'string|required|min:1|max:191',
'num_ext' => 'string|required|min:1|max:191',
'num_int' => 'string|nullable|min:1|max:191',
'colonia' => 'string|required|min:1|max:191',
'cp' => 'string|required|min:1|max:191',
'telefono' => 'alpha_num|required|max:10',
'gerente' => 'string|required|min:1|max:191',
'encargado' => 'string|required|min:1|max:191',
];
}
}
public function messages()
{
$messages = [
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class TiposServiciosRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['tipos_servicio'];
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_tipos_servicios,nombre,'.$id.',id',
];
}else{
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_tipos_servicios,nombre',
];
}
}
public function messages()
{
$messages = [
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class TiposVehiculosRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['tipos_vehiculo'];
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_tipos_vehiculos,nombre,'.$id.',id',
'objetivo_mensual' => 'numeric|max:1000',
];
}else{
return [
'nombre' => 'string|required|min:1|max:191|unique:cat_tipos_vehiculos,nombre',
'objetivo_mensual' => 'numeric|max:1000',
];
}
}
public function messages()
{
$messages = [
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class UserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['usuario'];
return [
'email' => 'string|required|email|max:191|unique:users,email,'.$id.',id',
//'password' => 'string|min:5',
'nombre' => 'string|required|min:1|max:191',
'apellido_paterno' => 'string|required|min:1|max:191',
'apellido_materno' =>'string|required|min:1|max:191',
'telefono' =>'alpha_num|required|max:10',
'role_id' => 'required|exists:roles,id',
'sucursal_id' => 'required|exists:sucursales,id',
];
}else{
return [
'email' => 'string|required|email|max:255|unique:users,email',
//'password' => 'string|min:5',
'nombre' => 'string|required|min:1|max:255',
'apellido_paterno' => 'string|required|min:1|max:191',
'apellido_materno' =>'string|required|min:1|max:191',
'telefono' =>'alpha_num|required|max:10',
'role_id' => 'required|exists:roles,id',
'sucursal_id' => 'required|exists:sucursales,id',
];
}
}
public function messages()
{
$messages = [
'email.unique' => 'El email que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Http\Requests\Administrador;
use Illuminate\Foundation\Http\FormRequest;
class VehiculosRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if($this->method()=='PUT'){
$params = $this->route()->parameters();
$id = $params['vehiculo'];
return [
'num_economico' => 'string|required|max:191|unique:cat_vehiculos,num_economico,'.$id.',id',
'descripcion' => 'string|max:100',
'sucursales' => 'array|required',
'tipo_vehiculo_id' => 'required|exists:cat_tipos_vehiculos,id',
];
}else{
return [
'num_economico' => 'string|required|max:191|unique:cat_vehiculos,num_economico',
'descripcion' => 'string|max:100',
'sucursales' => 'array|required',
'tipo_vehiculo_id' => 'required|exists:cat_tipos_vehiculos,id',
];
}
}
public function messages()
{
$messages = [
'num_economico.unique' => 'El Vehículo que ingresó ya se encuentra en nuestros registros.'
];
return $messages;
}
}