File "ocslideshow.twig"

Full path: /home/cakedeco/retaildirectonline.co.uk/admin/view/template/extension/module/ocslideshow/ocslideshow.twig
File size: 6.35 B (6.35 KB bytes)
MIME-type: text/html
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-module" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    {% if error_warning %}
    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
      </div>
      <div class="panel-body">
        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-module" class="form-horizontal">
         	  
		 <div class="form-group">
            <label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
            <div class="col-sm-10">
              <select name="status" id="input-status" class="form-control">
                {% if status %}
                <option value="1" selected="selected">{{ text_enabled }}</option>
                <option value="0">{{ text_disabled }}</option>
                {% else %}
                <option value="1">{{ text_enabled }}</option>
                <option value="0" selected="selected">{{ text_disabled }}</option>
                {% endif %}
              </select>
            </div>
          </div>
		        <table id="module" class="table table-striped table-bordered table-hover">
            <thead>
              <tr>
                <td class="text-right">#</td>
                <td class="text-left">{{ entry_limit }}</td>
                <td class="text-left">{{ entry_image }}</td>
                <td></td>
              </tr>
            </thead>
            <tbody>
			{{ module_row = 1 }}
              
			{% for  ocslideshow_module  in ocslideshow_modules %}
              <tr id="module-row{{ ocslideshow_module['key'] }}">
                <td class="text-right">{{ module_row }}</td>
                <td class="text-left"><input type="text" name="ocslideshow_module[{{ ocslideshow_module['key'] }}][limit]" value="{{ ocslideshow_module['limit'] }}" placeholder="{{ entry_limit }}" class="form-control" /></td>
                <td class="text-left"><input type="text" name="ocslideshow_module[{{ ocslideshow_module['key'] }}][width]" value="{{ ocslideshow_module['width'] }}" placeholder="{{ entry_width }}" class="form-control" />
                  <input type="text" name="ocslideshow_module[{{ ocslideshow_module['key'] }}][height]" value="{{ ocslideshow_module['height'] }}" placeholder="{{ entry_height }}" class="form-control" />
                  <?php if (isset($error_image[$ocslideshow_module['key']])) { ?>
                  <div class="text-danger">{{ error_image[$ocslideshow_module['key']] }}</div>
                  <?php } ?></td>
                <td class="text-left"><button type="button" onclick="$('#module-row{{ ocslideshow_module['key'] }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
              </tr>
              {{ module_row++ }}
			  {% endfor %}
            </tbody>
            <tfoot>
              <tr>
                <td colspan="3"></td>
                <td class="text-left"><button type="button" onclick="addModule();" data-toggle="tooltip" title="{{ button_module_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
              </tr>
            </tfoot>
          </table>
			
		  
		  
        </form>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
$('input[name=\'product\']').autocomplete({
	'source': function(request, response) {
		$.ajax({
			url: 'index.php?route=catalog/product/autocomplete&token={{ user_token}} &filter_name=' +  encodeURIComponent(request),
			dataType: 'json',			
			success: function(json) {
				response($.map(json, function(item) {
					return {
						label: item['name'],
						value: item['product_id']
					}
				}));
			}
		});
	},
	'select': function(item) {
		$('#ocslideshow-product' + item['value']).remove();
		
		$('#ocslideshow-product').append('<div id="ocslideshow-product' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" value="' + item['value'] + '" /></div>');	
	
		data = $.map($('#ocslideshow-product input'), function(element) {
			return $(element).attr('value');
		});
						
		$('input[name=\'ocslideshow_product\']').attr('value', data.join());	
	}	
});

$('#ocslideshow-product').delegate('.fa-minus-circle', 'click', function() {
	$(this).parent().remove();

	data = $.map($('#ocslideshow-product input'), function(element) {
		return $(element).attr('value');
	});
					
	$('input[name=\'ocslideshow_product\']').attr('value', data.join());	
});
//--></script> 
  <script type="text/javascript"><!--
function addModule() {
	var user_token = Math.random().toString(36).substr(2);
			
	html  = '<tr id="module-row' + token + '">';
	html += '  <td class="text-right">' + ($('tbody tr').length + 1) + '</td>';
	html += '  <td class="text-left"><input type="text" name="ocslideshow_module[' + token + '][limit]" value="5" placeholder="{{ entry_limit }}" class="form-control" /></td>';
	html += '  <td class="text-left"><input type="text" name="ocslideshow_module[' + token + '][width]" value="200" placeholder="{{ entry_width }}" class="form-control" /> <input type="text" name="ocslideshow_module[' + user_token + '][height]" value="200" placeholder="{{ entry_height }}" class="form-control" /></td>';	
	html += '  <td class="text-left"><button type="button" onclick="$(\'#module-row' + token + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
	html += '</tr>';
	
	$('#module tbody').append(html);
}
//--></script>


{{ footer }}