Compare commits

...

15 Commits

Author SHA1 Message Date
311f523647 feat : Ajout d'une liste des utilisateur 2026-02-06 15:36:27 +01:00
gitea-actions
0d0aa788db chore: bump version to v0.0.32
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m15s
2026-02-06 10:52:56 +00:00
c010bdc262 feat : ajout du numéro de version de l'application auth/default layout
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
2026-02-06 11:52:45 +01:00
gitea-actions
0e905bfcbe chore: bump version to v0.0.31
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m12s
2026-02-06 09:44:54 +00:00
e6bb4ddf6a feat : test auto-tag-develop.yml (auto incrément version)
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
2026-02-06 10:44:43 +01:00
299ea84e87 fix : auto-tag-develop.yml
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m9s
2026-02-06 10:40:57 +01:00
bb0b0092da fix : auto-tag-develop.yml 2026-02-06 10:38:32 +01:00
33d21f6ae6 feat : update numéro de version 2026-02-06 10:30:27 +01:00
98ee62294d feat : ajout d'un numéro de version automatique via la CI 2026-02-06 10:25:54 +01:00
820386b87b Layout admin panel (!13)
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build Release Artefact / build (push) Successful in 1m13s
| Numéro du ticket | Layout admin panel |
|------------------|-----------------|
|                  |                 |

## Description de la PR

## Modification du .env

## Check list

- [x] Pas de régression
- [ ] TU/TI/TF rédigée
- [x] TU/TI/TF OK
- [ ] CHANGELOG modifié

