ultimatepos/Modules/SupplyChain/Resources/views/rfq/show.blade.php

151 lines
8.1 KiB
PHP

@extends('layouts.app')
@section('title', $rfq->ref_no)
@section('content')
@include('supplychain::layouts.nav')
<section class="content-header">
<h1>{{ $rfq->ref_no }} {{ $rfq->title }}
<span class="label {{ $supplyChainUtil->rfqStatusBadgeClass($rfq->status) }}">@lang('supplychain::lang.rfq_status_'.$rfq->status)</span>
</h1>
</section>
<section class="content">
@if(session('status'))
<div class="alert alert-{{ session('status.success') ? 'success' : 'warning' }} alert-dismissible">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ session('status.msg') }}
</div>
@endif
<div class="row">
<div class="col-md-8">
<div class="box box-primary">
<div class="box-header with-border"><h3 class="box-title">@lang('supplychain::lang.lines')</h3></div>
<div class="box-body table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>@lang('supplychain::lang.product')</th>
<th>@lang('supplychain::lang.variation')</th>
<th>@lang('supplychain::lang.qty')</th>
<th>@lang('supplychain::lang.specs')</th>
</tr>
</thead>
<tbody>
@foreach($rfq->lines as $line)
<tr>
<td>{{ $line->product?->name ?? '—' }}</td>
<td>{{ $line->variation?->sub_sku ?? '—' }}</td>
<td>{{ number_format($line->qty, 4) }}</td>
<td>{{ $line->specs ?? '—' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="box box-info">
<div class="box-header with-border"><h3 class="box-title">@lang('supplychain::lang.responses')</h3></div>
<div class="box-body table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>@lang('supplychain::lang.supplier')</th>
<th>@lang('supplychain::lang.quoted_price')</th>
<th>@lang('supplychain::lang.lead_days')</th>
<th>@lang('supplychain::lang.status')</th>
@can('supplychain.rfq.update')
<th>@lang('supplychain::lang.action')</th>
@endcan
</tr>
</thead>
<tbody>
@forelse($rfq->responses as $response)
<tr>
<td>{{ $response->contact?->name ?? '—' }}</td>
<td>{{ $response->quoted_price !== null ? number_format($response->quoted_price, 2) : '—' }}</td>
<td>{{ $response->lead_days ?? '—' }}</td>
<td>{{ $response->status }}</td>
@can('supplychain.rfq.update')
<td>
@if($rfq->status === 'open' || $rfq->status === 'closed')
<form method="POST" action="{{ action([\Modules\SupplyChain\Http\Controllers\RfqController::class, 'award'], $rfq->id) }}" style="display:inline;">
@csrf
<input type="hidden" name="contact_id" value="{{ $response->contact_id }}">
<button type="submit" class="btn btn-xs btn-success" onclick="return confirm('@lang('supplychain::lang.award_rfq')?')">@lang('supplychain::lang.award_rfq')</button>
</form>
@endif
</td>
@endcan
</tr>
@empty
<tr><td colspan="5" class="text-center text-muted">@lang('supplychain::lang.no_records')</td></tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-4">
<div class="box box-default">
<div class="box-body">
<p><strong>@lang('supplychain::lang.due_date'):</strong> {{ $rfq->due_date?->format('Y-m-d') ?? '—' }}</p>
@if($rfq->notes)
<p><strong>@lang('supplychain::lang.notes'):</strong> {{ $rfq->notes }}</p>
@endif
</div>
@can('supplychain.rfq.update')
<div class="box-footer">
@if($rfq->status === 'draft')
<form method="POST" action="{{ action([\Modules\SupplyChain\Http\Controllers\RfqController::class, 'open'], $rfq->id) }}" style="display:inline;">
@csrf
<button type="submit" class="btn btn-primary btn-sm">@lang('supplychain::lang.open_rfq')</button>
</form>
@endif
@if(in_array($rfq->status, ['open', 'draft']))
<form method="POST" action="{{ action([\Modules\SupplyChain\Http\Controllers\RfqController::class, 'close'], $rfq->id) }}" style="display:inline;">
@csrf
<button type="submit" class="btn btn-default btn-sm">@lang('supplychain::lang.close_rfq')</button>
</form>
@endif
</div>
@endcan
</div>
@can('supplychain.rfq.update')
@if(in_array($rfq->status, ['open', 'closed']))
<div class="box box-warning">
<div class="box-header with-border"><h3 class="box-title">@lang('supplychain::lang.submit_response')</h3></div>
{!! Form::open(['url' => action([\Modules\SupplyChain\Http\Controllers\RfqController::class, 'submitResponse'], $rfq->id), 'method' => 'post']) !!}
<div class="box-body">
<div class="form-group">
{!! Form::label('contact_id', __('supplychain::lang.supplier').':') !!}
{!! Form::select('contact_id', $suppliers, null, ['class' => 'form-control select2', 'required']) !!}
</div>
<div class="form-group">
{!! Form::label('quoted_price', __('supplychain::lang.quoted_price').':') !!}
{!! Form::number('quoted_price', null, ['class' => 'form-control', 'required', 'min' => '0', 'step' => 'any']) !!}
</div>
<div class="form-group">
{!! Form::label('lead_days', __('supplychain::lang.lead_days').':') !!}
{!! Form::number('lead_days', null, ['class' => 'form-control', 'required', 'min' => '0']) !!}
</div>
<div class="form-group">
{!! Form::label('notes', __('supplychain::lang.notes').':') !!}
{!! Form::textarea('notes', null, ['class' => 'form-control', 'rows' => 2]) !!}
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-warning btn-sm">@lang('supplychain::lang.submit_response')</button>
</div>
{!! Form::close() !!}
</div>
@endif
@endcan
</div>
</div>
<a href="{{ action([\Modules\SupplyChain\Http\Controllers\RfqController::class, 'index']) }}" class="btn btn-default">@lang('messages.back')</a>
</section>
@endsection