<form class="form-horizontal" id="form_credit">
	<input type="hidden" name="idtransaction_group" name="idtransaction_group" value="<?php echo $data['idtransaction_group'];?>">
	<table>
		<tr>
			<td>Tanggal</td>
			<td>&nbsp;:&nbsp;</td>
			<td><?php echo $data['date'];?></td>
			<td width="200px"></td>
			<td>Pelanggan</td>
			<td>&nbsp;:&nbsp;</td>
			<td><?php echo $data['customer'];?></td>
		</tr>
		<tr>
			<td>Kode</td>
			<td>&nbsp;:&nbsp;</td>
			<td><?php echo $data['code'];?></td>
			<td></td>
			<td>Total</td>
			<td>&nbsp;:&nbsp;</td>
			<td class="txt-total"><?php echo az_thousand_separator_decimal($data['total']);?></td>
		</tr>
	</table>

	<div class="container-credit" style="margin-top:20px;">
		<table class="table table-bordered table-condensed" id="table_credit">
			<thead>
				<tr>
					<th style="text-align:center;">Tgl Pembayaran</th>
					<th style="text-align:center;">Jumlah Pembayaran</th>
					<th width="10px" style="text-align:center;">#</th>
				</tr>
			</thead>
			<tbody>
				<?php 
					foreach ($data['payment']->result() as $key => $value) {
				?>
				<tr>
					<td>
						<input type="hidden" name="idcredit_payment[]" value="<?php echo $value->idcredit_payment;?>" />
						<div class="input-group az-datetime">
				            <input type="text" class="form-control installment-payment-date" name="installment_payment_date[]" value="<?php echo Date('d-m-Y H:i:s', strtotime($value->installment_payment_date));?>">
				            <span class="input-group-addon">
				            <span class="glyphicon glyphicon-calendar"></span>
				            </span>
				        </div>
					</td>
					<td><input type="text" class="form-control installment-payment format-number-decimal" name="installment_payment[]" value="<?php echo az_thousand_separator_decimal($value->installment_payment);?>"></td>
					<td><button class="btn btn-xs btn-danger btn-delete" type="button"><i class="fa fa-remove"></i></button></td>
				</tr>
				<?php
					}
				?>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="3">
						<button class="btn btn-info btn-xs" type="button" id="btn_add_payment">Tambah Pembayaran</button>
					</td>
				</tr>
			</tfoot>
		</table>
	</div>
	<div>
		<table>
			<tr>
				<td>Jumlah Pembayaran</td>
				<td align="center" width="20px">&nbsp;:&nbsp;</td>
				<td class="txt-pay"></td>
			</tr>
			<tr>
				<td>Sisa Hutang</td>
				<td align="center">&nbsp;:&nbsp;</td>
				<td class="txt-lack"></td>
			</tr>
		</table>
	</div>
</form>

<script type="text/template" id="tmp_credit">
	<tr>
		<td>
			<input type="hidden" name="idcredit_payment[]"/>
			<div class="input-group az-datetime">
	            <input type="text" class="form-control installment-payment-date" name="installment_payment_date[]">
	            <span class="input-group-addon">
	            <span class="glyphicon glyphicon-calendar"></span>
	            </span>
	        </div>
		</td>
		<td><input type="text" class="form-control installment-payment format-number-decimal" name="installment_payment[]"></td>
		<td><button class="btn btn-xs btn-danger btn-delete" type="button"><i class="fa fa-remove"></i></button></td>
	</tr>	
</script>