%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.220.213.204 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/js/landing/ui/panel/formsettingspanel/content/callback/src/ |
Upload File : |
import {Text} from 'main.core'; import {BaseEvent} from 'main.core.events'; import {Loc} from 'landing.loc'; import {ContentWrapper} from 'landing.ui.panel.basepresetpanel'; import {FormSettingsForm} from 'landing.ui.form.formsettingsform'; import {HeaderCard} from 'landing.ui.card.headercard'; import {TextField} from 'landing.ui.field.textfield'; import {MessageCard} from 'landing.ui.card.messagecard'; export default class Callback extends ContentWrapper { constructor(options) { super(options); this.setEventNamespace('BX.Landing.UI.Panel.FormSettingsPanel.Callback'); this.addItem(this.getHeader()); if (!this.isAvailable()) { this.addItem(this.getWarningMessage()); this.getSettingsForm().disable(); } this.addItem(this.getSettingsForm()); } getHeader(): HeaderCard { return this.cache.remember('header', () => { return new HeaderCard({ title: Loc.getMessage('LANDING_FORM_SETTINGS_CALLBACK_TITLE'), }); }); } getWarningMessage() { return this.cache.remember('warningMessage', () => { return new MessageCard({ header: Loc.getMessage('LANDING_FORM_CALLBACK_WARNING_HEADER'), description: Loc.getMessage('LANDING_FORM_CALLBACK_WARNING_TEXT'), angle: false, closeable: false, hideActions: true, context: 'warning', }); }); } isAvailable(): boolean { return this.cache.remember('isAvailable', () => { return this.options.dictionary.callback.from.length > 0; }); } getSettingsForm(): FormSettingsForm { return this.cache.remember('settingsForm', () => { return new FormSettingsForm({ title: Loc.getMessage('LANDING_FORM_SETTINGS_CALLBACK_USE_CHECKBOX_LABEL'), toggleable: true, toggleableType: FormSettingsForm.ToggleableType.Switch, opened: this.isAvailable() && Text.toBoolean(this.options.formOptions.callback.use), fields: [ this.getPhoneListField(), this.getTextField(), ], }); }); } getUseCheckboxField(): BX.Landing.UI.Field.Checkbox { return this.cache.remember('useCheckboxField', () => { return new BX.Landing.UI.Field.Checkbox({ selector: 'use', compact: true, value: [Text.toBoolean(this.options.formOptions.callback.use)], items: [ {name: Loc.getMessage('LANDING_FORM_SETTINGS_CALLBACK_USE_CHECKBOX_LABEL'), value: true}, ], }); }); } getPhoneListField(): BX.Landing.UI.Field.Dropdown { return this.cache.remember('phoneListField', () => { return new BX.Landing.UI.Field.Dropdown({ selector: 'from', title: Loc.getMessage('LANDING_FORM_SETTINGS_CALLBACK_PHONE_TITLE'), content: this.options.formOptions.callback.from, items: [ {name: Loc.getMessage('LANDING_FORM_DEFAULT_PHONE_NOT_SELECTED'), value: ''}, ...this.options.dictionary.callback.from.map((item) => { return {name: item.name, value: item.id}; }), ], }); }); } getTextField() { return this.cache.remember('textField', () => { return new TextField({ selector: 'text', title: Loc.getMessage('LANDING_FORM_SETTINGS_CALLBACK_TEXT_TITLE'), content: this.options.formOptions.callback.text, textOnly: true, }); }); } valueReducer(value: {[key: string]: any}): {[key: string]: any} { return { callback: { ...value, use: this.getSettingsForm().isOpened(), }, }; } onChange(event: BaseEvent) { this.emit('onChange', {...event.getData(), skipPrepare: true}); } }