custom_profile_fields: Display data of default external type fields.

Display default values of "name" and "hint" field in uneditable way
while creating new default external account type profile fields.
This commit is contained in:
Yogesh Sirsat 2022-09-13 01:07:04 +05:30 committed by Tim Abbott
parent 50c13f9db0
commit aa7fddbc1d
1 changed files with 13 additions and 7 deletions

View File

@ -174,18 +174,24 @@ function set_up_create_field_form() {
if (Number.parseInt($("#profile_field_type").val(), 10) === field_types.EXTERNAL_ACCOUNT.id) {
$field_elem.show();
if ($("#profile_field_external_accounts_type").val() === "custom") {
const $profile_field_external_account_type = $(
"#profile_field_external_accounts_type",
).val();
if ($profile_field_external_account_type === "custom") {
$field_url_pattern_elem.show();
$("#profile_field_name").val("").closest(".input-group").show();
$("#profile_field_hint").val("").closest(".input-group").show();
$("#profile_field_name").val("").prop("disabled", false);
$("#profile_field_hint").val("").prop("disabled", false);
} else {
$field_url_pattern_elem.hide();
$("#profile_field_name").closest(".input-group").hide();
$("#profile_field_hint").closest(".input-group").hide();
const profile_field_name =
page_params.realm_default_external_accounts[$profile_field_external_account_type]
.name;
$("#profile_field_name").val(profile_field_name).prop("disabled", true);
$("#profile_field_hint").val("").prop("disabled", true);
}
} else {
$("#profile_field_name").closest(".input-group").show();
$("#profile_field_hint").closest(".input-group").show();
$("#profile_field_name").prop("disabled", false);
$("#profile_field_hint").prop("disabled", false);
$field_url_pattern_elem.hide();
$field_elem.hide();
}