Make sure that label is also set (#7874)

This commit is contained in:
Hariom Balhara 2023-03-22 10:10:49 +05:30 committed by GitHub
parent 20b3efbcb6
commit 7fc884912e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,13 @@ import {
export const SMS_REMINDER_NUMBER_FIELD = "smsReminderNumber";
/**
* PHONE -> Phone
*/
function upperCaseToCamelCase(upperCaseString: string) {
return upperCaseString[0].toUpperCase() + upperCaseString.slice(1).toLowerCase();
}
export const getSmsReminderNumberField = () =>
({
name: SMS_REMINDER_NUMBER_FIELD,
@ -296,8 +303,9 @@ export const ensureBookingInputsHaveSystemFields = ({
// Backward Compatibility: If we are migrating from old system, we need to map `customInputs` to `bookingFields`
if (handleMigration) {
customInputs.forEach((input, index) => {
const label = input.label || `${upperCaseToCamelCase(input.type)}`;
bookingFields.push({
label: input.label,
label: label,
editable: "user",
// Custom Input's slugified label was being used as query param for prefilling. So, make that the name of the field
// Also Custom Input's label could have been empty string as well. But it's not possible to have empty name. So generate a name automatically.