mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Working on upload avatar - generic
This commit is contained in:
parent
0be7408ca7
commit
f37f28a846
97
app/Http/Controllers/ClientPortal/DocumentController.php
Normal file
97
app/Http/Controllers/ClientPortal/DocumentController.php
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\ClientPortal\StoreDocumentRequest;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class DocumentController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(StoreDocumentRequest $request)
|
||||||
|
{
|
||||||
|
Log::error($request->all());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
@ -37,7 +37,15 @@ class ProfileController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit(ClientContact $client_contact)
|
public function edit(ClientContact $client_contact)
|
||||||
{
|
{
|
||||||
return view('portal.default.profile.index');
|
$data = [
|
||||||
|
'params' => [
|
||||||
|
'is_avatar' => TRUE,
|
||||||
|
],
|
||||||
|
'url' => '/client/document',
|
||||||
|
'multi_upload' => FALSE,
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('portal.default.profile.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
43
app/Http/Requests/ClientPortal/StoreDocumentRequest.php
Normal file
43
app/Http/Requests/ClientPortal/StoreDocumentRequest.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Requests\ClientPortal;
|
||||||
|
|
||||||
|
use App\Http\Requests\Request;
|
||||||
|
|
||||||
|
class StoreDocumentRequest extends Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function authorize() : bool
|
||||||
|
{
|
||||||
|
if( request('is_avatar') )
|
||||||
|
return request('is_avatar') == true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
//$this->sanitize();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'file' => 'required|max:10000|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
63
resources/views/generic/dropzone.blade.php
Normal file
63
resources/views/generic/dropzone.blade.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
@section('header')
|
||||||
|
@parent
|
||||||
|
<link href="/vendors/css/dropzone.min.css" rel="stylesheet">
|
||||||
|
<link href="/vendors/css/dropzone-basic.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
.dropzone {
|
||||||
|
background: white;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 2px dashed rgb(0, 135, 247);
|
||||||
|
border-image: none;
|
||||||
|
max-width: 500px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@stop
|
||||||
|
<div id="dropzone">
|
||||||
|
<form class="dropzone needsclick" id="demo-upload">
|
||||||
|
<div class="dz-message needsclick">
|
||||||
|
{{ ctrans('texts.dropzone_default_message')}}<br>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@push('scripts')
|
||||||
|
<script src="/vendors/js/dropzone.min.js"></script>
|
||||||
|
<script>
|
||||||
|
Dropzone.autoDiscover = false;
|
||||||
|
window.countUploadingDocuments = 0;
|
||||||
|
|
||||||
|
window.dropzone = new Dropzone('.dropzone', {
|
||||||
|
url: '{!! $url !!}',
|
||||||
|
params: {
|
||||||
|
'_token': '{{ csrf_token() }}',
|
||||||
|
@foreach($params as $key => $value)
|
||||||
|
'{!! $key !!}' : '{!! $value !!}',
|
||||||
|
@endforeach
|
||||||
|
},
|
||||||
|
addRemoveLinks: true,
|
||||||
|
dictRemoveFileConfirmation: "{{ctrans('texts.are_you_sure')}}",
|
||||||
|
dictDefaultMessage : "{{ctrans('texts.dropzone_default_message')}}",
|
||||||
|
dictFallbackMessage : "{{ctrans('texts.dropzone_fallback_message')}}",
|
||||||
|
dictFallbackText : "{{ctrans('texts.dropzone_fallback_text')}}",
|
||||||
|
dictFileTooBig : "{{ctrans('texts.dropzone_file_too_big')}}",
|
||||||
|
dictInvalidFileType : "{{ctrans('texts.dropzone_invalid_file_type')}}",
|
||||||
|
dictResponseError : "{{ctrans('texts.dropzone_response_error')}}",
|
||||||
|
dictCancelUpload : "{{ctrans('texts.dropzone_cancel_upload')}}",
|
||||||
|
dictCancelUploadConfirmation : "{{ctrans('texts.dropzone_cancel_upload_confirmation')}}",
|
||||||
|
dictRemoveFile : "{{ctrans('texts.dropzone_remove_file')}}",
|
||||||
|
parallelUploads: 1,
|
||||||
|
maxFiles: {{ $multi_upload ? 100000 : 1 }},
|
||||||
|
clickable: true,
|
||||||
|
maxfilesexceeded: function(file) {
|
||||||
|
this.removeAllFiles();
|
||||||
|
this.addFile(file);
|
||||||
|
},
|
||||||
|
init: function(){
|
||||||
|
// this.on("addedfile", handleFileAdded);
|
||||||
|
// this.on("removedfile", handleFileRemoved);
|
||||||
|
this.on("error", function(file){if (!file.accepted) this.removeFile(file);});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
@ -147,10 +147,8 @@ $(document).ready(function() {
|
|||||||
alert('download');
|
alert('download');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function filterTable() {
|
function filterTable() {
|
||||||
|
|
||||||
table_filter = $('#table_filter').val();
|
table_filter = $('#table_filter').val();
|
||||||
@ -187,7 +185,6 @@ $('#statuses').select2({
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@ -1,22 +1,5 @@
|
|||||||
@extends('portal.default.layouts.master')
|
@extends('portal.default.layouts.master')
|
||||||
@section('header')
|
|
||||||
@parent
|
|
||||||
<link href="/vendors/css/dropzone.min.css" rel="stylesheet">
|
|
||||||
<link href="/vendors/css/dropzone-basic.min.css" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
|
|
||||||
|
|
||||||
.dropzone {
|
|
||||||
background: white;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 2px dashed rgb(0, 135, 247);
|
|
||||||
border-image: none;
|
|
||||||
max-width: 500px;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@stop
|
|
||||||
@section('body')
|
@section('body')
|
||||||
<main class="main">
|
<main class="main">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -36,13 +19,7 @@
|
|||||||
|
|
||||||
<i class="fa fa-user fa-5x"></i>
|
<i class="fa fa-user fa-5x"></i>
|
||||||
|
|
||||||
<div id="dropzone">
|
@include('generic.dropzone')
|
||||||
<form class="dropzone needsclick" id="demo-upload" action="/upload">
|
|
||||||
<div class="dz-message needsclick">
|
|
||||||
Drop files here or click to upload.<BR>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -75,20 +52,13 @@
|
|||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
@endsection
|
@endsection
|
||||||
@push('scripts')
|
|
||||||
<script src="/vendors/js/dropzone.min.js"></script>
|
|
||||||
@endpush
|
|
||||||
@section('footer')
|
|
||||||
|
|
||||||
|
@section('footer')
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ Route::group(['middleware' => ['auth:contact'], 'prefix' => 'client', 'as' => 'c
|
|||||||
Route::get('profile/{client_contact}/edit', 'ClientPortal\ProfileController@edit')->name('profile.edit');
|
Route::get('profile/{client_contact}/edit', 'ClientPortal\ProfileController@edit')->name('profile.edit');
|
||||||
Route::put('profile/{client_contact}/edit', 'ClientPortal\ProfileController@update')->name('profile.update');
|
Route::put('profile/{client_contact}/edit', 'ClientPortal\ProfileController@update')->name('profile.update');
|
||||||
|
|
||||||
|
Route::post('document', 'ClientPortal\DocumentController@store')->name('document.store');
|
||||||
|
|
||||||
Route::get('logout', 'Auth\ContactLoginController@logout')->name('logout');
|
Route::get('logout', 'Auth\ContactLoginController@logout')->name('logout');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user