[javascript] fasd

Viewer

  1. var submitterCheck = procVSync('_submitterCheck');
  2. //console.log('submitterChcek');
  3. //console.log(submitterCheck);
  4.  
  5.  
  6. varReadOn('company', function() {
  7.     //console.log('_submitterCheck');
  8.     //console.log(procVSync('_submitterCheck'));
  9.     if (procVSync('_submitterCheck') == 'no') {
  10.         //console.log('jsem true');
  11.         return true;
  12.     } else {
  13.         return false;
  14.     }
  15.     //return procVSync('_submitterCheck') == 'yes'
  16. });
  17. /*
  18. varReadOn('company', function() {
  19.       return procVSync('_submitterCheck') == 'no'
  20. }); 
  21. */
  22. /*
  23. if (submitterCheck === "yes") {
  24. varMustOn('company', function() {
  25.     return procVSync('_submitterCheck') === "yes"
  26. });
  27. } else  if  (submitterCheck === "no"){
  28. varReadOn('company', function() {
  29.     return procVSync('_submitterCheck') == 'no'
  30. }); 
  31. */
  32.  
  33. ///Zde je potřeba nejdříve dostat dyntable do té stránky pomocí getDyntable///
  34. this.getDynTable(vSync('_dtEntities'));
  35. var self = this;
  36. var _nazevDynTable1 = vSync('_dtEntities');
  37.  
  38. changeVarVal(['companyAddress', 'headOffice', 'generalCostCentre', /*'identificationNumber'*/ ], true, function() {
  39.     var company = vSync('company');
  40.     if (company == undefined) {
  41.         company = procVSync('company');
  42.     }
  43.  
  44.     // pokud promenna company = readOnly tak TAS nevraci index, ale title, proto bereme ze self
  45.     if (submitterCheck == "no") {
  46.         var companyRow = _.find(self.props.processVars, 'ivar_name', 'company') || {};
  47.         company = companyRow.ivar_dt_index;
  48.  
  49.     }
  50.  
  51.     if (company) {
  52.         //console.log('jsem v company');
  53.         //console.log(company);
  54.         var addressCompanyRow = _.find(self.dynTable[_nazevDynTable1], 'dlv_index', company) || {};
  55.         //var actualRow = _.find(self.dynTable[_nazevDynTable1], 'dlv_index', vSync('company'));
  56.         //console.log(addressCompanyRow);
  57.         return [addressCompanyRow.col_5, addressCompanyRow.col_14, addressCompanyRow.col_4, /* addressCompanyRow.col_11 */ ]
  58.  
  59.     }
  60. })
  61.  
  62. ////rizeni dynamickych radku
  63. var compAbbr = vSync('_dtCompanyAbbrCopy');
  64. if (compAbbr == 'MIR-BASE') {
  65.     hideVarOn(['reqItemsLabels', 'requestItemsClothes'], function() {
  66.         return compAbbr == 'MIR-BASE'
  67.     });
  68. } else if (compAbbr == 'MIR-LABEL') {
  69.     hideVarOn(['requestItems', 'requestItemsClothes'], function() {
  70.         return compAbbr == 'MIR-LABEL'
  71.     });
  72.  
  73. } else if (compAbbr == 'MIR-CLOTHES') {
  74.     hideVarOn(['reqItemsLabels', 'requestItems'], function() {
  75.         return compAbbr == 'MIR-CLOTHES'
  76.     });
  77. }
  78.  
  79. //////zobrazení obrázku pro marketing
  80. if (compAbbr == 'MIR-BASE') {
  81.     this.getDynTable(vSync('_dtRequestsItems'));
  82.     var dtRequestsItems = vSync('_dtRequestsItems');
  83.     var self = this;
  84.     //console.log("DT " + dtRequestsItems);
  85.  
  86.  
  87.     changeVarVal('_picture', true, function() {
  88.         var requestItems = vSync('requestItems');
  89.         var lastItemName = requestItems.itemName[requestItems.itemName.length - 1];
  90.         if (lastItemName) {
  91.             lastItemName = lastItemName.value;
  92.             if (lastItemName) {
  93.                 var lastItemIndex = lastItemName.value || lastItemName;
  94.                 if (lastItemIndex) {
  95.                     var actualRow = _.find(self.dynTable[dtRequestsItems], 'dlv_index', lastItemIndex);
  96.                     return actualRow.col_15;
  97.                 }
  98.             }
  99.         }
  100.     })
  101. } else if (compAbbr == 'MIR-CLOTHES') {
  102.  
  103.     //dotazeni obrazku pro obleceni
  104.     this.getDynTable(vSync('_dtRequestsItems'));
  105.     var dtRequestsItems = vSync('_dtRequestsItems');
  106.     var self = this;
  107.     //console.log("DT " + dtRequestsItems);
  108.     changeVarVal('_picture', true, function() {
  109.         var requestItemsCloth = vSync('requestItemsClothes');
  110.         var lastItemName = requestItemsCloth.itemName[requestItemsCloth.itemName.length - 1];
  111.         if (lastItemName) {
  112.             lastItemName = lastItemName.value;
  113.             if (lastItemName) {
  114.                 var lastItemIndex = lastItemName.value || lastItemName;
  115.                 if (lastItemIndex) {
  116.                     var actualRow = _.find(self.dynTable[dtRequestsItems], 'dlv_index', lastItemIndex);
  117.                     return actualRow.col_15;
  118.                 }
  119.             }
  120.         }
  121.     })
  122. } else if (compAbbr == 'MIR-LABEL') {
  123.     this.getDynTable(vSync('_dtRequestsItems'));
  124.     var dtRequestsItems = vSync('_dtRequestsItems');
  125.     var self = this;
  126.     //console.log("DT " + dtRequestsItems);
  127.  
  128.  
  129.     changeVarVal('_picture', true, function() {
  130.         var requestItemsLabel = vSync('reqItemsLabels');
  131.         var lastItemName = requestItemsLabel.tpyLable[requestItemsLabel.tpyLable.length - 1];
  132.         if (lastItemName) {
  133.             lastItemName = lastItemName.value;
  134.             if (lastItemName) {
  135.                 var lastItemIndex = lastItemName.value || lastItemName;
  136.                 if (lastItemIndex) {
  137.                     var actualRow = _.find(self.dynTable[dtRequestsItems], 'dlv_index', lastItemIndex);
  138.                     return actualRow.col_15;
  139.                 }
  140.             }
  141.         }
  142.     })
  143. }
  144.  
  145. /*
  146. //////////optimizace s lodash
  147. changeVarVal('_picture', true, function() {
  148.     const requestItems = vSync('requestItems');
  149.     const lastItem = _.last(requestItems.itemName);
  150.     const lastItemIndex = _.get(lastItem, 'value') || _.get(lastItem, 'value.value');
  151.     if (lastItemIndex) {
  152.         const actualRow = _.find(self.dynTable[dtRequestsItems], 'dlv_index', lastItemIndex);
  153.         return actualRow.col_15;
  154.     }
  155. });
  156. */

Editor

You can edit this paste and save as new:


File Description
  • fasd
  • Paste Code
  • 02 Mar-2021
  • 5.44 Kb
You can Share it: