src/ApplicationBundle/Resources/views/modals/input_forms/add_payment.html.twig line 1

Open in your IDE?
  1. <!-- Modal -->
  2. <div class="modal fade" id="newPaymentModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  3.     <div class="modal-dialog" role="document">
  4.         <form class="form-horizontal addCreatedByDataForm modalFormPayment" method="post" action="{{ url('add_payment') }}" >
  5.             <div class="modal-content">
  6.                 <div class="modal-header">
  7.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  8.                     <h4 class="modal-title" id="myModalLabel">Add New Payment</h4>
  9.                 </div>
  10.                 <div class="modal-body">
  11.                     <div class="form-group">
  12.                         <label for="inputEmail3" class="col-sm-2 control-label">Payment Date</label>
  13.                         <div class="col-sm-10">
  14.                             <input  name="payment_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
  15.                         </div>
  16.                     </div>
  17.                     <div class="form-group">
  18.                         <label for="inputEmail3" class="col-sm-2 control-label">Payment Type</label>
  19.                         <div class="col-sm-10">
  20.                             <select class="form-control selectize_me  filter_by_this" name="payment_type">
  21.                                 {#{% for category in itemgroup %}#}
  22.                                     <option value="1">To Supplier </option>
  23.                                     <option value="2">To Employee </option>
  24.                                     <option value="3">Against A/C Head </option>
  25.                                 {#{% endfor %}#}
  26.                             </select>
  27.                         </div>
  28.                     </div>
  29.                     <div class="form-group">
  30.                         <label for="inputEmail3" class="col-sm-2 control-label">Pay As</label>
  31.                         <div class="col-sm-10">
  32.                             <select class="form-control selectize_me" name="payment_sub_type" >
  33.                                 {#{% for category in itemgroup %}#}
  34.                                 <option value="1">As Payment</option>
  35.                                 <option value="2">As Advance</option>
  36.                                 <option value="3">As Loan</option>
  37.                                 {#{% endfor %}#}
  38.                             </select>
  39.                         </div>
  40.                     </div>
  41.                     <div class="form-group">
  42.                         <label for="inputEmail3" class="col-sm-2 control-label">Amount</label>
  43.                         <div class="col-sm-10">
  44.                             <input type="number" name="payment_amount" class="form-control" id="payment_amount" placeholder="Amount">
  45.                         </div>
  46.                     </div>
  47.                     <div class="form-group  filter filter-default filter-1">
  48.                         <label for="inputEmail3" class="col-sm-2 control-label">Pay To</label>
  49.                         <div class="col-sm-10">
  50.                             {% set head_list=''|SupplierList %}
  51.                             {#{{ dump(head_list) }}#}
  52.                             <select class="form-control selectize_me change_check_narration" name="payment_to_1">
  53.                                 {% for head in head_list %}
  54.                                 {#<option value="{{ head.supplierId }}">{{ head.supplierName }} ( Due: {{ head.supplierDue }} )</option>#}
  55.                                 <option value="{{ head.supplierId }}">{{ head.supplierName }} ( Due: {{ head.supplierDue }} )</option>
  56.                                 {% endfor %}
  57.                             </select>
  58.                             <input type="text" name="payment_to_note_1" class="form-control"  placeholder="Notes about this">
  59.                         </div>
  60.                     </div>
  61.                     <div class="form-group filter filter-2">
  62.                         <label for="inputEmail3" class="col-sm-2 control-label">Pay To</label>
  63.                         <div class="col-sm-10">
  64.                             {% set head_list='pv'|GetParentLedgerHeads %}
  65.                             <select class="form-control selectize_me change_check_narration" name="payment_to_2">
  66.                                 {% if head_list.DEBIT_HEADS is defined %}
  67.                                 {% for head in head_list.DEBIT_HEADS %}
  68.                                     <option value="{{ head['id'] }}">{{ head['text'] }}</option>
  69.                                 {% endfor %}
  70.                                 {% endif %}
  71.                             </select>
  72.                             <input type="text" name="payment_to_note_2" class="form-control"   placeholder="Notes about this">
  73.                         </div>
  74.                     </div>
  75.                     <div class="form-group filter filter-3">
  76.                         <label for="inputEmail3" class="col-sm-2 control-label">Pay To</label>
  77.                         <div class="col-sm-10">
  78.                             {% set head_list='pv'|GetParentLedgerHeads %}
  79.                             <select class="form-control selectize_me change_check_narration" name="payment_to_3">
  80.                                 {% if head_list.DEBIT_HEADS is defined %}
  81.                                 {% for head in head_list.DEBIT_HEADS %}
  82.                                     <option value="{{ head['id'] }}">{{ head['text'] }}</option>
  83.                                 {% endfor %}
  84.                                 {% endif %}
  85.                             </select>
  86.                             <input type="text" name="payment_to_note_3" class="form-control"   placeholder="Notes about this">
  87.                         </div>
  88.                     </div>
  89.                     <div class="form-group">
  90.                         <label for="inputEmail3" class="col-sm-2 control-label">Pay From</label>
  91.                         <div class="col-sm-10">
  92.                             {#{% set head_list='pv'|GetParentLedgerHeads %}#}
  93.                             <select class="form-control selectize_me payment_change_check_number" name="payment_from">
  94.                                 <option value="">Select</option>
  95.                                 {% if head_list.CREDIT_HEADS is defined %}
  96.                                 {% for head in head_list.CREDIT_HEADS %}
  97.                                     <option value="{{ head['id'] }}">{{ head['text'] }}</option>
  98.                                 {% endfor %}
  99.                                 {% endif %}
  100.                             </select>
  101.                             <input type="text" name="payment_from_note" class="form-control"   placeholder="Notes about this">
  102.                         </div>
  103.                     </div>
  104.                     <div class="form-group filter payment_check_number_div">
  105.                         <label for="inputEmail3" class="col-sm-2 control-label">Check Number</label>
  106.                         <div class="col-sm-10">
  107.                             <input type="text" name="payment_check_number" class="form-control" id="payment_check_number_here" placeholder="">
  108.                             <input  name="check_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
  109.                             <input type="text" name="check_narration" class="form-control" id="payment_check_narration" placeholder="Check Narration (default)" value="">
  110.                             <input type="hidden" name="check_id" class="form-control" id="payment_check_id" placeholder="">
  111.                         </div>
  112.                     </div>
  113.                     <div class="form-group">
  114.                         <label for="inputEmail3" class="col-sm-2 control-label">Description</label>
  115.                         <div class="col-sm-10">
  116.                             <textarea name="description" rows="3" class="form-control"   placeholder="">Voucher Narration here</textarea>
  117.                         </div>
  118.                     </div>
  119.                     <div class="form-group filter filter-default filter-1">
  120.                         <label for="inputEmail3" class="col-sm-2 control-label"></label>
  121.                         <div class="col-sm-10">
  122.                         <input type="checkbox"  name="auto_balance_1" value="1" id="exp_check_auto_balance" checked>
  123.                             <label for="exp_check_auto_balance">Automatically Balance Invoice and Order</label>
  124.                             </div>
  125.                     </div>
  126.                 </div>
  127.                 <div class="modal-footer">
  128.                     <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  129.                     <button type="submit" class="btn btn-primary">Save</button>
  130.                 </div>
  131.             </div>
  132.         </form>
  133.     </div>
  134. </div>
  135. <script>
  136.     // wait for the DOM to be loaded
  137.     var SINGLE_CHECK_LIST={{ ''|GetSingleCheckList|json_encode()|raw  }}
  138.             {#var HEAD_LIST={{ ''|GetParentLedgerHeads|json_encode()|raw  }}#}
  139.             $(document).ready(function() {
  140.                     var paymentOptions = {
  141. //            target:        '#output1',   // target element(s) to be updated with server response
  142. //            dataType:  null  ,      // 'xml', 'script', or 'json' (expected server response type)
  143.                         beforeSubmit:  function(arr, $form, options) {
  144. //                            alertify.set({ delay: 5000 });
  145. //                            alertify.alert('Please Wait..');
  146.                         },
  147.                         success:       showResponsePayment  // post-submit callback
  148.                     };
  149.                     function showResponsePayment(responseText, statusText, xhr, $form)  {
  150.                         if(statusText=='success') {
  151.                             if(responseText.success==true) {
  152.                                 alertify.alert('Successfully Added The Payment. Document Name: '+responseText.docHash);
  153.                                 alertify.success("Expense Added");
  154.                             }
  155.                             else
  156.                             {
  157.                                 alertify.alert('Action Failed');
  158.                                 alertify.error("Could not Add the Payment");
  159.                                 addCreateConfirmed = 0;
  160.                             }
  161.                         }
  162.                         else
  163.                         {
  164.                             alertify.alert('No response form server');
  165.                             alertify.error("Could not Add the Payment");
  166.                             addCreateConfirmed = 0;
  167.                         }
  168. //                    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
  169. //                            '\n\nThe output div should have already been updated with the responseText.');
  170. //                    //    console.log('status: ' + statusText + '\n\nresponseText: \n' + responseText +
  171. //                            '\n\nThe output div should have already been updated with the responseText.');
  172.                     }
  173.                 $('.modalFormPayment').ajaxForm(paymentOptions);
  174.                 $('.filter').hide();
  175.                 $('.filter-default').show();
  176.                 $('.filter_by_this').change(function(){
  177. //            alert('here')
  178.                     var filter_ind=$(this).val()
  179.                     $('.filter').hide();
  180.                     $('.filter-'+filter_ind).show();
  181.                 })
  182.                 $('.payment_change_check_number').change(function(){
  183. //            alert('here')
  184.                     var filter_ind=$(this).val()
  185. //            $('.filter').hide();
  186.                     if(SINGLE_CHECK_LIST[filter_ind]) {
  187.                         $('#payment_check_number_here').val(SINGLE_CHECK_LIST[filter_ind].name);
  188. //                        alert(SINGLE_CHECK_LIST[filter_ind].id)
  189.                         $('#payment_check_id').val(SINGLE_CHECK_LIST[filter_ind].id);
  190. //                        alert($('#check_id').val())
  191.                         $('.payment_check_number_div').show();
  192.                     }
  193.                     else {
  194.                         $('#payment_check_number_here').val('');
  195.                         $('#payment_check_id').val('');
  196.                         $('.payment_check_number_div').hide();
  197.                     }
  198.                 })
  199.             });
  200. </script>