akaunting 3.0 (the last dance)
This commit is contained in:
46
app/View/Components/Form/Accordion.php
Normal file
46
app/View/Components/Form/Accordion.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form;
|
||||
|
||||
use App\Abstracts\View\Component;
|
||||
|
||||
class Accordion extends Component
|
||||
{
|
||||
public $type;
|
||||
|
||||
public $icon;
|
||||
|
||||
public $open;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
string $type, string $icon = '', bool $open = false
|
||||
) {
|
||||
$this->type = $type;
|
||||
$this->icon = $this->getIcon($icon);
|
||||
$this->open = $open;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.accordion.index');
|
||||
}
|
||||
|
||||
protected function getIcon($icon)
|
||||
{
|
||||
if (! empty($icon)) {
|
||||
return $icon;
|
||||
}
|
||||
|
||||
return 'expand_more';
|
||||
}
|
||||
}
|
131
app/View/Components/Form/Buttons.php
Normal file
131
app/View/Components/Form/Buttons.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form;
|
||||
|
||||
use App\Abstracts\View\Component;
|
||||
|
||||
class Buttons extends Component
|
||||
{
|
||||
public $groupClass = 'sm:col-span-6';
|
||||
|
||||
public $withoutCancel;
|
||||
|
||||
public $cancel;
|
||||
|
||||
public $cancelRoute;
|
||||
|
||||
public $cancelUrl;
|
||||
|
||||
public $cancelClass = 'px-6 py-1.5 hover:bg-gray-200 rounded-lg ltr:mr-2 rtl:ml-2';
|
||||
|
||||
public $cancelText;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
$groupClass = '',
|
||||
$cancel = '', $cancelRoute = '', $cancelUrl = '', $cancelClass = '', $cancelText = '', $withoutCancel = false
|
||||
) {
|
||||
$this->groupClass = $this->getGroupClass($groupClass);
|
||||
|
||||
$this->cancel = $this->getCancel($cancel, $cancelRoute, $cancelUrl);
|
||||
$this->cancelClass = $this->getCancelClass($cancelClass);
|
||||
$this->cancelText = $this->getCancelText($cancelText);
|
||||
$this->withoutCancel = $withoutCancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.buttons');
|
||||
}
|
||||
|
||||
protected function getGroupClass($groupClass)
|
||||
{
|
||||
if (! empty($groupClass)) {
|
||||
return $groupClass;
|
||||
}
|
||||
|
||||
return $this->groupClass;
|
||||
}
|
||||
|
||||
protected function getCancel($cancel, $route, $url)
|
||||
{
|
||||
if (! empty($cancel)) {
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
if (!empty($route)) {
|
||||
return $this->getRouteAction($route);
|
||||
}
|
||||
|
||||
if (!empty($url)) {
|
||||
return $this->getUrlAction($url);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action for a "url" option.
|
||||
*
|
||||
* @param array|string $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getUrlAction($options)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
return url($options[0], array_slice($options, 1));
|
||||
}
|
||||
|
||||
return url($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action for a "route" option.
|
||||
*
|
||||
* @param array|string $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getRouteAction($options)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
$parameters = array_slice($options, 1);
|
||||
|
||||
if (array_keys($options) === [0, 1]) {
|
||||
$parameters = head($parameters);
|
||||
}
|
||||
|
||||
return route($options[0], $parameters);
|
||||
}
|
||||
|
||||
return route($options);
|
||||
}
|
||||
|
||||
protected function getCancelClass($cancelClass)
|
||||
{
|
||||
if (! empty($cancelClass)) {
|
||||
return $cancelClass;
|
||||
}
|
||||
|
||||
return $this->cancelClass;
|
||||
}
|
||||
|
||||
protected function getCancelText($cancelText)
|
||||
{
|
||||
if (! empty($cancelText)) {
|
||||
return $cancelText;
|
||||
}
|
||||
|
||||
return trans('general.cancel');
|
||||
}
|
||||
}
|
37
app/View/Components/Form/Group/Account.php
Normal file
37
app/View/Components/Form/Group/Account.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
use App\Models\Banking\Account as Model;
|
||||
|
||||
class Account extends Form
|
||||
{
|
||||
public $type = 'account';
|
||||
|
||||
public $path;
|
||||
|
||||
public $accounts;
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if (empty($this->name)) {
|
||||
$this->name = 'account_id';
|
||||
}
|
||||
|
||||
$this->path = route('modals.accounts.create');
|
||||
|
||||
$this->accounts = Model::enabled()->orderBy('name')->pluck('name', 'id');
|
||||
|
||||
if (empty($this->selected) && empty($this->getParentData('model'))) {
|
||||
$this->selected = setting('default.account');
|
||||
}
|
||||
|
||||
return view('components.form.group.account');
|
||||
}
|
||||
}
|
80
app/View/Components/Form/Group/Attachment.php
Normal file
80
app/View/Components/Form/Group/Attachment.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Attachment extends Form
|
||||
{
|
||||
public $name = 'attachment';
|
||||
|
||||
public $type = 'file';
|
||||
|
||||
public $formGroupClass = 'sm:col-span-3';
|
||||
|
||||
public $custom_attributes = [
|
||||
'dropzone-class' => 'form-file dropzone-column w-1/2 h-32.5',
|
||||
];
|
||||
|
||||
public $file_types;
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->setFileTypes();
|
||||
|
||||
$this->custom_attributes = $this->setCustomAttributes();
|
||||
|
||||
return view('components.form.group.attachment');
|
||||
}
|
||||
|
||||
protected function setFileTypes()
|
||||
{
|
||||
$this->file_types = [];
|
||||
|
||||
$file_type_mimes = explode(',', config('filesystems.mimes'));
|
||||
|
||||
$file_types = [];
|
||||
|
||||
foreach ($file_type_mimes as $mime) {
|
||||
$file_types[] = '.' . $mime;
|
||||
}
|
||||
|
||||
$this->file_types = implode(',', $file_types);
|
||||
}
|
||||
|
||||
protected function setCustomAttributes()
|
||||
{
|
||||
$attributes = [];
|
||||
|
||||
if (! empty($this->required)) {
|
||||
$attributes['required'] = $this->required;
|
||||
}
|
||||
|
||||
if (! empty($this->disabled)) {
|
||||
$attributes['disabled'] = $this->disabled;
|
||||
}
|
||||
|
||||
if (! empty($this->readonly)) {
|
||||
$attributes['readonly'] = $this->readonly;
|
||||
}
|
||||
|
||||
if (! empty($this->options)) {
|
||||
$attributes['options'] = $this->options;
|
||||
}
|
||||
|
||||
if (! empty($this->multiple)) {
|
||||
$attributes['multiple'] = $this->multiple;
|
||||
}
|
||||
|
||||
foreach ($this->custom_attributes as $key => $value) {
|
||||
$attributes[$key] = $value;
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
}
|
46
app/View/Components/Form/Group/Category.php
Normal file
46
app/View/Components/Form/Group/Category.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
use App\Models\Setting\Category as Model;
|
||||
|
||||
class Category extends Form
|
||||
{
|
||||
public $type = 'income';
|
||||
|
||||
public $path;
|
||||
|
||||
public $remoteAction;
|
||||
|
||||
public $categories;
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$type = $this->type;
|
||||
|
||||
if (empty($this->name)) {
|
||||
$this->name = 'category_id';
|
||||
}
|
||||
|
||||
$this->path = route('modals.categories.create', ['type' => $this->type]);
|
||||
$this->remoteAction = route('categories.index', ['search' => 'type:' . $this->type . ' enabled:1']);
|
||||
|
||||
$this->categories = Model::type($type)->enabled()->orderBy('name')->take(setting('default.select_limit'))->get();
|
||||
|
||||
if (!empty($model) && $model->category && ! $this->categories->has($model->category_id)) {
|
||||
$this->categories->put($model->category->id, $model->category->name);
|
||||
}
|
||||
|
||||
if (empty($this->selected) && (in_array($type, ['income', 'expense']))) {
|
||||
$this->selected = setting('default.' . $type . '_category');
|
||||
}
|
||||
|
||||
return view('components.form.group.category');
|
||||
}
|
||||
}
|
27
app/View/Components/Form/Group/Checkbox.php
Normal file
27
app/View/Components/Form/Group/Checkbox.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Checkbox extends Form
|
||||
{
|
||||
public $type = 'checkbox';
|
||||
|
||||
/** @var string */
|
||||
public $formGroupClass = 'sm:col-span-6';
|
||||
|
||||
public $except = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.checkbox');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Color.php
Normal file
20
app/View/Components/Form/Group/Color.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Color extends Form
|
||||
{
|
||||
public $type = 'color';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.color');
|
||||
}
|
||||
}
|
76
app/View/Components/Form/Group/Contact.php
Normal file
76
app/View/Components/Form/Group/Contact.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
use App\Models\Common\Contact as Model;
|
||||
|
||||
class Contact extends Form
|
||||
{
|
||||
public $type = 'contact';
|
||||
|
||||
public $label;
|
||||
|
||||
public $view = 'components.form.group.contact';
|
||||
|
||||
public $path;
|
||||
|
||||
public $remoteAction;
|
||||
|
||||
public $contacts;
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$type = $this->type;
|
||||
|
||||
switch ($type) {
|
||||
case 'customer':
|
||||
$this->prepareCustomer();
|
||||
break;
|
||||
case 'vendor':
|
||||
$this->prepareVendor();
|
||||
break;
|
||||
}
|
||||
|
||||
return view($this->view);
|
||||
}
|
||||
|
||||
protected function prepareCustomer()
|
||||
{
|
||||
if (empty($this->name)) {
|
||||
$this->name = 'contact_id';
|
||||
}
|
||||
|
||||
$this->path = route('modals.customers.create');
|
||||
$this->remoteAction = route('customers.index');
|
||||
$this->label = trans_choice('general.customers', 1);
|
||||
|
||||
$this->contacts = Model::customer()->enabled()->orderBy('name')->take(setting('default.select_limit'))->get();
|
||||
|
||||
if (!empty($model) && $model->customer && ! $this->contacts->has($model->contact_id)) {
|
||||
$this->contacts->put($model->customer->id, $model->customer->name);
|
||||
}
|
||||
}
|
||||
|
||||
protected function prepareVendor()
|
||||
{
|
||||
if (empty($this->name)) {
|
||||
$this->name = 'contact_id';
|
||||
}
|
||||
|
||||
$this->path = route('modals.vendors.create');
|
||||
$this->remoteAction = route('vendors.index');
|
||||
$this->label = trans_choice('general.vendors', 1);
|
||||
|
||||
$this->contacts = Model::vendor()->enabled()->orderBy('name')->take(setting('default.select_limit'))->get();
|
||||
|
||||
if (!empty($model) && $model->vendor && ! $this->contacts->has($model->contact_id)) {
|
||||
$this->contacts->put($model->vendor->id, $model->vendor->name);
|
||||
}
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Country.php
Normal file
20
app/View/Components/Form/Group/Country.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Country extends Form
|
||||
{
|
||||
public $type = 'country';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.country');
|
||||
}
|
||||
}
|
44
app/View/Components/Form/Group/Currency.php
Normal file
44
app/View/Components/Form/Group/Currency.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
use App\Models\Setting\Currency as Model;
|
||||
|
||||
class Currency extends Form
|
||||
{
|
||||
public $type = 'currency';
|
||||
|
||||
public $path;
|
||||
|
||||
public $field;
|
||||
|
||||
public $currencies;
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if (empty($this->name)) {
|
||||
$this->name = 'currency_code';
|
||||
}
|
||||
|
||||
$this->path = route('modals.currencies.create');
|
||||
|
||||
$this->field = [
|
||||
'key' => 'code',
|
||||
'value' => 'name'
|
||||
];
|
||||
|
||||
$this->currencies = Model::enabled()->orderBy('name')->pluck('name', 'code');
|
||||
|
||||
if (empty($this->selected) && empty($this->getParentData('model'))) {
|
||||
$this->selected = setting('default.currency');
|
||||
}
|
||||
|
||||
return view('components.form.group.currency');
|
||||
}
|
||||
}
|
10
app/View/Components/Form/Group/Customer.php
Normal file
10
app/View/Components/Form/Group/Customer.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form\Group\Contact;
|
||||
|
||||
class Customer extends Contact
|
||||
{
|
||||
public $type = 'customer';
|
||||
}
|
20
app/View/Components/Form/Group/Date.php
Normal file
20
app/View/Components/Form/Group/Date.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Date extends Form
|
||||
{
|
||||
public $type = 'date';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.date');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/DateTime.php
Normal file
20
app/View/Components/Form/Group/DateTime.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class DateTime extends Form
|
||||
{
|
||||
public $type = 'date_time';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.date_time');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Editor.php
Normal file
20
app/View/Components/Form/Group/Editor.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Editor extends Form
|
||||
{
|
||||
public $type = 'editor';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.editor');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Email.php
Normal file
20
app/View/Components/Form/Group/Email.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Email extends Form
|
||||
{
|
||||
public $type = 'email';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.email');
|
||||
}
|
||||
}
|
26
app/View/Components/Form/Group/File.php
Normal file
26
app/View/Components/Form/Group/File.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class File extends Form
|
||||
{
|
||||
public $type = 'file';
|
||||
|
||||
public $formGroupClass = 'sm:col-span-3';
|
||||
|
||||
public $custom_attributes = [
|
||||
'dropzone-class' => 'form-file dropzone-column w-1/2 h-32.5',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.file');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/InvoiceText.php
Normal file
20
app/View/Components/Form/Group/InvoiceText.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class InvoiceText extends Form
|
||||
{
|
||||
public $type = 'invoice-text';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.invoice_text');
|
||||
}
|
||||
}
|
26
app/View/Components/Form/Group/Locale.php
Normal file
26
app/View/Components/Form/Group/Locale.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Locale extends Form
|
||||
{
|
||||
public $type = 'locale';
|
||||
|
||||
public $name = 'locale';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if (empty($this->selected)) {
|
||||
$this->selected = setting('default.locale', config('app.locale', 'en-GB'));
|
||||
}
|
||||
|
||||
return view('components.form.group.locale');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Money.php
Normal file
20
app/View/Components/Form/Group/Money.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Money extends Form
|
||||
{
|
||||
public $type = 'money';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.money');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Number.php
Normal file
20
app/View/Components/Form/Group/Number.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Number extends Form
|
||||
{
|
||||
public $type = 'number';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.number');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Password.php
Normal file
20
app/View/Components/Form/Group/Password.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Password extends Form
|
||||
{
|
||||
public $type = 'password';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.password');
|
||||
}
|
||||
}
|
29
app/View/Components/Form/Group/PaymentMethod.php
Normal file
29
app/View/Components/Form/Group/PaymentMethod.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
use App\Utilities\Modules;
|
||||
|
||||
class PaymentMethod extends Form
|
||||
{
|
||||
public $type = 'payment_method';
|
||||
|
||||
public $payment_methods;
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->payment_methods = Modules::getPaymentMethods();
|
||||
|
||||
if (empty($this->selected) && empty($this->getParentData('model'))) {
|
||||
$this->selected = setting('default.payment_method');
|
||||
}
|
||||
|
||||
return view('components.form.group.payment_method');
|
||||
}
|
||||
}
|
27
app/View/Components/Form/Group/Radio.php
Normal file
27
app/View/Components/Form/Group/Radio.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Radio extends Form
|
||||
{
|
||||
public $type = 'radio';
|
||||
|
||||
/** @var string */
|
||||
public $formGroupClass = 'sm:col-span-6';
|
||||
|
||||
public $except = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.radio');
|
||||
}
|
||||
}
|
174
app/View/Components/Form/Group/Recurring.php
Normal file
174
app/View/Components/Form/Group/Recurring.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Component;
|
||||
use App\Utilities\Date;
|
||||
|
||||
class Recurring extends Component
|
||||
{
|
||||
public $type;
|
||||
|
||||
public $frequency;
|
||||
public $frequencies = [];
|
||||
|
||||
public $customFrequency = '';
|
||||
public $customFrequencies = [];
|
||||
|
||||
public $limit = '';
|
||||
public $limits = [];
|
||||
|
||||
public $startedValue = '';
|
||||
public $limitCount = '';
|
||||
public $limitDateValue = '';
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
$type = '',
|
||||
$frequency = '',
|
||||
$frequencies = [],
|
||||
|
||||
$customFrequency = '',
|
||||
$customFrequencies = [],
|
||||
|
||||
$limit = '',
|
||||
$limits = [],
|
||||
|
||||
$startedValue = '',
|
||||
$limitCount = '',
|
||||
$limitDateValue = '',
|
||||
) {
|
||||
$this->type = $this->getType($type);
|
||||
$this->frequency = $this->getFrequency($frequency);
|
||||
$this->frequencies = $this->getFrequencies($frequencies);
|
||||
|
||||
$this->customFrequency = $this->getCustomFrequency($customFrequency);
|
||||
$this->customFrequencies = $this->getCustomFrequencies($customFrequencies);
|
||||
|
||||
$this->limit = $this->getLimit($limit);
|
||||
$this->limits = $this->getLimits($limits);
|
||||
|
||||
$this->startedValue = $this->getStartedValue($startedValue);
|
||||
$this->limitCount = $this->getLimitCount($limitCount);
|
||||
$this->limitDateValue = $this->getLimitDateValue($limitDateValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.recurring');
|
||||
}
|
||||
|
||||
protected function getType($type)
|
||||
{
|
||||
if (! empty($type)) {
|
||||
return $type;
|
||||
}
|
||||
|
||||
return 'invoice';
|
||||
}
|
||||
|
||||
protected function getFrequency($frequency)
|
||||
{
|
||||
if (! empty($frequency)) {
|
||||
return $frequency;
|
||||
}
|
||||
|
||||
return 'monthly';
|
||||
}
|
||||
|
||||
protected function getFrequencies($frequencies)
|
||||
{
|
||||
if (! empty($frequencies)) {
|
||||
return $frequencies;
|
||||
}
|
||||
|
||||
return [
|
||||
'daily' => trans('recurring.daily'),
|
||||
'weekly' => trans('recurring.weekly'),
|
||||
'monthly' => trans('recurring.monthly'),
|
||||
'yearly' => trans('recurring.yearly'),
|
||||
'custom' => trans('recurring.custom'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getCustomFrequency($customFrequency)
|
||||
{
|
||||
if (! empty($customFrequency)) {
|
||||
return $customFrequency;
|
||||
}
|
||||
|
||||
return 'monthly';
|
||||
}
|
||||
|
||||
protected function getCustomFrequencies($customFrequencies)
|
||||
{
|
||||
if (! empty($customFrequencies)) {
|
||||
return $customFrequencies;
|
||||
}
|
||||
|
||||
return [
|
||||
'daily' => trans('recurring.days'),
|
||||
'weekly' => trans('recurring.weeks'),
|
||||
'monthly' => trans('recurring.months'),
|
||||
'yearly' => trans('recurring.years'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getLimit($limit)
|
||||
{
|
||||
if (! empty($limit)) {
|
||||
return $limit;
|
||||
}
|
||||
|
||||
return 'never';
|
||||
}
|
||||
|
||||
protected function getLimits($limits)
|
||||
{
|
||||
if (! empty($limits)) {
|
||||
return $limits;
|
||||
}
|
||||
|
||||
return [
|
||||
'after' => trans('recurring.after'),
|
||||
'on' => trans('recurring.on'),
|
||||
'never' => trans('recurring.never'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getStartedValue($startedValue)
|
||||
{
|
||||
if (! empty($startedValue)) {
|
||||
return $startedValue;
|
||||
}
|
||||
|
||||
return Date::now()->toDateString();
|
||||
}
|
||||
|
||||
protected function getLimitCount($limitCount)
|
||||
{
|
||||
if (! empty($limitCount)) {
|
||||
return $limitCount;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function getLimitDateValue($limitDateValue)
|
||||
{
|
||||
if (! empty($limitDateValue)) {
|
||||
return $limitDateValue;
|
||||
}
|
||||
|
||||
return Date::now()->toDateString();
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Select.php
Normal file
20
app/View/Components/Form/Group/Select.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Select extends Form
|
||||
{
|
||||
public $type = 'select';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.select');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Sswitch.php
Normal file
20
app/View/Components/Form/Group/Sswitch.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Sswitch extends Form
|
||||
{
|
||||
public $type = 'switch';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.switch');
|
||||
}
|
||||
}
|
44
app/View/Components/Form/Group/Tax.php
Normal file
44
app/View/Components/Form/Group/Tax.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
use App\Models\Setting\Currency as Model;
|
||||
|
||||
class Tax extends Form
|
||||
{
|
||||
public $type = 'tax';
|
||||
|
||||
public $path;
|
||||
|
||||
public $field;
|
||||
|
||||
public $currencies;
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if (empty($this->name)) {
|
||||
$this->name = 'currency_code';
|
||||
}
|
||||
|
||||
$this->path = route('modals.currencies.create');
|
||||
|
||||
$this->field = [
|
||||
'key' => 'code',
|
||||
'value' => 'name'
|
||||
];
|
||||
|
||||
$this->currencies = Model::enabled()->orderBy('name')->pluck('name', 'code');
|
||||
|
||||
if (empty($this->selected)) {
|
||||
$this->selected = setting('default.currency');
|
||||
}
|
||||
|
||||
return view('components.form.group.tax');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Text.php
Normal file
20
app/View/Components/Form/Group/Text.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Text extends Form
|
||||
{
|
||||
public $type = 'text';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.text');
|
||||
}
|
||||
}
|
22
app/View/Components/Form/Group/Textarea.php
Normal file
22
app/View/Components/Form/Group/Textarea.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Textarea extends Form
|
||||
{
|
||||
public $type = 'textarea';
|
||||
|
||||
public $formGroupClass = 'sm:col-span-6';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.textarea');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Time.php
Normal file
20
app/View/Components/Form/Group/Time.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Time extends Form
|
||||
{
|
||||
public $type = 'time';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.time');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Group/Toggle.php
Normal file
20
app/View/Components/Form/Group/Toggle.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Toggle extends Form
|
||||
{
|
||||
public $type = 'radio';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.group.toggle');
|
||||
}
|
||||
}
|
10
app/View/Components/Form/Group/Vendor.php
Normal file
10
app/View/Components/Form/Group/Vendor.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Group;
|
||||
|
||||
use App\Abstracts\View\Components\Form\Group\Contact;
|
||||
|
||||
class Vendor extends Contact
|
||||
{
|
||||
public $type = 'vendor';
|
||||
}
|
20
app/View/Components/Form/Input/Checkbox.php
Normal file
20
app/View/Components/Form/Input/Checkbox.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Checkbox extends Form
|
||||
{
|
||||
public $type = 'checkbox';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.checkbox');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Color.php
Normal file
20
app/View/Components/Form/Input/Color.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Color extends Form
|
||||
{
|
||||
public $type = 'color';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.color');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Editor.php
Normal file
20
app/View/Components/Form/Input/Editor.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Editor extends Form
|
||||
{
|
||||
public $type = 'editor';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.editor');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Email.php
Normal file
20
app/View/Components/Form/Input/Email.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Email extends Form
|
||||
{
|
||||
public $type = 'email';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.email');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Ffile.php
Normal file
20
app/View/Components/Form/Input/Ffile.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Ffile extends Form
|
||||
{
|
||||
public $type = 'file';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.file');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Hidden.php
Normal file
20
app/View/Components/Form/Input/Hidden.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Hidden extends Form
|
||||
{
|
||||
public $type = 'hidden';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.hidden');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Input.php
Normal file
20
app/View/Components/Form/Input/Input.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Input extends Form
|
||||
{
|
||||
public $type = 'input';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.input');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Money.php
Normal file
20
app/View/Components/Form/Input/Money.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Money extends Form
|
||||
{
|
||||
public $type = 'money';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.money');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Number.php
Normal file
20
app/View/Components/Form/Input/Number.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Number extends Form
|
||||
{
|
||||
public $type = 'number';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.number');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Password.php
Normal file
20
app/View/Components/Form/Input/Password.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Password extends Form
|
||||
{
|
||||
public $type = 'password';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.password');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Radio.php
Normal file
20
app/View/Components/Form/Input/Radio.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Radio extends Form
|
||||
{
|
||||
public $type = 'radio';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.radio');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Select.php
Normal file
20
app/View/Components/Form/Input/Select.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Select extends Form
|
||||
{
|
||||
public $type = 'select';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.select');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Text.php
Normal file
20
app/View/Components/Form/Input/Text.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Text extends Form
|
||||
{
|
||||
public $type = 'text';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.text');
|
||||
}
|
||||
}
|
20
app/View/Components/Form/Input/Textarea.php
Normal file
20
app/View/Components/Form/Input/Textarea.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Form\Input;
|
||||
|
||||
use App\Abstracts\View\Components\Form;
|
||||
|
||||
class Textarea extends Form
|
||||
{
|
||||
public $type = 'textarea';
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.input.textarea');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user