refactor(platform-orders): extract blocked hint component for tool actions

This commit is contained in:
萝卜
2026-03-17 09:52:34 +08:00
parent 78eef42d57
commit 28e9e3bbe8
2 changed files with 103 additions and 65 deletions

View 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>

View File

@@ -875,19 +875,20 @@
<div class="mt-6"> <div class="mt-6">
<button class="btn btn-sm" type="submit" @disabled($batchActivateBlocked) title="{{ $batchActivateBlockedReason }}">批量同步订阅(当前筛选范围)</button> <button class="btn btn-sm" type="submit" @disabled($batchActivateBlocked) title="{{ $batchActivateBlockedReason }}">批量同步订阅(当前筛选范围)</button>
@if($batchActivateBlocked) @if($batchActivateBlocked)
<div class="adm-tool-blocked-hint" data-role="batch-activate-subscriptions-blocked-hint"> @php
<div>提示:{{ $batchActivateBlockedReason }}</div> // 提效被阻断时给一键跳转到「可同步订阅集合」口径syncable_only=1 + sync_status=unsynced
@php $goSyncableUrl = $buildQuickFilterUrl([
// 提效被阻断时给一键跳转到「可同步订阅集合」口径syncable_only=1 + sync_status=unsynced 'syncable_only' => '1',
$goSyncableUrl = $buildQuickFilterUrl([ 'sync_status' => 'unsynced',
'syncable_only' => '1', ]);
'sync_status' => 'unsynced', @endphp
]); @include('admin.components.tool_blocked_hint', [
@endphp 'dataRole' => 'batch-activate-subscriptions-blocked-hint',
<div class="mt-6 actions gap-10"> 'reason' => $batchActivateBlockedReason,
<a class="btn btn-secondary btn-sm" href="{!! $goSyncableUrl !!}">切到可同步订阅集合</a> 'actions' => [
</div> ['label' => '切到可同步订阅集合', 'url' => $goSyncableUrl],
</div> ],
])
@endif @endif
</div> </div>
</form> </form>
@@ -931,19 +932,20 @@
<div class="mt-6"> <div class="mt-6">
<button class="btn btn-sm" type="submit" @disabled($batchBmpaBlocked) title="{{ $batchBmpaBlockedReason }}">批量标记支付并生效(含订阅同步)(当前筛选范围)</button> <button class="btn btn-sm" type="submit" @disabled($batchBmpaBlocked) title="{{ $batchBmpaBlockedReason }}">批量标记支付并生效(含订阅同步)(当前筛选范围)</button>
@if($batchBmpaBlocked) @if($batchBmpaBlocked)
<div class="adm-tool-blocked-hint" data-role="batch-bmpa-blocked-hint"> @php
<div>提示:{{ $batchBmpaBlockedReason }}</div> // 提效被阻断时给一键跳转到「可BMPA处理集合」口径pending + unpaid
@php $goBmpaProcessableUrl = $buildQuickFilterUrl([
// 提效被阻断时给一键跳转到「可BMPA处理集合」口径pending + unpaid 'status' => 'pending',
$goBmpaProcessableUrl = $buildQuickFilterUrl([ 'payment_status' => 'unpaid',
'status' => 'pending', ]);
'payment_status' => 'unpaid', @endphp
]); @include('admin.components.tool_blocked_hint', [
@endphp 'dataRole' => 'batch-bmpa-blocked-hint',
<div class="mt-6 actions gap-10"> 'reason' => $batchBmpaBlockedReason,
<a class="btn btn-secondary btn-sm" href="{!! $goBmpaProcessableUrl !!}">切到可BMPA处理集合</a> 'actions' => [
</div> ['label' => '切到可BMPA处理集合', 'url' => $goBmpaProcessableUrl],
</div> ],
])
@endif @endif
</div> </div>
</form> </form>
@@ -987,21 +989,22 @@
<div class="mt-6"> <div class="mt-6">
<button class="btn btn-sm" type="submit" @disabled($batchMarkActivatedBlocked) title="{{ $batchMarkActivatedBlockedReason }}">批量仅标记为已生效(当前筛选范围)</button> <button class="btn btn-sm" type="submit" @disabled($batchMarkActivatedBlocked) title="{{ $batchMarkActivatedBlockedReason }}">批量仅标记为已生效(当前筛选范围)</button>
@if($batchMarkActivatedBlocked) @if($batchMarkActivatedBlocked)
<div class="adm-tool-blocked-hint" data-role="batch-mark-activated-blocked-hint"> @php
<div>提示:{{ $batchMarkActivatedBlockedReason }}</div> // 提效当被阻断时给一键跳转到“待生效集合”的入口口径paid + pending + sync_status=unsynced
@php // 说明:使用快捷筛选构造器,保留上下文(站点/套餐/订阅/keyword/lead/时间范围/back并自动清空 page 与工具型开关。
// 提效当被阻断时给一键跳转到“待生效集合”的入口口径paid + pending + sync_status=unsynced $goPaidPendingUnsyncedUrl = $buildQuickFilterUrl([
// 说明:使用快捷筛选构造器,保留上下文(站点/套餐/订阅/keyword/lead/时间范围/back并自动清空 page 与工具型开关。 'payment_status' => 'paid',
$goPaidPendingUnsyncedUrl = $buildQuickFilterUrl([ 'status' => 'pending',
'payment_status' => 'paid', 'sync_status' => 'unsynced',
'status' => 'pending', ]);
'sync_status' => 'unsynced', @endphp
]); @include('admin.components.tool_blocked_hint', [
@endphp 'dataRole' => 'batch-mark-activated-blocked-hint',
<div class="mt-6 actions gap-10"> 'reason' => $batchMarkActivatedBlockedReason,
<a class="btn btn-secondary btn-sm" href="{!! $goPaidPendingUnsyncedUrl !!}">切到待生效集合</a> 'actions' => [
</div> ['label' => '切到待生效集合', 'url' => $goPaidPendingUnsyncedUrl],
</div> ],
])
@endif @endif
</div> </div>
</form> </form>
@@ -1037,18 +1040,19 @@
<div class="mt-6"> <div class="mt-6">
<button class="btn btn-danger btn-sm" type="submit" @disabled($clearSyncBlocked) title="{{ $clearSyncBlockedReason }}">清除同步失败标记(当前筛选范围)</button> <button class="btn btn-danger btn-sm" type="submit" @disabled($clearSyncBlocked) title="{{ $clearSyncBlockedReason }}">清除同步失败标记(当前筛选范围)</button>
@if($clearSyncBlocked) @if($clearSyncBlocked)
<div class="adm-tool-blocked-hint" data-role="clear-sync-errors-blocked-hint"> @php
<div>提示:{{ $clearSyncBlockedReason }}</div> // 提效:清理同步失败标记前必须先锁定失败集合;被阻断时给一键跳转入口。
@php $goSyncFailedUrl = $buildQuickFilterUrl([
// 提效:清理同步失败标记前必须先锁定失败集合;被阻断时给一键跳转入口。 'sync_status' => 'failed',
$goSyncFailedUrl = $buildQuickFilterUrl([ ]);
'sync_status' => 'failed', @endphp
]); @include('admin.components.tool_blocked_hint', [
@endphp 'dataRole' => 'clear-sync-errors-blocked-hint',
<div class="mt-6 actions gap-10"> 'reason' => $clearSyncBlockedReason,
<a class="btn btn-secondary btn-sm" href="{!! $goSyncFailedUrl !!}">切到同步失败集合</a> 'actions' => [
</div> ['label' => '切到同步失败集合', 'url' => $goSyncFailedUrl],
</div> ],
])
@endif @endif
</div> </div>
</form> </form>
@@ -1083,18 +1087,19 @@
<div class="mt-6"> <div class="mt-6">
<button class="btn btn-danger btn-sm" type="submit" @disabled($clearBmpaBlocked) title="{{ $clearBmpaBlockedReason }}">清除批量标记支付失败标记(当前筛选范围)</button> <button class="btn btn-danger btn-sm" type="submit" @disabled($clearBmpaBlocked) title="{{ $clearBmpaBlockedReason }}">清除批量标记支付失败标记(当前筛选范围)</button>
@if($clearBmpaBlocked) @if($clearBmpaBlocked)
<div class="adm-tool-blocked-hint" data-role="clear-bmpa-errors-blocked-hint"> @php
<div>提示:{{ $clearBmpaBlockedReason }}</div> // 提效:清理 BMPA 失败标记前必须先锁定 BMPA 失败集合;被阻断时给一键跳转入口。
@php $goBmpaFailedUrl = $buildQuickFilterUrl([
// 提效:清理 BMPA 失败标记前必须先锁定 BMPA 失败集合;被阻断时给一键跳转入口。 'bmpa_failed_only' => '1',
$goBmpaFailedUrl = $buildQuickFilterUrl([ ]);
'bmpa_failed_only' => '1', @endphp
]); @include('admin.components.tool_blocked_hint', [
@endphp 'dataRole' => 'clear-bmpa-errors-blocked-hint',
<div class="mt-6 actions gap-10"> 'reason' => $clearBmpaBlockedReason,
<a class="btn btn-secondary btn-sm" href="{!! $goBmpaFailedUrl !!}">切到 BMPA 失败集合</a> 'actions' => [
</div> ['label' => '切到 BMPA 失败集合', 'url' => $goBmpaFailedUrl],
</div> ],
])
@endif @endif
</div> </div>
</form> </form>