initials support complex names
This commit is contained in:
@ -140,7 +140,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
if (shift.assignments.some(a => a.isWithTransport)) {
|
||||
if (shift.requiresTransport) {
|
||||
notes = "Транспорт: ";
|
||||
notes_bold = " " + shift.assignments.filter(a => a.isWithTransport).map(a => a.publisher.firstName.charAt(0) + "." + a.publisher.lastName.charAt(0) + ".").join(", ");
|
||||
notes_bold = " " + shift.assignments.filter(a => a.isWithTransport).map(a => common.getInitials(a.publisher.firstName + " " + a.publisher.lastName)).join(", ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -746,3 +746,8 @@ exports.getLocalStorage = function (key, defaultValue) {
|
||||
exports.root = function (req) {
|
||||
return process.env.NEXT_PUBLIC_PUBLIC_URL;
|
||||
}
|
||||
|
||||
exports.getInitials = function (names) {
|
||||
const parts = names.split(' ');
|
||||
return parts.map(part => part[0] + ".").join('');
|
||||
}
|
Reference in New Issue
Block a user