diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a38b03..8f02923 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,14 @@ exclude: 'node_modules|.git' -default_stages: [commit] +default_stages: [pre-commit] fail_fast: false - repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - files: "suppliers_portal.*" - exclude: ".*json$|.*txt$|.*csv|.*md|.*svg" + files: 'suppliers_portal.*' + exclude: '.*json$|.*txt$|.*csv|.*md|.*svg' - id: check-yaml - id: check-merge-conflict - id: check-ast @@ -19,49 +18,41 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.0 + rev: v0.11.7 hooks: - id: ruff - name: "Run ruff linter and apply fixes" - args: ["--fix"] + name: 'Run ruff linter and apply fixes' + args: ['--fix'] - id: ruff-format - name: "Format Python code" - - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 - hooks: - - id: prettier - types_or: [javascript, vue, scss] - # Ignore any files that might contain jinja / bundles - exclude: | - (?x)^( - suppliers_portal/public/dist/.*| - .*node_modules.*| - .*boilerplate.*| - suppliers_portal/templates/includes/.*| - suppliers_portal/public/js/lib/.* - )$ - + name: 'Format Python code' - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.44.0 + rev: v8.56.0 hooks: - id: eslint types_or: [javascript] args: ['--quiet'] # Ignore any files that might contain jinja / bundles exclude: | - (?x)^( - suppliers_portal/public/dist/.*| - cypress/.*| - .*node_modules.*| - .*boilerplate.*| - suppliers_portal/templates/includes/.*| - suppliers_portal/public/js/lib/.* - )$ + (?x)^( + .*boilerplate.*| + .*node_modules.*| + cypress/.*| + suppliers_portal/public/dist/.*| + suppliers_portal/public/js/lib/.*| + suppliers_portal/public/supplier-portal/assets/.*| + suppliers_portal/templates/includes/.* + )$ + + - repo: local + hooks: + - id: prettier + name: prettier + entry: npx prettier -w . --config .prettierrc.cjs --ignore-path .prettierignore + language: system ci: - autoupdate_schedule: weekly - skip: [] - submodules: false + autoupdate_schedule: weekly + skip: [] + submodules: false diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..929a012 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,222 @@ +#------------------------------------------------------------------------------------------------------------------- +# Keep this section in sync with .gitignore +#------------------------------------------------------------------------------------------------------------------- + +*.pyc +*.py~ +*.comp.js +*.DS_Store +locale +.wnf-lang-status +*.swp +*.egg-info +dist/ +# build/ +suppliers_portal/docs/current +suppliers_portal/public/dist +suppliers_portal/public/supplier-portal/assets +.vscode +.vs +node_modules +.kdev4/ +*.kdev4 +*debug.log + +# Not Recommended, but will remove once webpack ready +package-lock.json + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +# build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ +.cypress-coverage + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +.static_storage/ +.media/ +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# next.js build output +.next + +# cypress +cypress/screenshots +cypress/videos + +# JetBrains IDEs +.idea/ + +#------------------------------------------------------------------------------------------------------------------- +# Prettier-specific overrides +#------------------------------------------------------------------------------------------------------------------- + + +# Package manager files +pnpm-lock.yaml +yarn.lock +package-lock.json +shrinkwrap.json + +# Build outputs +lib +.github + +# Prettier reformats code blocks inside Markdown, which affects rendered output +*.md + +# In a Frappe context HTML files are either Jinja or Resig's microtemplate format and should not be checked +*.html diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 0000000..eeb2d4e --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1,19 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: true, + embeddedLanguageFormatting: 'auto', + htmlWhitespaceSensitivity: 'css', + insertPragma: false, + jsxSingleQuote: false, + printWidth: 120, + proseWrap: 'preserve', + quoteProps: 'as-needed', + requirePragma: false, + semi: false, + singleQuote: true, + tabWidth: 2, + trailingComma: 'es5', + useTabs: true, + vueIndentScriptAndStyle: false, +} diff --git a/supplier-portal/.prettierrc.json b/supplier-portal/.prettierrc.json index b2095be..1ccc975 100644 --- a/supplier-portal/.prettierrc.json +++ b/supplier-portal/.prettierrc.json @@ -1,4 +1,4 @@ { - "semi": false, - "singleQuote": true + "semi": false, + "singleQuote": true } diff --git a/supplier-portal/package.json b/supplier-portal/package.json index 37960d0..55c5d73 100644 --- a/supplier-portal/package.json +++ b/supplier-portal/package.json @@ -1,26 +1,26 @@ { - "name": "frappe-ui-frontend", - "private": true, - "version": "0.0.0", - "scripts": { - "dev": "vite", - "build": "vite build --base=/assets/suppliers_portal/supplier-portal/ && yarn copy-html-entry", - "preview": "vite preview", - "copy-html-entry": "cp ../suppliers_portal/public/supplier-portal/index.html ../suppliers_portal/www/supplier-portal.html" - }, - "dependencies": { - "bootstrap": "5.2.3", - "bootstrap-icons": "^1.11.3", - "feather-icons": "^4.28.0", - "frappe-ui": "^0.1.69", - "vue": "^3.2.25", - "vue-router": "^4.0.12" - }, - "devDependencies": { - "@vitejs/plugin-vue": "^2.0.0", - "autoprefixer": "^10.4.2", - "postcss": "^8.4.5", - "tailwindcss": "^3.0.15", - "vite": "^2.7.2" - } + "name": "frappe-ui-frontend", + "private": true, + "version": "0.0.0", + "scripts": { + "dev": "vite", + "build": "vite build --base=/assets/suppliers_portal/supplier-portal/ && yarn copy-html-entry", + "preview": "vite preview", + "copy-html-entry": "cp ../suppliers_portal/public/supplier-portal/index.html ../suppliers_portal/www/supplier-portal.html" + }, + "dependencies": { + "bootstrap": "5.2.3", + "bootstrap-icons": "^1.11.3", + "feather-icons": "^4.28.0", + "frappe-ui": "^0.1.69", + "vue": "^3.2.25", + "vue-router": "^4.0.12" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^2.0.0", + "autoprefixer": "^10.4.2", + "postcss": "^8.4.5", + "tailwindcss": "^3.0.15", + "vite": "^2.7.2" + } } diff --git a/supplier-portal/postcss.config.js b/supplier-portal/postcss.config.js index 33ad091..1b69d43 100644 --- a/supplier-portal/postcss.config.js +++ b/supplier-portal/postcss.config.js @@ -1,6 +1,6 @@ module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, } diff --git a/supplier-portal/src/App.vue b/supplier-portal/src/App.vue index a14d0c3..eb1533e 100644 --- a/supplier-portal/src/App.vue +++ b/supplier-portal/src/App.vue @@ -1,5 +1,5 @@ diff --git a/supplier-portal/src/assets/Inter/inter.css b/supplier-portal/src/assets/Inter/inter.css index 3ca1bbf..8fca606 100644 --- a/supplier-portal/src/assets/Inter/inter.css +++ b/supplier-portal/src/assets/Inter/inter.css @@ -1,152 +1,170 @@ @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 100; - font-display: swap; - src: url("Inter-Thin.woff2?v=3.12") format("woff2"), - url("Inter-Thin.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 100; + font-display: swap; + src: + url('Inter-Thin.woff2?v=3.12') format('woff2'), + url('Inter-Thin.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 100; - font-display: swap; - src: url("Inter-ThinItalic.woff2?v=3.12") format("woff2"), - url("Inter-ThinItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 100; + font-display: swap; + src: + url('Inter-ThinItalic.woff2?v=3.12') format('woff2'), + url('Inter-ThinItalic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 200; - font-display: swap; - src: url("Inter-ExtraLight.woff2?v=3.12") format("woff2"), - url("Inter-ExtraLight.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 200; + font-display: swap; + src: + url('Inter-ExtraLight.woff2?v=3.12') format('woff2'), + url('Inter-ExtraLight.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 200; - font-display: swap; - src: url("Inter-ExtraLightItalic.woff2?v=3.12") format("woff2"), - url("Inter-ExtraLightItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 200; + font-display: swap; + src: + url('Inter-ExtraLightItalic.woff2?v=3.12') format('woff2'), + url('Inter-ExtraLightItalic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 300; - font-display: swap; - src: url("Inter-Light.woff2?v=3.12") format("woff2"), - url("Inter-Light.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 300; + font-display: swap; + src: + url('Inter-Light.woff2?v=3.12') format('woff2'), + url('Inter-Light.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 300; - font-display: swap; - src: url("Inter-LightItalic.woff2?v=3.12") format("woff2"), - url("Inter-LightItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 300; + font-display: swap; + src: + url('Inter-LightItalic.woff2?v=3.12') format('woff2'), + url('Inter-LightItalic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url("Inter-Regular.woff2?v=3.12") format("woff2"), - url("Inter-Regular.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: + url('Inter-Regular.woff2?v=3.12') format('woff2'), + url('Inter-Regular.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 400; - font-display: swap; - src: url("Inter-Italic.woff2?v=3.12") format("woff2"), - url("Inter-Italic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 400; + font-display: swap; + src: + url('Inter-Italic.woff2?v=3.12') format('woff2'), + url('Inter-Italic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 500; - font-display: swap; - src: url("Inter-Medium.woff2?v=3.12") format("woff2"), - url("Inter-Medium.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 500; + font-display: swap; + src: + url('Inter-Medium.woff2?v=3.12') format('woff2'), + url('Inter-Medium.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 500; - font-display: swap; - src: url("Inter-MediumItalic.woff2?v=3.12") format("woff2"), - url("Inter-MediumItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 500; + font-display: swap; + src: + url('Inter-MediumItalic.woff2?v=3.12') format('woff2'), + url('Inter-MediumItalic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 600; - font-display: swap; - src: url("Inter-SemiBold.woff2?v=3.12") format("woff2"), - url("Inter-SemiBold.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 600; + font-display: swap; + src: + url('Inter-SemiBold.woff2?v=3.12') format('woff2'), + url('Inter-SemiBold.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 600; - font-display: swap; - src: url("Inter-SemiBoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-SemiBoldItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 600; + font-display: swap; + src: + url('Inter-SemiBoldItalic.woff2?v=3.12') format('woff2'), + url('Inter-SemiBoldItalic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 700; - font-display: swap; - src: url("Inter-Bold.woff2?v=3.12") format("woff2"), - url("Inter-Bold.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 700; + font-display: swap; + src: + url('Inter-Bold.woff2?v=3.12') format('woff2'), + url('Inter-Bold.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 700; - font-display: swap; - src: url("Inter-BoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-BoldItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 700; + font-display: swap; + src: + url('Inter-BoldItalic.woff2?v=3.12') format('woff2'), + url('Inter-BoldItalic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 800; - font-display: swap; - src: url("Inter-ExtraBold.woff2?v=3.12") format("woff2"), - url("Inter-ExtraBold.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 800; + font-display: swap; + src: + url('Inter-ExtraBold.woff2?v=3.12') format('woff2'), + url('Inter-ExtraBold.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 800; - font-display: swap; - src: url("Inter-ExtraBoldItalic.woff2?v=3.12") format("woff2"), - url("Inter-ExtraBoldItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 800; + font-display: swap; + src: + url('Inter-ExtraBoldItalic.woff2?v=3.12') format('woff2'), + url('Inter-ExtraBoldItalic.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 900; - font-display: swap; - src: url("Inter-Black.woff2?v=3.12") format("woff2"), - url("Inter-Black.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: normal; + font-weight: 900; + font-display: swap; + src: + url('Inter-Black.woff2?v=3.12') format('woff2'), + url('Inter-Black.woff?v=3.12') format('woff'); } @font-face { - font-family: 'Inter'; - font-style: italic; - font-weight: 900; - font-display: swap; - src: url("Inter-BlackItalic.woff2?v=3.12") format("woff2"), - url("Inter-BlackItalic.woff?v=3.12") format("woff"); + font-family: 'Inter'; + font-style: italic; + font-weight: 900; + font-display: swap; + src: + url('Inter-BlackItalic.woff2?v=3.12') format('woff2'), + url('Inter-BlackItalic.woff?v=3.12') format('woff'); } diff --git a/supplier-portal/src/data/session.js b/supplier-portal/src/data/session.js index 46f3e59..8c213b7 100644 --- a/supplier-portal/src/data/session.js +++ b/supplier-portal/src/data/session.js @@ -5,87 +5,87 @@ import { createResource } from 'frappe-ui' import { userResource } from './user' export function sessionUser() { - const cookies = new URLSearchParams(document.cookie.split('; ').join('&')) - let _sessionUser = cookies.get('user_id') - if (_sessionUser === 'Guest') { - _sessionUser = null - } - return _sessionUser + const cookies = new URLSearchParams(document.cookie.split('; ').join('&')) + let _sessionUser = cookies.get('user_id') + if (_sessionUser === 'Guest') { + _sessionUser = null + } + return _sessionUser } export function sessionSupplierId() { - const cookies = new URLSearchParams(document.cookie.split('; ').join('&')) - return cookies.get('supplier_id') + const cookies = new URLSearchParams(document.cookie.split('; ').join('&')) + return cookies.get('supplier_id') } export function sessionSupplierName() { - const cookies = new URLSearchParams(document.cookie.split('; ').join('&')) - return cookies.get('supplier_name') + const cookies = new URLSearchParams(document.cookie.split('; ').join('&')) + return cookies.get('supplier_name') } export const session = reactive({ - supplier_login: createResource({ - url: 'suppliers_portal.suppliers_portal.api.validate_supplier_id', - makeParams({ supplier_id }) { - return { - supplier_id, - } - }, - onSuccess(data) { - if (data && data.status === 'success') { - userResource.reload() - session.user = sessionUser() - document.cookie = `supplier_id=${data.supplier_id}` - document.cookie = `supplier_name=${data.supplier_name}` - session.supplier_id = data.supplier_id - session.supplier_name = data.supplier_name - session.login.reset() - router.replace({ name: 'SupplierInvoiceList' }) - } - }, - onError(error) { - console.error('Login failed', error) - }, - }), - login: createResource({ - url: 'login', - makeParams({ email, password }) { - return { - usr: email, - pwd: password, - } - }, - onSuccess(data) { - if (data) { - userResource.reload() - session.user = sessionUser() - // clear supplier_id and supplier_name - document.cookie = `supplier_id=${session.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`; - document.cookie = `supplier_id=${session.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`; - session.supplier_id = '' - session.supplier_name = '' - session.login.reset() - router.replace({ name: 'SupplierInvoiceList' }) - } - }, - onError(error) { - console.error('Login failed', error) - }, - }), - logout: createResource({ - url: 'logout', - onSuccess() { - document.cookie = `supplier_id=${session.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`; - document.cookie = `supplier_id=${session.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`; - session.supplier_id = '' - session.supplier_name = '' - userResource.reset() - session.user = sessionUser() - router.replace({ name: 'Login' }) - }, - }), - user: sessionUser(), - supplier_id: sessionSupplierId(), - supplier_name: sessionSupplierName(), - isLoggedIn: computed(() => !!session.user), -}) \ No newline at end of file + supplier_login: createResource({ + url: 'suppliers_portal.suppliers_portal.api.validate_supplier_id', + makeParams({ supplier_id }) { + return { + supplier_id, + } + }, + onSuccess(data) { + if (data && data.status === 'success') { + userResource.reload() + session.user = sessionUser() + document.cookie = `supplier_id=${data.supplier_id}` + document.cookie = `supplier_name=${data.supplier_name}` + session.supplier_id = data.supplier_id + session.supplier_name = data.supplier_name + session.login.reset() + router.replace({ name: 'SupplierInvoiceList' }) + } + }, + onError(error) { + console.error('Login failed', error) + }, + }), + login: createResource({ + url: 'login', + makeParams({ email, password }) { + return { + usr: email, + pwd: password, + } + }, + onSuccess(data) { + if (data) { + userResource.reload() + session.user = sessionUser() + // clear supplier_id and supplier_name + document.cookie = `supplier_id=${session.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'` + document.cookie = `supplier_id=${session.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'` + session.supplier_id = '' + session.supplier_name = '' + session.login.reset() + router.replace({ name: 'SupplierInvoiceList' }) + } + }, + onError(error) { + console.error('Login failed', error) + }, + }), + logout: createResource({ + url: 'logout', + onSuccess() { + document.cookie = `supplier_id=${session.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'` + document.cookie = `supplier_id=${session.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'` + session.supplier_id = '' + session.supplier_name = '' + userResource.reset() + session.user = sessionUser() + router.replace({ name: 'Login' }) + }, + }), + user: sessionUser(), + supplier_id: sessionSupplierId(), + supplier_name: sessionSupplierName(), + isLoggedIn: computed(() => !!session.user), +}) diff --git a/supplier-portal/src/data/user.js b/supplier-portal/src/data/user.js index 876b359..95766d5 100644 --- a/supplier-portal/src/data/user.js +++ b/supplier-portal/src/data/user.js @@ -2,11 +2,11 @@ import router from '@/router' import { createResource } from 'frappe-ui' export const userResource = createResource({ - url: 'frappe.auth.get_logged_user', - cache: 'User', - onError(error) { - if (error && error.exc_type === 'AuthenticationError') { - router.push({ name: 'LoginPage' }) - } - }, -}) \ No newline at end of file + url: 'frappe.auth.get_logged_user', + cache: 'User', + onError(error) { + if (error && error.exc_type === 'AuthenticationError') { + router.push({ name: 'LoginPage' }) + } + }, +}) diff --git a/supplier-portal/src/data/utils.js b/supplier-portal/src/data/utils.js index 8f4d55c..9adaf5b 100644 --- a/supplier-portal/src/data/utils.js +++ b/supplier-portal/src/data/utils.js @@ -1,22 +1,22 @@ export const addDays = (date, days) => { - const result = new Date(date); - result.setDate(result.getDate() + days); - return result; + const result = new Date(date) + result.setDate(result.getDate() + days) + return result } -export const parseInvoiceTerms = (invoiceTerm) => { - switch (invoiceTerm) { - case 'NET 10': - return 10; - case 'NET 15': - return 15; - case 'NET 30': - return 30; - case 'NET 45': - return 45; - case 'NET 60': - return 60; - default: - return 0; - } -} \ No newline at end of file +export const parseInvoiceTerms = invoiceTerm => { + switch (invoiceTerm) { + case 'NET 10': + return 10 + case 'NET 15': + return 15 + case 'NET 30': + return 30 + case 'NET 45': + return 45 + case 'NET 60': + return 60 + default: + return 0 + } +} diff --git a/supplier-portal/src/main.js b/supplier-portal/src/main.js index 3420fdd..aec5d08 100644 --- a/supplier-portal/src/main.js +++ b/supplier-portal/src/main.js @@ -7,16 +7,7 @@ import 'bootstrap/dist/css/bootstrap.min.css' import 'bootstrap' import 'bootstrap-icons/font/bootstrap-icons.css' - - -import { - Button, - Card, - Input, - setConfig, - frappeRequest, - resourcesPlugin, -} from 'frappe-ui' +import { Button, Card, Input, setConfig, frappeRequest, resourcesPlugin } from 'frappe-ui' let app = createApp(App) @@ -29,4 +20,4 @@ app.component('Button', Button) app.component('Card', Card) app.component('Input', Input) -app.mount('#app') \ No newline at end of file +app.mount('#app') diff --git a/supplier-portal/src/pages/Login.vue b/supplier-portal/src/pages/Login.vue index 950fe8a..8a0d079 100644 --- a/supplier-portal/src/pages/Login.vue +++ b/supplier-portal/src/pages/Login.vue @@ -4,29 +4,11 @@
- - + +
- +
diff --git a/supplier-portal/src/pages/NewInvoice.vue b/supplier-portal/src/pages/NewInvoice.vue index d71b401..fb0a40c 100644 --- a/supplier-portal/src/pages/NewInvoice.vue +++ b/supplier-portal/src/pages/NewInvoice.vue @@ -12,13 +12,7 @@ - +
@@ -29,24 +23,19 @@
- +
+ v-model.number="invoiceData.supplier_invoice_number" />
- +
+ v-model="invoiceData.service_date" />
@@ -65,25 +53,20 @@
- +
+ v-model="invoiceData.supplier" />
- +
+ v-model="invoiceData.invoice_date" />
@@ -102,9 +84,7 @@
- +
+ v-if="!isAdministrator" /> + v-else />
- +
@@ -153,9 +125,7 @@
- +
+ v-model="invoiceDueDate" />
@@ -182,80 +151,43 @@ data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" - aria-controls="collapseOne" - > + aria-controls="collapseOne"> Service Address
+ data-bs-parent="#service-address-accordion">
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
@@ -273,21 +205,14 @@ data-bs-toggle="collapse" data-bs-target="#collapse-2" aria-expanded="true" - aria-controls="collapse-2" - > + aria-controls="collapse-2"> Notes -
+
- +