<table class="table">
	<tbody>
		<tr>
	  		<td class="col-xs-2"><h5><span class="required">* </span><?php echo $entry_code; ?>:</h5></td>
	  		<td>
				<div class="col-xs-3">
					<select name="giftTeaser[Enabled]" class="form-control">
						  <option value="yes" <?php echo (!empty($data['giftTeaser']['Enabled']) && $data['giftTeaser']['Enabled'] == 'yes') ? 'selected=selected' : '' ?>><?php echo $text_enabled; ?></option>
						  <option value="no"  <?php echo (empty($data['giftTeaser']['Enabled']) || $data['giftTeaser']['Enabled']== 'no') ? 'selected=selected' : '' ?>><?php echo $text_disabled; ?></option>
					</select>
			  	</div>
			</td>
		</tr>
    <tr>
      <td class="col-xs-2"><h5><span class="required">* </span><?php echo $entry_free_gift_label; ?>:</h5></td>
      <td>
        <div class="col-xs-3">
          <?php foreach ($languages as $language) : ?>
            <div class="input-group">
              <div class="input-group-addon"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></div>
              <input placeholder="Free gifts" class="form-control" type="text" name="giftTeaser[FreeGiftLabel][<?php echo $language['language_id']; ?>]" value="<?php echo !empty($data['giftTeaser']['FreeGiftLabel'][$language['language_id']]) ? $data['giftTeaser']['FreeGiftLabel'][$language['language_id']] : ''; ?>" />
            </div>
          <?php endforeach; ?>
        </div>
      </td>
    </tr>
	</tbody>      
</table>

    <table id="module" class="table list">
      <thead>
        <tr>
          <td class="left"><?php echo $entry_layout_options; ?></td>
          <td class="left"><?php echo $entry_position_options; ?></td>
          <td>Actions:</td>
        </tr>
      </thead>
      <?php $module_row = 0; ?>
      <?php foreach ($modules as $module) { ?>
      <tbody id="module-row<?php echo $module_row; ?>">
        <tr>
          <td class="left col-xs-3">
            <div class="form-group modulePositioning">
            	<label><?php echo $entry_status; ?></label>
                <select name="giftTeaser_module[<?php echo $module_row; ?>][status]" class="form-control">
                <?php if ($module['status']) { ?>
                <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                <option value="0"><?php echo $text_disabled; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_enabled; ?></option>
                <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                <?php } ?>
              </select>
            </div>
            <div class="form-group modulePositioning">
            	<label><?php echo $entry_layout; ?></label>
                <select name="giftTeaser_module[<?php echo $module_row; ?>][layout_id]" class="form-control">
                <?php foreach ($layouts as $layout) { ?>
                <?php if ($layout['layout_id'] == $module['layout_id']) { ?>
                <option value="<?php echo $layout['layout_id']; ?>" selected="selected"><?php echo $layout['name']; ?></option>
                <?php } else { ?>
                <option value="<?php echo $layout['layout_id']; ?>"><?php echo $layout['name']; ?></option>
                <?php } ?>
                <?php } ?>
              </select>
            </div>
            <div class="form-group modulePositioning">
            	<label><?php echo $entry_sort_order; ?></label>
                <input class="form-control" type="number" name="giftTeaser_module[<?php echo $module_row; ?>][sort_order]" value="<?php echo $module['sort_order']; ?>" />
            </div>
          </td>
          <td class="left">
            <div class="widgetPositionOpenCart">
				<div class="radio">
                    <label for="buttonPos<?php echo $module_row; ?>_1">
                        <input <?php if ($module['position'] == 'content_top') echo 'checked="checked"'; ?> type="radio" style="width:auto" name="giftTeaser_module[<?php echo $module_row; ?>][position]" id="buttonPos<?php echo $module_row; ?>_1" class="widgetPositionOptionBox" data-checkbox="#buttonPosCheckbox_<?php echo $module_row; ?>" value="content_top" />
                        <?php echo $text_content_top; ?>
                    </label>
            	</div>
            	<div class="positionSampleBox">
                	<label for="buttonPos<?php echo $module_row; ?>_1"><img src="view/image/giftTeaser/content_top.png" title="<?php echo $text_content_top; ?>" border="0" /></label>
                </div>        
        	</div>
        	<div class="widgetPositionOpenCart">
				<div class="radio">
                	<label for="buttonPos<?php echo $module_row; ?>_2">
                    	<input <?php if ($module['position'] == 'content_bottom') echo 'checked="checked"'; ?> type="radio" style="width:auto" name="giftTeaser_module[<?php echo $module_row; ?>][position]" id="buttonPos<?php echo $module_row; ?>_2" class="widgetPositionOptionBox" data-checkbox="#buttonPosCheckbox_<?php echo $module_row; ?>" value="content_bottom" />
						<?php echo $text_content_bottom; ?>
                    </label>
                </div>
                <div class="positionSampleBox">
                	<label for="buttonPos<?php echo $module_row; ?>_2"><img src="view/image/giftTeaser/content_bottom.png" title="<?php echo $text_content_bottom; ?>" border="0" /></label>
                </div>
        	</div>
        	<div class="widgetPositionOpenCart">
            	<div class="radio">
                	<label for="buttonPos<?php echo $module_row; ?>_3">
                    	<input <?php if ($module['position'] == 'column_left') echo 'checked="checked"'; ?> type="radio" style="width:auto" name="giftTeaser_module[<?php echo $module_row; ?>][position]" id="buttonPos<?php echo $module_row; ?>_3" class="widgetPositionOptionBox" data-checkbox="#buttonPosCheckbox_<?php echo $module_row; ?>" value="column_left" />
						<?php echo $text_column_left; ?>
                	</label>
                </div>
                <div class="positionSampleBox">
                	<label for="buttonPos<?php echo $module_row; ?>_3"><img src="view/image/giftTeaser/column_left.png" title="<?php echo $text_column_left; ?>" border="0" /></label>
                </div>
        	</div>
        	<div class="widgetPositionOpenCart last">
            	<div class="radio">
                	<label for="buttonPos<?php echo $module_row; ?>_4">
						<input <?php if ($module['position'] == 'column_right') echo 'checked="checked"'; ?> type="radio" style="width:auto" name="giftTeaser_module[<?php echo $module_row; ?>][position]" id="buttonPos<?php echo $module_row; ?>_4" class="widgetPositionOptionBox" data-checkbox="#buttonPosCheckbox_<?php echo $module_row; ?>" value="column_right" />
						<?php echo $text_column_right; ?>
                	</label>
            	</div>
                <div class="positionSampleBox">
                	<label for="buttonPos<?php echo $module_row; ?>_4"><img src="view/image/giftTeaser/column_right.png" title="<?php echo $text_column_right; ?>" border="0" /></label>
               	</div>
			</div>
          </td>
          <td class="left" style="vertical-align:bottom;"><a onclick="$('#module-row<?php echo $module_row; ?>').remove();" class="btn btn-danger"><i class="fa fa-times"></i>&nbsp;<?php echo $button_remove; ?></a></td>
        </tr>
      </tbody>
      <?php $module_row++; ?>
      <?php } ?>
      <tfoot>
        <tr>
          <td colspan="2"></td>
          <td class="left"><a onclick="addModule();" class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;<?php echo $button_add_module; ?></a></td>
        </tr>
      </tfoot>
    </table>
<script type="text/javascript">
var module_row = <?php echo $module_row; ?>;
var layouts = <?php echo json_encode($layouts); ?>
</script>