@autobusal/operator-routes 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.1] - 2026-08-07
4
+
5
+ ### Fixed
6
+
7
+ - **Transiting country select no longer defaults to Afghanistan.** `value`
8
+ was `0`, so submitting without touching the field added the first country
9
+ in the list to the route's transit list.
10
+
11
+ ## 1.3.0
12
+
13
+ **The operator's own notice windows.**
14
+
15
+ - `information_en|sq` replaces `policies_en|sq` on the route form.
16
+ - Two new fields: cancellation notice and reschedule notice, in hours before departure, with a note saying the two things an operator cannot guess from the labels — that **empty means "not offered on this line"** (not zero, which would be offering it right up until the coach pulls away), and that these numbers are **never shown to passengers**.
17
+
18
+ They decide whether Flexible Ticket may be sold on the line and what window it grants. A passenger only ever sees the resolved consequence.
19
+
3
20
  All notable changes to this package are documented here. This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
4
21
 
5
22
  ## [1.2.0] - 2026-07-25
package/Manage.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import { useState } from 'react';
2
+ import styled from 'styled-components';
2
3
  import { TFunction } from 'i18next';
3
4
  import { useParams, useNavigate } from 'react-router-dom';
4
5
  import { RiMoneyEuroCircleLine } from 'react-icons/ri';
@@ -209,15 +210,45 @@ const Manage = ({ url, t }: Props): JSX.Element => {
209
210
  type: 'checkbox',
210
211
  value: data?.searchable
211
212
  }, {}, {
212
- label: t('operator_routes.manage.policies_en', { ns: 'common' }),
213
- name: 'policies_en',
213
+ label: t('operator_routes.manage.information_en', { ns: 'common' }),
214
+ name: 'information_en',
214
215
  type: 'textarea-html',
215
- value: data?.policies_en
216
+ value: data?.information_en
216
217
  }, {}, {
217
- label: t('operator_routes.manage.policies_sq', { ns: 'common' }),
218
- name: 'policies_sq',
218
+ label: t('operator_routes.manage.information_sq', { ns: 'common' }),
219
+ name: 'information_sq',
219
220
  type: 'textarea-html',
220
- value: data?.policies_sq
221
+ value: data?.information_sq
222
+ }, {}, {
223
+ /*
224
+ * Edited: Ferjolt Ozuni - Date: 2026-08-03
225
+ *
226
+ * How much notice this operator needs on THIS line, in hours. Not
227
+ * published anywhere: it decides whether Flexible Ticket may be
228
+ * sold on the line and what window it grants, and a passenger only
229
+ * ever sees the consequence ("cancel up to 24 hours before
230
+ * departure").
231
+ *
232
+ * EMPTY MEANS "we do not offer it here", not zero - zero would be
233
+ * offering cancellation right up until the coach pulls away. That
234
+ * is why there is no `required` rule and no default of 0.
235
+ */
236
+ label: t('operator_routes.manage.refund_hours', { ns: 'common' }),
237
+ name: 'refund_hours',
238
+ type: 'number',
239
+ value: data?.refund_hours ?? '',
240
+ rules: 'min:0|max:720'
241
+ }, {
242
+ label: t('operator_routes.manage.reschedule_hours', { ns: 'common' }),
243
+ name: 'reschedule_hours',
244
+ type: 'number',
245
+ value: data?.reschedule_hours ?? '',
246
+ rules: 'min:0|max:720'
247
+ }, {
248
+ label: '',
249
+ type: 'component',
250
+ name: 'hours_help',
251
+ value: <Help>{ t('operator_routes.manage.hours_help', { ns: 'common' }) }</Help>
221
252
  }, {}, {
222
253
  label: t('operator_routes.manage.ticket.template', { ns: 'common' }),
223
254
  type: 'component',
@@ -244,4 +275,20 @@ const Manage = ({ url, t }: Props): JSX.Element => {
244
275
  );
245
276
  };
246
277
 
247
- export default Manage;
278
+
279
+ /**
280
+ * The note under the two notice-window fields.
281
+ *
282
+ * Edited: Ferjolt Ozuni - Date: 2026-08-03
283
+ * Says the two things an operator has to know and cannot guess from the
284
+ * labels: that empty means "not offered", and that these numbers are never
285
+ * shown to passengers.
286
+ */
287
+ const Help = styled.p`
288
+ margin: -10px 0 0;
289
+ font-size: 13px;
290
+ line-height: 1.5;
291
+ color: #6b7280;
292
+ `;
293
+
294
+ export default Manage;
@@ -85,7 +85,15 @@ const Manage = ({ url, t }: Props): JSX.Element => {
85
85
  name: 'country_id',
86
86
  type: 'select',
87
87
  values: filterCountries(data?.transiting ?? [], CountriesData),
88
- value: 0,
88
+ /*
89
+ * Edited: Ferjolt Ozuni - Date: 2026-08-07
90
+ * `value: 0` matches no country, so this opened showing the first
91
+ * one - and submitting without touching it added THAT country to
92
+ * the route's transit list. An empty value plus a placeholder
93
+ * makes the operator pick.
94
+ */
95
+ placeholder: t('routes_order.step5.billing.country_choose', { ns: 'common' }),
96
+ value: '',
89
97
  rules: 'required'
90
98
  }] }
91
99
  fetching={ isFetching }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/operator-routes",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"