npm-pkg-hook 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/hooks/useDessert/index.js +1 -1
- package/src/hooks/useEditOneExtProductFoodOptional/index.js +28 -0
- package/src/hooks/useEditOneExtProductFoodOptional/queries.js +16 -0
- package/src/hooks/useProductsFood/queriesStore.js +17 -2
- package/src/hooks/useProductsFood/usetagsProducts.js +1 -1
- package/src/hooks/useSales/index.js +8 -10
- package/src/hooks/useSaveAvailableProduct/helpers/index.js +10 -2
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import { useRemoveExtraProductFoodsOptional } from '../useRemoveExtraProductFood
|
|
|
11
11
|
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL } from '../useRemoveExtraProductFoodsOptional/queries'
|
|
12
12
|
import { transformDataToDessert } from './helpers'
|
|
13
13
|
import { useDeleteSubProductOptional } from '../useDeleteSubProductOptional'
|
|
14
|
-
|
|
14
|
+
export * from './helpers'
|
|
15
15
|
export const useDessert = ({
|
|
16
16
|
pId = null,
|
|
17
17
|
initialData = null,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useMutation } from '@apollo/client'
|
|
4
|
+
import { UPDATE_EXT_PRODUCT_FOOD_OPTIONAL } from './queries';
|
|
5
|
+
export const useEditOneExtProductFoodOptional = () => {
|
|
6
|
+
const [updateExtProductFood] = useMutation(UPDATE_EXT_PRODUCT_FOOD_OPTIONAL);
|
|
7
|
+
const [loading, setLoading] = useState(false);
|
|
8
|
+
|
|
9
|
+
const updateOneExtraProductFood = async (input) => {
|
|
10
|
+
setLoading(true);
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const { data } = await updateExtProductFood({
|
|
14
|
+
variables: { input }
|
|
15
|
+
});
|
|
16
|
+
console.log('Product food updated:', data.editExtProductFoodOptional);
|
|
17
|
+
setLoading(false);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error('Error updating product food:', error.message);
|
|
20
|
+
setLoading(false);
|
|
21
|
+
throw new Error('Error updating product food');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
loading,
|
|
26
|
+
updateOneExtraProductFood
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { gql } from "@apollo/client"
|
|
2
|
+
|
|
3
|
+
export const UPDATE_EXT_PRODUCT_FOOD_OPTIONAL = gql`
|
|
4
|
+
mutation editExtProductFoodOptional($input: EditExtProductFoodOptionalInput!) {
|
|
5
|
+
editExtProductFoodOptional(input: $input) {
|
|
6
|
+
pId
|
|
7
|
+
opExPid
|
|
8
|
+
OptionalProName
|
|
9
|
+
state
|
|
10
|
+
code
|
|
11
|
+
required
|
|
12
|
+
numbersOptionalOnly
|
|
13
|
+
pDatMod
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`
|
|
@@ -575,7 +575,7 @@ export const SET_EDIT_STORE_NAME = gql`
|
|
|
575
575
|
}
|
|
576
576
|
`
|
|
577
577
|
export const GET_ONE_PRODUCTS_FOOD = gql`
|
|
578
|
-
|
|
578
|
+
query productFoodsOne($pId: ID) {
|
|
579
579
|
productFoodsOne(pId: $pId) {
|
|
580
580
|
pId
|
|
581
581
|
carProId
|
|
@@ -588,7 +588,6 @@ export const GET_ONE_PRODUCTS_FOOD = gql`
|
|
|
588
588
|
dId
|
|
589
589
|
ctId
|
|
590
590
|
tpId
|
|
591
|
-
|
|
592
591
|
fId
|
|
593
592
|
pName
|
|
594
593
|
ProPrice
|
|
@@ -612,6 +611,22 @@ export const GET_ONE_PRODUCTS_FOOD = gql`
|
|
|
612
611
|
sTateLogistic
|
|
613
612
|
pDatCre
|
|
614
613
|
pDatMod
|
|
614
|
+
getOneTags {
|
|
615
|
+
tPsId
|
|
616
|
+
idUser
|
|
617
|
+
idStore
|
|
618
|
+
pId
|
|
619
|
+
nameTag
|
|
620
|
+
aName
|
|
621
|
+
}
|
|
622
|
+
getAllAvailableProduct {
|
|
623
|
+
availableProductId
|
|
624
|
+
idStore
|
|
625
|
+
pId
|
|
626
|
+
dayAvailable
|
|
627
|
+
pDatCre
|
|
628
|
+
pDatMod
|
|
629
|
+
}
|
|
615
630
|
ExtProductFoodsAll {
|
|
616
631
|
pId
|
|
617
632
|
exPid
|
|
@@ -456,14 +456,14 @@ export const useSales = ({
|
|
|
456
456
|
})
|
|
457
457
|
.filter((obj) => obj !== null) // Elimine todos los objetos nulos del arreglo
|
|
458
458
|
const filteredDataExtra = dataExtra?.filter((p) => p?.quantity !== undefined && p?.quantity !== 0);
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
459
|
+
if (product?.PRODUCT?.pId) {
|
|
460
|
+
dispatch({
|
|
461
|
+
type: 'PUT_EXTRA_PRODUCTS_AND_OPTIONAL_PRODUCT',
|
|
462
|
+
payload: product.PRODUCT.pId,
|
|
463
|
+
dataOptional: filteredDataOptional,
|
|
464
|
+
dataExtra: filteredDataExtra
|
|
465
|
+
})
|
|
466
|
+
}
|
|
467
467
|
} catch (_error) {
|
|
468
468
|
return sendNotification({
|
|
469
469
|
title: 'Error',
|
|
@@ -847,8 +847,6 @@ export const useSales = ({
|
|
|
847
847
|
const { registerSalesStore } = data || {}
|
|
848
848
|
const { Response } = registerSalesStore || {}
|
|
849
849
|
if (Response && Response.success === true) {
|
|
850
|
-
dispatch({ type: 'REMOVE_ALL_PRODUCTS' })
|
|
851
|
-
setValues({})
|
|
852
850
|
setPrint(false)
|
|
853
851
|
client.query({
|
|
854
852
|
query: GET_ALL_COUNT_SALES,
|
|
@@ -9,7 +9,7 @@ export const days = [
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
day: 3,
|
|
12
|
-
name: '
|
|
12
|
+
name: 'MI'
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
day: 4,
|
|
@@ -27,4 +27,12 @@ export const days = [
|
|
|
27
27
|
day: 0,
|
|
28
28
|
name: 'D'
|
|
29
29
|
}
|
|
30
|
-
]
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
export const arraysAreEqual = (arr1, arr2) => {
|
|
33
|
+
if (arr1.length !== arr2.length) return false;
|
|
34
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
35
|
+
if (arr1[i] !== arr2[i]) return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
};
|