forked from verdnatura/salix-front
feat: 5926: Refresh button
This commit is contained in:
parent
6c91fee139
commit
c3d08c94d1
|
@ -65,14 +65,16 @@ const handleSendToTablet = async (row) => {
|
||||||
console.error('Error removing department');
|
console.error('Error removing department');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
function checkFileFocuware({ deviceProductionFk }) {
|
||||||
|
return axios.post(`Docuwares/${deviceProductionFk}/checkFile`, {
|
||||||
|
fileCabinet: 'hr',
|
||||||
|
signed: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
const handleRefreshDocuware = async (row) => {
|
const handleRefreshDocuware = async (row) => {
|
||||||
try {
|
try {
|
||||||
if (isProduction()) {
|
if (isProduction()) {
|
||||||
const { deviceProductionFk } = row;
|
await checkFileFocuware(row);
|
||||||
await axios.post(`Docuwares/upload`, {
|
|
||||||
fileCabinet: 'hr',
|
|
||||||
ids: [deviceProductionFk],
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
notify(t('PDA Signed'), 'positive');
|
notify(t('PDA Signed'), 'positive');
|
||||||
row.isSigned = true;
|
row.isSigned = true;
|
||||||
|
@ -96,12 +98,7 @@ const handleDownloadDocuware = async (row) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function fetchDocuware(deviceProductions) {
|
async function fetchDocuware(deviceProductions) {
|
||||||
let promises = deviceProductions.map(({ deviceProductionFk }) =>
|
let promises = deviceProductions.map((device) => checkFileFocuware(device));
|
||||||
axios.post(`Docuwares/${deviceProductionFk}/checkFile`, {
|
|
||||||
fileCabinet: 'hr',
|
|
||||||
signed: true,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
promises = await Promise.all(promises);
|
promises = await Promise.all(promises);
|
||||||
promises.forEach((promise) => {
|
promises.forEach((promise) => {
|
||||||
const id = +promise.config.url.match(/\d+/)[0];
|
const id = +promise.config.url.match(/\d+/)[0];
|
||||||
|
|
Loading…
Reference in New Issue