Skip to content
Extraits de code Groupes Projets
Valider c517ba75 rédigé par Mohamed Lemine BAILLAHI's avatar Mohamed Lemine BAILLAHI
Parcourir les fichiers

Merge branch 'feature/VSN-1181' into 'develop'

VSN-1181/Modify the order of the fields and replace 'circuit' with 'department' in the...

Closes VSN-1181

See merge request !244
parents 7a641a27 d295124d
Branches
Étiquettes v0.0.45
1 requête de fusion!244VSN-1181/Modify the order of the fields and replace 'circuit' with 'department' in the...
Pipeline #20331 réussi avec l'étape
in 21 secondes
Affichage de
avec 58 ajouts et 61 suppressions
......@@ -3,7 +3,7 @@
import type React from 'react';
import { useState, useCallback, useRef } from 'react';
import { nanoid } from 'nanoid';
import type { ModeType } from '@/shared/types/common';
import { TableType, type ModeType } from '@/shared/types/common';
export interface TabItem<T> {
id: string;
......@@ -233,14 +233,14 @@ export function useTabsManager<T extends { id: string }>(config: TabConfig<T>) {
const tabToClose = tabs.find((tab) => tab.id === tabId);
if (!forceClose && tabToClose?.hasUnsavedChanges) {
tabToCloseRef.current = tabId;
pendingAction.current = 'cancel';
pendingAction.current = config.type !== TableType.Usager ? 'close' : 'cancel';
setShowConfirmDialog(true);
return;
}
setTabs((prevTabs) => prevTabs.filter((tab) => tab.id !== tabId));
setActiveTab('list');
},
[tabs]
[config.type, tabs]
);
const updateListTabTitle = useCallback((newTitle: string) => {
......
......@@ -32,7 +32,7 @@ export const _avenants = (isSecondaryTable: boolean) => [...Array(50)].map((_,
dateFin: endDate.toISOString().split('T')[0],
etablissement: ['Les Champs', 'La Colline', 'Le Rivage', 'La Forêt'][index % 4],
chauffeur: Math.random() > 0.3 ? `Chauffeur ${index + 1}` : "Non Affecté",
societe: `Région ${['Est', 'Ouest', 'Nord', 'Sud'][index % 4]}`,
departement: `Région ${['Est', 'Ouest', 'Nord', 'Sud'][index % 4]}`,
clientDO: `DO ${['Nord', 'Sud', 'Est', 'Ouest'][index % 4]}`,
isActive: Math.random() < 0.6,
objet: "Transport Scolaire",
......@@ -51,7 +51,7 @@ export const DEFAULT_AVENANT_CIRCUIT_TABLE_HEAD: TableColumn[] = [
{ id: 'dateFin', label: 'Fin de circuit', type: 'date', align: 'center' },
{ id: 'etablissement', label: 'Établissement', type: 'text', align: 'left' },
{ id: 'chauffeur', label: 'Chauffeur', type: 'text', align: 'left' },
{ id: 'societe', label: 'Société', type: 'text', align: 'left' },
{ id: 'departement', label: 'Département', type: 'text', align: 'left' },
{ id: 'clientDO', label: 'Client DO', type: 'text', align: 'left' },
{ id: 'isActive', label: 'Active', type: 'boolean',align: 'center' },
{ id: '', label: 'Action' },
......@@ -65,7 +65,7 @@ export const DEFAULT_AVENANT_TABLE_HEAD: TableColumn[] = [
{ id: 'intitule', label: 'Intitulé', type: 'text', align: 'left' },
{ id: 'clientDO', label: 'Client DO', type: 'text', align: 'left' },
{ id: 'chauffeur', label: 'Chauffeur', type: 'text', align: 'left' },
{ id: 'societe', label: 'Société', type: 'text', align: 'left' },
{ id: 'departement', label: 'Département', type: 'text', align: 'left' },
{ id: 'objetAvenant', label: 'Objet de l\'avenant', type: 'text', align: 'left' },
{ id: 'objet', label: 'Objet', type: 'text', align: 'left' },
{ id: 'type', label: 'Type', type: 'text', align: 'left' },
......@@ -86,7 +86,7 @@ export const INITIAL_AVENANT_DATA: IAvenant = {
dateFin: '',
etablissement: '',
chauffeur: '',
societe: '',
departement: '',
clientDO: '',
isActive: true,
objet: '',
......
......@@ -41,7 +41,7 @@ export const _circuits = [...Array(55)].map((_, index) => {
etablissement: ['Les Champs', 'La Colline', 'Le Rivage', 'La Forêt'][index % 4],
adresseEtablissement: mockAddress,
numeroContrat: `CT-${(index + 1).toString().padStart(5, '0')}`,
societe: `Région ${['Est', 'Ouest', 'Nord', 'Sud'][index % 4]}`,
departement: `Région ${['Est', 'Ouest', 'Nord', 'Sud'][index % 4]}`,
numeroLot: `BCI${(256579345 + index).toString().padStart(9, '0')}`,
isActive: Math.random() < 0.6,
typeCalcul: '',
......@@ -71,7 +71,7 @@ export const DEFAULT_CIRCUIT_TABLE_HEAD : TableColumn[] = [
{ id: 'etablissement', label: 'Établissement', type: 'text',align: 'left' },
{ id: 'adresseEtablissement', label: 'Adresse établissement', type: 'text',align: 'left' },
{ id: 'numeroContrat', label: 'Contrat', type: 'text',align: 'left' },
{ id: 'societe', label: 'Société', type: 'text',align: 'left' },
{ id: 'departement', label: 'Département', type: 'text',align: 'left' },
{ id: 'numeroLot', label: 'N° de lot', type: 'text', align: 'left' },
{ id: 'isActive', label: 'Active', type: 'boolean',align: 'center' },
{ id: '', label: 'Action' },
......@@ -97,7 +97,7 @@ export const INITIAL_CIRCUIT_DATA: ICircuit = {
formattedAddress: ''
},
numeroContrat: '',
societe: '',
departement: '',
numeroLot: '',
typeCalcul: '',
colorCode: '',
......
......@@ -18,7 +18,7 @@ const mapToIAvenant = (amendmentResponse: AmendmentDetailDTO): IAvenant => {
dateFin: amendment.endDate || '',
etablissement: amendment.establishment || '',
chauffeur: amendment.driver,
societe: amendment.company,
departement: amendment.company,
clientDO: amendment.clientDO,
isActive: amendment.active,
objet: amendment.purpose || '',
......
......@@ -19,7 +19,7 @@ const mapToIAvenant = (amendment: AmendmentListDTO): IAvenant => ({
dateFin: amendment.endDate || '',
etablissement: amendment.establishment || '',
chauffeur: amendment.driver,
societe: amendment.company,
departement: amendment.company,
clientDO: amendment.client,
isActive: amendment.active,
objet: amendment.object || '',
......
......@@ -13,7 +13,7 @@ const EMPTY_AVENANT_DATA: IAvenant = {
dateFin: '',
etablissement: '',
chauffeur: '',
societe: '',
departement: '',
clientDO: '',
isActive: true,
objet: '',
......
......@@ -58,7 +58,7 @@ export default function AvenantDetailView({ amendmentId }: AvenantDetailViewProp
<Grid item xs={12} md={6}>
<Stack spacing={2}>
<Typography variant="subtitle1">Chauffeur: {avenant.chauffeur}</Typography>
<Typography variant="subtitle1">Société: {avenant.societe}</Typography>
<Typography variant="subtitle1">Société: {avenant.departement}</Typography>
<Typography variant="subtitle1">Circuit: {avenant.codeCircuit}</Typography>
</Stack>
</Grid>
......
......@@ -86,7 +86,7 @@ export default function AvenantListView() {
dateFin: amendmentData.endDate || '',
etablissement: amendmentData.establishment || '',
chauffeur: amendmentData.driver,
societe: amendmentData.company,
departement: amendmentData.company,
clientDO: amendmentData.clientDO,
isActive: amendmentData.active,
objet: amendmentData.purpose || '',
......
......@@ -45,7 +45,7 @@ const EMPTY_CIRCUIT: ICircuit = {
codeCircuit: '',
intitule: '',
clientDO: '',
societe: '',
departement: '',
dateDernierAvenant: '',
numeroContrat: '',
isActive: true,
......@@ -83,7 +83,7 @@ const mapAmendmentToAvenant = (amendmentResponse: AmendmentDetailDTO): IAvenant
dateFin: amendment.endDate || '',
etablissement: amendment.establishment || '',
chauffeur: amendment.driver,
societe: amendment.company,
departement: amendment.company,
clientDO: amendment.clientDO,
isActive: amendment.active,
objet: amendment.purpose || '',
......@@ -170,7 +170,7 @@ export default function AvenantForm({ avenant, mode, onSave, onClose, onEdit, is
// Map other fields from amendment data
intitule: amendmentData.title || '',
clientDO: amendmentData.clientDO || '',
societe: amendmentData.company || '',
departement: amendmentData.company || '',
isActive: amendmentData.active,
codeCircuit: amendmentData.circuitCode || '',
};
......@@ -187,7 +187,7 @@ export default function AvenantForm({ avenant, mode, onSave, onClose, onEdit, is
dateFin: formData.dateFin,
intitule: formData.intitule,
clientDO: formData.clientDO,
societe: formData.societe,
departement: formData.departement,
isActive: formData.isActive,
codeCircuit: formData.codeCircuit,
typeCalcul: formData.typeCalcul || 'calculAutomatique',
......
......@@ -53,7 +53,7 @@ export default function AvenantTableRow({
subject: avenant.intitule || '',
client: avenant.clientDO || '',
driver: avenant.chauffeur || '',
company: avenant.societe || '',
company: avenant.departement || '',
circuitCode: avenant.codeCircuit || '',
amendmentObject: avenant.objetAvenant || '',
type: avenant.type || '',
......
......@@ -21,14 +21,6 @@ export const formFieldsCircuit: FormFieldType<ICircuit>[] = [
type: 'select',
options: _CIRCUIT_STATUS,
},
{
name: 'etablissement',
label: 'Établissement principal',
type: 'text',
placeholder: 'Entrez un nom',
required: true,
icon: '/assets/icons/form/ic_building.svg',
},
{
name: 'adresseEtablissement',
label: 'Prise en charge',
......@@ -36,20 +28,11 @@ export const formFieldsCircuit: FormFieldType<ICircuit>[] = [
placeholder: 'Entrez une adresse',
},
{
name: 'typeCalcul',
label: 'Type de calcul',
type: 'select',
options: [
{ value: 'calculCouts', label: 'Calcul pour les Coûts' },
{ value: 'calculAutres', label: 'Autres calculs' },
],
},
{
name: 'grillePrix',
label: 'Grille de prix',
type: 'text',
placeholder: '0',
icon: faEuro,
name: 'colorCode',
label: 'Code couleur',
type: 'color',
placeholder: 'Choisissez une couleur',
required: true,
},
{
name: 'dateDebut',
......@@ -64,18 +47,21 @@ export const formFieldsCircuit: FormFieldType<ICircuit>[] = [
required: true,
},
{
name: 'colorCode',
label: 'Code couleur',
type: 'color',
placeholder: 'Choisissez une couleur',
required: true,
name: 'typeCalcul',
label: 'Type de calcul',
type: 'select',
options: [
{ value: 'calculCouts', label: 'Calcul pour les Coûts' },
{ value: 'calculAutres', label: 'Autres calculs' },
],
},
{
name: 'chauffeur',
label: 'Chauffeurs',
name: 'etablissement',
label: 'Établissement principal',
type: 'text',
placeholder: 'Entrez un nom',
icon: faAddressCard,
required: true,
icon: '/assets/icons/form/ic_building.svg',
},
{
name: 'dureeTrajet',
......@@ -84,6 +70,13 @@ export const formFieldsCircuit: FormFieldType<ICircuit>[] = [
placeholder: 'Sélectionnez une durée',
options: _TRAJET_DUREES,
},
{
name: 'chauffeur',
label: 'Chauffeurs',
type: 'text',
placeholder: 'Entrez un nom',
icon: faAddressCard,
},
{
name: 'observation',
label: "Observation",
......@@ -91,6 +84,13 @@ export const formFieldsCircuit: FormFieldType<ICircuit>[] = [
type: 'textarea',
icon: faStickyNote,
},
{
name: 'grillePrix',
label: 'Grille de prix',
type: 'text',
placeholder: '0',
icon: faEuro,
},
];
export const numeroLotOptions = [
{ value: 'BCI256579345', label: 'BCI256579345' },
......
'use client';
import { StyledTextField } from '@/shared/theme/css';
import { Grid, InputAdornment } from '@mui/material';
import FontAwesome from '@/shared/components/fontawesome';
import SvgColor from '@/shared/components/svg-color';
import { faHashtag } from '@fortawesome/free-solid-svg-icons';
import { useEffect, useState } from 'react';
import { Grid} from '@mui/material';
import { useEffect } from 'react';
import CircuitTabForm from '../components/circuit-form/circuit-form';
import CircuittrajetsForm from '../components/circuit-form/trajet/trajets-list';
import { ICircuit } from '@/shared/types/circuit';
......
import { IPassengerList } from '@/shared/types/passenger';
import { TabConfig, useTabsManager } from '../../../../hooks/use-tabs-manager';
import { INITIAL_USAGER_DATA } from '@/shared/_mock/_usagers';
import { TableType } from '@/shared/types/common';
const contractConfig: TabConfig<IPassengerList> = {
type: 'usager',
type: TableType.Usager,
listTitle: 'Liste des usagers',
newItemTitle: 'Nouveau usager',
initialData: INITIAL_USAGER_DATA,
......
......@@ -29,7 +29,7 @@ const mapFiltersToBackendFormat = (filters: Record<string, { value: string; cond
'intitule': 'subject',
'clientDO': 'client',
'chauffeur': 'driver',
'societe': 'company',
'departement': 'company',
'objetAvenant': 'amendmentObject',
'objet': 'object',
'type': 'type',
......@@ -72,7 +72,7 @@ const mapColumnsToBackendFormat = (columns: string[]): string[] => {
'intitule': 'subject',
'clientDO': 'client',
'chauffeur': 'driver',
'societe': 'company',
'departement': 'company',
'objetAvenant': 'amendmentObject',
'objet': 'object',
'type': 'type',
......
......@@ -15,7 +15,7 @@ export type ICircuit = {
etablissement: string,
adresseEtablissement: AddressData,
numeroContrat: string,
societe: string,
departement: string,
isActive:boolean;
typeCalcul?:string;
grillePrix?:string;
......@@ -53,7 +53,7 @@ export type ICircuit = {
dateFin: string;
etablissement: string;
chauffeur: string;
societe: string;
departement: string;
clientDO: string;
isActive:boolean;
objet?: string;
......
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter