diff --git a/angular.json b/angular.json index 6cb3b53..73d4c4e 100644 --- a/angular.json +++ b/angular.json @@ -43,7 +43,11 @@ { "glob": "axios.min.js", "input": "./node_modules/axios/dist", "output": "swagger-ui" }, { "glob": "**/*", "input": "src/main/webapp/swagger-ui/", "output": "swagger-ui" } ], - "styles": ["src/main/webapp/content/scss/paper-dashboard.scss", "./node_modules/swiper/swiper-bundle.min.css"], + "styles": [ + "src/main/webapp/content/scss/paper-dashboard.scss", + "./node_modules/swiper/swiper-bundle.min.css", + "node_modules/chartist/dist/chartist.css" + ], "scripts": [ "./node_modules/jquery/dist/jquery.min.js", "src/main/webapp/content/js/jquery.bootstrap.wizard.min.js", diff --git a/package-lock.json b/package-lock.json index ca1294a..6444173 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,8 +7,10 @@ "": { "name": "data-survey", "version": "0.0.1-SNAPSHOT", + "hasInstallScript": true, "license": "MIT", "dependencies": { + "@angular/cdk": "^12.1.4", "@angular/common": "12.0.5", "@angular/compiler": "12.0.5", "@angular/core": "12.0.5", @@ -17,20 +19,26 @@ "@angular/platform-browser": "12.0.5", "@angular/platform-browser-dynamic": "12.0.5", "@angular/router": "12.0.5", - "@fortawesome/angular-fontawesome": "0.9.0", - "@fortawesome/fontawesome-svg-core": "1.2.35", - "@fortawesome/free-solid-svg-icons": "5.15.3", + "@fortawesome/angular-fontawesome": "^0.9.0", + "@fortawesome/fontawesome-svg-core": "^1.2.35", + "@fortawesome/free-brands-svg-icons": "^5.15.3", + "@fortawesome/free-solid-svg-icons": "^5.15.3", "@ng-bootstrap/ng-bootstrap": "9.1.3", "@ngx-translate/core": "13.0.0", "@ngx-translate/http-loader": "6.0.0", "@types/gapi.auth2": "0.0.54", "angularx-social-login": "^4.0.1", "bootstrap": "4.6.0", + "chartist": "^0.11.4", "dayjs": "1.10.5", "file-saver": "^2.0.5", "jquery": "^3.6.0", "jspdf": "^2.3.1", + "jw-angular-social-buttons": "^1.0.0", + "ng-chartist": "^5.0.0", "ngx-infinite-scroll": "10.0.1", + "ngx-paypal": "^8.0.0", + "ngx-sharebuttons": "^8.0.5", "ngx-webstorage": "8.0.0", "rxjs": "6.6.7", "sockjs-client": "1.5.0", @@ -50,6 +58,7 @@ "@angular/service-worker": "12.0.5", "@types/bootstrap": "^5.0.17", "@types/file-saver": "^2.0.3", + "@types/chartist": "^0.11.1", "@types/jest": "26.0.23", "@types/jquery": "^3.5.6", "@types/node": "15.12.2", @@ -506,6 +515,28 @@ "typescript": "*" } }, + "node_modules/@angular/cdk": { + "version": "12.2.1", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-12.2.1.tgz", + "integrity": "sha512-UOzuDXcfaJlBd+o7EJb6CZ3my1AmU7XHriC/hFT6bFianhVK/I/0gcOwxyMx8VAplEip8msLczX0IlZSJ1GCCg==", + "dependencies": { + "tslib": "^2.2.0" + }, + "optionalDependencies": { + "parse5": "^5.0.0" + }, + "peerDependencies": { + "@angular/common": "^12.0.0 || ^13.0.0-0", + "@angular/core": "^12.0.0 || ^13.0.0-0", + "rxjs": "^6.5.3 || ^7.0.0" + } + }, + "node_modules/@angular/cdk/node_modules/parse5": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", + "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", + "optional": true + }, "node_modules/@angular/cli": { "version": "12.0.4", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-12.0.4.tgz", @@ -2760,9 +2791,9 @@ } }, "node_modules/@fortawesome/fontawesome-common-types": { - "version": "0.2.35", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.35.tgz", - "integrity": "sha512-IHUfxSEDS9dDGqYwIW7wTN6tn/O8E0n5PcAHz9cAaBoZw6UpG20IG/YM3NNLaGPwPqgjBAFjIURzqoQs3rrtuw==", + "version": "0.2.36", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.36.tgz", + "integrity": "sha512-a/7BiSgobHAgBWeN7N0w+lAhInrGxksn13uK7231n2m8EDPE3BMCl9NZLTGrj9ZXfCmC6LM0QLqXidIizVQ6yg==", "hasInstallScript": true, "engines": { "node": ">=6" @@ -2780,6 +2811,18 @@ "node": ">=6" } }, + "node_modules/@fortawesome/free-brands-svg-icons": { + "version": "5.15.4", + "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.15.4.tgz", + "integrity": "sha512-f1witbwycL9cTENJegcmcZRYyawAFbm8+c6IirLmwbbpqz46wyjbQYLuxOc7weXFXfB7QR8/Vd2u5R3q6JYD9g==", + "hasInstallScript": true, + "dependencies": { + "@fortawesome/fontawesome-common-types": "^0.2.36" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/@fortawesome/free-solid-svg-icons": { "version": "5.15.3", "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.3.tgz", @@ -4219,6 +4262,12 @@ "@types/jquery": "*" } }, + "node_modules/@types/chartist": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@types/chartist/-/chartist-0.11.1.tgz", + "integrity": "sha512-85eNd7rF+e5sLnpprgcDdeqARgNvczEXaBfnrkw0292TBCE4KF/2HmOPA6dIblyHUWV4OZ2kuQBH2R12F+VwYg==", + "dev": true + }, "node_modules/@types/concat-stream": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz", @@ -6777,6 +6826,14 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, + "node_modules/chartist": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/chartist/-/chartist-0.11.4.tgz", + "integrity": "sha512-H4AimxaUD738/u9Mq8t27J4lh6STsLi4BQHt65nOtpLk3xyrBPaLiLMrHw7/WV9CmsjGA02WihjuL5qpSagLYw==", + "engines": { + "node": ">=4.6.0" + } + }, "node_modules/chevrotain": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-9.0.2.tgz", @@ -15975,6 +16032,11 @@ "integrity": "sha512-K2MLc+ZC2DVxX4V61bIKPeMUUfj1YYZ3h0myhchDXOW1cKoPZMnjIoNCqv9bF2n5Oob1PFxuR2gVJxkxz4e58w==", "dev": true }, + "node_modules/jw-angular-social-buttons": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jw-angular-social-buttons/-/jw-angular-social-buttons-1.0.0.tgz", + "integrity": "sha512-E1xxsZBj0+DzJC7iPrwqq08UnfMbYuUHibMt5ijSqrR2LyBKmrZIlRM+8I+4e3m0bNNt1nwBbXcKlY6DsvOCOQ==" + }, "node_modules/karma-source-map-support": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz", @@ -17392,6 +17454,20 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "node_modules/ng-chartist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ng-chartist/-/ng-chartist-5.0.0.tgz", + "integrity": "sha512-lTHuND77RuYNxpt0qPlGW5LuohCMUTX0LCMYEhTqCPstBImPP+ZHM7+Dnpzx8FpNstBPandzvlEWVbKPMfn2FA==", + "dependencies": { + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@angular/common": ">=12.0.2", + "@angular/core": ">=12.0.2", + "@types/chartist": "^0.11.0", + "chartist": ">=0.11.4" + } + }, "node_modules/ngx-infinite-scroll": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/ngx-infinite-scroll/-/ngx-infinite-scroll-10.0.1.tgz", @@ -17402,6 +17478,32 @@ "opencollective-postinstall": "^2.0.2" } }, + "node_modules/ngx-paypal": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ngx-paypal/-/ngx-paypal-8.0.0.tgz", + "integrity": "sha512-cmXpEb8Gfwwk/Yn43w0OsURpRXiXghgZ5MbVKBYsPdkAqVacoQtYiWLcNmmU/DYGoPN5lRVqZb+Svg6qbbOvTw==", + "dependencies": { + "tslib": "^2.2.0" + }, + "peerDependencies": { + "@angular/common": "^12.0.0", + "@angular/core": "^12.0.0" + } + }, + "node_modules/ngx-sharebuttons": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/ngx-sharebuttons/-/ngx-sharebuttons-8.0.5.tgz", + "integrity": "sha512-LAaZQk1i/yuYkX+SK72OkJBMNmGJ7SS/yoGEIyuUd7r9F9SwLpWfUAjccmtuM0qDzd48h+1CCnPGIB6WYlKY4g==", + "dependencies": { + "tslib": "^2.0.0" + }, + "peerDependencies": { + "@angular/cdk": ">=8.0.0", + "@angular/common": ">=8.0.0", + "@angular/core": ">=8.0.0", + "rxjs": ">=6.0.0" + } + }, "node_modules/ngx-webstorage": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/ngx-webstorage/-/ngx-webstorage-8.0.0.tgz", @@ -27951,6 +28053,23 @@ "@typescript-eslint/experimental-utils": "4.23.0" } }, + "@angular/cdk": { + "version": "12.2.1", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-12.2.1.tgz", + "integrity": "sha512-UOzuDXcfaJlBd+o7EJb6CZ3my1AmU7XHriC/hFT6bFianhVK/I/0gcOwxyMx8VAplEip8msLczX0IlZSJ1GCCg==", + "requires": { + "parse5": "^5.0.0", + "tslib": "^2.2.0" + }, + "dependencies": { + "parse5": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", + "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", + "optional": true + } + } + }, "@angular/cli": { "version": "12.0.4", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-12.0.4.tgz", @@ -29513,9 +29632,9 @@ } }, "@fortawesome/fontawesome-common-types": { - "version": "0.2.35", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.35.tgz", - "integrity": "sha512-IHUfxSEDS9dDGqYwIW7wTN6tn/O8E0n5PcAHz9cAaBoZw6UpG20IG/YM3NNLaGPwPqgjBAFjIURzqoQs3rrtuw==" + "version": "0.2.36", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.36.tgz", + "integrity": "sha512-a/7BiSgobHAgBWeN7N0w+lAhInrGxksn13uK7231n2m8EDPE3BMCl9NZLTGrj9ZXfCmC6LM0QLqXidIizVQ6yg==" }, "@fortawesome/fontawesome-svg-core": { "version": "1.2.35", @@ -29525,6 +29644,14 @@ "@fortawesome/fontawesome-common-types": "^0.2.35" } }, + "@fortawesome/free-brands-svg-icons": { + "version": "5.15.4", + "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.15.4.tgz", + "integrity": "sha512-f1witbwycL9cTENJegcmcZRYyawAFbm8+c6IirLmwbbpqz46wyjbQYLuxOc7weXFXfB7QR8/Vd2u5R3q6JYD9g==", + "requires": { + "@fortawesome/fontawesome-common-types": "^0.2.36" + } + }, "@fortawesome/free-solid-svg-icons": { "version": "5.15.3", "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.3.tgz", @@ -30681,6 +30808,12 @@ "@types/jquery": "*" } }, + "@types/chartist": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@types/chartist/-/chartist-0.11.1.tgz", + "integrity": "sha512-85eNd7rF+e5sLnpprgcDdeqARgNvczEXaBfnrkw0292TBCE4KF/2HmOPA6dIblyHUWV4OZ2kuQBH2R12F+VwYg==", + "dev": true + }, "@types/concat-stream": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz", @@ -32695,6 +32828,11 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, + "chartist": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/chartist/-/chartist-0.11.4.tgz", + "integrity": "sha512-H4AimxaUD738/u9Mq8t27J4lh6STsLi4BQHt65nOtpLk3xyrBPaLiLMrHw7/WV9CmsjGA02WihjuL5qpSagLYw==" + }, "chevrotain": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-9.0.2.tgz", @@ -39797,6 +39935,11 @@ "integrity": "sha512-K2MLc+ZC2DVxX4V61bIKPeMUUfj1YYZ3h0myhchDXOW1cKoPZMnjIoNCqv9bF2n5Oob1PFxuR2gVJxkxz4e58w==", "dev": true }, + "jw-angular-social-buttons": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jw-angular-social-buttons/-/jw-angular-social-buttons-1.0.0.tgz", + "integrity": "sha512-E1xxsZBj0+DzJC7iPrwqq08UnfMbYuUHibMt5ijSqrR2LyBKmrZIlRM+8I+4e3m0bNNt1nwBbXcKlY6DsvOCOQ==" + }, "karma-source-map-support": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz", @@ -40894,6 +41037,14 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "ng-chartist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ng-chartist/-/ng-chartist-5.0.0.tgz", + "integrity": "sha512-lTHuND77RuYNxpt0qPlGW5LuohCMUTX0LCMYEhTqCPstBImPP+ZHM7+Dnpzx8FpNstBPandzvlEWVbKPMfn2FA==", + "requires": { + "tslib": "^2.1.0" + } + }, "ngx-infinite-scroll": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/ngx-infinite-scroll/-/ngx-infinite-scroll-10.0.1.tgz", @@ -40903,6 +41054,22 @@ "opencollective-postinstall": "^2.0.2" } }, + "ngx-paypal": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ngx-paypal/-/ngx-paypal-8.0.0.tgz", + "integrity": "sha512-cmXpEb8Gfwwk/Yn43w0OsURpRXiXghgZ5MbVKBYsPdkAqVacoQtYiWLcNmmU/DYGoPN5lRVqZb+Svg6qbbOvTw==", + "requires": { + "tslib": "^2.2.0" + } + }, + "ngx-sharebuttons": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/ngx-sharebuttons/-/ngx-sharebuttons-8.0.5.tgz", + "integrity": "sha512-LAaZQk1i/yuYkX+SK72OkJBMNmGJ7SS/yoGEIyuUd7r9F9SwLpWfUAjccmtuM0qDzd48h+1CCnPGIB6WYlKY4g==", + "requires": { + "tslib": "^2.0.0" + } + }, "ngx-webstorage": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/ngx-webstorage/-/ngx-webstorage-8.0.0.tgz", diff --git a/package.json b/package.json index d25a4a9..4de4c2c 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,8 @@ "preci:e2e:server:start": "npm run docker:db:await --if-present && npm run docker:others:await --if-present", "ci:e2e:server:start": "java -jar target/e2e.$npm_package_config_packaging --spring.profiles.active=$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.org.datasurvey=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR", "ci:frontend:build": "npm run webapp:build:$npm_package_config_default_environment", - "ci:frontend:test": "npm run ci:frontend:build && npm test" + "ci:frontend:test": "npm run ci:frontend:build && npm test", + "postinstall": "ngcc" }, "config": { "backend_port": 8080, @@ -66,6 +67,7 @@ "packaging": "jar" }, "dependencies": { + "@angular/cdk": "^12.1.4", "@angular/common": "12.0.5", "@angular/compiler": "12.0.5", "@angular/core": "12.0.5", @@ -74,20 +76,26 @@ "@angular/platform-browser": "12.0.5", "@angular/platform-browser-dynamic": "12.0.5", "@angular/router": "12.0.5", - "@fortawesome/angular-fontawesome": "0.9.0", - "@fortawesome/fontawesome-svg-core": "1.2.35", - "@fortawesome/free-solid-svg-icons": "5.15.3", + "@fortawesome/angular-fontawesome": "^0.9.0", + "@fortawesome/fontawesome-svg-core": "^1.2.35", + "@fortawesome/free-brands-svg-icons": "^5.15.3", + "@fortawesome/free-solid-svg-icons": "^5.15.3", "@ng-bootstrap/ng-bootstrap": "9.1.3", "@ngx-translate/core": "13.0.0", "@ngx-translate/http-loader": "6.0.0", "@types/gapi.auth2": "0.0.54", "angularx-social-login": "^4.0.1", "bootstrap": "4.6.0", + "chartist": "^0.11.4", "dayjs": "1.10.5", "file-saver": "^2.0.5", "jquery": "^3.6.0", "jspdf": "^2.3.1", + "jw-angular-social-buttons": "^1.0.0", + "ng-chartist": "^5.0.0", "ngx-infinite-scroll": "10.0.1", + "ngx-paypal": "^8.0.0", + "ngx-sharebuttons": "^8.0.5", "ngx-webstorage": "8.0.0", "rxjs": "6.6.7", "sockjs-client": "1.5.0", @@ -106,6 +114,7 @@ "@angular/compiler-cli": "12.0.5", "@angular/service-worker": "12.0.5", "@types/bootstrap": "^5.0.17", + "@types/chartist": "^0.11.1", "@types/file-saver": "^2.0.3", "@types/jest": "26.0.23", "@types/jquery": "^3.5.6", diff --git a/pom.xml b/pom.xml index 7595ca8..72bad53 100644 --- a/pom.xml +++ b/pom.xml @@ -318,6 +318,12 @@ org.springframework.security spring-security-messaging + + + org.webjars + bootstrap + 4.0.0-2 + diff --git a/src/main/java/org/datasurvey/service/MailService.java b/src/main/java/org/datasurvey/service/MailService.java index 13b50b3..525e75d 100644 --- a/src/main/java/org/datasurvey/service/MailService.java +++ b/src/main/java/org/datasurvey/service/MailService.java @@ -4,6 +4,7 @@ import java.nio.charset.StandardCharsets; import java.util.Locale; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; +import org.datasurvey.domain.Factura; import org.datasurvey.domain.User; import org.datasurvey.domain.UsuarioEncuesta; import org.datasurvey.domain.UsuarioExtra; @@ -33,6 +34,8 @@ public class MailService { private static final String CONTRASENNA = "contrasenna"; + private static final String FACTURA = "factura"; + private static final String BASE_URL = "baseUrl"; private final JHipsterProperties jHipsterProperties; @@ -128,6 +131,22 @@ public class MailService { sendEmail(user.getEmail(), subject, content, false, true); } + @Async + public void sendEmailFromTemplateFactura(User user, Factura factura, String templateName, String titleKey) { + if (user.getEmail() == null) { + log.debug("Email doesn't exist for user '{}'", user.getLogin()); + return; + } + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable(USER, user); + context.setVariable(FACTURA, factura); + context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl()); + String content = templateEngine.process(templateName, context); + String subject = messageSource.getMessage(titleKey, null, locale); + sendEmail(user.getEmail(), subject, content, false, true); + } + @Async public void sendActivationEmail(User user) { log.debug("Sending activation email to '{}'", user.getEmail()); @@ -203,4 +222,10 @@ public class MailService { "email.deleteColaborator.title" ); } + + @Async + public void sendReceiptUser(UsuarioExtra user, Factura factura) { + log.debug("Sending paypal receipt mail to '{}'", user.getUser().getEmail()); + sendEmailFromTemplateFactura(user.getUser(), factura, "mail/facturaPayPalEmail", "email.receipt.title"); + } } diff --git a/src/main/java/org/datasurvey/web/rest/FacturaResource.java b/src/main/java/org/datasurvey/web/rest/FacturaResource.java index 4a407dc..419318c 100644 --- a/src/main/java/org/datasurvey/web/rest/FacturaResource.java +++ b/src/main/java/org/datasurvey/web/rest/FacturaResource.java @@ -8,9 +8,12 @@ import java.util.Optional; import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.datasurvey.domain.Factura; +import org.datasurvey.domain.UsuarioExtra; import org.datasurvey.repository.FacturaRepository; import org.datasurvey.service.FacturaQueryService; import org.datasurvey.service.FacturaService; +import org.datasurvey.service.MailService; +import org.datasurvey.service.UsuarioExtraService; import org.datasurvey.service.criteria.FacturaCriteria; import org.datasurvey.web.rest.errors.BadRequestAlertException; import org.slf4j.Logger; @@ -41,10 +44,22 @@ public class FacturaResource { private final FacturaQueryService facturaQueryService; - public FacturaResource(FacturaService facturaService, FacturaRepository facturaRepository, FacturaQueryService facturaQueryService) { + private final UsuarioExtraService userExtraService; + + private final MailService mailService; + + public FacturaResource( + FacturaService facturaService, + FacturaRepository facturaRepository, + FacturaQueryService facturaQueryService, + UsuarioExtraService userExtraService, + MailService mailService + ) { this.facturaService = facturaService; this.facturaRepository = facturaRepository; this.facturaQueryService = facturaQueryService; + this.userExtraService = userExtraService; + this.mailService = mailService; } /** @@ -60,11 +75,22 @@ public class FacturaResource { if (factura.getId() != null) { throw new BadRequestAlertException("A new factura cannot already have an ID", ENTITY_NAME, "idexists"); } + + Optional usuarioExtra = userExtraService.findOne(Long.parseLong(factura.getNombreUsuario())); + + factura.setNombreUsuario(usuarioExtra.get().getNombre()); + Factura result = facturaService.save(factura); + + mailService.sendReceiptUser(usuarioExtra.get(), factura); + return ResponseEntity .created(new URI("/api/facturas/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) .body(result); + //retrieve yser + + //Enviar el correo } /** diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties index 9e05ac2..0d59fa4 100644 --- a/src/main/resources/i18n/messages.properties +++ b/src/main/resources/i18n/messages.properties @@ -64,3 +64,11 @@ email.deleteColaborator.title=Se le ha expulsado de una encuesta como colaborado email.deleteColaborator.greeting=¡Se le ha expulsado, {0}! email.deleteColaborator.text1=Fue expulsado de la encuesta {0}(#{1})" email.deleteColaborator.text2=Saludos, + + +email.receipt.title=Comprobante de pago +email.receipt.user={0} +email.receipt.fecha={0} +email.receipt.plantilla={0} +email.receipt.precio=${0} + diff --git a/src/main/resources/templates/mail/facturaPayPalEmail.html b/src/main/resources/templates/mail/facturaPayPalEmail.html new file mode 100644 index 0000000..2764744 --- /dev/null +++ b/src/main/resources/templates/mail/facturaPayPalEmail.html @@ -0,0 +1,262 @@ + + + + + + + + + + + JHipster activation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Usuario: + + + + + + + + + + + Fecha: + + + + + + + + + Plantilla + Cantidad + Precio + + + + + + 1 + + + + + + + + + Monto total + + + + + + + + + + + + + + + + + + + + + + + + Acerca de + DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted + + + + + + + + + Información de contacto + + datasurveyapp@gmail.com + + + + + + + + + + + + + DataSurvey.org + + + + + + + + + + + + + diff --git a/src/main/webapp/app/account/register/register.component.spec.ts b/src/main/webapp/app/account/register/register.component.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/account/register/register.component.spec.ts rename to src/main/webapp/app/account/register/register.component.tmpSpec.ts diff --git a/src/main/webapp/app/account/register/register.component.ts b/src/main/webapp/app/account/register/register.component.ts index a1727ff..1d14fa4 100644 --- a/src/main/webapp/app/account/register/register.component.ts +++ b/src/main/webapp/app/account/register/register.component.ts @@ -91,7 +91,7 @@ export class RegisterComponent implements AfterViewInit { login, email, password, - langKey: this.translateService.currentLang, + langKey: this.translateService.currentLang!, name, firstName, profileIcon: this.profileIcon, diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts index 7c6db5a..0495c9c 100644 --- a/src/main/webapp/app/app.module.ts +++ b/src/main/webapp/app/app.module.ts @@ -33,6 +33,12 @@ import { PageRibbonComponent } from './layouts/profiles/page-ribbon.component'; import { ErrorComponent } from './layouts/error/error.component'; import { SidebarComponent } from './layouts/sidebar/sidebar.component'; import { PaginaPrincipalComponent } from './pagina-principal/pagina-principal.component'; +import { ChartistModule } from 'ng-chartist'; +import { ListarPlantillaTiendaModule } from './entities/tienda/listar-tienda-plantilla/listar-plantilla-tienda.module'; +import { PaypalDialogComponent } from './entities/tienda/paypal-dialog/paypal-dialog.component'; +import { NgxPayPalModule } from 'ngx-paypal'; +import { ShareButtonsModule } from 'ngx-sharebuttons/buttons'; +import { ShareIconsModule } from 'ngx-sharebuttons/icons'; @NgModule({ imports: [ @@ -41,6 +47,7 @@ import { PaginaPrincipalComponent } from './pagina-principal/pagina-principal.co SharedModule, HomeModule, PaginaPrincipalModule, + ListarPlantillaTiendaModule, // jhipster-needle-angular-add-module JHipster will add new module here EntityRoutingModule, AppRoutingModule, @@ -60,6 +67,10 @@ import { PaginaPrincipalComponent } from './pagina-principal/pagina-principal.co useFactory: missingTranslationHandler, }, }), + ChartistModule, // add ChartistModule to your imports + ShareButtonsModule, + ShareIconsModule, + NgxPayPalModule, ], providers: [ Title, @@ -79,7 +90,15 @@ import { PaginaPrincipalComponent } from './pagina-principal/pagina-principal.co } as SocialAuthServiceConfig, }, ], - declarations: [MainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, FooterComponent, SidebarComponent], + declarations: [ + MainComponent, + NavbarComponent, + ErrorComponent, + PageRibbonComponent, + FooterComponent, + SidebarComponent, + PaypalDialogComponent, + ], bootstrap: [MainComponent], }) export class AppModule { diff --git a/src/main/webapp/app/core/auth/account.service.spec.ts b/src/main/webapp/app/core/auth/account.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/core/auth/account.service.spec.ts rename to src/main/webapp/app/core/auth/account.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html index d1ad4e4..a603aea 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html @@ -19,7 +19,7 @@ Cancel - + Toggle Status diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index 7f97ca1..f231513 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -42,7 +42,7 @@ export class CategoriaDeleteDialogComponent { this.encuestas!.forEach(encuesta => { if (encuesta.categoria != null && encuesta.categoria!.id === categoria.id) { encuesta.categoria = categoriaNula; - this.subscribeToSaveResponse(this.encuestaService.update(encuesta)); + this.subscribeToSaveResponse(this.encuestaService.updateSurvey(encuesta)); } }); categoria.estado = EstadoCategoria.INACTIVE; diff --git a/src/main/webapp/app/entities/categoria/list/categoria.component.html b/src/main/webapp/app/entities/categoria/list/categoria.component.html index b486a5d..780d299 100644 --- a/src/main/webapp/app/entities/categoria/list/categoria.component.html +++ b/src/main/webapp/app/entities/categoria/list/categoria.component.html @@ -44,7 +44,7 @@ - + Nombre @@ -67,7 +67,7 @@ Edit - + Toggle Status diff --git a/src/main/webapp/app/entities/categoria/route/categoria-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/categoria/route/categoria-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/categoria/route/categoria-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/categoria/route/categoria-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.html b/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.html index ae29458..06056dd 100644 --- a/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.html +++ b/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.html @@ -1,3 +1,141 @@ -dashboard-admin works! -Export as Excel + + + + + + + + + + + + + + + Ganancias por plantillas + {{ gananciasTotales | currency: 'CR' }} + + + + + + + + + + + + + + + + + + + Cantidad usuarios activos + {{ cantUsuarioActivos }} + + + + + + + + + + + + + + + + + + + + Cantidad usuarios bloqueados + {{ cantUsuarioBloqueados }} + + + + + + + + + + + + + Cantidad de encuestas publicadas por mes + + + + + + + + + Cantidad de Encuestas Publicadas por Categoria + + + + + + + + + {{ categoria.nombre }} + + + {{ encuestasPublicadasCategoria[i] }} + + + + + + + + + + + + + + Cantidad de Encuestas Finalizadas por Categoria + + + + + + + + + {{ categoria.nombre }} + + + {{ encuestasFinalzadasCategoria[i] }} + + + + + + + + + + + + + Export as PDF +Export as Excel diff --git a/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.scss b/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.scss index e69de29..653e090 100644 --- a/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.scss +++ b/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.scss @@ -0,0 +1,34 @@ +.ct-chart { + width: 600px; + height: 400px; + overflow-x: scroll; +} +.grafico-encuestas-fecha .card { + width: 600px; +} + +.card .icon-big { + font-size: 3em; +} + +.icon-success { + color: #00b88d; +} + +.icon-users-active { + color: #018adf; +} + +.icon-users-block { + color: #da1b2b; +} + +.encuestas-por-categoria .table-responsive { + height: 300px; + max-height: 300px; + overflow-x: none; +} + +.por-categoria { + padding: 5% 0; +} diff --git a/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.spec.ts b/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.tempSpec.ts similarity index 100% rename from src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.spec.ts rename to src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.tempSpec.ts diff --git a/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.ts b/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.ts index 0cce762..ac14613 100644 --- a/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.ts +++ b/src/main/webapp/app/entities/dashboard/dashboard-admin/dashboard-admin.component.ts @@ -5,15 +5,191 @@ import { jsPDF } from 'jspdf'; import { exportAsExcelFile } from '../export/export_excel'; import { generatePDFTableData, createPDFTableHeaders, generatePDFTable } from '../export/export_pdf'; +import { FacturaService } from '../../factura/service/factura.service'; +import { UsuarioExtraService } from '../../usuario-extra/service/usuario-extra.service'; +import { CategoriaService } from '../../categoria/service/categoria.service'; +import { EncuestaService } from '../../encuesta/service/encuesta.service'; + +import { ICategoria } from '../../categoria/categoria.model'; +import { IEncuesta } from '../../encuesta/encuesta.model'; +import { finalize } from 'rxjs/operators'; + +import * as Chartist from 'chartist'; + +import { faWallet, faUsers, faUsersSlash } from '@fortawesome/free-solid-svg-icons'; + @Component({ selector: 'jhi-dashboard-admin', templateUrl: './dashboard-admin.component.html', styleUrls: ['./dashboard-admin.component.scss'], }) export class DashboardAdminComponent implements OnInit { - constructor() {} + cantUsuarioActivos: number | undefined = 0; + cantUsuarioBloqueados: number | undefined = 0; + encuestasPublicadasCategoria: number[] = []; + encuestasFinalzadasCategoria: number[] = []; + encuestasPublicadasMesAnno: number[] = []; + listaMesesAnnos: string[] = []; + gananciasTotales: number = 0; + categorias: ICategoria[] | undefined = []; + encuestas: IEncuesta[] | undefined = []; + faWallet = faWallet; + faUsers = faUsers; + faUsersSlash = faUsersSlash; - ngOnInit(): void {} + chartFechas = []; + + constructor( + protected facturaService: FacturaService, + protected usuarioExtraService: UsuarioExtraService, + protected encuestaService: EncuestaService, + protected categoriaService: CategoriaService + ) {} + + ngOnInit(): void { + this.loadAll(); + } + + trackId(_index: number, item: ICategoria): number { + return item.id!; + } + + loadAll() { + this.cargarGananciasTotales(); + this.cargarCantidadUsuarios(); + this.cargarEncuestas(); + } + + cargarGananciasTotales() { + this.facturaService.query().subscribe( + res => { + const tempFacturas = res.body; + tempFacturas?.forEach(f => { + if (f.costo != undefined) { + this.gananciasTotales += f.costo; + } + }); + }, + () => {} + ); + } + + cargarCantidadUsuarios() { + this.usuarioExtraService.query().subscribe(res => { + const tmpUsuarios = res.body; + this.cantUsuarioActivos = tmpUsuarios?.filter(u => u.estado === 'ACTIVE').length; + this.cantUsuarioBloqueados = tmpUsuarios?.filter(u => u.estado === 'SUSPENDED').length; + }); + } + + cargarEncuestas() { + this.encuestaService + .query() + .pipe(finalize(() => this.cargarCategorias())) + .subscribe(res => { + const tmpEncuestas = res.body; + this.encuestas = tmpEncuestas?.filter(e => e.estado === 'ACTIVE' || e.estado === 'FINISHED'); + }); + } + + cargarCategorias() { + this.categoriaService + .query() + .pipe(finalize(() => this.acomodarMesesYAnnos())) + .subscribe(res => { + const tmpCategorias = res.body; + this.categorias = tmpCategorias?.filter(c => c.estado === 'ACTIVE'); + let cantPublicadas = 0; + let cantFinalizadas = 0; + const publicadas: number[] | null = []; + const finalizadas: number[] | null = []; + this.categorias?.forEach(c => { + this.encuestas?.forEach(e => { + if (e.categoria?.id === c.id && e.estado === 'ACTIVE') { + cantPublicadas = cantPublicadas + 1; + } + if (e.categoria?.id === c.id && e.estado === 'FINISHED') { + cantFinalizadas = cantFinalizadas + 1; + } + }); + publicadas.push(cantPublicadas); + finalizadas.push(cantFinalizadas); + }); + this.encuestasPublicadasCategoria = publicadas; + this.encuestasFinalzadasCategoria = finalizadas; + }); + } + + acomodarMesesYAnnos() { + const fechas: string[] | null = []; + const cantEncuestasFechas: number[] | null = []; + var encuestasPublicadas = this.encuestas?.filter(e => e.estado === 'ACTIVE'); + if (encuestasPublicadas) { + encuestasPublicadas = this.ordenarFechas(encuestasPublicadas); + encuestasPublicadas.forEach(e => { + if (e.fechaPublicacion) { + let fecha = this.formatoFecha(e.fechaPublicacion); + if (!fechas.includes(fecha)) { + fechas.push(fecha); + } + } + }); + this.listaMesesAnnos = fechas; + + this.listaMesesAnnos.forEach(f => { + let contEncuestaDeFecha = 0; + if (encuestasPublicadas) { + encuestasPublicadas.forEach(e => { + if (e.fechaPublicacion) { + let fecha = this.formatoFecha(e.fechaPublicacion); + if (f === fecha) { + contEncuestaDeFecha++; + } + } + }); + } + cantEncuestasFechas.push(contEncuestaDeFecha); + }); + this.encuestasPublicadasMesAnno = cantEncuestasFechas; + } + this.llenarGraficoEncuestasXFechas(); + } + + llenarGraficoEncuestasXFechas() { + if (this.listaMesesAnnos && this.encuestasPublicadasMesAnno) { + var data = { + // A labels array that can contain any sort of values + labels: this.listaMesesAnnos, + // Our series array that contains series objects or in this case series data arrays + series: [this.encuestasPublicadasMesAnno], + }; + var options = { + low: 0, + showArea: true, + showLabel: true, + axisY: { + onlyInteger: true, + }, + }; + new Chartist.Line('.ct-chart', data, options); + } + } + + formatoFecha(fecha: any): string { + return fecha.month() + 1 + '/' + fecha.year(); + } + + ordenarFechas(encuestasPublicadas: IEncuesta[]): IEncuesta[] { + if (encuestasPublicadas) { + encuestasPublicadas.sort((e1, e2) => { + if (e1.fechaPublicacion && e2.fechaPublicacion) { + return e1.fechaPublicacion < e2.fechaPublicacion ? -1 : e1.fechaPublicacion > e2.fechaPublicacion ? 1 : 0; + } + return 0; + }); + } + return encuestasPublicadas; + } exportReportesGeneralesAdministradorExcel(): void { /* diff --git a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.spec.ts b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.tempSpec.ts similarity index 100% rename from src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.spec.ts rename to src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.tempSpec.ts diff --git a/src/main/webapp/app/entities/e-pregunta-abierta-respuesta/route/e-pregunta-abierta-respuesta-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/e-pregunta-abierta-respuesta/route/e-pregunta-abierta-respuesta-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/e-pregunta-abierta-respuesta/route/e-pregunta-abierta-respuesta-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/e-pregunta-abierta-respuesta/route/e-pregunta-abierta-respuesta-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/e-pregunta-abierta/route/e-pregunta-abierta-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/e-pregunta-abierta/route/e-pregunta-abierta-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/e-pregunta-abierta/route/e-pregunta-abierta-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/e-pregunta-abierta/route/e-pregunta-abierta-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/e-pregunta-cerrada-opcion/route/e-pregunta-cerrada-opcion-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/e-pregunta-cerrada-opcion/route/e-pregunta-cerrada-opcion-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/e-pregunta-cerrada-opcion/route/e-pregunta-cerrada-opcion-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/e-pregunta-cerrada-opcion/route/e-pregunta-cerrada-opcion-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/e-pregunta-cerrada/route/e-pregunta-cerrada-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/e-pregunta-cerrada/route/e-pregunta-cerrada-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/e-pregunta-cerrada/route/e-pregunta-cerrada-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/e-pregunta-cerrada/route/e-pregunta-cerrada-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/encuesta/complete/complete.component.html b/src/main/webapp/app/entities/encuesta/complete/complete.component.html index 057f800..3b5bfed 100644 --- a/src/main/webapp/app/entities/encuesta/complete/complete.component.html +++ b/src/main/webapp/app/entities/encuesta/complete/complete.component.html @@ -83,7 +83,7 @@ - Terminar + Finalizar encuesta-compartir-dialog works! + + + Compartir encuesta + + + + Puede copiar el enlace o compartirlo en redes sociales + + + + + + + + + + diff --git a/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.scss b/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.scss index e69de29..a6675a7 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.scss +++ b/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.scss @@ -0,0 +1,7 @@ +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500&display=swap'); + +@import '~ngx-sharebuttons/themes/default/default-theme'; + +.compartir { + width: 100% !important; +} diff --git a/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.spec.ts b/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.spec.ts deleted file mode 100644 index 7dd0e6b..0000000 --- a/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { EncuestaCompartirDialogComponent } from './encuesta-compartir-dialog.component'; - -describe('EncuestaCompartirDialogComponent', () => { - let component: EncuestaCompartirDialogComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [EncuestaCompartirDialogComponent], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(EncuestaCompartirDialogComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.ts b/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.ts index bc1ad54..d69762c 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.ts +++ b/src/main/webapp/app/entities/encuesta/encuesta-compartir-dialog/encuesta-compartir-dialog.component.ts @@ -1,4 +1,6 @@ import { Component, OnInit } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { IEncuesta } from '../encuesta.model'; @Component({ selector: 'jhi-encuesta-compartir-dialog', @@ -6,7 +8,21 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./encuesta-compartir-dialog.component.scss'], }) export class EncuestaCompartirDialogComponent implements OnInit { - constructor() {} + encuesta?: IEncuesta; + baseURL: string = ''; + imagen: string = ''; + mensaje: string = 'Encuesta en DatasSurvey'; + name = 'ngx sharebuttons'; - ngOnInit(): void {} + constructor(protected activeModal: NgbActiveModal) {} + + ngOnInit(): void { + this.baseURL = location.origin + '/' + this.encuesta?.id + '/complete'; + } + + compartir(): void {} + + cancel(): void { + this.activeModal.dismiss(); + } } diff --git a/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.html b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.html index 0baeb1f..f01705e 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.html +++ b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.html @@ -1,6 +1,6 @@ - + Publique su encuesta @@ -48,13 +48,7 @@ Cancel - + Delete diff --git a/src/main/webapp/app/entities/encuesta/encuesta.module.ts b/src/main/webapp/app/entities/encuesta/encuesta.module.ts index 94ed589..d06bc12 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta.module.ts +++ b/src/main/webapp/app/entities/encuesta/encuesta.module.ts @@ -10,13 +10,14 @@ import { EncuestaPublishDialogComponent } from './encuesta-publish-dialog/encues import { EncuestaDeleteQuestionDialogComponent } from './encuesta-delete-question-dialog/encuesta-delete-question-dialog.component'; import { EncuestaDeleteOptionDialogComponent } from './encuesta-delete-option-dialog/encuesta-delete-option-dialog.component'; import { EncuestaCompartirDialogComponent } from './encuesta-compartir-dialog/encuesta-compartir-dialog.component'; +import { ShareButtonsModule } from 'ngx-sharebuttons/buttons'; import { EncuestaCompleteComponent } from './complete/complete.component'; import { EncuestaPasswordDialogComponent } from './encuesta-password-dialog/encuesta-password-dialog.component'; import { EncuestaFinalizarDialogComponent } from './encuesta-finalizar-dialog/encuesta-finalizar-dialog.component'; import { EncuestaDeleteColaboratorDialogComponent } from './encuesta-delete-colaborator-dialog/encuesta-delete-colaborator-dialog.component'; @NgModule({ - imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule], + imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule, ShareButtonsModule], declarations: [ EncuestaComponent, EncuestaDetailComponent, diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html index 02652ea..4c1d9c9 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html @@ -120,9 +120,11 @@ Publicar - + + + Compartir + + @@ -175,9 +177,11 @@ style="animation-delay: 3s" > - - - + @@ -213,7 +217,7 @@ 0"> - + Nombre diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts b/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts index f22fa92..6761b1a 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts @@ -41,6 +41,7 @@ import { } from '@fortawesome/free-solid-svg-icons'; import * as $ from 'jquery'; +import { EncuestaCompartirDialogComponent } from '../encuesta-compartir-dialog/encuesta-compartir-dialog.component'; @Component({ selector: 'jhi-encuesta', @@ -491,12 +492,18 @@ export class EncuestaComponent implements OnInit, AfterViewInit { document.getElementById('contextmenu-edit')!.style.display = 'block'; document.getElementById('contextmenu-publish')!.style.display = 'block'; document.getElementById('contextmenu-duplicate')!.style.display = 'block'; + document.getElementById('contextmenu-share')!.style.display = 'none'; } else { document.getElementById('contextmenu-edit')!.style.display = 'none'; document.getElementById('contextmenu-publish')!.style.display = 'none'; document.getElementById('contextmenu-duplicate')!.style.display = 'none'; + document.getElementById('contextmenu-share')!.style.display = 'block'; } - // document.getElementById('contextmenu-share')!.style.display = 'block'; + + if (this.selectedSurvey!.estado === 'FINISHED') { + document.getElementById('contextmenu-share')!.style.display = 'none'; + } + document.getElementById('contextmenu-create--separator')!.style.display = 'none'; } @@ -548,4 +555,16 @@ export class EncuestaComponent implements OnInit, AfterViewInit { categoria: this.selectedSurvey!.categoria, }); } + + compartir(): void { + const modalRef = this.modalService.open(EncuestaCompartirDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.encuesta = this.selectedSurvey; + // unsubscribe not needed because closed completes on modal close + modalRef.closed.subscribe(reason => { + if (reason === 'published') { + this.successPublished = true; + this.loadAll(); + } + }); + } } diff --git a/src/main/webapp/app/entities/factura/route/factura-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/factura/route/factura-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/factura/route/factura-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/factura/route/factura-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/factura/service/factura.service.ts b/src/main/webapp/app/entities/factura/service/factura.service.ts index 07ed844..2f236c9 100644 --- a/src/main/webapp/app/entities/factura/service/factura.service.ts +++ b/src/main/webapp/app/entities/factura/service/factura.service.ts @@ -19,6 +19,7 @@ export class FacturaService { constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {} create(factura: IFactura): Observable { + debugger; const copy = this.convertDateFromClient(factura); return this.http .post(this.resourceUrl, copy, { observe: 'response' }) diff --git a/src/main/webapp/app/entities/p-pregunta-abierta/route/p-pregunta-abierta-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/p-pregunta-abierta/route/p-pregunta-abierta-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/p-pregunta-abierta/route/p-pregunta-abierta-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/p-pregunta-abierta/route/p-pregunta-abierta-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/p-pregunta-cerrada-opcion/route/p-pregunta-cerrada-opcion-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/p-pregunta-cerrada-opcion/route/p-pregunta-cerrada-opcion-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/p-pregunta-cerrada-opcion/route/p-pregunta-cerrada-opcion-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/p-pregunta-cerrada-opcion/route/p-pregunta-cerrada-opcion-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/p-pregunta-cerrada/route/p-pregunta-cerrada-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/p-pregunta-cerrada/route/p-pregunta-cerrada-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/p-pregunta-cerrada/route/p-pregunta-cerrada-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/p-pregunta-cerrada/route/p-pregunta-cerrada-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/parametro-aplicacion/route/parametro-aplicacion-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/parametro-aplicacion/route/parametro-aplicacion-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/parametro-aplicacion/route/parametro-aplicacion-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/parametro-aplicacion/route/parametro-aplicacion-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/plantilla/delete/plantilla-delete-dialog.component.html b/src/main/webapp/app/entities/plantilla/delete/plantilla-delete-dialog.component.html index 71aac23..4042602 100644 --- a/src/main/webapp/app/entities/plantilla/delete/plantilla-delete-dialog.component.html +++ b/src/main/webapp/app/entities/plantilla/delete/plantilla-delete-dialog.component.html @@ -17,7 +17,7 @@ Cancel - + Delete diff --git a/src/main/webapp/app/entities/plantilla/list/plantilla.component.html b/src/main/webapp/app/entities/plantilla/list/plantilla.component.html index 87be2ab..8ea63f7 100644 --- a/src/main/webapp/app/entities/plantilla/list/plantilla.component.html +++ b/src/main/webapp/app/entities/plantilla/list/plantilla.component.html @@ -64,7 +64,7 @@ 0"> - + Nombre diff --git a/src/main/webapp/app/entities/plantilla/plantilla-change-status-dialog/plantilla-change-status-dialog.component.html b/src/main/webapp/app/entities/plantilla/plantilla-change-status-dialog/plantilla-change-status-dialog.component.html index f28b733..286b8d8 100644 --- a/src/main/webapp/app/entities/plantilla/plantilla-change-status-dialog/plantilla-change-status-dialog.component.html +++ b/src/main/webapp/app/entities/plantilla/plantilla-change-status-dialog/plantilla-change-status-dialog.component.html @@ -25,8 +25,8 @@ - Cambiar estado + + Cambiar estado diff --git a/src/main/webapp/app/entities/plantilla/route/plantilla-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/plantilla/route/plantilla-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/plantilla/route/plantilla-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/plantilla/route/plantilla-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-plantilla-tienda.module.ts b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-plantilla-tienda.module.ts new file mode 100644 index 0000000..4a6c185 --- /dev/null +++ b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-plantilla-tienda.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { SharedModule } from 'app/shared/shared.module'; +import { TIENDA_PLANTILLA_ROUTE } from './listar-tienda-plantilla.route'; +import { ListarTiendaPlantillaComponent } from './listar-tienda-plantilla.component'; + +@NgModule({ + imports: [SharedModule, RouterModule.forChild([TIENDA_PLANTILLA_ROUTE])], + declarations: [ListarTiendaPlantillaComponent], +}) +export class ListarPlantillaTiendaModule {} diff --git a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.html b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.html new file mode 100644 index 0000000..ca7956a --- /dev/null +++ b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.html @@ -0,0 +1,115 @@ + + + + + ¡Compre y utilice las plantillas! + + Puede comprar sus plantillas mediante PayPal + + + + + + + + + + + + + + + + + + + + + Plantillas + + + + + + + + + + + + 0"> + + + + + {{ plantilla.nombre }} + + Precio: {{ plantilla.precio | currency }} + Precio: GRATIS + + + + {{ plantilla.categoria.nombre | lowercase }} + + + {{ plantilla.descripcion | lowercase }} + + + + + + Comprar con PayPal + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.scss b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.scss new file mode 100644 index 0000000..c594f74 --- /dev/null +++ b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.scss @@ -0,0 +1,449 @@ +/* ========================================================================== +Main page styles +========================================================================== */ + +.hipster { + display: inline-block; + width: 347px; + height: 497px; + + background-size: contain; +} + +.bg-img-cover { + background-position: center; + background-size: cover; + background-repeat: no-repeat; + background-color: #192e4d; +} +/*SPLIT CSS*/ +.split { + height: 90%; + width: 100%; + position: fixed; + z-index: 1; + top: 0; + overflow-x: hidden; + padding-top: 20px; +} +.left { + left: 0; + background-color: #192e4d; +} + +.right { + right: 0; +} + +.centered { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + text-align: center; +} + +.bg-img-style { + padding-top: 2px; + margin-left: 50%; + margin-top: 0; + width: 400px; + height: 300px; +} + +.overlay { + position: relative; +} +.overlay:before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #000; + opacity: 0.1; +} + +.overlay-10:before { + opacity: 0.1; +} + +.overlay-20:before { + opacity: 0.2; +} + +.overlay-30:before { + opacity: 0.3; +} + +.overlay-40:before { + opacity: 0.4; +} + +.overlay-50:before { + opacity: 0.5; +} + +.overlay-60:before { + opacity: 0.6; +} + +.overlay-70:before { + opacity: 0.7; +} + +.overlay-80:before { + opacity: 0.8; +} + +.overlay-90:before { + opacity: 0.9; +} + +.fixed-top, +.page-header-ui.navbar-fixed .navbar { + position: fixed; + top: 0; + right: 0; + left: 0; + z-index: 1030; +} + +.text-white-75, +.page-header-ui-dark .page-header-ui-text a { + color: rgba(255, 255, 255, 0.75) !important; +} +.page-header-ui { + position: relative; + padding-top: 4%; + padding-bottom: 4%; +} +.page-header-ui .page-header-ui-content .page-header-ui-title { + font-size: 2.5rem; + color: #000000; +} +.page-header-ui .page-header-ui-content .page-header-ui-text { + font-size: 1.15rem; +} +.page-header-ui .page-header-ui-content .page-header-ui-text.small { + font-size: 0.9rem; +} + +.page-header-ui-dark { + color: #fffcf5 !important; + background-color: #212832; + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.svg-border-rounded svg { + position: absolute; + bottom: 0; + left: 0; + height: 1rem; + width: 100%; +} +@media (min-width: 576px) { + .svg-border-rounded svg { + height: 1.5rem; + } +} +@media (min-width: 768px) { + .svg-border-rounded svg { + height: 2rem; + } +} +@media (min-width: 992px) { + .svg-border-rounded svg { + height: 2.5rem; + } +} +@media (min-width: 1200px) { + .svg-border-rounded svg { + height: 3rem; + } +} + +/** + Cards +**/ +.lift { + box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15); + transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +} +.lift:hover { + transform: translateY(-0.3333333333rem); + box-shadow: 0 0.5rem 2rem 0 rgba(33, 40, 50, 0.25); +} +.lift:active { + transform: none; + box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15); +} + +.lift-sm { + box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2); +} +.lift-sm:hover { + transform: translateY(-0.1666666667rem); + box-shadow: 0 0.25rem 1rem 0 rgba(33, 40, 50, 0.25); +} +.lift-sm:active { + transform: none; + box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2); +} + +/*.card.lift { + text-decoration: none; + color: inherit; +} + +.card-flag { + position: absolute; + font-size: 0.7rem; + padding: 0.3rem 0.5rem; + line-height: 1; +} + +.card-flag-dark { + background-color: rgba(33, 40, 50, 0.7); + color: #fff; +} + +.card-flag-light { + background-color: rgba(255, 255, 255, 0.7); + color: #69707a; +} + +.card-flag-lg { + font-size: 0.9rem; + padding: 0.5rem 0.65rem; +} + +.card-flag-top-right { + border-top-left-radius: 0.25rem; + border-bottom-left-radius: 0.25rem; + top: 0.5rem; + right: 0; +} + +.card-flag-top-left { + border-top-right-radius: 0.25rem; + border-bottom-right-radius: 0.25rem; + top: 0.5rem; + left: 0; +}*/ + +.border-cyan { + border-color: #00cfd5 !important; +} + +.py-10 { + padding-top: 6rem !important; + padding-bottom: 6rem !important; +} + +/* wait autoprefixer update to allow simple generation of high pixel density media query */ +@media only screen and (-webkit-min-device-pixel-ratio: 2), + only screen and (-moz-min-device-pixel-ratio: 2), + only screen and (-o-min-device-pixel-ratio: 2/1), + only screen and (min-resolution: 192dpi), + only screen and (min-resolution: 2dppx) { + .hipster { + background-size: contain; + } +} + +.icon-stack { + display: inline-flex; + justify-content: center; + align-items: center; + border-radius: 100%; + height: 2.5rem; + width: 2.5rem; + font-size: 1rem; + background-color: #f2f6fc; + flex-shrink: 0; +} +.icon-stack svg { + height: 1rem; + width: 1rem; +} + +.icon-stack-sm { + height: 2rem; + width: 2rem; +} + +.icon-stack-lg { + height: 4rem; + width: 4rem; + font-size: 1.5rem; +} +.icon-stack-lg svg { + height: 1.5rem; + width: 1.5rem; +} + +.icon-stack-xl { + height: 5rem; + width: 5rem; + font-size: 1.75rem; +} +.icon-stack-xl svg { + height: 1.75rem; + width: 1.75rem; +} + +.container-encuestas { + max-height: 1536px; + overflow-y: auto; +} +.bg-gradient-primary-to-secondary { + background-color: #1c44b2 !important; + background-image: linear-gradient(135deg, #1c44b2 0%, #00b88d 100%) !important; +} + +/*.card .entity-icon--star { + color: #ffcc47; + margin-right: 0.2rem; +} + +.card .card-title { + font-size: 2em; +} + +.card .tag { + font-size: 0.8rem; + color: #f8f8f8; + margin-top: 0.5rem; + padding: 0.2rem 1.5rem; + background-color: #2962ff94; + border-radius: 15px; +} + +.card .subtitle { + color: rgba(0, 0, 0, 0.54); + font-size: 0.9rem; +} + +.card .btn-card { + padding: 11px 10px !important; +}*/ + +.accordion-button { + position: relative; + display: flex; + align-items: center; + width: 100%; + padding: 1rem 1.25rem; + font-size: 1rem; + color: #69707a; + text-align: left; + background-color: #fff; + border: 0; + border-radius: 0; + overflow-anchor: none; + transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, + border-radius 0.15s ease; +} +@media (prefers-reduced-motion: reduce) { + .accordion-button { + transition: none; + } +} +.accordion-button:not(.collapsed) { + color: #0057da; + background-color: #e6effe; + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125); +} +.accordion-button:not(.collapsed)::after { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230057da'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); + transform: rotate(-180deg); +} +.accordion-button::after { + flex-shrink: 0; + width: 1.25rem; + height: 1.25rem; + margin-left: auto; + content: ''; + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2369707a'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); + background-repeat: no-repeat; + background-size: 1.25rem; + transition: transform 0.2s ease-in-out; +} +@media (prefers-reduced-motion: reduce) { + .accordion-button::after { + transition: none; + } +} +.accordion-button:hover { + z-index: 2; +} +.accordion-button:focus { + z-index: 3; + border-color: transparent; + outline: 0; + box-shadow: 0 0 0 0.25rem #00b88d3a; +} + +.accordion-header { + margin-bottom: 0; +} + +.accordion-item { + background-color: #fff; + border: 1px solid rgba(0, 0, 0, 0.125); +} +.accordion-item:first-of-type { + border-top-left-radius: 0.35rem; + border-top-right-radius: 0.35rem; +} +.accordion-item:first-of-type .accordion-button { + border-top-left-radius: calc(0.35rem - 1px); + border-top-right-radius: calc(0.35rem - 1px); +} +.accordion-item:not(:first-of-type) { + border-top: 0; +} +.accordion-item:last-of-type { + border-bottom-right-radius: 0.35rem; + border-bottom-left-radius: 0.35rem; +} +.accordion-item:last-of-type .accordion-button.collapsed { + border-bottom-right-radius: calc(0.35rem - 1px); + border-bottom-left-radius: calc(0.35rem - 1px); +} +.accordion-item:last-of-type .accordion-collapse { + border-bottom-right-radius: 0.35rem; + border-bottom-left-radius: 0.35rem; +} + +.accordion-body { + padding: 1rem 1.25rem; +} + +.accordion-flush .accordion-collapse { + border-width: 0; +} +.accordion-flush .accordion-item { + border-right: 0; + border-left: 0; + border-radius: 0; +} +.accordion-flush .accordion-item:first-child { + border-top: 0; +} +.accordion-flush .accordion-item:last-child { + border-bottom: 0; +} +.accordion-flush .accordion-item .accordion-button { + border-radius: 0; +} + +.card-header { + padding: 0; +} + +.card-header .collapsed { + background-color: #e6effe; +} diff --git a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.tmpSpec.ts b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.tmpSpec.ts new file mode 100644 index 0000000..2a604cb --- /dev/null +++ b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.tmpSpec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ListarTiendaPlantillaComponent } from './listar-tienda-plantilla.component'; + +describe('ListarTiendaPlantillaComponent', () => { + let component: ListarTiendaPlantillaComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ListarTiendaPlantillaComponent], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ListarTiendaPlantillaComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.ts b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.ts new file mode 100644 index 0000000..da767ba --- /dev/null +++ b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.ts @@ -0,0 +1,131 @@ +import { Component, OnInit } from '@angular/core'; +import { ICategoria } from '../../categoria/categoria.model'; +import { Account } from '../../../core/auth/account.model'; +import { UsuarioExtra } from '../../usuario-extra/usuario-extra.model'; +import { IEncuesta } from '../../encuesta/encuesta.model'; +import { Subject } from 'rxjs'; +import { EncuestaService } from '../../encuesta/service/encuesta.service'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { CategoriaService } from '../../categoria/service/categoria.service'; +import { UsuarioExtraService } from '../../usuario-extra/service/usuario-extra.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { FormBuilder } from '@angular/forms'; +import { AccountService } from '../../../core/auth/account.service'; +import { takeUntil } from 'rxjs/operators'; +import { HttpResponse } from '@angular/common/http'; +import { faPollH, faCalendarAlt, faStar, faListAlt, faFileAlt, faCreditCard } from '@fortawesome/free-solid-svg-icons'; +import { IPlantilla } from '../../plantilla/plantilla.model'; +import { PlantillaService } from '../../plantilla/service/plantilla.service'; +import { EncuestaPublishDialogComponent } from '../../encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component'; +import { PaypalDialogComponent } from '../paypal-dialog/paypal-dialog.component'; + +@Component({ + selector: 'jhi-listar-tienda-plantilla', + templateUrl: './listar-tienda-plantilla.component.html', + styleUrls: ['./listar-tienda-plantilla.component.scss'], +}) +export class ListarTiendaPlantillaComponent implements OnInit { + public searchString: string; + public searchCategoria: string; + public searchPrecio: string; + categorias?: ICategoria[]; + account: Account | null = null; + public searchEncuestaPublica: string; + notAccount: boolean = true; + usuarioExtra: UsuarioExtra | null = null; + plantillas?: IPlantilla[]; + successPayment = false; + + isLoading = false; + private readonly destroy$ = new Subject(); + + faStar = faStar; + faCalendarAlt = faCalendarAlt; + faPollH = faPollH; + faListAlt = faListAlt; + faFileAlt = faFileAlt; + faCreditCard = faCreditCard; + + constructor( + protected plantillaService: PlantillaService, + protected modalService: NgbModal, + protected categoriaService: CategoriaService, + protected usuarioExtraService: UsuarioExtraService, + protected activatedRoute: ActivatedRoute, + protected fb: FormBuilder, + protected accountService: AccountService, + protected router: Router + ) { + this.searchEncuestaPublica = ''; + this.searchString = ''; + this.searchCategoria = ''; + this.searchPrecio = ''; + } + + ngOnInit(): void { + this.searchEncuestaPublica = ''; + this.accountService + .getAuthenticationState() + .pipe(takeUntil(this.destroy$)) + .subscribe(account => { + if (account !== null) { + this.account = account; + this.notAccount = false; + } else { + this.notAccount = true; + } + }); + this.loadAll(); + this.loadAllCategorias(); + } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); + } + + loadAll(): void { + this.isLoading = true; + + this.plantillaService.query().subscribe( + (res: HttpResponse) => { + this.isLoading = false; + const plantillasBody = res.body ?? []; + this.plantillas = plantillasBody.filter(e => e.estado === 'ACTIVE'); + }, + () => { + this.isLoading = false; + } + ); + } + + loadAllCategorias(): void { + this.isLoading = true; + + this.categoriaService.query().subscribe( + (res: HttpResponse) => { + this.isLoading = false; + this.categorias = res.body ?? []; + }, + () => { + this.isLoading = false; + } + ); + } + + trackId(index: number, item: IEncuesta): number { + return item.id!; + } + + triggerPaypalDialog(plantilla: IPlantilla): void { + const modalRef = this.modalService.open(PaypalDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.plantilla = plantilla; + // unsubscribe not needed because closed completes on modal close + modalRef.closed.subscribe(reason => { + if (reason === 'published') { + this.successPayment = true; + this.loadAll(); + } + }); + } +} diff --git a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.route.ts b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.route.ts new file mode 100644 index 0000000..41d7973 --- /dev/null +++ b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.route.ts @@ -0,0 +1,10 @@ +import { Route, RouterModule } from '@angular/router'; +import { ListarTiendaPlantillaComponent } from './listar-tienda-plantilla.component'; + +export const TIENDA_PLANTILLA_ROUTE: Route = { + path: 'tienda-plantilla', + component: ListarTiendaPlantillaComponent, + data: { + pageTitle: 'tiendaPlantilla.title', + }, +}; diff --git a/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.html b/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.html new file mode 100644 index 0000000..400a2c7 --- /dev/null +++ b/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.html @@ -0,0 +1,26 @@ + + + + + + + Plantilla: {{ plantilla!.nombre }} + Cantidad: 1 + Total: ${{ plantilla!.precio }} + + + + La plantilla ha comprar no tiene costo alguno + + Finalizar compra + + + + + + + diff --git a/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.scss b/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.tmpSpec.ts b/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.tmpSpec.ts new file mode 100644 index 0000000..ad83b67 --- /dev/null +++ b/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.tmpSpec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PaypalDialogComponent } from './paypal-dialog.component'; + +describe('PaypalDialogComponent', () => { + let component: PaypalDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [PaypalDialogComponent], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PaypalDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.ts b/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.ts new file mode 100644 index 0000000..9cd5f42 --- /dev/null +++ b/src/main/webapp/app/entities/tienda/paypal-dialog/paypal-dialog.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit } from '@angular/core'; +import { IPayPalConfig, ICreateOrderRequest } from 'ngx-paypal'; +import { ParametroAplicacionService } from '../../parametro-aplicacion/service/parametro-aplicacion.service'; +import { EncuestaService } from '../../encuesta/service/encuesta.service'; +import { FormBuilder } from '@angular/forms'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { IPlantilla } from '../../plantilla/plantilla.model'; +import { faCreditCard, faCheck } from '@fortawesome/free-solid-svg-icons'; +import { Account } from '../../../core/auth/account.model'; +import { UsuarioExtra } from '../../usuario-extra/usuario-extra.model'; +import { UsuarioExtraService } from '../../usuario-extra/service/usuario-extra.service'; +import { IFactura } from '../../factura/factura.model'; +import { takeUntil } from 'rxjs/operators'; +import { AccountService } from '../../../core/auth/account.service'; +import { Subject } from 'rxjs'; +import * as dayjs from 'dayjs'; +import { FacturaService } from '../../factura/service/factura.service'; + +@Component({ + selector: 'jhi-paypal-dialog', + templateUrl: './paypal-dialog.component.html', + styleUrls: ['./paypal-dialog.component.scss'], +}) +export class PaypalDialogComponent implements OnInit { + public payPalConfig?: IPayPalConfig; + showSuccess = false; + plantilla?: IPlantilla; + account: Account | null = null; + usuarioExtra: UsuarioExtra | null = null; + factura?: IFactura; + notAccount: boolean = true; + private readonly destroy$ = new Subject(); + + faCreditCard = faCreditCard; + faCheck = faCheck; + + constructor( + protected facturaService: FacturaService, + protected usuarioExtraService: UsuarioExtraService, + protected activeModal: NgbActiveModal, + protected accountService: AccountService + ) {} + + ngOnInit(): void { + this.accountService + .getAuthenticationState() + .pipe(takeUntil(this.destroy$)) + .subscribe(account => { + if (account !== null) { + this.account = account; + this.notAccount = false; + } else { + this.notAccount = true; + } + }); + + this.getUser(); + + this.initConfig(); + } + + private initConfig(): void { + this.payPalConfig = { + currency: 'USD', + clientId: 'AUIxW_mYvd_h3mMqTtHdrSNMJ9yPmJkpiOCkNq454vDxXCN6hgadgPHIX_9PTeQn1Qv8m-ozcQUQkUjZ', + createOrderOnClient: data => + { + intent: 'CAPTURE', + purchase_units: [ + { + amount: { + currency_code: 'USD', + value: String(this.plantilla?.precio), + breakdown: { + item_total: { + currency_code: 'USD', + value: String(this.plantilla?.precio), + }, + }, + }, + items: [ + { + name: this.plantilla?.nombre, + quantity: '1', + unit_amount: { + currency_code: 'USD', + value: String(this.plantilla?.precio), + }, + }, + ], + }, + ], + }, + advanced: { + commit: 'true', + }, + style: { + label: 'paypal', + layout: 'vertical', + }, + onApprove: (data, actions) => { + console.log('onApprove - transaction was approved, but not authorized', data, actions); + actions.order.get().then((details: any) => { + //calls baxkend + console.log('onApprove - you can get full order details inside onApprove: ', details); + }); + }, + onClientAuthorization: data => { + debugger; + console.log('onClientAuthorization - you should probably inform your server about completed transaction at this point', data); + this.updateUser(); + this.sendReceipt(); + }, + }; + } + + cancel(): void { + this.activeModal.dismiss(); + } + + getUser(): void { + debugger; + // Get jhi_user and usuario_extra information + if (this.account !== null) { + this.usuarioExtraService.find(this.account.id).subscribe(usuarioExtra => { + this.usuarioExtra = usuarioExtra.body; + }); + } + } + + updateUser(): void { + this.usuarioExtra?.plantillas?.push(this.plantilla!); + + this.usuarioExtraService.update(this.usuarioExtra!).subscribe(() => { + this.showSuccess = true; + }); + } + sendReceipt(): void { + const now = dayjs(); + + debugger; + this.factura = { + nombreUsuario: String(this.usuarioExtra?.id!), + nombrePlantilla: this.plantilla?.nombre!, + costo: this.plantilla?.precio, + fecha: now, + }; + + this.facturaService.create(this.factura).subscribe(() => { + this.showSuccess = true; + this.cancel(); + }); + + //send + } + + freePurchase(): void { + this.getUser(); + this.sendReceipt(); + } +} diff --git a/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html b/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html index 5eb2292..167dae8 100644 --- a/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html +++ b/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html @@ -44,7 +44,7 @@ 0"> - + Rol diff --git a/src/main/webapp/app/entities/usuario-encuesta/route/usuario-encuesta-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/usuario-encuesta/route/usuario-encuesta-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/usuario-encuesta/route/usuario-encuesta-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/usuario-encuesta/route/usuario-encuesta-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html index e550920..9388306 100644 --- a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html +++ b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html @@ -15,7 +15,7 @@ Cancel - + Cambiar estado diff --git a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html index 313c27a..aa52b7e 100644 --- a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html +++ b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html @@ -43,7 +43,7 @@ 0"> - + Rol @@ -96,7 +96,7 @@ View --> - + Toggle Status diff --git a/src/main/webapp/app/entities/usuario-extra/route/usuario-extra-routing-resolve.service.spec.ts b/src/main/webapp/app/entities/usuario-extra/route/usuario-extra-routing-resolve.service.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/usuario-extra/route/usuario-extra-routing-resolve.service.spec.ts rename to src/main/webapp/app/entities/usuario-extra/route/usuario-extra-routing-resolve.service.tmpSpec.ts diff --git a/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.spec.ts b/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.spec.ts rename to src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.tmpSpec.ts diff --git a/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts b/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts index 4f61529..0ee3e4a 100644 --- a/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts +++ b/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts @@ -88,7 +88,7 @@ export class UsuarioExtraUpdateComponent { login, email, password, - langKey: this.translateService.currentLang, + langKey: this.translateService.currentLang!, name, firstName, profileIcon: this.profileIcon, diff --git a/src/main/webapp/app/entities/usuario-plantillas/list/usuario-plantillas.component.html b/src/main/webapp/app/entities/usuario-plantillas/list/usuario-plantillas.component.html index 74e885f..fc43592 100644 --- a/src/main/webapp/app/entities/usuario-plantillas/list/usuario-plantillas.component.html +++ b/src/main/webapp/app/entities/usuario-plantillas/list/usuario-plantillas.component.html @@ -30,7 +30,7 @@ 0"> - + Nombre diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html index 6ce258b..3044200 100644 --- a/src/main/webapp/app/home/home.component.html +++ b/src/main/webapp/app/home/home.component.html @@ -3,7 +3,7 @@ diff --git a/src/main/webapp/app/layouts/sidebar/sidebar.component.html b/src/main/webapp/app/layouts/sidebar/sidebar.component.html index 04fe706..5c2079a 100644 --- a/src/main/webapp/app/layouts/sidebar/sidebar.component.html +++ b/src/main/webapp/app/layouts/sidebar/sidebar.component.html @@ -21,6 +21,7 @@ +
DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted
DataSurvey.org
dashboard-admin works!
Ganancias por plantillas
Cantidad usuarios activos
Cantidad usuarios bloqueados
Puede copiar el enlace o compartirlo en redes sociales