mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Separate page for download
This commit is contained in:
parent
814dfb0346
commit
d55cfc42cf
@ -12,13 +12,32 @@
|
||||
|
||||
namespace App\Http\Controllers\ClientPortal;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Document\ShowDocumentRequest;
|
||||
use App\Models\Document;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class DownloadController extends Controller
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return render('downloads.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show(ShowDocumentRequest $request, $document)
|
||||
{
|
||||
$document = Document::findOrFail($document);
|
||||
|
||||
return render('downloads.show', [
|
||||
'document' => $document,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class DownloadsTable extends Component
|
||||
|
||||
public function render()
|
||||
{
|
||||
$query = auth()->user()->client->documents()
|
||||
$query = Document::query()
|
||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
||||
->paginate($this->per_page);
|
||||
|
||||
|
@ -22,7 +22,8 @@ class ShowDocumentRequest extends Request
|
||||
*/
|
||||
public function authorize() : bool
|
||||
{
|
||||
return auth()->user()->can('view', $this->document);
|
||||
return true;
|
||||
// return auth()->user()->can('view', $this->document);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3251,4 +3251,8 @@ return [
|
||||
|
||||
'width' => 'Width',
|
||||
'height' => 'Height',
|
||||
|
||||
'document_details' => 'Details about the document',
|
||||
|
||||
'hash' => 'Hash',
|
||||
];
|
||||
|
@ -38,6 +38,7 @@
|
||||
<th class="px-6 py-3 border-b border-gray-200 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
|
||||
{{ ctrans('texts.download') }}
|
||||
</th>
|
||||
<th class="px-6 py-3 border-b border-gray-200 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider" />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -60,6 +61,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-download-cloud"><polyline points="8 17 12 21 16 17"></polyline><line x1="12" y1="12" x2="12" y2="21"></line><path d="M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29"></path></svg>
|
||||
</a>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
|
||||
<a href="{{ route('client.downloads.show', $download->id) }}" class="button-link">
|
||||
{{ ctrans('texts.view') }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr class="bg-white group hover:bg-gray-100">
|
||||
|
80
resources/views/portal/ninja2020/downloads/show.blade.php
Normal file
80
resources/views/portal/ninja2020/downloads/show.blade.php
Normal file
@ -0,0 +1,80 @@
|
||||
@extends('portal.ninja2020.layout.app')
|
||||
@section('meta_title', ctrans('texts.document'))
|
||||
|
||||
@section('body')
|
||||
<div class="container mx-auto">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-7 col-start-3">
|
||||
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||
{{ ctrans('texts.document') }}
|
||||
</h3>
|
||||
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">
|
||||
{{ ctrans('texts.document_details') }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<dl>
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.name') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2 flex items-center">
|
||||
{{ Illuminate\Support\Str::limit($document->name, 40) }}
|
||||
<a href="{{ $document->generateUrl() }}" class="ml-2 text-black hover:text-blue-600" download>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-download-cloud">
|
||||
<polyline points="8 17 12 21 16 17"></polyline>
|
||||
<line x1="12" y1="12" x2="12" y2="21"></line>
|
||||
<path d="M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29"></path>
|
||||
</svg>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.type') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Models\Document::$types[$document->type]['mime'] }}
|
||||
</dd>
|
||||
</div>
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.hash') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $document->hash }}
|
||||
</dd>
|
||||
</div>
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.size') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $document->size / 1000 }} kB
|
||||
</dd>
|
||||
</div>
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.width') }}
|
||||
</dt>
|
||||
<div class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $document->width }}px
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.height') }}
|
||||
</dt>
|
||||
<div class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $document->height }}px
|
||||
</div>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -60,7 +60,7 @@ Route::group(['middleware' => ['auth:contact','locale'], 'prefix' => 'client', '
|
||||
|
||||
Route::get('client/switch_company/{contact}', 'ClientPortal\SwitchCompanyController')->name('switch_company');
|
||||
|
||||
Route::resource('downloads', 'ClientPortal\DownloadController');
|
||||
Route::resource('downloads', 'ClientPortal\DownloadController')->only(['index', 'show']);
|
||||
|
||||
Route::get('logout', 'Auth\ContactLoginController@logout')->name('logout');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user