2024-10-14 13:19:53 +08:00
|
|
|
{{#if (or this.isEditing (not @userField.id))}}
|
|
|
|
<div class="admin-config-area user-field">
|
|
|
|
<div class="admin-config-area__primary-content">
|
|
|
|
<div class="admin-config-area-card">
|
|
|
|
<Form
|
|
|
|
@data={{this.formData}}
|
|
|
|
@onSubmit={{this.save}}
|
|
|
|
{{did-insert this._focusName}}
|
|
|
|
as |form transientData|
|
|
|
|
>
|
|
|
|
<form.Field
|
|
|
|
@name="field_type"
|
|
|
|
@title={{i18n "admin.user_fields.type"}}
|
|
|
|
@format="large"
|
|
|
|
@validation="required"
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Select as |select|>
|
|
|
|
{{#each @fieldTypes as |fieldType|}}
|
|
|
|
<select.Option
|
|
|
|
@value={{fieldType.id}}
|
|
|
|
>{{fieldType.name}}</select.Option>
|
|
|
|
{{/each}}
|
|
|
|
</field.Select>
|
|
|
|
</form.Field>
|
2015-07-28 02:22:12 +08:00
|
|
|
|
2024-10-14 13:19:53 +08:00
|
|
|
<form.Field
|
|
|
|
@name="name"
|
|
|
|
@title={{i18n "admin.user_fields.name"}}
|
|
|
|
@format="large"
|
|
|
|
@validation="required"
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Input class="user-field-name" maxlength="255" />
|
|
|
|
</form.Field>
|
2015-07-28 02:22:12 +08:00
|
|
|
|
2024-10-14 13:19:53 +08:00
|
|
|
<form.Field
|
|
|
|
@name="description"
|
|
|
|
@title={{i18n "admin.user_fields.description"}}
|
|
|
|
@format="large"
|
|
|
|
@validation="required"
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Input class="user-field-desc" maxlength="1000" />
|
|
|
|
</form.Field>
|
2015-07-29 00:29:40 +08:00
|
|
|
|
2024-10-14 13:19:53 +08:00
|
|
|
{{#if
|
|
|
|
(or
|
|
|
|
(eq transientData.field_type "dropdown")
|
|
|
|
(eq transientData.field_type "multiselect")
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
<form.Field
|
|
|
|
@name="options"
|
|
|
|
@title={{i18n "admin.user_fields.options"}}
|
|
|
|
@format="large"
|
|
|
|
@validation="required"
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Custom>
|
|
|
|
<ValueList
|
|
|
|
@values={{transientData.options}}
|
|
|
|
@inputType="array"
|
|
|
|
@onChange={{field.set}}
|
|
|
|
/>
|
|
|
|
</field.Custom>
|
|
|
|
</form.Field>
|
|
|
|
{{/if}}
|
2015-07-28 02:22:12 +08:00
|
|
|
|
2024-10-14 13:19:53 +08:00
|
|
|
<form.Field
|
|
|
|
@name="requirement"
|
|
|
|
@title={{i18n "admin.user_fields.requirement.title"}}
|
|
|
|
@validation="required"
|
|
|
|
@onSet={{this.setRequirement}}
|
|
|
|
@format="full"
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.RadioGroup as |radioGroup|>
|
|
|
|
<radioGroup.Radio @value="optional">
|
|
|
|
{{i18n "admin.user_fields.requirement.optional.title"}}
|
|
|
|
</radioGroup.Radio>
|
|
|
|
<radioGroup.Radio @value="for_all_users" as |radio|>
|
|
|
|
{{i18n "admin.user_fields.requirement.for_all_users.title"}}
|
|
|
|
<radio.Description>{{i18n
|
|
|
|
"admin.user_fields.requirement.for_all_users.description"
|
|
|
|
}}</radio.Description>
|
|
|
|
</radioGroup.Radio>
|
|
|
|
<radioGroup.Radio @value="on_signup" as |radio|>
|
|
|
|
{{i18n "admin.user_fields.requirement.on_signup.title"}}
|
|
|
|
<radio.Description>{{i18n
|
|
|
|
"admin.user_fields.requirement.on_signup.description"
|
|
|
|
}}</radio.Description>
|
|
|
|
</radioGroup.Radio>
|
|
|
|
</field.RadioGroup>
|
|
|
|
</form.Field>
|
2016-04-08 20:35:41 +08:00
|
|
|
|
2024-10-14 13:19:53 +08:00
|
|
|
<form.CheckboxGroup
|
|
|
|
class="user-field-preferences"
|
|
|
|
@title={{i18n "admin.user_fields.preferences"}}
|
|
|
|
as |group|
|
|
|
|
>
|
|
|
|
<group.Field
|
|
|
|
@name="editable"
|
|
|
|
@showTitle={{false}}
|
|
|
|
@title={{i18n "admin.user_fields.editable.title"}}
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Checkbox disabled={{this.editableDisabled}} />
|
|
|
|
</group.Field>
|
|
|
|
<group.Field
|
|
|
|
@name="show_on_profile"
|
|
|
|
@showTitle={{false}}
|
|
|
|
@title={{i18n "admin.user_fields.show_on_profile.title"}}
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Checkbox />
|
|
|
|
</group.Field>
|
|
|
|
<group.Field
|
|
|
|
@name="show_on_user_card"
|
|
|
|
@showTitle={{false}}
|
|
|
|
@title={{i18n "admin.user_fields.show_on_user_card.title"}}
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Checkbox />
|
|
|
|
</group.Field>
|
|
|
|
<group.Field
|
|
|
|
@name="searchable"
|
|
|
|
@showTitle={{false}}
|
|
|
|
@title={{i18n "admin.user_fields.searchable.title"}}
|
|
|
|
as |field|
|
|
|
|
>
|
|
|
|
<field.Checkbox />
|
|
|
|
</group.Field>
|
|
|
|
</form.CheckboxGroup>
|
2022-04-19 19:31:43 +08:00
|
|
|
|
2024-10-17 13:06:55 +08:00
|
|
|
<PluginOutlet
|
|
|
|
@name="after-admin-user-fields"
|
|
|
|
@outletArgs={{hash userField=@userField form=form}}
|
|
|
|
/>
|
|
|
|
|
2024-10-14 13:19:53 +08:00
|
|
|
<form.Actions>
|
|
|
|
<form.Submit
|
|
|
|
class="save"
|
|
|
|
@icon="check"
|
|
|
|
@label="admin.user_fields.save"
|
|
|
|
/>
|
|
|
|
<form.Button
|
|
|
|
@action={{this.cancel}}
|
|
|
|
@label="admin.user_fields.cancel"
|
|
|
|
class="btn-default"
|
|
|
|
/>
|
|
|
|
</form.Actions>
|
|
|
|
</Form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<div class="user-field">
|
2022-04-19 19:31:43 +08:00
|
|
|
<div class="row">
|
|
|
|
<div class="form-display">
|
2024-10-14 13:19:53 +08:00
|
|
|
<b class="name">{{@userField.name}}</b>
|
2022-04-19 19:31:43 +08:00
|
|
|
<br />
|
2024-10-14 13:19:53 +08:00
|
|
|
<span class="description">{{html-safe @userField.description}}</span>
|
2022-04-19 19:31:43 +08:00
|
|
|
</div>
|
2024-10-14 13:19:53 +08:00
|
|
|
<div class="form-display field-type">{{@userField.fieldTypeName}}</div>
|
2022-04-19 19:31:43 +08:00
|
|
|
<div class="form-element controls">
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{this.edit}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="pencil"
|
2022-06-30 18:30:50 +08:00
|
|
|
@label="admin.user_fields.edit"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-default edit"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
2022-07-06 01:41:31 +08:00
|
|
|
<DButton
|
2024-10-14 13:19:53 +08:00
|
|
|
@action={{fn @destroyAction @userField}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="trash-can"
|
2022-07-06 01:41:31 +08:00
|
|
|
@label="admin.user_fields.delete"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-danger cancel"
|
2022-07-06 01:41:31 +08:00
|
|
|
/>
|
|
|
|
<DButton
|
2024-10-14 13:19:53 +08:00
|
|
|
@action={{fn @moveUpAction @userField}}
|
2022-07-06 01:41:31 +08:00
|
|
|
@icon="arrow-up"
|
|
|
|
@disabled={{this.cantMoveUp}}
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-default"
|
2022-07-06 01:41:31 +08:00
|
|
|
/>
|
|
|
|
<DButton
|
2024-10-14 13:19:53 +08:00
|
|
|
@action={{fn @moveDownAction @userField}}
|
2022-07-06 01:41:31 +08:00
|
|
|
@icon="arrow-down"
|
|
|
|
@disabled={{this.cantMoveDown}}
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-default"
|
2022-07-06 01:41:31 +08:00
|
|
|
/>
|
2022-04-19 19:31:43 +08:00
|
|
|
</div>
|
2015-07-11 00:28:56 +08:00
|
|
|
</div>
|
2023-08-16 04:59:04 +08:00
|
|
|
<div class="row user-field-flags">{{this.flags}}</div>
|
2024-10-14 13:19:53 +08:00
|
|
|
</div>
|
|
|
|
{{/if}}
|