28 Commits

Author SHA1 Message Date
173cf3771b #28 dependency: add axios 2026-02-14 17:56:37 -05:00
173ddfd05f feat(Login): add example jwt token 2026-02-14 17:49:49 -05:00
c593dd0273 Merge pull request '#23 Comentado botones para adicionar clientes.' (#25) from delete_add_customer_buttons_#23 into main
Reviewed-on: #25
2025-08-30 16:10:33 -05:00
c8460c8e81 #23 fix: comment add customer button. 2025-08-30 16:08:31 -05:00
Rodia
3fdfc3c883 Merge pull request 'feat: Add page send sales to tryton close #20' (#21) from enviar_ventas_tryton#20 into main
Reviewed-on: #21
2025-08-16 15:15:31 -05:00
rodia
460e213e0e feat: Add page send sales to tryton close #20 2025-08-16 17:12:46 -03:00
rodia
e192c3778a feat: Admin code for sychronize Parties, Products 2025-08-16 14:02:55 -03:00
Rodia
5c594ea563 Merge pull request 'AsyncProductsFromTryton' (#18) from AsyncProductsFromTryton into main
Reviewed-on: #18
2025-08-16 09:42:45 -05:00
f22fcb6f16 feat: Add Update Parties From Tryton 2025-08-09 19:44:30 -03:00
1b84c5419f feat: Sincronizar Productos desde Tryton 2025-08-09 16:35:07 -03:00
7fe137ce4f Se agrega al menu la opcion de sincronizar productos desde tryton 2025-07-26 19:57:12 -03:00
e2ccfbcd5f Merge pull request 'config(Deploy): use environment to config api server.' (#17) from config_environment_on_production into main
Reviewed-on: #17
2025-04-04 18:54:03 -05:00
459a028891 config(Deploy): use environment to config api server. 2025-04-04 18:28:10 -05:00
1c294a5ba6 fix: Modify tasks service name 2025-03-29 16:13:28 -05:00
8a855be105 Merge pull request 'Venta de admin que puede editar precios de productos' (#15) from admin_purchase_#12 into main
Reviewed-on: #15
2025-03-08 19:10:49 -05:00
d89b79bfd0 #12 style(Navbar): add icions and separete admin actions. 2025-03-08 19:07:40 -05:00
5860411753 #12 feat(Compra): add compra administrativa. 2025-03-08 18:04:45 -05:00
a4dd8f98d8 #14 style(SummaryPurchase): add info table. 2025-03-08 17:45:31 -05:00
ed482542a4 #13 fix(SummaryPurchase): change button to start point. 2025-03-08 17:02:02 -05:00
8652e4778f #10 fix(Code): add cancel button. 2025-03-08 16:59:06 -05:00
187f2fde9f Merge pull request 'exportando ventas de tryton #5' (#6) from export_purchases_to_tryton_#5 into main
Reviewed-on: #6
2025-03-03 22:54:14 -05:00
49e8de8c0c #5 secured(csv): export_purchases_to_tryton 2025-03-03 22:52:44 -05:00
f8a52fc3ec #5 feat(CSV): export csv tryton. 2025-03-03 22:50:47 -05:00
db8ec154ae #5 feat(API): getCSVForTryton 2025-03-03 22:06:49 -05:00
4e88477323 Merge pull request '#2 fix(Environment): move django url to vite.config.mjs' (#4) from fix_api_implementantion_env_#2 into main
Reviewed-on: #4
2025-03-02 00:45:31 -05:00
2e4aef00c4 #2 fix(Environment): move django url to vite.config.mjs 2025-03-02 00:45:11 -05:00
3841e6ac7f Merge pull request 'fix(Environment): move API_IMPLEMENTATION to vite.config.mjs' (#3) from fix_api_implementantion_env_#2 into main
Reviewed-on: #3
2025-03-01 22:37:43 -05:00
d50ff7e1e7 fix(Environment): move API_IMPLEMENTATION to vite.config.mjs 2025-03-01 22:31:58 -05:00
25 changed files with 1083 additions and 91 deletions

View File

@@ -12,12 +12,12 @@ namespace :live do
desc 'monitorear salida' desc 'monitorear salida'
task :tail do task :tail do
compose('logs', '-f', 'django', compose: DOCKER_COMPOSE) compose('logs', '-f', 'frontend', compose: DOCKER_COMPOSE)
end end
desc 'monitorear salida' desc 'monitorear salida'
task :tail_end do task :tail_end do
compose('logs', '-f', '-n 50', 'django', compose: DOCKER_COMPOSE) compose('logs', '-f', '-n 50', 'frontend', compose: DOCKER_COMPOSE)
end end
desc 'iniciar entorno' desc 'iniciar entorno'

View File

@@ -7,4 +7,7 @@ services:
- ./:/app/ - ./:/app/
ports: ports:
- "7001:3000" - "7001:3000"
environment:
- VITE_DJANGO_BASE_URL=http://localhost:7000
- VITE_API_IMPLEMENTATION=django

220
package-lock.json generated
View File

@@ -9,6 +9,7 @@
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"@mdi/font": "7.4.47", "@mdi/font": "7.4.47",
"axios": "^1.13.5",
"core-js": "^3.37.1", "core-js": "^3.37.1",
"roboto-fontface": "*", "roboto-fontface": "*",
"vee-validate": "^4.14.6", "vee-validate": "^4.14.6",
@@ -1503,6 +1504,12 @@
"node": ">=16.14.0" "node": ">=16.14.0"
} }
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT"
},
"node_modules/available-typed-arrays": { "node_modules/available-typed-arrays": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@@ -1519,6 +1526,17 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/axios": {
"version": "1.13.5",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz",
"integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.11",
"form-data": "^4.0.5",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/babel-eslint": { "node_modules/babel-eslint": {
"version": "10.1.0", "version": "10.1.0",
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz",
@@ -1667,6 +1685,19 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/callsites": { "node_modules/callsites": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -1752,6 +1783,18 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": { "node_modules/concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -1941,6 +1984,15 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/doctrine": { "node_modules/doctrine": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@@ -1954,6 +2006,20 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/entities": { "node_modules/entities": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
@@ -2028,14 +2094,10 @@
} }
}, },
"node_modules/es-define-property": { "node_modules/es-define-property": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": {
"get-intrinsic": "^1.2.4"
},
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
} }
@@ -2044,17 +2106,15 @@
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/es-object-atoms": { "node_modules/es-object-atoms": {
"version": "1.0.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"es-errors": "^1.3.0" "es-errors": "^1.3.0"
@@ -2064,15 +2124,15 @@
} }
}, },
"node_modules/es-set-tostringtag": { "node_modules/es-set-tostringtag": {
"version": "2.0.3", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"get-intrinsic": "^1.2.4", "es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2", "has-tostringtag": "^1.0.2",
"hasown": "^2.0.1" "hasown": "^2.0.2"
}, },
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
@@ -2851,6 +2911,26 @@
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"license": "MIT",
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/for-each": { "node_modules/for-each": {
"version": "0.3.3", "version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
@@ -2861,6 +2941,22 @@
"is-callable": "^1.1.3" "is-callable": "^1.1.3"
} }
}, },
"node_modules/form-data": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -2886,7 +2982,6 @@
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
"license": "MIT", "license": "MIT",
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
@@ -2922,17 +3017,21 @@
} }
}, },
"node_modules/get-intrinsic": { "node_modules/get-intrinsic": {
"version": "1.2.4", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0", "es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2", "function-bind": "^1.1.2",
"has-proto": "^1.0.1", "get-proto": "^1.0.1",
"has-symbols": "^1.0.3", "gopd": "^1.2.0",
"hasown": "^2.0.0" "has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
}, },
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
@@ -2941,6 +3040,19 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/get-symbol-description": { "node_modules/get-symbol-description": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz",
@@ -3041,13 +3153,12 @@
} }
}, },
"node_modules/gopd": { "node_modules/gopd": {
"version": "1.0.1", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "engines": {
"get-intrinsic": "^1.1.3" "node": ">= 0.4"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
@@ -3107,10 +3218,9 @@
} }
}, },
"node_modules/has-symbols": { "node_modules/has-symbols": {
"version": "1.0.3", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
@@ -3123,7 +3233,6 @@
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"has-symbols": "^1.0.3" "has-symbols": "^1.0.3"
@@ -3139,7 +3248,6 @@
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"function-bind": "^1.1.2" "function-bind": "^1.1.2"
@@ -3721,6 +3829,15 @@
"node": ">=16.14.0" "node": ">=16.14.0"
} }
}, },
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/merge2": { "node_modules/merge2": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -3745,6 +3862,27 @@
"node": ">=8.6" "node": ">=8.6"
} }
}, },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": { "node_modules/minimatch": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -4206,6 +4344,12 @@
"node": ">= 0.8.0" "node": ">= 0.8.0"
} }
}, },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",

