This commit is contained in:
Cüneyt Şentürk 2022-09-13 09:38:25 +03:00
parent d45305585d
commit d60c7a471b
11 changed files with 89 additions and 78 deletions

View File

@ -13,6 +13,8 @@ class Information extends Component
public const DEFAULT_TYPE = 'customer';
public const DEFAULT_PLURAL_TYPE = 'customers';
public $id;
public $document;
public $hideShow;
@ -23,22 +25,20 @@ class Information extends Component
public $placement;
public $id;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
$document, bool $hideShow = false, string $showRoute = '', string $showDocumentRoute = '', string $placement = '', string $id = ''
string $id = '', $document, bool $hideShow = false, string $showRoute = '', string $showDocumentRoute = '', string $placement = ''
) {
$this->id = (! empty($id)) ? $id : 'tooltip-information-' . $document->id;
$this->document = $document;
$this->hideShow = $hideShow;
$this->showRoute = $this->getShowRoute($document->contact->type, $showRoute);
$this->showDocumentRoute = $this->getShowRoute($document->type, $showDocumentRoute);
$this->placement = (! empty($placement)) ? $placement : 'left';
$this->id = (! empty($id)) ? $id : 'tooltip-information-' . $document->id;
}
/**

View File

@ -1,65 +1,65 @@
<?php
namespace App\View\Components\Script;
use App\Abstracts\View\Component;
use Illuminate\Support\Js;
class Declaration extends Component
{
/** @var string */
public $kind;
/** @var array */
public $value;
public $scripts = null;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
string $kind = 'var',array $value = []
) {
$this->kind = $kind;
$this->value = $value;
$this->scripts = $this->getScripts();
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.script.declaration');
}
protected function getScripts()
{
$scripts = '';
foreach ($this->value as $key => $value) {
$scripts .= $this->getScript($key, $value) . "\n";
}
return $scripts;
}
protected function getScript($key, $value = null)
{
$script = $this->kind . ' ' . $key;
if (! is_null($value)) {
$script .= ' = ' . Js::from($value)->toHtml() . ';';
} else {
$script .= ' = ' . 'null;';
}
return $script;
}
}
<?php
namespace App\View\Components\Script;
use App\Abstracts\View\Component;
use Illuminate\Support\Js;
class Declaration extends Component
{
/** @var string */
public $kind;
/** @var array */
public $value;
public $scripts = null;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
string $kind = 'var',array $value = []
) {
$this->kind = $kind;
$this->value = $value;
$this->scripts = $this->getScripts();
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.script.declaration');
}
protected function getScripts()
{
$scripts = '';
foreach ($this->value as $key => $value) {
$scripts .= $this->getScript($key, $value) . "\n";
}
return $scripts;
}
protected function getScript($key, $value = null)
{
$script = $this->kind . ' ' . $key;
if (! is_null($value)) {
$script .= ' = ' . Js::from($value)->toHtml() . ';';
} else {
$script .= ' = ' . 'null;';
}
return $script;
}
}

View File

