diff --git a/.eslintignore b/.eslintignore index 9f81cf8..8a3e589 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,3 +5,4 @@ /node_modules .eslintrc.cjs /quasar.config.*.temporary.compiled* +/pocketbase diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 381a053..e3db14c 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -26,14 +26,14 @@ module.exports = { // 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) 'standard' - + ], plugins: [ // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files // required to lint *.vue files 'vue', - + ], globals: { @@ -51,7 +51,7 @@ module.exports = { // add your custom rules here rules: { - + // allow async-await 'generator-star-spacing': 'off', // allow paren-less arrow functions @@ -68,8 +68,12 @@ module.exports = { 'import/extensions': 'off', 'import/no-unresolved': 'off', 'import/no-extraneous-dependencies': 'off', - + 'prefer-promise-reject-errors': 'off', + 'prefer-const': 'off', + 'no-unused-vars': 'off', + 'no-trailing-spaces' : 'off', + 'vue/multi-word-component-names' : 'off', // allow debugger during development only 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' diff --git a/quasar.config.js b/quasar.config.js index baff104..a815e63 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -20,7 +20,8 @@ module.exports = configure(function (/* ctx */) { // https://v2.quasar.dev/quasar-cli-vite/boot-files boot: [ - 'axios' + 'axios', + 'pocketbase' ], // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css @@ -98,7 +99,12 @@ module.exports = configure(function (/* ctx */) { // directives: [], // Quasar plugins - plugins: [] + plugins: [ + 'Dialog', + 'Notify', + 'LocalStorage', + 'Loading' + ] }, // animations: 'all', // --- includes all animations diff --git a/src/assets/gyoza.jpg b/src/assets/gyoza.jpg new file mode 100644 index 0000000..025b022 Binary files /dev/null and b/src/assets/gyoza.jpg differ diff --git a/src/assets/gyoza_logo.jpg b/src/assets/gyoza_logo.jpg new file mode 100644 index 0000000..aa1ad3f Binary files /dev/null and b/src/assets/gyoza_logo.jpg differ diff --git a/src/assets/gyoza_logo_inline.jpg b/src/assets/gyoza_logo_inline.jpg new file mode 100644 index 0000000..b90feca Binary files /dev/null and b/src/assets/gyoza_logo_inline.jpg differ diff --git a/src/assets/gyoza_logo_nobg.png b/src/assets/gyoza_logo_nobg.png new file mode 100644 index 0000000..b4e676d Binary files /dev/null and b/src/assets/gyoza_logo_nobg.png differ diff --git a/src/assets/methmoji.png b/src/assets/methmoji.png new file mode 100644 index 0000000..6eabacd Binary files /dev/null and b/src/assets/methmoji.png differ diff --git a/src/assets/quasar-logo-full.svg b/src/assets/quasar-logo-full.svg new file mode 100644 index 0000000..281d072 --- /dev/null +++ b/src/assets/quasar-logo-full.svg @@ -0,0 +1,191 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/sad.svg b/src/assets/sad.svg new file mode 100644 index 0000000..628136f --- /dev/null +++ b/src/assets/sad.svg @@ -0,0 +1 @@ + diff --git a/src/boot/pocketbase.js b/src/boot/pocketbase.js new file mode 100644 index 0000000..0321a35 --- /dev/null +++ b/src/boot/pocketbase.js @@ -0,0 +1,13 @@ +import { boot } from 'quasar/wrappers' +import PocketBase from 'pocketbase' +const pb = new PocketBase('http://127.0.0.1:8090') + +export default boot(({ app }) => { + pb.collection('_superusers').authWithPassword( + 'gyoza@hfsplay.fr', + 'gyozagyoza' + ) + + app.config.globalProperties.$pb = pb +}) +export { pb } diff --git a/src/components/Feed.vue b/src/components/Feed.vue new file mode 100644 index 0000000..5818e89 --- /dev/null +++ b/src/components/Feed.vue @@ -0,0 +1,75 @@ + + + + Quoi de neuf + + + + {{ history.text }} + + {{history.user}} + , au sujet de {{ history.item.name}} #{{history.ref}} + + + + + + + + + + + + diff --git a/src/components/GlobalSearch.vue b/src/components/GlobalSearch.vue new file mode 100644 index 0000000..0c82b69 --- /dev/null +++ b/src/components/GlobalSearch.vue @@ -0,0 +1,79 @@ + + + + + {{searchResults.length}} résultats de recherche pour "{{srcTxt}}" + + + {{ result.name }} + + #{{result.ref}}, dans {{result.type}} + + + + + + + + + + + + + diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index 3996ce1..97a2ac3 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -12,14 +12,24 @@ // to match your app's branding. // Tip: Use the "Theme Builder" on Quasar's documentation website. -$primary : #1976D2; -$secondary : #26A69A; -$accent : #9C27B0; +//$primary : #1976D2; +//$secondary : #26A69A; +//$accent : #9C27B0; +// +//$dark : #1D1D1D; +//$dark-page : #121212; +// +//$positive : #21BA45; +//$negative : #C10015; +//$info : #31CCEC; +//$warning : #F2C037; -$dark : #1D1D1D; -$dark-page : #121212; +$primary: #027be3; +$secondary: #26A69A; +$tertiary: #555; -$positive : #21BA45; -$negative : #C10015; -$info : #31CCEC; -$warning : #F2C037; +$neutral: #E0E1E2; +$positive: #21BA45; +$negative: #DB2828; +$info: #31CCEC; +$warning: #F2C037; diff --git a/src/layouts/DefaultLayout.vue b/src/layouts/DefaultLayout.vue new file mode 100644 index 0000000..c00d8a5 --- /dev/null +++ b/src/layouts/DefaultLayout.vue @@ -0,0 +1,224 @@ + + + + + + + + + + + {{username}} + + + + + + Catégories + + + {{ category.name }} + {{ counters[category.name] }} + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/layouts/FullscreenLayout.vue b/src/layouts/FullscreenLayout.vue new file mode 100644 index 0000000..de1c58d --- /dev/null +++ b/src/layouts/FullscreenLayout.vue @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/src/pages/Dashboard.vue b/src/pages/Dashboard.vue new file mode 100644 index 0000000..21c19c9 --- /dev/null +++ b/src/pages/Dashboard.vue @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/src/pages/Error404.vue b/src/pages/Error404.vue new file mode 100644 index 0000000..07e4bab --- /dev/null +++ b/src/pages/Error404.vue @@ -0,0 +1,22 @@ + + + + + + Y'a rien ici, frêre...(404) + Retour a la home + + + + diff --git a/src/pages/Index.vue b/src/pages/Index.vue new file mode 100644 index 0000000..35151da --- /dev/null +++ b/src/pages/Index.vue @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/src/pages/StockItem.vue b/src/pages/StockItem.vue new file mode 100644 index 0000000..5f037e9 --- /dev/null +++ b/src/pages/StockItem.vue @@ -0,0 +1,308 @@ + + + {{item.ref}} + Supprimé + {{item.name || '---- -- ----'}} + {{item.type}} + + + + + + + + + + + + + + + + + + Enregistrer + + + + + + Historique + + + + + + + + + + + + + Annuler + Ok + + + + + + + {{ event.text }} + + + + + + + + + + + + + diff --git a/src/pages/StockItems.vue b/src/pages/StockItems.vue new file mode 100644 index 0000000..e1c287d --- /dev/null +++ b/src/pages/StockItems.vue @@ -0,0 +1,146 @@ + + + {{category.name}} + + + + + + + + + + + + ✔ + ✘ + + + ✘ + + + + + + {{ col.value }} + + + + + + + + + + + + diff --git a/src/router/routes.js b/src/router/routes.js index 1b2e365..52be573 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -1,17 +1,19 @@ const routes = [ { path: '/', - component: () => import('layouts/MainLayout.vue'), + component: () => import('layouts/FullscreenLayout.vue'), children: [ - { path: '', component: () => import('pages/IndexPage.vue') } + { path: '', component: () => import('pages/Index.vue') } ] }, - - // Always leave this as last one, - // but you can also remove it { - path: '/:catchAll(.*)*', - component: () => import('pages/ErrorNotFound.vue') + path: '/', + component: () => import('layouts/DefaultLayout.vue'), + children: [ + { path: 'dashboard', component: () => import('pages/Dashboard.vue') }, + { path: 'category/:categoryCode', props: true, component: () => import('pages/StockItems.vue') }, + { path: 'item/:itemRef', props: true, component: () => import('pages/StockItem.vue') } + ] } ] diff --git a/src/store/core/actions.js b/src/store/core/actions.js new file mode 100644 index 0000000..1a936eb --- /dev/null +++ b/src/store/core/actions.js @@ -0,0 +1,49 @@ +import { pb } from 'src/boot/pocketbase' +// +// export function loadAppData (store) { +// return Firebase.database().ref().once('value').then((snapshot) => { +// store.commit('setFirebaseState', snapshot.val()) +// }) +// } +// +export async function loadAppData (store) { + return Promise.all([ + pb.collection('stock').getFullList(), + pb.collection('history').getFullList(), + pb.collection('categories').getFullList() + ]).then(([stock, history, categories]) => { + return store.commit('setFirebaseState', { + stock, + history, + categories + }) + }) +} + +// export function addToCollection (store, data) { +// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => { +// let index = parseInt(Object.keys(snapshot.val()).reverse()[0]) + 1 +// return Firebase.database().ref('/' + data.collection + '/' + index).set(data.data) +// }) +// } +// +// export function removeFromCollection (store, data) { +// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => { +// let index = snapshot.val().findIndex(item => +// item.timestamp === data.data.timestamp && item.ref === data.data.ref +// ) +// return Firebase.database().ref('/' + data.collection + '/' + index).remove() +// }) +// } +// +// export function updateItem (store, data) { +// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(data.data) +// } +// +// export function deleteItem (store, data) { +// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(null) +// } +// +// export function uploadFile (store, file) { +// return Firebase.storage().ref().child(Date.now() + file.name).put(file) +// } diff --git a/src/store/core/getters.js b/src/store/core/getters.js new file mode 100644 index 0000000..cc054a3 --- /dev/null +++ b/src/store/core/getters.js @@ -0,0 +1,4 @@ +/* +export function someGetter (state) { +} +*/ diff --git a/src/store/core/index.js b/src/store/core/index.js new file mode 100644 index 0000000..b41a219 --- /dev/null +++ b/src/store/core/index.js @@ -0,0 +1,12 @@ +import state from './state' +import * as getters from './getters' +import * as mutations from './mutations' +import * as actions from './actions' + +export default { + namespaced: true, + state, + getters, + mutations, + actions +} diff --git a/src/store/core/mutations.js b/src/store/core/mutations.js new file mode 100644 index 0000000..620f565 --- /dev/null +++ b/src/store/core/mutations.js @@ -0,0 +1,8 @@ +export function setFirebaseState (state, data) { + state.firebase = data + return data +} + +export function setUsername (state, data) { + state.username = data +} diff --git a/src/store/core/state.js b/src/store/core/state.js new file mode 100644 index 0000000..b7580ae --- /dev/null +++ b/src/store/core/state.js @@ -0,0 +1,8 @@ +export default { + username: null, + firebase: { + categories: [], + history: [], + stock: [] + } +} diff --git a/src/store/index.js b/src/store/index.js index f4ce543..4e43933 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,6 +1,6 @@ import { store } from 'quasar/wrappers' import { createStore } from 'vuex' - +import core from './core' // import example from './module-example' /* @@ -15,7 +15,7 @@ import { createStore } from 'vuex' export default store(function (/* { ssrContext } */) { const Store = createStore({ modules: { - // example + core }, // enable strict mode (adds overhead!)
+ +
Y'a rien ici, frêre...(404)