From d543ff3e7a9fd81e907a41becdfa2504f9d4666f Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Mon, 18 Mar 2024 11:07:10 +0100 Subject: [PATCH] refactor(global): Improve Contact form paste from linkedin - Adding Larasatan codeanalyzer to composer dev requisites. - Improve i18n for spanish spain --- composer.json | 1 + composer.lock | 192 +++++++++++++++++- etc/infrastructure/nginx/conf.d/.gitignore | 2 + lang/es-ES.json | 5 +- .../views/contact/contact_form.blade.php | 32 ++- version.php | 2 +- 6 files changed, 222 insertions(+), 12 deletions(-) create mode 100644 etc/infrastructure/nginx/conf.d/.gitignore diff --git a/composer.json b/composer.json index c72ec645..f6ac1eee 100755 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/composer.lock b/composer.lock index 6a89f951..e6ffb27e 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6b1d3c8d602d06cfdd30c17010e2241b", + "content-hash": "cf0556a0a1072b9913effab97c788ba3", "packages": [ { "name": "akaunting/laravel-money", @@ -11555,6 +11555,108 @@ }, "time": "2020-07-09T08:09:16+00:00" }, + { + "name": "larastan/larastan", + "version": "v2.9.2", + "source": { + "type": "git", + "url": "https://github.com/larastan/larastan.git", + "reference": "a79b46b96060504b400890674b83f66aa7f5db6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/larastan/larastan/zipball/a79b46b96060504b400890674b83f66aa7f5db6d", + "reference": "a79b46b96060504b400890674b83f66aa7f5db6d", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/console": "^9.52.16 || ^10.28.0 || ^11.0", + "illuminate/container": "^9.52.16 || ^10.28.0 || ^11.0", + "illuminate/contracts": "^9.52.16 || ^10.28.0 || ^11.0", + "illuminate/database": "^9.52.16 || ^10.28.0 || ^11.0", + "illuminate/http": "^9.52.16 || ^10.28.0 || ^11.0", + "illuminate/pipeline": "^9.52.16 || ^10.28.0 || ^11.0", + "illuminate/support": "^9.52.16 || ^10.28.0 || ^11.0", + "php": "^8.0.2", + "phpmyadmin/sql-parser": "^5.8.2", + "phpstan/phpstan": "^1.10.50" + }, + "require-dev": { + "doctrine/coding-standard": "^12.0", + "nikic/php-parser": "^4.17.1", + "orchestra/canvas": "^7.11.1 || ^8.11.0 || ^9.0.0", + "orchestra/testbench": "^7.33.0 || ^8.13.0 || ^9.0.0", + "phpunit/phpunit": "^9.6.13 || ^10.5" + }, + "suggest": { + "orchestra/testbench": "Using Larastan for analysing a package needs Testbench" + }, + "type": "phpstan-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "Larastan\\Larastan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Can Vural", + "email": "can9119@gmail.com" + }, + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "larastan", + "laravel", + "package", + "php", + "static analysis" + ], + "support": { + "issues": "https://github.com/larastan/larastan/issues", + "source": "https://github.com/larastan/larastan/tree/v2.9.2" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/canvural", + "type": "github" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2024-02-27T03:16:03+00:00" + }, { "name": "laravel/pint", "version": "v1.14.0", @@ -12120,6 +12222,94 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpmyadmin/sql-parser", + "version": "5.9.0", + "source": { + "type": "git", + "url": "https://github.com/phpmyadmin/sql-parser.git", + "reference": "011fa18a4e55591fac6545a821921dd1d61c6984" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/011fa18a4e55591fac6545a821921dd1d61c6984", + "reference": "011fa18a4e55591fac6545a821921dd1d61c6984", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "phpmyadmin/motranslator": "<3.0" + }, + "require-dev": { + "phpbench/phpbench": "^1.1", + "phpmyadmin/coding-standard": "^3.0", + "phpmyadmin/motranslator": "^4.0 || ^5.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.9.12", + "phpstan/phpstan-phpunit": "^1.3.3", + "phpunit/php-code-coverage": "*", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "^0.16.1", + "vimeo/psalm": "^4.11", + "zumba/json-serializer": "~3.0.2" + }, + "suggest": { + "ext-mbstring": "For best performance", + "phpmyadmin/motranslator": "Translate messages to your favorite locale" + }, + "bin": [ + "bin/highlight-query", + "bin/lint-query", + "bin/sql-parser", + "bin/tokenize-query" + ], + "type": "library", + "autoload": { + "psr-4": { + "PhpMyAdmin\\SqlParser\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "The phpMyAdmin Team", + "email": "developers@phpmyadmin.net", + "homepage": "https://www.phpmyadmin.net/team/" + } + ], + "description": "A validating SQL lexer and parser with a focus on MySQL dialect.", + "homepage": "https://github.com/phpmyadmin/sql-parser", + "keywords": [ + "analysis", + "lexer", + "parser", + "query linter", + "sql", + "sql lexer", + "sql linter", + "sql parser", + "sql syntax highlighter", + "sql tokenizer" + ], + "support": { + "issues": "https://github.com/phpmyadmin/sql-parser/issues", + "source": "https://github.com/phpmyadmin/sql-parser" + }, + "funding": [ + { + "url": "https://www.phpmyadmin.net/donate/", + "type": "other" + } + ], + "time": "2024-01-20T20:34:02+00:00" + }, { "name": "phpstan/phpstan", "version": "1.10.60", diff --git a/etc/infrastructure/nginx/conf.d/.gitignore b/etc/infrastructure/nginx/conf.d/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/etc/infrastructure/nginx/conf.d/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/lang/es-ES.json b/lang/es-ES.json index f5da9bf2..80a1287c 100755 --- a/lang/es-ES.json +++ b/lang/es-ES.json @@ -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", @@ -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", @@ -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", @@ -142,6 +144,7 @@ "Taxes" : "Impuestos", "to": "a", "To" : "Para", + "Time zone" : "Huso horario", "Title" : "Título", "Today" : "Hoy", "Type" : "Tipo", diff --git a/resources/views/contact/contact_form.blade.php b/resources/views/contact/contact_form.blade.php index 80c4f849..3a26e6ee 100755 --- a/resources/views/contact/contact_form.blade.php +++ b/resources/views/contact/contact_form.blade.php @@ -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); }); }); -@endpush \ No newline at end of file +@endpush diff --git a/version.php b/version.php index d66a504c..ccaf7a2d 100755 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@