Skip to content

Commit

Permalink
refactor(global): Improve Contact form paste from linkedin
Browse files Browse the repository at this point in the history
- Adding Larasatan codeanalyzer to composer dev requisites.
- Improve i18n for spanish spain
  • Loading branch information
gnovaro committed Mar 18, 2024
1 parent a62cc53 commit d543ff3
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 12 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"require-dev": {
"barryvdh/laravel-debugbar": "^3.6",
"friendsofphp/php-cs-fixer": "^3.14",
"larastan/larastan": "^2.0",
"laravel/pint": "^1.2",
"marcocesarato/php-conventional-changelog": "^1.16",
"mockery/mockery": "^1.4.4",
Expand Down
192 changes: 191 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions etc/infrastructure/nginx/conf.d/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
5 changes: 4 additions & 1 deletion lang/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"City" : "Ciudad",
"Close" : "Cerrar",
"Closed" : "Cerrado",
"Cold call": "Llamada en frío",
"Confirm" : "Confirmar",
"Confirm password" : "Confirmar constraseña",
"Contacts" : "Contactos",
Expand All @@ -37,6 +38,7 @@
"Country" : "País",
"Created at" : "Fecha alta",
"Currency" : "Moneda",
"Currencies" : "Monedas",
"Customer" : "Cliente",
"Customer deleted successfully" : "Cliente eliminado exitosamente",
"Customer :name successfully saved": "Cliente :name guardado con éxito",
Expand Down Expand Up @@ -99,9 +101,9 @@
"Open" : "Abierto",
"Order" : "Pedido",
"Orders" : "Pedidos",
"Password" : "Contraseña",
"Permission": "Permiso",
"Permissions": "Permisos",
"Password" : "Contraseña",
"Phone" : "Teléfono",
"Photo" : "Foto",
"Preview" : "Vista previa",
Expand Down Expand Up @@ -142,6 +144,7 @@
"Taxes" : "Impuestos",
"to": "a",
"To" : "Para",
"Time zone" : "Huso horario",
"Title" : "Título",
"Today" : "Hoy",
"Type" : "Tipo",
Expand Down
32 changes: 23 additions & 9 deletions resources/views/contact/contact_form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,34 @@ class="form-control form-control-lg">
let matches = url.match(/linkedin\.com\/in\/([^\/]+)\//);
if (matches && matches[1]) {
let parts = matches[1].split('-');
let fullName = matches[1].replace(/-/g, ' '); // Reemplazar guiones con espacios
let nameParts = fullName.split(' ');
let firstName = '';
let lastName = '';
// Si tanto el nombre como el apellido están vacíos
if (!$('#contact_first_name').val() && !$('#contact_last_name').val()) {
if (parts.length > 1) {
$('#contact_first_name').val(parts[0]);
$('#contact_last_name').val(parts.slice(1).join(' '));
nameParts.forEach(function(part, index) {
if (index === 0) {
firstName += part.charAt(0).toUpperCase() + part.slice(1).toLowerCase(); // Convertir primera letra en mayúscula
} else {
$('#contact_first_name').val(matches[1]);
if (index === nameParts.length - 1) {
// Última parte, eliminar cualquier hash alfanumérico
lastName += part.replace(/[0-9a-fA-F]+$/, '').charAt(0).toUpperCase() + part.slice(1).toLowerCase();
} else {
lastName += part.charAt(0).toUpperCase() + part.slice(1).toLowerCase(); // Convertir primera letra en mayúscula
}
lastName += ' ';
}
}
});
// Eliminar espacio adicional al final del apellido
lastName = lastName.trim();
// Asignar valores a los campos de nombre y apellido
$('#contact_first_name').val(firstName);
$('#contact_last_name').val(lastName);
}
}, 0);
});
});
</script>
@endpush
@endpush
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

const APP_VERSION = '3.8.2';
const APP_VERSION = '3.8.3';

0 comments on commit d543ff3

Please sign in to comment.