alanittec пре 2 година
родитељ
комит
2717df75ee

+ 227 - 30
sistema-mantenimiento-back/app/Http/Controllers/DocumentManagementController.php

@@ -8,46 +8,49 @@ use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Carbon;
 
-class DocumentManagementController extends Controller{
+class DocumentManagementController extends Controller
+{
     private $responseController;
     private $encryptionController;
     private $functionsController;
 
-    public function __construct(){
+    public function __construct()
+    {
         $this->responseController = new ResponseController();
         $this->encryptionController = new EncryptionController();
         $this->functionsController = new FunctionsController();
     }
 
-    public function downloadFile($token, $idUser, $line){
+    public function downloadFile($token, $idUser, $line)
+    {
 
         $tokenInfo = DB::table('S002V01TTODE')->where([
             ['TODE_NULI', '=', $line],
             ['TODE_TOKE', '=', $token]
         ])->first();
 
-/*         if(is_null($tokenInfo)){
+        if (is_null($tokenInfo)) {
             return $this->responseController->makeResponse(true, 'El token de descarga no existe.', [], 404);
-        }else if($tokenInfo->TODE_ESTA != 'Activo'){
+        } else if ($tokenInfo->TODE_ESTA != 'Activo') {
             return $this->responseController->makeResponse(true, 'El token de descarga ya fue utilizado.', [], 401);
-        } */
+        }
 
         $token = $this->encryptionController->shortDec($token);
-        if(!$token){
+        if (!$token) {
             return $this->responseController->makeResponse(true, 'El token de descarga no está encriptado correctamente.', [], 400);
         }
 
         $tokenArr = explode("|", $token);
-        if(count($tokenArr) != 3){
+        if (count($tokenArr) != 3) {
             return $this->responseController->makeResponse(true, 'Estructura de token inválida.', [], 401);
-        }else if(intval($tokenArr[1]) != $tokenInfo->TODE_LLAL){
+        } else if (intval($tokenArr[1]) != $tokenInfo->TODE_LLAL) {
             return $this->responseController->makeResponse(true, 'Token inválido.', [], 401);
-        }else if($tokenArr[2] != 'syp'){
+        } else if ($tokenArr[2] != 'syp') {
             return $this->responseController->makeResponse(true, 'Token inválido.', [], 401);
         }
 
         $idUser = $this->encryptionController->shortDec($idUser);
-        if(!$idUser){
+        if (!$idUser) {
             return $this->responseController->makeResponse(true, 'El ID del usuario que realizó la petición no está encriptado correctamente.', [], 400);
         }
 
@@ -56,7 +59,7 @@ class DocumentManagementController extends Controller{
             ['USUA_NULI', '=', $line]
         ])->first();
 
-        if(is_null($usr)){
+        if (is_null($usr)) {
             return $this->responseController->makeResponse(true, 'El usuario que realizó la consulta no está registrado.', [], 404);
         }
 
@@ -83,7 +86,7 @@ class DocumentManagementController extends Controller{
             'TODE_USDE' => $idUser,
             'TODE_FEDE' => $nowStr
         ]);
-        
+
         $file = DB::table('S002V01TAFAL')->where([
             ['AFAL_NULI', '=', $nuli],
             ['AFAL_COMO', '=', $como],
@@ -97,22 +100,23 @@ class DocumentManagementController extends Controller{
 
         $aux = DB::getQueryLog();
 
-        if(is_null($file)){
+        if (is_null($file)) {
             return $this->responseController->makeResponse(true, 'El archivo solicitado no existe.', [], 404);
         }
         return response()->download($file->AFAL_UBIC);
     }
 
-    public function getDownloadToken($idFile, $idUser, $line){
+    public function getDownloadToken($idFile, $idUser, $line)
+    {
         DB::enableQueryLog();
 
         $idFile = $this->encryptionController->shortDec($idFile);
-        if(!$idFile){
+        if (!$idFile) {
             return $this->responseController->makeResponse(true, 'El ID del archivo requerido no está encriptado correctamente.', [], 400);
         }
 
         $idUser = $this->encryptionController->shortDec($idUser);
-        if(!$idUser){
+        if (!$idUser) {
             return $this->responseController->makeResponse(true, 'El ID del usuario que realizó la petición no está encriptado correctamente.', [], 400);
         }
 
@@ -121,7 +125,7 @@ class DocumentManagementController extends Controller{
             ['USUA_NULI', '=', $line]
         ])->first();
 
-        if(is_null($usr)){
+        if (is_null($usr)) {
             return $this->responseController->makeResponse(true, 'El usuario que realizó la consulta no está registrado.', [], 404);
         }
 
@@ -137,7 +141,7 @@ class DocumentManagementController extends Controller{
         $nuve = $codiArr[1];
         $noar = $suffArr[0];
         $exte = $suffArr[1];
-        
+
         $file = DB::table('S002V01TAFAL')->where([
             ['AFAL_NULI', '=', $nuli],
             ['AFAL_COMO', '=', $como],
@@ -150,7 +154,7 @@ class DocumentManagementController extends Controller{
         ])->first();
 
         $aux = DB::getQueryLog();
-        if(is_null($file)){
+        if (is_null($file)) {
             return $this->responseController->makeResponse(true, 'El archivo solicitado no existe.', [], 404);
         }
 
@@ -175,16 +179,17 @@ class DocumentManagementController extends Controller{
         return $this->responseController->makeResponse(false, 'EXITO', ['TOKEN' => $token]);
     }
 
-    public function getFileInfo($id, $idUser, $line){
+    public function getFileInfo($id, $idUser, $line)
+    {
         DB::enableQueryLog();
 
         $id = $this->encryptionController->shortDec($id);
-        if(!$id){
+        if (!$id) {
             return $this->responseController->makeResponse(true, 'El ID del archivo requerido no está encriptado correctamente.', [], 400);
         }
 
         $idUser = $this->encryptionController->shortDec($idUser);
-        if(!$idUser){
+        if (!$idUser) {
             return $this->responseController->makeResponse(true, 'El ID del usuario que realizó la petición no está encriptado correctamente.', [], 400);
         }
 
@@ -193,7 +198,7 @@ class DocumentManagementController extends Controller{
             ['USUA_NULI', '=', $line]
         ])->first();
 
-        if(is_null($usr)){
+        if (is_null($usr)) {
             return $this->responseController->makeResponse(true, 'El usuario que realizó la consulta no está registrado.', [], 404);
         }
 
@@ -222,9 +227,9 @@ class DocumentManagementController extends Controller{
             ['AFAL_NUVE', '=', $nuve],
         ])->first();
 
-        if(is_null($fileInfo)){
+        if (is_null($fileInfo)) {
             return $this->responseController->makeResponse(true, 'El archivo solicitado no está registrado.', [], 404);
-        }else if($fileInfo->ESTADO != 'Activo'){
+        } else if ($fileInfo->ESTADO != 'Activo') {
             return $this->responseController->makeResponse(true, 'El archivo solicitado no está disponible.', [], 404);
         }
 
@@ -262,15 +267,16 @@ class DocumentManagementController extends Controller{
         return $this->responseController->makeresponse(false, "EXITO", $documents);
     }
 
-    public function getInfoDocument($idUser, $line, $idDocument){
+    public function getInfoDocument($idUser, $line, $idDocument)
+    {
         DB::enableQueryLog();
         $idUser = $this->encryptionController->shortDec($idUser);
-        if(!$idUser){
+        if (!$idUser) {
             return $this->responseController->makeResponse(true, 'El ID del usuario que realizó la solicitud no está encriptado correctamente', [], 400);
         }
 
         $idDocument = $this->encryptionController->shortDec($idDocument);
-        if(!$idDocument){
+        if (!$idDocument) {
             return $this->responseController->makeResponse(true, 'El ID del documento no está encriptado correctamente', [], 400);
         }
 
@@ -282,4 +288,195 @@ class DocumentManagementController extends Controller{
         //$this->functionsController->registerActivity($actions, $idUser, $nowStr, $line);
         return $this->responseController->makeresponse(false, "EXITO", $document);
     }
-}
+
+    public function moveFinalFile(Request $request)
+    {
+        DB::enableQueryLog();
+        $validator = Validator::make($request->all(), [
+            'id_user' => 'required|string',
+            'linea' => 'required|integer',
+            'audiencia' => 'required|json',
+            'archivos' => 'required|json',
+            'cldo' => 'required|string',
+            ''
+        ]);
+
+        if($validator->fails()){
+            return $this->responseController->makeResponse(
+                true,
+                "Se encontraron uno o más errores.",
+                $this->responseController->makeErrors(
+                    $validator->errors()->messages()
+                ),
+                401
+            );
+        }
+
+        $advice = $request->all();
+        $idUser = $this->encryptionController->decrypt($advice['id_user']);
+        if(!$idUser){
+            return $this->responseController->makeResponse(true, "El ID del usuario que realizó la petición no fue encriptado correctamente", [], 400);
+        }
+
+        $usr = DB::table('S002V01TUSUA')->where([
+            ['USUA_IDUS', '=', $idUser],
+            ['USUA_NULI', '=', $advice['linea']]
+        ])->first();
+
+        if(is_null($usr)){
+            return $this->responseController->makeResponse(true, 'El usuario que realizó la consulta no está registrado', [], 404);
+        }
+
+        $filesArr = json_decode($advice['archivos'], true);
+        $nowStr = Carbon::now('America/Mexico_city')->toDateTimeString();
+        $attachedArr = [];
+        foreach($filesArr as $file){
+            $idFile = $file['id'];
+            $idFile = $this->encryptionController->decrypt($idFile);
+            if(!$idFile){
+                return $this->responseController->makeResponse(true, "El ID del archivo $file[name] no fue encriptado correctamente", [], 400);
+            }
+
+            $fileObj = DB::table('S002V01TARTE')->where([
+                ['ARTE_IDAR', '=', $idFile],
+                ['ARTE_NULI', '=', $advice['linea']]
+            ])->first();
+
+            if(is_null($fileObj)){
+                return $this->responseController->makeResponse(true, "El ID del archivo $file[name] no existe", [], 404);
+            }else if($fileObj->ARTE_ESTA == 'Eliminado'){
+                return $this->responseController->makeResponse(true, "El archivo $file[name] está eliminado", [], 404);
+            }
+
+            $fileSaved = $this->moveFinalFile($advice['linea'], 'AV', $fileObj, 'S002V01M01ADSI', 'S002V01F03CRAV', 'S002V01P02CNAV');
+            if(!$fileSaved[0]){
+                return $this->responseController->makeResponse(true, "El archivo no pudo guardarse: $fileSaved[1]", [], 500);
+            }
+            
+            $attachedArr[] = $this->encryptionController->encrypt($fileSaved[1]);
+
+            DB::table('S002V01TARTE')->where([
+                ['ARTE_IDAR', '=', $idFile],
+                ['ARTE_NULI', '=', $advice['linea']],
+            ])->update([
+                'ARTE_ESTA' => 'Eliminado',
+                'ARTE_USMO' => $idUser,
+                'ARTE_FEMO' => $nowStr
+            ]);
+        }
+
+        $ubiTempFile = $file->ARTE_UBTE;
+        $ubiFileArr = explode('tempFiles', $ubiTempFile);
+        $ubic = $ubiFileArr[0] . 'files' . $ubiFileArr[1];
+
+        $como = substr($module, -4);
+        $date = Carbon::now('America/Mexico_city')->toDateTimeString();
+        $dateArr = explode(' ', $date);
+        $dateStr = $dateArr[0];
+        $dA = explode('-', $dateStr);
+        $dA[0] = substr($dA[0], -2);
+        $fecr = implode('', $dA);
+
+        $nameStr = $file->ARTE_NOAR;
+        $nameArr = explode('.', $nameStr);
+
+        $nuve = 0;
+        $nuse = 0;
+
+        $lastSec = DB::table('S002V01TAFAL')->where([
+            ['AFAL_NULI', '=', $line],
+            ['AFAL_COMO', '=', $como],
+            ['AFAL_CLDO', '=', $cldo]
+        ])->orderBy('AFAL_NUSE', 'desc')->first();
+
+        if (is_null($lastSec)) {
+            $nuse = 1;
+        } else {
+            $nuse = $lastSec->AFAL_NUSE + 1;
+        }
+
+        $lastVersion = DB::table('S002V01TAFAL')->where([
+            ['AFAL_NULI', '=', $line],
+            ['AFAL_NOAR', '=', $nameArr[0]],
+            ['AFAL_EXTE', '=', $nameArr[1]],
+        ])->orderBy('AFAL_NUVE', 'desc')->first();
+
+        if (is_null($lastVersion)) {
+            $nuve = 1;
+        } else {
+            $nuve = $lastVersion->AFAL_NUVE + 1;
+        }
+
+        if ($nuve > 99) return [false, 'El archivo llegó al número máximo de versiones'];
+        if ($nuse > 999999) return [false, 'El archivo llegó al número de secuencia máximo'];
+
+
+        $noar = $nameArr[0];
+        $exte = $nameArr[1];
+
+        if (strlen($noar) > 100) return [false, 'El nombre del archivo tiene una longitud mayor a 100 caracteres'];
+        $tama = $file->ARTE_TAMA;
+        $usac = json_encode([$file->ARTE_USRE]);
+        $usre = $file->ARTE_USRE;
+        $fere = $file->ARTE_FERE;
+
+        DB::table('S002V01TAFAL')->insert([
+            'AFAL_NULI' => $line,
+            'AFAL_COMO' => $como,
+            'AFAL_CLDO' => $cldo,
+            'AFAL_FECR' => $fecr,
+            'AFAL_NUSE' => $nuse,
+            'AFAL_NUVE' => $nuve,
+            'AFAL_NOAR' => $noar,
+            'AFAL_EXTE' => $exte,
+            'AFAL_TAMA' => $tama,
+            'AFAL_UBIC' => $ubic,
+            'AFAL_USAC' => $usac,
+            'AFAL_USRE' => $usre,
+            'AFAL_FERE' => $fere
+        ]);
+
+        if (file_exists($file->ARTE_UBTE)) {
+            rename($file->ARTE_UBTE, $ubic);
+        }
+
+        $codigo = "";
+        if (strlen($line) < 2) {
+            $codigo .= "0$line-";
+        } else {
+            $codigo .= "$line-";
+        }
+
+        $codigo .= "$como-$cldo-$fecr-";
+        switch (strlen($nuse)) {
+            case 1:
+                $codigo .= "00000$nuse";
+                break;
+            case 2:
+                $codigo .= "0000$nuse";
+                break;
+            case 3:
+                $codigo .= "000$nuse";
+                break;
+            case 4:
+                $codigo .= "00$nuse";
+                break;
+            case 5:
+                $codigo .= "0$nuse";
+                break;
+            default:
+                $codigo .= "$nuse";
+                break;
+        }
+
+        if (strlen($nuve) < 2) {
+            $codigo .= "=0$nuve=";
+        } else {
+            $codigo .= "=$nuve=";
+        }
+
+        $codigo .= "$noar.$exte";
+
+        return [true, $codigo];
+    }
+}

+ 15 - 31
sistema-mantenimiento-front/src/app/components/gdel/addo/addo.component.html

@@ -23,22 +23,6 @@
         </mat-card-content>
         <mat-card-content class="mat-card-content-fill prevent-select animated fadeIn" *ngIf="!isLoading && !hasError">
             <div class="row-advices pt-8">
-                <mat-form-field appearance="outline" style="width: calc(50% - 8px);">
-                    <mat-label>Nombre del archivo</mat-label>
-                    <input type="text" matInput maxlength="100" #NOAR [formControl]="AFAL_NOAR"
-                        [errorStateMatcher]="errorMatcher">
-                    <mat-hint align="end">{{NOAR.value.length}} / 100</mat-hint>
-                    <mat-error *ngIf="AFAL_NOAR.hasError('required')">
-                        El nombre del documento es <strong>requerido</strong>.
-                    </mat-error>
-                    <mat-error *ngIf="AFAL_NOAR.hasError('minlength')">
-                        El nombre del documento debe tener al menos <strong>8 caracteres</strong>.
-                    </mat-error>
-                    <mat-error *ngIf="AFAL_NOAR.hasError('maxlength')">
-                        El nombre del documento debe tener máximo <strong>100 caracteres</strong>.
-                    </mat-error>
-                </mat-form-field>
-
                 <mat-form-field appearance="outline" style="width: calc(50% - 8px);">
                     <mat-label>Clasificación del documento</mat-label>
                     <mat-select #CLDO [formControl]="AFAL_CLDO" [errorStateMatcher]="errorMatcher">
@@ -49,20 +33,6 @@
                         La clasificación del documento es <strong>requerido</strong>.
                     </mat-error>
                 </mat-form-field>
-            </div>
-
-            <div class="row-advices pt-8">
-                <mat-form-field appearance="outline" style="width: calc(50% - 8px);">
-                    <mat-label>Código del módulo</mat-label>
-                    <mat-select #COMO [formControl]="AFAL_COMO" [errorStateMatcher]="errorMatcher">
-                        <mat-option *ngFor="let mod of modules; let i = index;"
-                            [value]=mod.MODU_IDMO>{{mod.MODU_NOMB}}</mat-option>
-                    </mat-select>
-                    <mat-error *ngIf="AFAL_COMO.hasError('required')">
-                        El código del módulo es <strong>requerido</strong>.
-                    </mat-error>
-                </mat-form-field>
-
                 <mat-form-field appearance="outline" style="width: calc(50% - 8px);">
                     <mat-label>Usuarios con acceso</mat-label>
                     <mat-select multiple [formControl]="AFAL_USAC">
@@ -78,6 +48,19 @@
                 </mat-form-field>
             </div>
 
+            <div class="row-advices pt-8">
+                <mat-form-field appearance="outline" style="width: calc(50% - 8px);">
+                    <mat-label>Código del módulo</mat-label>
+                    <mat-select #COMO [formControl]="AFAL_COMO" [errorStateMatcher]="errorMatcher">
+                        <mat-option *ngFor="let mod of modules; let i = index;"
+                            [value]=mod.MODU_IDMO>{{mod.MODU_NOMB}}</mat-option>
+                    </mat-select>
+                    <mat-error *ngIf="AFAL_COMO.hasError('required')">
+                        El código del módulo es <strong>requerido</strong>.
+                    </mat-error>
+                </mat-form-field>
+            </div>
+
             <div class="row-advices pt-8">
                 <input type="file" name="file" id="file" #file class="hidden" (change)="checkFile($event)">
                 <button type="button" mat-stroked-button style="width: calc(50% - 8px);transform: translateX(50%);"
@@ -132,7 +115,8 @@
             </table>
         </mat-card-content>
         <mat-card-actions align="end">
-            
+            <button mat-button (click)="registerDocument()" *ngIf="isNew">Registrar documento</button>
+            <!--  <button mat-button (click)="updateAdvice()" *ngIf="!isNew">Guardar cambios</button> -->
         </mat-card-actions>
     </mat-card>
 </div>

+ 80 - 38
sistema-mantenimiento-front/src/app/components/gdel/addo/addo.component.ts

@@ -218,49 +218,46 @@ export class ADDOComponent implements OnInit {
 
   }
 
-  checkFile(event: any) {
-    let fileTypes = availableFiles;
-    let sizes = Object.keys(fileTypes);
-    let extensions = Object.values(fileTypes);
-    let maxSizeMB = 0;
-
-    let extArr = event.target.files[0].name.split('.').reverse();
-    let extStr = extArr[0];
-
-    let i = 0;
-    extensions.forEach((ext) => {
-      let size = parseInt(sizes[i]);
+  async registerDocument(){
+    let hasErrorForm = false;
 
-      if (ext.includes(extStr)) maxSizeMB = size;
-      i++;
-    });
+    if(this.AFAL_CLDO.invalid){
+      this.AFAL_CLDO.markAsTouched();
+      hasErrorForm = true;
+    }
 
-    if (maxSizeMB == 0) {
-      this.openSnackBar(`Los archivos ${extStr} no están soportados`);
-    } else {
-      let maxFileSize = 1048576 * maxSizeMB;
-      let fileSize = event.target.files[0].size;
+    if(this.AFAL_COMO.invalid){
+      this.AFAL_COMO.markAsTouched();
+      hasErrorForm = true;
+    }
 
-      if (fileSize > maxFileSize) {
-        this.openSnackBar(
-          `El tamaño del archivo supera el límite de ${maxSizeMB} MB`
-        );
-      } else {
-        let alreadyAttached = false;
-        this.attached.forEach((file) => {
-          alreadyAttached =
-            file.name == event.target.files[0].name &&
-            file.size == this.formatBytes(event.target.files[0].size);
-        });
+    if(this.AFAL_USAC.invalid){
+      this.AFAL_USAC.markAsTouched();
+      hasErrorForm = true;
+    }
 
-        if (alreadyAttached) {
-          this.openSnackBar('El archivo seleccionado ya fue adjuntado.');
-        } else {
-          this.isUploading = true;
-          this.uploadTmp(event.target.files[0]);
-        }
-      }
+    if(hasErrorForm){
+      this.openSnackBar('Antes de continuar debe completar los campos señalados.');
+    }else{
+      console.log('ya paso');
+      let attachedStr = JSON.stringify(this.attached);
+      let idEnc = localStorage.getItem('idusuario');
+      let audience = this.AFAL_USAC.value;
+
+      let body = {
+        id_user: idEnc,
+        linea: 1,
+        audiencia: audience,
+        archivos: attachedStr,
+        cldo: this.AFAL_CLDO.value,
+        como: this.AFAL_COMO,
+        noar: this.AFAL_NOAR
+      };
+
+      console.log(body);
+      
     }
+
   }
 
   async uploadTmp(fileData: any) {
@@ -385,6 +382,51 @@ export class ADDOComponent implements OnInit {
     this.isLoading = false;
   }
 
+  checkFile(event: any) {
+    let fileTypes = availableFiles;
+    let sizes = Object.keys(fileTypes);
+    let extensions = Object.values(fileTypes);
+    let maxSizeMB = 0;
+
+    let extArr = event.target.files[0].name.split('.').reverse();
+    let extStr = extArr[0];
+
+    let i = 0;
+    extensions.forEach((ext) => {
+      let size = parseInt(sizes[i]);
+
+      if (ext.includes(extStr)) maxSizeMB = size;
+      i++;
+    });
+
+    if (maxSizeMB == 0) {
+      this.openSnackBar(`Los archivos ${extStr} no están soportados`);
+    } else {
+      let maxFileSize = 1048576 * maxSizeMB;
+      let fileSize = event.target.files[0].size;
+
+      if (fileSize > maxFileSize) {
+        this.openSnackBar(
+          `El tamaño del archivo supera el límite de ${maxSizeMB} MB`
+        );
+      } else {
+        let alreadyAttached = false;
+        this.attached.forEach((file) => {
+          alreadyAttached =
+            file.name == event.target.files[0].name &&
+            file.size == this.formatBytes(event.target.files[0].size);
+        });
+
+        if (alreadyAttached) {
+          this.openSnackBar('El archivo seleccionado ya fue adjuntado.');
+        } else {
+          this.isUploading = true;
+          this.uploadTmp(event.target.files[0]);
+        }
+      }
+    }
+  }
+
   formatBytes(bytes: number, decimals = 2) {
     if (bytes === 0) return '0 Bytes';
 

+ 7 - 2
sistema-mantenimiento-front/src/app/components/system-admin/advices/new-advice/new-advice.component.ts

@@ -248,12 +248,15 @@ export class NewAdviceComponent implements OnInit {
       this.adviceHour.setValue(caduArr[1]);
 
       let adjuStr = advice.response.ADJUNTOS;
+      
       let adjuArr = JSON.parse(adjuStr);
+      console.log(adjuArr);
+
       adjuArr.forEach(async (adju: any) => {
         let idDec = await this._encService.desencriptar(adju);
         let short = await lastValueFrom(this._encService.shortEncrypt(adju));
         let file: FinalFileResponse = await lastValueFrom(this._documentManagement.getFileInfo(short.response.encrypted, shortEnc.response.encrypted, 1));
-
+        
         let fileInfo: TempFileInfo = {
           id: adju,
           name: idDec,
@@ -352,13 +355,15 @@ export class NewAdviceComponent implements OnInit {
   }
 
   async downloadFile(idFile: string){
+    console.log(idFile);
+    
     try{
       let shortAvi = await lastValueFrom(this._encService.shortEncrypt(idFile));
       let idEnc = localStorage.getItem('idusuario');
       let shortEnc = await lastValueFrom(this._encService.shortEncrypt(idEnc!));
 
       let downloadToken = await lastValueFrom(this._advicesService.getDownloadToken(shortAvi.response.encrypted, shortEnc.response.encrypted, 1));
-      //this.downloadLink = "http://git.ittec.mx/sam/public/api/download-file///1";
+      //this.downloadL  ink = "http://git.ittec.mx/sam/public/api/download-file///1";
       this.downloadLink = `http://git.ittec.mx/sam/public/api/download-file/${downloadToken.response.TOKEN}/${shortEnc.response.encrypted}/1`;
       console.log(this.downloadLink);
       this.a?.nativeElement.click();