Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit e73d0a4

Browse files
committed
refactor: pricing API change in core
core branch: City-of-Helsinki/tilavarauspalvelu-core#1317 refs: TILA-3525
1 parent b50dc76 commit e73d0a4

29 files changed

Lines changed: 745 additions & 1077 deletions

apps/admin-ui/gql/gql-types.ts

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,14 +1689,6 @@ export enum PriceUnit {
16891689
PerWeek = "PER_WEEK",
16901690
}
16911691

1692-
/** An enumeration. */
1693-
export enum PricingType {
1694-
/** Maksuton */
1695-
Free = "FREE",
1696-
/** Maksullinen */
1697-
Paid = "PAID",
1698-
}
1699-
17001692
/** An enumeration. */
17011693
export enum Priority {
17021694
Primary = "PRIMARY",
@@ -4089,21 +4081,18 @@ export type ReservationUnitPricingNode = Node & {
40894081
lowestPriceNet?: Maybe<Scalars["Decimal"]["output"]>;
40904082
pk?: Maybe<Scalars["Int"]["output"]>;
40914083
priceUnit: PriceUnit;
4092-
pricingType?: Maybe<PricingType>;
4093-
status: Status;
40944084
taxPercentage: TaxPercentageNode;
40954085
};
40964086

40974087
export type ReservationUnitPricingSerializerInput = {
40984088
begins: Scalars["Date"]["input"];
40994089
highestPrice?: InputMaybe<Scalars["Decimal"]["input"]>;
41004090
highestPriceNet?: InputMaybe<Scalars["String"]["input"]>;
4091+
isActivatedOnBegins?: InputMaybe<Scalars["Boolean"]["input"]>;
41014092
lowestPrice?: InputMaybe<Scalars["Decimal"]["input"]>;
41024093
lowestPriceNet?: InputMaybe<Scalars["String"]["input"]>;
41034094
pk?: InputMaybe<Scalars["Int"]["input"]>;
41044095
priceUnit?: InputMaybe<PriceUnit>;
4105-
pricingType?: InputMaybe<PricingType>;
4106-
status: Status;
41074096
taxPercentage?: InputMaybe<Scalars["Int"]["input"]>;
41084097
};
41094098

@@ -4737,12 +4726,20 @@ export type SpaceUpdateMutationPayload = {
47374726

47384727
/** An enumeration. */
47394728
export enum Status {
4740-
/** aktiivinen */
4741-
Active = "ACTIVE",
4742-
/** tuleva */
4743-
Future = "FUTURE",
4744-
/** mennyt */
4745-
Past = "PAST",
4729+
/** Peruttu */
4730+
Cancelled = "CANCELLED",
4731+
/** Luonnos */
4732+
Draft = "DRAFT",
4733+
/** Rauennut */
4734+
Expired = "EXPIRED",
4735+
/** Käsitelty */
4736+
Handled = "HANDLED",
4737+
/** Käsittelyssä */
4738+
InAllocation = "IN_ALLOCATION",
4739+
/** Vastaanotettu */
4740+
Received = "RECEIVED",
4741+
/** Päätökset lähetetty */
4742+
ResultSent = "RESULT_SENT",
47464743
}
47474744

47484745
export type SuitableTimeRangeNode = Node & {
@@ -5236,12 +5233,11 @@ export type UpdateReservationUnitPricingSerializerInput = {
52365233
begins?: InputMaybe<Scalars["Date"]["input"]>;
52375234
highestPrice?: InputMaybe<Scalars["Decimal"]["input"]>;
52385235
highestPriceNet?: InputMaybe<Scalars["String"]["input"]>;
5236+
isActivatedOnBegins?: InputMaybe<Scalars["Boolean"]["input"]>;
52395237
lowestPrice?: InputMaybe<Scalars["Decimal"]["input"]>;
52405238
lowestPriceNet?: InputMaybe<Scalars["String"]["input"]>;
52415239
pk?: InputMaybe<Scalars["Int"]["input"]>;
52425240
priceUnit?: InputMaybe<PriceUnit>;
5243-
pricingType?: InputMaybe<PricingType>;
5244-
status?: InputMaybe<Status>;
52455241
taxPercentage?: InputMaybe<Scalars["Int"]["input"]>;
52465242
};
52475243

@@ -5928,10 +5924,8 @@ export type PricingFieldsFragment = {
59285924
id: string;
59295925
begins: string;
59305926
priceUnit: PriceUnit;
5931-
pricingType?: PricingType | null;
59325927
lowestPrice: string;
59335928
highestPrice: string;
5934-
status: Status;
59355929
taxPercentage: { id: string; pk?: number | null; value: string };
59365930
};
59375931

@@ -6810,10 +6804,8 @@ export type ReservationUnitEditQuery = {
68106804
id: string;
68116805
begins: string;
68126806
priceUnit: PriceUnit;
6813-
pricingType?: PricingType | null;
68146807
lowestPrice: string;
68156808
highestPrice: string;
6816-
status: Status;
68176809
taxPercentage: { id: string; pk?: number | null; value: string };
68186810
}>;
68196811
applicationRoundTimeSlots: Array<{
@@ -8405,10 +8397,8 @@ export type ReservationQuery = {
84058397
id: string;
84068398
begins: string;
84078399
priceUnit: PriceUnit;
8408-
pricingType?: PricingType | null;
84098400
lowestPrice: string;
84108401
highestPrice: string;
8411-
status: Status;
84128402
taxPercentage: { id: string; pk?: number | null; value: string };
84138403
}>;
84148404
metadataSet?: {
@@ -8706,10 +8696,8 @@ export type ReservationUnitPricingFragment = {
87068696
id: string;
87078697
begins: string;
87088698
priceUnit: PriceUnit;
8709-
pricingType?: PricingType | null;
87108699
lowestPrice: string;
87118700
highestPrice: string;
8712-
status: Status;
87138701
taxPercentage: { id: string; pk?: number | null; value: string };
87148702
}>;
87158703
};
@@ -9688,15 +9676,13 @@ export const PricingFieldsFragmentDoc = gql`
96889676
id
96899677
begins
96909678
priceUnit
9691-
pricingType
96929679
lowestPrice
96939680
highestPrice
96949681
taxPercentage {
96959682
id
96969683
pk
96979684
value
96989685
}
9699-
status
97009686
}
97019687
`;
97029688
export const ReservationUnitPricingFragmentDoc = gql`

apps/admin-ui/src/i18n/messages.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,16 @@ const translations: ITranslations = {
222222
"Ei pystytty luomaan varauksia yli 2 vuoden päähän",
223223
],
224224
RESERVATION_SERIES_ALREADY_STARTED: ["Toistuva varaus on jo alkanut"],
225+
RESERVATION_UNIT_PRICINGS_MISSING: [
226+
"Varausyksiköllä ei ole hinnoittelua",
227+
],
228+
RESERVATION_UNIT_PRICINGS_NO_ACTIVE_PRICINGS: [
229+
"Varausyksiköllä ei ole aktiivisia hinnoitteluita",
230+
],
231+
RESERVATION_UNIT_PRICINGS_DUPLICATE_DATE: ["Päivämäärä on jo käytössä"],
232+
RESERVATION_UNIT_PRICINGS_INVALID_PRICES: [
233+
"Hinnoittelussa on virheellisiä hintoja",
234+
],
225235
},
226236
descriptive: {
227237
"Reservation overlaps with reservation before due to buffer time.": [
@@ -1334,10 +1344,11 @@ const translations: ITranslations = {
13341344
pricingType: ["Varausyksikön maksullisuus"],
13351345
pricingTerms: ["Hinnoitteluperiaate"],
13361346
pricingTypes: {
1337-
PAID: ["Maksullinen"],
1338-
FREE: ["Maksuton"],
1347+
paid: ["Maksullinen"],
1348+
free: ["Maksuton"],
13391349
},
1340-
priceChange: ["Hintaan on tulossa muutos"],
1350+
hasFuturePrice: ["Hintaan on tulossa muutos"],
1351+
begins: ["Alkaa"],
13411352
openingTime: ["Alkamisaika"],
13421353
closingTime: ["Päättymisaika"],
13431354
},
@@ -1413,12 +1424,6 @@ const translations: ITranslations = {
14131424
`Kuvaus kirjoitetaan standardointipohjan mukaisesti.
14141425
Lisää linkkejä ulkoisille verkkosivuille kuten käyttöohjeisiin vain tarvittaessa. Tarkista linkkien toimivuus ja saavutettavuus säännöllisesti. Käytäthän muotoiluja harkiten. `,
14151426
],
1416-
images: [
1417-
`Liitä vähintään kolme kuvaa. Kuvien tulisi olla todenmukaisia ja hyvälaatuisia.
1418-
Suositus:
1419-
lisää ensisijaisesti vaakatasossa kuvattuja kuvia, ei kuitenkaan panoramoja. jpeg/jpg ja png, max 1 M
1420-
Kuvissa näkyviltä ihmisiltä tulee olla kuvauslupa. Kuvissa ei saa näkyä turvakameroita.`,
1421-
],
14221427
publishingSettings: [
14231428
`Voit ajastaa varausyksikön julkaistavaksi tai piilotettavaksi asiakkailta tiettynä ajankohtana.`,
14241429
],
@@ -1705,6 +1710,12 @@ const translations: ITranslations = {
17051710
deleteImage: ["Poista"],
17061711
mainImage: ["Pääkuva"],
17071712
useAsMainImage: ["Käytä pääkuvana"],
1713+
tooltip: [
1714+
`Liitä vähintään kolme kuvaa. Kuvien tulisi olla todenmukaisia ja hyvälaatuisia.
1715+
Suositus:
1716+
lisää ensisijaisesti vaakatasossa kuvattuja kuvia, ei kuitenkaan panoramoja. jpeg/jpg ja png, max 1 M
1717+
Kuvissa näkyviltä ihmisiltä tulee olla kuvauslupa. Kuvissa ei saa näkyä turvakameroita.`,
1718+
],
17081719
},
17091720
priceUnit: {
17101721
FIXED: ["Per kerta"],

apps/admin-ui/src/spa/ReservationUnit/edit/ActivationGroup.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@ export function ActivationGroup<T extends FieldValues>({
3434
style,
3535
className,
3636
}: ControllerProps<T>): JSX.Element {
37-
const { field } = useController({ control, name });
37+
const {
38+
field: { value, onChange },
39+
} = useController({ control, name });
3840

3941
return (
4042
<Wrapper $noMargin={noMargin} style={style} className={className}>
41-
<Checkbox
42-
id={name}
43-
label={label}
44-
checked={field.value}
45-
onChange={field.onChange}
46-
/>
47-
{field.value ? (
43+
<Checkbox id={name} label={label} checked={value} onChange={onChange} />
44+
{value ? (
4845
<Wrapper $noMargin={noMargin}>
4946
<Indent $noIndent={noIndent}>{children}</Indent>
5047
</Wrapper>

apps/admin-ui/src/spa/ReservationUnit/edit/ImageEditor.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ function RUImage({ image }: { image: ImageFormType }): JSX.Element {
3838
let fakePk = -1;
3939

4040
const FileInputContainer = styled.div`
41+
& button {
42+
--background-color-hover: var(--color-black-5);
43+
--color-hover: var(--color-black);
44+
--background-color-focus: transparent;
45+
--color-focus: var(--color-black) --focus-outline-color:
46+
var(--color-focus-outline);
47+
--color: var(--color-black);
48+
--border-color: var(--color-black);
49+
}
50+
4151
div:nth-of-type(3) {
4252
width: 100%;
4353
button {
@@ -61,7 +71,10 @@ const FileInputContainer = styled.div`
6171
}
6272
`;
6373

64-
const SmallButton = styled(Button)`
74+
const SmallButton = styled(Button).attrs({
75+
variant: "secondary",
76+
theme: "black",
77+
})`
6578
border: 0;
6679
padding: 0;
6780
min-height: 0;
@@ -94,15 +107,13 @@ function ReservationUnitImage({
94107
<span>{t("ImageEditor.mainImage")}</span>
95108
) : (
96109
<SmallButton
97-
variant="secondary"
98110
disabled={isMain || image.pk == null}
99111
onClick={() => makeIntoMainImage(image.pk ?? 0)}
100112
>
101113
{t("ImageEditor.useAsMainImage")}
102114
</SmallButton>
103115
)}
104116
<SmallButton
105-
variant="secondary"
106117
disabled={image.pk == null}
107118
onClick={() => deleteImage(image.pk ?? 0)}
108119
>
@@ -177,7 +188,7 @@ export function ImageEditor({
177188
dragAndDropInputLabel=" "
178189
maxSize={5242880}
179190
onChange={(files) => addImage(files)}
180-
tooltipText={t("ReservationUnitEditor.tooltip.images")}
191+
tooltipText={t("ImageEditor.tooltip")}
181192
/>
182193
</FileInputContainer>
183194
</div>

0 commit comments

Comments
 (0)