403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/cvetdv.ru/bitrix/js/calendar/resourcebooking/src/controls/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/js/calendar/resourcebooking/src/controls/durationselector.js
import {Type, Dom, BookingUtil, SelectInput} from "../resourcebooking";
import {ViewControlAbstract} from "../viewcontrolabstract";

export class DurationSelector extends ViewControlAbstract
{
	constructor(params)
	{
		super(params);
		this.name = 'DurationSelector';
		this.data = params.data;
		this.durationList = BookingUtil.getDurationList(params.fullDay);
		this.changeValueCallback = params.changeValueCallback;
		this.defaultValue = params.defaultValue || this.data.defaultValue;
		this.handleSettingsData(params.data);
	}

	handleSettingsData()
	{
		this.durationItems = [];
		if (Type.isArray(this.durationList))
		{
			this.durationList.forEach(function(item)
			{
				this.durationItems.push({
					id: item.value,
					title: item.label
				});
			}, this);
		}
	}

	displayControl()
	{
		this.DOM.durationInput = this.DOM.controlWrap.appendChild(Dom.create('INPUT', {
			attrs: {
				value: this.data.defaultValue || null,
				type: 'text'
			},
			props: {className: 'calendar-resbook-webform-block-input calendar-resbook-webform-block-input-dropdown'}
		}));

		this.durationControl = new SelectInput({
			input: this.DOM.durationInput,
			values: this.durationList,
			value: this.data.defaultValue || null,
			editable: this.data.manualInput === 'Y',
			defaultValue: this.defaultValue,
			setFirstIfNotFound: true,
			onChangeCallback: this.changeValueCallback
		});
	}

	refresh(data)
	{
		this.refreshLabel(data);
		this.data = data;
		this.handleSettingsData(this.data);

		if (this.setDataConfig())
		{
			if (this.isDisplayed())
			{
				this.show({animation: true});
				if (this.durationControl)
				{
					this.durationControl.setValue(this.data.defaultValue || null);
				}
			}
			else
			{
				this.hide({animation: true});
			}
		}
	}

	getSelectedValue()
	{
		let duration = null;
		if (this.durationControl)
		{
			duration = BookingUtil.parseDuration(this.durationControl.getValue());
		}
		else
		{
			duration = parseInt(this.defaultValue);
		}
		return duration;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit