You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					177 lines
				
				7.0 KiB
			
		
		
			
		
	
	
					177 lines
				
				7.0 KiB
			| 
								 
											2 years ago
										 
									 | 
							
								@extends('layouts.admin.app')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@section('title',translate('messages.add_fund'))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@push('css_or_js')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@endpush
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@section('content')
							 | 
						||
| 
								 | 
							
								    <div class="content container-fluid">
							 | 
						||
| 
								 | 
							
								        <!-- Page Header -->
							 | 
						||
| 
								 | 
							
								        <div class="page-header">
							 | 
						||
| 
								 | 
							
								            <h1 class="page-header-title text-capitalize">
							 | 
						||
| 
								 | 
							
								                <div class="card-header-icon d-inline-flex mr-2 img">
							 | 
						||
| 
								 | 
							
								                    <img src="{{asset('/public/assets/admin/img/money.png')}}" alt="public">
							 | 
						||
| 
								 | 
							
								                </div>
							 | 
						||
| 
								 | 
							
								                <span>
							 | 
						||
| 
								 | 
							
								                    {{translate('messages.add_fund')}}
							 | 
						||
| 
								 | 
							
								                </span>
							 | 
						||
| 
								 | 
							
								            </h1>
							 | 
						||
| 
								 | 
							
								        </div>
							 | 
						||
| 
								 | 
							
								        <!-- End Page Header -->
							 | 
						||
| 
								 | 
							
								        <div class="card gx-2 gx-lg-3">
							 | 
						||
| 
								 | 
							
								            <div class="card-body">
							 | 
						||
| 
								 | 
							
								                <form action="{{route('admin.customer.wallet.add-fund')}}" method="post" enctype="multipart/form-data" id="add_fund">
							 | 
						||
| 
								 | 
							
								                    @csrf
							 | 
						||
| 
								 | 
							
								                    <div class="row">
							 | 
						||
| 
								 | 
							
								                        <div class="col-sm-6 col-12">
							 | 
						||
| 
								 | 
							
								                            <div class="form-group">
							 | 
						||
| 
								 | 
							
								                                <label class="form-label" for="customer">{{translate('messages.customer')}}</label>
							 | 
						||
| 
								 | 
							
								                                <select id='customer' name="customer_id" data-placeholder="{{translate('messages.select_customer')}}" class="js-data-example-ajax form-control h--45px" required>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                                </select>
							 | 
						||
| 
								 | 
							
								                            </div>
							 | 
						||
| 
								 | 
							
								                        </div>
							 | 
						||
| 
								 | 
							
								                        <div class="col-sm-6 col-12">
							 | 
						||
| 
								 | 
							
								                            <div class="form-group">
							 | 
						||
| 
								 | 
							
								                                <label class="form-label" for="amount">{{translate('messages.amount')}}</label>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                                <input type="number" class="form-control h--45px" name="amount" id="amount" step=".01" required>
							 | 
						||
| 
								 | 
							
								                            </div>
							 | 
						||
| 
								 | 
							
								                        </div>
							 | 
						||
| 
								 | 
							
								                        <div class="col-12">
							 | 
						||
| 
								 | 
							
								                            <div class="form-group">
							 | 
						||
| 
								 | 
							
								                                <label class="form-label" for="referance">{{translate('messages.reference')}} <small>({{translate('messages.optional')}})</small></label>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                                <input type="text" class="form-control h--45px" name="referance" id="referance">
							 | 
						||
| 
								 | 
							
								                            </div>
							 | 
						||
| 
								 | 
							
								                        </div>
							 | 
						||
| 
								 | 
							
								                    </div>
							 | 
						||
| 
								 | 
							
								                    <div class="btn--container justify-content-end">
							 | 
						||
| 
								 | 
							
								                        <button type="reset" id="reset" class="btn btn--reset">{{translate('messages.reset')}}</button>
							 | 
						||
| 
								 | 
							
								                        <button type="submit" id="submit" class="btn btn--primary">{{translate('messages.submit')}}</button>
							 | 
						||
| 
								 | 
							
								                    </div>
							 | 
						||
| 
								 | 
							
								                </form>
							 | 
						||
| 
								 | 
							
								            </div>
							 | 
						||
| 
								 | 
							
								            <!-- End Table -->
							 | 
						||
| 
								 | 
							
								        </div>
							 | 
						||
| 
								 | 
							
								    </div>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@endsection
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@push('script_2')
							 | 
						||
| 
								 | 
							
								    <script>
							 | 
						||
| 
								 | 
							
								        $(document).on('ready', function () {
							 | 
						||
| 
								 | 
							
								            // INITIALIZATION OF DATATABLES
							 | 
						||
| 
								 | 
							
								            // =======================================================
							 | 
						||
| 
								 | 
							
								            var datatable = $.HSCore.components.HSDatatables.init($('#columnSearchDatatable'));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            $('#column1_search').on('keyup', function () {
							 | 
						||
| 
								 | 
							
								                datatable
							 | 
						||
| 
								 | 
							
								                    .columns(1)
							 | 
						||
| 
								 | 
							
								                    .search(this.value)
							 | 
						||
| 
								 | 
							
								                    .draw();
							 | 
						||
| 
								 | 
							
								            });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            $('#column3_search').on('change', function () {
							 | 
						||
| 
								 | 
							
								                datatable
							 | 
						||
| 
								 | 
							
								                    .columns(2)
							 | 
						||
| 
								 | 
							
								                    .search(this.value)
							 | 
						||
| 
								 | 
							
								                    .draw();
							 | 
						||
| 
								 | 
							
								            });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            // INITIALIZATION OF SELECT2
							 | 
						||
| 
								 | 
							
								            // =======================================================
							 | 
						||
| 
								 | 
							
								            $('.js-select2-custom').each(function () {
							 | 
						||
| 
								 | 
							
								                var select2 = $.HSCore.components.HSSelect2.init($(this));
							 | 
						||
| 
								 | 
							
								            });
							 | 
						||
| 
								 | 
							
								        });
							 | 
						||
