85 lines
3.0 KiB
PHP
Executable File
85 lines
3.0 KiB
PHP
Executable File
<?php
|
|
namespace App\Filament\Pages\Supporto;
|
|
|
|
use BackedEnum;
|
|
use UnitEnum;
|
|
|
|
class AggiornamentoLauncher extends Modifiche
|
|
{
|
|
protected static ?string $navigationLabel = 'Aggiornamento Nodo';
|
|
|
|
protected static ?string $title = 'Launcher Aggiornamento Nodo';
|
|
|
|
protected static BackedEnum|string|null $navigationIcon = 'heroicon-o-arrow-path';
|
|
|
|
protected static UnitEnum|string|null $navigationGroup = 'Supporto';
|
|
|
|
protected static ?int $navigationSort = 29;
|
|
|
|
protected static ?string $slug = 'supporto/aggiornamento-nodo';
|
|
|
|
protected string $view = 'filament.pages.supporto.aggiornamento-launcher';
|
|
|
|
public function simulaChiamataInArrivo(): void
|
|
{
|
|
\App\Models\RubricaUniversale::updateOrCreate(
|
|
['telefono' => '3206996068'],
|
|
[
|
|
'nome' => 'Annamaria',
|
|
'cognome' => 'ROSCIOLI',
|
|
'tipo_soggetto' => 'privato',
|
|
]
|
|
);
|
|
|
|
\App\Models\CommunicationMessage::create([
|
|
'channel' => 'smdr',
|
|
'direction' => 'inbound',
|
|
'phone_number' => '3206996068',
|
|
'target_extension' => '601',
|
|
'protocol_number' => 'CTI-MOCK-' . now()->timestamp,
|
|
'received_at' => now(),
|
|
'status' => 'ringing',
|
|
'message_text' => 'Chiamata simulata per test centralino',
|
|
'metadata' => [
|
|
'event_type' => 'ringing',
|
|
'received_at' => now()->toIso8601String(),
|
|
]
|
|
]);
|
|
|
|
\Filament\Notifications\Notification::make()
|
|
->title('Chiamata simulata inviata!')
|
|
->body('La chiamata da Annamaria ROSCIOLI comparirà nella barra in alto per i prossimi 8 minuti.')
|
|
->success()
|
|
->send();
|
|
}
|
|
|
|
public function mount(): void
|
|
{
|
|
parent::mount();
|
|
|
|
$targetFile = '/mnt/gescon-archives/gescon/dbc/Stabili.mdb';
|
|
if (!file_exists($targetFile)) {
|
|
// Prova a ripristinare il mount point in sola lettura
|
|
\Illuminate\Support\Facades\Process::run('mount /mnt/gescon-archives');
|
|
if (!file_exists($targetFile)) {
|
|
// Se non è andato a buon fine, proviamo con sudo
|
|
\Illuminate\Support\Facades\Process::run('sudo mount /mnt/gescon-archives');
|
|
}
|
|
|
|
if (file_exists($targetFile)) {
|
|
\Filament\Notifications\Notification::make()
|
|
->title('Auto-Mount Ripristinato!')
|
|
->body('Il volume Samba /mnt/gescon-archives è stato ricollegato con successo in sola lettura.')
|
|
->success()
|
|
->send();
|
|
} else {
|
|
\Filament\Notifications\Notification::make()
|
|
->title('Verifica Archivio Fallita')
|
|
->body('Il mount point /mnt/gescon-archives risulta scollegato e il ripristino automatico non è riuscito.')
|
|
->danger()
|
|
->send();
|
|
}
|
|
}
|
|
}
|
|
}
|