<?php
/**
 *---------------------------------------------------------------------------------------
 * @package       VP Smart Template
 *---------------------------------------------------------------------------------------
 * @copyright     Copyright (C) 2012-2021 VirtuePlanet Services LLP. All rights reserved.
 * @license       GNU General Public License version 2 or later; see LICENSE.txt
 * @authors       Abhishek Das
 * @email         info@virtueplanet.com
 * @link          https://www.virtueplanet.com
 *---------------------------------------------------------------------------------------
 */
defined('_JEXEC') or die('Restricted access');

$hiddenFields = '';
?>
<?php if(!empty($this->userFieldsCart['fields'])) : ?>
	<?php foreach($this->userFieldsCart['fields'] as $field) : ?>
		<?php if($field['hidden']) 
		{
			$hiddenFields .= $field['formcode'] . "\n";
		}
		else
		{ ?>
			<?php if($field['name'] == 'customer_note' || $field['type'] == 'textarea') : ?>
				<div class="form-group">
					<label for="<?php echo $field['name'] ?>_field"><?php echo $field['title'] ?></label>
					<?php $field['formcode'] = str_replace('rows="1"', 'rows="3"', $field['formcode']); ?>
					<?php echo strpos($field['formcode'], 'class="') ? 
					str_replace('class="', 'class="form-control ', $field['formcode']) : 
					str_replace('<textarea', '<textarea class="form-control"', $field['formcode']); ?>
				</div>
			<?php elseif($field['name'] == 'tos') : ?>
				<?php echo $field['formcode'] ?>
			<?php else : ?>
				<fieldset class="vm-fieldset-<?php echo str_replace('_', '-', $field['name']) ?>">
					<div class="form-group">
						<label for="<?php echo $field['name'] ?>_field"><?php echo $field['title'] ?></label>
						<?php echo $field['formcode'] ?>
					</div>
				</fieldset>
			<?php endif; ?>
			<?php
		} ?>
	<?php endforeach; ?>
<?php endif; ?>

<?php echo $hiddenFields; ?>