| 
								 | 
							
								    </script>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    <script>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $('#add_fund').on('submit', function (e) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            e.preventDefault();
							 | 
						||
| 
								 | 
							
								            var formData = new FormData(this);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            Swal.fire({
							 | 
						||
| 
								 | 
							
								                title: '{{translate('messages.are_you_sure')}}',
							 | 
						||
| 
								 | 
							
								                text: '{{translate('messages.you_want_to_add_fund')}}'+$('#amount').val()+' {{\App\CentralLogics\Helpers::currency_code().' '.translate('messages.to')}} '+$('#customer option:selected').text()+'{{translate('messages.to_wallet')}}',
							 | 
						||
| 
								 | 
							
								                type: 'info',
							 | 
						||
| 
								 | 
							
								                showCancelButton: true,
							 | 
						||
| 
								 | 
							
								                cancelButtonColor: 'default',
							 | 
						||
| 
								 | 
							
								                confirmButtonColor: 'primary',
							 | 
						||
| 
								 | 
							
								                cancelButtonText: '{{translate('messages.no')}}',
							 | 
						||
| 
								 | 
							
								                confirmButtonText: '{{translate('messages.add')}}',
							 | 
						||
| 
								 | 
							
								                reverseButtons: true
							 | 
						||
| 
								 | 
							
								            }).then((result) => {
							 | 
						||
| 
								 | 
							
								                if (result.value) {
							 | 
						||
| 
								 | 
							
								                    $.ajaxSetup({
							 | 
						||
| 
								 | 
							
								                        headers: {
							 | 
						||
| 
								 | 
							
								                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
							 | 
						||
| 
								 | 
							
								                        }
							 | 
						||
| 
								 | 
							
								                    });
							 | 
						||
| 
								 | 
							
								                    $.post({
							 | 
						||
| 
								 | 
							
								                        url: '{{route('admin.customer.wallet.add-fund')}}',
							 | 
						||
| 
								 | 
							
								                        data: formData,
							 | 
						||
| 
								 | 
							
								                        cache: false,
							 | 
						||
| 
								 | 
							
								                        contentType: false,
							 | 
						||
| 
								 | 
							
								                        processData: false,
							 | 
						||
| 
								 | 
							
								                        success: function (data) {
							 | 
						||
| 
								 | 
							
								                            if (data.errors) {
							 | 
						||
| 
								 | 
							
								                                for (var i = 0; i < data.errors.length; i++) {
							 | 
						||
| 
								 | 
							
								                                    toastr.error(data.errors[i].message, {
							 | 
						||
| 
								 | 
							
								                                        CloseButton: true,
							 | 
						||
| 
								 | 
							
								                                        ProgressBar: true
							 | 
						||
| 
								 | 
							
								                                    });
							 | 
						||
| 
								 | 
							
								                                }
							 | 
						||
| 
								 | 
							
								                            } else {
							 | 
						||
| 
								 | 
							
								                                $('#customer').val(null).trigger('change');
							 | 
						||
| 
								 | 
							
								                                $('#amount').val(null).trigger('change');
							 | 
						||
| 
								 | 
							
								                                $('#referance').val(null).trigger('change');
							 | 
						||
| 
								 | 
							
								                                toastr.success('{{__("messages.fund_added_successfully")}}', {
							 | 
						||
| 
								 | 
							
								                                    CloseButton: true,
							 | 
						||
| 
								 | 
							
								                                    ProgressBar: true
							 | 
						||
| 
								 | 
							
								                                });
							 | 
						||
| 
								 | 
							
								                            }
							 | 
						||
| 
								 | 
							
								                        }
							 | 
						||
| 
								 | 
							
								                    });
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            })
							 | 
						||
| 
								 | 
							
								        })
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $('.js-data-example-ajax').select2({
							 | 
						||
| 
								 | 
							
								            ajax: {
							 | 
						||
| 
								 | 
							
								                url: '{{route('admin.customer.select-list')}}',
							 | 
						||
| 
								 | 
							
								                data: function (params) {
							 | 
						||
| 
								 | 
							
								                    return {
							 | 
						||
| 
								 | 
							
								                        q: params.term, // search term
							 | 
						||
| 
								 | 
							
								                        page: params.page
							 | 
						||
| 
								 | 
							
								                    };
							 | 
						||
| 
								 | 
							
								                },
							 | 
						||
| 
								 | 
							
								                processResults: function (data) {
							 | 
						||
| 
								 | 
							
								                    return {
							 | 
						||
| 
								 | 
							
								                    results: data
							 | 
						||
| 
								 | 
							
								                    };
							 | 
						||
| 
								 | 
							
								                },
							 | 
						||
| 
								 | 
							
								                __port: function (params, success, failure) {
							 | 
						||
| 
								 | 
							
								                    var $request = $.ajax(params);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    $request.then(success);
							 | 
						||
| 
								 | 
							
								                    $request.fail(failure);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    return $request;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $('#reset').click(function(){
							 | 
						||
| 
								 | 
							
								            $('#customer').val(null).trigger('change');
							 | 
						||
| 
								 | 
							
								        })
							 | 
						||
| 
								 | 
							
								    </script>
							 | 
						||
| 
								 | 
							
								@endpush
							 |