mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
- removed invoicing from oasis
This commit is contained in:
24
.github/workflows/backend-code-style-fix.yml
vendored
24
.github/workflows/backend-code-style-fix.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: Code Style Fix
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
|
||||
jobs:
|
||||
php-cs-fixer:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Run PHP CS Fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
with:
|
||||
args: --config=.php_cs.dist --allow-risky=yes
|
||||
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Fix backend code styling
|
||||
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
@@ -1,35 +0,0 @@
|
||||
name: Frontend Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- run: npm run prod
|
||||
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Application Build
|
||||
41
.github/workflows/unit-testing.yml
vendored
41
.github/workflows/unit-testing.yml
vendored
@@ -1,41 +0,0 @@
|
||||
name: Unit Testing
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, oasis ]
|
||||
pull_request:
|
||||
branches: [ master, oasis ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
php: [8.0]
|
||||
stability: [prefer-stable]
|
||||
|
||||
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: ctype, json, exif, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
|
||||
coverage: none
|
||||
|
||||
- name: Setup problem matchers
|
||||
run: |
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
|
||||
|
||||
- name: Run tests
|
||||
run: vendor/bin/phpunit
|
||||
File diff suppressed because one or more lines are too long
@@ -45,7 +45,6 @@ class SetupOasisEnvironment extends Command
|
||||
{
|
||||
$this->info('Setting up Oasis environment');
|
||||
|
||||
$this->create_demo_content();
|
||||
$this->set_oasis_data();
|
||||
|
||||
$this->info('Dispatching jobs...');
|
||||
@@ -56,92 +55,6 @@ class SetupOasisEnvironment extends Command
|
||||
$this->info('Everything is done, congratulations! 🥳🥳🥳');
|
||||
}
|
||||
|
||||
public function create_demo_content()
|
||||
{
|
||||
$user = User::whereEmail('howdy@hi5ve.digital')
|
||||
->first();
|
||||
|
||||
$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');
|
||||
|
||||
$profile = $user->invoiceProfile()->create([
|
||||
'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",
|
||||
]);
|
||||
|
||||
$clients = Client::factory(Client::class)
|
||||
->count(6)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$regular_invoices = Invoice::factory(Invoice::class)
|
||||
->state(new Sequence(
|
||||
['client_id' => $clients[0]->id],
|
||||
['client_id' => $clients[1]->id],
|
||||
['client_id' => $clients[2]->id],
|
||||
['client_id' => $clients[3]->id],
|
||||
['client_id' => $clients[4]->id],
|
||||
['client_id' => $clients[5]->id],
|
||||
))->count(8)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'discount_type' => null,
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$advance_invoices = Invoice::factory(Invoice::class)
|
||||
->count(6)
|
||||
->state(new Sequence(
|
||||
['client_id' => $clients[0]->id],
|
||||
['client_id' => $clients[1]->id],
|
||||
['client_id' => $clients[2]->id],
|
||||
['client_id' => $clients[3]->id],
|
||||
['client_id' => $clients[4]->id],
|
||||
['client_id' => $clients[5]->id],
|
||||
))->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'advance-invoice',
|
||||
'discount_type' => null,
|
||||
'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,
|
||||
])
|
||||
->setPaper('a4')
|
||||
->setOrientation('portrait')
|
||||
->save(
|
||||
storage_path("app/files/{$invoice->user_id}/invoice-{$invoice->id}.pdf")
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public function set_oasis_data()
|
||||
{
|
||||
Setting::updateOrCreate([
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use Auth;
|
||||
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
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$clients = Client::sortable(['created_at', 'DESC'])
|
||||
->whereUserId(Auth::id())
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisViewClientCollection($clients),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param StoreClientRequest $request
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function store(StoreClientRequest $request)
|
||||
{
|
||||
$client = $request->user()
|
||||
->clients()
|
||||
->create([
|
||||
'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,
|
||||
]);
|
||||
|
||||
return response(
|
||||
new OasisViewClientResource($client),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function show(Client $client)
|
||||
{
|
||||
return response(new OasisViewClientResource($client), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @param Request $request
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function update(Client $client, Request $request)
|
||||
{
|
||||
// Store image if exist
|
||||
if ($request->hasFile($request->name)) {
|
||||
// Find and update image path
|
||||
$client->update([
|
||||
$request->name => store_avatar($request, $request->name),
|
||||
]);
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
$client->update(
|
||||
make_single_input($request)
|
||||
);
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy(Client $client)
|
||||
{
|
||||
$client->delete();
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function show_invoices(Client $client)
|
||||
{
|
||||
return response(new OasisInvoiceCollection($client->invoices), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$query = remove_accents(request()->input('query'));
|
||||
|
||||
$results = Client::search($query)
|
||||
->where('user_id', request()->user()->id)
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisViewClientCollection($results),
|
||||
200
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,287 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use Auth;
|
||||
use Storage;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Oasis\Client;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use App\Http\Requests\Oasis\ShareInvoiceRequest;
|
||||
use App\Http\Requests\Oasis\StoreInvoiceRequest;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Http\Resources\Oasis\OasisInvoiceResource;
|
||||
use App\Http\Resources\Oasis\OasisViewInvoiceResource;
|
||||
use App\Http\Resources\Oasis\OasisViewInvoiceCollection;
|
||||
use App\Notifications\Oasis\InvoiceDeliveryNotification;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
{
|
||||
/**
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function get_all_regular_invoices()
|
||||
{
|
||||
$invoices = Invoice::sortable(['created_at', 'DESC'])
|
||||
->whereUserId(Auth::id())
|
||||
->whereInvoiceType('regular-invoice')
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisViewInvoiceCollection($invoices),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function get_all_advance_invoices()
|
||||
{
|
||||
$invoices = Invoice::sortable(['created_at', 'DESC'])
|
||||
->whereUserId(Auth::id())
|
||||
->whereInvoiceType('advance-invoice')
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisViewInvoiceCollection($invoices),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Invoice $invoice
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function get_single_invoice(Invoice $invoice)
|
||||
{
|
||||
return response(
|
||||
new OasisInvoiceResource($invoice),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Invoice $invoice
|
||||
* @return \Symfony\Component\HttpFoundation\StreamedResponse
|
||||
*/
|
||||
public function download_invoice(Invoice $invoice)
|
||||
{
|
||||
if (! Storage::exists(invoice_path($invoice))) {
|
||||
abort(404, 'Not Found');
|
||||
}
|
||||
|
||||
return Storage::download(invoice_path($invoice), "invoice-{$invoice->id}.pdf");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$results = Invoice::search(
|
||||
remove_accents(request()->input('query'))
|
||||
)
|
||||
->where('user_id', request()->user()->id)
|
||||
->where('invoice_type', request()->input('type'))
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisViewInvoiceCollection($results),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store and generate new invoice
|
||||
*
|
||||
* @param StoreInvoiceRequest $request
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function store(StoreInvoiceRequest $request)
|
||||
{
|
||||
$client = $this->getOrStoreClient($request);
|
||||
$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,
|
||||
'variable_number' => $request->variable_number,
|
||||
'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,
|
||||
],
|
||||
]);
|
||||
|
||||
// Generate PDF
|
||||
\PDF::loadView('oasis.invoices.invoice', [
|
||||
'invoice' => Invoice::find($invoice->id),
|
||||
'user' => $user,
|
||||
])
|
||||
->setPaper('a4')
|
||||
->setOrientation('portrait')
|
||||
->save(
|
||||
storage_path("app/files/{$user->id}/invoice-{$invoice->id}.pdf")
|
||||
);
|
||||
|
||||
if ($request->send_invoice && $invoice->client['email']) {
|
||||
Notification::route('mail', $invoice->client['email'])->notify(
|
||||
new InvoiceDeliveryNotification($user, $invoice)
|
||||
);
|
||||
}
|
||||
|
||||
return response(
|
||||
new OasisViewInvoiceResource($invoice),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store and generate new invoice
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Invoice $invoice
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function update(StoreInvoiceRequest $request, Invoice $invoice)
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$invoice->update([
|
||||
'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' => json_decode($request->items),
|
||||
]);
|
||||
|
||||
Storage::delete(invoice_path($invoice));
|
||||
|
||||
// Generate PDF
|
||||
\PDF::loadView('oasis.invoices.invoice', [
|
||||
'invoice' => Invoice::find($invoice->id),
|
||||
'user' => $user,
|
||||
])
|
||||
->setPaper('a4')
|
||||
->setOrientation('portrait')
|
||||
->save(
|
||||
storage_path("app/files/{$user->id}/invoice-{$invoice->id}.pdf")
|
||||
);
|
||||
|
||||
if ($request->send_invoice && $invoice->client['email']) {
|
||||
Notification::route('mail', $invoice->client['email'])->notify(
|
||||
new InvoiceDeliveryNotification($user, $invoice)
|
||||
);
|
||||
}
|
||||
|
||||
return response(
|
||||
'Done',
|
||||
204
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Share invoice via email
|
||||
*
|
||||
* @param ShareInvoiceRequest $request
|
||||
* @param Invoice $invoice
|
||||
*/
|
||||
public function share(ShareInvoiceRequest $request, Invoice $invoice)
|
||||
{
|
||||
Notification::route('mail', $request->email)
|
||||
->notify(
|
||||
new InvoiceDeliveryNotification($request->user(), $invoice)
|
||||
);
|
||||
|
||||
return response(
|
||||
'Done',
|
||||
204
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Invoice $invoice
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy(Invoice $invoice)
|
||||
{
|
||||
$invoice->delete();
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data for frontend invoice creator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function editor()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return [
|
||||
'isVatPayer' => $user->invoiceProfile->ic_dph ?? false,
|
||||
'latestInvoiceNumber' => $user->regularInvoices->first()
|
||||
? (int) $user->regularInvoices->first()->invoice_number
|
||||
: null,
|
||||
'recommendedInvoiceNumber' => $user->regularInvoices->first()
|
||||
? (int) $user->regularInvoices->first()->invoice_number + 1
|
||||
: Carbon::now()->format('Y') . '0001',
|
||||
'clients' => $user->clients->map(function ($client) {
|
||||
return [
|
||||
'label' => $client->name,
|
||||
'value' => $client->id,
|
||||
];
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param StoreInvoiceRequest $request
|
||||
* @return mixed
|
||||
*/
|
||||
private function getOrStoreClient(StoreInvoiceRequest $request)
|
||||
{
|
||||
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,
|
||||
'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,
|
||||
]);
|
||||
}
|
||||
|
||||
return Client::whereUserId($request->user()->id)
|
||||
->whereId($request->client)
|
||||
->first();
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Oasis;
|
||||
|
||||
use Auth;
|
||||
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
|
||||
{
|
||||
/**
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user->invoiceProfile) {
|
||||
return response(
|
||||
new InvoiceProfileResource($user->invoiceProfile),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
return response("Profile didn't exists", 404);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
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,
|
||||
'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,
|
||||
]);
|
||||
|
||||
return response(
|
||||
new InvoiceProfileResource($profile),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
// 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),
|
||||
]);
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
$request->user()
|
||||
->invoiceProfile()
|
||||
->update(make_single_input($request));
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShareInvoiceRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreClientRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'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',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreInvoiceProfileRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
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',
|
||||
'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',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Requests\Oasis;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreInvoiceRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'invoice_type' => 'sometimes|string',
|
||||
'invoice_number' => 'required|string',
|
||||
'variable_number' => 'required|string',
|
||||
'client' => 'sometimes|required',
|
||||
'items' => 'required|string',
|
||||
'discount_type' => 'sometimes|string',
|
||||
'discount_rate' => 'sometimes|integer',
|
||||
'delivery_at' => 'required|date',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class InvoiceProfileCollection extends ResourceCollection
|
||||
{
|
||||
public $collects = InvoiceProfileResource::class;
|
||||
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class InvoiceProfileResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'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,
|
||||
'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,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class OasisInvoiceCollection extends ResourceCollection
|
||||
{
|
||||
public $collects = OasisInvoiceResource::class;
|
||||
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OasisInvoiceResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'invoice',
|
||||
'attributes' => [
|
||||
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
|
||||
'invoice_number' => $this->invoice_number,
|
||||
'variable_number' => $this->variable_number,
|
||||
'invoice_type' => $this->invoice_type,
|
||||
'delivery_at' => $this->delivery_at,
|
||||
'items' => $this->items,
|
||||
'discount_type' => $this->discount_type,
|
||||
'discount_rate' => $this->discount_rate,
|
||||
'client' => $this->client,
|
||||
'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,20 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class OasisViewClientCollection extends ResourceCollection
|
||||
{
|
||||
public $collects = OasisViewClientResource::class;
|
||||
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return $this->collection;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OasisViewClientResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$total_net = \DB::table('invoices')
|
||||
->whereClientId($this->id)
|
||||
->sum('total_net');
|
||||
|
||||
$total_invoices = \DB::table('invoices')
|
||||
->whereClientId($this->id)
|
||||
->count();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => 'client',
|
||||
'created_at' => format_date($this->created_at, '%d. %B %Y'),
|
||||
|
||||
'totalNet' => format_to_currency($total_net, 'CZK'),
|
||||
'totalInvoices' => $total_invoices,
|
||||
|
||||
'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,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class OasisViewInvoiceCollection extends ResourceCollection
|
||||
{
|
||||
public $collects = OasisViewInvoiceResource::class;
|
||||
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return $this->collection;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Resources\Oasis;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OasisViewInvoiceResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
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),
|
||||
'invoice_number' => $this->invoice_number,
|
||||
'total' => format_to_currency($this->total_net, $this->currency),
|
||||
'file_url' => "/oasis/invoice/$this->id",
|
||||
'client_name' => $this->client['name'],
|
||||
'mimetype' => 'pdf',
|
||||
'type' => 'invoice',
|
||||
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Cashier\Cashier;
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @return bool
|
||||
*/
|
||||
function is_route($name)
|
||||
{
|
||||
return Route::currentRouteName() === $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filepath
|
||||
* @return string
|
||||
*/
|
||||
function base64_from_storage_image($filepath)
|
||||
{
|
||||
if (is_null($filepath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! Storage::exists($filepath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return 'data:' . Storage::mimeType($filepath) . ';base64,' . base64_encode(Storage::get($filepath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return invoice path to storage
|
||||
*
|
||||
* @param $invoice
|
||||
* @return string
|
||||
*/
|
||||
function invoice_path($invoice)
|
||||
{
|
||||
return "files/{$invoice->user_id}/invoice-{$invoice->id}.pdf";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get only tax for single invoice item
|
||||
*
|
||||
* @param $item
|
||||
* @return float|int|string
|
||||
*/
|
||||
function invoice_item_only_tax_price($item)
|
||||
{
|
||||
return ($item['price'] * $item['amount']) * ($item['tax_rate'] / 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item price with tax for single invoice item
|
||||
*
|
||||
* @param $item
|
||||
* @return float|int|string
|
||||
*/
|
||||
function invoice_item_with_tax_price($item)
|
||||
{
|
||||
return ($item['price'] * $item['amount']) * ($item['tax_rate'] / 100 + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $invoice
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
function invoice_tax_base($invoice)
|
||||
{
|
||||
$bag = collect([]);
|
||||
|
||||
// Count tax base
|
||||
foreach ($invoice['items'] as $item) {
|
||||
if (! $bag->firstWhere('rate', $item['tax_rate'])) {
|
||||
$bag->push([
|
||||
'rate' => $item['tax_rate'],
|
||||
'total' => $item['price'] * $item['amount'],
|
||||
]);
|
||||
} else {
|
||||
$bag->map(function ($bagItem) use ($item) {
|
||||
if ($bagItem['rate'] === $item['tax_rate']) {
|
||||
$bagItem['total'] += ($item['price'] * $item['amount']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Count discount
|
||||
if ($invoice['discount_type']) {
|
||||
return $bag->map(function ($bagItem) use ($invoice) {
|
||||
if ($invoice['discount_type'] === 'percent') {
|
||||
$bagItem['total'] -= $bagItem['total'] * ($invoice['discount_rate'] / 100);
|
||||
}
|
||||
|
||||
if ($invoice['discount_type'] === 'value') {
|
||||
$percentage_of_discount = $invoice['discount_rate'] / (invoice_total($invoice) + $invoice['discount_rate']);
|
||||
|
||||
$bagItem['total'] -= $bagItem['total'] * $percentage_of_discount;
|
||||
}
|
||||
|
||||
return $bagItem;
|
||||
});
|
||||
}
|
||||
|
||||
return $bag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $invoice
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
function invoice_tax_summary($invoice)
|
||||
{
|
||||
$bag = collect([]);
|
||||
|
||||
// Count tax base
|
||||
foreach ($invoice['items'] as $item) {
|
||||
if (! $bag->firstWhere('rate', $item['tax_rate'])) {
|
||||
$bag->push([
|
||||
'rate' => $item['tax_rate'],
|
||||
'total' => ($item['price'] * $item['amount']) * ($item['tax_rate'] / 100),
|
||||
]);
|
||||
} else {
|
||||
$bag->map(function ($bagItem) use ($item) {
|
||||
if ($bagItem['rate'] === $item['tax_rate']) {
|
||||
$bagItem['total'] += ($item['price'] * $item['amount']) * ($item['tax_rate'] / 100);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Count discount
|
||||
if ($invoice['discount_type']) {
|
||||
return $bag->map(function ($bagItem) use ($invoice) {
|
||||
if ($invoice['discount_type'] === 'percent') {
|
||||
$bagItem['total'] -= $bagItem['total'] * ($invoice['discount_rate'] / 100);
|
||||
}
|
||||
|
||||
if ($invoice['discount_type'] === 'value') {
|
||||
$percentage_of_discount = $invoice['discount_rate'] / (invoice_total($invoice) + $invoice['discount_rate']);
|
||||
|
||||
$bagItem['total'] -= $bagItem['total'] * $percentage_of_discount;
|
||||
}
|
||||
|
||||
return $bagItem;
|
||||
});
|
||||
}
|
||||
|
||||
return $bag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $invoice
|
||||
* @return float|int|string
|
||||
*/
|
||||
function invoice_total($invoice)
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
foreach ($invoice['items'] as $item) {
|
||||
$total_without_tax = $item['amount'] * $item['price'];
|
||||
|
||||
if ($invoice['user']['ic_dph'] && $item['tax_rate']) {
|
||||
$total_without_tax += $total_without_tax * ($item['tax_rate'] / 100);
|
||||
}
|
||||
|
||||
$total += $total_without_tax;
|
||||
}
|
||||
|
||||
if ($invoice['discount_type']) {
|
||||
if ($invoice['discount_type'] === 'percent') {
|
||||
$total -= $total * ($invoice['discount_rate'] / 100);
|
||||
}
|
||||
|
||||
if ($invoice['discount_type'] === 'value') {
|
||||
$total -= $invoice['discount_rate'];
|
||||
}
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $invoice
|
||||
* @param false $format
|
||||
* @return float|int|string
|
||||
*/
|
||||
function invoice_total_tax($invoice)
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
foreach ($invoice['items'] as $item) {
|
||||
$total += ($item['amount'] * $item['price']) * ($item['tax_rate'] / 100);
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param string $currency
|
||||
* @param string $locale
|
||||
* @return string
|
||||
*/
|
||||
function format_to_currency($value, $currency = 'CZK', $locale = 'cs')
|
||||
{
|
||||
$amount = round($value, 2) * 100;
|
||||
|
||||
return Cashier::formatAmount((int) $amount, $currency, $locale);
|
||||
}
|
||||
1769
app/Http/helpers.php
1769
app/Http/helpers.php
File diff suppressed because it is too large
Load Diff
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
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)
|
||||
*/
|
||||
class Client extends Model
|
||||
{
|
||||
use HasFactory, Searchable, Sortable;
|
||||
|
||||
public $guarded = ['id'];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
public $sortable = [
|
||||
'created_at',
|
||||
'name',
|
||||
];
|
||||
|
||||
/**
|
||||
* Format avatar to full url
|
||||
*
|
||||
* @return \Illuminate\Contracts\Routing\UrlGenerator|string
|
||||
*/
|
||||
public function getAvatarAttribute()
|
||||
{
|
||||
// Get avatar from external storage
|
||||
if ($this->attributes['avatar'] && ! is_storage_driver('local')) {
|
||||
return Storage::temporaryUrl($this->attributes['avatar'], now()->addDay());
|
||||
}
|
||||
|
||||
// Get avatar from local storage
|
||||
if ($this->attributes['avatar']) {
|
||||
return url('/' . $this->attributes['avatar']);
|
||||
}
|
||||
|
||||
return url('/assets/images/default-avatar.png');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany(Invoice::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index file
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$array = $this->toArray();
|
||||
|
||||
$client_name = Str::slug($array['name'], ' ');
|
||||
$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]))),
|
||||
];
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($client) {
|
||||
$client->id = (string) Str::uuid();
|
||||
});
|
||||
|
||||
static::deleting(function ($client) {
|
||||
if ($client->getRawOriginal('avatar')) {
|
||||
Storage::delete($client->getRawOriginal('avatar'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
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, Sortable;
|
||||
|
||||
protected $casts = [
|
||||
'items' => 'array',
|
||||
'user' => 'array',
|
||||
'client' => 'array',
|
||||
];
|
||||
|
||||
public $guarded = [
|
||||
'id',
|
||||
];
|
||||
|
||||
public $sortable = [
|
||||
'invoice_number',
|
||||
'created_at',
|
||||
'total_net',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
public function author()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->hasOne(Client::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$array = $this->toArray();
|
||||
|
||||
$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'],
|
||||
'invoiceNumberNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$array['invoice_number']]))),
|
||||
];
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($invoice) {
|
||||
$invoice->id = (string) Str::uuid();
|
||||
|
||||
$invoice->total_net = invoice_total($invoice);
|
||||
$invoice->total_tax = invoice_total_tax($invoice);
|
||||
|
||||
$invoice->currency = 'CZK';
|
||||
});
|
||||
|
||||
static::updating(function ($invoice) {
|
||||
$invoice->total_net = invoice_total($invoice);
|
||||
$invoice->total_tax = invoice_total_tax($invoice);
|
||||
});
|
||||
|
||||
static::deleting(function ($invoice) {
|
||||
Storage::delete(invoice_path($invoice));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class InvoiceProfile extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $guarded = ['id'];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($invoice) {
|
||||
$invoice->id = (string) Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
namespace App\Notifications\Oasis;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class InvoiceDeliveryNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
private $invoice;
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @param $user
|
||||
* @param $invoice
|
||||
*/
|
||||
public function __construct($user, $invoice)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__t('in.notify.subject', ['company' => $this->user->invoiceProfile->company]))
|
||||
->greeting(__t('mail_greeting'))
|
||||
->line(__t('in.notify.message', ['company' => $this->user->invoiceProfile->company]))
|
||||
->salutation(__t('mail_salutation'))
|
||||
->attach(storage_path('app/' . invoice_path($this->invoice)), [
|
||||
'as' => 'name.pdf',
|
||||
'mime' => 'application/pdf',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
<?php
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Models\Oasis\Client;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use App\Models\Oasis\InvoiceProfile;
|
||||
use App\Models\Oasis\SubscriptionRequest;
|
||||
|
||||
trait Oasis
|
||||
@@ -12,25 +9,4 @@ trait Oasis
|
||||
{
|
||||
return $this->hasOne(SubscriptionRequest::class);
|
||||
}
|
||||
|
||||
public function invoiceProfile()
|
||||
{
|
||||
return $this->hasOne(InvoiceProfile::class);
|
||||
}
|
||||
|
||||
public function clients()
|
||||
{
|
||||
return $this->hasMany(Client::class, 'user_id', 'id')
|
||||
->orderByDesc('created_at');
|
||||
}
|
||||
|
||||
public function regularInvoices()
|
||||
{
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('regular-invoice')->orderByDesc('created_at');
|
||||
}
|
||||
|
||||
public function advanceInvoices()
|
||||
{
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('advance-invoice')->orderByDesc('created_at');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
"spatie/laravel-backup": "^6.15",
|
||||
"spatie/laravel-tail": "^4.3",
|
||||
"teamtnt/laravel-scout-tntsearch-driver": "^11.1.0",
|
||||
"vimeo/psalm": "^4.7"
|
||||
"vimeo/psalm": "^4.7",
|
||||
"makingcg/vuefilemanager-invoicing": "dev-master"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
@@ -46,6 +47,11 @@
|
||||
"nunomaduro/collision": "^5.3.0",
|
||||
"phpunit/phpunit": "^9.5.2"
|
||||
},
|
||||
"repositories": [{
|
||||
"type": "path",
|
||||
"url": "../vuefilemanager-invoicing"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
|
||||
265
composer.lock
generated
265
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "00cbdcc8589eda0ebebb68616acae12c",
|
||||
"content-hash": "78711ace16bbb77d8e0a9381e7984e03",
|
||||
"packages": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
@@ -230,16 +230,16 @@
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.180.6",
|
||||
"version": "3.181.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "1a836be14ba664ea11eb965dec77715e9e607013"
|
||||
"reference": "0829df420170e4994767860290a69487a18555f7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/1a836be14ba664ea11eb965dec77715e9e607013",
|
||||
"reference": "1a836be14ba664ea11eb965dec77715e9e607013",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0829df420170e4994767860290a69487a18555f7",
|
||||
"reference": "0829df420170e4994767860290a69487a18555f7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -314,9 +314,9 @@
|
||||
"support": {
|
||||
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
||||
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.180.6"
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.181.1"
|
||||
},
|
||||
"time": "2021-05-10T18:17:07+00:00"
|
||||
"time": "2021-05-12T18:13:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
@@ -2997,16 +2997,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/cashier",
|
||||
"version": "v12.13.0",
|
||||
"version": "v12.13.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/cashier-stripe.git",
|
||||
"reference": "f1a7d5ffce278bf9c85cd3c1b86c45d688f3bf00"
|
||||
"reference": "532089a487dd09c6fa5adaf9c0088715a7623e48"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/cashier-stripe/zipball/f1a7d5ffce278bf9c85cd3c1b86c45d688f3bf00",
|
||||
"reference": "f1a7d5ffce278bf9c85cd3c1b86c45d688f3bf00",
|
||||
"url": "https://api.github.com/repos/laravel/cashier-stripe/zipball/532089a487dd09c6fa5adaf9c0088715a7623e48",
|
||||
"reference": "532089a487dd09c6fa5adaf9c0088715a7623e48",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3071,7 +3071,7 @@
|
||||
"issues": "https://github.com/laravel/cashier/issues",
|
||||
"source": "https://github.com/laravel/cashier"
|
||||
},
|
||||
"time": "2021-04-27T17:42:05+00:00"
|
||||
"time": "2021-05-11T20:52:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/fortify",
|
||||
@@ -3138,16 +3138,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v8.40.0",
|
||||
"version": "v8.41.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "a654897ad7f97aea9d7ef292803939798c4a02a4"
|
||||
"reference": "05417155d886df8710e55c84e12622b52d83c47c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/a654897ad7f97aea9d7ef292803939798c4a02a4",
|
||||
"reference": "a654897ad7f97aea9d7ef292803939798c4a02a4",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/05417155d886df8710e55c84e12622b52d83c47c",
|
||||
"reference": "05417155d886df8710e55c84e12622b52d83c47c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3255,7 +3255,7 @@
|
||||
"phpunit/phpunit": "Required to use assertions and run tests (^8.5.8|^9.3.3).",
|
||||
"predis/predis": "Required to use the predis connector (^1.1.2).",
|
||||
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
|
||||
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0|^5.0).",
|
||||
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0|^5.0|^6.0).",
|
||||
"symfony/cache": "Required to PSR-6 cache bridge (^5.1.4).",
|
||||
"symfony/filesystem": "Required to enable support for relative symbolic links (^5.1.4).",
|
||||
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).",
|
||||
@@ -3302,20 +3302,20 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2021-04-28T14:38:56+00:00"
|
||||
"time": "2021-05-11T14:00:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/sanctum",
|
||||
"version": "v2.10.0",
|
||||
"version": "v2.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/sanctum.git",
|
||||
"reference": "a08cfee365c6b6df3e91c8f43b92f7163ffc8a94"
|
||||
"reference": "3ed8f60dafef026acc21733366a08746a7bd176e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/sanctum/zipball/a08cfee365c6b6df3e91c8f43b92f7163ffc8a94",
|
||||
"reference": "a08cfee365c6b6df3e91c8f43b92f7163ffc8a94",
|
||||
"url": "https://api.github.com/repos/laravel/sanctum/zipball/3ed8f60dafef026acc21733366a08746a7bd176e",
|
||||
"reference": "3ed8f60dafef026acc21733366a08746a7bd176e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3366,7 +3366,7 @@
|
||||
"issues": "https://github.com/laravel/sanctum/issues",
|
||||
"source": "https://github.com/laravel/sanctum"
|
||||
},
|
||||
"time": "2021-04-20T16:20:46+00:00"
|
||||
"time": "2021-05-11T21:03:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/scout",
|
||||
@@ -3564,16 +3564,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/commonmark",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/commonmark.git",
|
||||
"reference": "2651c497f005de305c7ba3f232cbd87b8c00ee8c"
|
||||
"reference": "7d70d2f19c84bcc16275ea47edabee24747352eb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2651c497f005de305c7ba3f232cbd87b8c00ee8c",
|
||||
"reference": "2651c497f005de305c7ba3f232cbd87b8c00ee8c",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/7d70d2f19c84bcc16275ea47edabee24747352eb",
|
||||
"reference": "7d70d2f19c84bcc16275ea47edabee24747352eb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3661,7 +3661,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-05-08T16:08:00+00:00"
|
||||
"time": "2021-05-12T11:39:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
@@ -3976,6 +3976,97 @@
|
||||
},
|
||||
"time": "2020-12-01T23:44:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "makingcg/vuefilemanager-invoicing",
|
||||
"version": "dev-master",
|
||||
"dist": {
|
||||
"type": "path",
|
||||
"url": "../vuefilemanager-invoicing",
|
||||
"reference": "d2a7cb5aa267c25f2a559d8af6740a327a2b3bef"
|
||||
},
|
||||
"require": {
|
||||
"barryvdh/laravel-snappy": "^0.4.8",
|
||||
"ext-json": "*",
|
||||
"illuminate/contracts": "^8.37",
|
||||
"intervention/image": "^2.5",
|
||||
"kyslik/column-sortable": "^6.4",
|
||||
"laravel/cashier": "^12.13",
|
||||
"php": "^8.0",
|
||||
"spatie/laravel-package-tools": "^1.4.3",
|
||||
"teamtnt/laravel-scout-tntsearch-driver": "^11.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"brianium/paratest": "^6.2",
|
||||
"ext-json": "*",
|
||||
"friendsofphp/php-cs-fixer": "^2.19",
|
||||
"nunomaduro/collision": "^5.3",
|
||||
"orchestra/testbench": "^6.15",
|
||||
"phpunit/phpunit": "^9.3",
|
||||
"spatie/laravel-ray": "^1.9",
|
||||
"vimeo/psalm": "^4.7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Makingcg\\Invoice\\InvoiceServiceProvider",
|
||||
"Kyslik\\ColumnSortable\\ColumnSortableServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Invoice": "Makingcg\\Invoice\\InvoiceFacade",
|
||||
"PDF": "Barryvdh\\Snappy\\Facades\\SnappyPdf"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Makingcg\\Invoice\\": "src",
|
||||
"Makingcg\\Invoice\\Database\\Factories\\": "database/factories"
|
||||
},
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Makingcg\\Invoice\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"psalm": [
|
||||
"vendor/bin/psalm"
|
||||
],
|
||||
"format": [
|
||||
"vendor/bin/php-cs-fixer fix --allow-risky=yes"
|
||||
],
|
||||
"test": [
|
||||
"./vendor/bin/testbench package:test --parallel --no-coverage"
|
||||
],
|
||||
"test-coverage": [
|
||||
"vendor/bin/phpunit --coverage-html coverage"
|
||||
]
|
||||
},
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Peter Papp",
|
||||
"email": "peterpapp@makingcg.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "The invoice system for VueFileManager app",
|
||||
"homepage": "https://github.com/makingcg/vuefilemanager-invoicing",
|
||||
"keywords": [
|
||||
"MakingCG",
|
||||
"laravel",
|
||||
"vuefilemanager-invoicing"
|
||||
],
|
||||
"transport-options": {
|
||||
"relative": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mockery/mockery",
|
||||
"version": "1.4.3",
|
||||
@@ -4351,16 +4442,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "2.47.0",
|
||||
"version": "2.48.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "606262fd8888b75317ba9461825a24fc34001e1e"
|
||||
"reference": "d3c447f21072766cddec3522f9468a5849a76147"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/606262fd8888b75317ba9461825a24fc34001e1e",
|
||||
"reference": "606262fd8888b75317ba9461825a24fc34001e1e",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3c447f21072766cddec3522f9468a5849a76147",
|
||||
"reference": "d3c447f21072766cddec3522f9468a5849a76147",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4440,7 +4531,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-13T21:54:02+00:00"
|
||||
"time": "2021-05-07T10:08:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "netresearch/jsonmapper",
|
||||
@@ -7937,16 +8028,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v5.2.7",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "90374b8ed059325b49a29b55b3f8bb4062c87629"
|
||||
"reference": "864568fdc0208b3eba3638b6000b69d2386e6768"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/90374b8ed059325b49a29b55b3f8bb4062c87629",
|
||||
"reference": "90374b8ed059325b49a29b55b3f8bb4062c87629",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/864568fdc0208b3eba3638b6000b69d2386e6768",
|
||||
"reference": "864568fdc0208b3eba3638b6000b69d2386e6768",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -8014,7 +8105,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v5.2.7"
|
||||
"source": "https://github.com/symfony/console/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -8030,7 +8121,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-19T14:07:32+00:00"
|
||||
"time": "2021-05-11T15:45:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
@@ -8166,16 +8257,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/error-handler",
|
||||
"version": "v5.2.7",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/error-handler.git",
|
||||
"reference": "ea3ddbf67615e883ca7c33a4de61213789846782"
|
||||
"reference": "1416bc16317a8188aabde251afef7618bf4687ac"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/error-handler/zipball/ea3ddbf67615e883ca7c33a4de61213789846782",
|
||||
"reference": "ea3ddbf67615e883ca7c33a4de61213789846782",
|
||||
"url": "https://api.github.com/repos/symfony/error-handler/zipball/1416bc16317a8188aabde251afef7618bf4687ac",
|
||||
"reference": "1416bc16317a8188aabde251afef7618bf4687ac",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -8215,7 +8306,7 @@
|
||||
"description": "Provides tools to manage errors and ease debugging PHP code",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/error-handler/tree/v5.2.7"
|
||||
"source": "https://github.com/symfony/error-handler/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -8231,7 +8322,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-07T15:57:33+00:00"
|
||||
"time": "2021-05-07T13:42:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
@@ -8461,16 +8552,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v5.2.4",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "0d639a0943822626290d169965804f79400e6a04"
|
||||
"reference": "eccb8be70d7a6a2230d05f6ecede40f3fdd9e252"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/0d639a0943822626290d169965804f79400e6a04",
|
||||
"reference": "0d639a0943822626290d169965804f79400e6a04",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/eccb8be70d7a6a2230d05f6ecede40f3fdd9e252",
|
||||
"reference": "eccb8be70d7a6a2230d05f6ecede40f3fdd9e252",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -8502,7 +8593,7 @@
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/finder/tree/v5.2.4"
|
||||
"source": "https://github.com/symfony/finder/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -8518,7 +8609,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-02-15T18:55:04+00:00"
|
||||
"time": "2021-05-10T14:39:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-client-contracts",
|
||||
@@ -8600,16 +8691,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v5.2.7",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "a416487a73bb9c9d120e9ba3a60547f4a3fb7a1f"
|
||||
"reference": "e8fbbab7c4a71592985019477532629cb2e142dc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/a416487a73bb9c9d120e9ba3a60547f4a3fb7a1f",
|
||||
"reference": "a416487a73bb9c9d120e9ba3a60547f4a3fb7a1f",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8fbbab7c4a71592985019477532629cb2e142dc",
|
||||
"reference": "e8fbbab7c4a71592985019477532629cb2e142dc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -8653,7 +8744,7 @@
|
||||
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v5.2.7"
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -8669,20 +8760,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-05-01T13:46:24+00:00"
|
||||
"time": "2021-05-07T13:41:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v5.2.7",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "1e9f6879f070f718e0055fbac232a56f67b8b6bd"
|
||||
"reference": "c3cb71ee7e2d3eae5fe1001f81780d6a49b37937"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/1e9f6879f070f718e0055fbac232a56f67b8b6bd",
|
||||
"reference": "1e9f6879f070f718e0055fbac232a56f67b8b6bd",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/c3cb71ee7e2d3eae5fe1001f81780d6a49b37937",
|
||||
"reference": "c3cb71ee7e2d3eae5fe1001f81780d6a49b37937",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -8765,7 +8856,7 @@
|
||||
"description": "Provides a structured process for converting a Request into a Response",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v5.2.7"
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -8781,7 +8872,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-05-01T14:53:15+00:00"
|
||||
"time": "2021-05-12T13:27:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
@@ -10113,16 +10204,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v5.2.6",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572"
|
||||
"reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572",
|
||||
"reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db",
|
||||
"reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10176,7 +10267,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v5.2.6"
|
||||
"source": "https://github.com/symfony/string/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10192,20 +10283,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-03-17T17:12:15+00:00"
|
||||
"time": "2021-05-10T14:56:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v5.2.7",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "e37ece5242564bceea54d709eafc948377ec9749"
|
||||
"reference": "445caa74a5986f1cc9dd91a2975ef68fa7cb2068"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/e37ece5242564bceea54d709eafc948377ec9749",
|
||||
"reference": "e37ece5242564bceea54d709eafc948377ec9749",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/445caa74a5986f1cc9dd91a2975ef68fa7cb2068",
|
||||
"reference": "445caa74a5986f1cc9dd91a2975ef68fa7cb2068",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10269,7 +10360,7 @@
|
||||
"description": "Provides tools to internationalize your application",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/translation/tree/v5.2.7"
|
||||
"source": "https://github.com/symfony/translation/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10285,7 +10376,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-01T08:15:21+00:00"
|
||||
"time": "2021-05-07T13:41:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation-contracts",
|
||||
@@ -10367,16 +10458,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v5.2.7",
|
||||
"version": "v5.2.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "27cb9f7cfa3853c736425c7233a8f68814b19636"
|
||||
"reference": "d693200a73fae179d27f8f1b16b4faf3e8569eba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/27cb9f7cfa3853c736425c7233a8f68814b19636",
|
||||
"reference": "27cb9f7cfa3853c736425c7233a8f68814b19636",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/d693200a73fae179d27f8f1b16b4faf3e8569eba",
|
||||
"reference": "d693200a73fae179d27f8f1b16b4faf3e8569eba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10435,7 +10526,7 @@
|
||||
"dump"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/var-dumper/tree/v5.2.7"
|
||||
"source": "https://github.com/symfony/var-dumper/tree/v5.2.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10451,7 +10542,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-19T14:07:32+00:00"
|
||||
"time": "2021-05-07T13:42:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "teamtnt/laravel-scout-tntsearch-driver",
|
||||
@@ -11297,12 +11388,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/composer.git",
|
||||
"reference": "0021758e0bcf964237a56cb22e2f0309118b6a3f"
|
||||
"reference": "5456cf81971b897ee82f75e82d2bcc3ad0bc6b84"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/composer/zipball/0021758e0bcf964237a56cb22e2f0309118b6a3f",
|
||||
"reference": "0021758e0bcf964237a56cb22e2f0309118b6a3f",
|
||||
"url": "https://api.github.com/repos/composer/composer/zipball/5456cf81971b897ee82f75e82d2bcc3ad0bc6b84",
|
||||
"reference": "5456cf81971b897ee82f75e82d2bcc3ad0bc6b84",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11388,7 +11479,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-05-10T11:14:14+00:00"
|
||||
"time": "2021-05-12T13:19:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/metadata-minifier",
|
||||
@@ -12191,7 +12282,9 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"makingcg/vuefilemanager-invoicing": 20
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Oasis;
|
||||
|
||||
use App\Models\Oasis\Client;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ClientFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Client::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'id' => $this->faker->uuid,
|
||||
'user_id' => $this->faker->uuid,
|
||||
'name' => $this->faker->company,
|
||||
'email' => $this->faker->email,
|
||||
'phone_number' => $this->faker->phoneNumber,
|
||||
'address' => $this->faker->address,
|
||||
'city' => $this->faker->city,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country' => $this->faker->randomElement(
|
||||
['SK', 'CZ', 'DE', 'FR']
|
||||
),
|
||||
'ico' => $this->faker->numberBetween(11111111, 99999999),
|
||||
'dic' => $this->faker->numberBetween(11111111, 99999999),
|
||||
'ic_dph' => 'CZ' . $this->faker->numberBetween(1111111111, 9999999999),
|
||||
'created_at' => $this->faker->dateTimeBetween(
|
||||
$startDate = '-6 months', $endDate = 'now', $timezone = null
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Oasis;
|
||||
|
||||
use App\Models\Oasis\Invoice;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class InvoiceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Invoice::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'id' => $this->faker->uuid,
|
||||
'user_id' => $this->faker->uuid,
|
||||
'client_id' => $this->faker->uuid,
|
||||
'invoice_type' => $this->faker->randomElement([
|
||||
'regular-invoice', 'advance-invoice'
|
||||
]),
|
||||
'invoice_number' => $this->faker->numberBetween(2120001, 2120999),
|
||||
'variable_number' => $this->faker->numberBetween(2120001, 2120999),
|
||||
'currency' => $this->faker->randomElement([
|
||||
'CZK', 'EUR'
|
||||
]),
|
||||
'user' => [],
|
||||
'client' => [
|
||||
'name' => $this->faker->company,
|
||||
'email' => $this->faker->email,
|
||||
'phone_number' => $this->faker->phoneNumber,
|
||||
'address' => $this->faker->address,
|
||||
'city' => $this->faker->city,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country' => $this->faker->randomElement(
|
||||
['SK', 'CZ', 'DE', 'FR']
|
||||
),
|
||||
'ico' => $this->faker->numberBetween(11111111, 99999999),
|
||||
'dic' => $this->faker->numberBetween(11111111, 99999999),
|
||||
'ic_dph' => 'CZ' . $this->faker->numberBetween(1111111111, 9999999999),
|
||||
],
|
||||
'items' => [
|
||||
[
|
||||
'description' => $this->faker->realText(60),
|
||||
'amount' => $this->faker->numberBetween(1, 3),
|
||||
'tax_rate' => 20,
|
||||
'price' => $this->faker->randomElement([120, 360, 400, 80, 90, 45, 16, 8]),
|
||||
],
|
||||
[
|
||||
'description' => $this->faker->realText(60),
|
||||
'amount' => $this->faker->numberBetween(1, 3),
|
||||
'tax_rate' => 20,
|
||||
'price' => $this->faker->randomElement([120, 360, 400, 80, 90, 45, 16, 8]),
|
||||
],
|
||||
],
|
||||
'discount_type' => $this->faker->randomElement(['percent', 'value', null]),
|
||||
'delivery_at' => $this->faker->dateTimeBetween(
|
||||
$startDate = '-6 months', $endDate = 'now', $timezone = null
|
||||
),
|
||||
'created_at' => $this->faker->dateTimeBetween(
|
||||
$startDate = '-6 months', $endDate = 'now', $timezone = null
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the model factory.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
return $this->afterCreating(function (Invoice $invoice) {
|
||||
if ($invoice->discount_type === 'percent') {
|
||||
$invoice->discount_rate = $this->faker->randomElement([2, 5, 10, 15, 20]);
|
||||
}
|
||||
|
||||
if ($invoice->discount_type === 'value') {
|
||||
$invoice->discount_rate = $this->faker->randomElement([20, 10]);
|
||||
}
|
||||
|
||||
$invoice->save();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Oasis;
|
||||
|
||||
use App\Models\Oasis\InvoiceProfile;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class InvoiceProfileFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = InvoiceProfile::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'id' => $this->faker->uuid,
|
||||
'user_id' => $this->faker->uuid,
|
||||
'company' => $this->faker->company,
|
||||
'logo' => '',
|
||||
'email' => $this->faker->email,
|
||||
'ico' => rand(11111111, 99999999),
|
||||
'dic' => rand(11111111, 99999999),
|
||||
'ic_dph' => 'SK' . rand(111111111111, 999999999999),
|
||||
'registration_notes' => $this->faker->realText(80),
|
||||
'author' => $this->faker->name,
|
||||
'stamp' => '',
|
||||
'address' => $this->faker->address,
|
||||
'state' => $this->faker->state,
|
||||
'city' => $this->faker->city,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country' => $this->faker->randomElement([
|
||||
'SK', 'CZ', 'DE', 'FR'
|
||||
]),
|
||||
'phone' => $this->faker->phoneNumber,
|
||||
'bank' => $this->faker->randomElement([
|
||||
'Fio Banka', 'Tatra Banka'
|
||||
]),
|
||||
'iban' => $this->faker->iban('CZ'),
|
||||
'swift' => $this->faker->swiftBicNumber,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateInvoicesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoices', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary()->index();
|
||||
$table->uuid('user_id')->index();
|
||||
$table->uuid('client_id')->nullable()->index();
|
||||
|
||||
$table->enum('invoice_type', [
|
||||
'regular-invoice', 'advance-invoice'
|
||||
]);
|
||||
|
||||
$table->text('invoice_number')->nullable();
|
||||
$table->text('variable_number')->nullable();
|
||||
|
||||
$table->longText('client');
|
||||
$table->longText('user');
|
||||
$table->longText('items');
|
||||
|
||||
$table->date('delivery_at')->nullable();
|
||||
$table->dateTime('due_at')->nullable();
|
||||
|
||||
$table->enum('discount_type', [
|
||||
'percent', 'value'
|
||||
])->nullable();
|
||||
$table->integer('discount_rate')->nullable();
|
||||
|
||||
$table->text('currency');
|
||||
|
||||
$table->string('total_net')->nullable();
|
||||
$table->string('total_tax')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoices');
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateClientsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('clients', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary()->index();
|
||||
$table->uuid('user_id')->index();
|
||||
|
||||
$table->text('name');
|
||||
$table->text('avatar')->nullable();
|
||||
|
||||
$table->text('email')->nullable();
|
||||
$table->text('phone_number')->nullable();
|
||||
|
||||
$table->text('address')->nullable();
|
||||
$table->text('city')->nullable();
|
||||
$table->text('postal_code')->nullable();
|
||||
$table->text('country')->nullable();
|
||||
|
||||
$table->text('ico')->nullable();
|
||||
$table->text('dic')->nullable();
|
||||
$table->text('ic_dph')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('clients');
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateInvoiceProfilesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoice_profiles', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary()->index();
|
||||
$table->uuid('user_id')->index();
|
||||
|
||||
$table->text('company')->nullable();
|
||||
$table->string('logo')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('phone')->nullable();
|
||||
|
||||
$table->text('address')->nullable();
|
||||
$table->text('state')->nullable();
|
||||
$table->text('city')->nullable();
|
||||
$table->text('postal_code')->nullable();
|
||||
$table->text('country')->nullable();
|
||||
|
||||
$table->string('ico')->nullable();
|
||||
$table->string('dic')->nullable();
|
||||
$table->string('ic_dph')->nullable();
|
||||
|
||||
$table->text('registration_notes')->nullable();
|
||||
|
||||
$table->text('bank')->nullable();
|
||||
$table->string('iban')->nullable();
|
||||
$table->string('swift')->nullable();
|
||||
|
||||
$table->string('author')->nullable();
|
||||
$table->string('stamp')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoice_profiles');
|
||||
}
|
||||
}
|
||||
@@ -1,93 +1,114 @@
|
||||
{
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~4509a016.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~4509a016.js?id=195bc845f51ce6d36498",
|
||||
"/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~e360f8a1.js": "/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~e360f8a1.js?id=40bff66dbabd620a5c7e",
|
||||
"/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~40cda2f4.js": "/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~40cda2f4.js?id=c3203130039da465a7d3",
|
||||
"/chunks/admin~chunks/oasis/invoices~chunks/platform~chunks/shared.js": "/chunks/admin~chunks/oasis/invoices~chunks/platform~chunks/shared.js?id=b1b8e6c2481a414ca4f7",
|
||||
"/chunks/files~chunks/oasis/invoices/list~chunks/shared/file-browser.js": "/chunks/files~chunks/oasis/invoices/list~chunks/shared/file-browser.js?id=8754c1ac780767414ce0",
|
||||
"/chunks/files~chunks/shared/file-browser~chunks/shared/single-file.js": "/chunks/files~chunks/shared/file-browser~chunks/shared/single-file.js?id=f7ba959865708b74aef5",
|
||||
"/vendors~chunks/oasis/invoices~chunks/platform~chunks/shared.js": "/vendors~chunks/oasis/invoices~chunks/platform~chunks/shared.js?id=44a3217593d9f71d702d",
|
||||
"/chunks/admin.js": "/chunks/admin.js?id=a90bf8811291e010df46",
|
||||
"/chunks/dashboard~chunks/dashboard-oasis.js": "/chunks/dashboard~chunks/dashboard-oasis.js?id=aa4de94799f0d6359f96",
|
||||
"/chunks/files~chunks/shared/file-browser.js": "/chunks/files~chunks/shared/file-browser.js?id=6863be7ae651919065a9",
|
||||
"/js/main.js": "/js/main.js?id=d6379a33f108c8da5b8d",
|
||||
"/css/app.css": "/css/app.css?id=e9183e52105da8549dfd",
|
||||
"/chunks/admin-account.js": "/chunks/admin-account.js?id=800a54b12ef6257507d5",
|
||||
"/chunks/app-appearance.js": "/chunks/app-appearance.js?id=1c1b83566868a90dd8e9",
|
||||
"/chunks/app-billings.js": "/chunks/app-billings.js?id=ffdebe1a9e985d043bb1",
|
||||
"/chunks/app-email.js": "/chunks/app-email.js?id=0a30b4f964b30c34ac14",
|
||||
"/chunks/app-index.js": "/chunks/app-index.js?id=5911c461bb12e6809df3",
|
||||
"/chunks/app-language.js": "/chunks/app-language.js?id=2f45b27675d7b2796351",
|
||||
"/chunks/app-others.js": "/chunks/app-others.js?id=5ca619d9d98d0948d457",
|
||||
"/chunks/app-payments.js": "/chunks/app-payments.js?id=f96b5d5874e7cb2e5a85",
|
||||
"/chunks/app-settings.js": "/chunks/app-settings.js?id=dfd81d8780a29fae1c51",
|
||||
"/chunks/app-setup.js": "/chunks/app-setup.js?id=c98df061fd25143ee592",
|
||||
"/chunks/billings-detail.js": "/chunks/billings-detail.js?id=56b76453c25a36f8982b",
|
||||
"/chunks/contact-us.js": "/chunks/contact-us.js?id=faeb0ff087099d2338fb",
|
||||
"/chunks/create-new-password.js": "/chunks/create-new-password.js?id=233006f4daf51540a6e5",
|
||||
"/chunks/dashboard.js": "/chunks/dashboard.js?id=a520d5e05f5f3c889918",
|
||||
"/chunks/dashboard-oasis.js": "/chunks/dashboard-oasis.js?id=ed57d28970e9d25a57c7",
|
||||
"/chunks/database.js": "/chunks/database.js?id=5e8858c96d80facd4158",
|
||||
"/chunks/dynamic-page.js": "/chunks/dynamic-page.js?id=d1c5ca1c79b2debac866",
|
||||
"/chunks/environment-setup.js": "/chunks/environment-setup.js?id=a14cbd92bd392981cbd0",
|
||||
"/chunks/files.js": "/chunks/files.js?id=f3f80f4ffa9990321a26",
|
||||
"/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=16a2798ed2eda763f85a",
|
||||
"/chunks/homepage.js": "/chunks/homepage.js?id=172d61f6a78fe8c66bff",
|
||||
"/chunks/installation-disclaimer.js": "/chunks/installation-disclaimer.js?id=27becfa27d2c09b54ae5",
|
||||
"/chunks/invoices.js": "/chunks/invoices.js?id=27a853727d4417256b02",
|
||||
"/chunks/not-found-shared.js": "/chunks/not-found-shared.js?id=1147a3c9625cffbf8743",
|
||||
"/chunks/oasis/homepage.js": "/chunks/oasis/homepage.js?id=d40682da49cec1a2056c",
|
||||
"/chunks/oasis/invoices.js": "/chunks/oasis/invoices.js?id=f40590af47d3e87881e8",
|
||||
"/chunks/oasis/invoices/client.js": "/chunks/oasis/invoices/client.js?id=0800ccae10be5349c8de",
|
||||
"/chunks/oasis/invoices/client-detail.js": "/chunks/oasis/invoices/client-detail.js?id=ea9620cce66b649f9125",
|
||||
"/chunks/oasis/invoices/client-invoices.js": "/chunks/oasis/invoices/client-invoices.js?id=77bd22b0313cab88ec61",
|
||||
"/chunks/oasis/invoices/create-client.js": "/chunks/oasis/invoices/create-client.js?id=27adbe42488c8081359f",
|
||||
"/chunks/oasis/invoices/create-invoice.js": "/chunks/oasis/invoices/create-invoice.js?id=3e52f7809f7e49417ba0",
|
||||
"/chunks/oasis/invoices/edit-invoice.js": "/chunks/oasis/invoices/edit-invoice.js?id=f946ffc9bf91ad585d96",
|
||||
"/chunks/oasis/invoices/list.js": "/chunks/oasis/invoices/list.js?id=55e5a0f10cd50f73e71a",
|
||||
"/chunks/oasis/invoices/profile.js": "/chunks/oasis/invoices/profile.js?id=656ba33790a80c962402",
|
||||
"/chunks/oasis/platba.js": "/chunks/oasis/platba.js?id=ce165f5e168c74681d5b",
|
||||
"/chunks/oasis/sign-up.js": "/chunks/oasis/sign-up.js?id=265fd13102e82de6c885",
|
||||
"/chunks/oasis/upgrade-billing.js": "/chunks/oasis/upgrade-billing.js?id=62d7e569a508b89efbda",
|
||||
"/chunks/oasis/upgrade-plan.js": "/chunks/oasis/upgrade-plan.js?id=0ff04d189e8012a772a6",
|
||||
"/chunks/oasis/user-create.js": "/chunks/oasis/user-create.js?id=dbbe553b1192f51e3347",
|
||||
"/chunks/oasis/users.js": "/chunks/oasis/users.js?id=90b79a2afd1c1af0de93",
|
||||
"/chunks/page-edit.js": "/chunks/page-edit.js?id=f461a854720e430167ad",
|
||||
"/chunks/pages.js": "/chunks/pages.js?id=154de6ecf8de75e52986",
|
||||
"/chunks/plan.js": "/chunks/plan.js?id=4017c43bca1e88be52fe",
|
||||
"/chunks/plan-create.js": "/chunks/plan-create.js?id=3858091e1cb4ccbff2a2",
|
||||
"/chunks/plan-delete.js": "/chunks/plan-delete.js?id=59fce90e14b91b926134",
|
||||
"/chunks/plan-settings.js": "/chunks/plan-settings.js?id=3d5c890c879c318877ec",
|
||||
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=3aeb7347662acca51436",
|
||||
"/chunks/plans.js": "/chunks/plans.js?id=de86874e55eec9384139",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=e960062bdcc0f26132a8",
|
||||
"/chunks/profile.js": "/chunks/profile.js?id=b0f4b9f9ded460ba6f0f",
|
||||
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=bcfbccee713a4915aa3d",
|
||||
"/chunks/settings.js": "/chunks/settings.js?id=dd11a55964c72fc86e8f",
|
||||
"/chunks/settings-create-payment-methods.js": "/chunks/settings-create-payment-methods.js?id=4f258d7ae720f6058cdc",
|
||||
"/chunks/settings-invoices.js": "/chunks/settings-invoices.js?id=cab4472faa901c1bbf0a",
|
||||
"/chunks/settings-password.js": "/chunks/settings-password.js?id=4b6f61865aad9ce1b901",
|
||||
"/chunks/settings-payment-methods.js": "/chunks/settings-payment-methods.js?id=58bbb1d7d4c3b73a46f1",
|
||||
"/chunks/settings-storage.js": "/chunks/settings-storage.js?id=7c18021929c42436c232",
|
||||
"/chunks/settings-subscription.js": "/chunks/settings-subscription.js?id=815fd683f57807826ae1",
|
||||
"/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=d0353ac99122ce69fb7f",
|
||||
"/chunks/shared.js": "/chunks/shared.js?id=66276189545daa439300",
|
||||
"/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=ddb14efefb1b754beddb",
|
||||
"/chunks/shared/file-browser.js": "/chunks/shared/file-browser.js?id=2a90999a1e96c274fbe6",
|
||||
"/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=d6f870eec2d2b4a4400a",
|
||||
"/chunks/sign-in.js": "/chunks/sign-in.js?id=79b669b21e0bcd9c69e3",
|
||||
"/chunks/sign-up.js": "/chunks/sign-up.js?id=188a69077b6b694efcdf",
|
||||
"/chunks/stripe-credentials.js": "/chunks/stripe-credentials.js?id=a71ab09be65541bfe932",
|
||||
"/chunks/subscription-plans.js": "/chunks/subscription-plans.js?id=bf68567befa1a54e245d",
|
||||
"/chunks/subscription-service.js": "/chunks/subscription-service.js?id=fbaf740effbd15eec7ea",
|
||||
"/chunks/upgrade-billing.js": "/chunks/upgrade-billing.js?id=64448adc4e0e2b541fe7",
|
||||
"/chunks/upgrade-plan.js": "/chunks/upgrade-plan.js?id=ca1b7f41502c32648d31",
|
||||
"/chunks/user.js": "/chunks/user.js?id=020eaf5a4df86c951c9e",
|
||||
"/chunks/user-create.js": "/chunks/user-create.js?id=49085ae287fd04da6793",
|
||||
"/chunks/user-delete.js": "/chunks/user-delete.js?id=7d9f71a92cc65984c7d1",
|
||||
"/chunks/user-detail.js": "/chunks/user-detail.js?id=995a0bf595cd43315779",
|
||||
"/chunks/user-invoices.js": "/chunks/user-invoices.js?id=ab6cbcc0968f86cc76ae",
|
||||
"/chunks/user-password.js": "/chunks/user-password.js?id=9991537c31e5be9b7a5e",
|
||||
"/chunks/user-storage.js": "/chunks/user-storage.js?id=97119b2893b1ca5e2b06",
|
||||
"/chunks/user-subscription.js": "/chunks/user-subscription.js?id=11d16c401ebdba04b506",
|
||||
"/chunks/users.js": "/chunks/users.js?id=9181ac549cb36558a19c"
|
||||
"/js/main.js": "/js/main.js",
|
||||
"/css/app.css": "/css/app.css",
|
||||
"/chunks/admin.js": "/chunks/admin.js?id=3048a34ebd4668893224",
|
||||
"/chunks/admin-account.js": "/chunks/admin-account.js?id=8d842bebde408d97b8e4",
|
||||
"/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~e360f8a1.js": "/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~e360f8a1.js?id=9a997811677c9fcc0c6e",
|
||||
"/chunks/admin-account~chunks/app-setup~chunks/billings-detail~chunks/create-new-password~chunks/datab~062c965c.js": "/chunks/admin-account~chunks/app-setup~chunks/billings-detail~chunks/create-new-password~chunks/datab~062c965c.js?id=515118382f7ad5724a54",
|
||||
"/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~56ae6336.js": "/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~56ae6336.js?id=3500df10c19053acd77b",
|
||||
"/chunks/admin~chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/sh~d177b2e8.js": "/chunks/admin~chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/sh~d177b2e8.js?id=a387d2c725058d00da7d",
|
||||
"/chunks/admin~chunks/files~chunks/oasis/invoices~chunks/settings~chunks/shared/file-browser.js": "/chunks/admin~chunks/files~chunks/oasis/invoices~chunks/settings~chunks/shared/file-browser.js?id=e15b67406596821c2be9",
|
||||
"/chunks/admin~chunks/oasis/invoices~chunks/platform.js": "/chunks/admin~chunks/oasis/invoices~chunks/platform.js?id=6b26b3e293cd0f376a73",
|
||||
"/chunks/admin~chunks/oasis/invoices~chunks/platform~chunks/shared.js": "/chunks/admin~chunks/oasis/invoices~chunks/platform~chunks/shared.js?id=1ca47708816a4be47a0a",
|
||||
"/chunks/app-appearance.js": "/chunks/app-appearance.js?id=1c320a815afcc355bae7",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~262a2a36.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~262a2a36.js?id=e6505b93727b56256f92",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~2e0b85bd.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~2e0b85bd.js?id=d4fb46f05374a298ac1b",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~c329baf3.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~c329baf3.js?id=917423b1c6ec5a0c7435",
|
||||
"/chunks/app-billings.js": "/chunks/app-billings.js?id=2bbe6337f28ee663e2ef",
|
||||
"/chunks/app-email.js": "/chunks/app-email.js?id=069bcdd39373a75f8270",
|
||||
"/chunks/app-index.js": "/chunks/app-index.js?id=6fd365716d797307517b",
|
||||
"/chunks/app-language.js": "/chunks/app-language.js?id=6353a4c87d14aec62efb",
|
||||
"/chunks/app-language~chunks/app-settings~chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chun~93101a7f.js": "/chunks/app-language~chunks/app-settings~chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chun~93101a7f.js?id=93fb27b76209e5b7b2d9",
|
||||
"/chunks/app-language~chunks/dashboard~chunks/dashboard-oasis~chunks/files~chunks/invoices~chunks/oasi~78bb4d4b.js": "/chunks/app-language~chunks/dashboard~chunks/dashboard-oasis~chunks/files~chunks/invoices~chunks/oasi~78bb4d4b.js?id=1f922f753ccc5064dbe1",
|
||||
"/chunks/app-others.js": "/chunks/app-others.js?id=764423f8911acbc659a9",
|
||||
"/chunks/app-payments.js": "/chunks/app-payments.js?id=4ecc19e6297a15de5278",
|
||||
"/chunks/app-settings.js": "/chunks/app-settings.js?id=acc6ba7a93681f0d5d64",
|
||||
"/chunks/app-setup.js": "/chunks/app-setup.js?id=e19bd2887ed43d5bfe91",
|
||||
"/chunks/billings-detail.js": "/chunks/billings-detail.js?id=7df1b3539a19b34d2d03",
|
||||
"/chunks/contact-us.js": "/chunks/contact-us.js?id=5d26cf9527766c281c2a",
|
||||
"/chunks/contact-us~chunks/dynamic-page~chunks/homepage.js": "/chunks/contact-us~chunks/dynamic-page~chunks/homepage.js?id=22bd5db44c72e8de5f5b",
|
||||
"/chunks/create-new-password.js": "/chunks/create-new-password.js?id=48dc53ccbd502c2739ec",
|
||||
"/chunks/dashboard.js": "/chunks/dashboard.js?id=55a783975e40f9dcf31b",
|
||||
"/chunks/dashboard-oasis.js": "/chunks/dashboard-oasis.js?id=8b37095a96ece7d6c1d8",
|
||||
"/chunks/dashboard~chunks/dashboard-oasis.js": "/chunks/dashboard~chunks/dashboard-oasis.js?id=67a4a8d617c2e38cb1f3",
|
||||
"/chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chunks/oasis/invoices/client-invoices~chunks~4ba83fa1.js": "/chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chunks/oasis/invoices/client-invoices~chunks~4ba83fa1.js?id=2e029bf012cccfd18e6c",
|
||||
"/chunks/database.js": "/chunks/database.js?id=d94b18f487382a1a8021",
|
||||
"/chunks/dynamic-page.js": "/chunks/dynamic-page.js?id=17cbd34e8c621c7a93e5",
|
||||
"/chunks/dynamic-page~chunks/oasis/homepage.js": "/chunks/dynamic-page~chunks/oasis/homepage.js?id=9840011d02134efd9210",
|
||||
"/chunks/environment-setup.js": "/chunks/environment-setup.js?id=b42ed6eea4625ce1c2db",
|
||||
"/chunks/files.js": "/chunks/files.js?id=af40942fb64ed6bbdd99",
|
||||
"/chunks/files~chunks/oasis/invoices/list~chunks/oasis/platba~chunks/settings-subscription~chunks/shar~32471b3c.js": "/chunks/files~chunks/oasis/invoices/list~chunks/oasis/platba~chunks/settings-subscription~chunks/shar~32471b3c.js?id=793a4093a170b7021e1a",
|
||||
"/chunks/files~chunks/oasis/invoices/list~chunks/platform~chunks/shared/file-browser.js": "/chunks/files~chunks/oasis/invoices/list~chunks/platform~chunks/shared/file-browser.js?id=3c89f716b5797441dd98",
|
||||
"/chunks/files~chunks/oasis/invoices/list~chunks/shared/file-browser.js": "/chunks/files~chunks/oasis/invoices/list~chunks/shared/file-browser.js?id=2d5163fd2869304720da",
|
||||
"/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~40cda2f4.js": "/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~40cda2f4.js?id=25a8f2ba10196cc72353",
|
||||
"/chunks/files~chunks/oasis/invoices~chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/s~3fd62fd8.js": "/chunks/files~chunks/oasis/invoices~chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/s~3fd62fd8.js?id=d39c8f198b09bb094e80",
|
||||
"/chunks/files~chunks/shared/file-browser.js": "/chunks/files~chunks/shared/file-browser.js?id=b7472ffd394e412cab33",
|
||||
"/chunks/files~chunks/shared/file-browser~chunks/shared/single-file.js": "/chunks/files~chunks/shared/file-browser~chunks/shared/single-file.js?id=eb79ae61af1b37bcfd7f",
|
||||
"/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=877a9289b77ac3885042",
|
||||
"/chunks/homepage.js": "/chunks/homepage.js?id=1a86b7f0efa95ad65c4a",
|
||||
"/chunks/installation-disclaimer.js": "/chunks/installation-disclaimer.js?id=561f2ef3cdde4f64c18c",
|
||||
"/chunks/invoices.js": "/chunks/invoices.js?id=733a4a9b02203923e96b",
|
||||
"/chunks/not-found-shared.js": "/chunks/not-found-shared.js?id=7fc7f9b6f10bdfac770e",
|
||||
"/chunks/oasis/homepage.js": "/chunks/oasis/homepage.js?id=a1885dd8814f9eb63a1c",
|
||||
"/chunks/oasis/invoices.js": "/chunks/oasis/invoices.js?id=92a5a7559d95a87b3753",
|
||||
"/chunks/oasis/invoices/client.js": "/chunks/oasis/invoices/client.js?id=5278e4b3fec7c313b500",
|
||||
"/chunks/oasis/invoices/client-detail.js": "/chunks/oasis/invoices/client-detail.js?id=f04d993baccf515554db",
|
||||
"/chunks/oasis/invoices/client-invoices.js": "/chunks/oasis/invoices/client-invoices.js?id=6558d35b1bfe20e8ede6",
|
||||
"/chunks/oasis/invoices/create-client.js": "/chunks/oasis/invoices/create-client.js?id=a27824905ee00e5b9d5e",
|
||||
"/chunks/oasis/invoices/create-invoice.js": "/chunks/oasis/invoices/create-invoice.js?id=da39947baccf666a1efc",
|
||||
"/chunks/oasis/invoices/edit-invoice.js": "/chunks/oasis/invoices/edit-invoice.js?id=b8776f1c1d5b8b0626da",
|
||||
"/chunks/oasis/invoices/list.js": "/chunks/oasis/invoices/list.js?id=fe9326d4268e817e3c58",
|
||||
"/chunks/oasis/invoices/profile.js": "/chunks/oasis/invoices/profile.js?id=cb529bbeb676d24b011e",
|
||||
"/chunks/oasis/invoices~chunks/platform~chunks/shared.js": "/chunks/oasis/invoices~chunks/platform~chunks/shared.js?id=14c791d5a02c82b747e9",
|
||||
"/chunks/oasis/platba.js": "/chunks/oasis/platba.js?id=791bf891bb4a384c0890",
|
||||
"/chunks/oasis/platba~chunks/oasis/upgrade-billing~chunks/oasis/upgrade-plan~chunks/upgrade-billing~ch~6880400b.js": "/chunks/oasis/platba~chunks/oasis/upgrade-billing~chunks/oasis/upgrade-plan~chunks/upgrade-billing~ch~6880400b.js?id=0c8d1c3cca084baa177f",
|
||||
"/chunks/oasis/sign-up.js": "/chunks/oasis/sign-up.js?id=e53eeb48ebabae259f9c",
|
||||
"/chunks/oasis/upgrade-billing.js": "/chunks/oasis/upgrade-billing.js?id=3008775e9c2b22f22215",
|
||||
"/chunks/oasis/upgrade-plan.js": "/chunks/oasis/upgrade-plan.js?id=b0148f9d17a29bc32736",
|
||||
"/chunks/oasis/user-create.js": "/chunks/oasis/user-create.js?id=23c05f1f2af5c8ed5f93",
|
||||
"/chunks/oasis/users.js": "/chunks/oasis/users.js?id=d15e1dd3ad4aa6cd8a77",
|
||||
"/chunks/page-edit.js": "/chunks/page-edit.js?id=9ccfe006fcd9ef785a61",
|
||||
"/chunks/pages.js": "/chunks/pages.js?id=7a1843e7aaeeaa111dc8",
|
||||
"/chunks/plan.js": "/chunks/plan.js?id=ac3046761e9083aa3053",
|
||||
"/chunks/plan-create.js": "/chunks/plan-create.js?id=5fc3fd093be62eea931e",
|
||||
"/chunks/plan-delete.js": "/chunks/plan-delete.js?id=ac08dc4225f7440d0512",
|
||||
"/chunks/plan-settings.js": "/chunks/plan-settings.js?id=311e6ea9254d8f5423a0",
|
||||
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=146c53671951b7061131",
|
||||
"/chunks/plans.js": "/chunks/plans.js?id=d4cfc1b66dd5021a3c84",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=32656f7d130ecbe06f12",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=a66981c626d89a234103",
|
||||
"/chunks/profile.js": "/chunks/profile.js?id=42695eb6d8ab8b0220d9",
|
||||
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=4873b06c3bbca3fe2c36",
|
||||
"/chunks/settings.js": "/chunks/settings.js?id=fcc97a29894164e2977c",
|
||||
"/chunks/settings-create-payment-methods.js": "/chunks/settings-create-payment-methods.js?id=16b924e46bb6731fb294",
|
||||
"/chunks/settings-invoices.js": "/chunks/settings-invoices.js?id=9d3c3ed48e31da008b33",
|
||||
"/chunks/settings-password.js": "/chunks/settings-password.js?id=0277b40c37adc464b97d",
|
||||
"/chunks/settings-payment-methods.js": "/chunks/settings-payment-methods.js?id=bfca271280566258f0b6",
|
||||
"/chunks/settings-storage.js": "/chunks/settings-storage.js?id=3763d6291aa27e295a81",
|
||||
"/chunks/settings-subscription.js": "/chunks/settings-subscription.js?id=d44d995362fe6567fc11",
|
||||
"/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=c6b88005b133268ed88f",
|
||||
"/chunks/shared.js": "/chunks/shared.js?id=a2c4342bfddd4946cb85",
|
||||
"/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=3d5c7754d438830a4204",
|
||||
"/chunks/shared/file-browser.js": "/chunks/shared/file-browser.js?id=f46e9dc63c1313bc2256",
|
||||
"/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=e8aedb75df7fe227d693",
|
||||
"/chunks/sign-in.js": "/chunks/sign-in.js?id=1d2f0d12e71a2eae51f1",
|
||||
"/chunks/sign-up.js": "/chunks/sign-up.js?id=ce15b1156cf37c0a9703",
|
||||
"/chunks/stripe-credentials.js": "/chunks/stripe-credentials.js?id=4c45fae14fd222237a62",
|
||||
"/chunks/subscription-plans.js": "/chunks/subscription-plans.js?id=53e92bad3f19ffcd7bb0",
|
||||
"/chunks/subscription-service.js": "/chunks/subscription-service.js?id=7011390fa6d368070d72",
|
||||
"/chunks/upgrade-billing.js": "/chunks/upgrade-billing.js?id=3541c0262320aeaf0749",
|
||||
"/chunks/upgrade-plan.js": "/chunks/upgrade-plan.js?id=e9c46003e82194e85439",
|
||||
"/chunks/user.js": "/chunks/user.js?id=3090bfd5b85dd1b200ec",
|
||||
"/chunks/user-create.js": "/chunks/user-create.js?id=d4c1fc74ca50973925b3",
|
||||
"/chunks/user-delete.js": "/chunks/user-delete.js?id=9b2354c223ea128603d6",
|
||||
"/chunks/user-detail.js": "/chunks/user-detail.js?id=84eada5c23af5d5a22d5",
|
||||
"/chunks/user-invoices.js": "/chunks/user-invoices.js?id=e1a81d02e60bba5770d7",
|
||||
"/chunks/user-password.js": "/chunks/user-password.js?id=ddf2709371236446ae98",
|
||||
"/chunks/user-storage.js": "/chunks/user-storage.js?id=38f3edba743a7448f8e6",
|
||||
"/chunks/user-subscription.js": "/chunks/user-subscription.js?id=32b823b73166fcaf70c4",
|
||||
"/chunks/users.js": "/chunks/users.js?id=178dc8d8c83a43d6e77f",
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~4509a016.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~4509a016.js?id=ea781ec6ec7cf0645e05",
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~66c4fa45.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~66c4fa45.js?id=accf0be7f09c1000b571",
|
||||
"/vendors~chunks/files~chunks/oasis/invoices~chunks/platform~chunks/shared~chunks/shared/file-browser~~b42d96c6.js": "/vendors~chunks/files~chunks/oasis/invoices~chunks/platform~chunks/shared~chunks/shared/file-browser~~b42d96c6.js?id=a564e3b9054e42dda63f",
|
||||
"/vendors~chunks/oasis/invoices~chunks/platform~chunks/shared.js": "/vendors~chunks/oasis/invoices~chunks/platform~chunks/shared.js?id=03d3cf785cbafa4d31f0"
|
||||
}
|
||||
|
||||
346
resources/sass/oasis/invoice.scss
vendored
346
resources/sass/oasis/invoice.scss
vendored
@@ -1,346 +0,0 @@
|
||||
$primary-color: #bc30fd;
|
||||
$text-color: #1B2539;
|
||||
$border-color: #D8D8D8;
|
||||
$background-color: #F4F5F6;
|
||||
$border-radius: 15px;
|
||||
|
||||
@mixin font-size($size) {
|
||||
font-size:(($size*1.6)/16) + 0em;
|
||||
}
|
||||
|
||||
* {
|
||||
outline: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: $text-color;
|
||||
}
|
||||
|
||||
*, html, body, h1, h2, h3, h4, p, span, b, strong {
|
||||
font-family: 'Nunito', serif;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: -webkit-flex;
|
||||
-webkit-flex-wrap: nowrap;
|
||||
width: 100%;
|
||||
|
||||
&.spaces {
|
||||
margin: 0 -15px;
|
||||
|
||||
div[class^='col-'] {
|
||||
padding: 0 15px;
|
||||
}
|
||||
}
|
||||
|
||||
div[class^='col-'] {
|
||||
-webkit-flex-grow: 1;
|
||||
|
||||
&.align-right {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.col-left, .col-right {
|
||||
width: 49%;
|
||||
}
|
||||
|
||||
&.align-center div[class^='col-'] {
|
||||
-webkit-align-self: center;
|
||||
}
|
||||
&.align-bottom div[class^='col-'] {
|
||||
-webkit-align-self: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.invoice-header {
|
||||
|
||||
.col-left, .col-right {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.logo {
|
||||
margin-bottom: 5px;
|
||||
display: block;
|
||||
width: 260px;
|
||||
}
|
||||
|
||||
.email, .phone {
|
||||
display: block;
|
||||
@include font-size(7);
|
||||
font-weight: 400;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
line-height: 1;
|
||||
padding-bottom: 5px;
|
||||
@include font-size(16);
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: $primary-color;
|
||||
font-weight: 600;
|
||||
@include font-size(11);
|
||||
}
|
||||
|
||||
h4 {
|
||||
color: $text-color;
|
||||
font-weight: 600;
|
||||
@include font-size(7);
|
||||
}
|
||||
}
|
||||
|
||||
.supplier {
|
||||
float: right;
|
||||
max-width: 600px;
|
||||
|
||||
.box {
|
||||
background: $background-color;
|
||||
border-radius: $border-radius;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.dates {
|
||||
margin-top: 10px;
|
||||
|
||||
p {
|
||||
text-align: right;
|
||||
@include font-size(9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.special-wrapper {
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px dashed $border-color;
|
||||
margin: 0 -5px 25px;
|
||||
|
||||
.special-item {
|
||||
background: $background-color;
|
||||
border-radius: 8px;
|
||||
display: inline-block;
|
||||
width: 20.9%;
|
||||
margin: 0 5px;
|
||||
|
||||
&:nth-child(1) {
|
||||
width: 31.5%;
|
||||
}
|
||||
|
||||
.padding {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
}
|
||||
|
||||
b {
|
||||
color: $primary-color;
|
||||
@include font-size(9);
|
||||
font-weight: 600;
|
||||
margin-bottom: 5px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
span {
|
||||
@include font-size(10);
|
||||
font-weight: 600;
|
||||
word-break: break-word;
|
||||
overflow-wrap: break-word;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.table {
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
|
||||
.table-row {
|
||||
|
||||
&:nth-child(even) {
|
||||
background-color: $background-color;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.table-cell {
|
||||
text-align: left;
|
||||
word-break: break-word;
|
||||
padding: 5px;
|
||||
|
||||
span, a {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
width: 280px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
text-align: right;
|
||||
padding-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tbody {
|
||||
.table-row {
|
||||
padding: 5px 0;
|
||||
}
|
||||
}
|
||||
|
||||
thead {
|
||||
background-color: white !important;
|
||||
padding-bottom: 15px;
|
||||
border-bottom: 0;
|
||||
|
||||
.table-cell {
|
||||
|
||||
span {
|
||||
color: $primary-color;
|
||||
font-weight: 600;
|
||||
@include font-size(9);
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-cell {
|
||||
word-break: break-all;
|
||||
|
||||
span, a {
|
||||
vertical-align: middle;
|
||||
font-weight: 600;
|
||||
@include font-size(9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.summary {
|
||||
max-width: 300px;
|
||||
margin: 15px 0 10px auto;
|
||||
text-align: right;
|
||||
|
||||
li {
|
||||
padding: 2px 0;
|
||||
display: block;
|
||||
|
||||
b, span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.col-full {
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
@include font-size(10);
|
||||
}
|
||||
|
||||
b {
|
||||
@include font-size(13);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.notes {
|
||||
padding-top: 20px;
|
||||
border-top: 1px dashed $border-color;
|
||||
}
|
||||
|
||||
.invoice-author {
|
||||
display: -webkit-flex;
|
||||
-webkit-justify-content: space-between;
|
||||
-webkit-align-items: flex-end;
|
||||
padding-bottom: 25px;
|
||||
|
||||
.sign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
img {
|
||||
max-height: 125px;
|
||||
display: block;
|
||||
margin: 0 0 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
.invoice-footer {
|
||||
padding-top: 15px;
|
||||
border-top: 1px dashed $border-color;
|
||||
text-align: center;
|
||||
|
||||
p {
|
||||
@include font-size(10);
|
||||
}
|
||||
|
||||
a {
|
||||
color: $primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: $primary-color;
|
||||
font-weight: 600;
|
||||
padding-bottom: 8px;
|
||||
@include font-size(10);
|
||||
}
|
||||
|
||||
p, span {
|
||||
font-weight: 600;
|
||||
padding-bottom: 4px;
|
||||
@include font-size(10);
|
||||
color: $text-color;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
color: $primary-color;
|
||||
}
|
||||
|
||||
section, header {
|
||||
border-bottom: 1px dashed $border-color;
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.address, .number {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.content-box {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.thank-you {
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
footer {
|
||||
|
||||
.stamp {
|
||||
max-width: 200px;
|
||||
display: block;
|
||||
margin: 0 0 0 auto;
|
||||
}
|
||||
|
||||
div {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
h3 {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
|
||||
@if(is_route('invoice-debug'))
|
||||
<link rel="stylesheet" href="{{ mix('css/oasis-invoice.css') }}">
|
||||
|
||||
<style>
|
||||
body {
|
||||
padding: 25px;
|
||||
}
|
||||
</style>
|
||||
@else
|
||||
<link rel="stylesheet" href="{{ public_path('css/oasis-invoice.css') }}">
|
||||
|
||||
<style>
|
||||
.page-break {
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
</style>
|
||||
@endif
|
||||
|
||||
<title>{{ __t('in.invoice') }}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="{{ count($invoice->items) > 8 ? 'page-break' : '' }}">
|
||||
{{--Invoice header--}}
|
||||
<header class="invoice-header">
|
||||
<div class="row">
|
||||
<div class="col-left">
|
||||
|
||||
@if($user->invoiceProfile->logo)
|
||||
<img class="logo" src="{{ base64_from_storage_image($user->invoiceProfile->logo) }}">
|
||||
@else
|
||||
<h1>{{ $user->invoiceProfile->company }}</h1>
|
||||
@endif
|
||||
|
||||
<b class="email">{{ $user->invoiceProfile->email }}</b>
|
||||
<b class="phone">{{ $user->invoiceProfile->phone }}</b>
|
||||
</div>
|
||||
<div class="col-right align-right">
|
||||
@if($invoice->invoice_type === 'regular-invoice')
|
||||
<h1>{{ __t('in.invoice') }} - {{ __t('in.doc.taxable_doc') }}</h1>
|
||||
@endif
|
||||
@if($invoice->invoice_type === 'advance-invoice')
|
||||
<h1>{{ __t('in.invoice') }} - {{ __t('in.doc.advance_doc') }}</h1>
|
||||
@endif
|
||||
<h2>{{ __t('in.doc.number') }}: {{ $invoice->invoice_number }}</h2>
|
||||
<h4>{{ __t('in.doc.variable_symbol') }}: {{ $invoice->variable_number }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!--Supplier-->
|
||||
<section>
|
||||
<div class="supplier">
|
||||
<div class="box" style="width: 500px;">
|
||||
<h3>{{ __t('in.doc.customer') }}:</h3>
|
||||
<p>{{ $invoice->client['name'] }}</p>
|
||||
<p>{{ $invoice->client['address'] }}, {{ $invoice->client['city'] }}</p>
|
||||
<p>{{ $invoice->client['postal_code'] }} {{ $invoice->client['country'] }}</p>
|
||||
|
||||
<div class="single-row">
|
||||
<span>
|
||||
@isset($invoice->client['ico'])
|
||||
<span class="highlight">{{ __t('in_editor.ico') }}</span>: {{ $invoice->client['ico'] }}
|
||||
@endisset
|
||||
@isset($invoice->client['dic'])
|
||||
<span class="highlight">{{ __t('in_editor.dic') }}</span>: {{ $invoice->client['dic'] }}
|
||||
@endisset
|
||||
@isset($invoice->client['ic_dph'])
|
||||
<span class="highlight">{{ __t('in_editor.ic_dph') }}</span>: {{ $invoice->client['ic_dph'] }}
|
||||
@endisset
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dates">
|
||||
<p>{{ __t('in.doc.date_of_issue') }}: {{ format_date($invoice->created_at, '%d. %B %Y') }}</p>
|
||||
<p>{{ __t('in.doc.date_of_delivery') }}: {{ format_date($invoice->delivery_at, '%d. %B %Y') }}</p>
|
||||
<p>{{ __t('in.doc.due_date') }}: {{ format_date($invoice->due_at, '%d. %B %Y') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-box">
|
||||
<h3>{{ __t('in.doc.supplier') }}:</h3>
|
||||
<p style="padding-bottom: 0">{{ $invoice->user['company'] }}</p>
|
||||
<small>{{ $invoice->user['registration_notes'] }}</small>
|
||||
</div>
|
||||
|
||||
<div class="content-box">
|
||||
<h3>{{ __t('in.doc.headquarters') }}:</h3>
|
||||
<p>{{ $invoice->user['address'] }} {{ $invoice->user['city'] }}</p>
|
||||
<p>{{ $invoice->user['postal_code'] }}, {{ $invoice->user['country'] }}</p>
|
||||
</div>
|
||||
|
||||
<div class="content-box" style="padding-bottom: 0px">
|
||||
<h3>{{ __t('user_settings.title_billing') }}:</h3>
|
||||
|
||||
@isset($invoice->user['ico'])
|
||||
<p>{{ __t('in_editor.ico') }}: {{ $invoice->user['ico'] }}</p>
|
||||
@endisset
|
||||
@isset($invoice->user['dic'])
|
||||
<p>{{ __t('in_editor.dic') }}: {{ $invoice->user['dic'] }}</p>
|
||||
@endisset
|
||||
@isset($invoice->user['ic_dph'])
|
||||
<p>{{ __t('in_editor.ic_dph') }}: {{ $invoice->user['ic_dph'] }}</p>
|
||||
@endisset
|
||||
|
||||
<p>{{ $invoice->user['bank'] }}</p>
|
||||
<p>{{ __t('in.form.iban') }}: {{ $invoice->user['iban'] }}, {{ __t('in.form.swift_code') }}: {{ $invoice->user['swift'] }}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{--Special info--}}
|
||||
<div class="special-wrapper">
|
||||
<div class="special-item">
|
||||
<div class="padding">
|
||||
<b>{{ __t('in.doc.bank_account_number') }}:</b>
|
||||
<span>{{ $invoice->user['iban'] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="special-item">
|
||||
<div class="padding">
|
||||
<b>{{ __t('in.doc.variable_symbol') }}:</b>
|
||||
<span>{{ $invoice->variable_number }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="special-item">
|
||||
<div class="padding">
|
||||
<b>{{ __t('in.doc.due_date') }}:</b>
|
||||
<span>{{ format_date($invoice->due_at, '%d. %h. %Y') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="special-item">
|
||||
<div class="padding">
|
||||
<b>{{ __t('in.doc.sum_to_pay') }}:</b>
|
||||
<span>{{ format_to_currency($invoice->total_net) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--Items table--}}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr class="table-row">
|
||||
<td class="table-cell">
|
||||
<span>{{ __t('in.doc.item.name') }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ __t('in.doc.item.amount') }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ __t('in.doc.item.price_per_unit') }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ __t('in.doc.item.total') }}</span>
|
||||
</td>
|
||||
@if($invoice->user['ic_dph'])
|
||||
<td class="table-cell">
|
||||
<span>{{ __t('in.doc.item.vat_rate') }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ __t('in.doc.item.vat') }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ __t('in.doc.item.total_with_vat') }}</span>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach($invoice->items as $item)
|
||||
<tr class="table-row">
|
||||
<td class="table-cell">
|
||||
<span style="word-break: break-word">{{ $item['description'] }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ $item['amount'] }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ format_to_currency($item['price']) }}</span>
|
||||
</td>
|
||||
|
||||
<td class="table-cell">
|
||||
<span>{{ format_to_currency($item['price'] * $item['amount']) }}</span>
|
||||
</td>
|
||||
|
||||
@if($invoice->user['ic_dph'])
|
||||
<td class="table-cell">
|
||||
<span>{{ $item['tax_rate'] }} %</span>
|
||||
</td>
|
||||
@endif
|
||||
|
||||
@if($invoice->user['ic_dph'])
|
||||
<td class="table-cell">
|
||||
<span>{{ format_to_currency(invoice_item_only_tax_price($item)) }}</span>
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span>{{ format_to_currency(invoice_item_with_tax_price($item)) }}</span>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="page-break">
|
||||
{{--Item Summary--}}
|
||||
<ul class="summary">
|
||||
|
||||
@if($invoice->discount_type)
|
||||
<li class="row" style="padding-bottom: 8px">
|
||||
<span>{{ __t('in.doc.discount') }}:</span>
|
||||
<span>-{{ $invoice->discount_type === 'percent' ? $invoice->discount_rate . '%' : format_to_currency($invoice->discount_rate) }}</span>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
{{--VAT Base--}}
|
||||
@if($invoice->user['ic_dph'])
|
||||
<div style="padding-bottom: 8px">
|
||||
@foreach(invoice_tax_base($invoice) as $item)
|
||||
<li class="row">
|
||||
<span>{{ __t('in.doc.vat_base') }} {{ $item['rate'] }}%: </span>
|
||||
<span>{{ format_to_currency($item['total']) }}</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{--VAT Summary--}}
|
||||
@if($invoice->user['ic_dph'])
|
||||
<div style="padding-bottom: 8px">
|
||||
@foreach(invoice_tax_summary($invoice) as $item)
|
||||
<li class="row">
|
||||
<span>{{ __t('in.doc.item.vat') }} {{ $item['rate'] }}%: </span>
|
||||
<span>{{ format_to_currency($item['total']) }}</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<li class="row">
|
||||
<b>{{ __t('in.doc.sum_to_pay') }}:</b>
|
||||
<b>{{ format_to_currency(invoice_total($invoice)) }}</b>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--Notes-->
|
||||
<div class="notes">
|
||||
<p>{{ __t('in.doc.thanks') }}</p>
|
||||
</div>
|
||||
|
||||
{{--Invoice author--}}
|
||||
<div class="invoice-author">
|
||||
<div class="tax-note">
|
||||
@if(! $invoice->user['ic_dph'])
|
||||
<p>{{ __t('in.doc.not_vat_payer') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="sign">
|
||||
@if(is_route('invoice-debug') && $user->invoiceProfile->stamp)
|
||||
<img src="/{{ $user->invoiceProfile->stamp }}">
|
||||
@endif
|
||||
|
||||
@if(! is_route('invoice-debug') && $user->invoiceProfile->stamp)
|
||||
<img src="{{ base64_from_storage_image($user->invoiceProfile->stamp) }}">
|
||||
@endif
|
||||
|
||||
<span class="highlight">{{ __t('in.doc.creator') }}:</span> {{ $invoice->user['author'] }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--Invoice Footer--}}
|
||||
<footer class="invoice-footer">
|
||||
<p>{!! __t('in.doc.created_by_app', ['app_name' => 'OasisDrive.cz', 'url' => 'https://oasisdrive.cz']) !!}</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Oasis\OasisDevService;
|
||||
use App\Http\Controllers\Oasis\AdminController;
|
||||
use App\Http\Controllers\Oasis\ClientController;
|
||||
use App\Http\Controllers\Oasis\InvoiceController;
|
||||
use App\Http\Controllers\Oasis\SubscriptionController;
|
||||
use App\Http\Controllers\Oasis\InvoiceProfileController;
|
||||
|
||||
Route::group(['middleware' => 'api', 'prefix' => '/api/oasis'], function () {
|
||||
// Admin
|
||||
@@ -21,51 +17,9 @@ Route::group(['middleware' => 'api', 'prefix' => '/api/oasis'], function () {
|
||||
Route::get('/{order}', [SubscriptionController::class, 'get_subscription_request']);
|
||||
Route::get('/{order}/setup-intent', [SubscriptionController::class, 'get_setup_intent']);
|
||||
});
|
||||
|
||||
// Invoices
|
||||
Route::group(['middleware' => 'auth:sanctum', 'prefix' => 'invoices'], function () {
|
||||
Route::get('/regular', [InvoiceController::class, 'get_all_regular_invoices']);
|
||||
Route::get('/advance', [InvoiceController::class, 'get_all_advance_invoices']);
|
||||
Route::get('/search', [InvoiceController::class, 'search']);
|
||||
|
||||
Route::get('/profile', [InvoiceProfileController::class, 'show']);
|
||||
Route::post('/profile', [InvoiceProfileController::class, 'store']);
|
||||
Route::patch('/profile', [InvoiceProfileController::class, 'update']);
|
||||
|
||||
Route::get('/editor', [InvoiceController::class, 'editor']);
|
||||
|
||||
Route::get('/{invoice}', [InvoiceController::class, 'get_single_invoice']);
|
||||
Route::delete('/{invoice}', [InvoiceController::class, 'destroy']);
|
||||
Route::post('/{invoice}', [InvoiceController::class, 'update']);
|
||||
Route::post('/{invoice}/share', [InvoiceController::class, 'share']);
|
||||
Route::post('/', [InvoiceController::class, 'store']);
|
||||
});
|
||||
|
||||
// Clients
|
||||
Route::group(['prefix' => 'clients'], function () {
|
||||
Route::get('/', [ClientController::class, 'index']);
|
||||
Route::get('/search', [ClientController::class, 'search']);
|
||||
|
||||
Route::get('/{client}', [ClientController::class, 'show']);
|
||||
Route::get('/{client}/invoices', [ClientController::class, 'show_invoices']);
|
||||
Route::patch('/{client}', [ClientController::class, 'update']);
|
||||
Route::delete('/{client}', [ClientController::class, 'destroy']);
|
||||
|
||||
Route::post('/', [ClientController::class, 'store']);
|
||||
});
|
||||
});
|
||||
|
||||
// Web routes
|
||||
Route::group(['middleware' => 'web', 'prefix' => 'oasis'], function () {
|
||||
Route::post('/subscribe/{order}/set-password', [SubscriptionController::class, 'set_password']);
|
||||
|
||||
// Invoices
|
||||
Route::group(['middleware' => 'auth:sanctum'], function () {
|
||||
Route::get('/invoice/{invoice}', [InvoiceController::class, 'download_invoice']);
|
||||
});
|
||||
});
|
||||
|
||||
// Debug routes
|
||||
Route::group(['middleware' => 'web', 'prefix' => 'oasis/debug'], function () {
|
||||
Route::get('/invoice', [OasisDevService::class, 'get_invoice_view'])->name('invoice-debug');
|
||||
});
|
||||
|
||||
@@ -1,300 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Oasis;
|
||||
|
||||
use App\Models\Oasis\Invoice;
|
||||
use App\Models\Oasis\InvoiceProfile;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use App\Models\Oasis\Client;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class OasisClientTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_test_client_factory()
|
||||
{
|
||||
$client = Client::factory(Client::class)
|
||||
->create();
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'name' => $client->name,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_create_new_client_with_avatar()
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
$avatar = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/clients', [
|
||||
'avatar' => $avatar,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
'phone_number' => '+421 950 123 456',
|
||||
|
||||
'address' => 'Does 12',
|
||||
'city' => 'Bratislava',
|
||||
'postal_code' => '076 54',
|
||||
'country' => 'SK',
|
||||
|
||||
'ico' => '11111111',
|
||||
'dic' => '11111111',
|
||||
'ic_dph' => 'SK11111111',
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
]);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertExists(
|
||||
Client::first()->getRawOriginal('avatar')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_create_new_client_without_avatar_and_contact_info()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/clients', [
|
||||
'avatar' => null,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => null,
|
||||
'phone_number' => null,
|
||||
'address' => 'Does 12',
|
||||
'city' => 'Bratislava',
|
||||
'postal_code' => '076 54',
|
||||
'country' => 'SK',
|
||||
'ico' => '11111111',
|
||||
'dic' => '11111111',
|
||||
'ic_dph' => 'SK11111111',
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_update_client_info()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this->patchJson("/api/oasis/clients/$client->id", [
|
||||
'name' => 'name',
|
||||
'value' => 'VueFileManager Inc.',
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_update_client_avatar()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$avatar = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$this->patchJson("/api/oasis/clients/$client->id", [
|
||||
'name' => 'avatar',
|
||||
'avatar' => $avatar,
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseMissing('clients', [
|
||||
'user_id' => $user->id,
|
||||
'avatar' => null,
|
||||
]);
|
||||
|
||||
Storage::disk('local')->assertExists(
|
||||
Client::first()->getRawOriginal('avatar')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_delete_client()
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$avatar = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
Storage::putFileAs('avatar', $avatar, 'fake-image.jpg');
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create([
|
||||
'avatar' => 'avatar/fake-image.jpg',
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$this->deleteJson("/api/oasis/clients/$client->id")
|
||||
->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseMissing('clients', [
|
||||
'id' => $client->id
|
||||
]);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertMissing('avatar/fake-image.jpg');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_single_client()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$this->getJson("/api/oasis/clients/$client->id")
|
||||
->assertJsonFragment([
|
||||
'id' => $client->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_client_client_invoices()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => 2001212,
|
||||
'client' => [
|
||||
'name' => 'VueFileManager Inc.',
|
||||
],
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$this->getJson("/api/oasis/clients/$client->id/invoices")
|
||||
->assertJsonFragment([
|
||||
'id' => $invoice->id,
|
||||
])
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_all_clients()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
Client::factory(Client::class)
|
||||
->count(2)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/clients')
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_search_user_client()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => 'info@company.com',
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/clients/search?query=vue')
|
||||
->assertJsonFragment([
|
||||
'id' => $client->id,
|
||||
])->assertStatus(200);
|
||||
|
||||
$this->getJson('/api/oasis/clients/search?query=inf')
|
||||
->assertJsonFragment([
|
||||
'id' => $client->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Oasis;
|
||||
|
||||
use App\Models\Oasis\InvoiceProfile;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Tests\TestCase;
|
||||
|
||||
class OasisInvoiceProfileTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_user_invoice_profile()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/profile')
|
||||
->assertStatus(200)
|
||||
->assertJsonFragment([
|
||||
'company' => $profile->company,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_store_invoice_profile_with_images()
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
$image = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/invoices/profile', [
|
||||
'company' => 'VueFileManager Inc.',
|
||||
'registration_notes' => 'Some registration notes',
|
||||
'logo' => $image,
|
||||
|
||||
'ico' => '11111111',
|
||||
'dic' => '11111111',
|
||||
'ic_dph' => 'SK20002313123',
|
||||
|
||||
'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' => $image,
|
||||
])->assertStatus(201)
|
||||
->assertJsonFragment([
|
||||
'company' => 'VueFileManager Inc.',
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('invoice_profiles', [
|
||||
'user_id' => $user->id,
|
||||
'company' => 'VueFileManager Inc.',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
]);
|
||||
|
||||
$profile = InvoiceProfile::first();
|
||||
|
||||
Storage::disk('local')->assertExists($profile->logo);
|
||||
Storage::disk('local')->assertExists($profile->stamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_update_invoice_profile_column()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->patchJson('/api/oasis/invoices/profile', [
|
||||
'name' => 'company',
|
||||
'value' => 'VueFileManager Inc.',
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseHas('invoice_profiles', [
|
||||
'user_id' => $user->id,
|
||||
'company' => 'VueFileManager Inc.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_update_invoice_profile_logo()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$image = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$this->patchJson('/api/oasis/invoices/profile', [
|
||||
'name' => 'logo',
|
||||
'logo' => $image,
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseMissing('invoice_profiles', [
|
||||
'logo' => null,
|
||||
]);
|
||||
|
||||
Storage::disk('local')->assertExists(
|
||||
InvoiceProfile::first()->logo
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,802 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Oasis;
|
||||
|
||||
use App\Models\Oasis\Client;
|
||||
use App\Models\Oasis\InvoiceProfile;
|
||||
use App\Notifications\Oasis\InvoiceDeliveryNotification;
|
||||
use PDF;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class OasisInvoiceTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations, Queueable;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->items = [
|
||||
[
|
||||
'description' => "No, I've made up my mind about it; if I'm Mabel, I'll stay.",
|
||||
'amount' => 1,
|
||||
'tax_rate' => 20,
|
||||
'price' => 200,
|
||||
],
|
||||
[
|
||||
'description' => "I only knew the right words,' said poor Alice, who felt.",
|
||||
'amount' => 3,
|
||||
'tax_rate' => 20,
|
||||
'price' => 500,
|
||||
],
|
||||
];
|
||||
|
||||
$this->client = [
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'address' => 'Does 12',
|
||||
'city' => 'Bratislava',
|
||||
'postal_code' => '076 54',
|
||||
'country' => 'SK',
|
||||
'ico' => 11111111,
|
||||
'dic' => 11111111,
|
||||
'ic_dph' => 'SK11111111',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_test_invoice_item_only_tax_price_function()
|
||||
{
|
||||
$item = [
|
||||
'description' => 'Test 1',
|
||||
'amount' => 1,
|
||||
'tax_rate' => 20,
|
||||
'price' => 20,
|
||||
];
|
||||
|
||||
$this->assertEquals(4, invoice_item_only_tax_price($item));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_test_invoice_item_with_tax_price_function()
|
||||
{
|
||||
$item = [
|
||||
'description' => 'Test 1',
|
||||
'amount' => 1,
|
||||
'tax_rate' => 20,
|
||||
'price' => 20,
|
||||
];
|
||||
|
||||
$this->assertEquals(24, invoice_item_with_tax_price($item));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_test_invoice_total_net()
|
||||
{
|
||||
$invoice = [
|
||||
'user' => [
|
||||
'ic_dph' => 43123545233
|
||||
],
|
||||
'discount_type' => null,
|
||||
'currency' => 'CZK',
|
||||
'items' => [
|
||||
[
|
||||
'description' => 'Test 1',
|
||||
'amount' => 1,
|
||||
'tax_rate' => 20,
|
||||
'price' => 20,
|
||||
],
|
||||
[
|
||||
'description' => 'Test 2',
|
||||
'amount' => 3,
|
||||
'tax_rate' => 20,
|
||||
'price' => 50,
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
$this->assertEquals(204, invoice_total($invoice));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_test_invoice_total_tax()
|
||||
{
|
||||
$invoice = [
|
||||
'currency' => 'CZK',
|
||||
'discount_type' => 'value',
|
||||
'discount_rate' => 18,
|
||||
'items' => [
|
||||
[
|
||||
'description' => 'Test 1',
|
||||
'amount' => 1,
|
||||
'tax_rate' => 20,
|
||||
'price' => 100,
|
||||
],
|
||||
[
|
||||
'description' => 'Test 2',
|
||||
'amount' => 2,
|
||||
'tax_rate' => 10,
|
||||
'price' => 100,
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
$this->assertEquals(40, invoice_total_tax($invoice));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_test_invoice_factory()
|
||||
{
|
||||
$invoice_profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create();
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create(['user' => $invoice_profile->toArray()]);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'id' => $invoice->id,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('invoices', [
|
||||
'user' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_create_new_invoice_with_storing_new_client()
|
||||
{
|
||||
Notification::fake();
|
||||
Storage::fake('local');
|
||||
PDF::fake();
|
||||
|
||||
$avatar = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/invoices', [
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => '2120001',
|
||||
'variable_number' => '2120001',
|
||||
'items' => json_encode($this->items),
|
||||
'discount_type' => 'percent',
|
||||
'discount_rate' => 10,
|
||||
'delivery_at' => Carbon::now()->addWeek(),
|
||||
'store_client' => true,
|
||||
'send_invoice' => true,
|
||||
'client' => 'others',
|
||||
'client_avatar' => $avatar,
|
||||
'client_name' => 'VueFileManager Inc.',
|
||||
'client_email' => 'howdy@hi5ve.digital',
|
||||
'client_phone_number' => '+421 950 123 456',
|
||||
'client_address' => 'Does 12',
|
||||
'client_city' => 'Bratislava',
|
||||
'client_postal_code' => '076 54',
|
||||
'client_country' => 'SK',
|
||||
'client_ico' => 11111111,
|
||||
'client_dic' => 11111111,
|
||||
'client_ic_dph' => 'SK11111111',
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => '2120001',
|
||||
'user_id' => $user->id,
|
||||
'items' => json_encode($this->items),
|
||||
'client' => json_encode($this->client),
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
]);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertExists(
|
||||
Client::first()->getRawOriginal('avatar')
|
||||
);
|
||||
|
||||
PDF::assertFileNameIs(storage_path("app/" . invoice_path(Invoice::first())));
|
||||
|
||||
Notification::assertTimesSent(1, InvoiceDeliveryNotification::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_create_new_invoice_with_storing_new_client_without_avatar_and_mail()
|
||||
{
|
||||
Storage::fake('local');
|
||||
Notification::fake();
|
||||
PDF::fake();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/invoices', [
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => '2120001',
|
||||
'variable_number' => '2120001',
|
||||
'items' => json_encode($this->items),
|
||||
'discount_type' => 'percent',
|
||||
'discount_rate' => 10,
|
||||
'delivery_at' => Carbon::now()->addWeek(),
|
||||
'store_client' => true,
|
||||
'send_invoice' => true,
|
||||
'client' => 'others',
|
||||
'client_avatar' => null,
|
||||
'client_name' => 'VueFileManager Inc.',
|
||||
'client_email' => null,
|
||||
'client_phone_number' => '+421 950 123 456',
|
||||
'client_address' => 'Does 12',
|
||||
'client_city' => 'Bratislava',
|
||||
'client_postal_code' => '076 54',
|
||||
'client_country' => 'SK',
|
||||
'client_ico' => 11111111,
|
||||
'client_dic' => 11111111,
|
||||
'client_ic_dph' => 'SK11111111',
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => '2120001',
|
||||
'user_id' => $user->id,
|
||||
'items' => json_encode($this->items),
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
]);
|
||||
|
||||
PDF::assertFileNameIs(storage_path("app/" . invoice_path(Invoice::first())));
|
||||
|
||||
Notification::assertNothingSent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_create_new_invoice_without_storing_client_without_avatar_and_mail()
|
||||
{
|
||||
Storage::fake('local');
|
||||
Notification::fake();
|
||||
PDF::fake();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/invoices', [
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => '2120001',
|
||||
'variable_number' => '2120001',
|
||||
'items' => json_encode($this->items),
|
||||
'discount_type' => 'percent',
|
||||
'discount_rate' => 10,
|
||||
'delivery_at' => Carbon::now()->addWeek(),
|
||||
'store_client' => false,
|
||||
'send_invoice' => false,
|
||||
'client' => 'others',
|
||||
'client_avatar' => null,
|
||||
'client_name' => 'VueFileManager Inc.',
|
||||
'client_email' => 'howdy@hi5ve.digital',
|
||||
'client_phone_number' => '+421 950 123 456',
|
||||
'client_address' => 'Does 12',
|
||||
'client_city' => 'Bratislava',
|
||||
'client_postal_code' => '076 54',
|
||||
'client_country' => 'SK',
|
||||
'client_ico' => 11111111,
|
||||
'client_dic' => 11111111,
|
||||
'client_ic_dph' => 'SK11111111',
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => '2120001',
|
||||
'user_id' => $user->id,
|
||||
'items' => json_encode($this->items),
|
||||
'client' => json_encode($this->client),
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('clients', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
]);
|
||||
|
||||
PDF::assertFileNameIs(storage_path("app/" . invoice_path(Invoice::first())));
|
||||
|
||||
Notification::assertNothingSent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_create_new_invoice_without_storing_client()
|
||||
{
|
||||
Storage::fake('local');
|
||||
Notification::fake();
|
||||
PDF::fake();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/invoices', [
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => '2120001',
|
||||
'variable_number' => '2120001',
|
||||
'items' => json_encode($this->items),
|
||||
'discount_type' => 'percent',
|
||||
'discount_rate' => 10,
|
||||
'delivery_at' => Carbon::now()->addWeek(),
|
||||
'store_client' => false,
|
||||
'send_invoice' => true,
|
||||
'client' => 'others',
|
||||
'client_name' => 'VueFileManager Inc.',
|
||||
'client_email' => 'howdy@hi5ve.digital',
|
||||
'client_phone_number' => '+421 950 123 456',
|
||||
'client_address' => 'Does 12',
|
||||
'client_city' => 'Bratislava',
|
||||
'client_postal_code' => '076 54',
|
||||
'client_country' => 'SK',
|
||||
'client_ico' => 11111111,
|
||||
'client_dic' => 11111111,
|
||||
'client_ic_dph' => 'SK11111111',
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => '2120001',
|
||||
'user_id' => $user->id,
|
||||
'items' => json_encode($this->items),
|
||||
'client' => json_encode($this->client),
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('clients', [
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
]);
|
||||
|
||||
PDF::assertFileNameIs(storage_path("app/" . invoice_path(Invoice::first())));
|
||||
|
||||
Notification::assertTimesSent(1, InvoiceDeliveryNotification::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_create_new_invoice_with_existing_client()
|
||||
{
|
||||
Storage::fake('local');
|
||||
Notification::fake();
|
||||
PDF::fake();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
]);
|
||||
|
||||
$this->postJson('/api/oasis/invoices', [
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => '2120001',
|
||||
'variable_number' => '2120001',
|
||||
'client' => $client->id,
|
||||
'items' => json_encode($this->items),
|
||||
'discount_type' => 'percent',
|
||||
'discount_rate' => 10,
|
||||
'delivery_at' => Carbon::now()->addWeek(),
|
||||
'send_invoice' => true,
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => '2120001',
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'items' => json_encode($this->items),
|
||||
]);
|
||||
|
||||
PDF::assertFileNameIs(storage_path("app/" . invoice_path(Invoice::first())));
|
||||
|
||||
Notification::assertTimesSent(1, InvoiceDeliveryNotification::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_update_existing_invoice()
|
||||
{
|
||||
PDF::fake();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$this->postJson("/api/oasis/invoices/$invoice->id", [
|
||||
'invoice_number' => '2120001',
|
||||
'variable_number' => '2120001',
|
||||
'items' => json_encode($this->items),
|
||||
'discount_type' => 'value',
|
||||
'discount_rate' => 10,
|
||||
'delivery_at' => Carbon::now()->addWeek(),
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseHas('invoices', [
|
||||
'invoice_number' => '2120001',
|
||||
'discount_type' => 'value',
|
||||
'items' => json_encode($this->items),
|
||||
'discount_rate' => 10,
|
||||
'total_net' => 2030,
|
||||
]);
|
||||
|
||||
PDF::assertFileNameIs(storage_path("app/" . invoice_path(Invoice::first())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_delete_invoice()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
\PDF::loadView('oasis.invoices.invoice', [
|
||||
'invoice' => Invoice::find($invoice->id),
|
||||
'user' => $user,
|
||||
])
|
||||
->setPaper('a4')
|
||||
->setOrientation('portrait')
|
||||
->save(
|
||||
storage_path("app/files/{$invoice->user_id}/invoice-{$invoice->id}.pdf")
|
||||
);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertExists(
|
||||
invoice_path($invoice)
|
||||
);
|
||||
|
||||
$this->delete("/api/oasis/invoices/$invoice->id");
|
||||
|
||||
$this->assertDatabaseMissing('invoices', [
|
||||
'id' => $invoice->id
|
||||
]);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertMissing(
|
||||
invoice_path($invoice)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_download_invoice_from_url()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
]);
|
||||
|
||||
$this->postJson('/api/oasis/invoices', [
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => '2120001',
|
||||
'variable_number' => '2120001',
|
||||
'client' => $client->id,
|
||||
'items' => json_encode($this->items),
|
||||
'discount_type' => 'percent',
|
||||
'discount_rate' => 10,
|
||||
'delivery_at' => Carbon::now()->addWeek(),
|
||||
'send_invoice' => true,
|
||||
])->assertStatus(201);
|
||||
|
||||
$invoice = Invoice::first();
|
||||
|
||||
$this->get("/oasis/invoice/{$invoice->id}")
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_single_invoice()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$this->getJson("/api/oasis/invoices/$invoice->id")
|
||||
->assertJsonFragment([
|
||||
'id' => $invoice->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_all_user_regular_invoices()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/regular')
|
||||
->assertJsonFragment([
|
||||
'id' => $invoice->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_all_user_advance_invoices()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'advance-invoice',
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/advance')
|
||||
->assertJsonFragment([
|
||||
'id' => $invoice->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_search_user_regular_invoice()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => 2001212,
|
||||
'client' => [
|
||||
'name' => 'VueFileManager Inc.',
|
||||
],
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular-invoice&query=2001212')
|
||||
->assertJsonFragment([
|
||||
'invoice_number' => '2001212',
|
||||
])->assertStatus(200);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular-invoice&query=Vue')
|
||||
->assertJsonFragment([
|
||||
'invoice_number' => '2001212',
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_data_for_invoice_editor()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->count(2)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$client->pluck('id')
|
||||
->each(function ($id) {
|
||||
$this->getJson('/api/oasis/invoices/editor')
|
||||
->assertStatus(200)
|
||||
->assertJsonFragment([
|
||||
'value' => $id,
|
||||
'recommendedInvoiceNumber' => '20210001',
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_default_recommended_invoice_number()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/editor')
|
||||
->assertStatus(200)
|
||||
->assertJsonFragment([
|
||||
'latestInvoiceNumber' => null,
|
||||
'recommendedInvoiceNumber' => '20210001',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_next_invoice_number_after_latest_invoice_number()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => 20210001,
|
||||
'client' => [
|
||||
'name' => 'VueFileManager Inc.',
|
||||
],
|
||||
'user' => [
|
||||
'ic_dph' => 423143124213
|
||||
],
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/editor')
|
||||
->assertStatus(200)
|
||||
->assertJsonFragment([
|
||||
'latestInvoiceNumber' => 20210001,
|
||||
'recommendedInvoiceNumber' => 20210002,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_send_single_invoice_on_email()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
$profile = InvoiceProfile::factory(InvoiceProfile::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'user' => $profile->toArray(),
|
||||
]);
|
||||
|
||||
$this->postJson("/api/oasis/invoices/$invoice->id/share", [
|
||||
'email' => 'john@doe.com',
|
||||
])->assertStatus(204);
|
||||
|
||||
Notification::assertTimesSent(1, InvoiceDeliveryNotification::class);
|
||||
}
|
||||
}
|
||||
4
webpack.mix.js
vendored
4
webpack.mix.js
vendored
@@ -34,12 +34,12 @@ mix.js('resources/js/main.js', 'public/js')
|
||||
clientLogLevel: 'none'
|
||||
}
|
||||
})
|
||||
.options({
|
||||
/*.options({
|
||||
hmrOptions: {
|
||||
host: '192.168.1.198',
|
||||
port: '8080'
|
||||
},
|
||||
})
|
||||
})*/
|
||||
.disableNotifications();
|
||||
|
||||
if (mix.inProduction()) {
|
||||
|
||||
Reference in New Issue
Block a user