Fix supplier staging access and blade root
This commit is contained in:
parent
f300654479
commit
5b92dc57f8
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -122,3 +122,8 @@ docs/ai/restart/DAY0-AUDIT-*.txt
|
|||
# Windows TAPI probe outputs (generated locally)
|
||||
inspect-*.json
|
||||
netgescon-tapi-info.json
|
||||
scripts/ops/windows/netgescon-tapi-provider-report.json
|
||||
|
||||
# Local generated archives and runtime payloads
|
||||
storage/app/private/**
|
||||
storage/app/public/**
|
||||
|
|
|
|||
|
|
@ -166,12 +166,16 @@ public function getProdottiUrl(): string
|
|||
|
||||
public function getGoogleConnectUrl(): string
|
||||
{
|
||||
return route('oauth.google.redirect');
|
||||
return route('oauth.google.redirect', [
|
||||
'return_to' => request()->getRequestUri(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function getGoogleDisconnectUrl(): string
|
||||
{
|
||||
return route('oauth.google.disconnect');
|
||||
return route('oauth.google.disconnect', [
|
||||
'return_to' => request()->getRequestUri(),
|
||||
]);
|
||||
}
|
||||
|
||||
private function refreshArchiveSummary(): void
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
namespace App\Filament\Pages\Fornitore;
|
||||
|
||||
use App\Filament\Pages\Fornitore\Concerns\ResolvesOperatoreContext;
|
||||
use App\Filament\Pages\Gescon\RubricaUniversaleScheda;
|
||||
use App\Models\Fornitore;
|
||||
use App\Models\TicketIntervento;
|
||||
use App\Models\User;
|
||||
|
|
@ -147,12 +146,16 @@ public function getProdottiUrl(): string
|
|||
|
||||
public function getGoogleConnectUrl(): string
|
||||
{
|
||||
return route('oauth.google.redirect');
|
||||
return route('oauth.google.redirect', [
|
||||
'return_to' => request()->getRequestUri(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function getGoogleDisconnectUrl(): string
|
||||
{
|
||||
return route('oauth.google.disconnect');
|
||||
return route('oauth.google.disconnect', [
|
||||
'return_to' => request()->getRequestUri(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -176,7 +179,7 @@ protected function resolveCallerDataForRubrica(TicketIntervento $intervento): ar
|
|||
$telefono = trim((string) ($soggetto->telefono ?? '')) ?: $telefono;
|
||||
$email = trim((string) ($soggetto->email ?? ''));
|
||||
$origine = 'Richiedente ticket';
|
||||
$rubricaUrl = RubricaUniversaleScheda::getUrl(['record' => (int) $soggetto->id], panel: 'admin-filament');
|
||||
$rubricaUrl = $this->buildRubricaUrlForCurrentUser((int) $soggetto->id);
|
||||
$rubricaLabel = trim((string) ($soggetto->categoria ?? ''));
|
||||
} elseif ($ticket?->apertoDaUser) {
|
||||
$contatto = trim((string) ($ticket->apertoDaUser->name ?? '')) ?: $contatto;
|
||||
|
|
@ -205,6 +208,21 @@ protected function resolveCallerDataForRubrica(TicketIntervento $intervento): ar
|
|||
];
|
||||
}
|
||||
|
||||
protected function buildRubricaUrlForCurrentUser(int $rubricaId): ?string
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if (! $user instanceof User) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($user->hasAnyRole(['super-admin', 'admin', 'amministratore', 'collaboratore'])) {
|
||||
return \App\Filament\Pages\Gescon\RubricaUniversaleScheda::getUrl(['record' => $rubricaId], panel: 'admin-filament');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>|null
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
use App\Filament\Pages\Contabilita\EstrattoContoSoggetto;
|
||||
use App\Filament\Pages\Fornitore\Concerns\ResolvesOperatoreContext;
|
||||
use App\Filament\Pages\Fornitore\RubricaClienti;
|
||||
use App\Filament\Pages\Gescon\RubricaUniversaleScheda;
|
||||
use App\Filament\Pages\Gescon\StabileScheda;
|
||||
use App\Models\Fornitore;
|
||||
|
|
@ -706,12 +707,16 @@ public function getProdottiUrl(): string
|
|||
|
||||
public function getGoogleConnectUrl(): string
|
||||
{
|
||||
return route('oauth.google.redirect');
|
||||
return route('oauth.google.redirect', [
|
||||
'return_to' => request()->getRequestUri(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function getGoogleDisconnectUrl(): string
|
||||
{
|
||||
return route('oauth.google.disconnect');
|
||||
return route('oauth.google.disconnect', [
|
||||
'return_to' => request()->getRequestUri(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function canAssignDipendente(): bool
|
||||
|
|
@ -1127,7 +1132,7 @@ protected function resolveCallerData(?Ticket $ticket): array
|
|||
|
||||
$rubrica = $this->resolveCallerRubrica($ticket, $caller);
|
||||
if ($rubrica instanceof RubricaUniversale) {
|
||||
$caller['rubrica_url'] = RubricaUniversaleScheda::getUrl(['record' => (int) $rubrica->id], panel: 'admin-filament');
|
||||
$caller['rubrica_url'] = $this->buildCallerRubricaUrl($rubrica, $caller);
|
||||
$caller['telefono'] = trim((string) ($rubrica->telefono_cellulare ?: $rubrica->telefono_ufficio ?: $rubrica->telefono_casa ?: '')) ?: $caller['telefono'];
|
||||
$caller['email'] = trim((string) ($rubrica->email ?? '')) ?: $caller['email'];
|
||||
}
|
||||
|
|
@ -1144,7 +1149,7 @@ protected function resolveCallerData(?Ticket $ticket): array
|
|||
|
||||
$caller['telefono'] = trim((string) ($rubrica->telefono_cellulare ?: $rubrica->telefono_ufficio ?: $rubrica->telefono_casa ?: '')) ?: $caller['telefono'];
|
||||
$caller['email'] = trim((string) ($rubrica->email ?? '')) ?: $caller['email'];
|
||||
$caller['rubrica_url'] = RubricaUniversaleScheda::getUrl(['record' => (int) $rubrica->id], panel: 'admin-filament');
|
||||
$caller['rubrica_url'] = $this->buildCallerRubricaUrl($rubrica, $caller);
|
||||
$caller['sorgente'] = 'Rubrica dedotta dal ticket';
|
||||
}
|
||||
|
||||
|
|
@ -1158,6 +1163,24 @@ protected function resolveCallerData(?Ticket $ticket): array
|
|||
return $caller;
|
||||
}
|
||||
|
||||
protected function buildCallerRubricaUrl(RubricaUniversale $rubrica, array $caller): ?string
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user instanceof User && $user->hasAnyRole(['super-admin', 'admin', 'amministratore', 'collaboratore'])) {
|
||||
return RubricaUniversaleScheda::getUrl(['record' => (int) $rubrica->id], panel: 'admin-filament');
|
||||
}
|
||||
|
||||
if (! $this->fornitore instanceof Fornitore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$search = trim((string) ($rubrica->nome_completo ?: $rubrica->ragione_sociale ?: $caller['contatto'] ?: $caller['telefono'] ?: $caller['email'] ?: ''));
|
||||
$url = RubricaClienti::getUrl(['fornitore' => (int) $this->fornitore->id], panel: 'admin-filament');
|
||||
|
||||
return $search !== '' ? ($url . '?search=' . urlencode($search)) : $url;
|
||||
}
|
||||
|
||||
protected function buildCallerReference(?Ticket $ticket, string $parsedReference = ''): string
|
||||
{
|
||||
if (! $ticket instanceof Ticket) {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,10 @@
|
|||
<div class="mt-3 flex flex-wrap gap-2">
|
||||
<a href="{{ $this->getGoogleConnectUrl() }}" class="inline-flex items-center rounded-md bg-white px-3 py-1.5 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Collega / aggiorna Google</a>
|
||||
@if($googleWorkspaceStatus['connected'])
|
||||
<a href="{{ $this->getGoogleDisconnectUrl() }}" class="inline-flex items-center rounded-md bg-rose-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-rose-500">Scollega</a>
|
||||
<form method="POST" action="{{ $this->getGoogleDisconnectUrl() }}">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex items-center rounded-md bg-rose-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-rose-500">Scollega</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
<div class="mt-3 text-xs text-gray-500">Questo blocco prepara l'uso fornitore di rubrica, calendario e Drive sullo stesso backend Google gia presente nel progetto.</div>
|
||||
|
|
|
|||
|
|
@ -154,7 +154,6 @@
|
|||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 whitespace-pre-wrap rounded-lg bg-gray-50 p-3 text-sm text-gray-700">{{ $ticket->descrizione }}</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -539,7 +538,10 @@
|
|||
<div class="mt-3 flex flex-wrap gap-2">
|
||||
<a href="{{ $this->getGoogleConnectUrl() }}" class="inline-flex items-center rounded-md bg-white px-3 py-1.5 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-300 hover:bg-gray-50">Collega / aggiorna Google</a>
|
||||
@if($googleWorkspaceStatus['connected'])
|
||||
<a href="{{ $this->getGoogleDisconnectUrl() }}" class="inline-flex items-center rounded-md bg-rose-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-rose-500">Scollega</a>
|
||||
<form method="POST" action="{{ $this->getGoogleDisconnectUrl() }}">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex items-center rounded-md bg-rose-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-rose-500">Scollega</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
<div class="mt-2 text-xs text-gray-500">Questo e il primo aggancio operativo per riusare contatti, calendario e Drive nello spazio fornitore con lo stesso account Google gia gestito dal backend.</div>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
Route::middleware(['auth', 'verified'])->group(function () {
|
||||
|
||||
// OAuth Google (Calendar / Rubrica)
|
||||
Route::middleware(['role:super-admin|admin|amministratore'])
|
||||
Route::middleware(['role:super-admin|admin|amministratore|fornitore'])
|
||||
->prefix('oauth/google')
|
||||
->name('oauth.google.')
|
||||
->group(function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user