139 lines
8.2 KiB
PHP
139 lines
8.2 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', $listing->title)
|
|
|
|
@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> {{ $listing->title }}</h1>
|
|
<div>
|
|
@can('aex.listings.update')
|
|
@if($listing->status === 'draft')
|
|
<form method="POST" action="{{ action([\Modules\AssetExchange\Http\Controllers\ListingController::class, 'submit'], [$listing->id]) }}" style="display:inline;">@csrf
|
|
<button type="submit" class="btn btn-success"><i class="fa fa-paper-plane"></i> @lang('assetexchange::lang.submit_listing')</button>
|
|
</form>
|
|
@endif
|
|
<a href="{{ action([\Modules\AssetExchange\Http\Controllers\ListingController::class, 'edit'], [$listing->id]) }}" class="btn btn-primary"><i class="fa fa-edit"></i> @lang('assetexchange::lang.edit')</a>
|
|
@endcan
|
|
@can('aex.research.create')
|
|
<a href="{{ action([\Modules\AssetExchange\Http\Controllers\ResearchCaseController::class, 'create'], ['listing_id' => $listing->id]) }}" class="btn btn-warning"><i class="fa fa-search"></i> @lang('assetexchange::lang.open_research')</a>
|
|
@endcan
|
|
@can('aex.inquiries.create')
|
|
<a href="{{ action([\Modules\AssetExchange\Http\Controllers\PriceInquiryController::class, 'create'], ['listing_id' => $listing->id]) }}" class="btn btn-default"><i class="fa fa-envelope"></i> @lang('assetexchange::lang.new_inquiry')</a>
|
|
@endcan
|
|
@can('aex.appraisals.create')
|
|
<a href="{{ action([\Modules\AssetExchange\Http\Controllers\AppraisalController::class, 'create'], ['listing_id' => $listing->id]) }}" class="btn btn-info"><i class="fa fa-search-dollar"></i> @lang('assetexchange::lang.new_appraisal')</a>
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
@if($listing->media->isNotEmpty())
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('assetexchange::lang.photos_and_docs')</h3></div>
|
|
<div class="mt-card-body">
|
|
<div class="row">
|
|
@foreach($listing->media as $media)
|
|
<div class="col-md-3 col-sm-4" style="margin-bottom:12px;">
|
|
@if($media->media_type === 'photo')
|
|
<a href="{{ asset('uploads/aex_listings/'.$media->path) }}" target="_blank">
|
|
<img src="{{ asset('uploads/aex_listings/'.$media->path) }}" class="img-responsive img-thumbnail" alt="">
|
|
</a>
|
|
@else
|
|
<a href="{{ asset('uploads/aex_listings/'.$media->path) }}" target="_blank" class="btn btn-default btn-block"><i class="fa fa-file"></i> {{ $media->caption ?: $media->path }}</a>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('assetexchange::lang.description')</h3></div>
|
|
<div class="mt-card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<p><strong>@lang('assetexchange::lang.listing_code'):</strong> {{ $listing->listing_code }}</p>
|
|
<p><strong>@lang('assetexchange::lang.listing_type'):</strong> {{ $aexUtil->listingTypeLabel($listing->listing_type) }}</p>
|
|
<p><strong>@lang('assetexchange::lang.status'):</strong> {{ $aexUtil->statusLabel($listing->status) }}</p>
|
|
<p><strong>@lang('assetexchange::lang.manufacturer'):</strong> {{ $listing->manufacturer ?? '—' }}</p>
|
|
<p><strong>@lang('assetexchange::lang.model'):</strong> {{ $listing->model ?? '—' }}</p>
|
|
<p><strong>@lang('assetexchange::lang.serial_number'):</strong> {{ $listing->serial_number ?? '—' }}</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<p><strong>@lang('assetexchange::lang.seller'):</strong> {{ $listing->seller?->name ?? '—' }}</p>
|
|
<p><strong>@lang('assetexchange::lang.broker'):</strong> {{ $listing->broker?->user_full_name ?? '—' }}</p>
|
|
<p><strong>@lang('assetexchange::lang.asking_price'):</strong> {{ $aexUtil->formatMoney($listing->asking_price) }}</p>
|
|
<p><strong>@lang('assetexchange::lang.location'):</strong> {{ $listing->location_text ?? '—' }}</p>
|
|
<p><strong>@lang('assetexchange::lang.intake_source'):</strong> {{ $listing->intake_source ?? 'internal' }}</p>
|
|
</div>
|
|
</div>
|
|
@if(!empty($listing->specs_json))
|
|
<hr><h4>@lang('assetexchange::lang.technical_specs')</h4>
|
|
<ul>@foreach($listing->specs_json as $k => $v)<li><strong>{{ $k }}:</strong> {{ is_array($v) ? json_encode($v) : $v }}</li>@endforeach</ul>
|
|
@endif
|
|
<hr><p>{{ $listing->description ?: '—' }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
@include('assetexchange::listings.partials.catalog_matches', ['listing' => $listing])
|
|
</div>
|
|
<div class="col-md-4">
|
|
@if($activeResearch)
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('assetexchange::lang.active_research')</h3></div>
|
|
<div class="mt-card-body">
|
|
<p>{{ $activeResearch->title }}</p>
|
|
<p>@lang('assetexchange::lang.progress'): {{ $activeResearch->tasks->where('status','completed')->count() }}/{{ $activeResearch->tasks->count() }}</p>
|
|
<a href="{{ action([\Modules\AssetExchange\Http\Controllers\ResearchCaseController::class, 'workspace'], [$activeResearch->id]) }}" class="btn btn-warning btn-block">@lang('assetexchange::lang.research_workspace')</a>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@can('aex.listings.update')
|
|
@if(in_array($listing->status, ['submitted', 'under_review']))
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('assetexchange::lang.assign_broker')</h3></div>
|
|
<div class="mt-card-body">
|
|
{!! Form::open(['url' => action([\Modules\AssetExchange\Http\Controllers\ListingController::class, 'assignBroker'], [$listing->id]), 'method' => 'post']) !!}
|
|
<div class="form-group">{!! Form::select('broker_user_id', \App\User::forDropdown($listing->business_id, false, false, true), $listing->assigned_broker_user_id, ['class' => 'form-control select2', 'style' => 'width:100%']) !!}</div>
|
|
<button type="submit" class="btn btn-primary btn-block">@lang('assetexchange::lang.assign_broker')</button>
|
|
{!! Form::close() !!}
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
</section>
|
|
@endsection
|
|
|
|
@section('javascript')
|
|
<script>
|
|
$(function(){
|
|
$('.select2').select2();
|
|
@if(isset($listing))
|
|
$('#catalog_search_{{ $listing->id }}').autocomplete({
|
|
source: function(request, response) {
|
|
$.getJSON('{{ action([\Modules\AssetExchange\Http\Controllers\CatalogMatchController::class, 'search']) }}', { term: request.term }, function(data){
|
|
response($.map(data, function(item){
|
|
return { label: item.label + ' (' + item.score + '%)', value: item.label, id: item.catalog_id, type: item.catalog_type };
|
|
}));
|
|
});
|
|
},
|
|
select: function(e, ui) {
|
|
$('#catalog_id_{{ $listing->id }}').val(ui.item.id);
|
|
$('#catalog_label_{{ $listing->id }}').val(ui.item.value);
|
|
$('select[name=catalog_type]').val(ui.item.type);
|
|
},
|
|
minLength: 2
|
|
});
|
|
@endif
|
|
});
|
|
</script>
|
|
@endsection
|