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/rospirotorg.ru/bitrix/js/catalog/warehouse-master/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/catalog/warehouse-master/src/button-click-handler.js
import { Loc } from 'main.core';

export class ButtonClickHandler
{
	constructor(props)
	{
		this.props = props;
		this.isUsed = props.isUsed;
		this.hasErrors = false;

		this.isPlanRestricted = props.isPlanRestricted;
		this.isUsed1C = props.isUsed1C;
		this.isWithOrdersMode = props.isWithOrdersMode;
		this.isRestrictedAccess = props.isRestrictedAccess;
	}

	handle()
	{
		if (this.isUsed)
		{
			this.handleDisableInventoryManagement();
		}
		else
		{
			this.handleEnableInventoryManagement();
		}
	}

	handleEnableInventoryManagement()
	{
		this.checkAccess();
		this.checkPlanRestriction();
		this.checkUsage1C();
		this.checkWithOrdersMode();
		if (!this.hasErrors)
		{
			this.showEnablePopup();
		}

		this.hasErrors = false;
	}

	handleDisableInventoryManagement()
	{
		this.checkAccess();
		if (!this.hasErrors)
		{
			this.showConfirmDisablePopup();
		}

		this.hasErrors = false;
	}

	showEnablePopup()
	{
		/**
		 * @see DialogEnable.popup()
		 */
		(new BX.Catalog.StoreUse.DialogEnable()).popup();
	}

	showErrorPopup(options)
	{
		/**
		 * @see DialogError.popup()
		 */
		(new BX.Catalog.StoreUse.DialogError(options)).popup();
	}

	showPlanRestrictionSlider()
	{
		top.BX.UI.InfoHelper.show('limit_store_inventory_management');
	}

	showConfirmDisablePopup()
	{
		/**
		 * @see DialogDisable.disablePopup()
		 */
		const dialogDisable = new BX.Catalog.StoreUse.DialogDisable();
		dialogDisable.disablePopup();
	}

	checkAccess(): void
	{
		if (
			this.hasErrors
			|| !this.isRestrictedAccess
		)
		{
			return;
		}

		this.hasErrors = true;
		const helpArticleId = '16556596';
		this.showErrorPopup({
			text: Loc.getMessage(
				'CAT_WAREHOUSE_MASTER_CLEAR_RIGHTS_RESTRICTED_MSGVER_1',
				{
					'#LINK_START#': '<a href="#" class="ui-link ui-link-dashed documents-grid-link">',
					'#LINK_END#': '</a>',
				},
			),
			helpArticleId,
		});
	}

	checkPlanRestriction(): void
	{
		if (
			this.hasErrors
			|| !this.isPlanRestricted
		)
		{
			return;
		}

		this.hasErrors = true;
		this.showPlanRestrictionSlider();
	}

	checkUsage1C(): void
	{
		if (
			this.hasErrors
			|| !this.isUsed1C
		)
		{
			return;
		}

		this.hasErrors = true;
		this.showErrorPopup({
			text: Loc.getMessage('CAT_WAREHOUSE_MASTER_CLEAR_ERROR_1C_USED_MSGVER_1'),
		});
	}

	checkWithOrdersMode(): void
	{
		if (
			this.hasErrors
			|| !this.isWithOrdersMode
		)
		{
			return;
		}

		this.hasErrors = true;
		const helpArticleId = '15718276';
		this.showErrorPopup({
			text: Loc.getMessage(
				'CAT_WAREHOUSE_MASTER_CLEAR_ERROR_ORDER_MODE_MSGVER_1',
				{
					'#LINK_START#': '<a href="#" class="ui-link ui-link-dashed documents-grid-link">',
					'#LINK_END#': '</a>',
				},
			),
			helpArticleId,
		});
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit