<style type="text/css">
.modal-lg {
	width: 98%;
}
</style>

<form class="form-horizontal" id="checkout-form" action="purchase_payment.php?action_type=PAYMENT">
<input type="hidden" name="invoice-id" value="{{ order.invoice_id }}">
<input type="hidden" name="pmethod-id" value="{{ pmethodId }}">
<input type="hidden" name="sup-id" value="{{ order.sup_id }}">
<div class="bootbox-body">
	<div class="table-selection">
		<div class="col-lg-3 col-md-3 col-sm-3 bootbox-tab-menu bootboox-container p-0">
			<div class="list-group">
				<?php $inc = 0;foreach(get_pmethods() as $pmethod) : ?>
					<a class="text-left list-group-item pmethod_item" id="pmethod_<?php echo $pmethod['pmethod_id']; ?>" href="javascript:void(0)" <?php echo $inc == 0 ? 'ng-init="selectPaymentMethod('.$pmethod['pmethod_id'].',\''.$pmethod['name'].'\')"' : null;?> ng-click="selectPaymentMethod('<?php echo $pmethod['pmethod_id']; ?>', '<?php echo $pmethod['name']; ?>')" onClick="return false;"><span class="fa fa-fw fa-angle-double-right"></span> <b><?php echo $pmethod['name']; ?></b></a>
				<?php $inc++;endforeach; ?>
			</div>
		</div>
		<div class="col-lg-5 col-md-5 col-sm-5 pmethod-options-content bootboox-container checkout-payment-option">
			<div class="tab-wrapper tab-cheque bootboox-container pmethods-payment-form">
				<h4 ng-show="pmethodId" class="text-center"><?php echo trans('text_pmethod'); ?> <b>{{ pmethodName }}</b></h4>
				<button ng-click="payNowWithFullPaid()" onClick="return false;" class="btn btn-success full-paid" style="width:100%;">
					<span class="fa fa-fw fa-money"></span> <?php echo trans('button_full_payment'); ?>
				</button>
				<div class="input-group input-group-lg pmethod-field-wrapper">
					<span class="input-group-addon hidden-sm"><?php echo trans('text_pay_amount'); ?></span>
					<input class="form-control" name="paid-amount" ng-model="paidAmount" placeholder="<?php echo trans('placeholder_input_an_amount'); ?>">
				</div>
				<div class="mt-5">
					<textarea name="note" class="form-control no-resize note" placeholder="<?php echo trans('placeholder_note_here');?>">{{ invoiceNote }}</textarea>
				</div>
				
					<div class="input-group input-group-lg">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <th scope="col"><span class="input-group-addon hidden-sm"><?php echo trans('MONTO PAGO EN PESOS'); ?></span></th>
                        <th scope="col"><input class="form-control" name="pago-pesos" ng-model="pagoPesos" placeholder="<?php echo trans('monto en pesos'); ?>" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;" onkeyup="if(this.value<0){this.value='1';}" /></th>
                        <th scope="col"><span class="input-group-addon hidden-sm"><?php echo trans('Cotizacion'); ?></span></th>
                        <th scope="col"><input  name="cotizaciondolar" type="text" class="form-control note" id="cotizaciondolar"  value="" size="7" ng-model="cotiDolar" placeholder="<?php echo trans('Cotizacion');?>" /></th>
                      </tr>
                    </table>
					
					<tr>	<input type="hidden" id="tiporecibo" ng-model="tipoRecibo" name="tiporecibo" class="form-control invoice-note" value="2" placeholder="<?php echo trans('CODIGO DE PAGO');?>" />	SOLO RECIBO (2) PAGA FACTURA (1)		</tr>
				  <tr>
							<h4 ng-show="pmethodId" class="text-center">&nbsp;						    </h4>
							<h4 ng-show="pmethodId" class="text-center">							  <?php echo trans('IMPORTE EN DOLARES:'); ?> <b>{{ pagoPesos > 0 ? pagoPesos / cotiDolar  : 0 | formatDecimal:4  }}</b></h4>
				  </tr>
				   <tr>
							<h4 ng-show="pmethodId" class="text-center"><?php echo trans('BALANCE CONTRAPARTIDA PESOS:'); ?> <b>{{ pagoPesos > 0 ? (paidAmount * cotiDolar) - importeCheque1 - importeCheque2 - importeCheque3 - importeCheque4 - importeCheque5 - importeEfectivo  - importeDeposito : 0 | formatDecimal:4  }}</b></h4>
							
				  </tr>
				   <tr>
							<h4 ng-show="pmethodId" class="text-center"><?php echo trans('BALANCE CONTRAPARTIDA PAGO EN DOLAR BILLETE:'); ?> <b>{{ pagoPesos > 0 ? (paidAmount * cotiDolar) - importeCheque1 - importeCheque2 - importeCheque3 - importeCheque4 - importeCheque5 - importeEfectivo - (importeDolar * cotizacionBillete) - importeDeposito : 0 | formatDecimal:4  }}</b></h4>
							
				  </tr>
						 <tr>
						<input name="paid-amount" class="form-control" onkeypress="return IsNumeric(event);" onKeyUp="if(this.value<0){this.value='1';}" size="4" ng-model="paidAmount" placeholder="<?php echo trans('Ingrese IMPORTE en dolares'); ?>" ondrop="return false;" onpaste="return false;">
			 </tr>
			 <tr>
						
						
			 </tr> 
			 
			  </div>
				<!-- <div class="input-group input-group-sm mt-5">
					<span class="input-group-addon hidden-sm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo trans('text_discount_amount'); ?></span>
					<input class="form-control" type="text" name="discount-amount" ng-model="discountAmount" placeholder="<?php echo trans('placeholder_input_discount_amount'); ?>" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;" onKeyUp="if(this.value<0){this.value='1';}">
				</div> -->
				
				<div class="mt-5">
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<div class="mt-5">
					<div class="input-group input-group-xs pmethod-field-wrapper">
						<span class="input-group-addon hidden-sm">CONTRA PARTIDA </span></div>
				  </div>
				  <div class="mt-5">
					<div class="input-group input-group-xs pmethod-field-wrapper"> <span class="input-group-addon hidden-sm"></span></span>
					  <table width="100%" border="0" cellspacing="0">
                          <tr>
                            <th width="21%" scope="col"><span class="input-group-addon hidden-sm"><?php echo trans('Caja Diaria Pesos'); ?></span></th>
                            <th width="79%" scope="col"><span class="input-group-addon hidden-sm">
                              <input type="text" id="importeefectivo"  name="importeefectivo" ng-model="importeEfectivo" class="form-control note" value="" placeholder="<?php echo trans('Importe en dPesos');?>" />
                            </span></th>
                          <tr>
                            <th scope="col">&nbsp;</th>
                            <th scope="col">&nbsp;</th>
                      </table>
					</div>
				</div>
				  <div class="mt-5">
						<table width="100%" border="0" cellspacing="0">
                          <tr>
                            <th width="5%" scope="col"><span class="input-group-addon hidden-sm">Ch 1</span></span> </th>
                            <th width="29%" scope="col"><input name="numerocheque1" type="text"  class="form-control invoice-note" id="numerocheque1" value="" size="10" placeholder="<?php echo trans('Numero de Cheque');?>" /></th>
                            <th width="33%" scope="col"><input type="date" id="fechacheque1" name="fechacheque1" class="form-control note" value="" placeholder="<?php echo trans('Fecha de Cobro');?>" /></th>
                            <th width="33%" scope="col"><input type="text" id="importecheque1" ng-model="importeCheque1" name="importecheque1" class="form-control invoice-note" value="" placeholder="<?php echo trans('Importe Cheque');?>" /></th>
                          </tr>
                          <tr>
                            <th width="5%" scope="col"><span class="input-group-addon hidden-sm">Ch 2</span></span> </th>
                            <th width="29%" scope="col"><input name="numerocheque2" type="text" class="form-control invoice-note" id="numerocheque2" value="" size="10" placeholder="<?php echo trans('Numero de Cheque');?>" /></th>
                            <th width="33%" scope="col"><input type="date" id="fechacheque2" name="fechacheque2" class="form-control note" value="" placeholder="<?php echo trans('Fecha de Cobro');?>" /></th>
                            <th width="33%" scope="col"><input type="text" id="importecheque2" ng-model="importeCheque2" name="importecheque2" class="form-control note" value="" placeholder="<?php echo trans('Importe Cheque');?>" /></th>
                          </tr>
						  <tr>
                            <th width="5%" scope="col"><span class="input-group-addon hidden-sm">Ch 3</span></span> </th>
                            <th width="29%" scope="col"><input name="numerocheque3" type="text" class="form-control note" id="numerocheque3" value="" size="10" placeholder="<?php echo trans('Numero de Cheque');?>" /></th>
                            <th width="33%" scope="col"><input type="date" id="fechacheque3" name="fechacheque3" class="form-control note" value="" placeholder="<?php echo trans('Fecha de Cobro');?>" /></th>
                            <th width="33%" scope="col"><input type="text" id="importecheque3"  name="importecheque3" ng-model="importeCheque3" class="form-control note" value="" placeholder="<?php echo trans('Importe Cheque');?>" /></th>
                          </tr>
						  <tr>
                            <th width="5%" scope="col"><span class="input-group-addon hidden-sm">Ch 4</span></span> </th>
                            <th width="29%" scope="col"><input name="numerocheque4" type="text" class="form-control invoice-note" id="numerocheque4" value="" size="10" placeholder="<?php echo trans('Numero de Cheque');?>" /></th>
                            <th width="33%" scope="col"><input type="date" id="fechacheque4" name="fechacheque4" class="form-control note" value="" placeholder="<?php echo trans('Fecha de Cobro');?>" /></th>
                            <th width="33%" scope="col"><input type="text" id="importecheque4" ng-model="importeCheque4" name="importecheque4" class="form-control note" value="" placeholder="<?php echo trans('Importe Cheque');?>" /></th>
                          </tr>
						  <tr>
                            <th width="5%" scope="col"><span class="input-group-addon hidden-sm">Ch 5</span></span> </th>
                            <th width="29%" scope="col"><input name="numerocheque5" type="text" class="form-control note" id="numerocheque5" value="" size="10" placeholder="<?php echo trans('Numero de Cheque');?>" /></th>
                            <th width="33%" scope="col"><input type="date" id="fechacheque5" name="fechacheque5" class="form-control note" value="" placeholder="<?php echo trans('Fecha de Cobro');?>" /></th>
                            <th width="33%" scope="col"><input type="text" id="importecheque5"  ng-model="importeCheque5" name="importecheque5" class="form-control note" value="" placeholder="<?php echo trans('Importe Cheque');?>" /></th>
                          </tr>
                        </table>
				  </div>
						
			  </div>
			  <div class="mt-5">
					<div class="input-group input-group-xs pmethod-field-wrapper">
						<span class="input-group-addon hidden-sm">Imputaciones en cajas</span></span>
						
				</div>
			  </div>
					
						<div class="mt-5">
					<div class="input-group input-group-xs pmethod-field-wrapper"> <span class="input-group-addon hidden-sm"></span></span>
					  <table width="100%" border="0" cellspacing="0">
                          <tr>
                            <th scope="col">Caja Dolar BILLETE Diaria </th>
                            <th scope="col"><span class="input-group-addon hidden-sm">
                              <input type="text" id="importe-dolar"  name="importedolar" ng-model="importeDolar" class="form-control note" value="" placeholder="<?php echo trans('Importe en dolares');?>" /><th scope="col">Cotizacion Dolar Billete </th>
                            <th scope="col"><span class="input-group-addon hidden-sm">
                              <input type="text" id="cotizacion-billete"  name="cotizacionbillete" ng-model="cotizacionBillete" class="form-control note" value="" placeholder="<?php echo trans('Cotizacion Dolar Billete');?>" />
                            </span></th>
                            </span></th>
							
                            
                      </table>
					</div>
				</div>
					
					
				<div class="mt-5">
					<div class="input-group input-group-xs pmethod-field-wrapper">
						<span class="input-group-addon hidden-sm">Deposito o tranferencias bancarias</span></span>
						
				  </div>
			  </div>
				<div class="mt-5">
					<div class="input-group input-group-xs pmethod-field-wrapper"> <span class="input-group-addon hidden-sm"></span></span>
					  <table width="100%" border="0" cellspacing="0">
                          <tr>
                            <th scope="col">Caja deposito</th>
                            <th scope="col"><span class="input-group-addon hidden-sm">
                              <input type="text" id="importedeposito"  name="importedeposito" ng-model="importeDeposito" class="form-control note" value="" placeholder="<?php echo trans('Importe del deposito');?>" />
                            </span></th>
                            <th scope="col">Numero de Transaccion</th>
                            <th scope="col"><input type="text" id="numerodeposito"  name="numerodeposito" class="form-control note" value="" placeholder="<?php echo trans('Numero de transaccion');?>" /></th>
                          </tr>
                      </table>
					</div>
				</div>
				
				
				<div bind-html-compile="rawPaymentMethodHtml"></div>
			</div>
		</div>
		<div class="col-lg-4 col-md-4 col-sm-4 cart-details bootboox-container">
			<div class="table-responsive mt-30">
				<table class="table table-bordered table-striped table-condensed">
					<tbody>
						<tr>
							<td><?php echo trans('button_full_payment'); ?></td>
							<td>{{ order.invoice_id }}</td>
						</tr>
					</tbody>
				</table>
			</div>
			
			
			
			<div class="text-center">
				<h4><?php echo trans('text_billing_details'); ?></h4>
			</div>
			<div class="table-responsive">
				<table class="table table-bordered table-condensed">
					<tbody>
						<tr ng-repeat="items in order.items">
							<td class="text-center w-10">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][item_qty_type]" value="{{ items.item_qty_type }}">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][item_id]" value="{{ items.item_id ? items.item_id : items.group_id }}">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][category_id]" value="{{ items.categoryId }}">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][sup_id]" value="{{ items.supId }}">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][item_name]" value="{{ items.item_name }}">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][item_price]" value="{{ items.item_price  | formatDecimal:2 }}">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][item_quantity]" value="{{ items.item_quantity }}">
								<input type="hidden" name="item['{{ items.item_id ? items.item_id : items.group_id }}'][item_total]" value="{{ items.item_total  | formatDecimal:2 }}">
								{{ $index+1 }}
							</td>
							<td class="w-70">{{ items.item_name }} (x{{ items.item_quantity | formatDecimal:2 }} {{ items.unitName }})</td>
							<td class="text-right w-20">{{ items.item_total  | formatDecimal:2 }}</td>
						</tr>
					</tbody>
					<tfoot>
						<tr>
							<th class="text-right w-60" colspan="2">
								<?php echo trans('label_subtotal'); ?>
							</th>
							<input type="hidden" name="sub-total" value="{{ order.subtotal }}">
							<td class="text-right w-40">{{ order.subtotal  | formatDecimal:2 }}</td>
						</tr>
						<tr>
							<th class="text-right w-60" colspan="2">
								<?php echo trans('label_order_tax'); ?>
							</th>
							<input type="hidden" name="tax-amount" value="{{ order.order_tax }}">
							<td class="text-right w-40">{{ order.order_tax  | formatDecimal:2 }}</td>
						</tr>

						<!-- Payments start -->
						<tr ng-repeat="payments in order.payments" class="{{ payments.type=='discount' ? 'danger' : 'success' }}">
							<th ng-show="payments.type=='discount'" class="text-right w-60" colspan="2"><small><i>Discount on</i></small> {{ payments.created_at }} <small><i>by {{ payments.by }}</i></small></th>
							<td ng-show="payments.type=='discount'" class="text-right w-40">{{ payments.amount | formatDecimal:2 }}</td>
						</tr>
						<!-- Payments end -->

						<tr>
							<th class="text-right w-60 bg-gray" colspan="2">
								<?php echo trans('label_payable_amount'); ?>
								<small>({{ order.total_items }} items)</small>
							</th>
							<input type="hidden" name="payable-amount" value="{{ order.payable_amount }}">
							<td class="text-right w-40 bg-gray">{{ order.payable_amount | formatDecimal:2 }}</td>
						</tr>

						<!-- Payments start -->
						<tr ng-repeat="payments in order.payments" class="{{ payments.type=='return' ? 'danger' : 'success' }}">
							<th ng-show="payments.type=='due_paid'" class="text-right w-60" colspan="2"><small><i>Duepaid on</i></small> {{ payments.created_at }} <small><i>by {{ payments.by }}</i></small></th>
							<td ng-show="payments.type=='due_paid'" class="text-right w-40">{{ payments.amount | formatDecimal:2 }}</td>

							<th ng-show="payments.type=='purchase'" class="text-right w-60" colspan="2"><small><i>Paid by</i></small> {{ payments.name }} <i>on</i> {{ payments.created_at }} <small><i>by {{ payments.by }}</i></small></th>
							<td ng-show="payments.type=='purchase'" class="text-right w-40">{{ payments.amount | formatDecimal:2 }}</td>

							<th ng-show="payments.type=='return'" class="text-right w-60" colspan="2"><small><i>Return on</i></small> {{ payments.created_at }} <small><i>by {{ payments.by }}</i></small></th>
							<td ng-show="payments.type=='return'" class="text-right w-40">{{ payments.amount | formatDecimal:2 }}</td>
						</tr>
						<!-- Payments end -->

						<tr class="danger">
							<th class="text-right w-60" colspan="2">
								<?php echo trans('label_due'); ?>
							</th>
							<input type="hidden" name="due-amount" value="{{ order.due }}">
							<td class="text-right w-40">{{ order.due | formatDecimal:2 }}</td>
						</tr>

						<!-- Payments start -->
						<tr ng-repeat="payments in order.payments" class="{{ 'success' }}">
							<th ng-show="payments.type=='change'" class="text-right w-60" colspan="2"><small><i>Change on</i></small> {{ payments.created_at }} <small><i>by {{ payments.by }}</i></small></th>
							<td ng-show="payments.type=='change'" class="text-right w-40">{{ payments.pos_balance | formatDecimal:2 }}</td>
						</tr>
						<!-- Payments end -->

						<tr class="warning">
							<th class="text-right w-60" colspan="2">Balance</th>
							<td class="text-right w-40">{{ order.balance | formatDecimal:2 }}</td>
						</tr>

						<tr ng-show="order.invoice_not" class="active">
							<td colspan="3">
								<b><?php echo trans('label_note'); ?>:</b> {{ order.invoice_note }}
							</td>
						</tr>
					</tfoot>
				</table>
			</div>
		</div>
	</div>
</div>
</form>