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)
|
# Windows TAPI probe outputs (generated locally)
|
||||||
inspect-*.json
|
inspect-*.json
|
||||||
netgescon-tapi-info.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
|
public function getGoogleConnectUrl(): string
|
||||||
{
|
{
|
||||||
return route('oauth.google.redirect');
|
return route('oauth.google.redirect', [
|
||||||
|
'return_to' => request()->getRequestUri(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGoogleDisconnectUrl(): string
|
public function getGoogleDisconnectUrl(): string
|
||||||
{
|
{
|
||||||
return route('oauth.google.disconnect');
|
return route('oauth.google.disconnect', [
|
||||||
|
'return_to' => request()->getRequestUri(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function refreshArchiveSummary(): void
|
private function refreshArchiveSummary(): void
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
namespace App\Filament\Pages\Fornitore;
|
namespace App\Filament\Pages\Fornitore;
|
||||||
|
|
||||||
use App\Filament\Pages\Fornitore\Concerns\ResolvesOperatoreContext;
|
use App\Filament\Pages\Fornitore\Concerns\ResolvesOperatoreContext;
|
||||||
use App\Filament\Pages\Gescon\RubricaUniversaleScheda;
|
|
||||||
use App\Models\Fornitore;
|
use App\Models\Fornitore;
|
||||||
use App\Models\TicketIntervento;
|
use App\Models\TicketIntervento;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
@ -147,12 +146,16 @@ public function getProdottiUrl(): string
|
||||||
|
|
||||||
public function getGoogleConnectUrl(): string
|
public function getGoogleConnectUrl(): string
|
||||||
{
|
{
|
||||||
return route('oauth.google.redirect');
|
return route('oauth.google.redirect', [
|
||||||
|
'return_to' => request()->getRequestUri(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGoogleDisconnectUrl(): string
|
public function getGoogleDisconnectUrl(): string
|
||||||
{
|
{
|
||||||
return route('oauth.google.disconnect');
|
return route('oauth.google.disconnect', [
|
||||||
|
'return_to' => request()->getRequestUri(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -163,20 +166,20 @@ protected function resolveCallerDataForRubrica(TicketIntervento $intervento): ar
|
||||||
$ticket = $intervento->ticket;
|
$ticket = $intervento->ticket;
|
||||||
$parsed = $this->extractCallerData((string) ($ticket?->descrizione ?? ''));
|
$parsed = $this->extractCallerData((string) ($ticket?->descrizione ?? ''));
|
||||||
|
|
||||||
$contatto = $parsed['contatto'];
|
$contatto = $parsed['contatto'];
|
||||||
$telefono = $parsed['telefono'];
|
$telefono = $parsed['telefono'];
|
||||||
$email = '';
|
$email = '';
|
||||||
$origine = 'Descrizione ticket';
|
$origine = 'Descrizione ticket';
|
||||||
$rubricaUrl = null;
|
$rubricaUrl = null;
|
||||||
$rubricaLabel = '';
|
$rubricaLabel = '';
|
||||||
|
|
||||||
if ($ticket?->soggettoRichiedente) {
|
if ($ticket?->soggettoRichiedente) {
|
||||||
$soggetto = $ticket->soggettoRichiedente;
|
$soggetto = $ticket->soggettoRichiedente;
|
||||||
$contatto = trim((string) ($soggetto->ragione_sociale ?: trim(($soggetto->nome ?? '') . ' ' . ($soggetto->cognome ?? '')))) ?: $contatto;
|
$contatto = trim((string) ($soggetto->ragione_sociale ?: trim(($soggetto->nome ?? '') . ' ' . ($soggetto->cognome ?? '')))) ?: $contatto;
|
||||||
$telefono = trim((string) ($soggetto->telefono ?? '')) ?: $telefono;
|
$telefono = trim((string) ($soggetto->telefono ?? '')) ?: $telefono;
|
||||||
$email = trim((string) ($soggetto->email ?? ''));
|
$email = trim((string) ($soggetto->email ?? ''));
|
||||||
$origine = 'Richiedente ticket';
|
$origine = 'Richiedente ticket';
|
||||||
$rubricaUrl = RubricaUniversaleScheda::getUrl(['record' => (int) $soggetto->id], panel: 'admin-filament');
|
$rubricaUrl = $this->buildRubricaUrlForCurrentUser((int) $soggetto->id);
|
||||||
$rubricaLabel = trim((string) ($soggetto->categoria ?? ''));
|
$rubricaLabel = trim((string) ($soggetto->categoria ?? ''));
|
||||||
} elseif ($ticket?->apertoDaUser) {
|
} elseif ($ticket?->apertoDaUser) {
|
||||||
$contatto = trim((string) ($ticket->apertoDaUser->name ?? '')) ?: $contatto;
|
$contatto = trim((string) ($ticket->apertoDaUser->name ?? '')) ?: $contatto;
|
||||||
|
|
@ -194,17 +197,32 @@ protected function resolveCallerDataForRubrica(TicketIntervento $intervento): ar
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'contatto' => $contatto !== '' ? $contatto : 'Contatto non identificato',
|
'contatto' => $contatto !== '' ? $contatto : 'Contatto non identificato',
|
||||||
'telefono' => $telefono,
|
'telefono' => $telefono,
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'origine' => $origine,
|
'origine' => $origine,
|
||||||
'stabile' => (string) ($ticket?->stabile?->denominazione ?? '-'),
|
'stabile' => (string) ($ticket?->stabile?->denominazione ?? '-'),
|
||||||
'rubrica_url' => $rubricaUrl,
|
'rubrica_url' => $rubricaUrl,
|
||||||
'rubrica_label'=> $rubricaLabel,
|
'rubrica_label' => $rubricaLabel,
|
||||||
'identity_key' => $identityKey,
|
'identity_key' => $identityKey,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
* @return array<string, mixed>|null
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
use App\Filament\Pages\Contabilita\EstrattoContoSoggetto;
|
use App\Filament\Pages\Contabilita\EstrattoContoSoggetto;
|
||||||
use App\Filament\Pages\Fornitore\Concerns\ResolvesOperatoreContext;
|
use App\Filament\Pages\Fornitore\Concerns\ResolvesOperatoreContext;
|
||||||
|
use App\Filament\Pages\Fornitore\RubricaClienti;
|
||||||
use App\Filament\Pages\Gescon\RubricaUniversaleScheda;
|
use App\Filament\Pages\Gescon\RubricaUniversaleScheda;
|
||||||
use App\Filament\Pages\Gescon\StabileScheda;
|
use App\Filament\Pages\Gescon\StabileScheda;
|
||||||
use App\Models\Fornitore;
|
use App\Models\Fornitore;
|
||||||
|
|
@ -706,12 +707,16 @@ public function getProdottiUrl(): string
|
||||||
|
|
||||||
public function getGoogleConnectUrl(): string
|
public function getGoogleConnectUrl(): string
|
||||||
{
|
{
|
||||||
return route('oauth.google.redirect');
|
return route('oauth.google.redirect', [
|
||||||
|
'return_to' => request()->getRequestUri(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGoogleDisconnectUrl(): string
|
public function getGoogleDisconnectUrl(): string
|
||||||
{
|
{
|
||||||
return route('oauth.google.disconnect');
|
return route('oauth.google.disconnect', [
|
||||||
|
'return_to' => request()->getRequestUri(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canAssignDipendente(): bool
|
public function canAssignDipendente(): bool
|
||||||
|
|
@ -1127,7 +1132,7 @@ protected function resolveCallerData(?Ticket $ticket): array
|
||||||
|
|
||||||
$rubrica = $this->resolveCallerRubrica($ticket, $caller);
|
$rubrica = $this->resolveCallerRubrica($ticket, $caller);
|
||||||
if ($rubrica instanceof RubricaUniversale) {
|
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['telefono'] = trim((string) ($rubrica->telefono_cellulare ?: $rubrica->telefono_ufficio ?: $rubrica->telefono_casa ?: '')) ?: $caller['telefono'];
|
||||||
$caller['email'] = trim((string) ($rubrica->email ?? '')) ?: $caller['email'];
|
$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['telefono'] = trim((string) ($rubrica->telefono_cellulare ?: $rubrica->telefono_ufficio ?: $rubrica->telefono_casa ?: '')) ?: $caller['telefono'];
|
||||||
$caller['email'] = trim((string) ($rubrica->email ?? '')) ?: $caller['email'];
|
$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';
|
$caller['sorgente'] = 'Rubrica dedotta dal ticket';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1158,6 +1163,24 @@ protected function resolveCallerData(?Ticket $ticket): array
|
||||||
return $caller;
|
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
|
protected function buildCallerReference(?Ticket $ticket, string $parsedReference = ''): string
|
||||||
{
|
{
|
||||||
if (! $ticket instanceof Ticket) {
|
if (! $ticket instanceof Ticket) {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,10 @@
|
||||||
<div class="mt-3 flex flex-wrap gap-2">
|
<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>
|
<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'])
|
@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
|
@endif
|
||||||
</div>
|
</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>
|
<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>
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
|
||||||
</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 class="mt-4 whitespace-pre-wrap rounded-lg bg-gray-50 p-3 text-sm text-gray-700">{{ $ticket->descrizione }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -539,7 +538,10 @@
|
||||||
<div class="mt-3 flex flex-wrap gap-2">
|
<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>
|
<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'])
|
@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
|
@endif
|
||||||
</div>
|
</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>
|
<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 () {
|
Route::middleware(['auth', 'verified'])->group(function () {
|
||||||
|
|
||||||
// OAuth Google (Calendar / Rubrica)
|
// OAuth Google (Calendar / Rubrica)
|
||||||
Route::middleware(['role:super-admin|admin|amministratore'])
|
Route::middleware(['role:super-admin|admin|amministratore|fornitore'])
|
||||||
->prefix('oauth/google')
|
->prefix('oauth/google')
|
||||||
->name('oauth.google.')
|
->name('oauth.google.')
|
||||||
->group(function () {
|
->group(function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user