View File

@@ -9,6 +9,7 @@
}, },
"dependencies": { "dependencies": {
"@mdi/font": "7.4.47", "@mdi/font": "7.4.47",
"axios": "^1.13.5",
"core-js": "^3.37.1", "core-js": "^3.37.1",
"roboto-fontface": "*", "roboto-fontface": "*",
"vee-validate": "^4.14.6", "vee-validate": "^4.14.6",

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" version="1.0"><path d="M256 196.25c0 40.122-21.534 60.038-64.603 59.747H67.495C22.498 255.997 0 236.663 0 197.994V60.184C0 20.06 22.016 0 66.049 0h124.384C234.144 0 256 20.206 256 60.62v135.63" style="text-align:start;line-height:125%;-inkscape-font-specification:Kimberley" font-size="108.872" font-weight="400" fill="#1b2019" font-family="Kimberley"/><path d="M19.006 169.515c5.949-3.124 17.076 1.966 22.115 10.12 4.518 7.31 27.406 14.114 35.516 10.558 5.412-2.372 6.779-5.378 7.202-15.844.798-19.685-3.636-35.098-17.99-62.536-7.205-13.77-14.753-29-16.775-33.835C47.052 73.14 41.601 64.6 36.961 59c-9.876-11.91-10.183-15.164-2.078-22.074C47.02 26.581 67.52 43.327 63.095 59.97c-2.178 8.191 2.003 20.14 15.85 45.295 16.431 29.85 33.084 41.94 43.03 31.243 2.57-2.763 5.759-18.178 8.698-42.04 4.421-35.889 4.399-38.037-.47-45.252-8.418-12.475-.48-25.42 12.84-20.943 13.43 4.513 22.192 22.778 13.775 28.714-3.735 2.633-4.942 10.29-6.636 42.097-2.173 40.785-.53 51.7 8.609 57.187 8.121 4.876 10.946 3.885 28.067-9.889 18.167-14.612 25.636-24.069 26.115-33.067.446-8.37 5.992-12.847 14.832-11.972 5.635.56 8.15 2.41 11.3 8.312 6.431 12.053 4.589 19.71-5.212 21.667-7.987 1.592-21.708 19.27-42.815 55.16-22.288 37.897-27.173 41.845-52.152 42.147-10.268.123-24.634-3.295-58.453-13.914-24.663-7.746-48.043-14.468-51.957-14.943-14.142-1.708-21.187-24.12-9.51-30.257z" fill="#ededed"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,341 @@
<template>
<v-container>
<v-form ref="purchase" v-model="valid" @change="onFormChange">
<v-row>
<v-col>
<v-autocomplete
v-model="purchase.customer"
:items="filteredClients"
:search="client_search"
no-data-text="No se hallaron clientes"
item-title="name"
item-value="id"
@update:model-value="onFormChange"
label="Cliente"
:rules="[rules.required]"
required
class="mr-4"
></v-autocomplete>
<!-- <v-btn color="primary" @click="openModal">Agregar Cliente</v-btn> -->
<CreateCustomerModal ref="customerModal" @customerCreated="handleNewCustomer"/>
</v-col>
<v-col lg="4">
<v-text-field
v-model="purchase.date"
label="Fecha"
type="datetime-local"
:rules="[rules.required]"
required
readonly
></v-text-field>
</v-col>
</v-row>
<v-textarea
v-model="purchase.notes"
label="Notas"
rows="2"
></v-textarea>
<v-divider></v-divider>
<v-container>
<v-toolbar>
<v-toolbar-title secondary>Productos</v-toolbar-title>
p </v-toolbar>
<v-container v-for="(line, index) in purchase.saleline_set" :key="line.id">
<v-row>
<v-col
lg="9">
<v-autocomplete
v-model="line.product"
:items="filteredProducts"
:search="product_search"
@update:modelValue="onProductChange(index)"
no-data-text="No se hallaron productos"
item-title="name"
item-value="id"
item-subtitle="Price"
label="Producto"
:rules="[rules.required]"
required
>
<template v-slot:item="{ props, item }">
<v-list-item v-bind="props" :title="item.raw.name" :subtitle="formatPrice(item.raw.price)"></v-list-item>
</template>
</v-autocomplete>
</v-col>
<v-col
lg="2"
>
<v-text-field
v-model.number="line.quantity"
label="Cantidad"
type="number"
:rules="[rules.required,rules.positive]"
required
></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col>
<v-text-field
v-model.number="line.unit_price"
label="Precio"
type="number"
:rules="[rules.required]"
prefix="$"
required
></v-text-field>
</v-col>
<v-col>
<v-text-field
v-model="line.measuring_unit"
label="UdM"
persistent-placeholder="true"
readonly
></v-text-field>
</v-col>
<v-col>
<v-text-field
type="number"
:value="calculateSubtotal(line)"
label="Subtotal"
prefix="$"
readonly
disable
persistent-placeholder="true"
></v-text-field>
</v-col>
<v-col>
<v-btn @click="removeLine(index)" color="red">Eliminar</v-btn>
</v-col>
</v-row>
<v-alert type="warning" :duration="2000" closable v-model="show_alert_lines">
No se puede eliminar la única línea.
</v-alert>
</v-container>
<v-btn @click="addLine" color="blue">Agregar</v-btn>
</v-container>
<v-divider></v-divider>
<v-text-field
:value="calculateTotal"
label="Total"
prefix="$"
readonly
persistent-placeholder="true"
></v-text-field>
<v-container v-if="calculateTotal > 0">
<v-select
:items="payment_methods"
v-model="purchase.payment_method"
item-title="text"
item-value="value"
label="Pago en"
:rules="[rules.required]"
required
></v-select>
<v-btn @click="openCasherModal" v-if="purchase.payment_method === 'CASH'">Calcular Devuelta</v-btn>
<CasherModal :total_purchase="calculateTotal" ref="casherModal"</CasherModal>
</v-container>
<v-btn @click="submit" color="green">Comprar</v-btn>
<v-alert type="error" :duration="2000" closable v-model="show_alert_purchase">
Verifique los campos obligatorios.
</v-alert>
</v-form>
</v-container>
</template>
<script>
import CustomerForm from './CreateCustomerModal.vue';
import CasherModal from './CasherModal.vue';
import { inject } from 'vue';
export default {
name: 'DonConfiao',
components: {
CustomerForm,
CasherModal,
},
props: {
msg: String
},
data() {
return {
api: inject('api'),
valid: false,
form_changed: false,
show_alert_lines: false,
show_alert_purchase: false,
client_search: '',
product_search: '',
payment_methods: null,
purchase: {
date: this.getCurrentDate(),
customer: null,
notes: '',
payment_method: null,
saleline_set: [{product:'', unit_price: 0, quantity: 0, unit: ''}],
},
rules: {
required: value => !!value || 'Requerido.',
positive: value => value > 0 || 'La cantidad debe ser mayor que 0.',
},
menuItems: [
{ title: 'Inicio', route: '/'},
{ title: 'Compras', route:'/compras'},
],
clients: [],
products: [],
};
},
created() {
this.fetchClients();
this.fetchProducts();
this.fetchPaymentMethods();
},
watch: {
group () {
this.drawer = false
},
},
beforeMount() {
window.addEventListener('beforeunload', this.confirmLeave);
},
beforeDestroy() {
window.removeEventListener('beforeunload', this.confirmLeave);
},
computed: {
calculateTotal() {
return this.purchase.saleline_set.reduce((total, saleline) => {
return total + this.calculateSubtotal(saleline);
}, 0);
},
filteredClients() {
return this.clients.filter(client => {
if (this.client_search === '') {
return [];
} else {
return client.name.toLowerCase().includes(this.client_search.toLowerCase());
}
});
},
filteredProducts() {
return this.products.filter(product => {
if (this.product_search === '') {
return [];
} else {
return product.name.toLowerCase().includes(this.product_search.toLowerCase());
}
});
},
},
methods: {
openModal() {
this.$refs.customerModal.openModal();
},
onFormChange() {
this.form_changed = true;
},
openCasherModal() {
this.$refs.casherModal.dialog = true
},
confirmLeave(event) {
if (this.form_changed) {
const message = '¿seguro que quieres salir? Perderas la información diligenciada';
event.preventDefault();
event.returnValue = message;
return message;
}
},
getCurrentDate() {
const today = new Date();
const gmtOffSet = -5;
const localDate = new Date(today.getTime() + (gmtOffSet * 60 * 60 * 1000));
// Formatear la fecha y hora en el formato YYYY-MM-DDTHH:MM
const formattedDate = localDate.toISOString().slice(0,16);
return formattedDate;
},
onProductChange(index) {
const selectedProductId = this.purchase.saleline_set[index].product;
const selectedProduct = this.products.find(p => p.id == selectedProductId);
this.purchase.saleline_set[index].unit_price = selectedProduct.price;
this.purchase.saleline_set[index].measuring_unit = selectedProduct.measuring_unit;
},
fetchClients() {
this.api.getCustomers()
.then(data => {
this.clients = data;
})
.catch(error => {
console.error(error);
});
},
handleNewCustomer(newCustomer){
this.clients.push(newCustomer);
this.purchase.customer = newCustomer.id;
},
fetchProducts() {
this.api.getProducts()
.then(data => {
this.products = data;
})
.catch(error => {
console.error(error);
});
},
fetchPaymentMethods() {
this.api.getPaymentMethods()
.then(data => {
this.payment_methods = data;
})
.catch(error => {
console.error(error);
});
},
addLine() {
this.purchase.saleline_set.push({ product: '', unit_price: 0, quantity:0, measuring_unit: ''});
},
removeLine(index) {
if (this.purchase.saleline_set.length > 1) {
this.purchase.saleline_set.splice(index, 1);
} else {
this.show_alert_lines = true;
setTimeout(() => {
this.show_alert_lines = false;
}, 2000);
}
},
calculateSubtotal(line) {
return line.unit_price * line.quantity;
},
async submit() {
this.$refs.purchase.validate();
if (this.valid) {
this.api.createPurchase(this.purchase)
.then(data => {
console.log('Compra enviada:', data);
this.$router.push({
path: "/summary_purchase",
query : {id: parseInt(data.id)}
});
})
.catch(error => console.error('Error al enviarl la compra:', error));
} else {
this.show_alert_purchase = true;
setTimeout(() => {
this.show_alert_purchase = false;
}, 4000);
}
},
navigate(route) {
this.$router.push(route);
},
formatPrice(price) {
return new Intl.NumberFormat('es-ES', { style: 'currency', currency: 'COP' }).format(price);
},
},
mounted() {
this.fetchClients();
}
};
</script>
<style>
</style>

View File

@@ -10,7 +10,8 @@
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-btn type="submit" form="code-form">Aceptar</v-btn> <v-btn type="submit" form="code-form" color="green">Aceptar</v-btn>
<v-btn :to="{ path: '/' }" color="red">Cancelar</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>

View File

@@ -0,0 +1,39 @@
<template>
<div>
<v-btn @click="downloadCSV">Descargar CSV</v-btn>
</div>
</template>
<script>
import { inject } from 'vue';
export default {
name: 'ExportPurchasesForTryton',
data() {
return {
api: inject('api'),
};
},
methods: {
downloadCSV() {
this.api.getCSVForTryton()
.then(data => {
const blob = new Blob([data['csv']], {type: 'text/csv'});
const pattern = /[/: ]/g;
const datetime = new Date();
const date = datetime.toLocaleDateString().replace(pattern, '-');
const time = datetime.toLocaleTimeString().replace(pattern, '-');
const name = `VentasTryton_${date}_${time}.csv`;
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = name;
link.click();
URL.revokeObjectURL(link.href);
})
.catch(error => {
console.error(error);
});
},
},
};
</script>

42
src/components/Login.vue Normal file
View File

@@ -0,0 +1,42 @@
<script setup>
import { ref } from 'vue';
import AuthService from '@/services/auth';
import { inject } from 'vue';
const username = ref('');
const password = ref('');
const error = ref('');
async function login() {
try {
await AuthService.login({ username: username.value, password: password.value });
// opcional: redirigir al dashboard
} catch (e) {
error.value = e.message;
}
}
// ejemplo de llamada a clientes (requiere token)
const api = inject('api');
async function loadCustomers() {
try {
const data = await api.getCustomers();
console.log(data);
} catch (e) {
console.error(e);
}
}
</script>
<template>
<h1>Login</h1>
<v-form @submit.prevent="login">
<v-text-field v-model="username" label="Usuario" required />
<v-text-field v-model="password" label="Contraseña" type="password" required />
<v-btn type="submit">Entrar</v-btn>
<v-alert v-if="error" type="error">{{ error }}</v-alert>
</v-form>
<v-btn @click="loadCustomers">Cargar clientes</v-btn>
</template>

View File

@@ -12,25 +12,53 @@
<v-navigation-drawer v-model="drawer" <v-navigation-drawer v-model="drawer"
:location="$vuetify.display.mobile ? 'bottom' : undefined" :location="$vuetify.display.mobile ? 'bottom' : undefined"
temporary> temporary>
<v-list> <v-list
<v-list-item v-for="item in menuItems" :key="item.title" @click="navigate(item.route)"> density="compact"
<v-list-item-title>{{ item.title }}</v-list-item-title> nav
</v-list-item> >
</v-list> <v-list-item
v-for="item in menuItems"
:key="item.title"
:title="item.title"
:prepend-icon="item.icon"
@click="navigate(item.route)"
></v-list-item>
<v-list-item prepend-icon="mdi-cog" title="Administracion" @click="toggleAdminMenu()"></v-list-item>
<v-list-item>
<v-list v-if="showAdminMenu">
<v-list-item
v-for="item in menuAdminItems"
:key="item.title"
:title="item.title"
:prepend-icon="item.icon"
@click="navigateAdmin(item.route)"
></v-list-item>
</v-list>
</v-list-item>
</v-list>
</v-navigation-drawer> </v-navigation-drawer>
</template> </template>
<script> <script>
import trytonIcon from '../assets/icons/tryton-icon.svg';
export default { export default {
name: 'NavBar', name: 'NavBar',
data: () => ({ data: () => ({
drawer: false, drawer: false,
group: null, group: null,
showAdminMenu: false,
menuItems: [ menuItems: [
{ title: 'Inicio', route: '/'}, { title: 'Inicio', route: '/', icon: 'mdi-home'},
{ title: 'Comprar', route:'/comprar'}, { title: 'Comprar', route:'/comprar', icon: 'mdi-cart'},
{ title: 'Cuadrar tarro', route: '/cuadrar_tarro'}, ],
{ title: 'Cuadres de tarro', route: '/cuadres_de_tarro'}, menuAdminItems: [
{ title: 'Cuadrar tarro', route: '/cuadrar_tarro', icon: 'mdi-calculator'},
{ title: 'Cuadres de tarro', route: '/cuadres_de_tarro', icon: 'mdi-chart-bar'},
{ title: 'CSV Tryton', route: '/ventas_para_tryton', icon: 'mdi-file-table'},
{ title: 'Compra adm', route: '/compra_admin', icon: 'mdi-cart'},
{ title: 'Actualizar Productos De Tryton', route: '/sincronizar_productos_tryton', icon: 'trytonIcon'},
{ title: 'Actualizar Clientes De Tryton', route: '/sincronizar_clientes_tryton', icon: 'trytonIcon'},
{ title: 'Actualizar Ventas Tryton', route: '/sincronizar_ventas_tryton', icon: 'trytonIcon'}
], ],
}), }),
watch: { watch: {
@@ -42,6 +70,13 @@
navigate(route) { navigate(route) {
this.$router.push(route); this.$router.push(route);
}, },
navigateAdmin(route) {
this.toggleAdminMenu();
this.navigate(route);
},
toggleAdminMenu() {
this.showAdminMenu = !this.showAdminMenu;
},
} }
} }
</script> </script>

View File

@@ -16,7 +16,7 @@
required required
class="mr-4" class="mr-4"
></v-autocomplete> ></v-autocomplete>
<v-btn color="primary" @click="openModal">Agregar Cliente</v-btn> <!--<v-btn color="primary" @click="openModal">Agregar Cliente</v-btn>-->
<CreateCustomerModal ref="customerModal" @customerCreated="handleNewCustomer"/> <CreateCustomerModal ref="customerModal" @customerCreated="handleNewCustomer"/>
</v-col> </v-col>
<v-col lg="4"> <v-col lg="4">

View File

@@ -39,8 +39,26 @@
{{ currencyFormat(calculateSubtotal(item.unit_price, item.quantity)) }} {{ currencyFormat(calculateSubtotal(item.unit_price, item.quantity)) }}
</template> </template>
</v-data-table-virtual> </v-data-table-virtual>
<v-alert type="info" class="my-4">
Recuerda adicionar a la planilla física lo siguiente
<v-data-table
:headers="headersTemplate"
:items="[purchase]"
item-key="id"
hide-default-footer
>
<template v-slot:item="{ item }">
<tr>
<td>{{ item.id }}</td>
<td>{{ item.date }}</td>
<td><span v-if="item.customer">{{ item.customer.name }}</span></td>
<td><span v-if="item.lines">{{ currencyFormat(calculateTotal(item.lines)) }}</span></td>
</tr>
</template>
</v-data-table>
</v-alert>
<div class="text-center"> <div class="text-center">
<v-btn :to="{ path: 'comprar' }" color="green">Ir a Comprar</v-btn> <v-btn :to="{ path: '/' }" color="green">Ir al inicio</v-btn>
</div> </div>
</v-container> </v-container>
</v-container> </v-container>
@@ -65,6 +83,12 @@
{ title: 'Cantidad', value: 'quantity' }, { title: 'Cantidad', value: 'quantity' },
{ title: 'Subtotal', value: 'subtotal' }, { title: 'Subtotal', value: 'subtotal' },
], ],
headersTemplate: [
{title: 'Compra', value: 'id'},
{title: 'Fecha', value: 'date'},
{title: 'Nombre', value: 'customer.name'},
{title: 'Valor', value: ''},
],
}; };
}, },
created() { created() {

View File

@@ -14,7 +14,6 @@ import ApiImplementation from './services/api-implementation';
// Composables // Composables
import { createApp } from 'vue' import { createApp } from 'vue'
process.env.API_IMPLEMENTATION = 'django';
let apiImplementation = new ApiImplementation(); let apiImplementation = new ApiImplementation();
const api = apiImplementation.getApi(); const api = apiImplementation.getApi();

View File

@@ -0,0 +1,7 @@
<template>
<Login />
</template>
<script setup>
//
</script>

View File

@@ -0,0 +1,20 @@
<template>
<div>
<CodeDialog @code-verified="(verified) => showComponent = verified"/>
</div>
<AdminPurchase v-if="showComponent"/>
</template>
<script >
import CodeDialog from '../components/CodeDialog.vue'
export default {
data() {
return {
showComponent: false,
}
},
components: { CodeDialog },
methods: {},
}
</script>

7
src/pages/login.vue Normal file
View File

@@ -0,0 +1,7 @@
<template>
<Login />
</template>
<script setup>
//
</script>

View File

@@ -0,0 +1,79 @@
<template>
<div>
<CodeDialog @code-verified="(verified) => showComponent = verified"/>
</div>
<v-container class="fill-height d-flex align-center justify-center">
<v-card class="pa-6" max-width="600" elevation="4">
<v-card-title class="text-h5 font-weight-bold text-center">
🔄 Sincronización de Clientes
</v-card-title>
<v-card-text>
<p>
Esta acción sincronizará los <strong>clientes</strong> desde el sistema
<strong>Tryton</strong> hacia la plataforma.
</p>
<v-alert type="warning" dense border="start" border-color="warning">
<strong>Advertencia:</strong> Este proceso podría tardar varios minutos
y reemplazar datos existentes en la plataforma.
Asegúrese de que la información en Tryton esté actualizada antes de
continuar.
</v-alert>
<p class="mt-4">
Durante la sincronización, no se podrán modificar productos en la
plataforma para evitar conflictos.
</p>
</v-card-text>
<v-card-actions class="justify-center">
<v-btn color="primary" @click="startSync">
Iniciar Sincronización
</v-btn>
<v-btn text @click="$router.push('/')">
Cancelar
</v-btn>
</v-card-actions>
</v-card>
<v-data-table :items="checked_tryton_parties"></v-data-table>
<v-data-table :items="created_customers"></v-data-table>
<v-data-table :items="failed_parties"></v-data-table>
<v-data-table :items="untouched_customers"></v-data-table>
</v-container>
</template>
<script>
import CodeDialog from '../components/CodeDialog.vue'
import { inject } from 'vue';
export default {
name: 'CustomersFromTryton',
data() {
return {
api: inject('api'),
checked_tryton_parties: [],
created_customers: [],
failed_parties: [],
untouched_customers: [],
updated_customers: [],
}
},
methods: {
startSync() {
this.api.getCustomersFromTryton()
.then(response => {
// Manejar la respuesta exitosa
this.checked_tryton_parties = response.checked_tryton_parties.map(id => ({ id }));
this.created_customers = response.created_customers.map(id => ({ id }));
this.failed_parties = response.failed_parties.map(id => ({ id }));
this.untouched_customers = response.untouched_customers.map(id => ({ id }));
})
.catch(error => {
// Manejar el error
console.error("Error al sincronizar clientes:", error);
});
}
}
}
</script>

View File

@@ -0,0 +1,60 @@
<template>
<div>
<CodeDialog @code-verified="(verified) => showComponent = verified"/>
</div>
<v-container class="fill-height d-flex align-center justify-center">
<v-card class="pa-6" max-width="600" elevation="4">
<v-card-title class="text-h5 font-weight-bold text-center">
🔄 Sincronización de Productos
</v-card-title>
<v-card-text>
<p>
Esta acción sincronizará los <strong>productos</strong> desde el sistema
<strong>Tryton</strong> hacia la plataforma.
</p>
<v-alert type="warning" dense border="start" border-color="warning">
<strong>Advertencia:</strong> Este proceso podría tardar varios minutos
y reemplazar datos existentes en la plataforma.
Asegúrese de que la información en Tryton esté actualizada antes de
continuar.
</v-alert>
<p class="mt-4">
Durante la sincronización, no se podrán modificar productos en la
plataforma para evitar conflictos.
</p>
</v-card-text>
<v-card-actions class="justify-center">
<v-btn color="primary" @click="startSync">
Iniciar Sincronización
</v-btn>
<v-btn text @click="$router.push('/')">
Cancelar
</v-btn>
</v-card-actions>
</v-card>
<v-data-table :items="productos_tryton"></v-data-table>
</v-container>
</template>
<script>
import CodeDialog from '../components/CodeDialog.vue'
import { inject } from 'vue';
export default {
name: 'ProductsFromTryton',
data() {
return {
api: inject('api'),
productos_tryton: [{}],
showComponent: false,
}
},
methods: {
startSync() {
this.productos_tryton = this.api.getProductsFromTryton()
}
}
}
</script>

View File

@@ -0,0 +1,63 @@
<template>
<div>
<CodeDialog @code-verified="(verified) => showComponent = verified"/>
</div>
<v-container class="fill-height d-flex align-center justify-center">
<v-card class="pa-6" max-width="600" elevation="4">
<v-card-title class="text-h5 font-weight-bold text-center">
🔄 Sincronización de Ventas
</v-card-title>
<v-card-text>
<p>
Esta acción sincronizará las <strong>ventas</strong> desde el sistema
<strong>Tryton</strong> hacia la plataforma.
</p>
<v-alert type="warning" dense border="start" border-color="warning">
<strong>Advertencia:</strong> Este proceso podría tardar varios minutos
y reemplazar datos existentes en la plataforma.
Asegúrese de que la información en Tryton esté actualizada antes de
continuar.
</v-alert>
</v-card-text>
<v-card-actions class="justify-center">
<v-btn color="primary" @click="startSync">
Iniciar Sincronización
</v-btn>
<v-btn text @click="$router.push('/')">
Cancelar
</v-btn>
</v-card-actions>
</v-card>
<v-data-table :items="ventas_tryton_failed"></v-data-table>
<v-data-table :items="ventas_tryton_successful"></v-data-table>
</v-container>
</template>
<script>
import CodeDialog from '../components/CodeDialog.vue';
import { inject } from 'vue';
export default {
name: 'SalesToTryton',
data() {
return {
api: inject('api'),
ventas_tryton: [],
showComponent: false,
}
},
methods: {
startSync() {
this.api.sendSalesToTryton()
.then(response => {
this.ventas_tryton_failed = response.failed.map(id => ({ id }));
this.ventas_tryton_successful = response.successful.map(id => ({ id }));
})
.catch(error => {
console.error("Error al sincronizar las ventas", error);
});
}
}
}
</script>

View File

@@ -0,0 +1,19 @@
<template>
<div>
<CodeDialog @code-verified="(verified) => showComponent = verified"/>
</div>
<ExportPurchasesForTryton v-if="showComponent" />
</template>
<script>
import CodeDialog from '../components/CodeDialog.vue'
export default {
data() {
return {
showComponent: false,
}
},
components: { CodeDialog },
methods: {},
}
</script>

View File

@@ -3,7 +3,7 @@ import Api from './api';
class ApiImplementation { class ApiImplementation {
constructor() { constructor() {
const implementation = process.env.API_IMPLEMENTATION; const implementation = import.meta.env.VITE_API_IMPLEMENTATION;
let apiImplementation; let apiImplementation;
if (implementation === 'django') { if (implementation === 'django') {
apiImplementation = new DjangoApi(); apiImplementation = new DjangoApi();

View File

@@ -46,6 +46,22 @@ class Api {
createCustomer(customer) { createCustomer(customer) {
return this.apiImplementation.createCustomer(customer); return this.apiImplementation.createCustomer(customer);
} }
getCSVForTryton() {
return this.apiImplementation.getCSVForTryton();
}
getProductsFromTryton() {
return this.apiImplementation.getProductsFromTryton();
}
getCustomersFromTryton() {
return this.apiImplementation.getCustomersFromTryton();
}
sendSalesToTryton(){
return this.apiImplementation.sendSalesToTryton();
}
} }
export default Api; export default Api;

49
src/services/auth.js Normal file
View File

@@ -0,0 +1,49 @@
class AuthService {
static TOKEN_KEY = 'access_token';
static REFRESH_KEY = 'refresh_token';
static login(credentials) {
const url = `${import.meta.env.VITE_DJANGO_BASE_URL}/api/token/`;
return fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(credentials),
})
.then(r => r.json())
.then(data => {
localStorage.setItem(this.TOKEN_KEY, data.access);
localStorage.setItem(this.REFRESH_KEY, data.refresh);
return data;
});
}
static getAccessToken() {
return localStorage.getItem(this.TOKEN_KEY);
}
static getRefreshToken() {
return localStorage.getItem(this.REFRESH_KEY);
}
static async refresh() {
const refresh = this.getRefreshToken();
if (!refresh) throw new Error('No refresh token');
const url = `${import.meta.env.VITE_DJANGO_BASE_URL}/api/token/refresh/`;
const resp = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ refresh }),
});
const data = await resp.json();
localStorage.setItem(this.TOKEN_KEY, data.access);
return data.access;
}
static logout() {
localStorage.removeItem(this.TOKEN_KEY);
localStorage.removeItem(this.REFRESH_KEY);
}
}
export default AuthService;

View File

@@ -1,6 +1,36 @@
import AuthService from '@/services/auth';
class DjangoApi { class DjangoApi {
constructor() { constructor() {
this.base = 'http://localhost:7000'; this.base = import.meta.env.VITE_DJANGO_BASE_URL;
}
_authHeaders() {
const token = AuthService.getAccessToken();
return token ? { Authorization: `Bearer ${token}` } : {};
}
_handleResponse(response) {
if (!response.ok) {
// Si el token ha expirado (401) intentamos refrescar y re‑intentar
if (response.status === 401) {
return AuthService.refresh().then(newToken => {
// volver a ejecutar la petición original con el nuevo token
const retryHeaders = {
...response.headers,
Authorization: `Bearer ${newToken}`,
};
// aquí usamos fetch de nuevo con los mismos parámetros
// (para simplificar, delegamos a getRequest/postRequest)
// En la práctica, extrae la lógica a una función reutilizable.
throw new Error('Retry logic should be implemented here');
});
}
return response.json().then(err => {
throw new Error(`Error ${response.status}: ${err.detail || response.statusText}`);
});
}
return response.json();
} }
getCustomers() { getCustomers() {
@@ -58,43 +88,44 @@ class DjangoApi {
return this.postRequest(url, customer); return this.postRequest(url, customer);
} }
getCSVForTryton() {
const url = this.base + '/don_confiao/api/sales/for_tryton';
return this.getRequest(url);
}
getProductsFromTryton(){
const url = this.base + '/don_confiao/api/importar_productos_de_tryton';
return this.postRequest(url, {});
}
getCustomersFromTryton(){
const url = this.base + '/don_confiao/api/importar_clientes_de_tryton';
return this.postRequest(url, {});
}
sendSalesToTryton(){
const url = this.base + '/don_confiao/api/enviar_ventas_a_tryton';
return this.postRequest(url, {});
}
getRequest(url) { getRequest(url) {
return new Promise ((resolve, reject) => { return fetch(url, {
fetch(url) headers: {
.then(response => response.json()) 'Content-Type': 'application/json',
.then(data => { ...this._authHeaders(),
resolve(data); },
}) }).then(this._handleResponse);
.catch(error => {
reject(error);
});
});
} }
postRequest(url, content) { postRequest(url, content) {
return new Promise((resolve, reject) => { return fetch(url, {
fetch(url, { method: 'POST',
method: 'POST', headers: {
headers: { 'Content-Type': 'application/json',
'Content-Type': 'application/json', ...this._authHeaders(),
}, },
body: JSON.stringify(content) body: JSON.stringify(content),
}) }).then(this._handleResponse);
.then(response => {
if (!response.ok) {
reject(new Error(`Error ${response.status}: ${response.statusText}`));
} else {
response.json().then(data => {
if (!data) {
reject(new Error('La respuesta no es un JSON válido'));
} else {
resolve(data);
}
});
}
})
.catch(error => reject(error));
});
} }
} }

View File

@@ -11,6 +11,16 @@ import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
const aliasMap = {
'@': fileURLToPath(new URL('./src', import.meta.url)),
};
console.log('🔧 Alias configurado:');
console.log(aliasMap); // <-- se muestra en la terminal al iniciar Vite
console.log('Resolución real de "@":', aliasMap['@']);
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
@@ -46,10 +56,11 @@ export default defineConfig({
vueTemplate: true, vueTemplate: true,
}), }),
], ],
define: { 'process.env': {} }, define: { 'process.env': {
} },
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)) '@': fileURLToPath(new URL('./src', import.meta.url)),
}, },
extensions: [ extensions: [
'.js', '.js',