@extends('layouts.admin') @push('script-page') @endpush @section('page-title') {{ __('Contract Detail') }} @endsection @section('breadcrumb') @if (\Auth::guard('customer')->check()) @else @endif @if (\Auth::user()->type == 'company') @else @endif @endsection @push('pre-purpose-css-page') @endpush @push('css-page') @endpush @push('script-page') @php if (\Auth::user()->type == 'company') { if (\Auth::user()->can('upload attachment')) { $route = route('contract.file.upload', [$contract->id]); } } else { $route = route('customer.contract.file.upload', [$contract->id]); } @endphp @endpush @php $chatGPT = \App\Models\Utility::settings('enable_chatgpt'); $enable_chatgpt = !empty($chatGPT); @endphp @section('action-btn')
@if (\Auth::user()->can('send contract mail') && $contract->edit_status == 'accept')
@endif @if (\Auth::user()->can('duplicate contract') && $contract->edit_status == 'accept')
@endif @if (\Auth::user()->type == 'company')
@else
@endif @if (\Auth::user()->type == 'company')
@else
@endif @if (\Auth::user()->type == 'company' && $contract->edit_status == 'accept')
@endif @if (\Auth::user()->type != 'company' && $contract->edit_status == 'accept')
@endif @php $editstatus = App\Models\Contract::editstatus(); @endphp @if (\Auth::user()->type != 'company') @endif
@endsection @section('filter') @endsection @section('content')
{{ __('Attachment') }}

{{ count($contract->files) }}

{{ __('Comment') }}

{{ count($contract->comment) }}

{{ __('Notes') }}

{{ count($contract->note) }}

{{ __('Customer Name') }}
{{ $contract->clients->name ?? '' }}
{{ __('Subject') }}
{{ $contract->subject }}
{{ __('Value') }}
{{ Auth::user()->priceFormat($contract->value) }}
{{ __('Type') }}
{{ $contract->types->name }}
{{ __('Start Date') }}
{{ Auth::user()->dateFormat($contract->start_date) }}
{{ __('End Date') }}
{{ Auth::user()->dateFormat($contract->end_date) }}
{{ __('Status') }}
{{ ucfirst($contract->edit_status) }}
{{ __('Descriptions') }}
@if ($enable_chatgpt) @endif
@if (\Auth::user()->type == 'company') @if (\Auth::user()->can('contract description')) {{ Form::open(['route' => ['contract.description.store', $contract->id]]) }}
@if ($contract->edit_status == 'accept')
{{ Form::submit(__('Add'), ['class' => 'btn btn-primary']) }}
@endif {{ Form::close() }} @endif @else @if (\Auth::user()->can('contract description')) {{ Form::open(['route' => ['customer.contract.description.store', $contract->id]]) }}
@if (\Auth::user()->type == 'company')
{{ Form::submit(__('Add'), ['class' => 'btn btn-primary']) }}
@endif {{ Form::close() }} @endif @endif
{{ __('Attachments') }}
@if (\Auth::user()->type=='company')
@elseif(\Auth::user()->type != 'company' && $contract->edit_status=='accept' )
@endif @foreach ($contract->files as $file)
{{ $file->files }}

{{ number_format(\File::size(storage_path('contract_attachment/' . $file->files)) / 1048576, 2) . ' ' . __('MB') }}

@if (\Auth::user()->can('delete attachment') && $contract->edit_status == 'accept')
{!! Form::open(['method' => 'DELETE', 'route' => ['contract.file.delete', $contract->id, $file->id]]) !!} {!! Form::close() !!}
@endif @if (\Auth::user()->type != 'company' && $contract->edit_status == 'accept' && \Auth::user()->id == $file->created_by)
{!! Form::open(['method' => 'DELETE', 'route' => ['customer.contract.file.delete', $contract->id, $file->id]]) !!} {!! Form::close() !!}
@endif @php $attachments = \App\Models\Utility::get_file('contract_attachment'); @endphp @if ($contract->files) @endif
@endforeach
{{ __('Comments') }}
{{-- @if ($contract->edit_status == 'accept') --}} @if (\Auth::user()->type == 'company') @if (\Auth::user()->can('add comment'))
@endif @elseif(\Auth::user()->type != 'company' && $contract->edit_status=='accept') @if (\Auth::user()->can('add comment'))
@endif @endif {{-- @endif --}}
@foreach ($contract->comment as $comment)
@if ($comment->type == 'company') @php $user = \App\Models\User::find($comment->created_by); $profile = \App\Models\Utility::get_file('/'); @endphp @elseif($comment->type == 'customer') @php $customer = \App\Models\Customer::find($comment->created_by); $profile = \App\Models\Utility::get_file('uploads/avatar/'); @endphp @endif

{{ $comment->comment }}

{{ $comment->created_at->diffForHumans() }}
@if (\Auth::user()->can('delete comment') && $contract->edit_status == 'accept')
{!! Form::open(['method' => 'GET', 'route' => ['comment.destroy', $comment->id]]) !!} {!! Form::close() !!}
@endif @if ( \Auth::user()->type != 'company' && $contract->edit_status == 'accept' && \Auth::user()->id == $comment->created_by && Auth::guard('customer')->user()->email == \Auth::user()->email)
{!! Form::open(['method' => 'GET', 'route' => ['customer.comment.destroy', $comment->id]]) !!} {!! Form::close() !!}
@endif
@endforeach
{{ __('Notes') }}
@if ($enable_chatgpt) @endif
{{-- @if ($contract->edit_status == 'accept') --}} @if (\Auth::user()->type == 'company') @if (\Auth::user()->can('add notes')) {{ Form::open(['route' => ['contract.note.store', $contract->id]]) }}
{{-- @if ($contract->edit_status == 'accept') --}}
{{ Form::submit(__('Add'), ['class' => 'btn btn-primary']) }}
{{-- @endif --}} {{ Form::close() }} @endif @elseif(\Auth::user()->type != 'company' && $contract->edit_status=='accept') @if (\Auth::user()->can('add notes')) {{ Form::open(['route' => ['customer.contract.note.store', $contract->id]]) }}
{{-- @if ($contract->edit_status == 'accept') --}}
{{ Form::submit(__('Add'), ['class' => 'btn btn-primary']) }}
{{-- @endif --}} {{ Form::close() }} @endif @endif {{-- @endif --}}
@foreach ($contract->note as $note)
{{-- --}}
@if ($note->type == 'company') @php $user = \App\Models\User::find($note->created_by); $profile = \App\Models\Utility::get_file('uploads/avatar/'); @endphp @elseif($note->type == 'customer') @php $customer = \App\Models\Customer::find($note->created_by); $profile = \App\Models\Utility::get_file('uploads/avatar/'); @endphp @endif

{{ $note->note }}

{{ $note->created_at->diffForHumans() }}
@if (\Auth::user()->can('delete notes') && $contract->edit_status == 'accept')
{!! Form::open(['method' => 'GET', 'route' => ['contract.note.destroy', $note->id]]) !!} {!! Form::close() !!}
@endif @if (\Auth::user()->type != 'company' && $contract->edit_status == 'accept' && \Auth::user()->id == $note->created_by)
{!! Form::open(['method' => 'GET', 'route' => ['customer.contract.note.destroy', $note->id]]) !!} {!! Form::close() !!}
@endif
@endforeach
@endsection