refactor(platform-orders): extract blocked hint component for tool actions
This commit is contained in:
33
resources/views/admin/components/tool_blocked_hint.blade.php
Normal file
33
resources/views/admin/components/tool_blocked_hint.blade.php
Normal file
@@ -0,0 +1,33 @@
|
||||
@php
|
||||
/**
|
||||
* 通用“工具被阻断提示块”。
|
||||
*
|
||||
* 用法:
|
||||
* @include('admin.components.tool_blocked_hint', [
|
||||
* 'dataRole' => 'xxx-blocked-hint',
|
||||
* 'reason' => '提示原因',
|
||||
* // actions: [['label' => '去xxx', 'url' => $url], ...]
|
||||
* 'actions' => [ ... ],
|
||||
* ])
|
||||
*/
|
||||
$dataRole = (string) ($dataRole ?? '');
|
||||
$reason = (string) ($reason ?? '');
|
||||
$actions = (array) ($actions ?? []);
|
||||
@endphp
|
||||
|
||||
<div class="adm-tool-blocked-hint" @if($dataRole !== '') data-role="{{ $dataRole }}" @endif>
|
||||
<div>提示:{{ $reason }}</div>
|
||||
@if(count($actions) > 0)
|
||||
<div class="mt-6 actions gap-10">
|
||||
@foreach($actions as $a)
|
||||
@php
|
||||
$label = (string) ($a['label'] ?? '');
|
||||
$url = (string) ($a['url'] ?? '');
|
||||
@endphp
|
||||
@if($label !== '' && $url !== '')
|
||||
<a class="btn btn-secondary btn-sm" href="{!! $url !!}">{{ $label }}</a>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user