{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-payment" 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">
          <ul class="nav nav-tabs">
            <li class="active"><a href="#tab-general" data-toggle="tab">{{ tab_general }}</a></li>
            <li><a href="#tab-settle" data-toggle="tab">{{ tab_settle }}</a></li>
            <!--<li><a href="#tab-refund" data-toggle="tab">{{ tab_refund }}</a></li>-->
            <li><a href="#tab-info" data-toggle="tab">{{ tab_info }}</a></li>
          </ul>
          <div class="tab-content">
            <div class="tab-pane active" id="tab-general">
			  <fieldset>
				<legend>{{ fields_configuration_1 }}</legend>
				<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-payment" class="form-horizontal">
				  <div class="form-group">
					<label class="col-sm-2 control-label" for="input-terminal-id">{{ entry_terminal_id }}</label>
					<div class="col-sm-10">
					  <input type="text" name="payment_ocf_mellat_terminal_id" value="{{ payment_ocf_mellat_terminal_id }}" placeholder="{{ entry_terminal_id }}" id="input-terminal-id" class="form-control" />
					</div>
				  </div>
				  <div class="form-group">
					<label class="col-sm-2 control-label" for="input-username">{{ entry_username }}</label>
					<div class="col-sm-10">
					  <input type="text" name="payment_ocf_mellat_username" value="{{ payment_ocf_mellat_username }}" placeholder="{{ entry_username }}" id="input-username" class="form-control" />
					</div>
				  </div>
				  <div class="form-group">
					<label class="col-sm-2 control-label" for="input-password">{{ entry_password }}</label>
					<div class="col-sm-10">
					  <input type="text" name="payment_ocf_mellat_password" value="{{ payment_ocf_mellat_password }}" placeholder="{{ entry_password }}" id="input-password" class="form-control" />
					</div>
				  </div>
				  <legend>{{ fields_configuration_2 }}</legend>
				  <div class="form-group">
					<label class="col-sm-2 control-label" for="input-order-status">{{ entry_order_status }}</label>
					<div class="col-sm-10">
					  <select name="payment_ocf_mellat_order_status_id" id="input-order-status" class="form-control">
						{% for order_status in order_statuses %}
						{% if order_status.order_status_id == payment_ocf_mellat_order_status_id %}
						<option value="{{ order_status.order_status_id }}" selected="selected">{{ order_status.name }}</option>
						{% else %}
						<option value="{{ order_status.order_status_id }}">{{ order_status.name }}</option>
						{% endif %}
						{% endfor %}
					  </select>
					</div>
				  </div>
				  <div class="form-group">
					<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
					<div class="col-sm-10">
					  <select name="payment_ocf_mellat_status" id="input-status" class="form-control">
						{% if payment_ocf_mellat_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>
				  <div class="form-group">
					<label class="col-sm-2 control-label" for="input-sort-order">{{ entry_sort_order }}</label>
					<div class="col-sm-10">
					  <input type="text" name="payment_ocf_mellat_sort_order" value="{{ payment_ocf_mellat_sort_order }}" placeholder="{{ entry_sort_order }}" id="input-sort-order" class="form-control" />
					</div>
				  </div>
				</form>
			  </fieldset>
			</div>
			<div class="tab-pane" id="tab-settle">
			  <fieldset>
				  <legend>{{ fields_configuration_3 }}</legend>
				  <form class="form-horizontal" id="button-settle">
					<div class="form-group">
					  <label class="col-sm-2 control-label" for="input-sale-order-id">{{ entry_sale_order_id }}</label>
					  <div class="col-sm-10">
						<input type="text" name="payment_ocf_mellat_sale_order_id" placeholder="{{ entry_sale_order_id }}" id="input-sale-order-id" class="form-control" />
					  </div>
					</div>
					<div class="form-group">
					  <label class="col-sm-2 control-label" for="input-sale-reference-id">{{ entry_sale_reference_id }}</label>
					  <div class="col-sm-10">
						<input type="text" name="payment_ocf_mellat_sale_reference_id" placeholder="{{ entry_sale_reference_id }}" id="input-sale-reference-id" class="form-control" />
					  </div>
					</div>
				  </form>
				  <div class="text-center">
					<button id="button-settle" data-loading-text="{{ text_loading }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i> {{ button_settle }}</button>
				  </div>
				  <br />
			  </fieldset>
			</div>
            <!--<div class="tab-pane" id="tab-refund">
			  <fieldset>
				  <legend>{{ fields_configuration_4 }}</legend>
				  <form class="form-horizontal" id="button-refund">
					  <div class="form-group">
						<label class="col-sm-2 control-label" for="input-sale-amount">{{ entry_sale_amount }}</label>
						<div class="col-sm-10">
						  <input type="text" name="payment_ocf_mellat_sale_amount" placeholder="{{ entry_sale_amount }}" id="input-sale-amount" class="form-control" />
						</div>
					  </div>
					  <div class="form-group">
						<label class="col-sm-2 control-label" for="input-sale-order-id">{{ entry_sale_order_id }}</label>
						<div class="col-sm-10">
						  <input type="text" name="payment_ocf_mellat_sale_order_id" placeholder="{{ entry_sale_order_id }}" id="input-sale-order-id" class="form-control" />
						</div>
					  </div>
					   <div class="form-group">
						<label class="col-sm-2 control-label" for="input-sale-reference-id">{{ entry_sale_reference_id }}</label>
						<div class="col-sm-10">
						  <input type="text" name="payment_ocf_mellat_sale_reference_id" placeholder="{{ entry_sale_reference_id }}" id="input-sale-reference-id" class="form-control" />
						</div>
					  </div>
				  </form>
				  <div class="text-right">
					<button id="button-refund" data-loading-text="{{ text_loading }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i> {{ button_refund }}</button>
				  </div>
			  </fieldset>
			</div>-->
			<div class="tab-pane" id="tab-info">
				<fieldset>
				  <div class="form-group">
					<label class="col-sm-2 control-label" for="developer">پشتیبانی</label>
					<div class="col-sm-10">
					  <span id="developer" class="form-control"><a href="http://opencartfarsi.com" title="اپن کارت فارسی دات کام" target="_blank">اپن کارت فارسی</a></span>
					</div>
				  </div>
				</fieldset>
			</div>
		</div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
	$('#tabs a').tabs(); 
	
	$('#button-settle').bind('click', function() {
		$.ajax({
			type: 'get',
			dataType: 'json',
			url: 'index.php?route=payment/mellat/settle&token={{ user_token }}',
			data: 'sale_order_id=' + encodeURIComponent($('input[name=\'payment_ocf_mellat_sale_order_id\']').val()) + '&sale_reference_id=' + encodeURIComponent($('input[name=\'payment_ocf_mellat_sale_reference_id\']').val()),
			beforeSend: function() {
				$('#button-settle').attr('disabled', true);
				$('.box').before('<div class="attention">{{ text_wait }}</div>');
			},
					
			success: function(json) {
				if (json['error']) {
					$('.box').before('<div class="warning">' + json['error'] + '</div>');
					$('#button-settle').attr('disabled', false);
				}
				
				$('.attention').remove();
				if (json['success']) {
					$('.box').before('<div class="success">' + json['success'] + '</div>');
					$('#button-settle').attr('disabled', false);
				}
			}
		});
	});
//--></script>
{{ footer }}