Compare commits
12 Commits
dev
...
split_fron
Author | SHA1 | Date | |
---|---|---|---|
1f22538b15 | |||
db4806b7d2 | |||
55c582084f | |||
12a0ef71d0 | |||
ab9baa992f | |||
7ab8df0f24 | |||
eb97abee7f | |||
a92383f7d0 | |||
ae44aaf59d | |||
7c6d5c41d2 | |||
b16c7d2636 | |||
17d98ae277 |
187
.gitignore
vendored
187
.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
datas/
|
||||
|
||||
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
@@ -23,4 +26,186 @@ pnpm-debug.log*
|
||||
*.sw?
|
||||
|
||||
#Electron-builder output
|
||||
/dist_electron
|
||||
/dist_electron# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-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/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# 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/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
41
backend/Dockerfile
Normal file
41
backend/Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
||||
FROM python:3.11.3-alpine3.18 as python-base
|
||||
|
||||
# https://python-poetry.org/docs#ci-recommendations
|
||||
ENV POETRY_VERSION=1.5.1
|
||||
ENV POETRY_HOME=/opt/poetry
|
||||
ENV POETRY_VENV=/opt/poetry-venv
|
||||
|
||||
# Tell Poetry where to place its cache and virtual environment
|
||||
ENV POETRY_CACHE_DIR=/opt/.cache
|
||||
|
||||
# Create stage for Poetry installation
|
||||
FROM python-base as poetry-base
|
||||
|
||||
# Creating a virtual environment just for poetry and install it with pip
|
||||
RUN python3 -m venv $POETRY_VENV \
|
||||
&& $POETRY_VENV/bin/pip install -U pip setuptools \
|
||||
&& $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION}
|
||||
|
||||
# Create a new stage from the base python image
|
||||
FROM python-base as set_poetry
|
||||
|
||||
# Copy Poetry to app image
|
||||
COPY --from=poetry-base ${POETRY_VENV} ${POETRY_VENV}
|
||||
|
||||
# Add Poetry to PATH
|
||||
ENV PATH="${PATH}:${POETRY_VENV}/bin"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy Dependencies
|
||||
COPY poetry.lock pyproject.toml ./
|
||||
|
||||
# [OPTIONAL] Validate the project is properly configured
|
||||
RUN poetry check
|
||||
RUN poetry install
|
||||
|
||||
FROM set_poetry as app_ready
|
||||
|
||||
#EXPOSE 80
|
||||
COPY src/ src
|
||||
CMD ["poetry", "run", "uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
203
backend/poetry.lock
generated
Normal file
203
backend/poetry.lock
generated
Normal file
@@ -0,0 +1,203 @@
|
||||
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "anyio"
|
||||
version = "3.7.0"
|
||||
description = "High level compatibility layer for multiple asynchronous event loop implementations"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "anyio-3.7.0-py3-none-any.whl", hash = "sha256:eddca883c4175f14df8aedce21054bfca3adb70ffe76a9f607aef9d7fa2ea7f0"},
|
||||
{file = "anyio-3.7.0.tar.gz", hash = "sha256:275d9973793619a5374e1c89a4f4ad3f4b0a5510a2b5b939444bee8f4c4d37ce"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
idna = ">=2.8"
|
||||
sniffio = ">=1.1"
|
||||
|
||||
[package.extras]
|
||||
doc = ["Sphinx (>=6.1.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme", "sphinxcontrib-jquery"]
|
||||
test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"]
|
||||
trio = ["trio (<0.22)"]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.1.3"
|
||||
description = "Composable command line interface toolkit"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
|
||||
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
description = "Cross-platform colored terminal text."
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||
files = [
|
||||
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
||||
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastapi"
|
||||
version = "0.96.0"
|
||||
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "fastapi-0.96.0-py3-none-any.whl", hash = "sha256:b8e11fe81e81eab4e1504209917338e0b80f783878a42c2b99467e5e1019a1e9"},
|
||||
{file = "fastapi-0.96.0.tar.gz", hash = "sha256:71232d47c2787446991c81c41c249f8a16238d52d779c0e6b43927d3773dbe3c"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
pydantic = ">=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0"
|
||||
starlette = ">=0.27.0,<0.28.0"
|
||||
|
||||
[package.extras]
|
||||
all = ["email-validator (>=1.1.1)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"]
|
||||
dev = ["pre-commit (>=2.17.0,<3.0.0)", "ruff (==0.0.138)", "uvicorn[standard] (>=0.12.0,<0.21.0)"]
|
||||
doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer-cli (>=0.0.13,<0.0.14)", "typer[all] (>=0.6.1,<0.8.0)"]
|
||||
test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6.5.0,<8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.7)", "pyyaml (>=5.3.1,<7.0.0)", "ruff (==0.0.138)", "sqlalchemy (>=1.3.18,<1.4.43)", "types-orjson (==3.6.2)", "types-ujson (==5.7.0.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "h11"
|
||||
version = "0.14.0"
|
||||
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
|
||||
{file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "3.4"
|
||||
description = "Internationalized Domain Names in Applications (IDNA)"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
files = [
|
||||
{file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"},
|
||||
{file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "1.10.8"
|
||||
description = "Data validation and settings management using python type hints"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "pydantic-1.10.8-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1243d28e9b05003a89d72e7915fdb26ffd1d39bdd39b00b7dbe4afae4b557f9d"},
|
||||
{file = "pydantic-1.10.8-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c0ab53b609c11dfc0c060d94335993cc2b95b2150e25583bec37a49b2d6c6c3f"},
|
||||
{file = "pydantic-1.10.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9613fadad06b4f3bc5db2653ce2f22e0de84a7c6c293909b48f6ed37b83c61f"},
|
||||
{file = "pydantic-1.10.8-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:df7800cb1984d8f6e249351139667a8c50a379009271ee6236138a22a0c0f319"},
|
||||
{file = "pydantic-1.10.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:0c6fafa0965b539d7aab0a673a046466d23b86e4b0e8019d25fd53f4df62c277"},
|
||||
{file = "pydantic-1.10.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e82d4566fcd527eae8b244fa952d99f2ca3172b7e97add0b43e2d97ee77f81ab"},
|
||||
{file = "pydantic-1.10.8-cp310-cp310-win_amd64.whl", hash = "sha256:ab523c31e22943713d80d8d342d23b6f6ac4b792a1e54064a8d0cf78fd64e800"},
|
||||
{file = "pydantic-1.10.8-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:666bdf6066bf6dbc107b30d034615d2627e2121506c555f73f90b54a463d1f33"},
|
||||
{file = "pydantic-1.10.8-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:35db5301b82e8661fa9c505c800d0990bc14e9f36f98932bb1d248c0ac5cada5"},
|
||||
{file = "pydantic-1.10.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f90c1e29f447557e9e26afb1c4dbf8768a10cc676e3781b6a577841ade126b85"},
|
||||
{file = "pydantic-1.10.8-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93e766b4a8226e0708ef243e843105bf124e21331694367f95f4e3b4a92bbb3f"},
|
||||
{file = "pydantic-1.10.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:88f195f582851e8db960b4a94c3e3ad25692c1c1539e2552f3df7a9e972ef60e"},
|
||||
{file = "pydantic-1.10.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:34d327c81e68a1ecb52fe9c8d50c8a9b3e90d3c8ad991bfc8f953fb477d42fb4"},
|
||||
{file = "pydantic-1.10.8-cp311-cp311-win_amd64.whl", hash = "sha256:d532bf00f381bd6bc62cabc7d1372096b75a33bc197a312b03f5838b4fb84edd"},
|
||||
{file = "pydantic-1.10.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:7d5b8641c24886d764a74ec541d2fc2c7fb19f6da2a4001e6d580ba4a38f7878"},
|
||||
{file = "pydantic-1.10.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7b1f6cb446470b7ddf86c2e57cd119a24959af2b01e552f60705910663af09a4"},
|
||||
{file = "pydantic-1.10.8-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c33b60054b2136aef8cf190cd4c52a3daa20b2263917c49adad20eaf381e823b"},
|
||||
{file = "pydantic-1.10.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1952526ba40b220b912cdc43c1c32bcf4a58e3f192fa313ee665916b26befb68"},
|
||||
{file = "pydantic-1.10.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:bb14388ec45a7a0dc429e87def6396f9e73c8c77818c927b6a60706603d5f2ea"},
|
||||
{file = "pydantic-1.10.8-cp37-cp37m-win_amd64.whl", hash = "sha256:16f8c3e33af1e9bb16c7a91fc7d5fa9fe27298e9f299cff6cb744d89d573d62c"},
|
||||
{file = "pydantic-1.10.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1ced8375969673929809d7f36ad322934c35de4af3b5e5b09ec967c21f9f7887"},
|
||||
{file = "pydantic-1.10.8-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93e6bcfccbd831894a6a434b0aeb1947f9e70b7468f274154d03d71fabb1d7c6"},
|
||||
{file = "pydantic-1.10.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:191ba419b605f897ede9892f6c56fb182f40a15d309ef0142212200a10af4c18"},
|
||||
{file = "pydantic-1.10.8-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:052d8654cb65174d6f9490cc9b9a200083a82cf5c3c5d3985db765757eb3b375"},
|
||||
{file = "pydantic-1.10.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ceb6a23bf1ba4b837d0cfe378329ad3f351b5897c8d4914ce95b85fba96da5a1"},
|
||||
{file = "pydantic-1.10.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6f2e754d5566f050954727c77f094e01793bcb5725b663bf628fa6743a5a9108"},
|
||||
{file = "pydantic-1.10.8-cp38-cp38-win_amd64.whl", hash = "sha256:6a82d6cda82258efca32b40040228ecf43a548671cb174a1e81477195ed3ed56"},
|
||||
{file = "pydantic-1.10.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3e59417ba8a17265e632af99cc5f35ec309de5980c440c255ab1ca3ae96a3e0e"},
|
||||
{file = "pydantic-1.10.8-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:84d80219c3f8d4cad44575e18404099c76851bc924ce5ab1c4c8bb5e2a2227d0"},
|
||||
{file = "pydantic-1.10.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e4148e635994d57d834be1182a44bdb07dd867fa3c2d1b37002000646cc5459"},
|
||||
{file = "pydantic-1.10.8-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:12f7b0bf8553e310e530e9f3a2f5734c68699f42218bf3568ef49cd9b0e44df4"},
|
||||
{file = "pydantic-1.10.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:42aa0c4b5c3025483240a25b09f3c09a189481ddda2ea3a831a9d25f444e03c1"},
|
||||
{file = "pydantic-1.10.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:17aef11cc1b997f9d574b91909fed40761e13fac438d72b81f902226a69dac01"},
|
||||
{file = "pydantic-1.10.8-cp39-cp39-win_amd64.whl", hash = "sha256:66a703d1983c675a6e0fed8953b0971c44dba48a929a2000a493c3772eb61a5a"},
|
||||
{file = "pydantic-1.10.8-py3-none-any.whl", hash = "sha256:7456eb22ed9aaa24ff3e7b4757da20d9e5ce2a81018c1b3ebd81a0b88a18f3b2"},
|
||||
{file = "pydantic-1.10.8.tar.gz", hash = "sha256:1410275520dfa70effadf4c21811d755e7ef9bb1f1d077a21958153a92c8d9ca"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
typing-extensions = ">=4.2.0"
|
||||
|
||||
[package.extras]
|
||||
dotenv = ["python-dotenv (>=0.10.4)"]
|
||||
email = ["email-validator (>=1.0.3)"]
|
||||
|
||||
[[package]]
|
||||
name = "sniffio"
|
||||
version = "1.3.0"
|
||||
description = "Sniff out which async library your code is running under"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "sniffio-1.3.0-py3-none-any.whl", hash = "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"},
|
||||
{file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "starlette"
|
||||
version = "0.27.0"
|
||||
description = "The little ASGI library that shines."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "starlette-0.27.0-py3-none-any.whl", hash = "sha256:918416370e846586541235ccd38a474c08b80443ed31c578a418e2209b3eef91"},
|
||||
{file = "starlette-0.27.0.tar.gz", hash = "sha256:6a6b0d042acb8d469a01eba54e9cda6cbd24ac602c4cd016723117d6a7e73b75"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
anyio = ">=3.4.0,<5"
|
||||
|
||||
[package.extras]
|
||||
full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart", "pyyaml"]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.6.3"
|
||||
description = "Backported and Experimental Type Hints for Python 3.7+"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "typing_extensions-4.6.3-py3-none-any.whl", hash = "sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26"},
|
||||
{file = "typing_extensions-4.6.3.tar.gz", hash = "sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uvicorn"
|
||||
version = "0.22.0"
|
||||
description = "The lightning-fast ASGI server."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "uvicorn-0.22.0-py3-none-any.whl", hash = "sha256:e9434d3bbf05f310e762147f769c9f21235ee118ba2d2bf1155a7196448bd996"},
|
||||
{file = "uvicorn-0.22.0.tar.gz", hash = "sha256:79277ae03db57ce7d9aa0567830bbb51d7a612f54d6e1e3e92da3ef24c2c8ed8"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
click = ">=7.0"
|
||||
h11 = ">=0.8"
|
||||
|
||||
[package.extras]
|
||||
standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1)", "watchfiles (>=0.13)", "websockets (>=10.4)"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.11"
|
||||
content-hash = "81c4b61a51cfa2f7aa8f9b8b7853c84ebe27eec96f74a20dd533cd585ae13036"
|
16
backend/pyproject.toml
Normal file
16
backend/pyproject.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[tool.poetry]
|
||||
name = "sousmargot"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Bertrand Benjamin <benjamin.bertrand@opytex.org>"]
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
fastapi = "^0.96.0"
|
||||
uvicorn = "^0.22.0"
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
0
backend/src/__init__.py
Normal file
0
backend/src/__init__.py
Normal file
20
backend/src/api/main.py
Normal file
20
backend/src/api/main.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from ..months import retreive_months
|
||||
from ..config import config
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["http://localhost:8080"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
@app.get("/months")
|
||||
async def get_months():
|
||||
return retreive_months(config["datapath"])
|
9
backend/src/config.py
Normal file
9
backend/src/config.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import os
|
||||
|
||||
config = {}
|
||||
|
||||
try:
|
||||
config["datapath"] = os.environ["DATASPATH"]
|
||||
except KeyError:
|
||||
config["datapath"] = "/datas"
|
||||
|
28
backend/src/months.py
Normal file
28
backend/src/months.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from pathlib import Path
|
||||
import csv
|
||||
|
||||
CSV_STYLE = {
|
||||
"delimiter": ",",
|
||||
"quotechar": '"',
|
||||
}
|
||||
|
||||
def list_month_files(path:str, file_schema:str="*_months.csv") -> list[Path]:
|
||||
print(list(Path(path).glob("*")))
|
||||
return list(Path(path).glob(file_schema))
|
||||
|
||||
def extract_month(filename:Path) -> list[dict[str,str]]:
|
||||
months = []
|
||||
with open(filename, 'r', newline='') as csvfile:
|
||||
month_reader = csv.DictReader(csvfile, **CSV_STYLE)
|
||||
for month in month_reader:
|
||||
months.append(month)
|
||||
return months
|
||||
|
||||
|
||||
|
||||
def retreive_months(path:str):
|
||||
month_files = list_month_files(path)
|
||||
months = []
|
||||
for file in month_files:
|
||||
months += extract_month(file)
|
||||
return months
|
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
back:
|
||||
build: ./backend
|
||||
ports:
|
||||
- 8000:8000
|
18
docker-compose_live.yml
Normal file
18
docker-compose_live.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
back:
|
||||
build: ./backend
|
||||
ports:
|
||||
- 8000:8000
|
||||
volumes:
|
||||
- ./backend/src:/app/src
|
||||
- ./datas:/datas
|
||||
|
||||
frontend:
|
||||
build: ./front
|
||||
volumes:
|
||||
- './front:/app'
|
||||
ports:
|
||||
- 8080:8080
|
15
front/Dockerfile
Normal file
15
front/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM node:lts-alpine3.18 as node-base
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV PATH /app/node_modules/.bin:$PATH
|
||||
FROM node-base as node-prepared
|
||||
|
||||
RUN npm install @vue/cli@5.0.8 -g
|
||||
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
RUN yarn install
|
||||
FROM node-prepared as vue-set
|
||||
|
||||
CMD ["yarn", "serve"]
|
@@ -1,4 +1,4 @@
|
||||
# sousmargot
|
||||
# front
|
||||
|
||||
## Project setup
|
||||
```
|
19
front/jsconfig.json
Normal file
19
front/jsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
47
front/package.json
Normal file
47
front/package.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.4.0",
|
||||
"core-js": "^3.8.3",
|
||||
"vue": "^3.2.13",
|
||||
"vue-router": "^4.0.3",
|
||||
"vuex": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/eslint-parser": "^7.12.16",
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||
"@vue/cli-plugin-router": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^8.0.3"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/vue3-essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "@babel/eslint-parser"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead",
|
||||
"not ie 11"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
15
front/src/App.vue
Normal file
15
front/src/App.vue
Normal file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
</style>
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
33
front/src/components/HelloWorld.vue
Normal file
33
front/src/components/HelloWorld.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div>
|
||||
<p>{{ msg }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
name: 'HelloWolrd',
|
||||
data() {
|
||||
return {
|
||||
msg: '',
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getMessage() {
|
||||
axios.get('/months')
|
||||
.then((res) => {
|
||||
this.msg = res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getMessage();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
14
front/src/main.js
Normal file
14
front/src/main.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { createApp } from 'vue'
|
||||
import axios from 'axios';
|
||||
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
axios.defaults.withCredentials = true;
|
||||
axios.defaults.baseURL = 'http://localhost:8000/';
|
||||
|
||||
app.use(router);
|
||||
app.mount('#app');
|
17
front/src/router/index.js
Normal file
17
front/src/router/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import HomeView from '../views/HomeView.vue'
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: HomeView
|
||||
},
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(process.env.BASE_URL),
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
18
front/src/views/HomeView.vue
Normal file
18
front/src/views/HomeView.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<img alt="Vue logo" src="../assets/logo.png">
|
||||
<HelloWorld msg="Welcome to Your Vue.js App"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// @ is an alias to /src
|
||||
import HelloWorld from '@/components/HelloWorld.vue'
|
||||
|
||||
export default {
|
||||
name: 'HomeView',
|
||||
components: {
|
||||
HelloWorld
|
||||
}
|
||||
}
|
||||
</script>
|
4
front/vue.config.js
Normal file
4
front/vue.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true
|
||||
})
|
6234
front/yarn.lock
Normal file
6234
front/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"vue"
|
||||
]
|
34672
package-lock.json
generated
34672
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
56
package.json
56
package.json
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"name": "sousmargot",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint",
|
||||
"electron:build": "vue-cli-service electron:build",
|
||||
"electron:serve": "vue-cli-service electron:serve",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"postuninstall": "electron-builder install-app-deps"
|
||||
},
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"chart.js": "2.9.4",
|
||||
"core-js": "^3.6.5",
|
||||
"date-fns": "^2.23.0",
|
||||
"papaparse": "^5.3.1",
|
||||
"vls": "^0.7.4",
|
||||
"vue": "^3.0.0",
|
||||
"vue-router": "^4.0.8",
|
||||
"vuex": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"@vue/compiler-sfc": "^3.0.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"electron": "^13.1.1",
|
||||
"electron-devtools-installer": "^3.1.0",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-vue": "^7.0.0",
|
||||
"vue-cli-plugin-electron-builder": "~2.0.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/vue3-essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
@@ -1 +0,0 @@
|
||||
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-cog" class="svg-inline--fa fa-user-cog fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M610.5 373.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 400.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm201.2 226.5c-2.3-1.2-4.6-2.6-6.8-3.9l-7.9 4.6c-6 3.4-12.8 5.3-19.6 5.3-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-5.5-17.7 1.9-36.4 17.9-45.7l7.9-4.6c-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-16-9.2-23.4-28-17.9-45.7.9-2.9 2.2-5.8 3.2-8.7-3.8-.3-7.5-1.2-11.4-1.2h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c10.1 0 19.5-3.2 27.2-8.5-1.2-3.8-2-7.7-2-11.8v-9.2z"></path></svg>
|
Before Width: | Height: | Size: 1.5 KiB |
20
src/App.vue
20
src/App.vue
@@ -1,20 +0,0 @@
|
||||
<template>
|
||||
<Nav></Nav>
|
||||
<div class="content">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Nav from './components/nav.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
Nav
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
@@ -1,84 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
import { app, protocol, BrowserWindow } from 'electron'
|
||||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
|
||||
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
|
||||
// Scheme must be registered before the app is ready
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
{ scheme: 'app', privileges: { secure: true, standard: true } }
|
||||
])
|
||||
|
||||
async function createWindow() {
|
||||
// Create the browser window.
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
|
||||
// Use pluginOptions.nodeIntegration, leave this alone
|
||||
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
|
||||
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
|
||||
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
|
||||
}
|
||||
})
|
||||
|
||||
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||
// Load the url of the dev server if in development mode
|
||||
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
|
||||
if (!process.env.IS_TEST) win.webContents.openDevTools()
|
||||
} else {
|
||||
createProtocol('app')
|
||||
// Load the index.html when not in development
|
||||
win.loadURL('app://./index.html')
|
||||
}
|
||||
}
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', async () => {
|
||||
if (isDevelopment && !process.env.IS_TEST) {
|
||||
// Install Vue Devtools
|
||||
try {
|
||||
//await installExtension(VUEJS_DEVTOOLS)
|
||||
// vuedev tools for vue3
|
||||
await installExtension('ljjemllljcmogpfapbkkighbhhppjdbg')
|
||||
} catch (e) {
|
||||
console.error('Vue Devtools failed to install:', e.toString())
|
||||
}
|
||||
}
|
||||
createWindow()
|
||||
})
|
||||
|
||||
// Exit cleanly on request from parent process in development mode.
|
||||
if (isDevelopment) {
|
||||
if (process.platform === 'win32') {
|
||||
process.on('message', (data) => {
|
||||
if (data === 'graceful-exit') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
process.on('SIGTERM', () => {
|
||||
app.quit()
|
||||
})
|
||||
}
|
||||
}
|
@@ -1,145 +0,0 @@
|
||||
<template>
|
||||
<div class="toolbar">
|
||||
<button v-show='!addingMonth' @click='toggleAdding'>
|
||||
Ajouter {{ formatedDate }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="boxed-green month-presentation" id="new-month" v-show='addingMonth'>
|
||||
<div class="date">
|
||||
<div class="month">
|
||||
{{ theMonth }}
|
||||
</div>
|
||||
<div class="year">
|
||||
{{ theYear }}
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="validate" @click="save"> Valider </button>
|
||||
<button class="cancel" @click="cancel"> Annuler </button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="datas">
|
||||
<li v-for="cara in description" :key='cara.name'>
|
||||
<label :for='cara.name'>{{ cara.label }}</label>
|
||||
<input type="number" v-model.number="monthCopy[cara.name]" id="cara.name" class="value">
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import { parseISO, addMonths, format } from 'date-fns'
|
||||
import frLocal from 'date-fns/locale/fr'
|
||||
|
||||
export default {
|
||||
name: 'NewMonth',
|
||||
props: {
|
||||
},
|
||||
components: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
monthDate: new Date(),
|
||||
monthCopy: Object,
|
||||
addingMonth: false,
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.monthCopy = this.theEmptyMonth
|
||||
},
|
||||
watch: {
|
||||
lastMonthDate: function () {
|
||||
if (this.lastMonthDate) {
|
||||
this.monthDate = addMonths(parseISO(this.lastMonthDate, "yyyy-MM", new Date()), 1)
|
||||
} else {
|
||||
this.monthDate = new Date()
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('travail', {
|
||||
'theEmptyMonth': 'TheEmptyMonth',
|
||||
'lastMonthDate': 'lastMonthDate',
|
||||
}),
|
||||
...mapGetters('config', {
|
||||
'description': 'descEditable',
|
||||
}),
|
||||
formatedDate: function () {
|
||||
return format(this.monthDate, "MMMM YYY", {locale: frLocal} )
|
||||
},
|
||||
theMonth: function () {
|
||||
return format(this.monthDate, "MMM", {locale: frLocal})
|
||||
},
|
||||
theYear: function () {
|
||||
return format(this.monthDate, "YYY", {locale: frLocal})
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions('travail', {
|
||||
'createMonth': 'createMonth',
|
||||
}),
|
||||
...mapActions('config', {
|
||||
'writeData': 'writeData',
|
||||
}),
|
||||
toggleAdding: function () {
|
||||
this.addingMonth = !this.addingMonth
|
||||
},
|
||||
save: function () {
|
||||
console.log("save")
|
||||
console.log(this.monthCopy)
|
||||
this.createMonth({date: format(this.monthDate, "yyyy-MM"), month: this.monthCopy})
|
||||
this.toggleAdding()
|
||||
this.writeData()
|
||||
},
|
||||
cancel: function () {
|
||||
this.toggleAdding()
|
||||
this.monthCopy = this.theEmptyMonth
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
.month-presentation {
|
||||
display: grid;
|
||||
grid-template-columns: 140px 1fr;
|
||||
}
|
||||
.month-presentation > * {
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.date > input {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
display: inline-flex;
|
||||
width: 6rem;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
li {
|
||||
margin: 3px;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
label{
|
||||
text-align: right;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.value {
|
||||
font-weight: bold;
|
||||
}
|
||||
.toolbar {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
@@ -1,69 +0,0 @@
|
||||
<template>
|
||||
<form>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="ca-theo">CA théorique</label>
|
||||
<input type="number" id="ca-theo">
|
||||
</li>
|
||||
<li>
|
||||
<label for="ca-retro">CA rétrocession</label>
|
||||
<input type="number" id="ca-retro">
|
||||
</li>
|
||||
<li>
|
||||
<label for="ca-react">CA réactualisé</label>
|
||||
<input type="number" id="ca-react">
|
||||
</li>
|
||||
<li>
|
||||
<label for="nbr-seance">Nombre de séances effectuées</label>
|
||||
<input type="number" id="nbr-seance">
|
||||
</li>
|
||||
<li>
|
||||
<label for="retro">Montant de la rétrocession</label>
|
||||
<input type="number" id="retro">
|
||||
</li>
|
||||
<li>
|
||||
<label for="remumeration">Rémunération effectuée</label>
|
||||
<input type="number" id="remumeration">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'MonthForm',
|
||||
props: {
|
||||
editMonth: {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
TheEmpty: "travail/TheEmptyMonth",
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
li {
|
||||
margin: 3px;
|
||||
width: 30%;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
li > label {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
input {
|
||||
width: 4em;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
</style>
|
@@ -1,146 +0,0 @@
|
||||
<template>
|
||||
<div class="month-presentation">
|
||||
<div id="date">
|
||||
<div class="month">
|
||||
{{ theMonth }}
|
||||
</div>
|
||||
<div class="year">
|
||||
{{ theYear }}
|
||||
</div>
|
||||
<div>
|
||||
<button class="edit" @click="toggleEdit" v-show="!editing"> Mettre à jour </button>
|
||||
<button class="validate" @click="save" v-show="editing"> Valider </button>
|
||||
<button class="cancel" @click="cancel" v-show="editing"> Annuler </button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="display" v-show="!editing">
|
||||
<div class="hightlight" v-for="cara in descHightlights" :key='cara.name'>
|
||||
<label :for='cara.name'>{{ cara.label }}</label>
|
||||
<span class="value" >{{ cara.output(TheMonth) ?? "∅"}} {{cara.unit}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="edit" v-show="editing">
|
||||
<div v-for="cara in descEditable" :key='cara.name' class="cara">
|
||||
<label :for='cara.name'>{{ cara.label }}</label>
|
||||
<input type="number" v-model.number="monthCopy[cara.name]" id="cara.name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
import { parseISO, format } from 'date-fns'
|
||||
import frLocal from 'date-fns/locale/fr'
|
||||
export default {
|
||||
name: 'MonthPresentation',
|
||||
props: {
|
||||
TheDate: String,
|
||||
TheMonth: {
|
||||
type: Object,
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
editing: false,
|
||||
monthCopy: Object,
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.monthCopy = {...this.TheMonth}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('config', {
|
||||
'descHightlights': 'monthHightlightDesc',
|
||||
'descEditable': 'descEditable',
|
||||
}),
|
||||
rawDate: function () {
|
||||
return parseISO(this.TheDate, "yyyy-MM", new Date())
|
||||
},
|
||||
theMonth: function () {
|
||||
return format(this.rawDate, "MMM", {locale: frLocal})
|
||||
},
|
||||
theYear: function () {
|
||||
return format(this.rawDate, "YYY", )
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions('travail', {
|
||||
'updateMonth': 'updateMonth',
|
||||
}),
|
||||
...mapActions('config', {
|
||||
'writeData': 'writeData',
|
||||
}),
|
||||
toggleEdit: function () {
|
||||
this.editing = !this.editing
|
||||
},
|
||||
save: function () {
|
||||
this.updateMonth({date: this.TheDate, month: {...this.monthCopy}})
|
||||
this.writeData()
|
||||
this.toggleEdit()
|
||||
},
|
||||
cancel: function () {
|
||||
this.monthCopy = {...this.TheMonth}
|
||||
this.toggleEdit()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
.month-presentation {
|
||||
display: grid;
|
||||
grid-template-columns: 140px 1fr;
|
||||
}
|
||||
.month-presentation > * {
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
#date {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
border-right: 1px solid black;
|
||||
}
|
||||
.month{
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#display {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
#display > * {
|
||||
margin: 3px;
|
||||
width: 80px;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
label{
|
||||
text-align: right;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.value {
|
||||
font-size: 1.5em;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.novisible {
|
||||
display: None;
|
||||
}
|
||||
button {
|
||||
margin-top: 5px;
|
||||
padding: 4px;
|
||||
font-size: 0.8em;
|
||||
width: auto;
|
||||
}
|
||||
.cara {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
</style>
|
@@ -1,42 +0,0 @@
|
||||
<template>
|
||||
<ul>
|
||||
<li v-for="date in dates" :key="date">
|
||||
<month-presentation :TheDate=date :TheMonth=getMonth(date)></month-presentation>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import MonthPresentation from "./MonthPresentation"
|
||||
export default {
|
||||
name: 'Months',
|
||||
components: {
|
||||
MonthPresentation: MonthPresentation
|
||||
},
|
||||
props: {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
dates: "travail/MonthsDate",
|
||||
getMonth: "travail/getMonth",
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
li:last-of-type {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
</style>
|
@@ -1,37 +0,0 @@
|
||||
<template>
|
||||
<div class="hightlights">
|
||||
<hightlight-sum :months="months" attribute="ca"/>
|
||||
<hightlight-sum :months="months" attribute="remuneration"/>
|
||||
<hightlight-sum :months="months" attribute="caPersoUntouch"/>
|
||||
</div>
|
||||
<revenus-chart/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import RevenusChart from '../components/graphs/RevenusChart.vue'
|
||||
import hightlightSum from './hightlightSum.vue'
|
||||
|
||||
export default {
|
||||
name: 'caOnPeriod',
|
||||
components: {
|
||||
RevenusChart: RevenusChart,
|
||||
hightlightSum: hightlightSum,
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('travail', {
|
||||
months: "months",
|
||||
}),
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
@@ -1,41 +0,0 @@
|
||||
<template>
|
||||
<div class="hightlights">
|
||||
<hightlight-sum :months="months" attribute="caTheo"/>
|
||||
<hightlight-sum :months="months" attribute="retro"/>
|
||||
<hightlight-sum :months="months" attribute="notInvoiced"/>
|
||||
</div>
|
||||
<repartition-chart/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import RepartitionChart from './graphs/RepartitionChart.vue'
|
||||
import hightlightSum from './hightlightSum.vue'
|
||||
|
||||
export default {
|
||||
name: 'caRepartition',
|
||||
components: {
|
||||
RepartitionChart: RepartitionChart,
|
||||
hightlightSum: hightlightSum,
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('travail', {
|
||||
months: "months",
|
||||
}),
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.hightlights{
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
@@ -1,21 +0,0 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
Content
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Content',
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
.content {
|
||||
background-color: red;
|
||||
}
|
||||
</style>
|
@@ -1,68 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<canvas id="repartition-chart"></canvas>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Chart from 'chart.js'
|
||||
import { mapGetters } from 'vuex'
|
||||
import {
|
||||
notInvoiced,
|
||||
caPro,
|
||||
caPersoUntouch,
|
||||
sum,
|
||||
} from '../../lib/months'
|
||||
|
||||
export default {
|
||||
name: 'RepartitionChart',
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
months: function () {
|
||||
const ctx = document.getElementById('repartition-chart');
|
||||
new Chart(ctx, this.graphDatas);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('config', {
|
||||
caProPercentage: 'caProPercentage',
|
||||
}),
|
||||
...mapGetters('travail', {
|
||||
months: "months",
|
||||
}),
|
||||
graphDatas: function () {
|
||||
var datas = {
|
||||
type: "pie",
|
||||
data: {
|
||||
labels: ['Partie pro', 'Non facturé', 'Retrocession', 'Salaire', '13e mois'],
|
||||
datasets: [
|
||||
{
|
||||
label: "Difference CA perso et remuneration",
|
||||
data: [
|
||||
sum(Object.values(this.months).map(a => caPro(a))),
|
||||
sum(Object.values(this.months).map(a => notInvoiced(a))),
|
||||
sum(Object.values(this.months).map(a => a.retro)),
|
||||
sum(Object.values(this.months).map(a => a.remuneration)),
|
||||
sum(Object.values(this.months).map(a => caPersoUntouch(a))),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
options: {
|
||||
legend: {position: 'right'},
|
||||
}
|
||||
}
|
||||
return datas
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
mounted() {
|
||||
const ctx = document.getElementById('repartition-chart');
|
||||
new Chart(ctx, this.graphDatas);
|
||||
}
|
||||
}
|
||||
</script>
|
@@ -1,94 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<canvas id="revenus-chart"></canvas>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Chart from 'chart.js'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { ca, caPersoUntouch, sum } from '../../lib/months'
|
||||
|
||||
export default {
|
||||
name: 'RevenusChart',
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
months: function () {
|
||||
const ctx = document.getElementById('revenus-chart');
|
||||
new Chart(ctx, this.graphDatas);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('config', {
|
||||
caProPercentage: 'caProPercentage',
|
||||
}),
|
||||
...mapGetters('travail', {
|
||||
months: "months",
|
||||
}),
|
||||
graphDatas: function () {
|
||||
var datas = {
|
||||
type: "bar",
|
||||
data: {
|
||||
labels: Object.keys(this.months),
|
||||
datasets: [
|
||||
{
|
||||
type: "bar",
|
||||
label: "Difference CA perso et remuneration",
|
||||
data: Object.values(this.months).map(a => caPersoUntouch(a)),
|
||||
backgroundColor: "red",
|
||||
borderColor: "light-red",
|
||||
borderWidth: 3
|
||||
},
|
||||
{
|
||||
type: "bar",
|
||||
label: "CA",
|
||||
data: Object.values(this.months).map(a => ca(a)),
|
||||
backgroundColor: "rgba(54,73,93,.5)",
|
||||
borderColor: "#36495d",
|
||||
borderWidth: 3
|
||||
},
|
||||
{
|
||||
type: "line",
|
||||
label: "Banque",
|
||||
data: this.untouchEvo,
|
||||
backgroundColor: "rgba(71, 183,132,.5)",
|
||||
borderColor: "#47b784",
|
||||
borderWidth: 3
|
||||
},
|
||||
],
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
lineTension: 1,
|
||||
scales: {
|
||||
yAxes: [
|
||||
{
|
||||
ticks: {
|
||||
beginAtZero: true,
|
||||
padding: 25
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
return datas
|
||||
},
|
||||
untouchEvo: function () {
|
||||
const cumulativeArray = (arr => value => {arr.push(value); return [...arr];})([]);
|
||||
return Object.values(this.months)
|
||||
.map(cumulativeArray)
|
||||
.map(a => sum(a.map(m => caPersoUntouch(m))))
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
mounted() {
|
||||
const ctx = document.getElementById('revenus-chart');
|
||||
new Chart(ctx, this.graphDatas);
|
||||
}
|
||||
}
|
||||
</script>
|
@@ -1,52 +0,0 @@
|
||||
<template>
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ sumValue }} {{ unit }}</li>
|
||||
<li>{{ label }} </li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import {
|
||||
sum,
|
||||
} from '../lib/months'
|
||||
|
||||
export default {
|
||||
name: 'hightlightSum',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
months: Object,
|
||||
attribute: String,
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('config', {
|
||||
descOf: "descOf",
|
||||
}),
|
||||
theDesc: function () {
|
||||
return this.descOf(this.attribute)
|
||||
},
|
||||
sumValue: function () {
|
||||
return sum(Object.values(this.months).map(m => this.theDesc.output(m))).toLocaleString()
|
||||
},
|
||||
label: function () {
|
||||
return this.theDesc.label
|
||||
},
|
||||
unit: function () {
|
||||
return this.theDesc.unit
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
@@ -1,148 +0,0 @@
|
||||
<template>
|
||||
<div class="hightlights">
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ ca }} €</li>
|
||||
<li>CA</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ caMean }} €</li>
|
||||
<li>CA moyen</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ caTheo }}</li>
|
||||
<li>CA des séances effectuées</li>
|
||||
</ul>
|
||||
</div>
|
||||
-->
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ caUnFactured }} €</li>
|
||||
<li>Non facturé</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ remuneration }} €</li>
|
||||
<li>Rémunération</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ remunerationMean }} €</li>
|
||||
<li>Rémunération moyenne</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ retrocession }}</li>
|
||||
<li>Rétrocession</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ retrocessionMean }}</li>
|
||||
<li>Rétrocession moyenne</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ caPro }}</li>
|
||||
<li> CA pour la partie pro ({{ caProPercentage*100}}% du CA)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ caPerso }}</li>
|
||||
<li> CA pour la partie perso</li>
|
||||
</ul>
|
||||
</div>
|
||||
-->
|
||||
<div class="hightlight boxed">
|
||||
<ul>
|
||||
<li>{{ caPersoUntouch }} €</li>
|
||||
<li> CA perso non utilisé pour se rémunérer</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { caTotal,
|
||||
caMean,
|
||||
caTheo,
|
||||
remuneration,
|
||||
remunerationMean,
|
||||
retrocession,
|
||||
retrocessionMean,
|
||||
caPro,
|
||||
caPerso,
|
||||
caPersoUntouch
|
||||
} from '../lib/months'
|
||||
|
||||
export default {
|
||||
name: 'Hightlights',
|
||||
components: {
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('config', {
|
||||
caProPercentage: 'caProPercentage',
|
||||
}),
|
||||
...mapGetters('travail', {
|
||||
months: "months",
|
||||
}),
|
||||
ca: function () {return caTotal(this.months).toLocaleString()},
|
||||
caMean: function () {return caMean(this.months).toLocaleString()},
|
||||
caTheo: function () {return caTheo(this.months).toLocaleString()},
|
||||
caUnFactured: function () {return (caTheo(this.months) - caTotal(this.months)).toLocaleString()},
|
||||
remuneration: function () {return remuneration(this.months).toLocaleString()},
|
||||
remunerationMean: function () {return remunerationMean(this.months).toLocaleString()},
|
||||
retrocession: function () {return retrocession(this.months).toLocaleString()},
|
||||
retrocessionMean: function () {return retrocessionMean(this.months).toLocaleString()},
|
||||
caPro: function () {return caPro(this.months, this.caProPercentage).toLocaleString()},
|
||||
caPerso: function () {return caPerso(this.months, this.caProPercentage).toLocaleString()},
|
||||
caPersoUntouch: function () {return caPersoUntouch(this.months, this.caProPercentage).toLocaleString()},
|
||||
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.hightlights {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-gap: 20px;
|
||||
}
|
||||
.hightlight > ul{
|
||||
list-style-type: none;
|
||||
display: flex;
|
||||
flex-flow: column wrap;
|
||||
padding-inline-start: 0;
|
||||
}
|
||||
.hightlight > ul > li {
|
||||
margin: 5px;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.hightlight > ul :first-child{
|
||||
font-size: 3rem;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
.hightlight > ul :last-child{
|
||||
text-align: end;
|
||||
}
|
||||
</style>
|
@@ -1,135 +0,0 @@
|
||||
<template>
|
||||
<ul>
|
||||
<li>
|
||||
<h2>Période</h2>
|
||||
</li>
|
||||
<li>
|
||||
<input type="month" @input="updateStart" v-model="start">
|
||||
<input type="month" @input="updateEnd" v-model="end">
|
||||
</li>
|
||||
<li>
|
||||
<button @click="setRangeFromJanuary" :active='selected=="january"'>Depuis le début de l'année</button>
|
||||
<button @click="setRange1year" :active='selected=="year"'>Sur 1 an</button>
|
||||
<button @click="setRangeAll" :active='selected=="all"'>Tout</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import { setMonth, addMonths, format, parseISO } from 'date-fns'
|
||||
|
||||
const today = new Date();
|
||||
|
||||
export default {
|
||||
name: 'MonthSelector',
|
||||
components: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
selected: "",
|
||||
start: "",
|
||||
end: "",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('travail', {
|
||||
range: "range",
|
||||
monthsDate: "MonthsDate",
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
range: function () {
|
||||
this.start = this.range.start
|
||||
this.end = this.range.end
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.setRangeFromJanuary()
|
||||
this.start = this.range.start
|
||||
this.end = this.range.end
|
||||
},
|
||||
methods: {
|
||||
...mapActions('travail', {
|
||||
setRange: "setRange",
|
||||
}),
|
||||
updateStart: function () {
|
||||
this.selected = "custom"
|
||||
this.setRange({start: this.start, end: this.end})
|
||||
},
|
||||
updateEnd: function () {
|
||||
this.selected = "custom"
|
||||
this.setRange({start: this.start, end: this.end})
|
||||
},
|
||||
setRangeFromJanuary: function () {
|
||||
const start = setMonth(today, 0)
|
||||
const range = {
|
||||
start: format(start, 'yyyy-MM'),
|
||||
end: format(today, 'yyyy-MM'),
|
||||
}
|
||||
this.selected = "january"
|
||||
this.setRange(range)
|
||||
},
|
||||
setRange1year: function () {
|
||||
const start = addMonths(new Date(), -12)
|
||||
const range = {
|
||||
start: format(start, 'yyyy-MM'),
|
||||
end: format(today, 'yyyy-MM'),
|
||||
}
|
||||
this.selected = "year"
|
||||
this.setRange(range)
|
||||
},
|
||||
setRangeAll: function () {
|
||||
const dates = this.monthsDate.map(a => parseISO(a, "yyyy-MM", new Date()))
|
||||
const start = dates.reduce((a, b) => (a.MeasureDate > b.MeasureDate ? a: b))
|
||||
const end = dates.reduce((a, b) => (a.MeasureDate > b.MeasureDate ? b: a))
|
||||
const range = {
|
||||
start: format(start, 'yyyy-MM'),
|
||||
end: format(end, 'yyyy-MM'),
|
||||
}
|
||||
this.selected = "all"
|
||||
this.setRange(range)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-flow: column wrap;
|
||||
}
|
||||
ul > * {
|
||||
margin-top: 10px;
|
||||
}
|
||||
li {
|
||||
list-style-type: none;
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
h2 {
|
||||
margin: 0;
|
||||
}
|
||||
input {
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 15px 32px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
color: black;
|
||||
}
|
||||
button {
|
||||
flex-basis: 33%;
|
||||
height: 3rem;
|
||||
background-color: white;
|
||||
|
||||
}
|
||||
</style>
|
@@ -1,87 +0,0 @@
|
||||
<template>
|
||||
<nav>
|
||||
<h1><router-link to="/"> Sous Margot </router-link></h1>
|
||||
<h2>
|
||||
<ul id="years">
|
||||
<li v-for="year in years" :key="year">
|
||||
<span @click="selectYear(year)" :class="{selected_year:year==selected_year}">{{ year }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</h2>
|
||||
<div class="nav-link">
|
||||
<router-link to="/edit">
|
||||
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-edit" class="svg-inline--fa fa-user-edit fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" width='25px' height="25px">
|
||||
<path fill="currentColor" d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h274.9c-2.4-6.8-3.4-14-2.6-21.3l6.8-60.9 1.2-11.1 7.9-7.9 77.3-77.3c-24.5-27.7-60-45.5-99.9-45.5zm45.3 145.3l-6.8 61c-1.1 10.2 7.5 18.8 17.6 17.6l60.9-6.8 137.9-137.9-71.7-71.7-137.9 137.8zM633 268.9L595.1 231c-9.3-9.3-24.5-9.3-33.8 0l-37.8 37.8-4.1 4.1 71.8 71.7 41.8-41.8c9.3-9.4 9.3-24.5 0-33.9z"></path>
|
||||
</svg>
|
||||
</router-link>
|
||||
<router-link to="/config">
|
||||
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-cog" class="svg-inline--fa fa-user-cog fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" width='25px' height="25px">
|
||||
<path fill="black" d="M610.5 373.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 400.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm201.2 226.5c-2.3-1.2-4.6-2.6-6.8-3.9l-7.9 4.6c-6 3.4-12.8 5.3-19.6 5.3-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-5.5-17.7 1.9-36.4 17.9-45.7l7.9-4.6c-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-16-9.2-23.4-28-17.9-45.7.9-2.9 2.2-5.8 3.2-8.7-3.8-.3-7.5-1.2-11.4-1.2h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c10.1 0 19.5-3.2 27.2-8.5-1.2-3.8-2-7.7-2-11.8v-9.2z"></path>
|
||||
</svg>
|
||||
</router-link>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { mapActions } from 'vuex'
|
||||
import { getYear } from 'date-fns'
|
||||
const today = new Date()
|
||||
export default {
|
||||
name: 'Nav',
|
||||
data () {
|
||||
return {
|
||||
current_year: getYear(today),
|
||||
selected_year: getYear(today),
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
available_years: "travail/years",
|
||||
}),
|
||||
years: function () {
|
||||
return [...this.available_years, this.current_year].filter((v, i, a) => a.indexOf(v) === i)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('travail', {
|
||||
'setRange': 'setRange',
|
||||
}),
|
||||
selectYear: function (year) {
|
||||
this.selected_year=year
|
||||
this.setRange({
|
||||
start: `${this.current_year}-01`,
|
||||
end: `${this.current_year}-12`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
|
||||
#years {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
#years > * {
|
||||
margin: 3px;
|
||||
width: 80px;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
.selected_year {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
@@ -1,44 +0,0 @@
|
||||
// Function on a month
|
||||
export function ca(month) {
|
||||
// Extract the CA of the month
|
||||
if (month.caReact) {
|
||||
return month.caReact
|
||||
} else {
|
||||
return month.caRetro
|
||||
}
|
||||
}
|
||||
|
||||
export function notInvoiced (month) {
|
||||
// Compute how much has not been invoiced
|
||||
return month.caTheo - ca(month)
|
||||
}
|
||||
|
||||
export function caPro (month) {
|
||||
// Compute the part of the CA to go pro usage
|
||||
return ca(month) * month.proPercentage / 100
|
||||
}
|
||||
|
||||
export function caPerso (month) {
|
||||
// Compute the part of the CA to go personnal usage
|
||||
return ca(month) * (1 - month.proPercentage / 100)
|
||||
}
|
||||
|
||||
export function caPersoUntouch (month) {
|
||||
// Compute the part of the CA to go personnal usage
|
||||
return caPerso(month) - month.remuneration
|
||||
}
|
||||
|
||||
|
||||
// Function on an array of month
|
||||
|
||||
|
||||
export function sum (array) {
|
||||
// sum the array
|
||||
return array.reduce((acc, v)=> acc + v, 0)
|
||||
}
|
||||
|
||||
export function mean(array) {
|
||||
console.log(array)
|
||||
return Math.floor(array.reduce((acc, v)=> acc + v, 0) / array.length)
|
||||
}
|
||||
|
11
src/main.js
11
src/main.js
@@ -1,11 +0,0 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from '@/App.vue'
|
||||
import router from '@/router'
|
||||
import store from '@/store'
|
||||
import '@/style.css'
|
||||
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(router)
|
||||
app.use(store)
|
||||
app.mount('#app')
|
@@ -1,26 +0,0 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
import Home from "@/views/home.vue"
|
||||
import Config from "@/views/config.vue"
|
||||
import Edit from "@/views/edit.vue"
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: '/edit',
|
||||
name: 'edit',
|
||||
component: Edit
|
||||
},
|
||||
{
|
||||
path: '/config',
|
||||
name: 'config',
|
||||
component: Config
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({ history: createWebHistory(), routes })
|
||||
export default router
|
@@ -1,175 +0,0 @@
|
||||
import path from 'path'
|
||||
import Papa from 'papaparse'
|
||||
import { writeFile } from 'fs'
|
||||
import {
|
||||
ca,
|
||||
notInvoiced,
|
||||
caPro,
|
||||
caPerso,
|
||||
caPersoUntouch,
|
||||
} from '../../lib/months.js'
|
||||
|
||||
const config = {
|
||||
namespaced: true,
|
||||
state() {
|
||||
return {
|
||||
//userDir: '~/.config/sousmargot/',
|
||||
userDir: './userDir/',
|
||||
dataFile: 'datas.csv',
|
||||
caProPercentage: 0.5,
|
||||
descAll : [
|
||||
{
|
||||
name: 'caTheo',
|
||||
color: '',
|
||||
label: 'CA "scéances effectuées"',
|
||||
type: 'editable',
|
||||
unit: '€',
|
||||
hightlight: false,
|
||||
output: month => month.caTheo,
|
||||
},
|
||||
{
|
||||
name: 'caRetro',
|
||||
color: '',
|
||||
label: 'CA "Séances facturées"',
|
||||
type: 'editable',
|
||||
unit: '€',
|
||||
hightlight: false,
|
||||
output: month => month.caRetro,
|
||||
},
|
||||
{
|
||||
name: 'caReact',
|
||||
color: '',
|
||||
label: 'CA "Séances facturées" réactualisé',
|
||||
type: 'editable',
|
||||
unit: '€',
|
||||
hightlight: false,
|
||||
output: month => month.caReact,
|
||||
},
|
||||
{
|
||||
name: 'sessionQty',
|
||||
color: '',
|
||||
label: 'Nombre de séances effectuées',
|
||||
unit: '',
|
||||
hightlight: false,
|
||||
output: month => month.sessionQty,
|
||||
},
|
||||
{
|
||||
name: 'retro',
|
||||
color: '',
|
||||
label: 'Montant de la rétrocession',
|
||||
type: 'editable',
|
||||
unit: '€',
|
||||
hightlight: false,
|
||||
output: month => month.retro,
|
||||
},
|
||||
{
|
||||
name: 'remuneration',
|
||||
color: '',
|
||||
label: 'Rémuneration',
|
||||
type: 'editable',
|
||||
unit: '€',
|
||||
hightlight: true,
|
||||
output: month => month.remuneration,
|
||||
},
|
||||
{
|
||||
name: 'proPercentage',
|
||||
color: '',
|
||||
label: 'Pourcentage du CA pour la partie pro',
|
||||
type: 'editable',
|
||||
unit: '%',
|
||||
hightlight: false,
|
||||
output: month => month.proPercentage,
|
||||
},
|
||||
{
|
||||
name: 'ca',
|
||||
color: '',
|
||||
label: 'CA',
|
||||
type: 'compute',
|
||||
unit: '€',
|
||||
hightlight: true,
|
||||
output: month => ca(month),
|
||||
},
|
||||
{
|
||||
name: 'notInvoiced',
|
||||
color: '',
|
||||
label: 'Non facturé',
|
||||
type: 'compute',
|
||||
unit: '€',
|
||||
hightlight: true,
|
||||
output: month => notInvoiced(month),
|
||||
},
|
||||
{
|
||||
name: 'caPro',
|
||||
color: '',
|
||||
label: 'CA pour le partie pro',
|
||||
type: 'compute',
|
||||
unit: '€',
|
||||
hightlight: false,
|
||||
output: month => caPro(month),
|
||||
},
|
||||
{
|
||||
name: 'caPerso',
|
||||
color: '',
|
||||
label: 'CA destiné à la rémuneration',
|
||||
type: 'compute',
|
||||
unit: '€',
|
||||
hightlight: false,
|
||||
output: month => caPerso(month),
|
||||
},
|
||||
{
|
||||
name: 'caPersoUntouch',
|
||||
color: '',
|
||||
label: 'Banque 13e mois',
|
||||
type: 'compute',
|
||||
unit: '€',
|
||||
hightlight: false,
|
||||
output: month => caPersoUntouch(month),
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
userDir (state) { return state.userDir },
|
||||
dataFilePath (state) { return path.join(state.userDir, state.dataFile) },
|
||||
descAll (state) {
|
||||
// All description of attributes for months
|
||||
return state.descAll
|
||||
},
|
||||
descEditable (state) {
|
||||
// All description of attributes for months that are editable
|
||||
return state.descAll.filter(d => d.type == 'editable')
|
||||
},
|
||||
descComputed (state) {
|
||||
// All description of attributes for months that are computed
|
||||
return state.descAll.filter(d => d.type != 'editable')
|
||||
},
|
||||
descOf: (state) => (desc) => {
|
||||
return state.descAll.filter(d => d.name == desc)[0]
|
||||
},
|
||||
monthHightlightDesc (state) { return state.descAll.filter(a => a.hightlight) },
|
||||
caProPercentage (state) { return state.caProPercentage },
|
||||
},
|
||||
mutations: {
|
||||
},
|
||||
actions: {
|
||||
loadConfig (context) {
|
||||
// load config file at ~/.config/sousmargot/config.json
|
||||
return context.state.userDir
|
||||
},
|
||||
writeData (context) {
|
||||
// overwrite the dataFile with months datas
|
||||
const months = context.rootGetters['travail/monthsAll']
|
||||
const unpackMonths = Object.keys(months).map(k => {return { ...months[k], date: k}})
|
||||
const csv = Papa.unparse(unpackMonths)
|
||||
writeFile(context.getters.dataFilePath, csv, (err) => {
|
||||
if (err) {
|
||||
console.log(err)
|
||||
} else {
|
||||
console.log("Datas sauvegardées")
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
@@ -1,13 +0,0 @@
|
||||
import { createStore } from 'vuex'
|
||||
import travailStore from "./travail"
|
||||
import configStore from "./config"
|
||||
|
||||
// Create a new store instance.
|
||||
const store = createStore({
|
||||
modules:{
|
||||
travail: travailStore,
|
||||
config: configStore,
|
||||
}
|
||||
})
|
||||
|
||||
export default store
|
@@ -1,130 +0,0 @@
|
||||
import { readFile } from 'fs'
|
||||
import Papa from 'papaparse'
|
||||
import { getYear } from 'date-fns'
|
||||
|
||||
const today = new Date()
|
||||
|
||||
const travail = {
|
||||
namespaced: true,
|
||||
state() {
|
||||
return {
|
||||
empty: {
|
||||
caTheo: null, // ca théorique basé sur les séances effectuées
|
||||
sessionQty: null, // Nombre de séances effectuées sur le mois
|
||||
caRetro: null, // ca au moment de la rétrocession
|
||||
caReact: null, // ca réactualisé
|
||||
retro: 0, // montant de la rétrocession
|
||||
remuneration: 0, // rémunération décidée
|
||||
proPercentage: 50, // Pourcentage du CA pour la partie pro
|
||||
},
|
||||
months: {
|
||||
},
|
||||
range: {
|
||||
start: `${getYear(today)}-01`,
|
||||
end: `${getYear(today)}-12`,
|
||||
},
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
TheEmptyMonth(state) { return { ...state.empty } },
|
||||
range(state) { return state.range },
|
||||
MonthsDate(state) {
|
||||
// Get months inside the range
|
||||
return Object.keys(state.months).filter(date => (date >= state.range.start) && (date <= state.range.end)).sort().reverse()
|
||||
},
|
||||
MonthsAllDate(state) {
|
||||
// Get all the months
|
||||
return Object.keys(state.months).sort().reverse()
|
||||
},
|
||||
lastMonthDate(state) {
|
||||
// Return the date of the last registered month
|
||||
return Object.keys(state.months).sort().reverse()[0]
|
||||
},
|
||||
months: (state, getters) => {
|
||||
// Get in range months
|
||||
const a = Object.keys(state.months)
|
||||
.filter(a => getters.MonthsDate.includes(a))
|
||||
.reduce((acc, v) => {
|
||||
acc[v] = state.months[v];
|
||||
return acc;
|
||||
}, {})
|
||||
return a
|
||||
},
|
||||
monthsAll: (state) => {
|
||||
// Get in range months
|
||||
return state.months
|
||||
},
|
||||
getMonth: (state) => (date) => {
|
||||
// Get a month by its date
|
||||
return state.months[date]
|
||||
},
|
||||
count: (state, getters) => {
|
||||
// Amount of mounts
|
||||
return Object.keys(getters.months).length
|
||||
},
|
||||
years: (state) => {
|
||||
// list of years with data
|
||||
return Object.keys(state.months).map(k => k.slice(0,4)).filter((v, i, a) => a.indexOf(v) === i)
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
cleanMonths (state) {
|
||||
// erase months
|
||||
state.months = []
|
||||
},
|
||||
importMonths(state, months) {
|
||||
// overwrite months
|
||||
state.months = months
|
||||
},
|
||||
updateMonth(state, { date, month }) {
|
||||
state.months[date] = month
|
||||
},
|
||||
createMonth (state, { date, month }) {
|
||||
state.months[date] = month
|
||||
},
|
||||
setRange(state, range) {
|
||||
state.range = range
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
cleanMonths (context) {
|
||||
context.commit("cleanMonths")
|
||||
},
|
||||
loadMonths (context) {
|
||||
// import all months from storage
|
||||
readFile(context.rootGetters["config/dataFilePath"], (err, data) => {
|
||||
if (err) throw err;
|
||||
const months = Papa.parse(data.toString(), {header: true, dynamicTyping:true, skipEmptyLines:true})
|
||||
.data
|
||||
.reduce(
|
||||
(acc, el) => {
|
||||
acc[el.date] = el;
|
||||
return acc
|
||||
}, {})
|
||||
context.commit("importMonths", months)
|
||||
})
|
||||
},
|
||||
updateMonth(context, { date, month }) {
|
||||
// update month's datas
|
||||
if (date in context.state.months) {
|
||||
context.commit('updateMonth', { date, month })
|
||||
} else {
|
||||
console.log("This month does not exists")
|
||||
}
|
||||
},
|
||||
createMonth(context, { date, month }) {
|
||||
// Create a new month
|
||||
if (!(date in context.state.months)) {
|
||||
context.commit('createMonth', { date, month })
|
||||
} else {
|
||||
console.log("This month already exists")
|
||||
}
|
||||
},
|
||||
setRange(context, range) {
|
||||
context.commit("setRange", range)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default travail
|
||||
|
110
src/style.css
110
src/style.css
@@ -1,110 +0,0 @@
|
||||
body {
|
||||
background-color: whitesmoke;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
padding: 0 20px;
|
||||
color: black;
|
||||
}
|
||||
nav h1 {
|
||||
font-size: 2em;
|
||||
border-bottom: 1px solid #000;
|
||||
}
|
||||
nav a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
color: black;
|
||||
padding: 4px;
|
||||
box-shadow: 1px 1px 2px gray;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
background-color: white;
|
||||
margin-top: 5px;
|
||||
font-size: 0.8em;
|
||||
width: auto;
|
||||
transition: all 0.2s ease-out;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: black;
|
||||
color: white;
|
||||
transition: all 0.2s ease-out;
|
||||
}
|
||||
|
||||
.validate {
|
||||
border: 2px solid green;
|
||||
color: green;
|
||||
}
|
||||
.validate:hover {
|
||||
background-color: green;
|
||||
color: white;
|
||||
}
|
||||
.cancel {
|
||||
border: 2px solid red;
|
||||
color: red;
|
||||
}
|
||||
.cancel:hover {
|
||||
background-color: red;
|
||||
color: white;
|
||||
}
|
||||
.edit {
|
||||
border: 2px solid orange;
|
||||
color: orange;
|
||||
}
|
||||
.edit:hover {
|
||||
background-color: orange;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.boxed {
|
||||
box-shadow: 2px 2px 5px gray;
|
||||
border-left: 1rem solid black;
|
||||
border-radius: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.boxed-green {
|
||||
box-shadow: 2px 2px 5px gray;
|
||||
border-left: 1rem solid green;
|
||||
border-radius: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.hightlights {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-gap: 20px;
|
||||
}
|
||||
.hightlight > ul {
|
||||
list-style-type: none;
|
||||
display: flex;
|
||||
flex-flow: column wrap;
|
||||
padding-inline-start: 0;
|
||||
margin-block-start: 0;
|
||||
margin-block-end: 0;
|
||||
}
|
||||
.hightlight > ul > li {
|
||||
margin: 5px;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.hightlight > ul :first-child {
|
||||
font-size: 2rem;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
.hightlight > ul :last-child {
|
||||
text-align: end;
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
<template>
|
||||
<h1>Config</h1>
|
||||
|
||||
<h2> Données </h2>
|
||||
<h3>Données éditables</h3>
|
||||
<ul>
|
||||
<li v-for="param in descEditable" :key='param.name'>
|
||||
{{ param }}
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Données calculées</h3>
|
||||
<ul>
|
||||
<li v-for="param in descComputed" :key='param.name'>
|
||||
{{ param }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'config',
|
||||
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('config', {
|
||||
'descEditable': 'descEditable',
|
||||
'descComputed': 'descComputed',
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
@@ -1,22 +0,0 @@
|
||||
<template>
|
||||
<h1>Edition</h1>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'edit',
|
||||
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
@@ -1,57 +0,0 @@
|
||||
<template>
|
||||
<div id="content">
|
||||
<section id="months">
|
||||
<create-month />
|
||||
<months-list />
|
||||
</section>
|
||||
<section id="stats">
|
||||
<ca-on-period />
|
||||
<ca-repartition />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions } from 'vuex'
|
||||
import MonthsList from '../components/MonthsUl.vue'
|
||||
import CreateMonth from '../components/CreateMonth.vue'
|
||||
import caOnPeriod from '../components/caOnPeriod.vue'
|
||||
import caRepartition from '../components/caRepartition.vue'
|
||||
export default {
|
||||
name: 'home',
|
||||
components: {
|
||||
MonthsList: MonthsList,
|
||||
CreateMonth: CreateMonth,
|
||||
caOnPeriod: caOnPeriod,
|
||||
caRepartition: caRepartition,
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
...mapActions('travail', {
|
||||
'loadMonths': 'loadMonths',
|
||||
}),
|
||||
},
|
||||
mounted () {
|
||||
this.loadMonths()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#content {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(580px, 2fr) minmax(450px, 1fr);
|
||||
grid-template-areas: "stats months";
|
||||
gap: 1em;
|
||||
}
|
||||
#stats {
|
||||
grid-area: stats;
|
||||
}
|
||||
#months {
|
||||
grid-area: months;
|
||||
}
|
||||
</style>
|
@@ -1,8 +0,0 @@
|
||||
caTheo,sessionQty,caRetro,caReact,retro,remuneration,date,proPercentage
|
||||
7000,,6747,,893,2000,2021-01,50
|
||||
5200,,5183,,665,1500,2021-02,50
|
||||
7100,,7088,,855,2000,2021-03,50
|
||||
5700,,4194,5630,627,2000,2021-04,50
|
||||
6500,,5564,6335,699,2800,2021-05,50
|
||||
6725,235,5442,6376,638,2800,2021-06,50
|
||||
2176,81,1274,,172,2000,2021-07,50
|
|
@@ -1,7 +0,0 @@
|
||||
module.exports = {
|
||||
pluginOptions: {
|
||||
electronBuilder: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user