@extends('layouts.basedashboard') @section('titulo', 'Crear Tipo de Usuario') @section('contenido')

Crear Tipo de Usuario

Agrega un nuevo tipo de usuario al sistema

Volver
Información del Usuario
@csrf
@error('tipo')
{{ $message }}
@enderror
Haz clic en cualquier boton ejemplo para usarlo
Cancelar
@endsection @push('JS') @endpush @push('JSOR') $("#tipo").on("input", function(){ actualizarPreview($(this).val()); }); $(".ejemplo-tipo").on("click", function(){ const tipo = $(this).data("tipo"); $("#tipo").val(tipo).trigger("input"); }); // Manejo del formulario $("#formCrearTipo").on("submit", function(e){ e.preventDefault(); cambiarEstadoBoton(true); $.ajax({ url: $(this).attr("action"), method: "POST", data: $(this).serialize(), success: function(response){ Swal.fire({ icon: "success", title: "Tipo creado!", text: "El tipo de usuario se ha creado correctamente", timer: 1500, showConfirmButton: false, timerProgressBar: true }).then(() => { window.location.href = "{{ route('tipos.index') }}"; }); }, error: function(xhr){ cambiarEstadoBoton(false); if( xhr.status === 422 ){ // Recargar para mostrar errores de validación location.reload(); } else{ Swal.fire({ icon: "error", title: "Error", text: "Ocurrió un problema al crear el tipo", confirmButtonText: "Aceptar" }); } } }); }); console.log("Vista crear usuario cargada"); @endpush