@autobusal/admin-agents 1.1.0 → 1.1.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/Manage.tsx +36 -10
  3. package/package.json +2 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ 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
+
5
+ ## [1.1.2] - 2026-07-19
6
+
7
+ ### Fixed
8
+
9
+ - `Manage.tsx`: the agent edit form's email field is now hydrated with the existing value (`value: data?.user.email`). Previously the email `<input>` rendered empty when editing an agent, so the field appeared blank and a save could overwrite the stored email with an empty value.
10
+
11
+ Authored by Ferjolt Ozuni. Consolidated from the magus and alvavel whitelabel patch sets into canonical @autobusal source (eliminates per-repo patch-package divergence).
package/Manage.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
3
- import { Meta, BackWithTitle, Viewer, IpLogs, ApiDetails } from '@autobusal/common';
4
- import { usePage, useBreadcrumbs, useSubscriptions, useOperators } from '@autobusal/hooks';
3
+ import { Meta, BackWithTitle, Viewer, Box, IpLogs, ApiDetails } from '@autobusal/common';
4
+ import { usePage, useBreadcrumbs, useSubscriptions, useCountries, useOperators } from '@autobusal/hooks';
5
5
  import { GetStatus, getAllowed, success } from '@autobusal/utilities';
6
6
  import { AgentData } from '@autobusal/providers/types/agents';
7
7
  import { useGetAgent, usePostAgent, useDeleteAgent } from './services';
@@ -22,6 +22,8 @@ const Manage = ({ url, t }: Props): JSX.Element => {
22
22
 
23
23
  const navigate = useNavigate();
24
24
 
25
+ const { data: CountryData, isLoading } = useCountries('all');
26
+
25
27
  const subscriptions = useSubscriptions('agent');
26
28
  const operators = useOperators();
27
29
 
@@ -35,6 +37,10 @@ const Manage = ({ url, t }: Props): JSX.Element => {
35
37
 
36
38
  const { mutate: Delete, isPending: isPendingDelete } = useDeleteAgent();
37
39
 
40
+ if (isLoading) {
41
+ return <Box />;
42
+ }
43
+
38
44
  const onSave = (data: AgentData): void => {
39
45
  Update(data, {
40
46
  onSuccess: () => {
@@ -97,6 +103,13 @@ const Manage = ({ url, t }: Props): JSX.Element => {
97
103
  type: 'text',
98
104
  value: data?.city,
99
105
  rules: 'required|min_length:2|max_length:40'
106
+ }, {
107
+ label: t('admin_agents.manage.country', { ns: 'common' }),
108
+ name: 'country_id',
109
+ type: 'select',
110
+ values: CountryData,
111
+ value: data?.country_id ?? 0,
112
+ rules: 'required'
100
113
  }, {}, {
101
114
  label: t('admin_agents.manage.mobile', { ns: 'common' }),
102
115
  name: 'mobile',
@@ -121,7 +134,8 @@ const Manage = ({ url, t }: Props): JSX.Element => {
121
134
  }, {}, {
122
135
  label: t('admin_agents.manage.email', { ns: 'common' }),
123
136
  name: 'email',
124
- type: 'email'
137
+ type: 'email',
138
+ value: data?.user.email
125
139
  }, {
126
140
  label: t('admin_agents.manage.password', { ns: 'common' }),
127
141
  name: 'password',
@@ -151,7 +165,7 @@ const Manage = ({ url, t }: Props): JSX.Element => {
151
165
  label: t('admin_agents.manage.subscription', { ns: 'common' }),
152
166
  name: 'subscription_id',
153
167
  type: 'select',
154
- value: data?.user.subscription?.subscription.id,
168
+ value: data?.user.subscription?.subscription.id ?? 0,
155
169
  values: subscriptions,
156
170
  rules: 'required',
157
171
  notice: t('admin_agents.manage.subscription_notice', { ns: 'common' })
@@ -185,31 +199,43 @@ const Manage = ({ url, t }: Props): JSX.Element => {
185
199
  label: t('admin_agents.manage.unique', { ns: 'common' }),
186
200
  name: 'unique',
187
201
  type: 'select',
188
- value: data?.user.comissions?.unique,
202
+ value: data?.user.comissions?.unique ?? 0,
189
203
  values: getAllowed(t)
190
204
  }, {
191
205
  label: t('admin_agents.manage.api', { ns: 'common' }),
192
206
  name: 'api',
193
207
  type: 'select',
194
- value: data?.user.api?.api,
208
+ value: data?.user.api?.api ?? 0,
195
209
  values: getAllowed(t)
196
210
  }, {
197
211
  label: t('admin_agents.manage.bkt', { ns: 'common' }),
198
212
  name: 'bkt',
199
213
  type: 'select',
200
- value: data?.user.api?.bkt,
214
+ value: data?.user.api?.bkt ?? 0,
215
+ values: getAllowed(t)
216
+ }, {
217
+ label: t('admin_agents.manage.stripe', { ns: 'common' }),
218
+ name: 'stripe',
219
+ type: 'select',
220
+ value: data?.user.api?.stripe ?? 0,
221
+ values: getAllowed(t)
222
+ }, {
223
+ label: t('admin_agents.manage.mollie', { ns: 'common' }),
224
+ name: 'mollie',
225
+ type: 'select',
226
+ value: data?.user.api?.mollie ?? 0,
201
227
  values: getAllowed(t)
202
228
  }, {
203
229
  label: t('admin_agents.manage.devpos', { ns: 'common' }),
204
230
  name: 'devpos',
205
231
  type: 'select',
206
- value: data?.user.api?.devpos,
232
+ value: data?.user.api?.devpos ?? 0,
207
233
  values: getAllowed(t)
208
234
  }, {
209
235
  label: t('admin_agents.manage.external', { ns: 'common' }),
210
236
  name: 'external',
211
237
  type: 'select',
212
- value: data?.user.comissions?.external,
238
+ value: data?.user.comissions?.external ?? 0,
213
239
  values: getAllowed(t)
214
240
  }, {
215
241
  label: t('admin_agents.manage.devpos_settings', { ns: 'common' }),
@@ -222,7 +248,7 @@ const Manage = ({ url, t }: Props): JSX.Element => {
222
248
  label: t('admin_agents.manage.status', { ns: 'common' }),
223
249
  name: 'status',
224
250
  type: 'select',
225
- value: data?.user.status,
251
+ value: data?.user.status ?? 0,
226
252
  values: GetStatus(t)
227
253
  }, {
228
254
  label: t('admin_agents.manage.display_email', { ns: 'common' }),
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@autobusal/admin-agents",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
+ "author": "Ferjolt Ozuni",
4
5
  "type": "module",
5
6
  "main": "index.ts"
6
7
  }