Compare commits

..

4 Commits

19 changed files with 193 additions and 304 deletions

View File

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

View File

@@ -1,10 +0,0 @@
<?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>

172
.idea/workspace.xml generated
View File

@@ -4,16 +4,10 @@
<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 : test auto-tag-develop.yml (auto incrément version)"> <list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="feat : Création d'une page d'administration listing des fournisseurs">
<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/pages/admin/supplierList.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/supplierList.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" />
@@ -27,6 +21,7 @@
<component name="CopilotPersistence"> <component name="CopilotPersistence">
<persistenceIdMap> <persistenceIdMap>
<entry key="_//wsl.localhost/Ubuntu-24.04/home/kevin/Stage/Ferme" value="381AhnCm9yPeOiWgMObKHhtgv2C" /> <entry key="_//wsl.localhost/Ubuntu-24.04/home/kevin/Stage/Ferme" value="381AhnCm9yPeOiWgMObKHhtgv2C" />
<entry key="_//wsl.localhost/Ubuntu-24.04/home/matte/Ferme" value="39QGG8hGN52IW0kjhmS0rLvVr56" />
</persistenceIdMap> </persistenceIdMap>
</component> </component>
<component name="EmbeddingIndexingInfo"> <component name="EmbeddingIndexingInfo">
@@ -36,15 +31,15 @@
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
<option value="Vue Composition API Component" />
<option value="TypeScript File" /> <option value="TypeScript File" />
<option value="Vue Composition API Component" />
</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="feat/256-reception-etape-3-bovin" /> <entry key="$PROJECT_DIR$" value="develop" />
</map> </map>
</option> </option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -62,7 +57,7 @@
</server> </server>
</servers> </servers>
</component> </component>
<component name="PhpWorkspaceProjectConfiguration" interpreter_name="C:/php-8.4.3/php.exe"> <component name="PhpWorkspaceProjectConfiguration" interpreter_name="C:/php/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" />
@@ -225,36 +220,39 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;RunOnceActivity.MCP Project settings loaded&quot;: &quot;true&quot;, "RunOnceActivity.MCP Project settings loaded": "true",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252&quot;: &quot;true&quot;, "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;, "RunOnceActivity.git.unshallow": "true",
&quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;, "RunOnceActivity.typescript.service.memoryLimit.init": "true",
&quot;git-widget-placeholder&quot;: &quot;develop&quot;, "com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
&quot;last_opened_file_path&quot;: &quot;/home/sroy/Documents/test/Ferme&quot;, "git-widget-placeholder": "feat/312-creation-d-une-page-d-administration-listing-des-fournisseurs",
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;, "junie.onboarding.icon.badge.shown": "true",
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;, "last_opened_file_path": "/home/sroy/Documents/test/Ferme",
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;, "node.js.detected.package.eslint": "true",
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;, "node.js.detected.package.tslint": "true",
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;, "node.js.selected.package.eslint": "(autodetect)",
&quot;settings.editor.selected.configurable&quot;: &quot;configurable.tailwindcss&quot;, "node.js.selected.package.tslint": "(autodetect)",
&quot;ts.external.directory.path&quot;: &quot;/opt/phpstorm/plugins/javascript-plugin/jsLanguageServicesImpl/external&quot;, "nodejs_package_manager_path": "npm",
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; "settings.editor.selected.configurable": "proofread",
"to.speed.mode.migration.done": "true",
"ts.external.directory.path": "/opt/phpstorm/plugins/javascript-plugin/jsLanguageServicesImpl/external",
"vue.rearranger.settings.migration": "true"
}, },
&quot;keyToStringList&quot;: { "keyToStringList": {
&quot;DatabaseDriversLRU&quot;: [ "DatabaseDriversLRU": [
&quot;postgresql&quot; "postgresql"
], ],
&quot;com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File&quot;: [ "com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [
&quot;TEXT&quot; "TEXT"
], ],
&quot;vue.recent.templates&quot;: [ "vue.recent.templates": [
&quot;Vue Composition API Component&quot; "Vue Composition API Component"
] ]
} }
}</component> }]]></component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="\\wsl.localhost\Ubuntu-24.04\home\m-tristan\workspace\Ferme" /> <recent name="\\wsl.localhost\Ubuntu-24.04\home\m-tristan\workspace\Ferme" />
@@ -301,6 +299,39 @@
<workItem from="1770195718952" duration="215000" /> <workItem from="1770195718952" duration="215000" />
<workItem from="1770195959162" duration="18915000" /> <workItem from="1770195959162" duration="18915000" />
<workItem from="1770274844804" duration="3940000" /> <workItem from="1770274844804" duration="3940000" />
<workItem from="1770620780923" duration="9218000" />
</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" />
@@ -646,55 +677,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1770308927948</updated> <updated>1770308927948</updated>
</task> </task>
<task id="LOCAL-00052" summary="fix : logo centré en mod mobile"> <task id="LOCAL-00052" summary="fix : suppression code mort sur la navbar">
<option name="closed" value="true" /> <option name="closed" value="true" />
<created>1770310504254</created> <created>1770366040426</created>
<option name="number" value="00052" /> <option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" /> <option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1770310504254</updated> <updated>1770366040426</updated>
</task> </task>
<task id="LOCAL-00053" summary="feat : ajout d'un numéro de version automatique via la CI"> <task id="LOCAL-00053" summary="feat : Création d'une page d'administration listing des fournisseurs">
<option name="closed" value="true" /> <option name="closed" value="true" />
<created>1770369945257</created> <created>1770628024317</created>
<option name="number" value="00053" /> <option name="number" value="00053" />
<option name="presentableId" value="LOCAL-00053" /> <option name="presentableId" value="LOCAL-00053" />
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1770369945257</updated> <updated>1770628024317</updated>
</task> </task>
<task id="LOCAL-00054" summary="feat : update numéro de version"> <option name="localTasksCounter" value="54" />
<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">
@@ -744,6 +743,9 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<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" />
@@ -764,12 +766,20 @@
<MESSAGE value="feat : mise à jour du bon de réception" /> <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 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="feat : ajout du responsive sur la navbar et la page d'accueil" />
<MESSAGE value="fix : logo centré en mod mobile" /> <MESSAGE value="fix : suppression code mort sur la navbar" />
<MESSAGE value="feat : ajout d'un numéro de version automatique via la CI" /> <MESSAGE value="feat : Création d'une page d'administration listing des fournisseurs" />
<MESSAGE value="feat : update numéro de version" /> <option name="LAST_COMMIT_MESSAGE" value="feat : Création d'une page d'administration listing des fournisseurs" />
<MESSAGE value="fix : auto-tag-develop.yml" /> </component>
<MESSAGE value="feat : test auto-tag-develop.yml (auto incrément version)" /> <component name="XDebuggerManager">
<option name="LAST_COMMIT_MESSAGE" value="feat : test auto-tag-develop.yml (auto incrément version)" /> <breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="php">
<url>file://$PROJECT_DIR$/src/Entity/ReceptionPelletBuilding.php</url>
<line>6</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component> </component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
<expand /> <expand />

