first tr classname & hidden mobile controlled
This commit is contained in:
parent
cf5f65310e
commit
f84dcb0c78
@ -11,6 +11,7 @@ class Td extends Component
|
||||
public $override;
|
||||
|
||||
public $kind;
|
||||
public $hiddenMobile;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
@ -18,11 +19,12 @@ class Td extends Component
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
string $class = '', string $override = '', string $kind = ''
|
||||
string $class = '', string $override = '', string $kind = '', bool $hiddenMobile = false,
|
||||
) {
|
||||
$this->override = $this->getOverride($override);
|
||||
|
||||
$this->kind = $kind;
|
||||
$this->hiddenMobile = $hiddenMobile;
|
||||
$this->class = $this->getClass($class);
|
||||
}
|
||||
|
||||
@ -47,6 +49,10 @@ class Td extends Component
|
||||
return $class;
|
||||
}
|
||||
|
||||
if ($this->hiddenMobile) {
|
||||
$class = $class . ' ' . 'hidden sm:table-cell';
|
||||
}
|
||||
|
||||
$default = 'py-4 whitespace-nowrap text-sm font-normal text-black truncate';
|
||||
|
||||
switch ($this->kind) {
|
||||
|
@ -12,17 +12,20 @@ class Th extends Component
|
||||
|
||||
public $kind;
|
||||
|
||||
public $hiddenMobile;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
string $class = '', string $override = '', string $kind = ''
|
||||
string $class = '', string $override = '', string $kind = '', bool $hiddenMobile = false,
|
||||
) {
|
||||
$this->override = $this->getOverride($override);
|
||||
|
||||
$this->kind = $kind;
|
||||
$this->hiddenMobile = $hiddenMobile;
|
||||
$this->class = $this->getClass($class);
|
||||
}
|
||||
|
||||
@ -47,6 +50,10 @@ class Th extends Component
|
||||
return $class;
|
||||
}
|
||||
|
||||
if ($this->hiddenMobile) {
|
||||
$class = $class . ' ' . 'hidden sm:table-cell';
|
||||
}
|
||||
|
||||
$default = 'py-3 text-xs font-medium text-black tracking-wider';
|
||||
|
||||
switch ($this->kind) {
|
||||
|
@ -45,6 +45,10 @@ class Tr extends Component
|
||||
return 'relative flex items-center px-1 group border-b hover:bg-gray-100';
|
||||
}
|
||||
|
||||
else if (array_key_exists('App\View\Components\Table\Thead', $values)) {
|
||||
return 'flex items-center px-1';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -234,7 +234,7 @@
|
||||
@if ($transactions->count())
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="w-6/12 lg:w-3/12">
|
||||
<x-slot name="first">
|
||||
<x-sortablelink column="paid_at" title="{{ trans('general.date') }}" />
|
||||
@ -334,7 +334,7 @@
|
||||
@if ($transfers->count())
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="w-3/12 hidden sm:table-cell">
|
||||
<x-slot name="first">
|
||||
<x-sortablelink column="expense_transaction.paid_at" title="{{ trans('general.created_date') }}" />
|
||||
|
@ -88,7 +88,7 @@
|
||||
<div class="py-2 align-middle inline-block min-w-full">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead>
|
||||
<tr class="flex items-center px-1">
|
||||
<tr>
|
||||
<th scope="col" class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
|
||||
{{ trans('general.date') }}
|
||||
</th>
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="w-2/12 hidden sm:table-cell">
|
||||
{{ trans('general.date') }}
|
||||
</x-table.th>
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -38,7 +38,7 @@
|
||||
<x-tabs.tab id="recurring-templates">
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -91,7 +91,7 @@
|
||||
<x-tabs.tab id="transactions">
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -43,8 +43,8 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" hidden-mobile override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
||||
@ -57,11 +57,11 @@
|
||||
</x-slot>
|
||||
</x-table.th>
|
||||
|
||||
<x-table.th class="w-3/12 hidden sm:table-cell">
|
||||
<x-table.th class="w-3/12" hidden-mobile>
|
||||
<x-sortablelink column="category.name" title="{{ trans_choice('general.categories', 1) }}" />
|
||||
</x-table.th>
|
||||
|
||||
<x-table.th class="w-2/12 hidden sm:table-cell">
|
||||
<x-table.th class="w-2/12" hidden-mobile>
|
||||
{{ trans_choice('general.taxes', 2) }}
|
||||
</x-table.th>
|
||||
|
||||
@ -79,11 +79,11 @@
|
||||
<x-table.tbody>
|
||||
@foreach($items as $item)
|
||||
<x-table.tr href="{{ route('items.edit', $item->id) }}">
|
||||
<x-table.td class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-table.td class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" hidden-mobile override="class">
|
||||
<x-index.bulkaction.single id="{{ $item->id }}" name="{{ $item->name }}" />
|
||||
</x-table.td>
|
||||
|
||||
<x-table.td class="w-6/12 sm:w-4/12 truncate">
|
||||
<x-table.td class="w-6/12 sm:w-4/12">
|
||||
<x-slot name="first" class="flex items-center font-bold" override="class">
|
||||
<div class="truncate">
|
||||
{{ $item->name }}
|
||||
@ -98,13 +98,13 @@
|
||||
</x-slot>
|
||||
</x-table.td>
|
||||
|
||||
<x-table.td class="w-3/12 truncate hidden sm:table-cell">
|
||||
<x-table.td class="w-3/12" hidden-mobile>
|
||||
<div class="flex items-center">
|
||||
<x-index.category :model="$item->category" />
|
||||
</div>
|
||||
</x-table.td>
|
||||
|
||||
<x-table.td class="w-2/12 hidden sm:table-cell">
|
||||
<x-table.td class="w-2/12" hidden-mobile>
|
||||
@if ($item->taxes->count())
|
||||
@foreach($item->taxes as $tax)
|
||||
<span class="bg-lilac-900 px-3 py-1 text-sm rounded-lg text-black ltr:mr-3 rtl:ml-3">
|
||||
@ -116,7 +116,7 @@
|
||||
@endif
|
||||
</x-table.td>
|
||||
|
||||
<x-table.td class="relative w-6/12 sm:w-3/12" kind="amount">
|
||||
<x-table.td class="w-6/12 sm:w-3/12" kind="amount">
|
||||
<x-slot name="first">
|
||||
@if ($item->sale_price)
|
||||
<x-money :amount="$item->sale_price" :currency="setting('default.currency')" convert />
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
@if (! $hideBulkAction)
|
||||
<x-table.th class="{{ $classBulkAction }}" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
|
@ -171,7 +171,7 @@
|
||||
@if ($documents->count())
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="w-4/12 lg:w-3/12">
|
||||
<x-slot name="first">
|
||||
<x-sortablelink column="due_at" title="{{ trans('invoices.due_date') }}" />
|
||||
@ -260,7 +260,7 @@
|
||||
@if ($transactions->count())
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="w-4/12 lg:w-3/12">
|
||||
<x-slot name="first">
|
||||
<x-sortablelink column="paid_at" title="{{ trans('general.date') }}" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
@if (! $hideBulkAction)
|
||||
<x-table.th class="{{ $classBulkAction }}" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
@if (! $hideBulkAction)
|
||||
<x-table.th class="{{ $classBulkAction }}" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
|
@ -55,7 +55,7 @@
|
||||
<x-index.container class="my-0" override="class">
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="w-3/12">
|
||||
{{ trans('general.name') }}
|
||||
</x-table.th>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th override="class" class="p-0"></x-table.th>
|
||||
@stack('issued_at_th_start')
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th override="class" class="p-0"></x-table.th>
|
||||
|
||||
<x-table.th class="w-4/12 sm:w-3/12">
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
<x-table>
|
||||
<x-table.thead>
|
||||
<x-table.tr class="flex items-center px-1">
|
||||
<x-table.tr>
|
||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
||||
<x-index.bulkaction.all />
|
||||
</x-table.th>
|
||||
|
Loading…
x
Reference in New Issue
Block a user