@visns-studio/visns-components 1.4.16 → 1.5.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.
- package/components/crm/visns-form.jsx +35 -49
- package/package.json +1 -1
|
@@ -268,50 +268,42 @@ function Form(props) {
|
|
|
268
268
|
};
|
|
269
269
|
|
|
270
270
|
const autocompleteSelect = (place, id) => {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
:
|
|
271
|
+
const { address, text, context } = place;
|
|
272
|
+
const address1 =
|
|
273
|
+
address !== undefined && address ? address + " " + text : text;
|
|
274
274
|
let address2 = "";
|
|
275
275
|
let suburb = "";
|
|
276
276
|
let postcode = "";
|
|
277
277
|
let state = "";
|
|
278
278
|
let country = "";
|
|
279
279
|
|
|
280
|
-
if (
|
|
281
|
-
suburb =
|
|
280
|
+
if (context[1]) {
|
|
281
|
+
suburb = context[1].text;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
if (
|
|
285
|
-
postcode =
|
|
284
|
+
if (context[0]) {
|
|
285
|
+
postcode = context[0].text;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
state = place.context[3].text;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (place.context[4]) {
|
|
294
|
-
country = place.context[4].text;
|
|
295
|
-
}
|
|
288
|
+
if (context.length === 5) {
|
|
289
|
+
[state, country] = [context[3]?.text, context[4]?.text];
|
|
296
290
|
} else {
|
|
297
|
-
|
|
298
|
-
state = place.context[2].text;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (place.context[3]) {
|
|
302
|
-
country = place.context[3].text;
|
|
303
|
-
}
|
|
291
|
+
[state, country] = [context[2]?.text, context[3]?.text];
|
|
304
292
|
}
|
|
305
293
|
|
|
294
|
+
const formDataUpdate = {
|
|
295
|
+
address1,
|
|
296
|
+
address2,
|
|
297
|
+
suburb,
|
|
298
|
+
postcode,
|
|
299
|
+
state,
|
|
300
|
+
country,
|
|
301
|
+
};
|
|
302
|
+
|
|
306
303
|
if (formData.same_address === true) {
|
|
307
304
|
setFormData((prevState) => ({
|
|
308
305
|
...prevState,
|
|
309
|
-
|
|
310
|
-
address2: address2,
|
|
311
|
-
suburb: suburb,
|
|
312
|
-
postcode: postcode,
|
|
313
|
-
state: state,
|
|
314
|
-
country: country,
|
|
306
|
+
...formDataUpdate,
|
|
315
307
|
postal_address1: address1,
|
|
316
308
|
postal_address2: address2,
|
|
317
309
|
postal_suburb: suburb,
|
|
@@ -319,28 +311,22 @@ function Form(props) {
|
|
|
319
311
|
postal_state: state,
|
|
320
312
|
postal_country: country,
|
|
321
313
|
}));
|
|
314
|
+
} else if (id === "address1") {
|
|
315
|
+
setFormData((prevState) => ({
|
|
316
|
+
...prevState,
|
|
317
|
+
...formDataUpdate,
|
|
318
|
+
}));
|
|
322
319
|
} else {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
} else {
|
|
334
|
-
setFormData((prevState) => ({
|
|
335
|
-
...prevState,
|
|
336
|
-
postal_address1: address1,
|
|
337
|
-
postal_address2: address2,
|
|
338
|
-
postal_suburb: suburb,
|
|
339
|
-
postal_postcode: postcode,
|
|
340
|
-
postal_state: state,
|
|
341
|
-
postal_country: country,
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
320
|
+
setFormData((prevState) => ({
|
|
321
|
+
...prevState,
|
|
322
|
+
...formDataUpdate,
|
|
323
|
+
postal_address1: address1,
|
|
324
|
+
postal_address2: address2,
|
|
325
|
+
postal_suburb: suburb,
|
|
326
|
+
postal_postcode: postcode,
|
|
327
|
+
postal_state: state,
|
|
328
|
+
postal_country: country,
|
|
329
|
+
}));
|
|
344
330
|
}
|
|
345
331
|
};
|
|
346
332
|
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react-dom": "^17.0.1"
|
|
36
36
|
},
|
|
37
37
|
"name": "@visns-studio/visns-components",
|
|
38
|
-
"version": "1.
|
|
38
|
+
"version": "1.5.2",
|
|
39
39
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
40
40
|
"main": "index.js",
|
|
41
41
|
"devDependencies": {},
|