0
0
Fork 0

perf: remove comments

This commit is contained in:
Javier Segarra 2024-10-09 00:50:53 +02:00
parent 477404f00a
commit dc13096bc1
1 changed files with 3 additions and 46 deletions

View File

@ -150,14 +150,6 @@ const columns = computed(() => [
icon: 'delete', icon: 'delete',
action: (row) => confirmRemove(row), action: (row) => confirmRemove(row),
isPrimary: true, isPrimary: true,
// show: (row) => !validations({ row }),
// },
// {
// title: t('save'),
// icon: 'save',
// action: (row) => upsertFixedPrice(row),
// isPrimary: true,
// show: (row) => validations({ row }),
}, },
], ],
}, },
@ -219,8 +211,6 @@ const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
}; };
const updateMinPrice = async (value, props) => { const updateMinPrice = async (value, props) => {
// El checkbox hasMinPrice se encuentra en la misma columna que el input hasMinPrice
// Por lo tanto le mandamos otro objeto con las mismas propiedades pero con el campo 'field' cambiado
props.row.hasMinPrice = value; props.row.hasMinPrice = value;
await upsertPrice({ await upsertPrice({
row: props.row, row: props.row,
@ -229,13 +219,9 @@ const updateMinPrice = async (value, props) => {
}); });
}; };
const validations = ({ row, rowIndex, col }) => { const validations = ({ row }) => {
const isNew = !row.id; const isNew = !row.id;
// Si la row no tiene id significa que fue agregada con addRow y no se ha guardado en la base de datos if (!isNew) return false;
// Si isNew es falso no se checkea si el valor es igual a la original
if (!isNew)
// if (fixedPricesOriginalData.value[rowIndex][col.field] == row[col.field])
return false;
const requiredFields = [ const requiredFields = [
'itemFk', 'itemFk',
@ -254,7 +240,6 @@ const upsertPrice = async (props, resetMinPrice = false) => {
try { try {
const isValid = validations({ ...props }); const isValid = validations({ ...props });
if (!isValid) { if (!isValid) {
// notify(t('globals.fillRequiredFields'), 'negative');
return; return;
} }
const { row } = props; const { row } = props;
@ -278,13 +263,6 @@ async function upsertFixedPrice(row) {
} }
} }
async function saveOnRowChange(row) {
if (rowsSelected.value.length > 1) return;
if (rowsSelected.value[0]?.id === row.id) return;
else if (rowsSelected.value.length === 1) await upsertPrice(rowsSelected.value[0]);
rowsSelected.value = [row];
}
function checkLastVisibleRow() { function checkLastVisibleRow() {
let lastVisibleRow = null; let lastVisibleRow = null;
@ -300,7 +278,6 @@ function checkLastVisibleRow() {
const addRow = (original = null) => { const addRow = (original = null) => {
let copy = null; let copy = null;
// if (!original) {
const today = Date.vnNew(); const today = Date.vnNew();
const millisecsInDay = 86400000; const millisecsInDay = 86400000;
const daysInWeek = 7; const daysInWeek = 7;
@ -313,26 +290,6 @@ const addRow = (original = null) => {
hasMinPrice: 0, hasMinPrice: 0,
$index: 0, $index: 0,
}; };
// } else
// copy = {
// $index: original.$index - 1,
// itemFk: original.itemFk,
// name: original.name,
// subName: original.subName,
// value5: original.value5,
// value6: original.value6,
// value7: original.value7,
// value8: original.value8,
// value9: original.value9,
// value10: original.value10,
// warehouseFk: original.warehouseFk,
// rate2: original.rate2,
// rate3: original.rate3,
// hasMinPrice: original.hasMinPrice,
// minPrice: original.minPrice,
// started: Date.vnNew(),
// ended: Date.vnNew(),
// };
return { original, copy }; return { original, copy };
}; };
@ -345,7 +302,7 @@ function highlightNewRow({ $index: index }) {
row.classList.add('highlight'); row.classList.add('highlight');
setTimeout(() => { setTimeout(() => {
row.classList.remove('highlight'); row.classList.remove('highlight');
}, 3000); // Duración de la animación en milisegundos }, 3000);
} }
} }
const openEditTableCellDialog = () => { const openEditTableCellDialog = () => {