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_TYPE = 'customer';
public const DEFAULT_PLURAL_TYPE = 'customers'; public const DEFAULT_PLURAL_TYPE = 'customers';
public $id;
public $document; public $document;
public $hideShow; public $hideShow;
@ -23,22 +25,20 @@ class Information extends Component
public $placement; public $placement;
public $id;
/** /**
* Create a new component instance. * Create a new component instance.
* *
* @return void * @return void
*/ */
public function __construct( 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->document = $document;
$this->hideShow = $hideShow; $this->hideShow = $hideShow;
$this->showRoute = $this->getShowRoute($document->contact->type, $showRoute); $this->showRoute = $this->getShowRoute($document->contact->type, $showRoute);
$this->showDocumentRoute = $this->getShowRoute($document->type, $showDocumentRoute); $this->showDocumentRoute = $this->getShowRoute($document->type, $showDocumentRoute);
$this->placement = (! empty($placement)) ? $placement : 'left'; $this->placement = (! empty($placement)) ? $placement : 'left';
$this->id = (! empty($id)) ? $id : 'tooltip-information-' . $document->id;
} }
/** /**

View File

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

View File

@ -42,7 +42,7 @@ class Actions extends Component
$actions = []; $actions = [];
if ($this->model && !empty($this->model->line_actions)) { if ($this->model && ! empty($this->model->line_actions)) {
$actions = $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" class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions"
@click="onDeleteViaConfirmation('delete-{{ $modelTable }}-{{ $id }}')" @click="onDeleteViaConfirmation('delete-{{ $modelTable }}-{{ $id }}')"
override="class" override="class"
{{ $attributes }}
> >
@if ($slot->isNotEmpty()) @if ($slot->isNotEmpty())
{!! $slot !!} {!! $slot !!}

View File

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

View File

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

View File

@ -9,7 +9,7 @@
<x-slot name="body"> <x-slot name="body">
@if ($transaction->children()->count()) @if ($transaction->children()->count())
@foreach ($transaction->children()->get() as $child) @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"> <div class="my-2">
{!! trans('recurring.child', ['url' => $url, 'date' => company_date($child->paid_at)]) !!} {!! trans('recurring.child', ['url' => $url, 'date' => company_date($child->paid_at)]) !!}

View File

@ -18,7 +18,7 @@
@php @php
$recurring_message = trans('recurring.message_parent', [ $recurring_message = trans('recurring.message_parent', [
'type' => mb_strtolower(trans_choice($textRecurringType, 1)), '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 @endphp

View File

@ -5,7 +5,7 @@
@php @php
$from_account = '<span class="font-medium">' . $transfer->expense_account->title . '</span>'; $from_account = '<span class="font-medium">' . $transfer->expense_account->title . '</span>';
$to_account = '<span class="font-medium">' . $transfer->income_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 @endphp
@endif @endif

View File

@ -30,9 +30,11 @@
<x-tabs.tab id="general"> <x-tabs.tab id="general">
<div class="grid sm:grid-cols-6 gap-x-8 gap-y-6 my-3.5"> <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="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="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="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.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)" /> <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.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="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="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.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 /> <x-form.group.country form-group-class="col-span-6 el-select-tags-pl-38" not-required />
</div> </div>
</x-tabs.tab> </x-tabs.tab>
@ -53,8 +58,11 @@
<x-tabs.tab id="other"> <x-tabs.tab id="other">
<div class="grid sm:grid-cols-6 gap-x-8 gap-y-6 my-3.5"> <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="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.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="type" value="customer" />
<x-form.input.hidden name="enabled" value="1" /> <x-form.input.hidden name="enabled" value="1" />
</div> </div>
</x-tabs.tab> </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.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="type" value="customer" />
<x-form.input.hidden name="enabled" value="1" /> <x-form.input.hidden name="enabled" value="1" />
</div> </div>
</x-tabs.tab> </x-tabs.tab>