them log, chinh upload
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled

This commit is contained in:
2026-05-09 11:00:59 +00:00
parent 96e1ce4f40
commit efa97b6c71
33 changed files with 1055 additions and 47 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Console\Commands;
use App\Services\ActivityLogger;
use App\Models\Contract;
use App\Models\Customer;
use App\Models\CustomerProduct;
@@ -52,6 +53,8 @@ class ImportCskh extends Command
$this->warn('=== DRY RUN MODE — No data will be written ===');
}
$startTime = now();
$rows = SimpleExcelReader::create($filePath)->getRows();
$total = iterator_count($rows);
@@ -94,6 +97,29 @@ class ImportCskh extends Command
$this->newLine(2);
$this->printSummary($rowCount, $dryRun);
$duration = now()->diffInSeconds($startTime);
$modeLabel = $dryRun ? '[DRY RUN] ' : '';
ActivityLogger::log(
'import',
$modeLabel . __('feedback.log_import_done', ['file' => basename($filePath), 'rows' => $rowCount]),
null,
[
'file' => $filePath,
'total_rows' => $rowCount,
'skipped' => $this->statsSkipped,
'products' => $this->statsProducts,
'customers' => $this->statsCustomers,
'contracts' => $this->statsContracts,
'handovers' => $this->statsHandovers,
'services' => $this->statsServices,
'feedbacks' => $this->statsFeedbacks,
'interactions' => $this->statsInteractions,
'duration_seconds' => $duration,
'dry_run' => $dryRun,
],
);
return self::SUCCESS;
}