Normalize name and surname
This commit is contained in:
parent
d5e1ad057e
commit
a93b94ba7b
|
|
@ -7,7 +7,8 @@ import {
|
|||
eyeIconLink,
|
||||
sendEmailIcon,
|
||||
TABULATOR_FR_LANG,
|
||||
trashIconForm
|
||||
trashIconForm,
|
||||
capitalizeFirstLetter
|
||||
} from "../js/global.js";
|
||||
import { Modal } from "bootstrap";
|
||||
import base_controller from "./base_controller.js";
|
||||
|
|
@ -1032,6 +1033,7 @@ export default class extends base_controller {
|
|||
const formData = new FormData(form);
|
||||
const ucSurname = formData.get('surname').toUpperCase();
|
||||
formData.set('surname', ucSurname);
|
||||
formData.set('name', capitalizeFirstLetter(formData.get('name'))); // Capitalize first letter of name
|
||||
|
||||
try {
|
||||
const response = await fetch('/user/new/ajax', { // Adjust path if prefix is different
|
||||
|
|
@ -1101,6 +1103,7 @@ export default class extends base_controller {
|
|||
|
||||
// Force Uppercase on Surname as requested
|
||||
formData.set('surname', formData.get('surname').toUpperCase());
|
||||
formData.set('name', capitalizeFirstLetter(formData.get('name'))); // Capitalize first letter of name
|
||||
|
||||
try {
|
||||
const response = await fetch(`/user/edit/${this.currentUserId}/ajax`, {
|
||||
|
|
|
|||
|
|
@ -79,4 +79,8 @@ export function sendEmailIcon(userId, orgId) {
|
|||
return `<a href="#" class="color-primary resend-invitation pt-3" data-id="${userId}" data-org-id="${orgId}" title="Renvoyer l'invitation" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" height="35px" viewBox="0 0 24 24"><path fill="currentColor" d="M18.175 17H15q-.425 0-.712-.288T14 16t.288-.712T15 15h3.175l-.9-.9Q17 13.825 17 13.413t.3-.713q.275-.275.7-.275t.7.275l2.6 2.6q.125.125.2.312t.075.388t-.075.387t-.2.313l-2.6 2.6q-.275.275-.687.288T17.3 19.3q-.275-.275-.275-.7t.275-.7zM4 17q-.825 0-1.412-.587T2 15V5q0-.825.588-1.412T4 3h13q.825 0 1.413.588T19 5v4.075q0 .4-.3.7t-.7.3q-.425 0-.712-.288T17 9.076V6.4L10.4 11L4 6.425V15h7.075q.425 0 .713.288t.287.712t-.287.713t-.713.287zM5.45 5l4.95 3.55L15.5 5zM4 15V5z"/></svg>
|
||||
</a>`
|
||||
}
|
||||
|
||||
export function capitalizeFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
Loading…
Reference in New Issue