Skip to content

Commit

Permalink
[tra-14716]Ajouter l'immatriculation et le n° de CAP sur le tableau d…
Browse files Browse the repository at this point in the history
…e bord général, pour tous les acteurs (#3624)
  • Loading branch information
JulianaJM authored Oct 3, 2024
1 parent 7df5531 commit 6c0b483
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
25 changes: 13 additions & 12 deletions front/src/Apps/Dashboard/Components/BsdCard/BsdCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,39 +183,33 @@ function BsdCard({
? getPrimaryActionsReviewsLabel(bsdDisplay, currentSiret)
: "";

const isTransportTabs = isToCollectTab || isCollectedTab;

const currentTransporterInfos = useMemo(() => {
if (!isToCollectTab && !isCollectedTab) {
return null;
}
return getCurrentTransporterInfos(bsd, currentSiret, isToCollectTab);
}, [bsd, currentSiret, isToCollectTab, isCollectedTab]);
}, [bsd, currentSiret, isToCollectTab]);

// display the transporter's custom info if:
// - we are in the "To Collect" tab
// OR
// - we are in the "Collected" tab and there is a custom info
const displayTransporterCustomInfo =
isTransportTabs &&
!!currentTransporterInfos &&
(isToCollectTab ||
(isCollectedTab &&
!!currentTransporterInfos?.transporterCustomInfo?.length));

// display the transporter's number plate if:
// - the mode of transport is ROAD
// AND
// - we are in the "To Collect" tab
// OR
// - we are in the "Collected" tab and there is a number plate
const displayTransporterNumberPlate =
!!currentTransporterInfos &&
(currentTransporterInfos.transporterMode === TransportMode.Road ||
// permet de gérer un trou dans la raquette en terme de validation des données
// qui ne rend pas le mode de transport obligatoire à la signature transporteur
// en attente de correction Cf ticket tra-14517
!currentTransporterInfos.transporterMode) &&
(isToCollectTab ||
(isCollectedTab &&
!!currentTransporterInfos?.transporterNumberPlate?.length));
!!currentTransporterInfos?.transporterNumberPlate?.length;

const handleValidationClick = (
_: React.MouseEvent<HTMLButtonElement, MouseEvent>
Expand Down Expand Up @@ -399,14 +393,21 @@ function BsdCard({
transporterNumberPlate:
currentTransporterInfos?.transporterNumberPlate
}}
hasEditableInfos
hasEditableInfos={isToCollectTab}
info={currentTransporterInfos?.transporterNumberPlate?.toString()}
isDisabled={
isCollectedTab ||
!permissions.includes(UserPermission.BsdCanUpdate)
}
onClick={handleEditableInfoClick}
/>
)}
{bsdDisplay?.destination?.["cap"] && (
<InfoWithIcon
labelCode={InfoIconCode.Cap}
info={bsdDisplay?.destination?.["cap"]}
/>
)}
</div>
{isMobile && <div className="bsd-card-border" />}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
flex-shrink: 0;
}
}
&__CustomId {
&__CustomId,
&__Cap {
&:before {
display: inline-block;
content: "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export enum InfoIconCode {
TransporterNumberPlate = "TransporterNumberPlate",
PickupSite = "PickupSite",
CustomId = "CustomId",
Cap = "Cap",
default = ""
}
export enum InfoIconValue {
TempStorage = "Entreposage provisoire",
LastModificationDate = "Modifié le",
CustomInfo = "Champ libre",
TransporterNumberPlate = "Plaque d'immatriculation",
PickupSite = "Adresse chantier",
CustomId = "N° libre : ",
Cap = "CAP : ",
default = ""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export const getLabelValue = (code: InfoIconCode): InfoIconValue => {
case InfoIconCode.CustomInfo:
return InfoIconValue.CustomInfo;
case InfoIconCode.TransporterNumberPlate:
return InfoIconValue.TransporterNumberPlate;
return InfoIconValue.default;
case InfoIconCode.CustomId:
return InfoIconValue.CustomId;
case InfoIconCode.Cap:
return InfoIconValue.Cap;
default:
return InfoIconValue.default;
}
Expand Down
1 change: 1 addition & 0 deletions front/src/Apps/common/queries/fragments/bsda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const bsdaFragment = gql`
}
}
}
cap
}
worker {
isDisabled
Expand Down
1 change: 1 addition & 0 deletions front/src/Apps/common/queries/fragments/bsdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ export const dashboardFormFragment = gql`
name
}
isTempStorage
cap
}
transporter {
id
Expand Down
1 change: 1 addition & 0 deletions front/src/Apps/common/queries/fragments/bsff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const dashboardBsffFragment = gql`
name
}
plannedOperationCode
cap
}
waste {
code
Expand Down

0 comments on commit 6c0b483

Please sign in to comment.