Create invoice form part 1.

This commit is contained in:
Peter Papp
2021-04-30 17:53:19 +02:00
parent 5167ae520e
commit 3c3e82758d
51 changed files with 1890 additions and 763 deletions
@@ -1,5 +1,4 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\ResourceCollection;
@@ -1,5 +1,4 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -16,27 +15,27 @@ class InvoiceProfileResource extends JsonResource
{
return [
'data' => [
'id' => $this->id,
'type' => 'invoice-profile',
'id' => $this->id,
'type' => 'invoice-profile',
'attributes' => [
'logo' => $this->logo,
'stamp' => $this->stamp,
'company' => $this->company,
'email' => $this->email,
'ico' => $this->ico,
'dic' => $this->dic,
'ic_dph' => $this->ic_dph,
'logo' => $this->logo,
'stamp' => $this->stamp,
'company' => $this->company,
'email' => $this->email,
'ico' => $this->ico,
'dic' => $this->dic,
'ic_dph' => $this->ic_dph,
'registration_notes' => $this->registration_notes,
'author' => $this->author,
'address' => $this->address,
'state' => $this->state,
'city' => $this->city,
'postal_code' => $this->postal_code,
'country' => $this->country,
'phone' => $this->phone,
'bank' => $this->bank,
'iban' => $this->iban,
'swift' => $this->swift,
'author' => $this->author,
'address' => $this->address,
'state' => $this->state,
'city' => $this->city,
'postal_code' => $this->postal_code,
'country' => $this->country,
'phone' => $this->phone,
'bank' => $this->bank,
'iban' => $this->iban,
'swift' => $this->swift,
],
],
];
@@ -1,5 +1,4 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\ResourceCollection;
@@ -1,10 +1,7 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class OasisInvoiceResource extends JsonResource
{
@@ -18,17 +15,17 @@ class OasisInvoiceResource extends JsonResource
{
return [
'data' => [
'id' => $this->id,
'type' => 'invoice',
'id' => $this->id,
'type' => 'invoice',
'attributes' => [
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
'invoiceNumber' => $this->invoice_number,
'total' => format_to_currency($this->total_net, $this->currency),
'file_url' => "/oasis/invoice/$this->id",
'mimetype' => 'pdf',
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
'total' => format_to_currency($this->total_net, $this->currency),
'file_url' => "/oasis/invoice/$this->id",
'mimetype' => 'pdf',
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
],
],
];
}
}
}
@@ -1,5 +1,4 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\ResourceCollection;
@@ -1,5 +1,4 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -23,24 +22,24 @@ class OasisViewClientResource extends JsonResource
->count();
return [
'id' => $this->id,
'type' => 'client',
'id' => $this->id,
'type' => 'client',
'created_at' => format_date($this->created_at, '%d. %B %Y'),
'totalNet' => format_to_currency($total_net, 'CZK'),
'totalNet' => format_to_currency($total_net, 'CZK'),
'totalInvoices' => $total_invoices,
'avatar' => $this->avatar,
'name' => $this->name,
'email' => $this->email,
'avatar' => $this->avatar,
'name' => $this->name,
'email' => $this->email,
'phone_number' => $this->phone_number,
'address' => $this->address,
'city' => $this->city,
'postal_code' => $this->postal_code,
'country' => $this->country,
'ico' => $this->ico,
'dic' => $this->dic,
'ic_dph' => $this->ic_dph,
'address' => $this->address,
'city' => $this->city,
'postal_code' => $this->postal_code,
'country' => $this->country,
'ico' => $this->ico,
'dic' => $this->dic,
'ic_dph' => $this->ic_dph,
];
}
}
@@ -1,5 +1,4 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\ResourceCollection;
@@ -1,10 +1,7 @@
<?php
namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class OasisViewInvoiceResource extends JsonResource
{
@@ -17,16 +14,16 @@ class OasisViewInvoiceResource extends JsonResource
public function toArray($request)
{
return [
'id' => $this->id,
'client_id' => $this->client_id,
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
'id' => $this->id,
'client_id' => $this->client_id,
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
'invoiceNumber' => $this->invoice_number,
'total' => format_to_currency($this->total_net, $this->currency),
'file_url' => "/oasis/invoice/$this->id",
'clientName' => $this->client['name'],
'mimetype' => 'pdf',
'type' => 'invoice',
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
'total' => format_to_currency($this->total_net, $this->currency),
'file_url' => "/oasis/invoice/$this->id",
'clientName' => $this->client['name'],
'mimetype' => 'pdf',
'type' => 'invoice',
'created_at' => format_date($this->created_at, '%d. %B. %Y'),
];
}
}
}
@@ -1,12 +1,9 @@
<?php
namespace App\Http\Resources\Oasis;
use App\Http\Resources\PlanResource;
use App\Http\Resources\PricingResource;
use App\Services\StripeService;
use App\Http\Resources\PricingResource;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Cache;
class SubscriptionRequestResource extends JsonResource
{
@@ -20,34 +17,34 @@ class SubscriptionRequestResource extends JsonResource
{
return [
'data' => [
'id' => $this->id,
'type' => 'subscription-requests',
'attributes' => [
'requested_plan' => $this->requested_plan,
'status' => $this->status,
'id' => $this->id,
'type' => 'subscription-requests',
'attributes' => [
'requested_plan' => $this->requested_plan,
'status' => $this->status,
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
],
'relationships' => [
'user' => [
'data' => [
'id' => $this->user->id,
'type' => 'users',
'id' => $this->user->id,
'type' => 'users',
'attributes' => [
'name' => $this->user->settings->name,
'address' => $this->user->settings->address,
'state' => $this->user->settings->state,
'city' => $this->user->settings->city,
'postal_code' => $this->user->settings->postal_code,
'country' => $this->user->settings->country,
'name' => $this->user->settings->name,
'address' => $this->user->settings->address,
'state' => $this->user->settings->state,
'city' => $this->user->settings->city,
'postal_code' => $this->user->settings->postal_code,
'country' => $this->user->settings->country,
'phone_number' => $this->user->settings->phone_number,
'ico' => $this->user->settings->ico,
]
]
'ico' => $this->user->settings->ico,
],
],
],
'plan' => new PricingResource(
resolve(StripeService::class)->getPlan($this->requested_plan)
),
]
],
],
];
}