new functions
This commit is contained in:
@@ -11,7 +11,7 @@ use App\Models\Document;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use App\Helpers\DocumentIdentifier;
|
||||
use App\Services\ProjectCodeService;
|
||||
|
||||
class ProjectShow extends Component
|
||||
{
|
||||
@@ -35,10 +35,12 @@ class ProjectShow extends Component
|
||||
|
||||
protected $listeners = ['documents-updated' => '$refresh'];
|
||||
|
||||
protected ProjectCodeService $codeService;
|
||||
|
||||
public function mount(Project $project)
|
||||
{
|
||||
$this->project = $project->load('rootFolders');
|
||||
$this->project = $project;
|
||||
$this->project['javi'] = 'braña';
|
||||
$this->currentFolder = $this->project->rootFolders->first() ?? null;
|
||||
}
|
||||
|
||||
@@ -129,6 +131,13 @@ class ProjectShow extends Component
|
||||
$this->validate([
|
||||
'selectedFiles.*' => 'file|max:10240|mimes:pdf,docx,xlsx,jpg,png'
|
||||
]);
|
||||
|
||||
$isValid = app(ProjectCodeService::class)->validate($this->project, $files[0]->getClientOriginalName());
|
||||
if ($isValid) {
|
||||
echo "✅ Código válido\n";
|
||||
} else {
|
||||
echo "❌ Código inválido\n";
|
||||
}
|
||||
|
||||
$this->selectedFiles = array_merge($this->selectedFiles, $files);
|
||||
}
|
||||
@@ -142,10 +151,16 @@ class ProjectShow extends Component
|
||||
|
||||
public function uploadFiles(): void
|
||||
{
|
||||
$validator = new ProjectCodeValidator($project->codingConfig);
|
||||
foreach ($this->selectedFiles as $file) {
|
||||
//$analizador = analizarDocumento();
|
||||
//print_r($analizador);
|
||||
//$resultado1 = $analizador->analizarDocumento($file->getClientOriginalName());
|
||||
if ($validator->validate($file->getClientOriginalName())) {
|
||||
echo "✅ Código válido\n";
|
||||
} else {
|
||||
echo "❌ Código inválido\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$code = $this->project->reference;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user