- removed invoicing from oasis

This commit is contained in:
Peter Papp
2021-05-13 09:31:16 +02:00
parent f5958dda57
commit 3af8bff13b
43 changed files with 1227 additions and 4900 deletions
@@ -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'),
];
}
}