@AndTheEnd

Как переставить элементы в order_ajax.js?

joxi.ru/8AndRXwiqaxykm

<div class="form-group bx-soa-customer-field" data-property-id-row="20">
	<label class="bx-soa-custom-label" for="soa-property-20">
		<span class="bx-authform-starrequired">*</span> Я согласен с политикой конфиденциальности и защиты информации
	</label>
		<div class="soa-property-container">
			<input type="hidden" name="ORDER_PROP_20" value="N">
			<input type="checkbox" name="ORDER_PROP_20" value="Y">
		</div>
</div>

А должно быть так
<div class="form-group bx-soa-customer-field" data-property-id-row="20">
	<div class="soa-property-container">
		<input type="hidden" name="ORDER_PROP_20" value="N">
		<input type="checkbox" name="ORDER_PROP_20" value="Y">
	<label class="bx-soa-custom-label" for="soa-property-20">
		<span class="bx-authform-starrequired">*</span> Я согласен с политикой конфиденциальности и защиты информации
	</label>
	</div>
</div>

Ввывод свойства:
insertYNProperty: function(property, propsItemNode, disabled)
	{
		var prop, inputs, values, i, propContainer;

		if (disabled)
		{
			prop = this.propsHiddenBlockNode.querySelector('div[data-property-id-row="' + property.getId() + '"]');
			if (prop)
			{
				values = [];
				inputs = prop.querySelectorAll('input[type=checkbox]');

				for (i = 0; i < inputs.length; i+=2)
					values.push(inputs[i].checked ? BX.message('SOA_YES') : BX.message('SOA_NO'));

				propsItemNode.appendChild(BX.create('DIV', {text: this.valuesToString(values)}));
			}
		}
		else
		{
			propContainer = BX.create('DIV', {props: {className: 'soa-property-container'}});
			property.appendTo(propContainer);
			propsItemNode.appendChild(propContainer);
			this.alterProperty(property.getSettings(), propContainer);
			this.bindValidation(property.getId(), propContainer);
		}
	},


Расположение элементов
getPropertyRowNode: function(property, propsItemsContainer, disabled)
{
	var propsItemNode = BX.create('DIV', {props: {className: "form-group bx-soa-customer-field"}}),
		labelTextHtml = '',
		propertyType = property.getType(),
		propertyDesc = property.getDescription(),
		label;

	if (property.isRequired())
		labelTextHtml += '<span class="bx-authform-starrequired">*</span> ';

	labelTextHtml += BX.util.htmlspecialchars(property.getName());
	if (propertyDesc.length && (disabled || (propertyType != 'STRING' && propertyType != 'NUMBER' && propertyType != 'DATE')))
		labelTextHtml += ' <small>(' + BX.util.htmlspecialchars(propertyDesc) + ')</small>';

	label = BX.create('LABEL', {props: {className: 'bx-soa-custom-label'}, html: labelTextHtml});
	if (!disabled)
	{
		label.setAttribute('for', 'soa-property-' + property.getId());
		propsItemNode.setAttribute('data-property-id-row', property.getId());
	}

	propsItemNode.appendChild(label);

	switch (propertyType)
	{
		case 'LOCATION':
			this.insertLocationProperty(property, propsItemNode, disabled);
			break;
		case 'DATE':
			this.insertDateProperty(property, propsItemNode, disabled);
			break;
		case 'FILE':
			this.insertFileProperty(property, propsItemNode, disabled);
			break;
		case 'STRING':
			this.insertStringProperty(property, propsItemNode, disabled);
			break;
		case 'ENUM':
			this.insertEnumProperty(property, propsItemNode, disabled);
			break;
		case 'Y/N':
			this.insertYNProperty(property, propsItemNode, disabled);
			break;
		case 'NUMBER':
			this.insertNumberProperty(property, propsItemNode, disabled);
	}

	propsItemsContainer.appendChild(propsItemNode);
},


Я пробовал сделать так
if(propertyType == 'Y/N') {
	label = BX.create('LABEL', {props: {className: 'my_class'}, html: 'my_text'});
}else{
	label = BX.create('LABEL', {props: {className: 'bx-soa-custom-label'}, html: labelTextHtml});
}


Но в этом случае чекбокс срабатывает только со второго раза
  • Вопрос задан
  • 813 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Yariy
Новый шаблон - это жопа, лучше скачай старый шаблон и кастомизируй его. Больше нервов и времени сэкономишь
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы