<?php
/*
 * @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @component Phoca Cart
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
/*
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.tooltip');
Joomla\CMS\HTML\HTMLHelper::_('behavior.multiselect');
Joomla\CMS\HTML\HTMLHelper::_('dropdown.init');
Joomla\CMS\HTML\HTMLHelper::_('formbehavior.chosen', 'select');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
*/

$linkWizard 		= 'index.php?option=com_phocacart&view=phocacartwizard&tmpl=component';
$linkCategoryEdit 	= 'index.php?option=com_phocacart&view=phocacartcategory&layout=edit';
$linkProductEdit 	= 'index.php?option=com_phocacart&view=phocacartitem&layout=edit';
$linkTaxEdit		= 'index.php?option=com_phocacart&view=phocacarttax&layout=edit';
$linkShippingEdit	= 'index.php?option=com_phocacart&view=phocacartshipping&layout=edit';
$linkPaymentEdit	= 'index.php?option=com_phocacart&view=phocacartpayment&layout=edit';
$linkCountryView	= 'index.php?option=com_phocacart&view=phocacartcountries';
$linkRegionView		= 'index.php?option=com_phocacart&view=phocacartregions';
$linkMenus			= 'index.php?option=com_menus&view=items';
$linkModules		= 'index.php?option=com_modules';
$linkOptions		= 'index.php?option=com_config&view=component&component=com_phocacart&path=&return=aHR0cDovL2xvY2FsaG9zdC9KMzYyL2FkbWluaXN0cmF0b3IvaW5kZXgucGhwP29wdGlvbj1jb21fcGhvY2FjYXJ0';

$urlAjax 			= 'index.php?option=com_phocacart&task=phocacartwizard.updatestatus&format=json&'. JSession::getFormToken().'=1';
$urlAjaxSkipWizard 	= 'index.php?option=com_phocacart&task=phocacartwizard.skipwizard&format=json&'. JSession::getFormToken().'=1';

PhocacartRenderAdminjs::renderAjaxDoRequestWizard(); // Event what must happen to run renderAjaxDoRequestWizardAfterChange
PhocacartRenderAdminjs::renderAjaxDoRequestWizardAfterChange($urlAjax, 'phClickBtn');// Ajax to render changes
PhocacartRenderAdminjs::renderAjaxDoRequestWizardController($urlAjaxSkipWizard, 'phCloseWizard');




if ($this->page == 0) { ?>




<div class="ph-wizard-start-page-window firstpage" data-page="0">
	<h1 class="ph-modal-content-header"><?php echo JText::_('COM_PHOCACART_WIZARD_WELCOME'); ?></h1>
	<div class="ph-wizard-top-text"><?php echo JText::_('COM_PHOCACART_WIZARD_THANK_YOU_FOR_CHOOSING_PHOCA_CART'); ?></div>
	<div class="row-fluid">
		<div class="span6 col-sm-6 col-md-6">
			<div class="ph-wizard-start-page-box">

				<div><?php echo JText::_('COM_PHOCACART_WIZARD_DOWNLOAD_DEMO_DATA'); ?>:</div>

				<div class="ph-wizard-center-button"><a class="btn btn-primary ph-btn"href="https://www.phoca.cz/download/category/100-phoca-cart-component" target="_blank"><span class="<?php $this->s['i']['download']?> icon-download"></span> <?php echo JText::_('COM_PHOCACART_DOWNLOAD'); ?></a></div>

				<ol>
					<li><?php echo JText::_('COM_PHOCACART_WIZARD_INSTALL_BOTH_PACKAGES'); ?></li>
					<li><?php echo JText::_('COM_PHOCACART_WIZARD_CREATE_OR_IMPORT_COUNTRIES'); ?></li>
					<li><?php echo JText::_('COM_PHOCACART_WIZARD_CREATE_MENU_LINK'); ?></li>

					<li><?php echo JText::_('COM_PHOCACART_WIZARD_BOOTSTRAP_TEMPLATE_RECOMMENDED'); ?> <a href="https://www.phoca.cz/joomla-templates" target="_blank"><?php echo JText::_('COM_PHOCACART_WIZARD_DOWNLOAD_BOOTSTRAP_TEMPLATE'); ?></a>.</li>
				</ol>


				<div><?php echo JText::_('COM_PHOCACART_FOR_MORE_INFORMATION_FOLLOW_THIS_GUIDE'); ?>: <a href="https://www.phoca.cz/documents/116-phoca-cart-component/807-installing-sample-data-demo-data-in-phoca-cart" target="_blank"><?php echo JText::_('COM_PHOCACART_INSTALLING_SAMPLE_DATA_IN_PHOCA_CART'); ?></a>.</div>

			</div>
		</div>

		<div class="span6  col-sm-6 col-md-6">
			<div class="ph-wizard-start-page-box">
				<div><?php echo JText::_('COM_PHOCACART_WIZARD_START_QUICK_SETUP_WIZARD');?>.</div>
				<div>&nbsp;</div>
				<div class="ph-wizard-center-button"><a class="btn btn-primary ph-btn" href="<?php echo JRoute::_($linkWizard.'&page=1'); ?>"><span class="glyphicon glyphicon-ok share-alt icon-share"></span> <?php echo JText::_('COM_PHOCACART_START_WIZARD'); ?></a></div>
			</div>
		</div>
	</div>
</div><?php

} else if ($this->page == 1) {
?>

<div class="ph-wizard-start-page-window nextpage" data-page="1">

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span12 col-sm-12 col-md-12">
			<div id="phResultWizardAll" class="ph-center" style="display:none;">
				<div><?php echo JText::_('COM_PHOCACART_YOUR_STORE_IS_READY'); ?></div>
				<div><button id="phCloseWizard" class="btn btn-success ph-btn"><span class="icon-delete"></span> <?php echo JText::_('COM_PHOCACART_CLOSE_WIZARD'); ?></button></div>
			</div>
		</div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_CREATE_AT_LEAST_ONE_CATEGORY'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkCategoryEdit);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_CREATE_CATEGORY'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardCategory"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_CREATE_TAX_IN_CASE_TAXABLE_PRODUCTS_WILL_BE_SOLD_IN_SHOP'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkTaxEdit);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_CREATE_TAX'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardTax"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_CREATE_AT_LEAST_ONE_PRODUCT'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkProductEdit);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_CREATE_PRODUCT'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardProduct"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_CREATE_AT_LEAST_ONE_SHIPPING_METHOD'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkShippingEdit);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_CREATE_SHIPPING_METHOD'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardShipping"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_CREATE_AT_LEAST_ONE_PAYMENT_METHOD'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkPaymentEdit);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_CREATE_PAYMENT_METHOD'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardPayment"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_ADD_OR_IMPORT_COUNTRIES'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkCountryView);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_ADD_OR_IMPORT_COUNTRY'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardCountry"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_ADD_OR_IMPORT_REGIONS'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkRegionView);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_ADD_OR_IMPORT_REGION'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardRegion"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_CREATE_MENU_LINK_TO_PHOCA_CART'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkMenus);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_CREATE_MENU_LINK'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardMenu"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_ADD_OR_EDIT_PHOCA_CART_MODULES'); ?> (<a href="https://www.phoca.cz/download/category/100-phoca-cart-component" target="_blank"><?php echo JText::_('COM_PHOCACART_DOWNLOAD_PHOCA_CART_MODULES'); ?></a>)</div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkModules);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_ADD_OR_EDIT_MODULES'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardModule"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span6 col-sm-6 col-md-6"><?php echo JText::_('COM_PHOCACART_EDIT_PHOCA_CART_OPTIONS'); ?></div>
		<div class="span3 col-sm-3 col-md-3 "><a class="btn btn-primary ph-btn phClickBtn" href="<?php echo JRoute::_($linkOptions);?>" target="_parent"><?php echo JText::_('COM_PHOCACART_OPTIONS'); ?></a></div>
		<div class="span3 col-sm-3 col-md-3"><div id="phResultWizardOption"></div></div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span12 col-sm-12 col-md-12"><?php echo JText::_('COM_PHOCACART_WIZARD_BOOTSTRAP_TEMPLATE_RECOMMENDED'); ?> <a href="https://www.phoca.cz/joomla-templates" target="_blank"><?php echo JText::_('COM_PHOCACART_WIZARD_DOWNLOAD_BOOTSTRAP_TEMPLATE'); ?></a>.</div>
	</div>

	<div class="row-fluid ph-vertical-align ph-wizard-row">
		<div class="span12 col-sm-12 col-md-12"><?php echo JText::_('COM_PHOCACART_DISCOVER'); ?> <a href="https://www.phoca.cz/phocacart-extensions" target="_blank"><?php echo JText::_('COM_PHOCACART_PHOCA_CART_EXTENSIONS'); ?></a>.</div>
	</div>

</div><?php

}




