abmp-npm 10.3.13 → 10.3.14
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/package.json +1 -1
- package/pages/personalDetails.js +15 -37
package/package.json
CHANGED
package/pages/personalDetails.js
CHANGED
|
@@ -975,36 +975,10 @@ async function personalDetailsOnReady({
|
|
|
975
975
|
});
|
|
976
976
|
}
|
|
977
977
|
|
|
978
|
-
async function handleItemDelete(event, getTextSelector, arrayRef, matchField, renderFn) {
|
|
979
|
-
const result = await wixWindow.openLightbox(LIGHTBOX_NAMES.DELETE_CONFIRM);
|
|
980
|
-
|
|
981
|
-
if (result && result.toDelete) {
|
|
982
|
-
const $clickedItem = _$w.at(event.context);
|
|
983
|
-
const textToRemove = $clickedItem(getTextSelector).text;
|
|
984
|
-
|
|
985
|
-
arrayRef.splice(
|
|
986
|
-
0,
|
|
987
|
-
arrayRef.length,
|
|
988
|
-
...arrayRef.filter(item =>
|
|
989
|
-
typeof item === 'string' ? item !== textToRemove : item[matchField] !== textToRemove
|
|
990
|
-
)
|
|
991
|
-
);
|
|
992
|
-
|
|
993
|
-
renderFn();
|
|
994
|
-
checkFormChanges(FORM_SECTION_HANDLER_MAP.BUSINESS_SERVICES);
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
|
|
998
978
|
async function setInterestData() {
|
|
999
979
|
const interestsData = await getInterestAll();
|
|
1000
980
|
|
|
1001
981
|
_$w('#removeServiceButton').onClick(async event => {
|
|
1002
|
-
// Capture the stable item id BEFORE awaiting the confirm lightbox.
|
|
1003
|
-
// Reading the chip's text after the await is unsafe: the repeater
|
|
1004
|
-
// recycles its DOM items on re-render, so after a rapid sequence of
|
|
1005
|
-
// deletes event.context can resolve to a recycled node showing a
|
|
1006
|
-
// different service, removing the wrong item (or none). Matching on
|
|
1007
|
-
// the stable _id (as the gallery delete does) avoids that race.
|
|
1008
982
|
const itemId = event.context.itemId;
|
|
1009
983
|
const result = await wixWindow.openLightbox(LIGHTBOX_NAMES.DELETE_CONFIRM);
|
|
1010
984
|
|
|
@@ -1090,9 +1064,6 @@ async function personalDetailsOnReady({
|
|
|
1090
1064
|
}
|
|
1091
1065
|
|
|
1092
1066
|
function renderServices() {
|
|
1093
|
-
// Pass a fresh array copy so the Wix repeater detects the change and
|
|
1094
|
-
// re-renders. Assigning the same array reference (mutated in place by
|
|
1095
|
-
// add/delete) is treated as a no-op, leaving stale chips on screen.
|
|
1096
1067
|
setupRepeater('#servicesRepeater', [...selectedServices]);
|
|
1097
1068
|
}
|
|
1098
1069
|
|
|
@@ -1355,14 +1326,21 @@ async function personalDetailsOnReady({
|
|
|
1355
1326
|
const addTestimonialButton = _$w('#addTestimonialButton');
|
|
1356
1327
|
|
|
1357
1328
|
addTestimonialButton.onClick(handleAddTestimonial);
|
|
1358
|
-
_$w('#deleteTestimonialButton').onClick(event => {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1329
|
+
_$w('#deleteTestimonialButton').onClick(async event => {
|
|
1330
|
+
const data = _$w('#testimonialRepeater').data || [];
|
|
1331
|
+
const clickedIndex = data.findIndex(item => item._id === event.context.itemId);
|
|
1332
|
+
const result = await wixWindow.openLightbox(LIGHTBOX_NAMES.DELETE_CONFIRM);
|
|
1333
|
+
|
|
1334
|
+
if (
|
|
1335
|
+
result &&
|
|
1336
|
+
result.toDelete &&
|
|
1337
|
+
clickedIndex > 0 &&
|
|
1338
|
+
Array.isArray(itemMemberObj.testimonial)
|
|
1339
|
+
) {
|
|
1340
|
+
itemMemberObj.testimonial.splice(clickedIndex - 1, 1);
|
|
1341
|
+
renderTestimonials();
|
|
1342
|
+
checkFormChanges(FORM_SECTION_HANDLER_MAP.BUSINESS_SERVICES);
|
|
1343
|
+
}
|
|
1366
1344
|
});
|
|
1367
1345
|
|
|
1368
1346
|
renderTestimonials();
|