Files
airtime-reseller/resources/views/merchants/refunds_old.blade.php
Kwesi Banson Jnr 2cfcfade4e Initial commit
2026-08-04 14:50:01 +00:00

144 lines
5.7 KiB
PHP

@extends('merch_layouts.merch_master')
@section('page-title')
Merchant | Refunds
@endsection
@section('page-js')
@endsection
@section('page-content')
<div class="row">
<div class="col-md-6">
<div class="hpanel hblue">
<div class="panel-heading hbuilt">Dealer Refund</div>
<div class="panel-body">
<!-- -->
<form action="{{ route('pushrefunds') }}" method="POST" class="form-horizontal" id="dealerRefundForm">
{{csrf_field()}}
<input type="hidden" id="merchantId" name="merchant_id" value="{!! $merchant->id !!}">
<div class="col-md-12" style="padding-bottom: 10px;">
@include('commons.notifications')
</div>
<div class="form-group">
<label class="col-md-3 control-label">Select Dealer</label>
<div class="col-md-7">
<select required class="form-control" name="dealer_id" id="dealerID" placeholder="Merchant" >
<option>-- Select Account --</option>
<?php foreach ($dealers_arr as $row): ?>
<option value="{{ $row->id }}">{{ $row->name }} ({{ $row->phone }}) </option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-md-3 control-label">Amount</label>
<div class="col-md-7">
<input type="number" name="amount" class="form-control" id="amount" placeholder="Refund Amount" required>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Reason</label>
<div class="col-md-7">
<input type="text" name="reason" class="form-control" id="reason" placeholder="Brief text as Reason" required>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-12 ">
<button class="btn btn-info btn-block btn-lg" id="refundFormBtn" type="submit"><i class="fa fa-money"></i> Top Up Merchant</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="hpanel hblue">
<div class="panel-heading hbuilt">Recent Dealer Refunds</div>
<div class="panel-body">
<div class="table-responsive">
<table cellpadding="1" cellspacing="1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Dealer Name</th>
<th>Dealer Phone</th>
<th>Refund Amount</th>
<th>Date</th>
</tr>
</thead>
<tbody>
@forelse ($recent_refunds as $row)
<tr>
<td>{{ $row->orgUserInfo->name }}</td>
<td>{{ $row->orgUserInfo->phone }}</td>
<td>{{ $row->amount }}</td>
<td>{{ $row->created_at }}</td>
</tr>
@empty
<tr>
<td colspan="4">No Data</td>
</tr>
@endforelse
</tbody>
</table>
</div>
{{ $recent_refunds->links() }}
</div>
<div class="panel-footer">
Page : {{ $recent_refunds->currentPage() }} of {{ $recent_refunds->lastPage() }} |
Total Records : <span id="totalRecords">{{ $recent_refunds->total() }}</span>
</div>
</div>
</div>
</div>
@endsection
@section('page-js')
<script>
$(document).ready(function(){
console.log('foo');
alert('foo');
$('#dealerID').select2({
// tags : true
});
$('#dealerRefundFormZZZ').on('submit', function(evt) {
evt.preventDefault();
$('#successArea').addClass('hidden');
$('#errorArea').addClass('hidden');
var merchID = $('#merchantId').val();
var dealerID = $('#dealerID').val();
$.ajax({
type: 'POST',
url: base_url + '/merchant/lukers',
// data: formdata, //a $(this).serialize(),
data: { merchant_id: merchID, dealer_id: dealerID, amount: $('#amount').val(), reason : $('#reason').val() },
headers: { "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content") },
success: function(response) {
console.log(response);
if (response.status == 'failed') {
$('#errorArea').removeClass('hidden');
$('#errorArea').html(response.message);
}
else{
$('#successArea').removeClass('hidden');
$('#successArea').html(response.message);
setTimeout(function() {
location.reload();
}, 3000);
}
},
error: function(xhr, status, error) {
$('#errorArea').removeClass('hidden');
// $('#errorArea').html(response.message);
xhr.responseJSON.errors.forEach(function(value, index) {
console.log(index + ': ' + value);
$('#errorArea').html(index + ': ' + value);
});
}
});
});
});
</script>
@endsection