95 lines
4.5 KiB
PHP
95 lines
4.5 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', __('assetexchange::lang.listings'))
|
|
|
|
@section('content')
|
|
@include('assetexchange::layouts.nav')
|
|
|
|
<section class="content no-print mt-page">
|
|
<div class="mt-page-header">
|
|
<h1><i class="fas fa-list" style="color:#3b82f6;margin-left:8px;"></i> @lang('assetexchange::lang.listings')</h1>
|
|
@can('aex.listings.create')
|
|
<a href="{{ action([\Modules\AssetExchange\Http\Controllers\ListingController::class, 'create']) }}" class="mt-btn-primary btn">
|
|
<i class="fa fa-plus"></i> @lang('assetexchange::lang.new_listing')
|
|
</a>
|
|
@endcan
|
|
</div>
|
|
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('assetexchange::lang.all_listings')</h3></div>
|
|
<div class="mt-card-body">
|
|
<div class="row" style="margin-bottom:12px;">
|
|
<div class="col-md-3">
|
|
{!! Form::select('status', ['' => __('assetexchange::lang.all')] + $statuses, null, ['class' => 'form-control select2 aex-filter-status', 'style' => 'width:100%']) !!}
|
|
</div>
|
|
<div class="col-md-3">
|
|
{!! Form::select('listing_type', ['' => __('assetexchange::lang.all')] + $listing_types, null, ['class' => 'form-control select2 aex-filter-type', 'style' => 'width:100%']) !!}
|
|
</div>
|
|
<div class="col-md-3">
|
|
{!! Form::select('seller_contact_id', ['' => __('assetexchange::lang.all')] + $contacts, null, ['class' => 'form-control select2 aex-filter-seller', 'style' => 'width:100%']) !!}
|
|
</div>
|
|
<div class="col-md-3">
|
|
<button type="button" class="btn btn-primary aex-apply-filters"><i class="fa fa-filter"></i> @lang('assetexchange::lang.apply_filters')</button>
|
|
</div>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-striped" id="aex_listings_table" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th>@lang('assetexchange::lang.listing_code')</th>
|
|
<th>@lang('assetexchange::lang.listing_title')</th>
|
|
<th>@lang('assetexchange::lang.listing_type')</th>
|
|
<th>@lang('assetexchange::lang.seller')</th>
|
|
<th>@lang('assetexchange::lang.asking_price')</th>
|
|
<th>@lang('assetexchange::lang.status')</th>
|
|
<th>@lang('assetexchange::lang.submitted_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_listings_table').DataTable({
|
|
processing: true,
|
|
serverSide: true,
|
|
ajax: {
|
|
url: '{{ action([\Modules\AssetExchange\Http\Controllers\ListingController::class, "index"]) }}',
|
|
data: function(d) {
|
|
d.status = $('.aex-filter-status').val();
|
|
d.listing_type = $('.aex-filter-type').val();
|
|
d.seller_contact_id = $('.aex-filter-seller').val();
|
|
}
|
|
},
|
|
columns: [
|
|
{ data: 'listing_code', name: 'listing_code' },
|
|
{ data: 'title', name: 'title' },
|
|
{ data: 'type_label', name: 'listing_type', orderable: false },
|
|
{ data: 'seller_name', name: 'seller_name', orderable: false },
|
|
{ data: 'asking_price_fmt', name: 'asking_price' },
|
|
{ data: 'status_label', name: 'status' },
|
|
{ data: 'submitted_at_fmt', name: 'submitted_at' },
|
|
{ data: 'action', name: 'action', orderable: false, searchable: false }
|
|
]
|
|
});
|
|
$('.aex-apply-filters').on('click', function() { table.ajax.reload(); });
|
|
$(document).on('click', '.delete_aex_listing', function() {
|
|
var url = $(this).data('href');
|
|
swal({ title: LANG.sure, icon: 'warning', buttons: true, dangerMode: true }).then(function(ok) {
|
|
if (!ok) return;
|
|
$.ajax({ method: 'DELETE', url: url, dataType: 'json', success: function(r) {
|
|
if (r.success) { toastr.success(r.msg); table.ajax.reload(); } else { toastr.error(r.msg); }
|
|
}});
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
@endsection
|