npm-pkg-hook 1.4.8 → 1.5.0
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/.eslintrc.js +38 -38
- package/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +8 -0
- package/package.json +1 -1
- package/src/hooks/getCategoriesWithProduct/index.js +1 -1
- package/src/hooks/getTodayTimestamps/index.js +64 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/useAsideCart/queries.js +1 -1
- package/src/hooks/useCart/index.js +1 -1
- package/src/hooks/useCart/useCart/helpers/index.js +2 -2
- package/src/hooks/useCatWithProductClient/queries.js +1 -1
- package/src/hooks/useCategoryInStore/queries.js +1 -1
- package/src/hooks/useChartData/index.js +21 -21
- package/src/hooks/useFavoriteStores/queries.js +1 -1
- package/src/hooks/useFetchJson/index.js +1 -1
- package/src/hooks/useGetOneStoreRating/queries.js +1 -1
- package/src/hooks/useGoogleLogin/loadScript.js +15 -15
- package/src/hooks/useGoogleLogin/removeScript.js +7 -7
- package/src/hooks/useKeypress/index.js +1 -1
- package/src/hooks/useLogout/index.js +45 -23
- package/src/hooks/useOrderClient/index.js +1 -1
- package/src/hooks/useOrders/queries.js +1 -1
- package/src/hooks/useReport/index.js +4 -4
- package/src/hooks/useReport/queries.js +3 -3
- package/src/hooks/useRestaurant/queries.js +1 -1
- package/src/hooks/useSales/index.js +8 -15
- package/src/hooks/useSales/queries.js +4 -2
package/.eslintrc.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
settings: {
|
|
3
|
-
react: {
|
|
4
|
-
version: 'detect'
|
|
5
|
-
}
|
|
6
|
-
},
|
|
7
|
-
env: {
|
|
8
|
-
browser: true,
|
|
9
|
-
es2021: true,
|
|
10
|
-
node: true
|
|
11
|
-
},
|
|
12
|
-
extends: [
|
|
13
|
-
'standard',
|
|
14
|
-
'plugin:react/recommended'
|
|
15
|
-
],
|
|
16
|
-
overrides: [
|
|
17
|
-
{
|
|
18
|
-
env: {
|
|
19
|
-
node: true
|
|
20
|
-
},
|
|
21
|
-
files: [
|
|
22
|
-
'.eslintrc.{js,cjs}'
|
|
23
|
-
],
|
|
24
|
-
parserOptions: {
|
|
25
|
-
sourceType: 'script'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
parserOptions: {
|
|
30
|
-
ecmaVersion: 'latest',
|
|
31
|
-
sourceType: 'module'
|
|
32
|
-
},
|
|
33
|
-
plugins: [
|
|
34
|
-
'react'
|
|
35
|
-
],
|
|
36
|
-
rules: {
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
settings: {
|
|
3
|
+
react: {
|
|
4
|
+
version: 'detect'
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
env: {
|
|
8
|
+
browser: true,
|
|
9
|
+
es2021: true,
|
|
10
|
+
node: true
|
|
11
|
+
},
|
|
12
|
+
extends: [
|
|
13
|
+
'standard',
|
|
14
|
+
'plugin:react/recommended'
|
|
15
|
+
],
|
|
16
|
+
overrides: [
|
|
17
|
+
{
|
|
18
|
+
env: {
|
|
19
|
+
node: true
|
|
20
|
+
},
|
|
21
|
+
files: [
|
|
22
|
+
'.eslintrc.{js,cjs}'
|
|
23
|
+
],
|
|
24
|
+
parserOptions: {
|
|
25
|
+
sourceType: 'script'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
parserOptions: {
|
|
30
|
+
ecmaVersion: 'latest',
|
|
31
|
+
sourceType: 'module'
|
|
32
|
+
},
|
|
33
|
+
plugins: [
|
|
34
|
+
'react'
|
|
35
|
+
],
|
|
36
|
+
rules: {
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the start timestamp for the current day.
|
|
3
|
+
* @returns {string} The start timestamp for the current day.
|
|
4
|
+
*/
|
|
5
|
+
export const getStartOfDayTimestamp = () => {
|
|
6
|
+
const start = new Date()
|
|
7
|
+
start.setHours(0, 0, 0, 0)
|
|
8
|
+
return start.toISOString()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get the end timestamp for the current day.
|
|
13
|
+
* @returns {string} The end timestamp for the current day.
|
|
14
|
+
*/
|
|
15
|
+
export const getEndOfDayTimestamp = () => {
|
|
16
|
+
const end = new Date()
|
|
17
|
+
end.setHours(23, 59, 59, 999)
|
|
18
|
+
return end.toISOString()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get start and end timestamps for the current day.
|
|
23
|
+
* @returns {Object} An object containing start and end timestamps.
|
|
24
|
+
*/
|
|
25
|
+
export const getTodayTimestamps = () => {
|
|
26
|
+
return {
|
|
27
|
+
startTimestamp: getStartOfDayTimestamp(),
|
|
28
|
+
endTimestamp: getEndOfDayTimestamp()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get start timestamp for a specific number of days ago.
|
|
34
|
+
* @param {number} daysAgo - The number of days ago.
|
|
35
|
+
* @returns {string} The start timestamp for the specified number of days ago.
|
|
36
|
+
*/
|
|
37
|
+
export const getStartTimestampDaysAgo = (daysAgo) => {
|
|
38
|
+
if (isNaN(daysAgo) || daysAgo < 0) {
|
|
39
|
+
throw new Error('Invalid input. Provide a valid number of days.')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const start = new Date()
|
|
43
|
+
start.setDate(start.getDate() - daysAgo)
|
|
44
|
+
start.setHours(0, 0, 0, 0)
|
|
45
|
+
|
|
46
|
+
return start.toISOString()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function convertDateFormat ({ dateString, start }) {
|
|
50
|
+
const parsedDate = new Date(dateString)
|
|
51
|
+
const year = parsedDate.getFullYear()
|
|
52
|
+
const month = `0${parsedDate.getMonth() + 1}`.slice(-2)
|
|
53
|
+
const day = `0${parsedDate.getDate()}`.slice(-2)
|
|
54
|
+
|
|
55
|
+
if (start) {
|
|
56
|
+
// Inicio del día (00:00:00)
|
|
57
|
+
return `${year}-${month}-${day}T00:00:00.000Z`
|
|
58
|
+
} else {
|
|
59
|
+
// Final del día (23:59:59.999)
|
|
60
|
+
const endOfDay = new Date(parsedDate)
|
|
61
|
+
endOfDay.setHours(23, 59, 59, 999)
|
|
62
|
+
return endOfDay.toISOString()
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/hooks/index.js
CHANGED
|
@@ -46,6 +46,7 @@ export * from './useDrag'
|
|
|
46
46
|
export * from './useEvent'
|
|
47
47
|
export * from './useFetchJson'
|
|
48
48
|
export * from './useFormatDate'
|
|
49
|
+
export * from './getTodayTimestamps'
|
|
49
50
|
export * from './useFormatNumberPhone'
|
|
50
51
|
export * from './useFormTools/index'
|
|
51
52
|
export * from './useHover'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './useCart'
|
|
2
|
-
export * from './useGetCart'
|
|
2
|
+
export * from './useGetCart'
|
|
@@ -2,7 +2,7 @@ import { filterKeyObject } from '../../../../utils'
|
|
|
2
2
|
|
|
3
3
|
const filters = ['__typename']
|
|
4
4
|
|
|
5
|
-
export const filterDataOptional = (dataOptional) => {
|
|
5
|
+
export const filterDataOptional = (dataOptional) => {
|
|
6
6
|
if (!Array.isArray(dataOptional)) {
|
|
7
7
|
throw new Error('Input data is not an array')
|
|
8
8
|
}
|
|
@@ -72,4 +72,4 @@ export const filterExtra = (dataExtra) => {
|
|
|
72
72
|
} catch (error) {
|
|
73
73
|
return []
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|
|
@@ -11,30 +11,29 @@ export const useChartData = ({ year }) => {
|
|
|
11
11
|
const [asFilter, setFilter] = useState(false)
|
|
12
12
|
const [newResult, setNewResult] = useState([])
|
|
13
13
|
const result = []
|
|
14
|
-
|
|
15
|
-
// Creamos la posición del array para cada mes
|
|
16
|
-
const mes = new Date(value.pDatCre).getMonth()
|
|
17
|
-
const Year = new Date(value.pDatCre).getFullYear()
|
|
18
|
-
if (!res[mes]) {
|
|
19
|
-
res[mes] = { Mes: mes, Year }
|
|
20
|
-
// Inicializamos a 0 el valor de cada key
|
|
21
|
-
Object.keys(value).forEach((key) => {
|
|
22
|
-
if (key !== 'pDatCre') {
|
|
23
|
-
res[mes][key] = 0
|
|
24
|
-
}
|
|
25
|
-
})
|
|
14
|
+
const sumByMonth = {}
|
|
26
15
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
data?.getAllSalesStore?.forEach(function (value) {
|
|
17
|
+
const month = new Date(value.pDatCre).getMonth()
|
|
18
|
+
const year = new Date(value.pDatCre).getFullYear()
|
|
19
|
+
const key = `${month}-${year}`
|
|
20
|
+
|
|
21
|
+
if (!sumByMonth[key]) {
|
|
22
|
+
sumByMonth[key] = {
|
|
23
|
+
Mes: month,
|
|
24
|
+
Year: year,
|
|
25
|
+
totalProductsPrice: 0
|
|
33
26
|
}
|
|
34
|
-
})
|
|
35
|
-
return res
|
|
36
|
-
}, {})
|
|
37
27
|
|
|
28
|
+
result.push(sumByMonth[key])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
sumByMonth[key].totalProductsPrice += value.totalProductsPrice
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
console.log(result)
|
|
35
|
+
|
|
36
|
+
console.log(data?.getAllSalesStore)
|
|
38
37
|
const allMonths = Array.from({ length: 12 }, (_, i) => { return i })
|
|
39
38
|
const missingMonths = allMonths.filter(month => { return !result.some(data => { return data.Mes === month }) })
|
|
40
39
|
|
|
@@ -89,6 +88,7 @@ export const useChartData = ({ year }) => {
|
|
|
89
88
|
}
|
|
90
89
|
]
|
|
91
90
|
}
|
|
91
|
+
console.log(result)
|
|
92
92
|
const options = {
|
|
93
93
|
interaction: {
|
|
94
94
|
mode: 'index',
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export default (d, s, id, jsSrc, cb, onError) => {
|
|
2
|
-
const element = d.getElementsByTagName(s)[0]
|
|
3
|
-
const fjs = element
|
|
4
|
-
let js = element
|
|
5
|
-
js = d.createElement(s)
|
|
6
|
-
js.id = id
|
|
7
|
-
js.src = jsSrc
|
|
8
|
-
if (fjs && fjs.parentNode) {
|
|
9
|
-
fjs.parentNode.insertBefore(js, fjs)
|
|
10
|
-
} else {
|
|
11
|
-
d.head.appendChild(js)
|
|
12
|
-
}
|
|
13
|
-
js.onerror = onError
|
|
14
|
-
js.onload = cb
|
|
15
|
-
}
|
|
1
|
+
export default (d, s, id, jsSrc, cb, onError) => {
|
|
2
|
+
const element = d.getElementsByTagName(s)[0]
|
|
3
|
+
const fjs = element
|
|
4
|
+
let js = element
|
|
5
|
+
js = d.createElement(s)
|
|
6
|
+
js.id = id
|
|
7
|
+
js.src = jsSrc
|
|
8
|
+
if (fjs && fjs.parentNode) {
|
|
9
|
+
fjs.parentNode.insertBefore(js, fjs)
|
|
10
|
+
} else {
|
|
11
|
+
d.head.appendChild(js)
|
|
12
|
+
}
|
|
13
|
+
js.onerror = onError
|
|
14
|
+
js.onload = cb
|
|
15
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default (d, id) => {
|
|
2
|
-
const element = d.getElementById(id)
|
|
3
|
-
|
|
4
|
-
if (element) {
|
|
5
|
-
element.parentNode.removeChild(element)
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
export default (d, id) => {
|
|
2
|
+
const element = d.getElementById(id)
|
|
3
|
+
|
|
4
|
+
if (element) {
|
|
5
|
+
element.parentNode.removeChild(element)
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -2,19 +2,43 @@ import { useApolloClient } from '@apollo/client'
|
|
|
2
2
|
import { useState } from 'react'
|
|
3
3
|
import { Cookies } from '../../cookies/index'
|
|
4
4
|
import { signOutAuth } from './helpers'
|
|
5
|
+
import { getCurrentDomain } from '../../utils'
|
|
5
6
|
export { signOutAuth } from './helpers'
|
|
6
7
|
|
|
7
|
-
export const useLogout = ({ setAlertBox = () => {
|
|
8
|
+
export const useLogout = ({ setAlertBox = () => {} } = {}) => {
|
|
8
9
|
const [loading, setLoading] = useState(false)
|
|
9
10
|
const [error, setError] = useState(false)
|
|
10
11
|
const client = useApolloClient()
|
|
11
12
|
|
|
13
|
+
const eliminarCookie = async (nombreCookie) => {
|
|
14
|
+
try {
|
|
15
|
+
let domain = getCurrentDomain()
|
|
16
|
+
|
|
17
|
+
// Si estás en entorno local, usa 'localhost' como dominio
|
|
18
|
+
if (domain === 'localhost') {
|
|
19
|
+
domain = undefined // Esto permitirá la cookie en 'localhost'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const expirationTime = new Date()
|
|
23
|
+
expirationTime.setTime(expirationTime.getTime() - 1000) // Establece una fecha de expiración en el pasado
|
|
24
|
+
|
|
25
|
+
const formattedDomain = domain || getCurrentDomain()
|
|
26
|
+
|
|
27
|
+
await Cookies.remove(nombreCookie, { domain: formattedDomain, path: '/', secure: process.env.NODE_ENV === 'production' })
|
|
28
|
+
|
|
29
|
+
console.log('Cookie eliminada correctamente.')
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Error al eliminar la cookie:', error)
|
|
32
|
+
throw new Error('Error al eliminar la cookie. ')
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
12
36
|
const onClickLogout = async () => {
|
|
13
37
|
try {
|
|
14
38
|
setLoading(true)
|
|
15
39
|
|
|
16
40
|
// Logout from the server
|
|
17
|
-
const logoutResponse = await
|
|
41
|
+
const logoutResponse = await fetch(`${process.env.URL_BASE}/api/auth/logout/`, {
|
|
18
42
|
method: 'POST',
|
|
19
43
|
headers: {
|
|
20
44
|
'Content-Type': 'application/json'
|
|
@@ -24,33 +48,31 @@ export const useLogout = ({ setAlertBox = () => { } } = {}) => {
|
|
|
24
48
|
|
|
25
49
|
if (!logoutResponse.ok) {
|
|
26
50
|
setLoading(false)
|
|
27
|
-
//
|
|
51
|
+
// Handle unsuccessful logout request, e.g., show an error message
|
|
28
52
|
return
|
|
29
53
|
}
|
|
30
54
|
|
|
31
|
-
const response = await logoutResponse.json()
|
|
55
|
+
const response = await logoutResponse.json()
|
|
32
56
|
const { status } = response || {}
|
|
33
57
|
console.log('Intentando borrar cookies...')
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setLoading(false)
|
|
46
|
-
console.log('Borrado todo')
|
|
47
|
-
signOutAuth({ redirect: true, callbackUrl: '/' })
|
|
48
|
-
.catch(() => {
|
|
49
|
-
setError(true)
|
|
50
|
-
setAlertBox({ message: 'Ocurrió un error al cerrar session' })
|
|
51
|
-
})
|
|
52
|
-
}
|
|
58
|
+
|
|
59
|
+
// Eliminar la cookie process.env.SESSION_NAME
|
|
60
|
+
await eliminarCookie(process.env.SESSION_NAME)
|
|
61
|
+
Cookies.remove(process.env.LOCAL_SALES_STORE)
|
|
62
|
+
Cookies.remove('restaurant')
|
|
63
|
+
Cookies.remove('usuario')
|
|
64
|
+
Cookies.remove('session')
|
|
65
|
+
|
|
66
|
+
// Clear Apollo Client cache
|
|
67
|
+
client?.clearStore()
|
|
68
|
+
|
|
53
69
|
setLoading(false)
|
|
70
|
+
console.log('Cookies eliminadas y sesión cerrada con éxito')
|
|
71
|
+
signOutAuth({ redirect: true, callbackUrl: '/' })
|
|
72
|
+
.catch(() => {
|
|
73
|
+
setError(true)
|
|
74
|
+
setAlertBox({ message: 'Ocurrió un error al cerrar sesión' })
|
|
75
|
+
})
|
|
54
76
|
} catch (error) {
|
|
55
77
|
setLoading(false)
|
|
56
78
|
setError(true)
|
|
@@ -30,15 +30,15 @@ export const useReport = ({
|
|
|
30
30
|
variables: {
|
|
31
31
|
fromDate,
|
|
32
32
|
toDate
|
|
33
|
-
}
|
|
34
|
-
skip: !data || data?.getAllSalesStore?.length === 0 // Skip if main query hasn't loaded or has no data
|
|
33
|
+
}
|
|
35
34
|
})
|
|
36
|
-
|
|
35
|
+
console.log(fromDate,
|
|
36
|
+
toDate)
|
|
37
37
|
const totalSales = totalSalesData?.getAllSalesStoreTotal ?? {}
|
|
38
38
|
|
|
39
39
|
return {
|
|
40
40
|
getAllSalesStore: lazyQuery ? getAllSalesStore : () => { }, // Return function only if in lazy mode
|
|
41
|
-
data: lazyQuery ?
|
|
41
|
+
data: lazyQuery ? lazyDataSales : data, // Use data from lazy query if available
|
|
42
42
|
loading: lazyQuery ? lazyLoading || loading : loading,
|
|
43
43
|
totalSales: totalSales.TOTAL || 0,
|
|
44
44
|
restaurant: totalSales.restaurant || 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gql } from '@apollo/client'
|
|
2
2
|
|
|
3
3
|
export const GET_ALL_SALES = gql`
|
|
4
|
-
query getAllSalesStore($idStore: ID,$search: String, $min: Int, $max: Int $fromDate:
|
|
4
|
+
query getAllSalesStore($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: String, $toDate: String ) {
|
|
5
5
|
getAllSalesStore(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
6
6
|
totalProductsPrice
|
|
7
7
|
channel
|
|
@@ -12,7 +12,7 @@ query getAllSalesStore($idStore: ID,$search: String, $min: Int, $max: Int $fromD
|
|
|
12
12
|
`
|
|
13
13
|
|
|
14
14
|
export const GET_ALL_TOTAL_SALES = gql`
|
|
15
|
-
query getAllSalesStoreTotal($idStore: ID,$search: String, $min: Int, $max: Int $fromDate:
|
|
15
|
+
query getAllSalesStoreTotal($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: String, $toDate: String) {
|
|
16
16
|
getAllSalesStoreTotal(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
17
17
|
restaurant
|
|
18
18
|
delivery
|
|
@@ -120,4 +120,4 @@ query getOneSalesStore($pCodeRef: String) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
`
|
|
123
|
+
`
|
|
@@ -54,10 +54,10 @@ const initializer = (initialValue = initialState) => {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export const useSales = ({
|
|
57
|
-
disabled,
|
|
58
|
-
sendNotification,
|
|
57
|
+
disabled = false,
|
|
59
58
|
router,
|
|
60
|
-
|
|
59
|
+
sendNotification = () => { return },
|
|
60
|
+
setAlertBox = () => { return }
|
|
61
61
|
}) => {
|
|
62
62
|
const domain = getCurrentDomain()
|
|
63
63
|
const [loadingSale, setLoadingSale] = useState(false)
|
|
@@ -330,14 +330,6 @@ export const useSales = ({
|
|
|
330
330
|
case 'DECREMENT':
|
|
331
331
|
return {
|
|
332
332
|
...state
|
|
333
|
-
// counter: state.counter - 1,
|
|
334
|
-
// PRODUCT: state?.PRODUCT?.map((items) => {
|
|
335
|
-
// return items.pId === action.id ? {
|
|
336
|
-
// ...items,
|
|
337
|
-
// ProQuantity: items.ProQuantity - 1,
|
|
338
|
-
// // ProPrice: ((productExist.ProQuantity + 1) * OurProduct?.ProPrice),
|
|
339
|
-
// } : items
|
|
340
|
-
// })
|
|
341
333
|
}
|
|
342
334
|
case 'PAYMENT_METHOD_TRANSACTION':
|
|
343
335
|
return {
|
|
@@ -826,6 +818,7 @@ export const useSales = ({
|
|
|
826
818
|
const totalProductsPrice = totalProductPrice
|
|
827
819
|
const client = useApolloClient()
|
|
828
820
|
const { getOnePedidoStore } = useGetSale()
|
|
821
|
+
|
|
829
822
|
const handleSubmit = () => {
|
|
830
823
|
if (errors?.change || errors?.valueDelivery) {
|
|
831
824
|
return sendNotification({
|
|
@@ -837,7 +830,7 @@ export const useSales = ({
|
|
|
837
830
|
setLoadingSale(true)
|
|
838
831
|
const code = RandomCode(10)
|
|
839
832
|
setCode(code)
|
|
840
|
-
function
|
|
833
|
+
function convertInteger (cadena) {
|
|
841
834
|
if (typeof cadena === 'string') {
|
|
842
835
|
const numeroEntero = parseInt(cadena?.replace('.', ''))
|
|
843
836
|
return numeroEntero
|
|
@@ -849,12 +842,12 @@ export const useSales = ({
|
|
|
849
842
|
input: finalArrayProduct || [],
|
|
850
843
|
id: values?.cliId,
|
|
851
844
|
pCodeRef: code,
|
|
852
|
-
change:
|
|
853
|
-
valueDelivery:
|
|
845
|
+
change: convertInteger(values.change),
|
|
846
|
+
valueDelivery: convertInteger(values.valueDelivery),
|
|
854
847
|
payMethodPState: data.payMethodPState,
|
|
855
848
|
pickUp: 1,
|
|
856
849
|
discount: discount.discount || 0,
|
|
857
|
-
totalProductsPrice:
|
|
850
|
+
totalProductsPrice: convertInteger(totalProductsPrice) || 0
|
|
858
851
|
}
|
|
859
852
|
})
|
|
860
853
|
.then((responseRegisterR) => {
|
|
@@ -6,8 +6,8 @@ export const GET_ALL_SALES = gql`
|
|
|
6
6
|
$search: String
|
|
7
7
|
$min: Int
|
|
8
8
|
$max: Int
|
|
9
|
-
$fromDate:
|
|
10
|
-
$toDate:
|
|
9
|
+
$fromDate: String
|
|
10
|
+
$toDate: String
|
|
11
11
|
) {
|
|
12
12
|
getAllSalesStore(
|
|
13
13
|
idStore: $idStore
|
|
@@ -275,6 +275,7 @@ export const GET_ONE_SALE = gql`
|
|
|
275
275
|
getAllShoppingCard {
|
|
276
276
|
ShoppingCard
|
|
277
277
|
cantProducts
|
|
278
|
+
priceProduct
|
|
278
279
|
refCodePid
|
|
279
280
|
subProductsId
|
|
280
281
|
comments
|
|
@@ -416,6 +417,7 @@ query getAllPedidoStoreFinal($idStore: ID, $search: String, $min: Int, $max: Int
|
|
|
416
417
|
pDatMod
|
|
417
418
|
getAllShoppingCard {
|
|
418
419
|
ShoppingCard
|
|
420
|
+
priceProduct
|
|
419
421
|
comments
|
|
420
422
|
cantProducts
|
|
421
423
|
pId
|