mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
Create invoice form part 1.
This commit is contained in:
@@ -392,38 +392,37 @@ class SetupDevEnvironment extends Command
|
||||
'mimetype' => 'pdf',
|
||||
],
|
||||
[
|
||||
'name' => 'Project Notes',
|
||||
'name' => 'Project Notes',
|
||||
'basename' => 'Project Notes.pdf',
|
||||
'mimetype' => 'pdf',
|
||||
],
|
||||
[
|
||||
'name' => 'Personal Savings',
|
||||
'name' => 'Personal Savings',
|
||||
'basename' => 'School Report.pages',
|
||||
'mimetype' => 'pages',
|
||||
],
|
||||
[
|
||||
'name' => 'License',
|
||||
'name' => 'License',
|
||||
'basename' => 'Stories of the Night Skies.pages',
|
||||
'mimetype' => 'pages',
|
||||
],
|
||||
])
|
||||
->each(function ($file) use ($user, $documents) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file['basename'];
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $documents->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file['name'],
|
||||
'basename' => $basename,
|
||||
'type' => 'file',
|
||||
'author' => 'user',
|
||||
'mimetype' => $file['mimetype'],
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'folder_id' => $documents->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file['name'],
|
||||
'basename' => $basename,
|
||||
'type' => 'file',
|
||||
'author' => 'user',
|
||||
'mimetype' => $file['mimetype'],
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -431,33 +430,32 @@ class SetupDevEnvironment extends Command
|
||||
// Get documents to shared folder
|
||||
collect([
|
||||
[
|
||||
'name' => 'Home plan',
|
||||
'name' => 'Home plan',
|
||||
'basename' => 'Licence.pdf',
|
||||
'mimetype' => 'pdf',
|
||||
],
|
||||
[
|
||||
'name' => 'Software Licence',
|
||||
'name' => 'Software Licence',
|
||||
'basename' => 'Project Notes.pdf',
|
||||
'mimetype' => 'pdf',
|
||||
]
|
||||
],
|
||||
])
|
||||
->each(function ($file) use ($user, $shared_folder) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file['basename'];
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $shared_folder->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file['name'],
|
||||
'basename' => $basename,
|
||||
'type' => 'file',
|
||||
'author' => 'user',
|
||||
'mimetype' => $file['mimetype'],
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'folder_id' => $shared_folder->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file['name'],
|
||||
'basename' => $basename,
|
||||
'type' => 'file',
|
||||
'author' => 'user',
|
||||
'mimetype' => $file['mimetype'],
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -465,58 +463,57 @@ class SetupDevEnvironment extends Command
|
||||
// Get documents to peter's files folder
|
||||
collect([
|
||||
[
|
||||
'name' => 'Project Backup',
|
||||
'name' => 'Project Backup',
|
||||
'basename' => 'Licence.pdf',
|
||||
'mimetype' => 'pdf',
|
||||
],
|
||||
[
|
||||
'name' => 'Yearly report',
|
||||
'name' => 'Yearly report',
|
||||
'basename' => 'Project Notes.pdf',
|
||||
'mimetype' => 'pdf',
|
||||
],
|
||||
[
|
||||
'name' => 'Work Update',
|
||||
'name' => 'Work Update',
|
||||
'basename' => 'School Report.pages',
|
||||
'mimetype' => 'pages',
|
||||
],
|
||||
[
|
||||
'name' => 'Person Writing on Notebook',
|
||||
'name' => 'Person Writing on Notebook',
|
||||
'basename' => 'Stories of the Night Skies.pages',
|
||||
'mimetype' => 'pages',
|
||||
],
|
||||
[
|
||||
'name' => 'Blank Business Composition Computer',
|
||||
'name' => 'Blank Business Composition Computer',
|
||||
'basename' => 'Licence.pdf',
|
||||
'mimetype' => 'pdf',
|
||||
],
|
||||
[
|
||||
'name' => '2020 April - Export',
|
||||
'name' => '2020 April - Export',
|
||||
'basename' => 'Project Notes.pdf',
|
||||
'mimetype' => 'pdf',
|
||||
],
|
||||
[
|
||||
'name' => 'Ballpen Blur Close Up Computer',
|
||||
'name' => 'Ballpen Blur Close Up Computer',
|
||||
'basename' => 'School Report.pages',
|
||||
'mimetype' => 'pages',
|
||||
],
|
||||
])
|
||||
->each(function ($file) use ($user, $peters_files) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file['basename'];
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $peters_files->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file['name'],
|
||||
'basename' => $basename,
|
||||
'type' => 'file',
|
||||
'author' => 'visitor',
|
||||
'mimetype' => $file['mimetype'],
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'folder_id' => $peters_files->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file['name'],
|
||||
'basename' => $basename,
|
||||
'type' => 'file',
|
||||
'author' => 'visitor',
|
||||
'mimetype' => $file['mimetype'],
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -529,22 +526,21 @@ class SetupDevEnvironment extends Command
|
||||
'Sphere Bound 3D Titles.mp4',
|
||||
])
|
||||
->each(function ($file) use ($user, $videohive) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $videohive->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'video',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'mp4',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'folder_id' => $videohive->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'video',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'mp4',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -554,22 +550,21 @@ class SetupDevEnvironment extends Command
|
||||
'Apple Watch App Video Promotion.mp4',
|
||||
])
|
||||
->each(function ($file) use ($user, $video) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $video->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'video',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'mp4',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'folder_id' => $video->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'video',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'mp4',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -579,22 +574,21 @@ class SetupDevEnvironment extends Command
|
||||
'D-Block & S-te-Fan - Bla Bla.mp3',
|
||||
])
|
||||
->each(function ($file) use ($user, $audio) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/audio/$file"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/audio/$file"), $basename, 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $audio->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'audio',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'mp3',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'folder_id' => $audio->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'audio',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'mp3',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -615,24 +609,23 @@ class SetupDevEnvironment extends Command
|
||||
'You Are My Sunshine.jpg',
|
||||
])
|
||||
->each(function ($file) use ($user, $apartments) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/$file"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/thumbnail-$file"), "thumbnail-$basename", "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/$file"), $basename, 'private');
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/thumbnail-$file"), "thumbnail-$basename", 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => null,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'image',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'jpg',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'thumbnail' => "thumbnail-$basename",
|
||||
'folder_id' => null,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'image',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'jpg',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'thumbnail' => "thumbnail-$basename",
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -648,24 +641,23 @@ class SetupDevEnvironment extends Command
|
||||
'Kitchen Island.jpg',
|
||||
])
|
||||
->each(function ($file) use ($user, $apartments) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/$file"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/thumbnail-$file"), "thumbnail-$basename", "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/$file"), $basename, 'private');
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/thumbnail-$file"), "thumbnail-$basename", 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $apartments->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'image',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'jpg',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'thumbnail' => "thumbnail-$basename",
|
||||
'folder_id' => $apartments->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'image',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'jpg',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'thumbnail' => "thumbnail-$basename",
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -685,24 +677,23 @@ class SetupDevEnvironment extends Command
|
||||
'Yellow Animal Eyes Fur.jpg',
|
||||
])
|
||||
->each(function ($file) use ($user, $nature) {
|
||||
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/$file"), $basename, "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/thumbnail-$file"), "thumbnail-$basename", "private");
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/$file"), $basename, 'private');
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/thumbnail-$file"), "thumbnail-$basename", 'private');
|
||||
|
||||
// Create file record
|
||||
File::create([
|
||||
'folder_id' => $nature->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'image',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'jpg',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'thumbnail' => "thumbnail-$basename",
|
||||
'folder_id' => $nature->id,
|
||||
'user_id' => $user->id,
|
||||
'name' => $file,
|
||||
'basename' => $basename,
|
||||
'type' => 'image',
|
||||
'author' => 'user',
|
||||
'mimetype' => 'jpg',
|
||||
'filesize' => rand(1000000, 4000000),
|
||||
'thumbnail' => "thumbnail-$basename",
|
||||
'created_at' => now()->subMinutes(rand(1, 5)),
|
||||
]);
|
||||
});
|
||||
@@ -720,13 +711,13 @@ class SetupDevEnvironment extends Command
|
||||
|
||||
$images->each(function ($id) use ($user) {
|
||||
Share::create([
|
||||
'user_id' => $user->id,
|
||||
'item_id' => $id,
|
||||
'type' => 'file',
|
||||
'user_id' => $user->id,
|
||||
'item_id' => $id,
|
||||
'type' => 'file',
|
||||
'is_protected' => false,
|
||||
'permission' => 'editor',
|
||||
'password' => null,
|
||||
'expire_in' => null,
|
||||
'permission' => 'editor',
|
||||
'password' => null,
|
||||
'expire_in' => null,
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -737,13 +728,13 @@ class SetupDevEnvironment extends Command
|
||||
|
||||
$files->each(function ($id) use ($user) {
|
||||
Share::create([
|
||||
'user_id' => $user->id,
|
||||
'item_id' => $id,
|
||||
'type' => 'file',
|
||||
'user_id' => $user->id,
|
||||
'item_id' => $id,
|
||||
'type' => 'file',
|
||||
'is_protected' => false,
|
||||
'permission' => 'editor',
|
||||
'password' => null,
|
||||
'expire_in' => null,
|
||||
'permission' => 'editor',
|
||||
'password' => null,
|
||||
'expire_in' => null,
|
||||
]);
|
||||
});
|
||||
}
|
||||
@@ -756,116 +747,116 @@ class SetupDevEnvironment extends Command
|
||||
// Get options
|
||||
collect([
|
||||
[
|
||||
'name' => 'setup_wizard_database',
|
||||
'name' => 'setup_wizard_database',
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'app_title',
|
||||
'name' => 'app_title',
|
||||
'value' => 'VueFileManager',
|
||||
],
|
||||
[
|
||||
'name' => 'app_description',
|
||||
'name' => 'app_description',
|
||||
'value' => 'Your self-hosted storage cloud software powered by Laravel and Vue',
|
||||
],
|
||||
[
|
||||
'name' => 'app_logo',
|
||||
'name' => 'app_logo',
|
||||
'value' => 'system/logo.svg',
|
||||
],
|
||||
[
|
||||
'name' => 'app_logo_horizontal',
|
||||
'name' => 'app_logo_horizontal',
|
||||
'value' => 'system/logo-horizontal.svg',
|
||||
],
|
||||
[
|
||||
'name' => 'app_favicon',
|
||||
'name' => 'app_favicon',
|
||||
'value' => 'system/favicon.png',
|
||||
],
|
||||
[
|
||||
'name' => 'app_og_image',
|
||||
'name' => 'app_og_image',
|
||||
'value' => 'system/og-image.jpg',
|
||||
],
|
||||
[
|
||||
'name' => 'app_touch_icon',
|
||||
'name' => 'app_touch_icon',
|
||||
'value' => 'system/touch-icon.png',
|
||||
],
|
||||
[
|
||||
'name' => 'google_analytics',
|
||||
'name' => 'google_analytics',
|
||||
'value' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'contact_email',
|
||||
'name' => 'contact_email',
|
||||
'value' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'registration',
|
||||
'name' => 'registration',
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'payments_active',
|
||||
'name' => 'payments_active',
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'storage_limitation',
|
||||
'name' => 'storage_limitation',
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'storage_default',
|
||||
'name' => 'storage_default',
|
||||
'value' => 5,
|
||||
],
|
||||
[
|
||||
'name' => 'setup_wizard_success',
|
||||
'name' => 'setup_wizard_success',
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'license',
|
||||
'name' => 'license',
|
||||
'value' => $this->license,
|
||||
],
|
||||
[
|
||||
'name' => 'purchase_code',
|
||||
'name' => 'purchase_code',
|
||||
'value' => '26b889eb-3602-4bf2-beb3-3sc378fcf484',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_address',
|
||||
'name' => 'billing_address',
|
||||
'value' => 'Palo Alto 20',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_city',
|
||||
'name' => 'billing_city',
|
||||
'value' => 'Palo Alto',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_country',
|
||||
'name' => 'billing_country',
|
||||
'value' => 'US',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_name',
|
||||
'name' => 'billing_name',
|
||||
'value' => 'VueFileManager Inc.',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_phone_number',
|
||||
'name' => 'billing_phone_number',
|
||||
'value' => '312343141243214',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_postal_code',
|
||||
'name' => 'billing_postal_code',
|
||||
'value' => '43213',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_state',
|
||||
'name' => 'billing_state',
|
||||
'value' => 'California',
|
||||
],
|
||||
[
|
||||
'name' => 'billing_vat_number',
|
||||
'name' => 'billing_vat_number',
|
||||
'value' => '41241241234',
|
||||
]
|
||||
],
|
||||
])->each(function ($col) {
|
||||
Setting::forceCreate([
|
||||
'name' => $col['name'],
|
||||
'value' => $col['value']
|
||||
'name' => $col['name'],
|
||||
'value' => $col['value'],
|
||||
]);
|
||||
});
|
||||
|
||||
// Get system images
|
||||
collect(['logo.svg', 'logo-horizontal.svg', 'favicon.png', 'og-image.jpg', 'touch-icon.png'])
|
||||
->each(function ($file) {
|
||||
Storage::putFileAs("system", storage_path("demo/app/$file"), $file, "private");
|
||||
Storage::putFileAs('system', storage_path("demo/app/$file"), $file, 'private');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -876,12 +867,12 @@ class SetupDevEnvironment extends Command
|
||||
{
|
||||
// Migrate database
|
||||
$this->call('migrate:fresh', [
|
||||
'--force' => true
|
||||
'--force' => true,
|
||||
]);
|
||||
|
||||
// Generate app key
|
||||
$this->call('key:generate', [
|
||||
'--force' => true
|
||||
'--force' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -894,4 +885,4 @@ class SetupDevEnvironment extends Command
|
||||
$this->call('config:clear');
|
||||
$this->call('view:clear');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Oasis\Client;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\Factories\Sequence;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Factories\Sequence;
|
||||
|
||||
class SetupOasisEnvironment extends Command
|
||||
{
|
||||
@@ -65,28 +64,28 @@ class SetupOasisEnvironment extends Command
|
||||
$hash = Str::random(12);
|
||||
|
||||
// Get invoice logo and stamp
|
||||
Storage::putFileAs("system", storage_path("demo/app/logo-horizontal.svg"), "{$hash}-logo-horizontal.svg", "private");
|
||||
Storage::putFileAs("system", storage_path("demo/oasis/stamp.png"), "{$hash}-stamp.png", "private");
|
||||
Storage::putFileAs('system', storage_path('demo/app/logo-horizontal.svg'), "{$hash}-logo-horizontal.svg", 'private');
|
||||
Storage::putFileAs('system', storage_path('demo/oasis/stamp.png'), "{$hash}-stamp.png", 'private');
|
||||
|
||||
$profile = $user->invoiceProfile()->create([
|
||||
'company' => 'VueFileManager Inc.',
|
||||
'company' => 'VueFileManager Inc.',
|
||||
'registration_notes' => 'Registrácia na OR SR Bratislava I. oddiel: Sro vl. č. 91906',
|
||||
'logo' => "system/{$hash}-logo-horizontal.svg",
|
||||
'ico' => '46530045',
|
||||
'dic' => '2023489457',
|
||||
'ic_dph' => 'SK2023489457',
|
||||
'address' => 'Does 11',
|
||||
'state' => 'Slovakia',
|
||||
'city' => 'Bratislava',
|
||||
'postal_code' => '04001',
|
||||
'country' => 'SK',
|
||||
'bank' => 'Fio Banka',
|
||||
'iban' => 'SK20000054236423624',
|
||||
'swift' => 'FIOZXXX',
|
||||
'phone' => '+421950123456',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
'author' => 'John Doe',
|
||||
'stamp' => "system/{$hash}-stamp.png",
|
||||
'logo' => "system/{$hash}-logo-horizontal.svg",
|
||||
'ico' => '46530045',
|
||||
'dic' => '2023489457',
|
||||
'ic_dph' => 'SK2023489457',
|
||||
'address' => 'Does 11',
|
||||
'state' => 'Slovakia',
|
||||
'city' => 'Bratislava',
|
||||
'postal_code' => '04001',
|
||||
'country' => 'SK',
|
||||
'bank' => 'Fio Banka',
|
||||
'iban' => 'SK20000054236423624',
|
||||
'swift' => 'FIOZXXX',
|
||||
'phone' => '+421950123456',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
'author' => 'John Doe',
|
||||
'stamp' => "system/{$hash}-stamp.png",
|
||||
]);
|
||||
|
||||
$clients = Client::factory(Client::class)
|
||||
@@ -103,10 +102,10 @@ class SetupOasisEnvironment extends Command
|
||||
['client_id' => $clients[5]->id],
|
||||
))->count(2)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'discount_type' => null,
|
||||
'user' => $profile->toArray(),
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$advance_invoices = Invoice::factory(Invoice::class)
|
||||
@@ -119,22 +118,21 @@ class SetupOasisEnvironment extends Command
|
||||
['client_id' => $clients[4]->id],
|
||||
['client_id' => $clients[5]->id],
|
||||
))->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'advance-invoice',
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'advance-invoice',
|
||||
'discount_type' => null,
|
||||
'user' => $profile->toArray(),
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
// Generate PDF
|
||||
collect([$regular_invoices, $advance_invoices])
|
||||
->collapse()
|
||||
->each(function ($invoice) use ($user) {
|
||||
|
||||
$this->info("Generating invoice id: $invoice->id");
|
||||
|
||||
\PDF::loadView('oasis.invoices.invoice', [
|
||||
'invoice' => Invoice::find($invoice->id),
|
||||
'user' => $user,
|
||||
'user' => $user,
|
||||
])
|
||||
->setPaper('a4')
|
||||
->setOrientation('portrait')
|
||||
@@ -147,9 +145,9 @@ class SetupOasisEnvironment extends Command
|
||||
public function set_oasis_data()
|
||||
{
|
||||
Setting::updateOrCreate([
|
||||
'name' => 'app_color'
|
||||
'name' => 'app_color',
|
||||
], [
|
||||
'value' => '#ae5fec'
|
||||
'value' => '#ae5fec',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\CreateUserByAdmin;
|
||||
use App\Http\Requests\Oasis\CreateOrderRequest;
|
||||
use App\Http\Resources\UserResource;
|
||||
use App\Models\User;
|
||||
use App\Models\UserSettings;
|
||||
use App\Notifications\Oasis\PaymentRequiredNotification;
|
||||
use App\Services\Oasis\CzechRegisterSearchService;
|
||||
use App\Services\StripeService;
|
||||
use Hash;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Notification;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\UserSettings;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Str;
|
||||
use Notification;
|
||||
use App\Services\StripeService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\UserResource;
|
||||
use App\Http\Requests\Admin\CreateUserByAdmin;
|
||||
use App\Http\Requests\Oasis\CreateOrderRequest;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Services\Oasis\CzechRegisterSearchService;
|
||||
use App\Notifications\Oasis\PaymentRequiredNotification;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
@@ -51,7 +50,7 @@ class AdminController extends Controller
|
||||
{
|
||||
// Create user
|
||||
$newbie = User::create([
|
||||
'email' => $request->email,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make(Str::random()),
|
||||
]);
|
||||
|
||||
@@ -62,15 +61,15 @@ class AdminController extends Controller
|
||||
->settings()
|
||||
->create([
|
||||
'storage_capacity' => 0,
|
||||
'ico' => $request->ico ?? null,
|
||||
'name' => $request->name,
|
||||
'address' => $request->address,
|
||||
'state' => $request->state,
|
||||
'city' => $request->city,
|
||||
'postal_code' => $request->postal_code,
|
||||
'country' => $request->country,
|
||||
'phone_number' => $request->phone_number ?? null,
|
||||
'timezone' => '1.0',
|
||||
'ico' => $request->ico ?? null,
|
||||
'name' => $request->name,
|
||||
'address' => $request->address,
|
||||
'state' => $request->state,
|
||||
'city' => $request->city,
|
||||
'postal_code' => $request->postal_code,
|
||||
'country' => $request->country,
|
||||
'phone_number' => $request->phone_number ?? null,
|
||||
'timezone' => '1.0',
|
||||
]);
|
||||
|
||||
// Store subscription request
|
||||
@@ -90,7 +89,8 @@ class AdminController extends Controller
|
||||
));
|
||||
|
||||
return response(
|
||||
new UserResource($newbie), 201
|
||||
new UserResource($newbie),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ class AdminController extends Controller
|
||||
{
|
||||
// Create user
|
||||
$user = User::forceCreate([
|
||||
'role' => $request->role,
|
||||
'email' => $request->email,
|
||||
'role' => $request->role,
|
||||
'email' => $request->email,
|
||||
'password' => \Illuminate\Support\Facades\Hash::make($request->password),
|
||||
]);
|
||||
|
||||
@@ -114,9 +114,9 @@ class AdminController extends Controller
|
||||
$user
|
||||
->settings()
|
||||
->create([
|
||||
'name' => $request->name,
|
||||
'avatar' => store_avatar($request, 'avatar'),
|
||||
'storage_capacity' => $request->storage_capacity,
|
||||
'name' => $request->name,
|
||||
'avatar' => store_avatar($request, 'avatar'),
|
||||
'storage_capacity' => $request->storage_capacity,
|
||||
'payment_activation' => 1,
|
||||
]);
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use App\Http\Requests\Oasis\StoreClientRequest;
|
||||
use App\Http\Resources\Oasis\OasisInvoiceCollection;
|
||||
use App\Http\Resources\Oasis\OasisViewClientCollection;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\Oasis\OasisViewClientResource;
|
||||
use App\Http\Resources\Oasis\OasisViewInvoiceCollection;
|
||||
use App\Models\Oasis\Client;
|
||||
use Auth;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Models\Oasis\Client;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Oasis\StoreClientRequest;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Http\Resources\Oasis\OasisInvoiceCollection;
|
||||
use App\Http\Resources\Oasis\OasisViewClientResource;
|
||||
use App\Http\Resources\Oasis\OasisViewClientCollection;
|
||||
|
||||
class ClientController extends Controller
|
||||
{
|
||||
@@ -23,7 +21,8 @@ class ClientController extends Controller
|
||||
public function index()
|
||||
{
|
||||
return response(
|
||||
new OasisViewClientCollection(Auth::user()->clients), 200
|
||||
new OasisViewClientCollection(Auth::user()->clients),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,21 +35,22 @@ class ClientController extends Controller
|
||||
$client = $request->user()
|
||||
->clients()
|
||||
->create([
|
||||
'avatar' => store_avatar($request, 'avatar') ?? null,
|
||||
'name' => $request->name,
|
||||
'email' => $request->email ?? null,
|
||||
'avatar' => store_avatar($request, 'avatar') ?? null,
|
||||
'name' => $request->name,
|
||||
'email' => $request->email ?? null,
|
||||
'phone_number' => $request->phone_number ?? null,
|
||||
'address' => $request->address,
|
||||
'city' => $request->city,
|
||||
'postal_code' => $request->postal_code,
|
||||
'country' => $request->country,
|
||||
'ico' => $request->ico ?? null,
|
||||
'dic' => $request->dic ?? null,
|
||||
'ic_dph' => $request->ic_dph ?? null,
|
||||
'address' => $request->address,
|
||||
'city' => $request->city,
|
||||
'postal_code' => $request->postal_code,
|
||||
'country' => $request->country,
|
||||
'ico' => $request->ico ?? null,
|
||||
'dic' => $request->dic ?? null,
|
||||
'ic_dph' => $request->ic_dph ?? null,
|
||||
]);
|
||||
|
||||
return response(
|
||||
new OasisViewClientResource($client), 201
|
||||
new OasisViewClientResource($client),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,10 +72,9 @@ class ClientController extends Controller
|
||||
{
|
||||
// Store image if exist
|
||||
if ($request->hasFile($request->name)) {
|
||||
|
||||
// Find and update image path
|
||||
$client->update([
|
||||
$request->name => store_avatar($request, $request->name)
|
||||
$request->name => store_avatar($request, $request->name),
|
||||
]);
|
||||
|
||||
return response('Done', 204);
|
||||
@@ -120,7 +119,8 @@ class ClientController extends Controller
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisViewClientCollection($results), 200
|
||||
new OasisViewClientCollection($results),
|
||||
200
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Oasis\StoreInvoiceRequest;
|
||||
use App\Http\Resources\Oasis\OasisViewInvoiceCollection;
|
||||
use App\Http\Resources\Oasis\OasisViewInvoiceResource;
|
||||
use Auth;
|
||||
use Storage;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Oasis\Client;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use App\Notifications\Oasis\InvoiceDeliveryNotification;
|
||||
use App\Notifications\SharedSendViaEmail;
|
||||
use Auth;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use App\Http\Requests\Oasis\StoreInvoiceRequest;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Str;
|
||||
use Storage;
|
||||
use App\Http\Resources\Oasis\OasisViewInvoiceResource;
|
||||
use App\Http\Resources\Oasis\OasisViewInvoiceCollection;
|
||||
use App\Notifications\Oasis\InvoiceDeliveryNotification;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
{
|
||||
@@ -26,7 +25,8 @@ class InvoiceController extends Controller
|
||||
public function get_all_regular_invoices()
|
||||
{
|
||||
return response(
|
||||
new OasisViewInvoiceCollection(Auth::user()->regularInvoices), 200
|
||||
new OasisViewInvoiceCollection(Auth::user()->regularInvoices),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ class InvoiceController extends Controller
|
||||
public function get_all_advance_invoices()
|
||||
{
|
||||
return response(
|
||||
new OasisViewInvoiceCollection(Auth::user()->advanceInvoices), 200
|
||||
new OasisViewInvoiceCollection(Auth::user()->advanceInvoices),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,7 +47,7 @@ class InvoiceController extends Controller
|
||||
*/
|
||||
public function get_invoice(Invoice $invoice)
|
||||
{
|
||||
if (!Storage::exists(invoice_path($invoice))) {
|
||||
if (! Storage::exists(invoice_path($invoice))) {
|
||||
abort(404, 'Not Found');
|
||||
}
|
||||
|
||||
@@ -66,7 +67,8 @@ class InvoiceController extends Controller
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisViewInvoiceCollection($results), 200
|
||||
new OasisViewInvoiceCollection($results),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,33 +84,33 @@ class InvoiceController extends Controller
|
||||
$user = $request->user();
|
||||
|
||||
$invoice = Invoice::create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id ?? null,
|
||||
'invoice_type' => $request->invoice_type,
|
||||
'invoice_number' => $request->invoice_number,
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id ?? null,
|
||||
'invoice_type' => $request->invoice_type,
|
||||
'invoice_number' => $request->invoice_number,
|
||||
'variable_number' => $request->variable_number,
|
||||
'delivery_at' => $request->delivery_at,
|
||||
'discount_type' => $request->discount_type ?? null,
|
||||
'discount_rate' => $request->discount_rate ?? null,
|
||||
'items' => $request->items,
|
||||
'user' => $user->invoiceProfile,
|
||||
'client' => [
|
||||
'email' => $client->email ?? $request->client_email,
|
||||
'name' => $client->name ?? $request->client_name,
|
||||
'address' => $client->address ?? $request->client_address,
|
||||
'city' => $client->city ?? $request->client_city,
|
||||
'delivery_at' => $request->delivery_at,
|
||||
'discount_type' => $request->discount_type ?? null,
|
||||
'discount_rate' => $request->discount_rate ?? null,
|
||||
'items' => json_decode($request->items),
|
||||
'user' => $user->invoiceProfile,
|
||||
'client' => [
|
||||
'email' => $client->email ?? $request->client_email,
|
||||
'name' => $client->name ?? $request->client_name,
|
||||
'address' => $client->address ?? $request->client_address,
|
||||
'city' => $client->city ?? $request->client_city,
|
||||
'postal_code' => $client->postal_code ?? $request->client_postal_code,
|
||||
'country' => $client->country ?? $request->client_country,
|
||||
'ico' => $client->ico ?? $request->client_ico,
|
||||
'dic' => $client->dic ?? $request->client_dic ?? null,
|
||||
'ic_dph' => $client->ic_dph ?? $request->client_ic_dph ?? null,
|
||||
'country' => $client->country ?? $request->client_country,
|
||||
'ico' => $client->ico ?? $request->client_ico,
|
||||
'dic' => $client->dic ?? $request->client_dic ?? null,
|
||||
'ic_dph' => $client->ic_dph ?? $request->client_ic_dph ?? null,
|
||||
],
|
||||
]);
|
||||
|
||||
// Generate PDF
|
||||
\PDF::loadView('oasis.invoices.invoice', [
|
||||
'invoice' => Invoice::find($invoice->id),
|
||||
'user' => $user,
|
||||
'user' => $user,
|
||||
])
|
||||
->setPaper('a4')
|
||||
->setOrientation('portrait')
|
||||
@@ -123,7 +125,8 @@ class InvoiceController extends Controller
|
||||
}
|
||||
|
||||
return response(
|
||||
new OasisViewInvoiceResource($invoice), 201
|
||||
new OasisViewInvoiceResource($invoice),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
@@ -138,28 +141,53 @@ class InvoiceController extends Controller
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function editor()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return [
|
||||
'clients' => $user->clients->map(function ($client) {
|
||||
return [
|
||||
'label' => $client->name,
|
||||
'value' => $client->id,
|
||||
];
|
||||
}),
|
||||
'isVatPayer' => $user->invoiceProfile->ic_dph
|
||||
? true
|
||||
: false,
|
||||
'latestInvoiceNumber' => $user->regularInvoices->last()
|
||||
? (int) $user->regularInvoices->last()->invoice_number
|
||||
: null,
|
||||
'recommendedInvoiceNumber' => $user->regularInvoices->last()
|
||||
? (int) $user->regularInvoices->last()->invoice_number + 1
|
||||
: Carbon::now()->format('Y') . '0001',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param StoreInvoiceRequest $request
|
||||
* @return mixed
|
||||
*/
|
||||
private function getOrStoreClient(StoreInvoiceRequest $request)
|
||||
{
|
||||
if (!Str::isUuid($request->client) && $request->store_client) {
|
||||
|
||||
if (! Str::isUuid($request->client) && $request->store_client) {
|
||||
return $request->user()
|
||||
->clients()
|
||||
->create([
|
||||
'avatar' => store_avatar($request, 'client_avatar') ?? null,
|
||||
'name' => $request->client_name,
|
||||
'email' => $request->client_email ?? null,
|
||||
'avatar' => store_avatar($request, 'client_avatar') ?? null,
|
||||
'name' => $request->client_name,
|
||||
'email' => $request->client_email ?? null,
|
||||
'phone_number' => $request->client_phone_number ?? null,
|
||||
'address' => $request->client_address,
|
||||
'city' => $request->client_city,
|
||||
'postal_code' => $request->client_postal_code,
|
||||
'country' => $request->client_country,
|
||||
'ico' => $request->client_ico ?? null,
|
||||
'dic' => $request->client_dic ?? null,
|
||||
'ic_dph' => $request->client_ic_dph ?? null,
|
||||
'address' => $request->client_address,
|
||||
'city' => $request->client_city,
|
||||
'postal_code' => $request->client_postal_code,
|
||||
'country' => $request->client_country,
|
||||
'ico' => $request->client_ico ?? null,
|
||||
'dic' => $request->client_dic ?? null,
|
||||
'ic_dph' => $request->client_ic_dph ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\Oasis\InvoiceProfileResource;
|
||||
use App\Models\Oasis\InvoiceProfile;
|
||||
use App\Models\Setting;
|
||||
use Auth;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Oasis\InvoiceProfile;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Http\Resources\Oasis\InvoiceProfileResource;
|
||||
|
||||
class InvoiceProfileController extends Controller
|
||||
{
|
||||
@@ -20,9 +18,11 @@ class InvoiceProfileController extends Controller
|
||||
public function show()
|
||||
{
|
||||
return response(
|
||||
new InvoiceProfileResource(Auth::user()->invoiceProfile), 200
|
||||
new InvoiceProfileResource(Auth::user()->invoiceProfile),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return Application|ResponseFactory|Response
|
||||
@@ -30,29 +30,30 @@ class InvoiceProfileController extends Controller
|
||||
public function store(Request $request)
|
||||
{
|
||||
$profile = InvoiceProfile::create([
|
||||
'user_id' => $request->user()->id,
|
||||
'logo' => store_system_image($request, 'logo') ?? null,
|
||||
'stamp' => store_system_image($request, 'stamp') ?? null,
|
||||
'company' => $request->company,
|
||||
'email' => $request->email,
|
||||
'ico' => $request->ico,
|
||||
'dic' => $request->dic,
|
||||
'ic_dph' => $request->ic_dph,
|
||||
'user_id' => $request->user()->id,
|
||||
'logo' => store_system_image($request, 'logo') ?? null,
|
||||
'stamp' => store_system_image($request, 'stamp') ?? null,
|
||||
'company' => $request->company,
|
||||
'email' => $request->email,
|
||||
'ico' => $request->ico,
|
||||
'dic' => $request->dic,
|
||||
'ic_dph' => $request->ic_dph,
|
||||
'registration_notes' => $request->registration_notes,
|
||||
'author' => $request->author,
|
||||
'address' => $request->address,
|
||||
'state' => $request->state,
|
||||
'city' => $request->city,
|
||||
'postal_code' => $request->postal_code,
|
||||
'country' => $request->country,
|
||||
'phone' => $request->phone,
|
||||
'bank' => $request->bank,
|
||||
'iban' => $request->iban,
|
||||
'swift' => $request->swift,
|
||||
'author' => $request->author,
|
||||
'address' => $request->address,
|
||||
'state' => $request->state,
|
||||
'city' => $request->city,
|
||||
'postal_code' => $request->postal_code,
|
||||
'country' => $request->country,
|
||||
'phone' => $request->phone,
|
||||
'bank' => $request->bank,
|
||||
'iban' => $request->iban,
|
||||
'swift' => $request->swift,
|
||||
]);
|
||||
|
||||
return response(
|
||||
new InvoiceProfileResource($profile), 201
|
||||
new InvoiceProfileResource($profile),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,12 +65,11 @@ class InvoiceProfileController extends Controller
|
||||
{
|
||||
// Store image if exist
|
||||
if ($request->hasFile($request->name)) {
|
||||
|
||||
// Find and update image path
|
||||
$request->user()
|
||||
->invoiceProfile()
|
||||
->update([
|
||||
$request->name => store_system_image($request, $request->name)
|
||||
$request->name => store_system_image($request, $request->name),
|
||||
]);
|
||||
|
||||
return response('Done', 204);
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\User\UpdateUserPasswordRequest;
|
||||
use App\Http\Resources\Oasis\SubscriptionRequestResource;
|
||||
use App\Http\Resources\PlanResource;
|
||||
use App\Models\Oasis\SubscriptionRequest;
|
||||
use App\Services\StripeService;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Services\StripeService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Models\Oasis\SubscriptionRequest;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Http\Requests\User\UpdateUserPasswordRequest;
|
||||
use App\Http\Resources\Oasis\SubscriptionRequestResource;
|
||||
|
||||
class SubscriptionController extends Controller
|
||||
{
|
||||
@@ -32,7 +29,8 @@ class SubscriptionController extends Controller
|
||||
public function get_subscription_request(SubscriptionRequest $order)
|
||||
{
|
||||
return response(
|
||||
new SubscriptionRequestResource($order), 200
|
||||
new SubscriptionRequestResource($order),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,7 +60,6 @@ class SubscriptionController extends Controller
|
||||
{
|
||||
// Make subscription from subscription request
|
||||
if ($order->exists) {
|
||||
|
||||
// Create subscription
|
||||
$order->user
|
||||
->newSubscription('main', $order->requested_plan)
|
||||
@@ -77,7 +74,7 @@ class SubscriptionController extends Controller
|
||||
}
|
||||
|
||||
// Make subscription after user sign up and pay for the plan
|
||||
if (!$order->exists) {
|
||||
if (! $order->exists) {
|
||||
$user = Auth::user();
|
||||
|
||||
// Set user billing
|
||||
@@ -99,7 +96,7 @@ class SubscriptionController extends Controller
|
||||
$user
|
||||
->settings()
|
||||
->update([
|
||||
'storage_capacity' => $plan['product']['metadata']['capacity'],
|
||||
'storage_capacity' => $plan['product']['metadata']['capacity'],
|
||||
'payment_activation' => 1,
|
||||
]);
|
||||
|
||||
@@ -126,7 +123,7 @@ class SubscriptionController extends Controller
|
||||
|
||||
// Update status
|
||||
$order->update([
|
||||
'status' => 'logged'
|
||||
'status' => 'logged',
|
||||
]);
|
||||
|
||||
// Log in user
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
@@ -24,16 +23,16 @@ class CreateOrderRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'ico' => 'sometimes|nullable',
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:users',
|
||||
'ico' => 'sometimes|nullable',
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:users',
|
||||
'phone_number' => 'string|nullable',
|
||||
'address' => 'required|string',
|
||||
'state' => 'required|string',
|
||||
'city' => 'required|string',
|
||||
'postal_code' => 'required|string',
|
||||
'country' => 'required|string',
|
||||
'plan' => 'required|string',
|
||||
'address' => 'required|string',
|
||||
'state' => 'required|string',
|
||||
'city' => 'required|string',
|
||||
'postal_code' => 'required|string',
|
||||
'country' => 'required|string',
|
||||
'plan' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
@@ -24,17 +23,17 @@ class StoreClientRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'avatar' => 'sometimes|nullable',
|
||||
'name' => 'required|string',
|
||||
'email' => 'sometimes|email|nullable',
|
||||
'avatar' => 'sometimes|nullable',
|
||||
'name' => 'required|string',
|
||||
'email' => 'sometimes|email|nullable',
|
||||
'phone_number' => 'sometimes|string|nullable',
|
||||
'address' => 'required|string',
|
||||
'city' => 'required|string',
|
||||
'postal_code' => 'required|string',
|
||||
'country' => 'required|string',
|
||||
'ico' => 'required|string',
|
||||
'dic' => 'required|string|nullable',
|
||||
'ic_dph' => 'sometimes|string|nullable',
|
||||
'address' => 'required|string',
|
||||
'city' => 'required|string',
|
||||
'postal_code' => 'required|string',
|
||||
'country' => 'required|string',
|
||||
'ico' => 'required|string',
|
||||
'dic' => 'required|string|nullable',
|
||||
'ic_dph' => 'sometimes|string|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
@@ -24,24 +23,24 @@ class StoreInvoiceProfileRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'logo' => 'sometimes|file',
|
||||
'stamp' => 'sometimes|file',
|
||||
'company' => 'required|string',
|
||||
'email' => 'required|email',
|
||||
'ico' => 'sometimes|string|nullable',
|
||||
'dic' => 'sometimes|string|nullable',
|
||||
'ic_dph' => 'sometimes|string|nullable',
|
||||
'logo' => 'sometimes|file',
|
||||
'stamp' => 'sometimes|file',
|
||||
'company' => 'required|string',
|
||||
'email' => 'required|email',
|
||||
'ico' => 'sometimes|string|nullable',
|
||||
'dic' => 'sometimes|string|nullable',
|
||||
'ic_dph' => 'sometimes|string|nullable',
|
||||
'registration_notes' => 'sometimes|string|nullable',
|
||||
'author' => 'required|string',
|
||||
'address' => 'required|string',
|
||||
'state' => 'required|string',
|
||||
'city' => 'required|string',
|
||||
'postal_code' => 'required|string',
|
||||
'country' => 'required|string',
|
||||
'phone' => 'required|string',
|
||||
'bank' => 'required|string',
|
||||
'iban' => 'required|string',
|
||||
'swift' => 'required|string',
|
||||
'author' => 'required|string',
|
||||
'address' => 'required|string',
|
||||
'state' => 'required|string',
|
||||
'city' => 'required|string',
|
||||
'postal_code' => 'required|string',
|
||||
'country' => 'required|string',
|
||||
'phone' => 'required|string',
|
||||
'bank' => 'required|string',
|
||||
'iban' => 'required|string',
|
||||
'swift' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
@@ -24,14 +23,14 @@ class StoreInvoiceRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'invoice_type' => 'required|string',
|
||||
'invoice_number' => 'required|string',
|
||||
'invoice_type' => 'required|string',
|
||||
'invoice_number' => 'required|string',
|
||||
'variable_number' => 'required|string',
|
||||
'client' => 'required',
|
||||
'items' => 'required|array',
|
||||
'discount_type' => 'sometimes|string',
|
||||
'discount_rate' => 'sometimes|integer',
|
||||
'delivery_at' => 'required|date',
|
||||
'client' => 'required',
|
||||
'items' => 'required|string',
|
||||
'discount_type' => 'nullable|string',
|
||||
'discount_rate' => 'nullable|integer',
|
||||
'delivery_at' => 'required|date',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
@@ -16,27 +15,27 @@ class InvoiceProfileResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'invoice-profile',
|
||||
'id' => $this->id,
|
||||
'type' => 'invoice-profile',
|
||||
'attributes' => [
|
||||
'logo' => $this->logo,
|
||||
'stamp' => $this->stamp,
|
||||
'company' => $this->company,
|
||||
'email' => $this->email,
|
||||
'ico' => $this->ico,
|
||||
'dic' => $this->dic,
|
||||
'ic_dph' => $this->ic_dph,
|
||||
'logo' => $this->logo,
|
||||
'stamp' => $this->stamp,
|
||||
'company' => $this->company,
|
||||
'email' => $this->email,
|
||||
'ico' => $this->ico,
|
||||
'dic' => $this->dic,
|
||||
'ic_dph' => $this->ic_dph,
|
||||
'registration_notes' => $this->registration_notes,
|
||||
'author' => $this->author,
|
||||
'address' => $this->address,
|
||||
'state' => $this->state,
|
||||
'city' => $this->city,
|
||||
'postal_code' => $this->postal_code,
|
||||
'country' => $this->country,
|
||||
'phone' => $this->phone,
|
||||
'bank' => $this->bank,
|
||||
'iban' => $this->iban,
|
||||
'swift' => $this->swift,
|
||||
'author' => $this->author,
|
||||
'address' => $this->address,
|
||||
'state' => $this->state,
|
||||
'city' => $this->city,
|
||||
'postal_code' => $this->postal_code,
|
||||
'country' => $this->country,
|
||||
'phone' => $this->phone,
|
||||
'bank' => $this->bank,
|
||||
'iban' => $this->iban,
|
||||
'swift' => $this->swift,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class OasisInvoiceResource extends JsonResource
|
||||
{
|
||||
@@ -18,17 +15,17 @@ class OasisInvoiceResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'invoice',
|
||||
'id' => $this->id,
|
||||
'type' => 'invoice',
|
||||
'attributes' => [
|
||||
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
|
||||
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
|
||||
'invoiceNumber' => $this->invoice_number,
|
||||
'total' => format_to_currency($this->total_net, $this->currency),
|
||||
'file_url' => "/oasis/invoice/$this->id",
|
||||
'mimetype' => 'pdf',
|
||||
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
'total' => format_to_currency($this->total_net, $this->currency),
|
||||
'file_url' => "/oasis/invoice/$this->id",
|
||||
'mimetype' => 'pdf',
|
||||
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
@@ -23,24 +22,24 @@ class OasisViewClientResource extends JsonResource
|
||||
->count();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => 'client',
|
||||
'id' => $this->id,
|
||||
'type' => 'client',
|
||||
'created_at' => format_date($this->created_at, '%d. %B %Y'),
|
||||
|
||||
'totalNet' => format_to_currency($total_net, 'CZK'),
|
||||
'totalNet' => format_to_currency($total_net, 'CZK'),
|
||||
'totalInvoices' => $total_invoices,
|
||||
|
||||
'avatar' => $this->avatar,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'avatar' => $this->avatar,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'phone_number' => $this->phone_number,
|
||||
'address' => $this->address,
|
||||
'city' => $this->city,
|
||||
'postal_code' => $this->postal_code,
|
||||
'country' => $this->country,
|
||||
'ico' => $this->ico,
|
||||
'dic' => $this->dic,
|
||||
'ic_dph' => $this->ic_dph,
|
||||
'address' => $this->address,
|
||||
'city' => $this->city,
|
||||
'postal_code' => $this->postal_code,
|
||||
'country' => $this->country,
|
||||
'ico' => $this->ico,
|
||||
'dic' => $this->dic,
|
||||
'ic_dph' => $this->ic_dph,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class OasisViewInvoiceResource extends JsonResource
|
||||
{
|
||||
@@ -17,16 +14,16 @@ class OasisViewInvoiceResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'client_id' => $this->client_id,
|
||||
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
|
||||
'id' => $this->id,
|
||||
'client_id' => $this->client_id,
|
||||
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
|
||||
'invoiceNumber' => $this->invoice_number,
|
||||
'total' => format_to_currency($this->total_net, $this->currency),
|
||||
'file_url' => "/oasis/invoice/$this->id",
|
||||
'clientName' => $this->client['name'],
|
||||
'mimetype' => 'pdf',
|
||||
'type' => 'invoice',
|
||||
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
'total' => format_to_currency($this->total_net, $this->currency),
|
||||
'file_url' => "/oasis/invoice/$this->id",
|
||||
'clientName' => $this->client['name'],
|
||||
'mimetype' => 'pdf',
|
||||
'type' => 'invoice',
|
||||
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use App\Http\Resources\PlanResource;
|
||||
use App\Http\Resources\PricingResource;
|
||||
use App\Services\StripeService;
|
||||
use App\Http\Resources\PricingResource;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class SubscriptionRequestResource extends JsonResource
|
||||
{
|
||||
@@ -20,34 +17,34 @@ class SubscriptionRequestResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'subscription-requests',
|
||||
'attributes' => [
|
||||
'requested_plan' => $this->requested_plan,
|
||||
'status' => $this->status,
|
||||
'id' => $this->id,
|
||||
'type' => 'subscription-requests',
|
||||
'attributes' => [
|
||||
'requested_plan' => $this->requested_plan,
|
||||
'status' => $this->status,
|
||||
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
],
|
||||
'relationships' => [
|
||||
'user' => [
|
||||
'data' => [
|
||||
'id' => $this->user->id,
|
||||
'type' => 'users',
|
||||
'id' => $this->user->id,
|
||||
'type' => 'users',
|
||||
'attributes' => [
|
||||
'name' => $this->user->settings->name,
|
||||
'address' => $this->user->settings->address,
|
||||
'state' => $this->user->settings->state,
|
||||
'city' => $this->user->settings->city,
|
||||
'postal_code' => $this->user->settings->postal_code,
|
||||
'country' => $this->user->settings->country,
|
||||
'name' => $this->user->settings->name,
|
||||
'address' => $this->user->settings->address,
|
||||
'state' => $this->user->settings->state,
|
||||
'city' => $this->user->settings->city,
|
||||
'postal_code' => $this->user->settings->postal_code,
|
||||
'country' => $this->user->settings->country,
|
||||
'phone_number' => $this->user->settings->phone_number,
|
||||
'ico' => $this->user->settings->ico,
|
||||
]
|
||||
]
|
||||
'ico' => $this->user->settings->ico,
|
||||
],
|
||||
],
|
||||
],
|
||||
'plan' => new PricingResource(
|
||||
resolve(StripeService::class)->getPlan($this->requested_plan)
|
||||
),
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class UserResource extends JsonResource
|
||||
'timezone' => $this->settings->timezone,
|
||||
|
||||
// OasisDrive
|
||||
'payment_activation' => (integer) $this->settings->payment_activation
|
||||
'payment_activation' => (integer) $this->settings->payment_activation,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
@@ -21,7 +21,7 @@ function base64_from_storage_image($filepath)
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Storage::exists($filepath)) {
|
||||
if (! Storage::exists($filepath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,6 @@ function invoice_total_discount($invoice, $format = false)
|
||||
{
|
||||
// Percent discount
|
||||
if ($invoice['discount_type'] === 'percent') {
|
||||
|
||||
$discount = (int) (invoice_total_net($invoice) + invoice_total_tax($invoice)) * ($invoice['discount_rate'] / 100);
|
||||
|
||||
if ($format) {
|
||||
@@ -96,7 +95,6 @@ function invoice_total_discount($invoice, $format = false)
|
||||
|
||||
// Value discount
|
||||
if ($invoice['discount_type'] === 'value') {
|
||||
|
||||
if ($format) {
|
||||
return Cashier::formatAmount($invoice['discount_rate'] * 100, $invoice['currency'], 'cs');
|
||||
}
|
||||
@@ -154,4 +152,4 @@ function invoice_total_tax($invoice, $format = false)
|
||||
function format_to_currency($value, $currency = 'CZK', $locale = 'cs')
|
||||
{
|
||||
return Cashier::formatAmount(((int) $value * 100), $currency, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,6 @@ function store_avatar($request, $name)
|
||||
$image_path = Str::random(16) . '-' . $image->getClientOriginalName();
|
||||
|
||||
if (in_array($image->getClientMimeType(), ['image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/webp'])) {
|
||||
|
||||
// Create intervention image
|
||||
$img = Image::make($image->getRealPath());
|
||||
|
||||
@@ -303,8 +302,7 @@ function store_avatar($request, $name)
|
||||
}
|
||||
|
||||
if ($image->getClientMimeType() === 'image/svg+xml') {
|
||||
|
||||
Storage::putFileAs("avatars", $image, $image_path);
|
||||
Storage::putFileAs('avatars', $image, $image_path);
|
||||
}
|
||||
|
||||
// Return path to image
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use TeamTNT\TNTSearch\Indexer\TNTIndexer;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
/**
|
||||
* @method static whereUserId($id)
|
||||
@@ -66,11 +65,11 @@ class Client extends Model
|
||||
$client_email = Str::slug($array['email'], ' ');
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'clientName' => $array['name'],
|
||||
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
|
||||
'clientEmail' => $array['email'],
|
||||
'clientEmailNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_email]))),
|
||||
'id' => $this->id,
|
||||
'clientName' => $array['name'],
|
||||
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
|
||||
'clientEmail' => $array['email'],
|
||||
'clientEmailNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_email]))),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use TeamTNT\TNTSearch\Indexer\TNTIndexer;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Invoice extends Model
|
||||
{
|
||||
use HasFactory, Searchable;
|
||||
|
||||
protected $casts = [
|
||||
'items' => 'array',
|
||||
'user' => 'array',
|
||||
'items' => 'array',
|
||||
'user' => 'array',
|
||||
'client' => 'array',
|
||||
];
|
||||
|
||||
public $guarded = [
|
||||
'id'
|
||||
'id',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
@@ -47,10 +45,10 @@ class Invoice extends Model
|
||||
$client_name = Str::slug($array['client']['name'], ' ');
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'clientName' => $array['client']['name'],
|
||||
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
|
||||
'invoiceNumber' => $array['invoice_number'],
|
||||
'id' => $this->id,
|
||||
'clientName' => $array['client']['name'],
|
||||
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
|
||||
'invoiceNumber' => $array['invoice_number'],
|
||||
'invoiceNumberNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$array['invoice_number']]))),
|
||||
];
|
||||
}
|
||||
@@ -60,7 +58,7 @@ class Invoice extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($invoice) {
|
||||
$invoice->id = (string)Str::uuid();
|
||||
$invoice->id = (string) Str::uuid();
|
||||
|
||||
$invoice->delivery_at = $invoice->created_at;
|
||||
$invoice->due_at = Carbon::parse($invoice->created_at)->addWeeks(2);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class InvoiceProfile extends Model
|
||||
{
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class SubscriptionRequest extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'requested_plan', 'creator', 'status'
|
||||
'requested_plan', 'creator', 'status',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
@@ -30,7 +29,7 @@ class SubscriptionRequest extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($order) {
|
||||
$order->id = (string)Str::uuid();
|
||||
$order->id = (string) Str::uuid();
|
||||
$order->creator = Auth::user()->email ?? $order->creator;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Oasis;
|
||||
@@ -18,7 +17,6 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable, Billable, Sortable, HasFactory, HasApiTokens;
|
||||
|
||||
use Oasis;
|
||||
|
||||
protected $guarded = [
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications\Oasis;
|
||||
|
||||
use App\Models\Oasis\Invoice;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class InvoiceDeliveryNotification extends Notification
|
||||
{
|
||||
@@ -51,7 +48,7 @@ class InvoiceDeliveryNotification extends Notification
|
||||
->greeting(__t('mail_greeting'))
|
||||
->line($this->user->settings->name . ' sent you an invoice.')
|
||||
->salutation(__t('mail_salutation'))
|
||||
->attach(storage_path("app/" . invoice_path($this->invoice)), [
|
||||
->attach(storage_path('app/' . invoice_path($this->invoice)), [
|
||||
'as' => 'name.pdf',
|
||||
'mime' => 'application/pdf',
|
||||
]);
|
||||
@@ -66,7 +63,6 @@ class InvoiceDeliveryNotification extends Notification
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications\Oasis;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Laravel\Cashier\Cashier;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class PaymentRequiredNotification extends Notification
|
||||
{
|
||||
@@ -50,9 +48,9 @@ class PaymentRequiredNotification extends Notification
|
||||
->greeting(__t('mail_greeting'))
|
||||
->line(__t('mail_order_line_1'))
|
||||
->line(__t('mail_tariff', [
|
||||
'name' => $this->plan['product']['name'],
|
||||
'name' => $this->plan['product']['name'],
|
||||
'storage' => Cashier::formatAmount($this->plan['plan']['amount']),
|
||||
'price' => format_gigabytes($this->plan['product']['metadata']['capacity']),
|
||||
'price' => format_gigabytes($this->plan['product']['metadata']['capacity']),
|
||||
]))
|
||||
->action(__t('mail_activation_action'), $url)
|
||||
->line(__t('mail_order_line_2'))
|
||||
@@ -69,7 +67,6 @@ class PaymentRequiredNotification extends Notification
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications\Oasis;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Laravel\Cashier\Cashier;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class ReminderForPaymentRequiredNotification extends Notification
|
||||
{
|
||||
@@ -50,9 +48,9 @@ class ReminderForPaymentRequiredNotification extends Notification
|
||||
->greeting(__t('mail_greeting'))
|
||||
->line(__t('mail_reminder_line_1'))
|
||||
->line(__t('mail_tariff', [
|
||||
'name' => $this->plan['product']['name'],
|
||||
'name' => $this->plan['product']['name'],
|
||||
'storage' => Cashier::formatAmount($this->plan['plan']['amount']),
|
||||
'price' => format_gigabytes($this->plan['product']['metadata']['capacity']),
|
||||
'price' => format_gigabytes($this->plan['product']['metadata']['capacity']),
|
||||
]))
|
||||
->line(__t('mail_reminder_line_2'))
|
||||
->action(__t('mail_activation_action'), $url)
|
||||
@@ -69,7 +67,6 @@ class ReminderForPaymentRequiredNotification extends Notification
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
* $out = $connector->findByIco('44315945');
|
||||
* echo ''.print_r($out, 1).'';
|
||||
*/
|
||||
|
||||
namespace App\Services\Oasis;
|
||||
|
||||
class CzechRegisterSearchService
|
||||
@@ -85,9 +84,11 @@ class CzechRegisterSearchService
|
||||
if (preg_match('/^\d{8}$/', $ico)) {
|
||||
$url = self::URL_SERVER . '?ico=' . $ico;
|
||||
$response = file_get_contents($url);
|
||||
|
||||
if ($response) {
|
||||
$response = self::extractSubjects($response);
|
||||
if (!empty($response[0])) {
|
||||
|
||||
if (! empty($response[0])) {
|
||||
$response = $response[0];
|
||||
}
|
||||
}
|
||||
@@ -96,7 +97,6 @@ class CzechRegisterSearchService
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return matched formatted for autocomplete dropdown list
|
||||
* @param string $term Searched matching string
|
||||
@@ -116,8 +116,7 @@ class CzechRegisterSearchService
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($subjects) && is_array($subjects)) {
|
||||
|
||||
if (! empty($subjects) && is_array($subjects)) {
|
||||
$subjects = array_slice($subjects, 0, $size); // return first $size matches
|
||||
|
||||
foreach ($subjects as &$subject) {
|
||||
@@ -129,7 +128,7 @@ class CzechRegisterSearchService
|
||||
}
|
||||
|
||||
foreach ($subjects as $subject) {
|
||||
if (!empty($subject['ico'])) {
|
||||
if (! empty($subject['ico'])) {
|
||||
$out[] = [
|
||||
'value' => $subject['ico'],
|
||||
'label' => "{$subject['shortname']} (IČO: {$subject['ico']})",
|
||||
@@ -149,15 +148,15 @@ class CzechRegisterSearchService
|
||||
protected static function extractSubjects($html)
|
||||
{
|
||||
// ensure valid XHTML markup
|
||||
if (!extension_loaded('tidy')) {
|
||||
if (! extension_loaded('tidy')) {
|
||||
throw new \Exception('Missing extension [tidy].');
|
||||
}
|
||||
|
||||
$tidy = new \tidy();
|
||||
$html = $tidy->repairString($html, array(
|
||||
'output-xhtml' => true,
|
||||
$html = $tidy->repairString($html, [
|
||||
'output-xhtml' => true,
|
||||
'show-body-only' => true,
|
||||
), 'utf8');
|
||||
], 'utf8');
|
||||
|
||||
// purify whitespaces - vkladaju \n alebo
|
||||
$html = strtr($html, [
|
||||
@@ -174,26 +173,25 @@ class CzechRegisterSearchService
|
||||
$out = [];
|
||||
|
||||
if ($rows->length) {
|
||||
|
||||
foreach ($rows as $row) {
|
||||
|
||||
// Nazev
|
||||
$nodeList = $xpath->query("./tr[1]/td[1]", $row);
|
||||
if (!$nodeList->length) {
|
||||
$nodeList = $xpath->query('./tr[1]/td[1]', $row);
|
||||
|
||||
if (! $nodeList->length) {
|
||||
continue; // nazev je povinny
|
||||
}
|
||||
$name = $nodeList->item(0)->nodeValue;
|
||||
$name = preg_replace('/\s+/', ' ', $name); // viacnasobne inside spaces
|
||||
|
||||
// ICO
|
||||
$nodeList = $xpath->query("./tr[1]/td[2]", $row);
|
||||
$nodeList = $xpath->query('./tr[1]/td[2]', $row);
|
||||
$ico = $nodeList->length ? $nodeList->item(0)->nodeValue : '';
|
||||
|
||||
// adresa - neda sa spolahnut na poradie prvkov :-(
|
||||
$city = '';
|
||||
$nodeList = $xpath->query("./tr[3]/td[1]", $row);
|
||||
if ($nodeList->length) {
|
||||
$nodeList = $xpath->query('./tr[3]/td[1]', $row);
|
||||
|
||||
if ($nodeList->length) {
|
||||
$addr = trim($nodeList->item(0)->nodeValue);
|
||||
|
||||
if (preg_match('/,\s*(\d{3} ?\d{2})\s+(.+)$/', $addr, $match)) {
|
||||
@@ -206,9 +204,10 @@ class CzechRegisterSearchService
|
||||
list($city, $addr_streetnr) = explode(',', $addr);
|
||||
$addr_city = $city;
|
||||
$addr_zip = $match[1];
|
||||
} elseif (!preg_match('/\d{3} ?\d{2}/', $addr, $match)) {
|
||||
} elseif (! preg_match('/\d{3} ?\d{2}/', $addr, $match)) {
|
||||
// Ústí nad Labem, Masarykova 74 - bez PSC - obec, ulice a cislo
|
||||
$addr_streetnr = $addr_zip = '';
|
||||
|
||||
if (false !== strpos($addr, ',')) {
|
||||
list($city, $addr_streetnr) = explode(',', $addr);
|
||||
} else {
|
||||
@@ -227,15 +226,15 @@ class CzechRegisterSearchService
|
||||
}
|
||||
|
||||
$out[] = [
|
||||
'name' => self::trimQuotes($name),
|
||||
'ico' => preg_replace('/[^\d]/', '', $ico),
|
||||
'city' => self::trimQuotes($city),
|
||||
'name' => self::trimQuotes($name),
|
||||
'ico' => preg_replace('/[^\d]/', '', $ico),
|
||||
'city' => self::trimQuotes($city),
|
||||
// pre polia s adresou konzistentne so smartform naseptavacem
|
||||
'addr_city' => self::trimQuotes($addr_city),
|
||||
'addr_zip' => preg_replace('/[^\d]/', '', $addr_zip),
|
||||
'addr_city' => self::trimQuotes($addr_city),
|
||||
'addr_zip' => preg_replace('/[^\d]/', '', $addr_zip),
|
||||
'addr_streetnr' => self::trimQuotes($addr_streetnr),
|
||||
// len pre kontrolu - plna povodna adresa
|
||||
'addr_full' => self::trimQuotes($addr),
|
||||
'addr_full' => self::trimQuotes($addr),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -251,5 +250,4 @@ class CzechRegisterSearchService
|
||||
{
|
||||
return trim(strtr($s, ['"' => '', "'" => '']));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\Oasis;
|
||||
|
||||
|
||||
use App\Models\Oasis\Client;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Factories\Sequence;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class OasisDevService
|
||||
{
|
||||
@@ -23,4 +18,4 @@ class OasisDevService
|
||||
->with('invoice', Invoice::first())
|
||||
->with('user', User::whereEmail('howdy@hi5ve.digital')->first());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\Oasis;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Services\StripeService;
|
||||
use App\Models\Oasis\SubscriptionRequest;
|
||||
use App\Notifications\Oasis\ReminderForPaymentRequiredNotification;
|
||||
use App\Services\StripeService;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class OasisService
|
||||
{
|
||||
@@ -20,21 +17,20 @@ class OasisService
|
||||
SubscriptionRequest::whereStatus('requested')
|
||||
->get()
|
||||
->each(function ($request) {
|
||||
|
||||
// Get diffInHours
|
||||
$diff = Carbon::parse($request->created_at)
|
||||
->diffInHours(Carbon::now());
|
||||
|
||||
// Send order reminder
|
||||
if ($diff == 8) {
|
||||
|
||||
$plan = resolve(StripeService::class)
|
||||
->getPlan($request->requested_plan);
|
||||
|
||||
$request->user->notify(new ReminderForPaymentRequiredNotification(
|
||||
$request, $plan
|
||||
$request,
|
||||
$plan
|
||||
));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class StripeService
|
||||
{
|
||||
|
||||
/**
|
||||
* Stripe Service constructor.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Models\Oasis\Client;
|
||||
@@ -27,11 +26,11 @@ trait Oasis
|
||||
|
||||
public function regularInvoices()
|
||||
{
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('regular-invoice');
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('regular-invoice')->orderByDesc('created_at');
|
||||
}
|
||||
|
||||
public function advanceInvoices()
|
||||
{
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('advance-invoice');
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('advance-invoice')->orderByDesc('created_at');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user