Blame view

resources/views/banking/accounts/create.blade.php 3.52 KB
b7c7a5f6   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  @extends('layouts.admin')
  
  @section('title', trans('general.title.new', ['type' => trans_choice('general.accounts', 1)]))
  
  @section('content')
      <!-- Default box -->
      <div class="box box-success">
          {!! Form::open(['url' => 'banking/accounts', 'role' => 'form']) !!}
  
          <div class="box-body">
              {{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
  
              {{ Form::textGroup('number', trans('accounts.number'), 'pencil') }}
  
              {{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange', $currencies, setting('general.default_currency')) }}
  
              {{ Form::textGroup('opening_balance', trans('accounts.opening_balance'), 'money', ['required' => 'required'], 0) }}
  
              {{ Form::textGroup('bank_name', trans('accounts.bank_name'), 'university', []) }}
  
              {{ Form::textGroup('bank_phone', trans('accounts.bank_phone'), 'phone', []) }}
  
              {{ Form::textareaGroup('bank_address', trans('accounts.bank_address')) }}
  
              {{ Form::radioGroup('default_account', trans('accounts.default_account')) }}
  
              {{ Form::radioGroup('enabled', trans('general.enabled')) }}
          </div>
          <!-- /.box-body -->
  
          <div class="box-footer">
              {{ Form::saveButtons('banking/accounts') }}
          </div>
          <!-- /.box-footer -->
  
          {!! Form::close() !!}
      </div>
  @endsection
  
  @push('scripts')
      <script type="text/javascript">
          var text_yes = '{{ trans('general.yes') }}';
          var text_no = '{{ trans('general.no') }}';
  
          $(document).ready(function(){
              $("#opening_balance").maskMoney({
                  thousands : '{{ $currency->thousands_separator }}',
                  decimal : '{{ $currency->decimal_mark }}',
                  precision : {{ $currency->precision }},
                  allowZero : true,
                  @if($currency->symbol_first)
                  prefix : '{{ $currency->symbol }}'
                  @else
                  suffix : '{{ $currency->symbol }}'
                  @endif
              });
  
              $("#opening_balance").focusout();
  
              $('#enabled_1').trigger('click');
  
              $('#name').focus();
  
              $("#currency_code").select2({
                  placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.currencies', 1)]) }}"
              });
          });
  
          $(document).on('change', '#currency_code', function (e) {
              $.ajax({
                  url: '{{ url("settings/currencies/currency") }}',
                  type: 'GET',
                  dataType: 'JSON',
                  data: 'code=' + $(this).val(),
                  success: function(data) {
                      $('#currency').val(data.code);
  
                      $('#currency_code').val(data.code);
                      $('#currency_rate').val(data.rate);
  
                      opening_balance = $('#opening_balance').maskMoney('unmasked')[0];
  
                      $("#opening_balance").maskMoney({
                          thousands : data.thousands_separator,
                          decimal : data.decimal_mark,
                          precision : data.precision,
                          allowZero : true,
                          prefix : (data.symbol_first) ? data.symbol : '',
                          suffix : (data.symbol_first) ? '' : data.symbol
                      });
  
                      $('#opening_balance').val(opening_balance);
  
                      $('#opening_balance').trigger('focusout');
                  }
              });
          });
      </script>
  @endpush