Require package reinstall after industry change and wipe old queues.
Deploy Ladill Queue / deploy (push) Successful in 1m5s
Deploy Ladill Queue / deploy (push) Successful in 1m5s
Changing industry now flags a pending reinstall with an app banner; reinstall clears queues, tickets, and service points before applying the new template. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,6 +22,38 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@auth
|
||||
@php
|
||||
$industryBannerOrg = app(\App\Services\Qms\OrganizationResolver::class)->resolveForUser(auth()->user());
|
||||
$industryNeedsReinstall = $industryBannerOrg
|
||||
&& \App\Services\Qms\Industry\IndustryPackageInstaller::needsReinstall($industryBannerOrg);
|
||||
$industryCanManage = $industryNeedsReinstall
|
||||
&& app(\App\Services\Qms\QmsPermissions::class)->can(
|
||||
app(\App\Services\Qms\OrganizationResolver::class)->memberFor(auth()->user(), $industryBannerOrg),
|
||||
'settings.manage'
|
||||
);
|
||||
$industrySelectedLabel = $industryNeedsReinstall
|
||||
? (app(\App\Services\Qms\Industry\IndustryPackageRegistry::class)
|
||||
->get((string) data_get($industryBannerOrg->settings, 'industry'))
|
||||
?->label() ?? data_get($industryBannerOrg->settings, 'industry'))
|
||||
: null;
|
||||
@endphp
|
||||
@if ($industryCanManage && ! request()->routeIs('qms.settings.*'))
|
||||
<div class="mb-4 rounded-xl border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-950 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100">
|
||||
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<p class="font-semibold">Reinstall industry package required</p>
|
||||
<p class="mt-1">
|
||||
Industry is set to <span class="font-medium">{{ $industrySelectedLabel }}</span>, but the installed queues still match the previous template.
|
||||
Reinstall to clear old queues and apply the new package.
|
||||
</p>
|
||||
</div>
|
||||
<a href="{{ route('qms.settings.edit') }}" class="btn-primary shrink-0 text-sm">Open settings</a>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endauth
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="mb-4 rounded-lg bg-red-50 border border-red-200 p-4">
|
||||
<p class="text-sm font-medium text-red-800">Please fix the following:</p>
|
||||
|
||||
@@ -153,18 +153,34 @@
|
||||
</form>
|
||||
|
||||
{{-- Separate form: nested forms break Save settings in browsers --}}
|
||||
@if ($canManage && $activePackage)
|
||||
@if ($canManage && ($selectedPackage ?? $activePackage))
|
||||
@php $templatePackage = $selectedPackage ?? $activePackage; @endphp
|
||||
<div class="mt-6">
|
||||
<x-settings.card title="Industry template" description="Re-sync departments, stages, service points, workflow, and announcement copy from the selected industry package. Existing tickets are kept.">
|
||||
@if ($needsPackageReinstall ?? false)
|
||||
<div class="mb-4 rounded-xl border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-950 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100">
|
||||
<p class="font-semibold">Industry package reinstall required</p>
|
||||
<p class="mt-1">
|
||||
You selected <span class="font-medium">{{ $templatePackage->label() }}</span>, but the installed template still matches
|
||||
<span class="font-medium">{{ $activePackage?->label() ?? 'the previous industry' }}</span>.
|
||||
Reinstall to clear old queues and apply the new service points.
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
<x-settings.card
|
||||
title="Industry template"
|
||||
description="Reinstall replaces departments, stages, service points, and workflow from the selected industry package. Existing queues, tickets, and related data are cleared."
|
||||
>
|
||||
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<p class="text-sm text-slate-600">
|
||||
{{ $activePackage->label() }} uses
|
||||
<span class="font-medium text-slate-900">{{ count($activePackage->stages()) }}</span> workflow stages and
|
||||
industry-specific terminology ({{ $activePackage->terminology()['ticket'] ?? 'Ticket' }}).
|
||||
{{ $templatePackage->label() }} uses
|
||||
<span class="font-medium text-slate-900">{{ count($templatePackage->stages()) }}</span> workflow stages and
|
||||
industry-specific terminology ({{ $templatePackage->terminology()['ticket'] ?? 'Ticket' }}).
|
||||
</p>
|
||||
<form method="POST" action="{{ route('qms.settings.package.reinstall') }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn-secondary shrink-0 text-sm">Reinstall package</button>
|
||||
<button type="submit" class="{{ ($needsPackageReinstall ?? false) ? 'btn-primary' : 'btn-secondary' }} shrink-0 text-sm">
|
||||
{{ ($needsPackageReinstall ?? false) ? 'Reinstall package now' : 'Reinstall package' }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</x-settings.card>
|
||||
|
||||
Reference in New Issue
Block a user