/*
$link	= JRoute::_( 'index.php?option='.$this->t['o'].'&view=phocacartedittax&tmpl=component&id='.(int)$this->id);

if (isset($this->item->id) && (int)$this->item->id > 0 && isset($this->item->title) && $this->item->title != '') {

	$flag = '';
	if (isset($this->item->code2) && $this->item->code2 != '') {
		$flag = PhocacartUtils::getCountryFlag($this->item->code2);
	}
	echo '<h1 class="ph-modal-header">'.$flag .' '.$this->item->title.'</h1>';

	echo '<form action="'.$link.'" method="post">';

	//echo '<table class="ph-tax-edit">';
	echo '<div class="row-fluid ph-tax-edit-header">';
	echo '<div class="span4 col-sm-4 col-md-4">'.JText::_('COM_PHOCACART_TAX_NAME').'</div>';
	echo '<div class="span2 col-sm-2 col-md-2">'.JText::_('COM_PHOCACART_TAX_RATE').'</div>';
	echo '<div class="span2 col-sm-2 col-md-2">'.JText::_('COM_PHOCACART_TITLE').'</div>';
	echo '<div class="span2 col-sm-2 col-md-2">'.JText::_('COM_PHOCACART_ALIAS').'</div>';
	echo '<div class="span2 col-sm-2 col-md-2">'.JText::_('COM_PHOCACART_TAX_RATE_COUNTRY').'</div>';
	echo '</div>';

	if (!empty($this->itemcountrytax)) {
		foreach($this->itemcountrytax as $k => $v) {
			echo '<div class="row-fluid ph-tax-edit-item">';
			echo '<div class="span4 col-sm-4 col-md-4">'.JText::_($v->title).'</div>';
			echo '<div class="span2 col-sm-2 col-md-2">'.PhocacartPrice::cleanPrice($v->tax_rate).'</div>';

			echo '<div class="span2 col-sm-2 col-md-2">';

			echo '<input class="input-small input-sm" type="text" name="jform['.(int)$v->id.'][title]" value="'.htmlspecialchars($v->tc_title).'">';
			echo '<input type="hidden" name="jform['.(int)$v->id.'][tax_id]" value="'.(int)$v->id.'">';
			echo '</div>';

			echo '<div class="span2 col-sm-2 col-md-2"><input class="input-small input-sm" type="text" name="jform['.(int)$v->id.'][alias]" value="'.htmlspecialchars($v->tc_alias).'"></div>';

			// cleanPrice method add 0 to empty values which is wrong in this case as we have:
			// VAT = 0 (valid VAT)
			// VAT = '' (vat not set)
			$tcTaxRate  = '';
			if ($v->tc_tax_rate != '') {
				$tcTaxRate = PhocacartPrice::cleanPrice($v->tc_tax_rate);
			}
			echo '<div class="span2 col-sm-2 col-md-2"><input class="input-small input-sm" type="text" name="jform['.(int)$v->id.'][tax_rate]" value="'.htmlspecialchars($tcTaxRate).'"></div>';
			echo '</div>';

		}
	}
	//echo '</table>';





	echo '<input type="hidden" name="jform[id]" value="'.(int)$this->id.'">';
	echo '<input type="hidden" name="task" value="phocacartedittax.edittax">';
	echo '<input type="hidden" name="tmpl" value="component" />';
	echo '<input type="hidden" name="option" value="com_phocacart" />';
	echo '<div class="ph-tax-edit-button"><button class="btn btn-success btn-sm ph-btn"><span class="icon-edit"></span> '.JText::_('COM_PHOCACART_SAVE').'</button></div>';

	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>';
}



echo '<p>&nbsp;</p>';

echo '<form action="'.$link.'" method="post">';
echo '<input type="hidden" name="jform[id]" value="'.(int)$this->id.'">';
echo '<input type="hidden" name="task" value="phocacartedittax.emptyinformation">';
echo '<input type="hidden" name="tmpl" value="component" />';
echo '<input type="hidden" name="option" value="com_phocacart" />';
echo '<button class="btn btn-primary btn-sm ph-btn"><span class="icon-delete"></span> '.JText::_('COM_PHOCACART_EMPTY_TAX_INFORMATION').'</button>';
echo '</div>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';

	*/
?>