Reviewed-on: #13
Co-authored-by: Matteo <matteo@yuno.malio.fr>
Co-committed-by: Matteo <matteo@yuno.malio.fr>
2026-02-06 08:22:08 +00:00
c17f7aa08a fix : logo centré en mod mobile
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m8s
2026-02-05 17:55:05 +01:00
4a0d38d307 feat : ajout du responsive sur la navbar et la page d'accueil
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m10s
2026-02-05 17:28:49 +01:00
e9948d6ac3 [#256] Créer une nouvelle réception (étape 3 - bovin) (!11)
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m9s
| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|       256           | Créer une nouvelle réception (étape 3 - bovin)                |

## Description de la PR

## Modification du .env

## Check list

- [x ] Pas de régression
- [ ] TU/TI/TF rédigée
- [x ] TU/TI/TF OK
- [x ] CHANGELOG modifié

Co-authored-by: tristan <tristan@yuno.malio.fr>
Reviewed-on: #11
Co-authored-by: kevin <kevin@yuno.malio.fr>
Co-committed-by: kevin <kevin@yuno.malio.fr>
2026-02-05 09:29:29 +00:00
80d87b7c9b [#268] Lister les réceptions terminées (!10)
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build Release Artefact / build (push) Successful in 1m11s
| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|       #268           |        Lister les réceptions terminées         |

## Description de la PR

## Modification du .env

## Check list

- [x] Pas de régression
- [ ] TU/TI/TF rédigée
- [x] TU/TI/TF OK
- [x] CHANGELOG modifié

Reviewed-on: #10
Co-authored-by: sroy <sebastien@yuno.malio.fr>
Co-committed-by: sroy <sebastien@yuno.malio.fr>
2026-02-05 07:19:46 +00:00
a69556c554 [#267] Lister les réceptions en attente (!9)
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build Release Artefact / build (push) Successful in 1m12s
| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|          #267        |        Lister les réceptions en attente          |

## Description de la PR

## Modification du .env

## Check list

- [x] Pas de régression
- [ ] TU/TI/TF rédigée
- [x] TU/TI/TF OK
- [x] CHANGELOG modifié

Reviewed-on: #9
Reviewed-by: Autin <tristan@yuno.malio.fr>
Co-authored-by: sroy <sebastien@yuno.malio.fr>
Co-committed-by: sroy <sebastien@yuno.malio.fr>
2026-02-04 14:40:50 +00:00
47 changed files with 1569 additions and 255 deletions

View File

@@ -16,30 +16,50 @@ jobs:
token: ${{ secrets.RELEASE_TOKEN }} token: ${{ secrets.RELEASE_TOKEN }}
persist-credentials: true persist-credentials: true
- name: Create next tag v0.0.X - name: Create next tag from config/version.yaml
shell: bash shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
# Skip if current commit already has a v0.0.* tag # Skip if current commit already has a vX.Y.Z tag
if git tag --points-at HEAD | grep -qE '^v0\.0\.'; then if git tag --points-at HEAD | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Tag already exists on this commit. Skipping." echo "Tag already exists on this commit. Skipping."
exit 0 exit 0
fi fi
last_tag="$(git tag -l 'v0.0.*' --sort=-v:refname | head -n1 || true)" changed_version=false
if [ -z "$last_tag" ]; then if git diff --name-only "${{ gitea.event.before }}" "${{ gitea.event.after }}" | grep -q '^config/version\.yaml$'; then
next_tag="v0.0.1" changed_version=true
else
patch="${last_tag##v0.0.}"
if ! [[ "$patch" =~ ^[0-9]+$ ]]; then
echo "Unexpected tag format: $last_tag" >&2
exit 1
fi
next_tag="v0.0.$((patch + 1))"
fi fi
git config user.name "gitea-actions" read_version() {
git config user.email "gitea-actions@local" awk -F': *' '/app\.version:/{print $2}' config/version.yaml | tr -d '[:space:]' | tr -d "'\""
git tag "$next_tag" }
git push origin "$next_tag"
if $changed_version; then
version="$(read_version)"
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version in version.yaml: $version" >&2
exit 1
fi
else
last_tag="$(git tag -l 'v*' --sort=-v:refname | head -n1 || true)"
if [ -z "$last_tag" ]; then
version="0.1.0"
else
base="${last_tag#v}"
IFS='.' read -r major minor patch <<< "$base"
version="${major}.${minor}.$((patch + 1))"
fi
printf "parameters:\\n app.version: '%s'\\n" "$version" > config/version.yaml
git config user.name "gitea-actions"
git config user.email "gitea-actions@local"
git add config/version.yaml
git commit -m "chore: bump version to v$version" || true
git push origin develop || true
fi
tag="v$version"
git tag "$tag"
git push origin "$tag"

2
.idea/dataSources.xml generated
View File

@@ -5,7 +5,7 @@
<driver-ref>postgresql</driver-ref> <driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize> <synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver> <jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://localhost:5433/ferme</jdbc-url> <jdbc-url>jdbc:postgresql://localhost:5432/ferme</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir> <working-dir>$ProjectFileDir$</working-dir>
</data-source> </data-source>
<data-source source="LOCAL" name="Ferme recette" uuid="ae622167-c834-4e7b-87a5-c1721036f5dc"> <data-source source="LOCAL" name="Ferme recette" uuid="ae622167-c834-4e7b-87a5-c1721036f5dc">

10
.idea/data_source_mapping.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourcePerFileMappings">
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/f407a514-c6b4-4b26-9555-445a85892502/console.sql" value="f407a514-c6b4-4b26-9555-445a85892502" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/f407a514-c6b4-4b26-9555-445a85892502/console_1.sql" value="f407a514-c6b4-4b26-9555-445a85892502" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/f407a514-c6b4-4b26-9555-445a85892502/console_2.sql" value="f407a514-c6b4-4b26-9555-445a85892502" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/f407a514-c6b4-4b26-9555-445a85892502/console_3.sql" value="f407a514-c6b4-4b26-9555-445a85892502" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/f407a514-c6b4-4b26-9555-445a85892502/console_4.sql" value="f407a514-c6b4-4b26-9555-445a85892502" />
</component>
</project>

206
.idea/workspace.xml generated
View File

@@ -4,10 +4,16 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="feat : mise à jour du bon de réception"> <list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="feat : test auto-tag-develop.yml (auto incrément version)">
<change beforePath="$PROJECT_DIR$/.idea/dataSources.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" /> <change afterPath="$PROJECT_DIR$/frontend/composables/useAppVersion.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/packages/security.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/config/packages/security.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/app.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/app.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/layouts/default.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/layouts/default.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/pages/login.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/login.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Dto/AppVersion.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/ApiResource/AppVersion.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/State/AppVersionProvider.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/State/AppVersionProvider.php" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -18,6 +24,11 @@
<pharConfigPath>$PROJECT_DIR$/composer.json</pharConfigPath> <pharConfigPath>$PROJECT_DIR$/composer.json</pharConfigPath>
<execution /> <execution />
</component> </component>
<component name="CopilotPersistence">
<persistenceIdMap>
<entry key="_//wsl.localhost/Ubuntu-24.04/home/kevin/Stage/Ferme" value="381AhnCm9yPeOiWgMObKHhtgv2C" />
</persistenceIdMap>
</component>
<component name="EmbeddingIndexingInfo"> <component name="EmbeddingIndexingInfo">
<option name="cachedIndexableFilesCount" value="151" /> <option name="cachedIndexableFilesCount" value="151" />
<option name="fileBasedEmbeddingIndicesEnabled" value="true" /> <option name="fileBasedEmbeddingIndicesEnabled" value="true" />
@@ -25,15 +36,15 @@
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
<option value="TypeScript File" />
<option value="Vue Composition API Component" /> <option value="Vue Composition API Component" />
<option value="TypeScript File" />
</list> </list>
</option> </option>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY"> <option name="RECENT_BRANCH_BY_REPOSITORY">
<map> <map>
<entry key="$PROJECT_DIR$" value="fix/makefile" /> <entry key="$PROJECT_DIR$" value="feat/256-reception-etape-3-bovin" />
</map> </map>
</option> </option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -51,7 +62,7 @@
</server> </server>
</servers> </servers>
</component> </component>
<component name="PhpWorkspaceProjectConfiguration" interpreter_name="/bin/php"> <component name="PhpWorkspaceProjectConfiguration" interpreter_name="C:/php-8.4.3/php.exe">
<include_path> <include_path>
<path value="$PROJECT_DIR$/vendor/psr/log" /> <path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" /> <path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" />
@@ -228,7 +239,7 @@
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;, &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;, &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;, &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;configurable.group.appearance&quot;, &quot;settings.editor.selected.configurable&quot;: &quot;configurable.tailwindcss&quot;,
&quot;ts.external.directory.path&quot;: &quot;/opt/phpstorm/plugins/javascript-plugin/jsLanguageServicesImpl/external&quot;, &quot;ts.external.directory.path&quot;: &quot;/opt/phpstorm/plugins/javascript-plugin/jsLanguageServicesImpl/external&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}, },
@@ -256,7 +267,6 @@
<component name="SharedIndexes"> <component name="SharedIndexes">
<attachedChunks> <attachedChunks>
<set> <set>
<option value="bundled-js-predefined-d6986cc7102b-9b0f141eb926-JavaScript-PS-253.30387.85" />
<option value="bundled-php-predefined-a98d8de5180a-0e0d91225499-com.jetbrains.php.sharedIndexes-PS-253.30387.85" /> <option value="bundled-php-predefined-a98d8de5180a-0e0d91225499-com.jetbrains.php.sharedIndexes-PS-253.30387.85" />
</set> </set>
</attachedChunks> </attachedChunks>
@@ -287,70 +297,10 @@
<workItem from="1770055690365" duration="370000" /> <workItem from="1770055690365" duration="370000" />
<workItem from="1770056515646" duration="21000" /> <workItem from="1770056515646" duration="21000" />
<workItem from="1770102495553" duration="2280000" /> <workItem from="1770102495553" duration="2280000" />
</task> <workItem from="1770195604082" duration="90000" />
<task id="LOCAL-00001" summary="feat : Ajout de pinia, création de la table weight et reception mise en place du système de step pour les receptions (WIP)"> <workItem from="1770195718952" duration="215000" />
<option name="closed" value="true" /> <workItem from="1770195959162" duration="18915000" />
<created>1768237763998</created> <workItem from="1770274844804" duration="3940000" />
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1768237763998</updated>
</task>
<task id="LOCAL-00002" summary="feat : Ajout de zod, création d'un composant de chargement loading-dots.vue et finalisation du flow d'une reception">
<option name="closed" value="true" />
<created>1768316052474</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1768316052474</updated>
</task>
<task id="LOCAL-00003" summary="feat : Ajout d'un composable pour la pesée qui sera réutilisable pour l'expédition, ajout de contrainte sur les entity de reception et weight pour plus de robustesse et correction de la class active des liens dans la nav">
<option name="closed" value="true" />
<created>1768316835575</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1768316835575</updated>
</task>
<task id="LOCAL-00004" summary="feat : update du fichier AGENTS.md">
<option name="closed" value="true" />
<created>1768316965511</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1768316965511</updated>
</task>
<task id="LOCAL-00005" summary="feat : update du fichier README.md et CHANGELOG.md">
<option name="closed" value="true" />
<created>1768317786187</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1768317786187</updated>
</task>
<task id="LOCAL-00006" summary="fix : correction du useApi pour qu'il n'y ait plus de retry lors d'une erreur 500 par exemple">
<option name="closed" value="true" />
<created>1768318875533</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1768318875533</updated>
</task>
<task id="LOCAL-00007" summary="test : ajout de TU sur les services et providers">
<option name="closed" value="true" />
<created>1768318921478</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1768318921478</updated>
</task>
<task id="LOCAL-00008" summary="feat : ajout de la génération du bon de reception, correction de la base du formulaire multi-etape de reception et ajout d'une gestion d'erreur global">
<option name="closed" value="true" />
<created>1768498751836</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1768498751836</updated>
</task> </task>
<task id="LOCAL-00009" summary="feat : ajout d'une gestion d'erreur au global côté front avec la lib toaster et I18n pour centraliser les messages d'erreur"> <task id="LOCAL-00009" summary="feat : ajout d'une gestion d'erreur au global côté front avec la lib toaster et I18n pour centraliser les messages d'erreur">
<option name="closed" value="true" /> <option name="closed" value="true" />
@@ -656,7 +606,95 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1769782099473</updated> <updated>1769782099473</updated>
</task> </task>
<option name="localTasksCounter" value="47" /> <task id="LOCAL-00047" summary="feat : Ajout de la sélection des bovins étape 3 d'une réception (WIP)">
<option name="closed" value="true" />
<created>1770131226364</created>
<option name="number" value="00047" />
<option name="presentableId" value="LOCAL-00047" />
<option name="project" value="LOCAL" />
<updated>1770131226364</updated>
</task>
<task id="LOCAL-00048" summary="feat : Ajout de la sélection des bovins étape 3 d'une réception (WIP)">
<option name="closed" value="true" />
<created>1770206668867</created>
<option name="number" value="00048" />
<option name="presentableId" value="LOCAL-00048" />
<option name="project" value="LOCAL" />
<updated>1770206668867</updated>
</task>
<task id="LOCAL-00049" summary="feat : Ajout de la sélection des bovins étape 3 d'une réception (WIP)">
<option name="closed" value="true" />
<created>1770217875423</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1770217875423</updated>
</task>
<task id="LOCAL-00050" summary="feat : Ajout de la sélection des bovins étape 3 d'une réception (WIP)">
<option name="closed" value="true" />
<created>1770283622425</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1770283622425</updated>
</task>
<task id="LOCAL-00051" summary="feat : ajout du responsive sur la navbar et la page d'accueil">
<option name="closed" value="true" />
<created>1770308927948</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1770308927948</updated>
</task>
<task id="LOCAL-00052" summary="fix : logo centré en mod mobile">
<option name="closed" value="true" />
<created>1770310504254</created>
<option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" />
<updated>1770310504254</updated>
</task>
<task id="LOCAL-00053" summary="feat : ajout d'un numéro de version automatique via la CI">
<option name="closed" value="true" />
<created>1770369945257</created>
<option name="number" value="00053" />
<option name="presentableId" value="LOCAL-00053" />
<option name="project" value="LOCAL" />
<updated>1770369945257</updated>
</task>
<task id="LOCAL-00054" summary="feat : update numéro de version">
<option name="closed" value="true" />
<created>1770370216428</created>
<option name="number" value="00054" />
<option name="presentableId" value="LOCAL-00054" />
<option name="project" value="LOCAL" />
<updated>1770370216428</updated>
</task>
<task id="LOCAL-00055" summary="fix : auto-tag-develop.yml">
<option name="closed" value="true" />
<created>1770370700697</created>
<option name="number" value="00055" />
<option name="presentableId" value="LOCAL-00055" />
<option name="project" value="LOCAL" />
<updated>1770370700698</updated>
</task>
<task id="LOCAL-00056" summary="fix : auto-tag-develop.yml">
<option name="closed" value="true" />
<created>1770370919043</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1770370919043</updated>
</task>
<task id="LOCAL-00057" summary="feat : test auto-tag-develop.yml (auto incrément version)">
<option name="closed" value="true" />
<created>1770371073055</created>
<option name="number" value="00057" />
<option name="presentableId" value="LOCAL-00057" />
<option name="project" value="LOCAL" />
<updated>1770371073055</updated>
</task>
<option name="localTasksCounter" value="58" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@@ -706,13 +744,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="ci : ajout du script et de la doc déploiement" />
<MESSAGE value="fix : correction du path URI pour la création d'un poids dans une réception" />
<MESSAGE value="feat : Ajout du bundle Monolog pour la gestion des logs" />
<MESSAGE value="fix : affiche plus détail dans les logs en recette/prod" />
<MESSAGE value="fix : modification du script de déploiement pour corriger le problème d'écriture des logs de prod" />
<MESSAGE value="fix : doc de déploiement" />
<MESSAGE value="fix : doc et script de déploiement" />
<MESSAGE value="fix : gitea workflow" /> <MESSAGE value="fix : gitea workflow" />
<MESSAGE value="fix : script de déploiement" /> <MESSAGE value="fix : script de déploiement" />
<MESSAGE value="feat : ajout plus d'information sur la liste des réceptions côté front sur la page d'accueil" /> <MESSAGE value="feat : ajout plus d'information sur la liste des réceptions côté front sur la page d'accueil" />
@@ -731,10 +762,25 @@
<MESSAGE value="feat : ajout de colonne pour les Supplier, Address et modification du numéro de réception" /> <MESSAGE value="feat : ajout de colonne pour les Supplier, Address et modification du numéro de réception" />
<MESSAGE value="feat : ajout de colonne pour les Supplier, Address. Modification du numéro de réception et ajout de fixtures" /> <MESSAGE value="feat : ajout de colonne pour les Supplier, Address. Modification du numéro de réception et ajout de fixtures" />
<MESSAGE value="feat : mise à jour du bon de réception" /> <MESSAGE value="feat : mise à jour du bon de réception" />
<option name="LAST_COMMIT_MESSAGE" value="feat : mise à jour du bon de réception" /> <MESSAGE value="feat : Ajout de la sélection des bovins étape 3 d'une réception (WIP)" />
<MESSAGE value="feat : ajout du responsive sur la navbar et la page d'accueil" />
<MESSAGE value="fix : logo centré en mod mobile" />
<MESSAGE value="feat : ajout d'un numéro de version automatique via la CI" />
<MESSAGE value="feat : update numéro de version" />
<MESSAGE value="fix : auto-tag-develop.yml" />
<MESSAGE value="feat : test auto-tag-develop.yml (auto incrément version)" />
<option name="LAST_COMMIT_MESSAGE" value="feat : test auto-tag-develop.yml (auto incrément version)" />
</component> </component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
<expand /> <expand />
<select /> <select />
</component> </component>
<component name="github-copilot-workspace">
<instructionFileLocations>
<option value=".github/instructions" />
</instructionFileLocations>
<promptFileLocations>
<option value=".github/prompts" />
</promptFileLocations>
</component>
</project> </project>

View File

@@ -27,6 +27,8 @@ Ajouter dans le fichier .env du frontend
* Ajout du bundle malio/ednotif-bundle * Ajout du bundle malio/ednotif-bundle
* Ajout de composant UI * Ajout de composant UI
* Finalisation de la partie réception de marchandise * Finalisation de la partie réception de marchandise
* [#267] Lister les réceptions en attente
* [#268] Lister les réceptions terminées
### Changed ### Changed

View File

@@ -53,6 +53,8 @@ security:
- { path: ^/api/users, roles: PUBLIC_ACCESS, methods: [GET] } - { path: ^/api/users, roles: PUBLIC_ACCESS, methods: [GET] }
# Doc API (swagger) en public # Doc API (swagger) en public
- { path: ^/api/docs, roles: PUBLIC_ACCESS } - { path: ^/api/docs, roles: PUBLIC_ACCESS }
# Version de l'application en public
- { path: ^/api/version, roles: PUBLIC_ACCESS, methods: [GET] }
# Tout le reste nécessite un JWT # Tout le reste nécessite un JWT
- { path: ^/, roles: IS_AUTHENTICATED_FULLY } - { path: ^/, roles: IS_AUTHENTICATED_FULLY }

View File

@@ -8,6 +8,9 @@
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters: parameters:
imports:
- { resource: version.yaml }
services: services:
# default configuration for services in *this* file # default configuration for services in *this* file
_defaults: _defaults:

2
config/version.yaml Normal file
View File

@@ -0,0 +1,2 @@
parameters:
app.version: '0.0.32'

View File

@@ -3,3 +3,11 @@
<NuxtPage /> <NuxtPage />
</NuxtLayout> </NuxtLayout>
</template> </template>
<script setup lang="ts">
const { load } = useAppVersion()
onMounted(() => {
load()
})
</script>

View File

@@ -0,0 +1,30 @@
<template>
<NuxtLink :to="link">
<div class="w-[324px] h-[228px] border border-black rounded-md p-6 flex flex-col justify-between">
<div class="flex justify-between">
<div class="rounded-full w-[80px] h-[80px] bg-neutral-400 flex justify-center items-center">
<Icon :name="iconName" style="color: black" size="44" />
</div>
<div>
<Icon name="mdi:plus" style="color: black" size="44" />
</div>
</div>
<div class="uppercase font-bold">
<p class="text-3xl"> {{ label }} </p>
</div>
</div>
</NuxtLink>
</template>
<script setup lang="ts">
const props = defineProps<{
link: string
iconName: string
label: string
}>()
</script>

View File

@@ -0,0 +1,183 @@
<template>
<div
v-if="receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.BOVINS"
class="flex flex-col items-center gap-16">
<h1 class="text-4xl uppercase font-bold">Sélection des marchandises réceptionnnées</h1>
<div
class="flex flex-row gap-8 items-center">
<div
v-for="type in bovineType"
:key="type.id"
class="mt-8 flex flex-row mb-2 gap-6">
<UiNumberInput
:label="type.label"
:code="type.code"
v-model="bovineQuantities[String(type.id)]"
:placeholder="0"
:min="0"
:max="10"
/>
</div>
<div
class="mt-8 flex flex-row mb-2 gap-6">
<UiNumberInput
label="Autres"
v-model="otherQuantity"
/>
</div>
</div>
<button
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
@click="goNext"
>Peser
</button>
</div>
</template>
<script setup lang="ts">
import type {BovineTypeData} from "~/services/dto/bovine-type-data";
import {getBovineTypeList} from "~/services/bovine-type";
import {RECEPTION_TYPE_CODES} from "~/utils/constants";
import {useReceptionStore} from '~/stores/reception'
import {
createReceptionBovine,
deleteReceptionBovine,
getReceptionBovineList,
updateReceptionBovine
} from "~/services/reception-bovine";
import {computed, onMounted, reactive, ref, watch} from "vue";
const toast = useToast()
const isLoadingBovineType = ref(false)
const bovineType = ref<BovineTypeData[]>([])
const receptionStore = useReceptionStore()
const bovineQuantities = reactive<Record<string, number | null>>({})
const otherQuantity = ref<number | null>(0)
const receptionId = computed(() => receptionStore.current?.id ?? null)
const receptionIri = computed(() =>
receptionId.value ? `/api/receptions/${receptionId.value}` : null
)
const totalBovines = computed(() => {
const base = Object.values(bovineQuantities).reduce((sum, value) => {
return sum + (value ?? 0)
}, 0)
return base + (otherQuantity.value ?? 0)
})
const loadBovineType = async () => {
isLoadingBovineType.value = true
try {
bovineType.value = await getBovineTypeList()
} finally {
isLoadingBovineType.value = false
}
}
onMounted(async () => {
await loadBovineType()
})
watch(
() => receptionId.value,
async (id) => {
if (!id || !receptionIri.value) {
return
}
const selectionMap: Record<string, number | null> = {}
for (const type of bovineType.value) {
selectionMap[String(type.id)] = 0
}
const existing = await getReceptionBovineList(receptionIri.value)
for (const selection of existing) {
const bovineTypeId = String(selection.bovineType.id)
selectionMap[bovineTypeId] = selection.quantity ?? 0
}
for (const key of Object.keys(bovineQuantities)) {
delete bovineQuantities[key]
}
Object.assign(bovineQuantities, selectionMap)
const existingOther = receptionStore.current?.bovineDetail
const parsedOther =
typeof existingOther === 'string' && existingOther.trim() !== ''
? Number(existingOther)
: 0
otherQuantity.value = Number.isFinite(parsedOther) ? parsedOther : 0
},
{immediate: true}
)
async function syncBovineSelections(receptionIri: string) {
const existing = await getReceptionBovineList(receptionIri)
const existingMap = new Map<string, { id: number; quantity: number | null }>()
for (const selection of existing) {
const bovineTypeId = String(selection.bovineType.id)
existingMap.set(bovineTypeId, {
id: selection.id,
quantity: selection.quantity ?? 0
})
}
// Supprime les entrées supprimées ou modifiées
for (const [bovineTypeId, entry] of existingMap.entries()) {
const selectedQuantity = bovineQuantities[bovineTypeId] ?? 0
if (!selectedQuantity) {
await deleteReceptionBovine(entry.id)
existingMap.delete(bovineTypeId)
continue
}
if (selectedQuantity !== entry.quantity) {
await updateReceptionBovine(entry.id, {quantity: selectedQuantity})
existingMap.set(bovineTypeId, {
id: entry.id,
quantity: selectedQuantity
})
}
}
// Crée les entrées manquantes
for (const [bovineTypeId, quantity] of Object.entries(bovineQuantities)) {
if (!quantity) {
continue
}
if (existingMap.has(bovineTypeId)) {
// Déjà à jour
continue
}
await createReceptionBovine({
reception: receptionIri,
bovineType: `/api/bovine_types/${bovineTypeId}`,
quantity
})
}
}
async function goNext() {
if (!receptionStore.current || !receptionIri.value) {
return
}
// @TODO Ajouter un composable pour le toaster qui gère les key i18n
if (totalBovines.value > 52) {
toast.error({
title: 'Erreur',
message: ('Le total des bovins ne peut pas dépasser 52.')
})
return
}
const nextStep = receptionStore.current.currentStep + 1
await syncBovineSelections(receptionIri.value)
await receptionStore.updateReception(receptionStore.current.id, {
merchandiseType: null,
merchandiseDetail: null,
bovineDetail: otherQuantity.value ? String(otherQuantity.value) : null,
currentStep: nextStep
})
}
</script>

View File

@@ -142,7 +142,8 @@ import type {DriverData} from '~/services/dto/driver-data'
import {getDriverList} from '~/services/driver' import {getDriverList} from '~/services/driver'
import type {VehicleData} from '~/services/dto/vehicle-data' import type {VehicleData} from '~/services/dto/vehicle-data'
import {getVehicleList} from '~/services/vehicle' import {getVehicleList} from '~/services/vehicle'
import {SUPLLIER_CODE} from "~/utils/constants"; import {RECEPTION_TYPE_CODES, SUPLLIER_CODE} from "~/utils/constants";
import {deleteReceptionBovine, getReceptionBovineList} from "~/services/reception-bovine";
type ReceptionFormData = { type ReceptionFormData = {
licensePlate: string licensePlate: string
@@ -222,6 +223,18 @@ const filteredVehicles = computed<VehicleData[]>(() => {
) )
}) })
const selectedReceptionType = computed(() =>
receptionTypes.value.find((type) => String(type.id) === form.receptionTypeId) ?? null
)
// Supprime les données bovines si on change de type de réception
const clearReceptionBovines = async (receptionIri: string) => {
const existing = await getReceptionBovineList(receptionIri)
for (const selection of existing) {
await deleteReceptionBovine(selection.id)
}
}
// Hydrate le formulaire depuis la réception en cours // Hydrate le formulaire depuis la réception en cours
watch( watch(
() => receptionStore.current, () => receptionStore.current,
@@ -509,6 +522,16 @@ async function validate() {
return return
} }
const previousTypeCode = receptionStore.current.receptionType?.code ?? null
const nextTypeCode = selectedReceptionType.value?.code ?? null
const receptionIri = `/api/receptions/${receptionStore.current.id}`
if (
previousTypeCode === RECEPTION_TYPE_CODES.BOVINS &&
nextTypeCode === RECEPTION_TYPE_CODES.MERCHANDISES
) {
await clearReceptionBovines(receptionIri)
}
const nextStep = receptionStore.current.currentStep + 1 const nextStep = receptionStore.current.currentStep + 1
await receptionStore.updateReception(receptionStore.current.id, { await receptionStore.updateReception(receptionStore.current.id, {
currentStep: nextStep, currentStep: nextStep,

View File

@@ -1,10 +1,9 @@
<template> <template>
<div class="flex flex-col items-center gap-16"> <div class="flex flex-col items-center gap-16">
<!-- @TODO voir pour séparer dans un composant au moment de l'implémentation des Bovins -->
<div <div
v-if="receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.MERCHANDISES" v-if="receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.MERCHANDISES"
class="flex flex-col gap-16 items-center w-full"> class="flex flex-col gap-16 items-center w-full">
<h1 class="text-4xl uppercase font-bold">Sélectionner des marchandises réceptionnnées</h1> <h1 class="text-4xl uppercase font-bold">Sélection des marchandises réceptionnnées</h1>
<UiSelect <UiSelect
id="merchandise-type" id="merchandise-type"
v-model="selectedMerchandiseTypeId" v-model="selectedMerchandiseTypeId"
@@ -12,7 +11,6 @@
:options="merchandiseTypes.map((type) => ({ value: String(type.id), label: type.label }))" :options="merchandiseTypes.map((type) => ({ value: String(type.id), label: type.label }))"
wrapper-class="w-[550px]" wrapper-class="w-[550px]"
/> />
<div <div
v-if="selectedMerchandiseTypeId && isAutres" v-if="selectedMerchandiseTypeId && isAutres"
class="flex flex-col w-full max-w-[550px]" class="flex flex-col w-full max-w-[550px]"
@@ -69,25 +67,27 @@
<button <button
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]" class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
@click="goNext" @click="goNext"
>Peser</button> >Peser
</button>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue' import {computed, onMounted, ref} from 'vue'
import { getBuildingList } from '~/services/building' import {getBuildingList} from '~/services/building'
import { getMerchandiseTypeList } from '~/services/merchandise-type' import {getMerchandiseTypeList} from '~/services/merchandise-type'
import type { MerchandiseTypeData } from '~/services/dto/merchandise-type-data' import type {MerchandiseTypeData} from '~/services/dto/merchandise-type-data'
import type { BuildingData } from '~/services/dto/building-data' import type {BuildingData} from '~/services/dto/building-data'
import type { PelletTypeData } from '~/services/dto/pellet-type-data' import type {PelletTypeData} from '~/services/dto/pellet-type-data'
import { getPelletTypeList } from '~/services/pellet-type' import {getPelletTypeList} from '~/services/pellet-type'
import { import {
createReceptionPelletBuilding, createReceptionPelletBuilding,
deleteReceptionPelletBuilding, deleteReceptionPelletBuilding,
getReceptionPelletBuildingList getReceptionPelletBuildingList
} from '~/services/reception-pellet-building' } from '~/services/reception-pellet-building'
import { useReceptionStore } from '~/stores/reception' import {useReceptionStore} from '~/stores/reception'
import { MERCHANDISE_TYPE_CODES, RECEPTION_TYPE_CODES } from '~/utils/constants' import {MERCHANDISE_TYPE_CODES, RECEPTION_TYPE_CODES} from '~/utils/constants'
import ReceptionBovineReceived from "~/components/reception/reception-bovine-received.vue";
const receptionStore = useReceptionStore() const receptionStore = useReceptionStore()
const merchandiseTypes = ref<MerchandiseTypeData[]>([]) const merchandiseTypes = ref<MerchandiseTypeData[]>([])
@@ -173,7 +173,6 @@ onMounted(async () => {
} }
selectedPelletBuildingIds.value = selectionMap selectedPelletBuildingIds.value = selectionMap
}) })
// Enregistre les sélections et passe à l'étape suivante // Enregistre les sélections et passe à l'étape suivante
async function goNext() { async function goNext() {
if (!receptionStore.current) { if (!receptionStore.current) {
@@ -191,6 +190,8 @@ async function goNext() {
buildings: isGranule.value buildings: isGranule.value
? [] ? []
: selectedBuildingIds.value.map((id) => `/api/buildings/${id}`), : selectedBuildingIds.value.map((id) => `/api/buildings/${id}`),
bovineDetail: null,
bovinesTypes: null,
currentStep: nextStep currentStep: nextStep
}) })
@@ -208,7 +209,6 @@ async function clearPelletSelections(receptionIri: string) {
await deleteReceptionPelletBuilding(selection.id) await deleteReceptionPelletBuilding(selection.id)
} }
} }
// Synchronise les associations granulés/bâtiments avec l'état du formulaire // Synchronise les associations granulés/bâtiments avec l'état du formulaire
async function syncPelletSelections(receptionIri: string) { async function syncPelletSelections(receptionIri: string) {
const existing = await getReceptionPelletBuildingList(receptionIri) const existing = await getReceptionPelletBuildingList(receptionIri)
@@ -227,7 +227,7 @@ async function syncPelletSelections(receptionIri: string) {
const desiredEntries: Array<{ pelletTypeId: string; buildingId: string }> = [] const desiredEntries: Array<{ pelletTypeId: string; buildingId: string }> = []
for (const [pelletTypeId, buildingIds] of Object.entries(selectedPelletBuildingIds.value)) { for (const [pelletTypeId, buildingIds] of Object.entries(selectedPelletBuildingIds.value)) {
for (const buildingId of buildingIds) { for (const buildingId of buildingIds) {
desiredEntries.push({ pelletTypeId, buildingId }) desiredEntries.push({pelletTypeId, buildingId})
} }
} }

View File

@@ -0,0 +1,91 @@
<template>
<div :class="['flex flex-row items-center gap-2', wrapperClass]">
<label
v-if="label"
:for="id"
class="text-xl text-bold flex items-center gap-2"
:class="labelClass"
>
<span
v-if="label">
{{ label }}
</span>
<span
v-if="code" class="text-neutral-600">
({{ code }})
</span>
</label>
<input
:id="id"
type="number"
:value="modelValue ?? ''"
:min="min"
:max="max"
:step="step"
:disabled="disabled"
v-bind="attrs"
class="border-b border-black text-xl bg-transparent w-48"
:class="[
isEmpty ? 'text-neutral-400' : 'text-black',
disabled ? 'cursor-not-allowed' : 'cursor-text',
inputClass
]"
@keydown="onKeydown"
@input="onInput"
>
</div>
</template>
<script setup lang="ts">
import {computed, useAttrs} from 'vue'
defineOptions({inheritAttrs: false})
const props = withDefaults(
defineProps<{
id?: string
label?: string
code?: string
modelValue: number | string | null | undefined
min?: number | string
max?: number | string
step?: number | string
disabled?: boolean
wrapperClass?: string
labelClass?: string
inputClass?: string
}>(),
{
min: undefined,
max: undefined,
step: undefined,
disabled: false,
wrapperClass: '',
labelClass: '',
inputClass: ''
}
)
const emit = defineEmits<{
(event: 'update:modelValue', value: number | null): void
}>()
const attrs = useAttrs()
const isEmpty = computed(() => props.modelValue === null || props.modelValue === undefined || props.modelValue === '')
const onInput = (event: Event) => {
const target = event.target as HTMLInputElement
if (target.value === '') {
emit('update:modelValue', null)
return
}
const numeric = Math.max(0, Number(target.value))
emit('update:modelValue', Number.isNaN(numeric) ? null : numeric)
}
const onKeydown = (event: KeyboardEvent) => {
if (event.key === '-' || event.key === 'e' || event.key === 'E') {
event.preventDefault()
}
}
</script>

View File

@@ -0,0 +1,17 @@
export const useAppVersion = () => {
const api = useApi()
const version = useState<string | null>('app-version', () => null)
const load = async () => {
if (version.value) {
return version.value
}
const response = await api.get<{ version: string }>('version', {}, {
toast: false
})
version.value = response.version
return version.value
}
return { version, load }
}

View File

@@ -1,64 +1,72 @@
{ {
"errors": { "errors": {
"http": { "http": {
"get": "Impossible de récupérer les données.", "get": "Impossible de récupérer les données.",
"post": "Impossible de créer la ressource.", "post": "Impossible de créer la ressource.",
"put": "Impossible de mettre à jour la ressource.", "put": "Impossible de mettre à jour la ressource.",
"patch": "Impossible de mettre à jour la ressource.", "patch": "Impossible de mettre à jour la ressource.",
"delete": "Impossible de supprimer la ressource." "delete": "Impossible de supprimer la ressource."
},
"reception": {
"list": "Impossible de récupérer la liste des réceptions.",
"fetch": "Impossible de récupérer la réception.",
"create": "Impossible de créer la réception.",
"update": "Impossible de mettre à jour la réception.",
"weigh": "Impossible de récupérer la pesée."
},
"receptionType": {
"list": "Impossible de récupérer la liste des types de réception."
},
"merchandiseType": {
"list": "Impossible de récupérer la liste des types de marchandises."
},
"building": {
"list": "Impossible de récupérer la liste des bâtiments."
},
"pelletType": {
"list": "Impossible de récupérer la liste des types de granulés."
},
"receptionPelletBuilding": {
"list": "Impossible de récupérer la liste des dépôts de granulés.",
"create": "Impossible d'enregistrer le dépôt de granulés.",
"delete": "Impossible de supprimer le dépôt de granulés."
},
"receptionBovine": {
"list": "Impossible de récupérer la liste des bovins de la réception.",
"create": "Impossible d'enregistrer le bovin.",
"delete": "Impossible de supprimer le bovin."
},
"supplier": {
"list": "Impossible de récupérer la liste des fournisseurs."
},
"truck": {
"list": "Impossible de récupérer la liste des camions."
},
"bovin": {
"list": "Impossible de récupérer la liste des races de bovins."
},
"carrier": {
"list": "Impossible de récupérer la liste des transporteurs."
},
"driver": {
"list": "Impossible de récupérer la liste des chauffeurs."
},
"vehicle": {
"list": "Impossible de récupérer la liste des immatriculations."
},
"auth": {
"login": "Identifiants invalides.",
"users": "Impossible de récupérer les utilisateurs.",
"logout": "Impossible de se déconnecter."
}
}, },
"reception": { "success": {
"list": "Impossible de récupérer la liste des réceptions.", "reception": {
"fetch": "Impossible de récupérer la réception.", "update": "Réception mise à jour avec succès."
"create": "Impossible de créer la réception.", },
"update": "Impossible de mettre à jour la réception.", "auth": {
"weigh": "Impossible de récupérer la pesée." "login": "Connexion réussie.",
}, "logout": "Déconnexion réussie."
"receptionType": { }
"list": "Impossible de récupérer la liste des types de réception."
},
"merchandiseType": {
"list": "Impossible de récupérer la liste des types de marchandises."
},
"building": {
"list": "Impossible de récupérer la liste des bâtiments."
},
"pelletType": {
"list": "Impossible de récupérer la liste des types de granulés."
},
"receptionPelletBuilding": {
"list": "Impossible de récupérer la liste des dépôts de granulés.",
"create": "Impossible d'enregistrer le dépôt de granulés.",
"delete": "Impossible de supprimer le dépôt de granulés."
},
"supplier": {
"list": "Impossible de récupérer la liste des fournisseurs."
},
"truck": {
"list": "Impossible de récupérer la liste des camions."
},
"carrier": {
"list": "Impossible de récupérer la liste des transporteurs."
},
"driver": {
"list": "Impossible de récupérer la liste des chauffeurs."
},
"vehicle": {
"list": "Impossible de récupérer la liste des immatriculations."
},
"auth": {
"login": "Identifiants invalides.",
"users": "Impossible de récupérer les utilisateurs.",
"logout": "Impossible de se déconnecter."
} }
},
"success": {
"reception": {
"update": "Réception mise à jour avec succès."
},
"auth": {
"login": "Connexion réussie.",
"logout": "Déconnexion réussie."
}
}
} }

View File

@@ -0,0 +1,71 @@
<template>
<div class="min-h-screen text-neutral-900 grid grid-rows-[85px,1fr]">
<!-- HEADER -->
<header class="bg-primary-500 z-50 h-[85px]">
<div class="h-full w-full px-6 grid grid-cols-[auto,1fr,auto] items-center gap-8">
<NuxtLink to="/" class="grid place-items-center">
<span class="grid place-items-center bg-white text-xl font-bold uppercase text-primary-500 p-4">
LOGO
</span>
</NuxtLink>
<nav class="text-2xl font-bold uppercase text-white"></nav>
<NuxtLink
to="/"
class="text-xl font-bold uppercase text-white transition hover:opacity-80 justify-self-end"
>
Quitter le panel admin
</NuxtLink>
</div>
</header>
<div class="grid grid-cols-[16rem,1fr] h-[calc(100vh-85px)] min-h-0">
<aside class="bg-primary-500 text-white min-h-0 grid grid-rows-[auto,1fr,auto]">
<div class="p-4 font-semibold">Tableau de bord</div>
<div class="overflow-y-auto min-h-0 p-4 space-y-3">
<!-- Liste des liens à ajouter ci-dessous -->
<!--Button pour afficher le component admin-users -->
<NuxtLink
to="/admin/user-list"
class="block px-4 py-2 rounded hover:bg-primary-600 transition"
>
Utilisateurs
</NuxtLink>
</div>
<div class="p-4">
<p class="font-bold text-white text-left">v{{ version }}</p>
<button
@click="handleLogout"
class="w-full bg-red-600 hover:bg-red-700 py-2 rounded font-bold"
>
Déconnexion
</button>
</div>
</aside>
<main class="min-h-0 overflow-auto px-12 py-12 ">
<div class="w-full ">
<slot />
</div>
</main>
</div>
</div>
</template>
<script setup lang="ts">
import auth from "~/layouts/auth.vue";
const { version } = useAppVersion()
const handleLogout = async () => {
try {
await auth.logout()
} finally {
await navigateTo('/login')
}
}
</script>

View File

@@ -1,15 +1,16 @@
<template> <template>
<div class="min-h-screen bg-white text-neutral-900"> <div class="min-h-screen bg-white text-neutral-900">
<header class="w-full border-b border-neutral-200 bg-primary-500"> <header class="w-full border-b border-neutral-200 bg-primary-500">
<div class="flex w-full items-center px-6 py-4"> <div class="flex w-full items-center justify-center px-6 py-4">
<NuxtLink to="/" class="flex items-center gap-3"> <button
<span type="button"
class="flex items-center justify-center bg-white text-xl font-bold uppercase text-primary-500 p-4" class="inline-flex items-center justify-center text-3xl text-white md:hidden"
> aria-label="Ouvrir le menu"
LOGO @click="toggleMenu"
</span> >
</NuxtLink> <span aria-hidden="true" class="flex items-center"><Icon name="mdi:menu" size="44"/></span>
<nav class="mx-8 flex flex-1 gap-8 text-2xl font-bold uppercase text-white"> </button>
<nav class="ml-4 hidden items-center gap-8 text-2xl font-bold uppercase text-white md:flex">
<NuxtLink to="/" custom v-slot="{ href, navigate, isExactActive }"> <NuxtLink to="/" custom v-slot="{ href, navigate, isExactActive }">
<a <a
:href="href" :href="href"
@@ -19,28 +20,89 @@
Accueil Accueil
</a> </a>
</NuxtLink> </NuxtLink>
<NuxtLink to="/reception" custom v-slot="{ href, navigate, isActive }"> <NuxtLink to="/admin/dashboard" custom v-slot="{ href, navigate, isActive }">
<a <a
:href="href" :href="href"
@click="navigate" @click="navigate"
:class="isReceptionActive ? 'opacity-100' : 'opacity-50'"
> >
Reception Admin
</a> </a>
</NuxtLink> </NuxtLink>
</nav> </nav>
<NuxtLink to="/" class="flex flex-1 items-center justify-center gap-3">
<span
class="flex items-center justify-center bg-white text-xl font-bold uppercase text-primary-500 p-4"
>
LOGO
</span>
</NuxtLink>
<div class="w-[44px] md:hidden"></div>
<button <button
type="button" type="button"
class="ml-auto text-xl font-bold uppercase text-white transition hover:opacity-80" class="ml-auto hidden text-xl font-bold uppercase text-white transition hover:opacity-80 md:inline-flex"
@click="handleLogout" @click="handleLogout"
> >
Déconnexion Déconnexion
</button> </button>
</div> </div>
<transition
enter-active-class="transition duration-200 ease-out"
enter-from-class="opacity-0"
enter-to-class="opacity-100"
leave-active-class="transition duration-150 ease-in"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<div
v-if="isMenuOpen"
class="fixed inset-0 z-40 bg-black/40 md:hidden"
@click="closeMenu"
/>
</transition>
<transition
enter-active-class="transition duration-200 ease-out"
enter-from-class="-translate-x-full"
enter-to-class="translate-x-0"
leave-active-class="transition duration-150 ease-in"
leave-from-class="translate-x-0"
leave-to-class="-translate-x-full"
>
<aside
v-if="isMenuOpen"
class="fixed left-0 top-0 z-50 h-full w-full bg-primary-600 px-6 pb-8 pt-6 text-white shadow-xl md:hidden"
role="dialog"
aria-modal="true"
>
<div class="flex items-center justify-between">
<span class="text-2xl font-bold uppercase">Menu</span>
<button
type="button"
class="text-2xl"
aria-label="Fermer le menu"
@click="closeMenu"
>
<Icon name="mdi:close" size="44"/>
</button>
</div>
<nav class="mt-8 flex flex-col gap-6 text-xl font-bold uppercase">
<NuxtLink to="/" class="opacity-100" @click="closeMenu">Accueil</NuxtLink>
</nav>
<button
type="button"
class="mt-5 text-xl font-bold uppercase"
@click="handleLogout"
>
Déconnexion
</button>
</aside>
</transition>
</header> </header>
<main class="mx-auto w-full max-w-[1280px] px-6 pt-[85px] pb-0"> <main class="mx-auto w-full max-w-[1280px] pb-0">
<slot/> <slot/>
</main> </main>
<footer class="w-full mt-8 bg-primary-500 p-6">
<p class="font-bold text-white text-right">v{{ version }}</p>
</footer>
</div> </div>
</template> </template>
@@ -49,12 +111,22 @@ import { useAuthStore } from '~/stores/auth'
const route = useRoute() const route = useRoute()
const auth = useAuthStore() const auth = useAuthStore()
const isReceptionActive = computed(() => route.path.startsWith('/reception')) const isMenuOpen = ref(false)
const { version } = useAppVersion()
const closeMenu = () => {
isMenuOpen.value = false
}
const toggleMenu = () => {
isMenuOpen.value = !isMenuOpen.value
}
const handleLogout = async () => { const handleLogout = async () => {
try { try {
await auth.logout() await auth.logout()
} finally { } finally {
closeMenu()
await navigateTo('/login') await navigateTo('/login')
} }
} }

View File

@@ -9,7 +9,8 @@ export default defineNuxtConfig({
'@nuxtjs/tailwindcss', '@nuxtjs/tailwindcss',
'@pinia/nuxt', '@pinia/nuxt',
'nuxt-toast', 'nuxt-toast',
'@nuxtjs/i18n' '@nuxtjs/i18n',
'@nuxt/icon'
], ],
css: ['~/assets/css/main.css', '~/assets/css/toast.css'], css: ['~/assets/css/main.css', '~/assets/css/toast.css'],
runtimeConfig: { runtimeConfig: {

View File

@@ -7,6 +7,7 @@
"name": "frontend", "name": "frontend",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"@nuxt/icon": "^2.2.1",
"@nuxtjs/i18n": "^10.2.1", "@nuxtjs/i18n": "^10.2.1",
"@pinia/nuxt": "^0.11.3", "@pinia/nuxt": "^0.11.3",
"izitoast": "^1.4.0", "izitoast": "^1.4.0",
@@ -35,6 +36,19 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/@antfu/install-pkg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@antfu/install-pkg/-/install-pkg-1.1.0.tgz",
"integrity": "sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ==",
"license": "MIT",
"dependencies": {
"package-manager-detector": "^1.3.0",
"tinyexec": "^1.0.1"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
"version": "7.27.1", "version": "7.27.1",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
@@ -1248,6 +1262,47 @@
"url": "https://github.com/sponsors/nzakas" "url": "https://github.com/sponsors/nzakas"
} }
}, },
"node_modules/@iconify/collections": {
"version": "1.0.646",
"resolved": "https://registry.npmjs.org/@iconify/collections/-/collections-1.0.646.tgz",
"integrity": "sha512-zA5Gr1MJm1SI0TjOUl7wu4kvBWXQ6Uh8ALEtqQ5ucXyUxP2M8m2bk2hfVtGykSdMlDB+Xs2AHbJ9pQqayz9WGQ==",
"license": "MIT",
"dependencies": {
"@iconify/types": "*"
}
},
"node_modules/@iconify/types": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz",
"integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==",
"license": "MIT"
},
"node_modules/@iconify/utils": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-3.1.0.tgz",
"integrity": "sha512-Zlzem1ZXhI1iHeeERabLNzBHdOa4VhQbqAcOQaMKuTuyZCpwKbC2R4Dd0Zo3g9EAc+Y4fiarO8HIHRAth7+skw==",
"license": "MIT",
"dependencies": {
"@antfu/install-pkg": "^1.1.0",
"@iconify/types": "^2.0.0",
"mlly": "^1.8.0"
}
},
"node_modules/@iconify/vue": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@iconify/vue/-/vue-5.0.0.tgz",
"integrity": "sha512-C+KuEWIF5nSBrobFJhT//JS87OZ++QDORB6f2q2Wm6fl2mueSTpFBeBsveK0KW9hWiZ4mNiPjsh6Zs4jjdROSg==",
"license": "MIT",
"dependencies": {
"@iconify/types": "^2.0.0"
},
"funding": {
"url": "https://github.com/sponsors/cyberalien"
},
"peerDependencies": {
"vue": ">=3"
}
},
"node_modules/@intlify/bundle-utils": { "node_modules/@intlify/bundle-utils": {
"version": "11.0.3", "version": "11.0.3",
"resolved": "https://registry.npmjs.org/@intlify/bundle-utils/-/bundle-utils-11.0.3.tgz", "resolved": "https://registry.npmjs.org/@intlify/bundle-utils/-/bundle-utils-11.0.3.tgz",
@@ -2268,6 +2323,28 @@
"devtools-wizard": "cli.mjs" "devtools-wizard": "cli.mjs"
} }
}, },
"node_modules/@nuxt/icon": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@nuxt/icon/-/icon-2.2.1.tgz",
"integrity": "sha512-GI840yYGuvHI0BGDQ63d6rAxGzG96jQcWrnaWIQKlyQo/7sx9PjXkSHckXUXyX1MCr9zY6U25Td6OatfY6Hklw==",
"license": "MIT",
"dependencies": {
"@iconify/collections": "^1.0.641",
"@iconify/types": "^2.0.0",
"@iconify/utils": "^3.1.0",
"@iconify/vue": "^5.0.0",
"@nuxt/devtools-kit": "^3.1.1",
"@nuxt/kit": "^4.2.2",
"consola": "^3.4.2",
"local-pkg": "^1.1.2",
"mlly": "^1.8.0",
"ohash": "^2.0.11",
"pathe": "^2.0.3",
"picomatch": "^4.0.3",
"std-env": "^3.10.0",
"tinyglobby": "^0.2.15"
}
},
"node_modules/@nuxt/kit": { "node_modules/@nuxt/kit": {
"version": "4.2.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/@nuxt/kit/-/kit-4.2.2.tgz", "resolved": "https://registry.npmjs.org/@nuxt/kit/-/kit-4.2.2.tgz",

View File

@@ -11,6 +11,7 @@
"build:dist": "nuxt generate && rm -rf dist && cp -R .output/public dist" "build:dist": "nuxt generate && rm -rf dist && cp -R .output/public dist"
}, },
"dependencies": { "dependencies": {
"@nuxt/icon": "^2.2.1",
"@nuxtjs/i18n": "^10.2.1", "@nuxtjs/i18n": "^10.2.1",
"@pinia/nuxt": "^0.11.3", "@pinia/nuxt": "^0.11.3",
"izitoast": "^1.4.0", "izitoast": "^1.4.0",

View File

@@ -0,0 +1,13 @@
<template>
<admin-users v-if="activeCode === 'users'" />
</template>
<script setup lang="ts">
definePageMeta({
layout: 'admin'
})
const route = useRoute()
const activeCode = computed(() => (route.query.code as string))
</script>

View File

@@ -0,0 +1,64 @@
<template>
<div class="flex items-center justify-between gap-10">
<h1 class="text-3xl font-bold uppercase">Utilisateurs</h1>
<button
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
@click="null"
>
Ajouter
</button>
</div>
<div>
<div class="mt-6 border border-slate-200 mb-16 ">
<div class="grid grid-cols-3 gap-4 bg-slate-100 px-4 py-3 text-sm font-semibold uppercase tracking-wide">
<div>Username</div>
<div>Role</div>
<div>Action</div>
</div>
<div
v-for="user in userList"
:key="user.id"
class="grid grid-cols-3 gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200 items-center"
role="button"
tabindex="0"
>
<div>
{{ user.username}}
</div>
<div>
{{ user.roles?.join(', ') || ' ---' }}
</div>
<div>
<div class="p-4">
<button
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
@click="null"
>
Modifier
</button>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
definePageMeta({
layout: 'admin'
})
import type {UserData} from "~/services/dto/user-data";
import {getUsers} from "~/services/auth";
const userList = ref<UserData[]>([])
onMounted(async () => {
userList.value = await getUsers()
})
</script>

View File

@@ -1,55 +1,15 @@
<script setup lang="ts">
</script>
<template> <template>
<div> <div class="flex flex-wrap justify-center mt-8 gap-8 mb-8 md:mb-0">
<h1 class="text-3xl font-bold">Liste des receptions</h1> <card-link label="NOUVELLE RÉCEPTION" link="/reception" iconName="mdi:truck-outline" />
<div class="mt-6 border border-slate-200"> <card-link label="NOUVELLE EXPÉDITION" link="/" iconName="mdi:truck-fast-outline" />
<div class="grid grid-cols-6 gap-4 bg-slate-100 px-4 py-3 text-sm font-semibold uppercase tracking-wide"> <card-link label="PLAN DE SITE" link="/" iconName="mdi:warehouse" />
<div>ID</div> <card-link label="RÉCEPTIONS EN ATTENTE" link="/reception/waiting-reception" iconName="mdi:truck-remove-outline" />
<div>Immatriculation</div> <card-link label="EXPÉDITIONS EN ATTENTE" link="/" iconName="mdi:truck-cargo-container" />
<div>Pesée plein</div> <card-link label="CASES" link="/" iconName="mdi:cube-outline" />
<div>Pesée vide</div> <card-link label="RÉCEPTIONS FINIES" link="/reception/finish-reception" iconName="mdi:truck-check-outline" />
<div>Etape</div> <card-link label="EXPÉDITIONS FINIES" link="/" iconName="mdi:truck-delivery-outline" />
<div>Date</div> <card-link label="PASSEPORT DU BOVIN" link="/" iconName="mdi:cow" />
</div>
<div
v-for="reception in receptionList"
:key="reception.id"
class="grid grid-cols-6 gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200"
role="button"
tabindex="0"
@click="goToReception(reception.id)"
@keydown.enter="goToReception(reception.id)"
>
<div>{{ reception.id }}</div>
<div>{{ reception.licensePlate }}</div>
<div>{{ formatWeighing(reception, 'gross') }}</div>
<div>{{ formatWeighing(reception, 'tare') }}</div>
<div>{{ reception.currentStep }}</div>
<div>{{ reception.receptionDate }}</div>
</div>
</div>
</div> </div>
</template> </template>
<script setup lang="ts">
import type {ReceptionData} from "~/services/dto/reception-data";
import {getReceptionList} from "~/services/reception";
const receptionList = ref<ReceptionData[]>()
const router = useRouter()
const goToReception = (id: number) => {
router.push(`/reception/${id}`)
}
const formatWeighing = (reception: ReceptionData, type: 'gross' | 'tare') => {
const entry = reception.weights?.find((weight) => weight.type === type)
if (!entry || entry.weight == null || entry.dsd == null) {
return '—'
}
return `${entry.weight} kg / ${entry.dsd} dsd`
}
onMounted(async () => {
receptionList.value = await getReceptionList()
})
</script>

View File

@@ -46,7 +46,8 @@
> >
Connexion Connexion
</button> </button>
</form> <p class="font-bold">v{{ version }}</p>
</form>
</div> </div>
</template> </template>
@@ -57,6 +58,7 @@ import { useAuthStore } from '~/stores/auth'
const router = useRouter() const router = useRouter()
const auth = useAuthStore() const auth = useAuthStore()
const { version } = useAppVersion()
definePageMeta({ definePageMeta({
layout: 'auth' layout: 'auth'

View File

@@ -16,7 +16,12 @@
</div> </div>
<ReceptionForm v-if="!storeReception || storeReception.currentStep === 0"/> <ReceptionForm v-if="!storeReception || storeReception.currentStep === 0"/>
<ReceptionWeight v-if="storeReception?.currentStep === 1" mode="gross"/> <ReceptionWeight v-if="storeReception?.currentStep === 1" mode="gross"/>
<ReceptionProductReceived v-if="storeReception?.currentStep === 2"/> <ReceptionProductReceived
v-if="storeReception?.currentStep === 2 &&
receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.MERCHANDISES"/>
<ReceptionBovineReceived
v-if="storeReception?.currentStep === 2 &&
receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.BOVINS"/>
<ReceptionWeight v-if="storeReception?.currentStep !== null && storeReception?.currentStep >= 3" mode="tare"/> <ReceptionWeight v-if="storeReception?.currentStep !== null && storeReception?.currentStep >= 3" mode="tare"/>
</div> </div>
</template> </template>
@@ -25,6 +30,7 @@
import {useReceptionStore} from '~/stores/reception' import {useReceptionStore} from '~/stores/reception'
import {storeToRefs} from 'pinia' import {storeToRefs} from 'pinia'
import {RECEPTION_STEP_LABELS} from '~/constants/steps' import {RECEPTION_STEP_LABELS} from '~/constants/steps'
import {RECEPTION_TYPE_CODES} from "~/utils/constants";
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()

View File

@@ -0,0 +1,53 @@
<template>
<div class="flex items-center justify-start gap-10">
<Icon @click="router.push('/')" name="gg:arrow-left-o" style="color: black" size="44" />
<h1 class="text-3xl font-bold uppercase">listes des réceptions finie</h1>
</div>
<div class="ps-20 " >
<div class="mt-6 border border-slate-200 mb-16 ">
<div class="grid grid-cols-6 gap-4 bg-slate-100 px-4 py-3 text-sm font-semibold uppercase tracking-wide">
<div>Numéro</div>
<div>Date</div>
<div>Fournisseur</div>
<div>Adresse</div>
<div>Type réception</div>
<div>Poids</div>
</div>
<div
v-for="reception in receptionList"
:key="reception.id"
class="grid grid-cols-6 gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200"
role="button"
tabindex="0"
>
<div>{{ reception.identificationNumber}}</div>
<div>{{ reception.receptionDate}}</div>
<div>{{ reception.supplier?.name }}</div>
<div>{{ reception.address?.fullAddress }}</div>
<div>{{ reception.receptionType?.label }}</div>
<div>{{ formatWeighing(reception, 'gross') }} | {{ formatWeighing(reception, 'tare') }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import type {ReceptionData} from "~/services/dto/reception-data";
import {getReceptionList} from "~/services/reception";
const receptionList = ref<ReceptionData[]>()
const router = useRouter()
const formatWeighing = (reception: ReceptionData, type: 'gross' | 'tare') => {
const entry = reception.weights?.find((weight) => weight.type === type)
if (!entry || entry.weight == null || entry.dsd == null) {
return '—'
}
return `${entry.weight} kg`
}
onMounted(async () => {
receptionList.value = await getReceptionList(true)
})
</script>

View File

@@ -0,0 +1,51 @@
<template>
<div class="flex items-center justify-between ">
<div class="flex items-center gap-10">
<Icon @click="router.push('/')" name="gg:arrow-left-o" style="color: black" size="44" />
<h1 class="text-3xl font-bold uppercase">listes des réceptions en attente</h1>
</div>
</div>
<div class="ps-20 " >
<div class="mt-6 border border-slate-200 mb-16 ">
<div class="grid grid-cols-5 gap-4 bg-slate-100 px-4 py-3 text-sm font-semibold uppercase tracking-wide">
<div>Fournisseur</div>
<div>Adresse</div>
<div>Type réception</div>
<div>Transporteur</div>
<div>Immatriculation</div>
</div>
<div
v-for="reception in receptionList"
:key="reception.id"
class="grid grid-cols-5 gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200"
role="button"
tabindex="0"
@click="goToReception(reception.id)"
@keydown.enter="goToReception(reception.id)"
>
<div>{{ reception.supplier?.name }}</div>
<div>{{ reception.address?.fullAddress }}</div>
<div>{{ reception.receptionType?.label }}</div>
<div>{{ reception.carrier?.name }}</div>
<div>{{ reception.licensePlate }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import type {ReceptionData} from "~/services/dto/reception-data";
import {getReceptionList} from "~/services/reception";
const receptionList = ref<ReceptionData[]>()
const router = useRouter()
const goToReception = (id: number) => {
router.push(`/reception/${id}`)
}
onMounted(async () => {
receptionList.value = await getReceptionList(false)
})
</script>

View File

@@ -0,0 +1,23 @@
import { useApi } from '~/composables/useApi'
import type {BovineTypeData} from "~/services/dto/bovine-type-data";
export type BovineTypeListResponse =
| BovineTypeData[]
| { 'hydra:member'?: BovineTypeData[] }
export async function getBovineTypeList(): Promise<BovineTypeData[]> {
const api = useApi()
const response = await api.get<BovineTypeListResponse>('bovine_types', {}, {
toastErrorKey: 'errors.bovin.list'
})
if (Array.isArray(response)) {
return response
}
if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) {
return response['hydra:member']
}
return []
}

View File

@@ -0,0 +1,5 @@
export interface BovineTypeData{
id: number
label: string
code: string
}

View File

@@ -0,0 +1,8 @@
import type {BovineTypeData} from "~/services/dto/bovine-type-data";
export interface ReceptionBovineTypeData{
id: number
quantity : number
reception?: string
bovineType: BovineTypeData
}

View File

@@ -8,6 +8,7 @@ import type { AddressData } from '~/services/dto/address-data'
import type { TruckData } from '~/services/dto/truck-data' import type { TruckData } from '~/services/dto/truck-data'
import type { CarrierData } from '~/services/dto/carrier-data' import type { CarrierData } from '~/services/dto/carrier-data'
import type { DriverData } from '~/services/dto/driver-data' import type { DriverData } from '~/services/dto/driver-data'
import type {BovineTypeData} from "~/services/dto/bovine-type-data";
export interface ReceptionData { export interface ReceptionData {
id: number id: number
@@ -20,7 +21,9 @@ export interface ReceptionData {
receptionType?: ReceptionTypeData | null receptionType?: ReceptionTypeData | null
merchandiseType?: MerchandiseTypeData | null merchandiseType?: MerchandiseTypeData | null
merchandiseDetail?: string | null merchandiseDetail?: string | null
bovineDetail?: string | null
buildings?: BuildingData[] | null buildings?: BuildingData[] | null
bovinesTypes?: BovineTypeData[] | null
pelletBuildings?: ReceptionPelletBuildingData[] | null pelletBuildings?: ReceptionPelletBuildingData[] | null
user?: UserData | null user?: UserData | null
supplier?: SupplierData | null supplier?: SupplierData | null
@@ -46,7 +49,9 @@ export type ReceptionPayload = {
receptionType?: string | null receptionType?: string | null
merchandiseType?: string | null merchandiseType?: string | null
merchandiseDetail?: string | null merchandiseDetail?: string | null
bovineDetail?: string | null
buildings?: string[] | null buildings?: string[] | null
bovinesTypes?: string[] | null
user?: string | null user?: string | null
supplier?: string | null supplier?: string | null
address?: string | null address?: string | null

View File

@@ -1,4 +1,5 @@
export interface UserData { export interface UserData {
id: number id: number
username: string username: string
roles?: string[]
} }

View File

@@ -0,0 +1,59 @@
import { useApi } from '~/composables/useApi'
import type { ReceptionBovineTypeData } from '~/services/dto/reception-bovine-data'
export type ReceptionBovineListResponse =
| ReceptionBovineTypeData[]
| { 'hydra:member'?: ReceptionBovineTypeData[] }
export type ReceptionBovinePayload = {
quantity: number
reception: string
bovineType: string
}
export async function getReceptionBovineList(
receptionIri: string
): Promise<ReceptionBovineTypeData[]> {
const api = useApi()
const response = await api.get<ReceptionBovineListResponse>(
'reception_bovines',
{ reception: receptionIri },
{
toastErrorKey: 'errors.receptionBovine.list'
}
)
if (Array.isArray(response)) {
return response
}
if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) {
return response['hydra:member']
}
return []
}
export async function createReceptionBovine(
payload: ReceptionBovinePayload
): Promise<ReceptionBovineTypeData> {
const api = useApi()
return api.post<ReceptionBovineTypeData>('reception_bovines', payload, {
toastErrorKey: 'errors.receptionBovine.create'
})
}
export async function deleteReceptionBovine(id: number): Promise<void> {
const api = useApi()
await api.delete<void>(`reception_bovines/${id}`, {}, {
toastErrorKey: 'errors.receptionBovine.delete'
})
}
export async function updateReceptionBovine(
id: number,
payload: Partial<ReceptionBovinePayload>
): Promise<ReceptionBovineTypeData> {
const api = useApi()
return api.patch<ReceptionBovineTypeData>(`reception_bovines/${id}`, payload, {
toastErrorKey: 'errors.receptionBovine.update'
})
}

View File

@@ -2,13 +2,15 @@ import {useApi} from '~/composables/useApi'
import type {ReceptionData, ReceptionPayload} from '~/services/dto/reception-data' import type {ReceptionData, ReceptionPayload} from '~/services/dto/reception-data'
import type {WeightData} from '~/services/dto/weight-data' import type {WeightData} from '~/services/dto/weight-data'
export async function getReceptionList() { export async function getReceptionList(isValid: boolean|null = null) {
const api = useApi() const api = useApi()
return api.get<ReceptionData>(`receptions`, {}, { const query = isValid !== null ? { isValid: isValid} : {}
return api.get<ReceptionData[]>('receptions', query, {
toastErrorKey: 'errors.reception.list' toastErrorKey: 'errors.reception.list'
}) })
} }
export async function getReception(id: number) { export async function getReception(id: number) {
const api = useApi() const api = useApi()
return api.get<ReceptionData>(`receptions/${id}`, {}, { return api.get<ReceptionData>(`receptions/${id}`, {}, {

View File

@@ -1,5 +1,6 @@
export const RECEPTION_TYPE_CODES = { export const RECEPTION_TYPE_CODES = {
MERCHANDISES: 'MARCHANDISES' MERCHANDISES: 'MARCHANDISES',
BOVINS: 'BOVINS'
} as const } as const
export const MERCHANDISE_TYPE_CODES = { export const MERCHANDISE_TYPE_CODES = {

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260203123833 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE bovine_type (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, label VARCHAR(120) NOT NULL, code VARCHAR(50) NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE TABLE reception_bovine (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, quantity INT NOT NULL, reception_id INT DEFAULT NULL, bovine_type_id INT NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE INDEX IDX_636B9DB97C14DF52 ON reception_bovine (reception_id)');
$this->addSql('CREATE INDEX IDX_636B9DB97899F32E ON reception_bovine (bovine_type_id)');
$this->addSql('ALTER TABLE reception_bovine ADD CONSTRAINT FK_636B9DB97C14DF52 FOREIGN KEY (reception_id) REFERENCES reception (id)');
$this->addSql('ALTER TABLE reception_bovine ADD CONSTRAINT FK_636B9DB97899F32E FOREIGN KEY (bovine_type_id) REFERENCES bovine_type (id) NOT DEFERRABLE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE reception_bovine DROP CONSTRAINT FK_636B9DB97C14DF52');
$this->addSql('ALTER TABLE reception_bovine DROP CONSTRAINT FK_636B9DB97899F32E');
$this->addSql('DROP TABLE bovine_type');
$this->addSql('DROP TABLE reception_bovine');
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260204141406 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE reception_bovine ALTER quantity SET DEFAULT 0');
$this->addSql('CREATE UNIQUE INDEX uniq_reception_bovine_type ON reception_bovine (reception_id, bovine_type_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX uniq_reception_bovine_type');
$this->addSql('ALTER TABLE reception_bovine ALTER quantity DROP DEFAULT');
}
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260205070819 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE reception ADD bovine_detail VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE reception DROP bovine_detail');
}
}

View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace App\ApiResource;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\State\AppVersionProvider;
use Symfony\Component\Serializer\Attribute\Groups;
#[ApiResource(
operations: [
new Get(
uriTemplate: '/version',
normalizationContext: ['groups' => ['version:read']],
provider: AppVersionProvider::class,
),
],
)]
final class AppVersion
{
#[Groups(['version:read'])]
public string $version = '';
}

View File

70
src/Entity/BovineType.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity]
#[ApiResource(
operations: [
new Get(
requirements: ['id' => '\d+'],
normalizationContext: ['groups' => ['bovine-type:read']],
),
new GetCollection(
normalizationContext: ['groups' => ['bovine-type:read']],
),
],
security: "is_granted('ROLE_USER')",
)]
class BovineType
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['bovine-type:read', 'reception:read', 'reception-bovine:read'])]
private ?int $id = null;
#[ORM\Column(length: 120)]
#[Groups(['bovine-type:read', 'reception:read', 'reception-bovine:read'])]
private ?string $label = null;
#[ORM\Column(length: 50)]
#[Groups(['bovine-type:read', 'reception:read', 'reception-bovine:read'])]
private ?string $code = null;
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): static
{
$this->label = $label;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): static
{
$this->code = $code;
return $this;
}
}

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Entity; namespace App\Entity;
use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\Get;
@@ -26,6 +28,7 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
#[ORM\Entity] #[ORM\Entity]
#[ORM\HasLifecycleCallbacks] #[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'reception')] #[ORM\Table(name: 'reception')]
#[ApiFilter(BooleanFilter::class, properties: ['isValid'])]
#[ApiResource( #[ApiResource(
operations: [ operations: [
new Get( new Get(
@@ -72,27 +75,27 @@ class Reception
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue] #[ORM\GeneratedValue]
#[ORM\Column] #[ORM\Column]
#[Groups(['reception:read'])] #[Groups(['reception:read', 'reception-bovine:read'])]
private ?int $id = null; private ?int $id = null;
#[ORM\Column(length: 20, nullable: true)] #[ORM\Column(length: 20, nullable: true)]
#[Groups(['reception:read', 'reception:write'])] #[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
private ?string $licensePlate = null; private ?string $licensePlate = null;
#[ORM\Column(length: 20, unique: true, nullable: true)] #[ORM\Column(length: 20, unique: true, nullable: true)]
#[Groups(['reception:read'])] #[Groups(['reception:read', 'reception-bovine:read'])]
private ?string $identificationNumber = null; private ?string $identificationNumber = null;
#[ORM\Column(options: ['default' => 0])] #[ORM\Column(options: ['default' => 0])]
#[Groups(['reception:read', 'reception:write'])] #[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
private int $currentStep = 0; private int $currentStep = 0;
#[ORM\Column(options: ['default' => false])] #[ORM\Column(options: ['default' => false])]
#[Groups(['reception:read', 'reception:write'])] #[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
private bool $isValid = false; private bool $isValid = false;
#[ORM\Column(name: 'date_reception', type: 'datetime_immutable')] #[ORM\Column(name: 'date_reception', type: 'datetime_immutable')]
#[Groups(['reception:read', 'reception:write'])] #[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])] #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
private ?DateTimeImmutable $receptionDate = null; private ?DateTimeImmutable $receptionDate = null;
@@ -168,6 +171,20 @@ class Reception
#[ApiProperty(readableLink: true)] #[ApiProperty(readableLink: true)]
private ?Driver $driver = null; private ?Driver $driver = null;
/**
* @var Collection<int, ReceptionBovine>
*/
#[ORM\OneToMany(targetEntity: ReceptionBovine::class, mappedBy: 'reception', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[Assert\Range(
min: 0
)]
#[Groups(['reception:read', 'reception:write'])]
private Collection $bovines_types;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['reception:read', 'reception:write'])]
private ?string $bovineDetail = null;
public function __construct( public function __construct(
?DateTimeImmutable $receptionDate = null, ?DateTimeImmutable $receptionDate = null,
) { ) {
@@ -175,6 +192,7 @@ class Reception
$this->weights = new ArrayCollection(); $this->weights = new ArrayCollection();
$this->buildings = new ArrayCollection(); $this->buildings = new ArrayCollection();
$this->pelletBuildings = new ArrayCollection(); $this->pelletBuildings = new ArrayCollection();
$this->bovines_types = new ArrayCollection();
} }
public function getId(): ?int public function getId(): ?int
@@ -469,4 +487,46 @@ class Reception
) )
; ;
} }
/**
* @return Collection<int, ReceptionBovine>
*/
public function getBovinesTypes(): Collection
{
return $this->bovines_types;
}
public function addBovinesType(ReceptionBovine $bovinesType): static
{
if (!$this->bovines_types->contains($bovinesType)) {
$this->bovines_types->add($bovinesType);
$bovinesType->setReception($this);
}
return $this;
}
public function removeBovinesType(ReceptionBovine $bovinesType): static
{
if ($this->bovines_types->removeElement($bovinesType)) {
// set the owning side to null (unless already changed)
if ($bovinesType->getReception() === $this) {
$bovinesType->setReception(null);
}
}
return $this;
}
public function getBovineDetail(): ?string
{
return $this->bovineDetail;
}
public function setBovineDetail(?string $bovineDetail): static
{
$this->bovineDetail = $bovineDetail;
return $this;
}
} }

View File

@@ -0,0 +1,109 @@
<?php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity]
#[ApiFilter(SearchFilter::class, properties: ['reception' => 'exact'])]
#[ORM\UniqueConstraint(name: 'uniq_reception_bovine_type', columns: ['reception_id', 'bovine_type_id'])]
#[ApiResource(
operations: [
new Get(
requirements: ['id' => '\d+'],
normalizationContext: ['groups' => ['reception-bovine:read']],
),
new GetCollection(
normalizationContext: ['groups' => ['reception-bovine:read']],
),
new Post(
normalizationContext: ['groups' => ['reception-bovine:read']],
denormalizationContext: ['groups' => ['reception-bovine:write']],
),
new Patch(
normalizationContext: ['groups' => ['reception-bovine:read']],
denormalizationContext: ['groups' => ['reception-bovine:write']],
),
new Delete(),
],
security: "is_granted('ROLE_USER')",
)]
class ReceptionBovine
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['reception-bovine:read', 'reception:read'])]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'bovines_types')]
#[Groups(['reception-bovine:read', 'reception-bovine:write'])]
private ?Reception $reception = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
#[Groups(['reception-bovine:read', 'reception-bovine:write', 'reception:read'])]
#[ApiProperty(readableLink: true)]
private ?BovineType $bovineType = null;
#[ORM\Column(options: ['default' => 0])]
#[Assert\Range(
min: 0
)]
#[Groups(['reception-bovine:read', 'reception-bovine:write', 'reception:read'])]
private ?int $quantity = null;
public function getId(): ?int
{
return $this->id;
}
public function getReception(): ?Reception
{
return $this->reception;
}
public function setReception(?Reception $reception): static
{
$this->reception = $reception;
return $this;
}
public function getBovineType(): ?BovineType
{
return $this->bovineType;
}
public function setBovineType(?BovineType $bovineType): static
{
$this->bovineType = $bovineType;
return $this;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(int $quantity): static
{
$this->quantity = $quantity;
return $this;
}
}

View File

@@ -49,6 +49,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
private string $username = ''; private string $username = '';
#[ORM\Column(type: 'json')] #[ORM\Column(type: 'json')]
#[Groups(['user:read'])]
private array $roles = []; private array $roles = [];
#[ORM\Column] #[ORM\Column]

View File

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\State;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
use App\ApiResource\AppVersion;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
final readonly class AppVersionProvider implements ProviderInterface
{
public function __construct(
#[Autowire('%app.version%')]
private string $version,
) {}
public function provide(Operation $operation, array $uriVariables = [], array $context = []): AppVersion
{
$dto = new AppVersion();
$dto->version = $this->version;
return $dto;
}
}