{{ header }}
{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-customer" 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"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
	<div class="well">
		<div class="row">
			<div class="col-sm-12">
				<a href="{{ manage_products }}" target="_blank" class="btn btn-primary" role="button">{{ button_manage_products }}</a>
				<a href="{{ manage_orders }}" target="_blank" class="btn btn-primary" role="button">{{ button_manage_orders }}</a>
				<a href="{{ manage_payments }}" target="_blank" class="btn btn-primary" role="button">{{ button_manage_payments }}</a>
				<a href="{{ manage_commissions }}" target="_blank" class="btn btn-primary" role="button">{{ button_manage_commissions }}</a>
				<a href="{{ manage_reviews }}" target="_blank" class="btn btn-primary" role="button">{{ button_manage_reviews }}</a>
			</div>
		</div>
	</div>
    <div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title"><i class="fa fa-list"></i> {{ text_form }}</h3>
		</div>
		<div class="panel-body">
			<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-product" class="form-horizontal">
				<ul class="nav nav-tabs">
					<li class="active"><a href="#tab-storedetail" data-toggle="tab">{{ tab_storedetail }}</a></li>
					<li><a href="#tab-product-assign" data-toggle="tab">{{ tab_product_assign }}</a></li>
					<li><a href="#tab-seller-shipping-charge" data-toggle="tab">{{ tab_seller_shipping_charge }}</a></li>
					<li><a href="#tab-seller-payments" data-toggle="tab">{{ tab_seller_payment }}</a></li>
					<li><a href="#tab-seller-commission" data-toggle="tab">{{ tab_seller_commission }}</a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="tab-storedetail">
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storename">{{ entry_name }}</label>
							<div class="col-sm-10">
							  <input type="text" name="seller_name" disabled value="{{ seller_name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control" />
							  <input type="hidden" name="seller_name" value="{{ seller_name }}" />
							  <input type="hidden" name="seller_id" value="{{ seller_id }}" />
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storename">{{ entry_storename }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_name" value="{{ store_name }}" placeholder="{{ entry_storename }}" id="input-storename" class="form-control" />
								{% if error_storename %}
							  <div class="text-danger">{{ error_storename }}</div>
								 {% endif %}
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">{{ entry_storelogo }}</label>
							<div class="col-sm-10"><a href="" id="thumb-image" data-toggle="image" class="img-thumbnail"><img src="{{ thumb }}" alt="" title="" data-placeholder="{{ placeholder }}" /></a>
							  <input type="hidden" name="store_logo" value="{{ store_logo }}" id="input-storelogo" />
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storeemail">{{ entry_storeemail }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_email" value="{{ store_email }}" placeholder="{{ entry_storeemail }}" id="input-storeemail" class="form-control" />
								{% if error_storeemail %}
							  <div class="text-danger">{{ error_storeemail }}</div>
								{% endif %}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storephone">{{ entry_storephone }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_phone" value="{{ store_phone }}" placeholder="{{ entry_storephone }}" id="input-storephone" class="form-control" />
								{% if error_storephone %}
							  <div class="text-danger">{{ error_storephone }}</div>
								{% endif %}
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">{{ entry_storebanner }}</label>
							<div class="col-sm-10"><a href="" id="banner-thumb-image" data-toggle="image" class="img-thumbnail"><img src="{{ banner_thumb }}" alt="" title="" data-placeholder="{{ placeholder }}" /></a>
							  <input type="hidden" name="store_banner" value="{{ store_banner }}" id="input-storebanner" /> <br>
								{{ entry_storebanner_desc }}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storedescription">{{ entry_storedescription }}</label>
							<div class="col-sm-10">
								<textarea name="store_description" data-toggle="summernote" class="form-control">{{ store_description }}</textarea>
								{% if error_storedescription %}
							  <div class="text-danger">{{ error_storedescription }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storeaddress">{{ entry_storeaddress }}</label>
							<div class="col-sm-10">
							  <textarea name="store_address" class="form-control" rows="5">{{ store_address }}</textarea>
								{% if error_storeaddress %}
							  <div class="text-danger">{{ error_storeaddress }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storecity">{{ entry_storecity }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_city" value="{{ store_city }}" placeholder="{{ entry_storecity }}" id="input-storecity" class="form-control" />
								{% if error_storecity %}
							  <div class="text-danger">{{ error_storecity }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group required">
                        <label class="col-sm-2 control-label" for="input-storecountry">{{ entry_storecountry }}</label>
                        <div class="col-sm-10">
                          <select name="store_country" id="input-storecountry" onchange="country(this,'{{ store_state }}');" class="form-control">
                            <option value="">{{ text_select }}</option>
							{% for country in countries %}
							{% if country.country_id == store_country %}
                            <option value="{{ country.country_id }}" selected="selected">{{ country.name }}</option>
							{% else %}
                            <option value="{{ country.country_id }}">{{ country.name }}</option>
                            {% endif %}
                            {% endfor %}
                          </select>
                          {% if error_storecountry %}
                          <div class="text-danger">{{ error_storecountry }}</div>
                          {% endif %}
                        </div>
                      </div>
                      <div class="form-group required">
                        <label class="col-sm-2 control-label" for="input-storestate">{{ entry_storezone }}</label>
                        <div class="col-sm-10">
                          <select name="store_state" id="input-storestate" class="form-control">
                          </select>
                          {% if error_storestate %}
                          <div class="text-danger">{{ error_storestate }}</div>
                          {% endif %}
                        </div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storezipcode">{{ entry_storepostcode }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_zipcode" value="{{ store_zipcode }}" placeholder="{{ entry_storepostcode }}" id="input-storezipcode" class="form-control" />
								{% if error_storezipcode %}
							  <div class="text-danger">{{ error_storezipcode }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" for="input-storeshipping">{{ entry_storeshippingpolicy }}</label>
							<div class="col-sm-10">
							  <textarea name="store_shipping_policy" data-toggle="summernote" class="form-control">{{ store_shipping_policy }}</textarea>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" for="input-storereturn">{{ entry_storereturn }}</label>
							<div class="col-sm-10">
							  <textarea name="store_return_policy" data-toggle="summernote" class="form-control">{{ store_return_policy }}</textarea>
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storemetakeyword">{{ entry_storemetakeyword }}</label>
							<div class="col-sm-10">
							   <textarea name="store_meta_keywords" class="form-control" rows="5">{{ store_meta_keywords }}</textarea>
								{% if error_storemetakeyword %}
							  <div class="text-danger">{{ error_storemetakeyword }}</div>
							 {% endif %}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storemetadescription">{{ entry_storemetadescription }}</label>
							<div class="col-sm-10">
							   <textarea name="store_meta_description" class="form-control" rows="5">{{ store_meta_description }}</textarea>
								{% if error_storemetadescription %}
							  <div class="text-danger">{{ error_storemetadescription }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storebankdetail">{{ entry_storebankdetail }}</label>
							<div class="col-sm-10">
							   <textarea name="store_bank_details" class="form-control" rows="5">{{ store_bank_details }}</textarea>
								{% if error_storebankdetail %}
							  <div class="text-danger">{{ error_storebankdetail }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" for="input-storetin">{{ entry_storetin }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_tin" value="{{ store_tin }}" placeholder="" id="input-storetin" class="form-control" />
								{% if error_storetin %}
							  <div class="text-danger">{{ error_storetin }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storeshipping">{{ entry_storeseo }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_seo" value="{{ store_seo }}" placeholder="{{ entry_storeseo }}" id="input-storeseo" class="form-control" />
								{% if error_storeseo %}
							  <div class="text-danger">{{ error_storeseo }}</div>
							  {% endif %}
							</div>
						</div>
						<div class="form-group required">
							<label class="col-sm-2 control-label" for="input-storetin">{{ entry_storestatus }}</label>
							<div class="col-sm-10">
							  <select name="store_status" class="form-control">
							  {% if store_status %}
								<option value="0">{{ text_disabled }}</option>
								<option value="1" selected>{{ text_enabled }}</option>
								{% else %}
								<option value="0" selected>{{ text_disabled }}</option>
								<option value="1">{{ text_enabled }}</option>
							  {% endif %}
							  </select>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="tab-product-assign">
						<div class="col-sm-8">
							<div class="well well-sm" style="height:300px;overflow:auto">
							{% if products %}
								{% for product in products %}
								<div class="checkbox">
									<label for="admin_product">
									<input type="checkbox" id="product" value="{{ product.product_id }}" name="product_ids[]"> {{ product.name }}</label>
								</div>
								{% endfor %}
								{% else %}
									{{ text_no_results }}
								{% endif %}
							</div>
						</div>
					</div>
					<div class="tab-pane" id="tab-seller-shipping-charge">
						<div class="form-group">
							<label class="col-sm-2 control-label" for="input-storeshipping">{{ entry_storeshipping }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_shipping_charge" value="{{ store_shipping_charge }}" placeholder="{{ entry_storeshipping }}" id="input-storeshipping" class="form-control" />
								{% if error_storecharge %}
								<div class="text-danger">{{ error_storecharge }}</div>
							  {% endif %}
							</div>
						</div>
					</div>
					<div class="tab-pane" id="tab-seller-commission">
						<div class="form-group">
							<label class="col-sm-2 control-label" for="input-storecommission">{{ entry_sellercommission }}</label>
							<div class="col-sm-10">
							  <input type="text" name="store_commission" value="{{ store_commission }}" placeholder="{{ entry_sellercommission }}" id="input-storecommission" class="form-control" />
								{% if error_sellercommission %}
								<div class="text-danger">{{ error_sellercommission }}</div>
							   {% endif %}
							</div>
						</div>
					</div>
					<div class="tab-pane" id="tab-seller-payments">
							<div class="well clearfix">
								<div class="col-sm-3"><h3>{{ commission_list.text_total_sale }}</h3> {{ commission_list.total_sale?commission_list.total_sale:0 }}</div>
								<div class="col-sm-3"><h3>{{ commission_list.text_total_commission }}</h3> {{ commission_list.total_commission?commission_list.total_commission:0 }}</div>
								<div class="col-sm-3"><h3>{{ commission_list.text_recvd_amt }}</h3> {{ commission_list.total_rcvd_amt?commission_list.total_rcvd_amt:0 }}</div>
								<div class="col-sm-3"><h3>{{ commission_list.text_pending_amt }}</h3> {{ commission_list.total_pending_amt?commission_list.total_pending_amt:0 }}</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label" for="input-sellertransaction">{{ payment_list.text_trnasaction }}</label>
								<div class="col-sm-10">
								  <input type="text" name="seller_transaction" value="" placeholder="{{ payment_list.text_trnasaction }}" id="input-sellertransaction" class="form-control" />
								  <input type="hidden" name="remaining_amount" value="{{ commission_list.total_pending_amt_1?commission_list.total_pending_amt_1:0 }}">
									{% if error_sellertransaction %}
								  <div class="text-danger">{{ error_sellertransaction }}</div>
								  {% endif %}
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label" for="input-selleramount">{{ payment_list.text_amount }}</label>
								<div class="col-sm-10">
								  <input type="text" name="seller_amount" value="" placeholder="{{ payment_list.text_amount }}" id="input-selleramount" class="form-control" />
									{% if error_selleramount %}
								  <div class="text-danger">{{ error_selleramount }}</div>
								  {% endif %}
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label" for="input-paymode">{{ payment_list.text_payment_mode }}</label>
								<div class="col-sm-10">
								  <input type="text" name="seller_payment" value="" placeholder="{{ payment_list.text_payment_mode }}" id="input-paymode" class="form-control" />
									{% if error_sellerpaymode %}
								  <div class="text-danger">{{ error_sellerpaymode }}</div>
								  {% endif %}
								</div>
						</div>
					</div>
				</div>
			</form>
		</div>
    </div>
  </div>
<link href="view/javascript/codemirror/lib/codemirror.css" rel="stylesheet" />
<link href="view/javascript/codemirror/theme/monokai.css" rel="stylesheet" />
<script type="text/javascript" src="view/javascript/codemirror/lib/codemirror.js"></script> 
<script type="text/javascript" src="view/javascript/codemirror/lib/xml.js"></script> 
<script type="text/javascript" src="view/javascript/codemirror/lib/formatting.js"></script> 
<script type="text/javascript" src="view/javascript/summernote/summernote.js"></script>
<link href="view/javascript/summernote/summernote.css" rel="stylesheet" />
<script type="text/javascript" src="view/javascript/summernote/summernote-image-attributes.js"></script> 
<script type="text/javascript" src="view/javascript/summernote/opencart.js"></script> 
<script type="text/javascript"><!--
function country(element,zone_id) { 
	$.ajax({
		url: 'index.php?route=localisation/country/country&user_token={{ user_token }}&country_id=' + element.value,
		dataType: 'json',
		beforeSend: function() {
			$('select[name=\'store_country\']').after(' <i class="fa fa-circle-o-notch fa-spin"></i>');
		},
		complete: function() {
			$('.fa-spin').remove();
		},
		success: function(json) {
			if (json['postcode_required'] == '1') {
				$('input[name=\'store_zipcode]\']').parent().parent().addClass('required');
			} else {
				$('input[name=\'store_zipcode\']').parent().parent().removeClass('required');
			}

			html = '<option value="">{{ text_select }}</option>';

			if (json['zone'] && json['zone'] != '') {
				for (i = 0; i < json['zone'].length; i++) {
					html += '<option value="' + json['zone'][i]['zone_id'] + '"';

					if (json['zone'][i]['zone_id'] == zone_id) {
						html += ' selected="selected"';
					}

					html += '>' + json['zone'][i]['name'] + '</option>';
				}
			} else {
				html += '<option value="0">{{ text_none }}</option>';
			}

			$('select[name=\'store_state\']').html(html);
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
}

$('select[name$=\'store_country\']').trigger('change');
//--></script>  
{{ footer }} 