@ -42,7 +42,7 @@ class Actions extends Component
$actions = [];
if ($this->model && !empty($this->model->line_actions)) {
if ($this->model && ! empty($this->model->line_actions)) {
$actions = $this->model->line_actions;
}

View File

@ -3,6 +3,7 @@
class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions"
@click="onDeleteViaConfirmation('delete-{{ $modelTable }}-{{ $id }}')"
override="class"
{{ $attributes }}
>
@if ($slot->isNotEmpty())
{!! $slot !!}

View File

@ -3,6 +3,7 @@
class="{{ $class }}"
@click="onDeleteViaConfirmation('delete-{{ $modelTable }}-{{ $id }}')"
override="class"
{{ $attributes }}
>
<span class="{{ $textClass }}">
@if ($slot->isNotEmpty())

View File

@ -1,5 +1,5 @@
@push('scripts_start')
<script type="text/javascript">
{!! $scripts !!}
</script>
@endpush
@push('scripts_start')
<script type="text/javascript">
{!! $scripts !!}
</script>
@endpush

View File

@ -9,7 +9,7 @@
<x-slot name="body">
@if ($transaction->children()->count())
@foreach ($transaction->children()->get() as $child)
@php $url = '<a href="' . route('transactions.show', $child->id) . '" class="text-purple" override="class">' . $child->number . '</a>' @endphp
@php $url = '<a href="' . route('transactions.show', $child->id) . '" class="text-purple">' . $child->number . '</a>' @endphp
<div class="my-2">
{!! trans('recurring.child', ['url' => $url, 'date' => company_date($child->paid_at)]) !!}

View File

@ -18,7 +18,7 @@
@php
$recurring_message = trans('recurring.message_parent', [
'type' => mb_strtolower(trans_choice($textRecurringType, 1)),
'link' => '<a href="' . route(config('type.transaction.' . $transaction->parent->type . '.route.prefix') . '.show', $parent->id) . '" override="class"><u>' . $parent->number . '</u></a>'
'link' => '<a href="' . route(config('type.transaction.' . $transaction->parent->type . '.route.prefix') . '.show', $parent->id) . '"><u>' . $parent->number . '</u></a>',
]);
@endphp

View File

@ -5,7 +5,7 @@
@php
$from_account = '<span class="font-medium">' . $transfer->expense_account->title . '</span>';
$to_account = '<span class="font-medium">' . $transfer->income_account->title . '</span>';
$date = '<a href="' . route('transfers.show', $transfer->id) . '" class="text-purple" override="class">' . company_date($transaction->paid_at) . '</a>';
$date = '<a href="' . route('transfers.show', $transfer->id) . '" class="text-purple">' . company_date($transaction->paid_at) . '</a>';
@endphp
@endif

View File

@ -30,9 +30,11 @@
<x-tabs.tab id="general">
<div class="grid sm:grid-cols-6 gap-x-8 gap-y-6 my-3.5">
<x-form.group.text name="name" label="{{ trans('general.name') }}" form-group-class="col-span-6" />
<x-form.group.text name="email" label="{{ trans('general.email') }}" form-group-class="col-span-6" not-required />
<x-form.group.text name="phone" label="{{ trans('general.phone') }}" form-group-class="col-span-6" not-required />
<x-form.group.text name="tax_number" label="{{ trans('general.tax_number') }}" form-group-class="col-span-6" not-required />
<x-form.group.currency without-add-new form-group-class="col-span-6" :add-new-text="trans_choice('general.currencies', 1)" />
@ -44,8 +46,11 @@
<x-form.group.textarea name="address" label="{{ trans('general.address') }}" form-group-class="col-span-6" rows=2 not-required />
<x-form.group.text name="city" label="{{ trans_choice('general.cities', 1) }}" form-group-class="col-span-6" not-required />
<x-form.group.text name="zip_code" label="{{ trans('general.zip_code') }}" form-group-class="col-span-6" not-required />
<x-form.group.text name="state" label="{{ trans('general.state') }}" form-group-class="col-span-6" not-required />
<x-form.group.country form-group-class="col-span-6 el-select-tags-pl-38" not-required />
</div>
</x-tabs.tab>
@ -53,8 +58,11 @@
<x-tabs.tab id="other">
<div class="grid sm:grid-cols-6 gap-x-8 gap-y-6 my-3.5">
<x-form.group.text name="website" label="{{ trans('general.website') }}" form-group-class="col-span-6" not-required />
<x-form.group.text name="reference" label="{{ trans('general.reference') }}" form-group-class="col-span-6" not-required />
<x-form.input.hidden name="type" value="customer" />
<x-form.input.hidden name="enabled" value="1" />
</div>
</x-tabs.tab>

View File

@ -62,6 +62,7 @@
<x-form.group.text name="reference" label="{{ trans('general.reference') }}" form-group-class="col-span-6" not-required />
<x-form.input.hidden name="type" value="customer" />
<x-form.input.hidden name="enabled" value="1" />
</div>
</x-tabs.tab>