205 lines
8.6 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
@extends('layouts.admin')
2018-12-18 12:55:19 +03:00
@section('title', trans('offlinepayment::general.title'))
2017-09-14 22:21:00 +03:00
@section('content')
<div class="row">
<div class="col-md-4">
<div class="box box-success">
<div class="box-header with-border">
2018-12-18 12:55:19 +03:00
<h3 class="box-title">{{ trans('offlinepayment::general.add_new') }}</h3>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
2017-09-14 22:21:00 +03:00
2018-12-18 12:55:19 +03:00
{!! Form::open(['route' => 'offlinepayment.update', 'files' => true, 'role' => 'form', 'class' => 'form-loading-button']) !!}
2017-09-14 22:21:00 +03:00
<div class="box-body">
<div id="install-loading"></div>
{{ Form::textGroup('name', trans('general.name'), 'id-card-o', ['required' => 'required'], null, 'col-md-12') }}
2017-09-14 22:21:00 +03:00
2018-12-18 12:55:19 +03:00
{{ Form::textGroup('code', trans('offlinepayment::general.form.code'), 'key', ['required' => 'required'], null, 'col-md-12') }}
2017-09-14 22:21:00 +03:00
2018-12-18 12:55:19 +03:00
{{ Form::radioGroup('customer', trans('offlinepayment::general.form.customer'), '', ['required' => 'required'], 0, 'col-md-12') }}
2017-11-18 15:23:20 +03:00
2018-12-18 12:55:19 +03:00
{{ Form::textGroup('order', trans('offlinepayment::general.form.order'), 'sort', [], null, 'col-md-12') }}
2017-09-14 22:21:00 +03:00
{{ Form::textareaGroup('description', trans('general.description')) }}
</div>
<!-- /.box-body -->
2017-09-14 22:21:00 +03:00
<div class="box-footer">
{{ Form::saveButtons('apps/offlinepayment/settings') }}
</div>
<!-- /.box-footer -->
2017-09-14 22:21:00 +03:00
{!! Form::close() !!}
2017-09-14 22:21:00 +03:00
</div>
<!-- /.box -->
</div>
2018-12-18 12:55:19 +03:00
<div class="col-md-8">
<!-- Default box -->
<div class="box box-success">
<div class="box-header with-border">
2018-12-18 12:55:19 +03:00
<h3 class="box-title">{{ trans('offlinepayment::general.payment_gateways') }}</h3>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body">
2018-12-18 12:55:19 +03:00
<div id="delete-loading"></div>
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-items">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.name') }}</th>
2018-12-18 12:55:19 +03:00
<th class="col-md-4">{{ trans('offlinepayment::general.form.code') }}</th>
<th class="col-md-2 text-center">{{ trans('offlinepayment::general.form.order') }}</th>
<th class="col-md-3">{{ trans('general.actions') }}</th>
2017-09-14 22:21:00 +03:00
</tr>
</thead>
<tbody>
@if($items)
@foreach($items as $item)
<tr id="method-{{ $item->code }}">
<td>{{ $item->name }}</td>
<td>{{ $item->code }}</td>
<td class="text-center">{{ $item->order }}</td>
<td>
<button type="button" class="btn btn-primary btn-xs method-edit" id="edit-{{ $item->code }}" title="{{ trans('general.edit') }}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {{ trans('general.edit') }}</button>
<button type="button" class="btn btn-danger btn-xs method-delete" id="delete-{{ $item->code }}" title="{{ trans('general.delete') }}"><i class="fa fa-trash-o" aria-hidden="true"></i> {{ trans('general.delete') }}</button>
</td>
</tr>
@endforeach
@else
2017-09-14 22:21:00 +03:00
@endif
</tbody>
</table>
</div>
2017-09-14 22:21:00 +03:00
</div>
<!-- /.box-body -->
2017-09-14 22:21:00 +03:00
</div>
<!-- /.box -->
2017-09-14 22:21:00 +03:00
</div>
</div>
@endsection
2017-11-13 21:57:07 +03:00
@push('stylesheet')
<style type="text/css">
2018-12-18 12:55:19 +03:00
#install-loading.active, #delete-loading.active {
font-size: 35px;
position: absolute;
z-index: 500;
top: 0px;
left: 0px;
width: 100%;
2018-12-18 12:55:19 +03:00
height: 100%;
background: rgb(136, 136, 136);
opacity: 0.2;
-moz-border-radius-bottomleft: 1px;
-moz-border-radius-bottomright: 1px;
border-bottom-left-radius: 1px;
border-bottom-right-radius: 1px;
}
.install-loading-spin {
font-size: 100px;
position: absolute;
margin: auto;
color: #fff;
2018-12-18 12:55:19 +03:00
padding: 45% 40%;
}
#delete-loading .install-loading-spin {
padding: 8% 40%;
}
</style>
2017-11-13 21:57:07 +03:00
@endpush
2017-11-13 21:57:07 +03:00
@push('scripts')
2017-09-14 22:21:00 +03:00
<script type="text/javascript">
2017-11-18 15:23:20 +03:00
var text_yes = '{{ trans('general.yes') }}';
var text_no = '{{ trans('general.no') }}';
2018-12-18 12:55:19 +03:00
var code = '';
var tr = '';
2017-11-18 15:23:20 +03:00
2017-09-14 22:21:00 +03:00
$(document).ready(function() {
$('.method-edit').on('click', function() {
2018-12-18 12:55:19 +03:00
code = $(this).attr('id').replace('edit-', '');
2017-09-14 22:21:00 +03:00
$.ajax({
2018-12-18 12:55:19 +03:00
url: '{{ route("offlinepayment.get") }}',
2017-09-14 22:21:00 +03:00
type: 'post',
dataType: 'json',
data: {code: code},
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
beforeSend: function() {
2018-12-18 12:55:19 +03:00
$('#install-loading').addClass('active');
$('#install-loading').html('<span class="install-loading-bar"><span class="install-loading-spin"><i class="fa fa-spinner fa-spin"></i></span></span>');
},
complete: function() {
2018-12-18 12:55:19 +03:00
$('#install-loading').removeClass('active');
$('#install-loading .install-loading-bar').remove();
},
2017-09-14 22:21:00 +03:00
success: function(json) {
if (json['error']) {
}
if (json['success']) {
$('.col-md-4.no-padding-left .box-header.with-border .box-title').html(json['data']['title']);
2017-09-14 22:21:00 +03:00
$('input[name="name"]').val(json['data']['name']);
$('input[name="code"]').val(json['data']['code']);
2017-11-18 15:23:20 +03:00
if (json['data']['customer']) {
$('#customer_1 input').trigger('click');
} else {
$('#customer_0 input').trigger('click');
}
$('input[name="order"]').val(json['data']['order']);
2017-12-23 00:49:37 +03:00
$('textarea[name="description"]').val(json['data']['description']);
2017-09-14 22:21:00 +03:00
$('input[name="method"]').remove();
$('.col-md-4 .box-body').append('<input type="hidden" name="method" value="' + json['data']['method'] + '">');
2017-09-14 22:21:00 +03:00
}
}
});
});
$('.method-delete').on('click', function() {
2018-12-18 12:55:19 +03:00
code = $(this).attr('id').replace('delete-', '');
tr = $(this).parent().parent();
2017-09-14 22:21:00 +03:00
$.ajax({
2018-12-18 12:55:19 +03:00
url: '{{ route("offlinepayment.delete") }}',
2017-09-14 22:21:00 +03:00
type: 'post',
dataType: 'json',
data: {code: code},
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
2018-12-18 12:55:19 +03:00
beforeSend: function() {
$('#delete-loading').addClass('active');
$('#delete-loading').html('<span class="install-loading-bar"><span class="install-loading-spin"><i class="fa fa-spinner fa-spin"></i></span></span>');
},
complete: function() {
//$('#delete-loading').removeClass('active');
//$('#delete-loading .install-loading-bar').remove();
},
2017-09-14 22:21:00 +03:00
success: function(json) {
if (json['error']) {
}
if (json['success']) {
$('#method-' + code).remove();
2018-12-18 12:55:19 +03:00
location.reload();
2017-09-14 22:21:00 +03:00
}
}
});
});
});
</script>
2017-11-13 21:57:07 +03:00
@endpush