mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 18:04:35 -04:00
Working on client side uploads
This commit is contained in:
parent
c50fb68b21
commit
3e91a4f700
@ -28,6 +28,8 @@ class ClientFactory
|
|||||||
$client->paid_to_date = 0;
|
$client->paid_to_date = 0;
|
||||||
$client->country_id = 4;
|
$client->country_id = 4;
|
||||||
$client->is_deleted = 0;
|
$client->is_deleted = 0;
|
||||||
|
$client->client_hash = str_random(40);
|
||||||
|
|
||||||
$client->settings = new ClientSettings(ClientSettings::defaults());
|
$client->settings = new ClientSettings(ClientSettings::defaults());
|
||||||
|
|
||||||
$client_contact = ClientContactFactory::create($company_id, $user_id);
|
$client_contact = ClientContactFactory::create($company_id, $user_id);
|
||||||
|
@ -15,6 +15,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\ClientPortal\StoreDocumentRequest;
|
use App\Http\Requests\ClientPortal\StoreDocumentRequest;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class DocumentController extends Controller
|
class DocumentController extends Controller
|
||||||
{
|
{
|
||||||
@ -47,7 +48,34 @@ class DocumentController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(StoreDocumentRequest $request)
|
public function store(StoreDocumentRequest $request)
|
||||||
{
|
{
|
||||||
|
$contact = auth()->user();
|
||||||
|
|
||||||
Log::error($request->all());
|
Log::error($request->all());
|
||||||
|
|
||||||
|
Storage::makeDirectory(public_path() . $contact->client->client_hash, 0755);
|
||||||
|
|
||||||
|
$path = Storage::putFile($contact->client->client_hash, $request->file('file'));
|
||||||
|
|
||||||
|
$url = Storage::url($path);
|
||||||
|
|
||||||
|
Log::error($path);
|
||||||
|
Log::error($url);
|
||||||
|
|
||||||
|
/*
|
||||||
|
[2019-08-07 05:50:23] local.ERROR: array (
|
||||||
|
'_token' => '7KoEVRjB2Fq8XBVFRUFbhQFjKm4rY9h0AGSlpdj3',
|
||||||
|
'is_avatar' => '1',
|
||||||
|
'q' => '/client/document',
|
||||||
|
'file' =>
|
||||||
|
Illuminate\Http\UploadedFile::__set_state(array(
|
||||||
|
'test' => false,
|
||||||
|
'originalName' => 'family.jpg',
|
||||||
|
'mimeType' => 'image/jpeg',
|
||||||
|
'error' => 0,
|
||||||
|
'hashName' => NULL,
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +47,7 @@ class QueryLogging
|
|||||||
$count = count($queries);
|
$count = count($queries);
|
||||||
$timeEnd = microtime(true);
|
$timeEnd = microtime(true);
|
||||||
$time = $timeEnd - $timeStart;
|
$time = $timeEnd - $timeStart;
|
||||||
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
//Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
||||||
|
|
||||||
if($count > 16)
|
if($count > 16)
|
||||||
Log::info($queries);
|
Log::info($queries);
|
||||||
|
@ -29,5 +29,6 @@ $factory->define(App\Models\Client::class, function (Faker $faker) {
|
|||||||
'shipping_postal_code' => $faker->postcode,
|
'shipping_postal_code' => $faker->postcode,
|
||||||
'shipping_country_id' => 4,
|
'shipping_country_id' => 4,
|
||||||
'settings' => new ClientSettings(ClientSettings::defaults()),
|
'settings' => new ClientSettings(ClientSettings::defaults()),
|
||||||
|
'client_hash' => str_random(40),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
@ -262,6 +262,8 @@ class CreateUsersTable extends Migration
|
|||||||
$table->string('name')->nullable();
|
$table->string('name')->nullable();
|
||||||
$table->string('website')->nullable();
|
$table->string('website')->nullable();
|
||||||
$table->text('private_notes')->nullable();
|
$table->text('private_notes')->nullable();
|
||||||
|
$table->text('client_hash')->nullable();
|
||||||
|
|
||||||
$table->decimal('balance', 13, 2)->nullable();
|
$table->decimal('balance', 13, 2)->nullable();
|
||||||
$table->decimal('paid_to_date', 13, 2)->nullable();
|
$table->decimal('paid_to_date', 13, 2)->nullable();
|
||||||
$table->timestamp('last_login')->nullable();
|
$table->timestamp('last_login')->nullable();
|
||||||
|
@ -76,9 +76,12 @@
|
|||||||
function handleDocumentError(file, responseText) {
|
function handleDocumentError(file, responseText) {
|
||||||
dropzone.removeFile(file);
|
dropzone.removeFile(file);
|
||||||
// window.countUploadingDocuments--;
|
// window.countUploadingDocuments--;
|
||||||
|
for (var error in responseText.errors) {
|
||||||
|
|
||||||
swal(responseText);
|
swal({title: '{{ctrans('texts.error')}}', text: responseText.errors[error]});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
Loading…
x
Reference in New Issue
Block a user