ldc-cocotte/resources/ts/bo/components/EmployeeSitesInputComponent.vue
Jérémy Munsch 3b3997d547
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-27 09:58:44 +01:00

101 lines
2.5 KiB
Vue

<template>
<div class="employee-sites-input container-fluid">
<div class="row">
<div
class="col-md-6 col-lg-4"
v-for="(site, index) in sites"
:key="index"
>
<div class="input-group mb-2">
<span
class="input-group-text"
:id="'site-location-' + index"
aria-label="Site location"
>
<i class="fa-solid fa-location-dot" />
</span>
<input
:aria-labelledby="'site-location-' + index"
v-model="sites[index]"
type="text"
name="employee_sites[]"
class="form-control text-uppercase font-monospace"
placeholder="ex: PA"
maxlength="20"
required
>
<button
type="button"
class="btn btn-outline-danger"
:title="__('Supprimer ce site')"
@click="removeSite(index)"
>
<i class="fa-solid fa-trash" />
</button>
</div>
</div>
</div>
<div
class="row"
v-if="sites.length === 0"
>
<div class="col">
<div
class="alert alert-secondary py-2 mb-2"
>
<i class="fa-solid fa-circle-info me-1" />
<span>{{ __('Aucun site configuré. Cliquez sur le bouton ci-dessous pour ajouter un site.') }}</span>
</div>
</div>
</div>
<div class="row">
<div class="col">
<button
type="button"
class="btn btn-sm btn-outline-primary"
@click="addSite"
>
<i class="fa-solid fa-plus me-1" />
{{ __('Ajouter un site') }}
</button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref, useAttrs } from "vue";
import { __ } from "@modules/trans";
defineOptions({ name: "EmployeeSitesInputComponent" });
const attrs = useAttrs();
const sites = ref<string[]>([]);
onMounted(() => {
try {
const rawJson = attrs.json ? String(attrs.json) : "[]";
const data = typeof attrs.json === "object" ? attrs.json : JSON.parse(rawJson);
if (Array.isArray(data)) {
sites.value = [...data];
} else if (data && Array.isArray(data.sites)) {
sites.value = [...data.sites];
}
} catch (e) {
console.error("Failed to parse employee sites json", e);
sites.value = [];
}
});
const addSite = (): void => {
sites.value.push("");
};
const removeSite = (index: number): void => {
sites.value.splice(index, 1);
};
</script>