feat: Shop Supplier Purchase Order get, filter, and add new.
This commit is contained in:
@@ -21,4 +21,7 @@ export default class BusinessObjects {
|
||||
};
|
||||
}
|
||||
*/
|
||||
static getObjectText(objectJson) {
|
||||
return objectJson[objectJson[flagNameAttrOptionText]];
|
||||
}
|
||||
}
|
||||
34
static/js/lib/business_objects/store/product_permutation.js
Normal file
34
static/js/lib/business_objects/store/product_permutation.js
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
export default class ProductPermutation {
|
||||
static getProductVariationsFromIdCsv(csvVariations) {
|
||||
let productVariations = [];
|
||||
if (!csvVariations) return productVariations;
|
||||
let variationPairs = csvVariations.split(',');
|
||||
if (variationPairs.length == 0) return productVariations;
|
||||
let parts;
|
||||
variationPairs.forEach((variationPair) => {
|
||||
parts = variationPair.split(':');
|
||||
if (parts.length == 2) {
|
||||
let productVariationType = productVariationTypes[parts[0]];
|
||||
let productVariation = productVariations[parts[1]];
|
||||
if (productVariationType && productVariation) {
|
||||
productVariations.push([productVariationType, productVariation]);
|
||||
}
|
||||
}
|
||||
});
|
||||
return productVariations;
|
||||
}
|
||||
static getProductVariationsPreviewFromIdCsv(csvVariations) {
|
||||
let variations = ProductPermutation.getProductVariationsFromIdCsv(csvVariations);
|
||||
let preview = '';
|
||||
if (variations.length == 0) return preview;
|
||||
variations.forEach((variation) => {
|
||||
if (preview.length > 0) {
|
||||
preview += '\n';
|
||||
}
|
||||
preview += variation[0] + ': ' + variation[1] + ', ';
|
||||
});
|
||||
return preview;
|
||||
}
|
||||
}
|
||||
@@ -2,50 +2,11 @@
|
||||
import Validation from "./validation.js";
|
||||
|
||||
export default class Common {
|
||||
static parseCSSPropertyToFloat(element, propertyName) {
|
||||
var propertyText = element.css(propertyName);
|
||||
|
||||
if (!Validation.isEmpty(propertyText)) {
|
||||
|
||||
propertyText = propertyText.replace('px', '');
|
||||
|
||||
if (!Validation.isValidNumber(propertyText, true)) return parseFloat(propertyText);
|
||||
}
|
||||
|
||||
return 0.00;
|
||||
}
|
||||
|
||||
static setPageToLoading(isLoading) {
|
||||
|
||||
if (isLoading) {
|
||||
document.querySelectorAll(document.body).classList.add(_dataLoadingFlag);
|
||||
}
|
||||
else {
|
||||
document.querySelectorAll(document.body).classList.remove(_dataLoadingFlag);
|
||||
}
|
||||
}
|
||||
|
||||
static setBackgroundToLoading(elId, isLoading) {
|
||||
|
||||
if (Validation.isEmpty(el)) {
|
||||
|
||||
var elObj = document.querySelectorAll(elId);
|
||||
|
||||
if (isLoading) {
|
||||
|
||||
setTimeout(function() {
|
||||
elObj.innerHTML = "";
|
||||
elObj.css({
|
||||
"background-image": "url(" + urlImgLoading + ")",
|
||||
"background-position": "center",
|
||||
"background-repeat": "no-repeat"
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
else {
|
||||
elObj.css("background-image", "");
|
||||
}
|
||||
static parseFloatWithDefault(value, defaultValue = 0.00) {
|
||||
if (!Validation.isEmpty(value) && Validation.isValidNumber(value, true)) {
|
||||
return parseFloat(value);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
static allowClick() {
|
||||
|
||||
@@ -151,13 +151,4 @@ export default class Validation {
|
||||
img.onerror = function() { callback(false); };
|
||||
img.src = url;
|
||||
}
|
||||
|
||||
static validateImageUrl(id, img) {
|
||||
Validation.imageExists(img, function(exists) {
|
||||
if (exists) {
|
||||
document.querySelectorAll("#" + id).css({ "background-image": "url(" + url + ")", "background-size": "35px 35px"})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user