2023-02-09 11:07:31 +00:00
|
|
|
export const calculationPercent = (
|
|
|
|
percent: number | undefined,
|
|
|
|
value: number | undefined
|
|
|
|
) => {
|
|
|
|
if (value && percent) {
|
|
|
|
const newPercent = percent / 100;
|
|
|
|
|
|
|
|
const discount = value * newPercent;
|
|
|
|
|
|
|
|
const newValue = value - discount;
|
|
|
|
|
|
|
|
return newValue.toFixed(2).toString().replace(".", ",");
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
};
|
|
|
|
|
2023-02-07 22:27:44 +00:00
|
|
|
export const sanatizeColor = (color: string) => {
|
|
|
|
if (color) {
|
|
|
|
const [first] = color.split(" ");
|
|
|
|
|
|
|
|
if (first.indexOf("c-") === 0) {
|
|
|
|
return first;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "c-on-base";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "c-on-base";
|
|
|
|
};
|