103 lines
4.7 KiB
PHP
103 lines
4.7 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', __('assetexchange::lang.offers'))
|
|
|
|
@section('content')
|
|
@include('assetexchange::layouts.nav')
|
|
|
|
<section class="content no-print mt-page">
|
|
<div class="mt-page-header">
|
|
<h1><i class="fas fa-tag" style="color:#3b82f6;margin-left:8px;"></i> @lang('assetexchange::lang.offers')</h1>
|
|
</div>
|
|
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('assetexchange::lang.all_offers')</h3></div>
|
|
<div class="mt-card-body">
|
|
@can('aex.offers.create')
|
|
<div class="well" style="margin-bottom:16px;">
|
|
{!! Form::open(['url' => action([\Modules\AssetExchange\Http\Controllers\OfferController::class, 'store']), 'method' => 'post']) !!}
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
{!! Form::label('listing_id', __('assetexchange::lang.listings') . ':') !!}
|
|
{!! Form::select('listing_id', $listings, null, ['class' => 'form-control select2', 'required', 'style' => 'width:100%']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
{!! Form::label('buyer_contact_id', __('assetexchange::lang.buyer') . ':') !!}
|
|
{!! Form::select('buyer_contact_id', $contacts, null, ['class' => 'form-control select2', 'placeholder' => __('assetexchange::lang.select'), 'style' => 'width:100%']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-group">
|
|
{!! Form::label('amount', __('assetexchange::lang.offer_amount') . ':') !!}
|
|
{!! Form::text('amount', null, ['class' => 'form-control input_number', 'required']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
{!! Form::label('message', __('assetexchange::lang.offer_message') . ':') !!}
|
|
{!! Form::text('message', null, ['class' => 'form-control']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<label> </label>
|
|
<button type="submit" class="btn btn-primary btn-block"><i class="fa fa-plus"></i></button>
|
|
</div>
|
|
</div>
|
|
{!! Form::close() !!}
|
|
</div>
|
|
@endcan
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-striped" id="aex_offers_table" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th>@lang('assetexchange::lang.listing_title')</th>
|
|
<th>@lang('assetexchange::lang.buyer')</th>
|
|
<th>@lang('assetexchange::lang.offer_amount')</th>
|
|
<th>@lang('assetexchange::lang.status')</th>
|
|
<th>@lang('assetexchange::lang.expires_at')</th>
|
|
<th>@lang('assetexchange::lang.action')</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
@endsection
|
|
|
|
@section('javascript')
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('.select2').select2();
|
|
var table = $('#aex_offers_table').DataTable({
|
|
processing: true,
|
|
serverSide: true,
|
|
ajax: '{{ action([\Modules\AssetExchange\Http\Controllers\OfferController::class, "index"]) }}',
|
|
columns: [
|
|
{ data: 'listing_title', name: 'listing_title', orderable: false },
|
|
{ data: 'buyer_name', name: 'buyer_name', orderable: false },
|
|
{ data: 'amount_fmt', name: 'amount' },
|
|
{ data: 'status_label', name: 'status' },
|
|
{ data: 'expires_at_fmt', name: 'expires_at' },
|
|
{ data: 'action', name: 'action', orderable: false, searchable: false }
|
|
]
|
|
});
|
|
function postOfferAction(url) {
|
|
$.post(url, { _token: '{{ csrf_token() }}' }, function(r) {
|
|
if (r.success) { toastr.success(r.msg); table.ajax.reload(); } else { toastr.error(r.msg); }
|
|
});
|
|
}
|
|
$(document).on('click', '.aex_accept_offer', function() {
|
|
postOfferAction($(this).data('href'));
|
|
});
|
|
$(document).on('click', '.aex_reject_offer', function() {
|
|
postOfferAction($(this).data('href'));
|
|
});
|
|
});
|
|
</script>
|
|
@endsection
|