All files / helpers/status translateInventoryStatus.js

100% Statements 35/35
100% Branches 43/43
100% Functions 4/4
100% Lines 35/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138      11x 10x   3x   1x   1x   1x   1x   1x   1x   1x     1x                                           5x 4x   1x   1x   1x   1x     1x                       9x 8x   1x   1x   1x   1x   1x   1x   1x   1x     1x                                           4x 3x   1x   1x   1x     1x                                
import { t } from '../i18n';
 
function inventoryStatus(status, appLanguage = 'ptBr') {
  if (status || status === 0) {
    switch (status) {
      case 1:
        return t('BEE470' /* Pendente */, undefined, appLanguage);
      case 2:
        return t('BEE2115' /* Em Contagem */, undefined, appLanguage);
      case 3:
        return t('BEE2116' /* Contagem Finalizada */, undefined, appLanguage);
      case 4:
        return t('BEE2119' /* Aprovado */, undefined, appLanguage);
      case 5:
        return t('BEE2118' /* Atualizado */, undefined, appLanguage);
      case 6:
        return t('BEE64' /* Cancelado */, undefined, appLanguage);
      case 7:
        return t('BEE2201' /* Reprovado */, undefined, appLanguage);
      default:
        return status;
    }
  } else {
    return [
      { value: 1, label: t('BEE470' /* Pendente */, undefined, appLanguage) },
      {
        value: 2,
        label: t('BEE2115' /* Em Contagem */, undefined, appLanguage),
      },
      {
        value: 3,
        label: t('BEE2116' /* Contagem Finalizada */, undefined, appLanguage),
      },
      { value: 4, label: t('BEE2119' /* Aprovado */, undefined, appLanguage) },
      {
        value: 5,
        label: t('BEE2118' /* Atualizado */, undefined, appLanguage),
      },
      { value: 6, label: t('BEE64' /* Cancelado */, undefined, appLanguage) },
      { value: 7, label: t('BEE2201' /* Reprovado */, undefined, appLanguage) },
    ];
  }
}
 
function inventoryType(type, appLanguage = 'ptBr') {
  if (type || type === 0) {
    switch (type) {
      case 1:
        return t('BEE2085' /* Rotativo */, undefined, appLanguage);
      case 2:
        return t('BEE191' /* Geral */, undefined, appLanguage);
      case 3:
        return t('BEE2760' /* Etiqueta Seriada */, undefined, appLanguage);
      default:
        return type;
    }
  } else {
    return [
      { value: 1, label: t('BEE2085' /* Rotativo */, undefined, appLanguage) },
      { value: 2, label: t('BEE191' /* Geral */, undefined, appLanguage) },
      {
        value: 3,
        label: t('BEE2760' /* Etiqueta Seriada */, undefined, appLanguage),
      },
    ];
  }
}
 
function inventorySheetStatus(status, appLanguage = 'ptBr') {
  if (status || status === 0) {
    switch (status) {
      case 1:
        return t('BEE470' /* Pendente */, undefined, appLanguage);
      case 2:
        return t('BEE2115' /* Em Contagem */, undefined, appLanguage);
      case 3:
        return t('BEE2116' /* Contagem Finalizada */, undefined, appLanguage);
      case 4:
        return t('BEE2188' /* Aprovada */, undefined, appLanguage);
      case 5:
        return t('BEE2117' /* Atualizada */, undefined, appLanguage);
      case 6:
        return t('BEE2189' /* Cancelada */, undefined, appLanguage);
      case 7:
        return t('BEE2200' /* Reprovada */, undefined, appLanguage);
      default:
        return status;
    }
  } else {
    return [
      { value: 1, label: t('BEE470' /* Pendente */, undefined, appLanguage) },
      {
        value: 2,
        label: t('BEE2115' /* Em Contagem */, undefined, appLanguage),
      },
      {
        value: 3,
        label: t('BEE2116' /* Contagem Finalizada */, undefined, appLanguage),
      },
      { value: 4, label: t('BEE2188' /* Aprovada */, undefined, appLanguage) },
      {
        value: 5,
        label: t('BEE2117' /* Atualizada */, undefined, appLanguage),
      },
      { value: 6, label: t('BEE2189' /* Cancelada */, undefined, appLanguage) },
      { value: 7, label: t('BEE2200' /* Reprovada */, undefined, appLanguage) },
    ];
  }
}
 
function inventoryCountQuantityStatus(status, appLanguage = 'ptBr') {
  if (status || status === 0) {
    switch (status) {
      case 1:
        return t('BEE470' /* Pendente */, undefined, appLanguage);
      case 2:
        return t('BEE2120' /* Finalizada */, undefined, appLanguage);
      default:
        return status;
    }
  } else {
    return [
      { value: 1, label: t('BEE470' /* Pendente */, undefined, appLanguage) },
      {
        value: 2,
        label: t('BEE2120' /* Finalizada */, undefined, appLanguage),
      },
    ];
  }
}
 
export default {
  inventoryStatus,
  inventoryType,
  inventorySheetStatus,
  inventoryCountQuantityStatus,
};