<!-- Modal -->
<div class="modal fade" id="newPaymentModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<form class="form-horizontal addCreatedByDataForm modalFormPayment" method="post" action="{{ url('add_payment') }}" >
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Add New Payment</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Payment Date</label>
<div class="col-sm-10">
<input name="payment_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Payment Type</label>
<div class="col-sm-10">
<select class="form-control selectize_me filter_by_this" name="payment_type">
{#{% for category in itemgroup %}#}
<option value="1">To Supplier </option>
<option value="2">To Employee </option>
<option value="3">Against A/C Head </option>
{#{% endfor %}#}
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Pay As</label>
<div class="col-sm-10">
<select class="form-control selectize_me" name="payment_sub_type" >
{#{% for category in itemgroup %}#}
<option value="1">As Payment</option>
<option value="2">As Advance</option>
<option value="3">As Loan</option>
{#{% endfor %}#}
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Amount</label>
<div class="col-sm-10">
<input type="number" name="payment_amount" class="form-control" id="payment_amount" placeholder="Amount">
</div>
</div>
<div class="form-group filter filter-default filter-1">
<label for="inputEmail3" class="col-sm-2 control-label">Pay To</label>
<div class="col-sm-10">
{% set head_list=''|SupplierList %}
{#{{ dump(head_list) }}#}
<select class="form-control selectize_me change_check_narration" name="payment_to_1">
{% for head in head_list %}
{#<option value="{{ head.supplierId }}">{{ head.supplierName }} ( Due: {{ head.supplierDue }} )</option>#}
<option value="{{ head.supplierId }}">{{ head.supplierName }} ( Due: {{ head.supplierDue }} )</option>
{% endfor %}
</select>
<input type="text" name="payment_to_note_1" class="form-control" placeholder="Notes about this">
</div>
</div>
<div class="form-group filter filter-2">
<label for="inputEmail3" class="col-sm-2 control-label">Pay To</label>
<div class="col-sm-10">
{% set head_list='pv'|GetParentLedgerHeads %}
<select class="form-control selectize_me change_check_narration" name="payment_to_2">
{% if head_list.DEBIT_HEADS is defined %}
{% for head in head_list.DEBIT_HEADS %}
<option value="{{ head['id'] }}">{{ head['text'] }}</option>
{% endfor %}
{% endif %}
</select>
<input type="text" name="payment_to_note_2" class="form-control" placeholder="Notes about this">
</div>
</div>
<div class="form-group filter filter-3">
<label for="inputEmail3" class="col-sm-2 control-label">Pay To</label>
<div class="col-sm-10">
{% set head_list='pv'|GetParentLedgerHeads %}
<select class="form-control selectize_me change_check_narration" name="payment_to_3">
{% if head_list.DEBIT_HEADS is defined %}
{% for head in head_list.DEBIT_HEADS %}
<option value="{{ head['id'] }}">{{ head['text'] }}</option>
{% endfor %}
{% endif %}
</select>
<input type="text" name="payment_to_note_3" class="form-control" placeholder="Notes about this">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Pay From</label>
<div class="col-sm-10">
{#{% set head_list='pv'|GetParentLedgerHeads %}#}
<select class="form-control selectize_me payment_change_check_number" name="payment_from">
<option value="">Select</option>
{% if head_list.CREDIT_HEADS is defined %}
{% for head in head_list.CREDIT_HEADS %}
<option value="{{ head['id'] }}">{{ head['text'] }}</option>
{% endfor %}
{% endif %}
</select>
<input type="text" name="payment_from_note" class="form-control" placeholder="Notes about this">
</div>
</div>
<div class="form-group filter payment_check_number_div">
<label for="inputEmail3" class="col-sm-2 control-label">Check Number</label>
<div class="col-sm-10">
<input type="text" name="payment_check_number" class="form-control" id="payment_check_number_here" placeholder="">
<input name="check_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
<input type="text" name="check_narration" class="form-control" id="payment_check_narration" placeholder="Check Narration (default)" value="">
<input type="hidden" name="check_id" class="form-control" id="payment_check_id" placeholder="">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea name="description" rows="3" class="form-control" placeholder="">Voucher Narration here</textarea>
</div>
</div>
<div class="form-group filter filter-default filter-1">
<label for="inputEmail3" class="col-sm-2 control-label"></label>
<div class="col-sm-10">
<input type="checkbox" name="auto_balance_1" value="1" id="exp_check_auto_balance" checked>
<label for="exp_check_auto_balance">Automatically Balance Invoice and Order</label>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>
</form>
</div>
</div>
<script>
// wait for the DOM to be loaded
var SINGLE_CHECK_LIST={{ ''|GetSingleCheckList|json_encode()|raw }}
{#var HEAD_LIST={{ ''|GetParentLedgerHeads|json_encode()|raw }}#}
$(document).ready(function() {
var paymentOptions = {
// target: '#output1', // target element(s) to be updated with server response
// dataType: null , // 'xml', 'script', or 'json' (expected server response type)
beforeSubmit: function(arr, $form, options) {
// alertify.set({ delay: 5000 });
// alertify.alert('Please Wait..');
},
success: showResponsePayment // post-submit callback
};
function showResponsePayment(responseText, statusText, xhr, $form) {
if(statusText=='success') {
if(responseText.success==true) {
alertify.alert('Successfully Added The Payment. Document Name: '+responseText.docHash);
alertify.success("Expense Added");
}
else
{
alertify.alert('Action Failed');
alertify.error("Could not Add the Payment");
addCreateConfirmed = 0;
}
}
else
{
alertify.alert('No response form server');
alertify.error("Could not Add the Payment");
addCreateConfirmed = 0;
}
// alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
// '\n\nThe output div should have already been updated with the responseText.');
// // console.log('status: ' + statusText + '\n\nresponseText: \n' + responseText +
// '\n\nThe output div should have already been updated with the responseText.');
}
$('.modalFormPayment').ajaxForm(paymentOptions);
$('.filter').hide();
$('.filter-default').show();
$('.filter_by_this').change(function(){
// alert('here')
var filter_ind=$(this).val()
$('.filter').hide();
$('.filter-'+filter_ind).show();
})
$('.payment_change_check_number').change(function(){
// alert('here')
var filter_ind=$(this).val()
// $('.filter').hide();
if(SINGLE_CHECK_LIST[filter_ind]) {
$('#payment_check_number_here').val(SINGLE_CHECK_LIST[filter_ind].name);
// alert(SINGLE_CHECK_LIST[filter_ind].id)
$('#payment_check_id').val(SINGLE_CHECK_LIST[filter_ind].id);
// alert($('#check_id').val())
$('.payment_check_number_div').show();
}
else {
$('#payment_check_number_here').val('');
$('#payment_check_id').val('');
$('.payment_check_number_div').hide();
}
})
});
</script>