View File

@@ -53,8 +53,6 @@ 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,9 +8,6 @@
# 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:

View File

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

View File

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

View File

@@ -1,17 +0,0 @@
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

@@ -21,22 +21,18 @@
</header> </header>
<div class="grid grid-cols-[16rem,1fr] h-[calc(100vh-85px)] min-h-0"> <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]"> <aside class="bg-primary-500 text-white min-h-0 flex flex-col justify-between">
<div class="p-4 font-semibold">Tableau de bord</div> <div class="flex flex-col gap-4 p-4 font-bold text-xl">
<div class="overflow-y-auto min-h-0 p-4 space-y-3">
<!-- Liste des liens à ajouter ci-dessous --> <!-- Liste des liens à ajouter ci-dessous -->
<!--Button pour afficher le component admin-users --> <NuxtLink to="/admin/dashboard">
<NuxtLink Tableau de bord
to="/admin/user-list" </NuxtLink>
class="block px-4 py-2 rounded hover:bg-primary-600 transition" <NuxtLink to="/admin/supplier-list">
> Fournisseur
Utilisateurs
</NuxtLink> </NuxtLink>
</div> </div>
<div class="p-4"> <div class="p-4">
<p class="font-bold text-white text-left">v{{ version }}</p>
<button <button
@click="handleLogout" @click="handleLogout"
class="w-full bg-red-600 hover:bg-red-700 py-2 rounded font-bold" class="w-full bg-red-600 hover:bg-red-700 py-2 rounded font-bold"
@@ -44,7 +40,6 @@
Déconnexion Déconnexion
</button> </button>
</div> </div>
</aside> </aside>
<main class="min-h-0 overflow-auto px-12 py-12 "> <main class="min-h-0 overflow-auto px-12 py-12 ">
@@ -58,9 +53,7 @@
<script setup lang="ts"> <script setup lang="ts">
import auth from "~/layouts/auth.vue";
const { version } = useAppVersion()
const handleLogout = async () => { const handleLogout = async () => {
try { try {
await auth.logout() await auth.logout()

View File

@@ -100,9 +100,6 @@
<main class="mx-auto w-full max-w-[1280px] 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>
@@ -112,7 +109,6 @@ import { useAuthStore } from '~/stores/auth'
const route = useRoute() const route = useRoute()
const auth = useAuthStore() const auth = useAuthStore()
const isMenuOpen = ref(false) const isMenuOpen = ref(false)
const { version } = useAppVersion()
const closeMenu = () => { const closeMenu = () => {
isMenuOpen.value = false isMenuOpen.value = false

View File

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

View File

@@ -0,0 +1,71 @@
<template>
<div class="flex items-center justify-between p-4">
<h1 class="text-xl font-fullbold uppercase"> Fournisseurs </h1>
<NuxtLink to="/admin/supplier"
class="flex items-center justify-center uppercase text-xl bg-primary-500 text-white h-[50px] w-[272px]"
>
Ajouter </NuxtLink>
</div>
<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>Nom</div>
<div>Mail</div>
<div>Rue</div>
<div>Complément</div>
<div>Code Postal</div>
<div>Ville</div>
</div>
<div v-for="supplier in supplierList" :key="supplier.id">
<template v-if="supplier.addresses?.length">
<div
v-for="addr in supplier.addresses"
:key="addr.id"
class="grid grid-cols-6 gap-4 px-4 py-2 "
@click="goToSupplier(supplier.id)"
>
<div class="truncate">
{{ supplier.name }}
</div>
<div class="truncate">
{{ supplier.email }}
</div>
<div class="truncate">
{{ addr.street }}
</div>
<div class="truncate">
{{ addr.street2 }}
</div>
<div>{{ addr.postalCode }}</div>
<div class="uppercase truncate">
{{ addr.city }}
</div>
</div>
</template>
</div>
</div>
</template>
<script setup lang="ts">
import type {SupplierData} from "~/services/dto/supplier-data"
import {getSupplierList} from "~/services/supplier"
definePageMeta({layout: "admin"})
const supplierList = ref<SupplierData[]>([])
const router = useRouter()
const goToSupplier = (id: number) => {
router.push(`/admin/supplier/${id}`)
}
onMounted(async () => {
supplierList.value = (await getSupplierList(false)) ?? []
})
</script>

View File

@@ -1,64 +0,0 @@
<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

@@ -46,8 +46,7 @@
> >
Connexion Connexion
</button> </button>
<p class="font-bold">v{{ version }}</p> </form>
</form>
</div> </div>
</template> </template>
@@ -58,7 +57,6 @@ 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

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

View File

@@ -1,25 +0,0 @@
<?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 = '';
}

0
src/Entity/.gitignore vendored Normal file
View File

View File

@@ -49,7 +49,6 @@ 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

@@ -1,26 +0,0 @@
<?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;
}
}