Я использую Livewire 3.
Код компонента Blade:< /p>
Select Cluster:
Select Cluster
@if( count($clusters) && isset($clusters[0]['khushecode']) )
@foreach($clusters as $c)
{{$c['khushename']}}
@endforeach
@endif
@if( !count($clusters) )
Loading...
@endif
Select Group:
Select Group
@if($this->cluster && count($groups))
@foreach($groups as $g)
{{$g['groupname']}}
@endforeach
@endif
@if( $cluster && !count($groups) )
Loading...
@endif
Select Standard:
Select Standard
@if($this->group && count($standards))
@foreach($standards as $s)
{{$s['name']}}
@endforeach
@endif
@if( $group && !count($standards) )
Loading...
@endif
@if( $standard )
Standard title:
{{$standardInfo['name']}}
Standard code:
{{verta()->enToFaNumbers($standardInfo['ccode'])}}
Standard time:
{{verta()->enToFaNumbers($standardInfo['jam'])}} Hours
Add Standard
@endif
- @foreach($this->requestStandards as $s)
- id="standard-{{ $s['standardid'] }}-tab" data-tabs-target="#standard-{{ $s['standardid'] }}"
role="tab" aria-controls="standard-{{ $s['standardid'] }}" aria-selected="false">
Delete from list
{{$s['name']}}
@endforeach
@foreach($this->requestStandards as $s)
Standard title:
{{$s['name']}}
Standard code:
{{verta()->enToFaNumbers($s['ccode'])}}
Standard time:
{{verta()->enToFaNumbers($s['jam'])}} Hours
Cluster title:
{{$s['cluster']}}
Group title:
{{$s['group']}}
Delete from list
@endforeach
@endif
@script
Livewire.hook('morph.updated', ({ el, component }) => {
tabElements = [
@php
$item = 0;
$first_item = 0;
@endphp
@foreach($requestStandards as $s)
@php
if($item == 0) $first_item = $s['standardid'];
$item++;
@endphp
{
id: "standard-{{ $s['standardid'] }}",
triggerEl: document.querySelector("#standard-{{ $s['standardid'] }}-tab"),
targetEl: document.querySelector("#standard-{{ $s['standardid'] }}"),
},
@endforeach
];
tabs = new Tabs(tabsElement, tabElements, options, instanceOptions);
initFlowbite();
})
const tabsElement = document.getElementById('tabs-standard');
let tabElements = [
@php
$item = 0;
$first_item = 0;
@endphp
@foreach($requestStandards as $s)
@php
if($item == 0) $first_item = $s['standardid'];
$item++;
@endphp
{
id: "standard-{{ $s['standardid'] }}",
triggerEl: document.querySelector("#standard-{{ $s['standardid'] }}-tab"),
targetEl: document.querySelector("#standard-{{ $s['standardid'] }}"),
},
@endforeach
];
const options = {
defaultTabId: "standard-{{ $first_item }}",
activeClasses:
'bg-cyan-600 text-cyan-50',
inactiveClasses:
'hover:bg-purple-600 hover:text-purple-50 group text-purple-700',
};
const instanceOptions = {
id: 'tabs-standard',
override: true
};
let tabs = null
if(tabElements.length)
tabs = new Tabs(tabsElement, tabElements, options, instanceOptions);
@endscript
Подробнее здесь: https://stackoverflow.com/questions/791 ... -an-update
Мобильная версия