in django_airavata/apps/admin/static/django_airavata_admin/src/store/modules/extendedUserProfile.js [25:59]
async saveExtendedUserProfileFields({ commit, dispatch, state }) {
let order = 1;
for (const field of state.extendedUserProfileFields) {
commit("setOrder", { field, order: order++ });
if (field.supportsChoices) {
for (let index = 0; index < field.choices.length; index++) {
const choice = field.choices[index];
commit("setChoiceOrder", { choice, order: index });
}
}
for (let index = 0; index < field.links.length; index++) {
const link = field.links[index];
commit("setLinkOrder", { link, order: index });
}
// Create or update each field
if (field.id) {
await services.ExtendedUserProfileFieldService.update({
lookup: field.id,
data: field,
});
} else {
await services.ExtendedUserProfileFieldService.create({ data: field });
}
}
if (state.deletedExtendedUserProfileFields.length > 0) {
for (const field of state.deletedExtendedUserProfileFields) {
await services.ExtendedUserProfileFieldService.delete({
lookup: field.id,
});
}
commit("resetDeletedExtendedUserProfileFields");
}
// Reload the fields
dispatch("loadExtendedUserProfileFields");
},