├── nuxt-checkout
├── .editorconfig
├── .gitignore
├── README.md
├── assets
│ └── README.md
├── components
│ ├── Logo.vue
│ └── README.md
├── layouts
│ ├── README.md
│ └── default.vue
├── middleware
│ └── README.md
├── nuxt.config.js
├── package-lock.json
├── package.json
├── pages
│ ├── Error.vue
│ ├── README.md
│ ├── Success.vue
│ └── _code.vue
├── plugins
│ └── README.md
├── static
│ ├── README.md
│ └── favicon.ico
├── store
│ └── README.md
└── tsconfig.json
├── vue-admin
├── .browserslistrc
├── .gitignore
├── README.md
├── babel.config.js
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ └── index.html
├── src
│ ├── App.vue
│ ├── components
│ │ ├── Menu.vue
│ │ └── Nav.vue
│ ├── main.ts
│ ├── models
│ │ └── user.ts
│ ├── plugins
│ │ └── vuetify.ts
│ ├── router
│ │ └── index.ts
│ ├── shims-tsx.d.ts
│ ├── shims-vue.d.ts
│ ├── shims-vuetify.d.ts
│ ├── store
│ │ └── index.ts
│ └── views
│ │ ├── Layout.vue
│ │ ├── Links.vue
│ │ ├── Login.vue
│ │ ├── Orders.vue
│ │ ├── Profile.vue
│ │ ├── Register.vue
│ │ ├── Users.vue
│ │ └── products
│ │ ├── ProductForm.vue
│ │ └── Products.vue
├── tsconfig.json
└── vue.config.js
└── vue-ambassador
├── .browserslistrc
├── .env
├── .gitignore
├── README.md
├── babel.config.js
├── package-lock.json
├── package.json
├── public
├── favicon.ico
└── index.html
├── src
├── App.vue
├── components
│ ├── Header.vue
│ └── Nav.vue
├── main.ts
├── models
│ ├── filter.ts
│ ├── link.ts
│ ├── product.ts
│ ├── ranking.ts
│ └── user.ts
├── router
│ └── index.ts
├── shims-vue.d.ts
├── store
│ └── index.ts
└── views
│ ├── Layout.vue
│ ├── Login.vue
│ ├── Products.vue
│ ├── ProductsBackend.vue
│ ├── ProductsFrontend.vue
│ ├── Profile.vue
│ ├── Rankings.vue
│ ├── Register.vue
│ └── Stats.vue
└── tsconfig.json
/nuxt-checkout/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/nuxt-checkout/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Node template
3 | # Logs
4 | /logs
5 | *.log
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 |
10 | # Runtime data
11 | pids
12 | *.pid
13 | *.seed
14 | *.pid.lock
15 |
16 | # Directory for instrumented libs generated by jscoverage/JSCover
17 | lib-cov
18 |
19 | # Coverage directory used by tools like istanbul
20 | coverage
21 |
22 | # nyc test coverage
23 | .nyc_output
24 |
25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26 | .grunt
27 |
28 | # Bower dependency directory (https://bower.io/)
29 | bower_components
30 |
31 | # node-waf configuration
32 | .lock-wscript
33 |
34 | # Compiled binary addons (https://nodejs.org/api/addons.html)
35 | build/Release
36 |
37 | # Dependency directories
38 | node_modules/
39 | jspm_packages/
40 |
41 | # TypeScript v1 declaration files
42 | typings/
43 |
44 | # Optional npm cache directory
45 | .npm
46 |
47 | # Optional eslint cache
48 | .eslintcache
49 |
50 | # Optional REPL history
51 | .node_repl_history
52 |
53 | # Output of 'npm pack'
54 | *.tgz
55 |
56 | # Yarn Integrity file
57 | .yarn-integrity
58 |
59 | # dotenv environment variables file
60 | .env
61 |
62 | # parcel-bundler cache (https://parceljs.org/)
63 | .cache
64 |
65 | # next.js build output
66 | .next
67 |
68 | # nuxt.js build output
69 | .nuxt
70 |
71 | # Nuxt generate
72 | dist
73 |
74 | # vuepress build output
75 | .vuepress/dist
76 |
77 | # Serverless directories
78 | .serverless
79 |
80 | # IDE / Editor
81 | .idea
82 |
83 | # Service worker
84 | sw.*
85 |
86 | # macOS
87 | .DS_Store
88 |
89 | # Vim swap files
90 | *.swp
91 |
--------------------------------------------------------------------------------
/nuxt-checkout/README.md:
--------------------------------------------------------------------------------
1 | # nuxt-checkout
2 |
3 | ## Build Setup
4 |
5 | ```bash
6 | # install dependencies
7 | $ npm install
8 |
9 | # serve with hot reload at localhost:3000
10 | $ npm run dev
11 |
12 | # build for production and launch server
13 | $ npm run build
14 | $ npm run start
15 |
16 | # generate static project
17 | $ npm run generate
18 | ```
19 |
20 | For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
21 |
--------------------------------------------------------------------------------
/nuxt-checkout/assets/README.md:
--------------------------------------------------------------------------------
1 | # ASSETS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
8 |
--------------------------------------------------------------------------------
/nuxt-checkout/components/Logo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
15 |
16 |
17 |
18 |
30 |
--------------------------------------------------------------------------------
/nuxt-checkout/components/README.md:
--------------------------------------------------------------------------------
1 | # COMPONENTS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | The components directory contains your Vue.js Components.
6 |
7 | _Nuxt.js doesn't supercharge these components._
8 |
--------------------------------------------------------------------------------
/nuxt-checkout/layouts/README.md:
--------------------------------------------------------------------------------
1 | # LAYOUTS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your Application Layouts.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).
8 |
--------------------------------------------------------------------------------
/nuxt-checkout/layouts/default.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
63 |
--------------------------------------------------------------------------------
/nuxt-checkout/middleware/README.md:
--------------------------------------------------------------------------------
1 | # MIDDLEWARE
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your application middleware.
6 | Middleware let you define custom functions that can be run before rendering either a page or a group of pages.
7 |
8 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).
9 |
--------------------------------------------------------------------------------
/nuxt-checkout/nuxt.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | // Global page headers: https://go.nuxtjs.dev/config-head
3 | ssr: true,
4 | head: {
5 | title: 'nuxt-checkout',
6 | htmlAttrs: {
7 | lang: 'en'
8 | },
9 | meta: [
10 | {charset: 'utf-8'},
11 | {name: 'viewport', content: 'width=device-width, initial-scale=1'},
12 | {hid: 'description', name: 'description', content: ''}
13 | ],
14 | link: [
15 | {rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'},
16 | {
17 | rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css',
18 | integrity: 'sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6', crossOrigin: 'anonymous'
19 | }
20 | ]
21 | },
22 |
23 | // Global CSS: https://go.nuxtjs.dev/config-css
24 | css: [],
25 |
26 | // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
27 | plugins: [],
28 |
29 | // Auto import components: https://go.nuxtjs.dev/config-components
30 | components: true,
31 |
32 | // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
33 | buildModules: [
34 | // https://go.nuxtjs.dev/typescript
35 | '@nuxt/typescript-build',
36 | ],
37 |
38 | // Modules: https://go.nuxtjs.dev/config-modules
39 | modules: [
40 | // https://go.nuxtjs.dev/axios
41 | '@nuxtjs/axios',
42 |
43 | ['nuxt-stripe-module', {
44 | publishableKey: 'pk_test_51H0wSsFHUJ5mamKON9UhPL8Rws5mF3p5aTqKK9kh2Rvk0DnQcpSLYujzQoWqTyp02tkWjYB8o9YRKSFWThARxyT100uqDDnoVy',
45 | }],
46 | ],
47 |
48 | // Axios module configuration: https://go.nuxtjs.dev/config-axios
49 | axios: {
50 | baseURL: 'http://localhost:8000/api/checkout/'
51 | },
52 |
53 | // Build Configuration: https://go.nuxtjs.dev/config-build
54 | build: {},
55 | server: {
56 | port: 5000
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/nuxt-checkout/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-checkout",
3 | "version": "1.0.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "nuxt",
7 | "build": "nuxt build",
8 | "start": "nuxt start",
9 | "generate": "nuxt generate"
10 | },
11 | "dependencies": {
12 | "@nuxtjs/axios": "^5.13.1",
13 | "bootstrap": "^4.6.0",
14 | "bootstrap-vue": "^2.21.2",
15 | "core-js": "^3.9.1",
16 | "nuxt": "^2.15.3",
17 | "nuxt-stripe-module": "^3.1.7"
18 | },
19 | "devDependencies": {
20 | "@nuxt/types": "^2.15.3",
21 | "@nuxt/typescript-build": "^2.1.0"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/nuxt-checkout/pages/Error.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Error
6 |
Could not process payment!
7 |
8 |
9 |
10 |
11 |
12 |
17 |
--------------------------------------------------------------------------------
/nuxt-checkout/pages/README.md:
--------------------------------------------------------------------------------
1 | # PAGES
2 |
3 | This directory contains your Application Views and Routes.
4 | The framework reads all the `*.vue` files inside this directory and creates the router of your application.
5 |
6 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).
7 |
--------------------------------------------------------------------------------
/nuxt-checkout/pages/Success.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Success
6 |
Your purchase has been completed!
7 |
8 |
9 |
10 |
11 |
12 |
24 |
--------------------------------------------------------------------------------
/nuxt-checkout/pages/_code.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Welcome
6 |
{{ user.first_name }} {{ user.last_name }} has invited you to buy these products!
7 |
8 |
9 |
10 |
11 |
12 | Products
13 |
14 |
35 |
36 |
37 |
Personal Info
38 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
154 |
155 |
160 |
--------------------------------------------------------------------------------
/nuxt-checkout/plugins/README.md:
--------------------------------------------------------------------------------
1 | # PLUGINS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains Javascript plugins that you want to run before mounting the root Vue.js application.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).
8 |
--------------------------------------------------------------------------------
/nuxt-checkout/static/README.md:
--------------------------------------------------------------------------------
1 | # STATIC
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your static files.
6 | Each file inside this directory is mapped to `/`.
7 | Thus you'd want to delete this README.md before deploying to production.
8 |
9 | Example: `/static/robots.txt` is mapped as `/robots.txt`.
10 |
11 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).
12 |
--------------------------------------------------------------------------------
/nuxt-checkout/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antoniopapa/vue-ambassador/a9f06ce81fff1b0ab07d31322ced4a088ea61e4e/nuxt-checkout/static/favicon.ico
--------------------------------------------------------------------------------
/nuxt-checkout/store/README.md:
--------------------------------------------------------------------------------
1 | # STORE
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your Vuex Store files.
6 | Vuex Store option is implemented in the Nuxt.js framework.
7 |
8 | Creating a file in this directory automatically activates the option in the framework.
9 |
10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
11 |
--------------------------------------------------------------------------------
/nuxt-checkout/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2018",
4 | "module": "ESNext",
5 | "moduleResolution": "Node",
6 | "lib": [
7 | "ESNext",
8 | "ESNext.AsyncIterable",
9 | "DOM"
10 | ],
11 | "esModuleInterop": true,
12 | "allowJs": true,
13 | "sourceMap": true,
14 | "strict": true,
15 | "noEmit": true,
16 | "experimentalDecorators": true,
17 | "baseUrl": ".",
18 | "paths": {
19 | "~/*": [
20 | "./*"
21 | ],
22 | "@/*": [
23 | "./*"
24 | ]
25 | },
26 | "types": [
27 | "@nuxt/types",
28 | "@nuxtjs/axios",
29 | "@types/node",
30 | "nuxt-stripe-module"
31 | ]
32 | },
33 | "exclude": [
34 | "node_modules",
35 | ".nuxt",
36 | "dist"
37 | ]
38 | }
39 |
--------------------------------------------------------------------------------
/vue-admin/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/vue-admin/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw?
24 |
--------------------------------------------------------------------------------
/vue-admin/README.md:
--------------------------------------------------------------------------------
1 | # vue-admin
2 |
3 | ## Project setup
4 | ```
5 | npm install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | npm run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | npm run build
16 | ```
17 |
18 | ### Customize configuration
19 | See [Configuration Reference](https://cli.vuejs.org/config/).
20 |
--------------------------------------------------------------------------------
/vue-admin/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/vue-admin/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-admin",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build"
8 | },
9 | "dependencies": {
10 | "axios": "^0.21.1",
11 | "core-js": "^3.6.5",
12 | "vue": "^2.6.11",
13 | "vue-class-component": "^7.2.3",
14 | "vue-property-decorator": "^9.1.2",
15 | "vue-router": "^3.2.0",
16 | "vuetify": "^2.4.0",
17 | "vuex": "^3.4.0"
18 | },
19 | "devDependencies": {
20 | "@vue/cli-plugin-babel": "~4.5.0",
21 | "@vue/cli-plugin-router": "~4.5.0",
22 | "@vue/cli-plugin-typescript": "~4.5.0",
23 | "@vue/cli-plugin-vuex": "~4.5.0",
24 | "@vue/cli-service": "~4.5.0",
25 | "sass": "^1.32.0",
26 | "sass-loader": "^10.0.0",
27 | "typescript": "~4.1.5",
28 | "vue-cli-plugin-vuetify": "~2.3.1",
29 | "vue-template-compiler": "^2.6.11",
30 | "vuetify-loader": "^1.7.0"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vue-admin/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antoniopapa/vue-ambassador/a9f06ce81fff1b0ab07d31322ced4a088ea61e4e/vue-admin/public/favicon.ico
--------------------------------------------------------------------------------
/vue-admin/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
13 |
14 |
15 |
16 | We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
17 | Please enable it to continue.
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/vue-admin/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 |
115 |
--------------------------------------------------------------------------------
/vue-admin/src/components/Menu.vue:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 |
30 |
--------------------------------------------------------------------------------
/vue-admin/src/components/Nav.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | Company name
4 |
5 |
6 |
7 | {{ user.first_name }} {{ user.last_name }}
8 |
9 | Sign out
10 |
11 |
12 |
13 |
14 |
33 |
--------------------------------------------------------------------------------
/vue-admin/src/main.ts:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 | import vuetify from './plugins/vuetify';
6 | import axios from "axios";
7 |
8 | axios.defaults.baseURL = 'http://localhost:8000/api/admin/';
9 | axios.defaults.withCredentials = true;
10 |
11 | Vue.config.productionTip = false
12 |
13 | new Vue({
14 | router,
15 | store,
16 | vuetify,
17 | render: h => h(App)
18 | }).$mount('#app')
19 |
--------------------------------------------------------------------------------
/vue-admin/src/models/user.ts:
--------------------------------------------------------------------------------
1 | export class User {
2 | id!: number;
3 | first_name!: string;
4 | last_name!: string;
5 | email!: string;
6 | }
7 |
--------------------------------------------------------------------------------
/vue-admin/src/plugins/vuetify.ts:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import Vuetify from 'vuetify/lib/framework';
3 |
4 | Vue.use(Vuetify);
5 |
6 | export default new Vuetify({
7 | });
8 |
--------------------------------------------------------------------------------
/vue-admin/src/router/index.ts:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter, {RouteConfig} from 'vue-router'
3 | import Layout from '@/views/Layout.vue'
4 | import Login from '@/views/Login.vue'
5 | import Register from '@/views/Register.vue'
6 | import Users from '@/views/Users.vue'
7 | import Links from '@/views/Links.vue'
8 | import Orders from '@/views/Orders.vue'
9 | import Profile from '@/views/Profile.vue'
10 | import Products from '@/views/products/Products.vue'
11 | import ProductForm from '@/views/products/ProductForm.vue'
12 |
13 | Vue.use(VueRouter)
14 |
15 | const routes: Array = [
16 | {path: '/login', component: Login},
17 | {path: '/register', component: Register},
18 | {
19 | path: '',
20 | component: Layout,
21 | children: [
22 | {path: '', redirect: '/users'},
23 | {path: '/users', component: Users},
24 | {path: '/users/:id/links', component: Links},
25 | {path: '/products', component: Products},
26 | {path: '/products/create', component: ProductForm},
27 | {path: '/products/:id/edit', component: ProductForm},
28 | {path: '/orders', component: Orders},
29 | {path: '/profile', component: Profile},
30 | ]
31 | }
32 | ]
33 |
34 | const router = new VueRouter({
35 | mode: 'history',
36 | base: process.env.BASE_URL,
37 | routes
38 | })
39 |
40 | export default router
41 |
--------------------------------------------------------------------------------
/vue-admin/src/shims-tsx.d.ts:
--------------------------------------------------------------------------------
1 | import Vue, { VNode } from 'vue'
2 |
3 | declare global {
4 | namespace JSX {
5 | // tslint:disable no-empty-interface
6 | interface Element extends VNode {}
7 | // tslint:disable no-empty-interface
8 | interface ElementClass extends Vue {}
9 | interface IntrinsicElements {
10 | [elem: string]: any
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/vue-admin/src/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.vue' {
2 | import Vue from 'vue'
3 | export default Vue
4 | }
5 |
--------------------------------------------------------------------------------
/vue-admin/src/shims-vuetify.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'vuetify/lib/framework' {
2 | import Vuetify from 'vuetify'
3 | export default Vuetify
4 | }
5 |
--------------------------------------------------------------------------------
/vue-admin/src/store/index.ts:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex, {Commit} from 'vuex'
3 | import {User} from "@/models/user";
4 |
5 | Vue.use(Vuex)
6 |
7 | export default new Vuex.Store({
8 | state: {
9 | user: new User()
10 | },
11 | mutations: {
12 | SET_USER(state: { user: User }, user: User) {
13 | state.user = user;
14 | }
15 | },
16 | actions: {
17 | setUser({commit}: { commit: Commit }, user: User) {
18 | return commit('SET_USER', user);
19 | }
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/vue-admin/src/views/Layout.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
39 |
--------------------------------------------------------------------------------
/vue-admin/src/views/Links.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #
7 | Code
8 | Count
9 | Revenue
10 |
11 |
12 |
13 |
14 | {{ link.id }}
15 | {{ link.code }}
16 | {{ link.orders.length }}
17 | {{ link.orders.reduce((s, o) => s + o.total, 0) }}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
41 |
--------------------------------------------------------------------------------
/vue-admin/src/views/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 |
21 |
44 |
45 |
73 |
--------------------------------------------------------------------------------
/vue-admin/src/views/Orders.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ order.name }} ${{ order.total }}
6 |
7 |
8 |
9 |
10 |
11 |
12 | #
13 | Product Title
14 | Price
15 | Quantity
16 |
17 |
18 |
19 |
20 | {{ item.id }}
21 | {{ item.product_title }}
22 | {{ item.price }}
23 | {{ item.quantity }}
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
50 |
--------------------------------------------------------------------------------
/vue-admin/src/views/Profile.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Account Information
4 |
16 |
17 |
Change Password
18 |
27 |
28 |
29 |
30 |
65 |
--------------------------------------------------------------------------------
/vue-admin/src/views/Register.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
33 |
34 |
35 |
36 |
65 |
66 |
94 |
--------------------------------------------------------------------------------
/vue-admin/src/views/Users.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | #
8 | Name
9 | Email
10 | Actions
11 |
12 |
13 |
14 |
15 | {{ user.id }}
16 | {{ user.first_name }} {{ user.last_name }}
17 | {{ user.email }}
18 |
19 | View
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
32 |
33 |
34 |
35 |
36 |
57 |
--------------------------------------------------------------------------------
/vue-admin/src/views/products/ProductForm.vue:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
62 |
--------------------------------------------------------------------------------
/vue-admin/src/views/products/Products.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Add
5 |
6 |
7 |
8 |
9 |
10 |
11 | #
12 | Image
13 | Title
14 | Description
15 | Price
16 | Actions
17 |
18 |
19 |
20 |
21 | {{ product.id }}
22 |
23 |
24 |
25 | {{ product.title }}
26 | {{ product.description }}
27 | {{ product.price }}
28 |
29 |
30 | Edit
31 | Delete
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
49 |
80 |
--------------------------------------------------------------------------------
/vue-admin/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "esnext",
5 | "strict": true,
6 | "jsx": "preserve",
7 | "importHelpers": true,
8 | "moduleResolution": "node",
9 | "experimentalDecorators": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "sourceMap": true,
14 | "baseUrl": ".",
15 | "types": [
16 | "webpack-env"
17 | ],
18 | "paths": {
19 | "@/*": [
20 | "src/*"
21 | ]
22 | },
23 | "lib": [
24 | "esnext",
25 | "dom",
26 | "dom.iterable",
27 | "scripthost"
28 | ]
29 | },
30 | "include": [
31 | "src/**/*.ts",
32 | "src/**/*.tsx",
33 | "src/**/*.vue",
34 | "tests/**/*.ts",
35 | "tests/**/*.tsx"
36 | ],
37 | "exclude": [
38 | "node_modules"
39 | ]
40 | }
41 |
--------------------------------------------------------------------------------
/vue-admin/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | transpileDependencies: [
3 | 'vuetify'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/vue-ambassador/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/vue-ambassador/.env:
--------------------------------------------------------------------------------
1 | VUE_APP_CHECKOUT_URL=http://localhost:5000
2 |
--------------------------------------------------------------------------------
/vue-ambassador/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw?
24 |
--------------------------------------------------------------------------------
/vue-ambassador/README.md:
--------------------------------------------------------------------------------
1 | # vue-ambassador
2 |
3 | ## Project setup
4 | ```
5 | npm install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | npm run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | npm run build
16 | ```
17 |
18 | ### Customize configuration
19 | See [Configuration Reference](https://cli.vuejs.org/config/).
20 |
--------------------------------------------------------------------------------
/vue-ambassador/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/vue-ambassador/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-ambassador",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve --port=4000",
7 | "build": "vue-cli-service build"
8 | },
9 | "dependencies": {
10 | "axios": "^0.21.1",
11 | "core-js": "^3.6.5",
12 | "vue": "^3.0.0",
13 | "vue-router": "^4.0.0-0",
14 | "vuex": "^4.0.0-0"
15 | },
16 | "devDependencies": {
17 | "@vue/cli-plugin-babel": "~4.5.0",
18 | "@vue/cli-plugin-router": "~4.5.0",
19 | "@vue/cli-plugin-typescript": "~4.5.0",
20 | "@vue/cli-plugin-vuex": "~4.5.0",
21 | "@vue/cli-service": "~4.5.0",
22 | "@vue/compiler-sfc": "^3.0.0",
23 | "typescript": "~4.1.5"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/vue-ambassador/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/antoniopapa/vue-ambassador/a9f06ce81fff1b0ab07d31322ced4a088ea61e4e/vue-ambassador/public/favicon.ico
--------------------------------------------------------------------------------
/vue-ambassador/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
11 |
12 |
13 |
14 | We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
15 | Please enable it to continue.
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/vue-ambassador/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/vue-ambassador/src/components/Header.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
{{ title }}
6 |
{{ description }}
7 |
8 | Login
9 | Register
10 |
11 |
12 |
13 |
14 |
15 |
16 |
45 |
--------------------------------------------------------------------------------
/vue-ambassador/src/components/Nav.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 | Frontend
8 |
9 |
10 | Backend
11 |
12 |
13 |
14 |
15 |
16 |
Rankings
17 |
Stats
18 |
Logout
19 |
{{ user.first_name }} {{ user.last_name }}
20 |
21 |
22 |
23 | Login
24 | Sign-up
25 |
26 |
27 |
28 |
29 |
30 |
31 |
55 |
--------------------------------------------------------------------------------
/vue-ambassador/src/main.ts:
--------------------------------------------------------------------------------
1 | import {createApp} from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 | import axios from 'axios'
6 |
7 | axios.defaults.baseURL = 'http://localhost:8000/api/ambassador/';
8 | axios.defaults.withCredentials = true;
9 |
10 | createApp(App).use(store).use(router).mount('#app')
11 |
--------------------------------------------------------------------------------
/vue-ambassador/src/models/filter.ts:
--------------------------------------------------------------------------------
1 | export interface Filter {
2 | s: string;
3 | sort: string;
4 | page: number;
5 | }
6 |
--------------------------------------------------------------------------------
/vue-ambassador/src/models/link.ts:
--------------------------------------------------------------------------------
1 | export class Link {
2 | id!: number;
3 | code!: string;
4 | count!: number;
5 | revenue!: number;
6 | }
7 |
--------------------------------------------------------------------------------
/vue-ambassador/src/models/product.ts:
--------------------------------------------------------------------------------
1 | export class Product {
2 | id!: number;
3 | title!: string;
4 | description!: string;
5 | image!: string;
6 | price!: number;
7 | }
8 |
--------------------------------------------------------------------------------
/vue-ambassador/src/models/ranking.ts:
--------------------------------------------------------------------------------
1 | export class Ranking {
2 | [key: string]: number;
3 | }
4 |
--------------------------------------------------------------------------------
/vue-ambassador/src/models/user.ts:
--------------------------------------------------------------------------------
1 | export class User {
2 | id!: number;
3 | first_name!: string;
4 | last_name!: string;
5 | email!: string;
6 | revenue!: number;
7 | }
8 |
--------------------------------------------------------------------------------
/vue-ambassador/src/router/index.ts:
--------------------------------------------------------------------------------
1 | import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'
2 | import Layout from '@/views/Layout.vue';
3 | import Login from '@/views/Login.vue';
4 | import Register from '@/views/Register.vue';
5 | import Profile from '@/views/Profile.vue';
6 | import ProductsFrontend from '@/views/ProductsFrontend.vue';
7 | import ProductsBackend from '@/views/ProductsBackend.vue';
8 | import Stats from '@/views/Stats.vue';
9 | import Rankings from '@/views/Rankings.vue';
10 |
11 | const routes: Array = [
12 | {path: '/login', component: Login},
13 | {path: '/register', component: Register},
14 | {
15 | path: '',
16 | component: Layout,
17 | children: [
18 | {path: '', component: ProductsFrontend},
19 | {path: '/backend', component: ProductsBackend},
20 | {path: '/profile', component: Profile},
21 | {path: '/stats', component: Stats},
22 | {path: '/rankings', component: Rankings},
23 | ]
24 | }
25 | ]
26 |
27 | const router = createRouter({
28 | history: createWebHistory(process.env.BASE_URL),
29 | routes
30 | })
31 |
32 | export default router
33 |
--------------------------------------------------------------------------------
/vue-ambassador/src/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | declare module '*.vue' {
3 | import type { DefineComponent } from 'vue'
4 | const component: DefineComponent<{}, {}, any>
5 | export default component
6 | }
7 |
--------------------------------------------------------------------------------
/vue-ambassador/src/store/index.ts:
--------------------------------------------------------------------------------
1 | import {Commit, createStore} from 'vuex'
2 | import {User} from "@/models/user";
3 |
4 | export default createStore({
5 | state: {
6 | user: new User()
7 | },
8 | mutations: {
9 | SET_USER(state: { user: User }, user: User) {
10 | state.user = user;
11 | }
12 | },
13 | actions: {
14 | setUser({commit}: { commit: Commit }, user: User) {
15 | return commit('SET_USER', user);
16 | }
17 | }
18 | })
19 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/Layout.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
14 |
15 |
16 |
17 |
49 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 |
21 |
44 |
45 |
73 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/Products.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ link }}
5 |
6 |
7 |
8 |
9 |
10 | {{ error }}
11 |
12 |
13 |
14 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
{{ product.title }}
34 |
35 | ${{ product.price }}
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | Load More
44 |
45 |
46 |
47 |
122 |
123 |
132 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/ProductsBackend.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
60 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/ProductsFrontend.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
67 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/Profile.vue:
--------------------------------------------------------------------------------
1 |
2 | Account Information
3 |
19 |
20 | Change Password
21 |
33 |
34 |
35 |
80 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/Rankings.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #
7 | Name
8 | Revenue
9 |
10 |
11 |
12 |
13 | {{ i + 1 }}
14 | {{ name }}
15 | {{ value }}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
44 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/Register.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
33 |
34 |
35 |
36 |
65 |
66 |
94 |
--------------------------------------------------------------------------------
/vue-ambassador/src/views/Stats.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Link
7 | Users
8 | Revenue
9 |
10 |
11 |
12 |
13 | {{ checkoutUrl(link.code) }}
14 | {{ link.count }}
15 | {{ link.revenue }}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
47 |
--------------------------------------------------------------------------------
/vue-ambassador/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "esnext",
5 | "strict": true,
6 | "jsx": "preserve",
7 | "importHelpers": true,
8 | "moduleResolution": "node",
9 | "skipLibCheck": true,
10 | "esModuleInterop": true,
11 | "allowSyntheticDefaultImports": true,
12 | "sourceMap": true,
13 | "baseUrl": ".",
14 | "types": [
15 | "webpack-env"
16 | ],
17 | "paths": {
18 | "@/*": [
19 | "src/*"
20 | ]
21 | },
22 | "lib": [
23 | "esnext",
24 | "dom",
25 | "dom.iterable",
26 | "scripthost"
27 | ]
28 | },
29 | "include": [
30 | "src/**/*.ts",
31 | "src/**/*.tsx",
32 | "src/**/*.vue",
33 | "tests/**/*.ts",
34 | "tests/**/*.tsx"
35 | ],
36 | "exclude": [
37 | "node_modules"
38 | ]
39 | }
40 |
--------------------------------------------------------------------------------