@mseva/upyog-ui-module-ads 1.1.5 → 1.1.7
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +58 -47
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -21955,12 +21955,10 @@ const ADSCartDetails$1 = ({
|
|
|
21955
21955
|
cartDetails,
|
|
21956
21956
|
t
|
|
21957
21957
|
}) => {
|
|
21958
|
-
const
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
const toggleExpand = adId => {
|
|
21963
|
-
setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(adId) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== adId) : [...prev, adId]);
|
|
21958
|
+
const getKey = ad => `${ad === null || ad === void 0 ? void 0 : ad.id}_${ad === null || ad === void 0 ? void 0 : ad.bookingStartDate}_${ad === null || ad === void 0 ? void 0 : ad.bookingEndDate}`;
|
|
21959
|
+
const [expanded, setExpanded] = useState(() => cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.map(item => getKey(item === null || item === void 0 ? void 0 : item.ad)));
|
|
21960
|
+
const toggleExpand = key => {
|
|
21961
|
+
setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(key) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== key) : [...prev, key]);
|
|
21964
21962
|
};
|
|
21965
21963
|
const makeColumns = () => [{
|
|
21966
21964
|
Header: t("ADS_DATE"),
|
|
@@ -21994,8 +21992,9 @@ const ADSCartDetails$1 = ({
|
|
|
21994
21992
|
color: "#666"
|
|
21995
21993
|
}
|
|
21996
21994
|
}, t("ADS_NO_ADVERTISMENT_DETAILS")) : cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.map((item, idx) => {
|
|
21997
|
-
var _item$
|
|
21998
|
-
const
|
|
21995
|
+
var _item$ad, _item$ad2, _item$ad3, _item$ad4, _item$slots;
|
|
21996
|
+
const key = getKey(item === null || item === void 0 ? void 0 : item.ad);
|
|
21997
|
+
const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(key);
|
|
21999
21998
|
return /*#__PURE__*/React.createElement("div", {
|
|
22000
21999
|
key: idx,
|
|
22001
22000
|
style: {
|
|
@@ -22005,10 +22004,7 @@ const ADSCartDetails$1 = ({
|
|
|
22005
22004
|
overflow: "hidden"
|
|
22006
22005
|
}
|
|
22007
22006
|
}, /*#__PURE__*/React.createElement("div", {
|
|
22008
|
-
onClick: () =>
|
|
22009
|
-
var _item$ad3;
|
|
22010
|
-
return toggleExpand(item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.id);
|
|
22011
|
-
},
|
|
22007
|
+
onClick: () => toggleExpand(key),
|
|
22012
22008
|
style: {
|
|
22013
22009
|
background: "#f9f9f9",
|
|
22014
22010
|
padding: "10px 14px",
|
|
@@ -22020,7 +22016,7 @@ const ADSCartDetails$1 = ({
|
|
|
22020
22016
|
justifyContent: "space-between",
|
|
22021
22017
|
alignItems: "center"
|
|
22022
22018
|
}
|
|
22023
|
-
}, /*#__PURE__*/React.createElement("span", null, t((item === null || item === void 0 ? void 0 : (_item$
|
|
22019
|
+
}, /*#__PURE__*/React.createElement("span", null, t((item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.name) ?? (item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.location)), item !== null && item !== void 0 && (_item$ad3 = item.ad) !== null && _item$ad3 !== void 0 && _item$ad3.amount ? ` — ₹${((item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.amount) * 1.18 * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)).toFixed(2)}` : ""), /*#__PURE__*/React.createElement("span", {
|
|
22024
22020
|
style: {
|
|
22025
22021
|
fontSize: "18px"
|
|
22026
22022
|
}
|
|
@@ -24065,8 +24061,8 @@ const AvailabilityModal = ({
|
|
|
24065
24061
|
});
|
|
24066
24062
|
const slots = (slotResults === null || slotResults === void 0 ? void 0 : slotResults.advertisementSlotAvailabiltityDetails) || [];
|
|
24067
24063
|
const existingForAd = (cartSlots === null || cartSlots === void 0 ? void 0 : (_cartSlots$find = cartSlots.find(item => {
|
|
24068
|
-
var _item$ad;
|
|
24069
|
-
return (item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) === (ad === null || ad === void 0 ? void 0 : ad.id);
|
|
24064
|
+
var _item$ad, _item$ad2, _item$ad3;
|
|
24065
|
+
return (item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate);
|
|
24070
24066
|
})) === null || _cartSlots$find === void 0 ? void 0 : _cartSlots$find.slots) || [];
|
|
24071
24067
|
const allBooked = (slots === null || slots === void 0 ? void 0 : slots.length) > 0 && (slots === null || slots === void 0 ? void 0 : slots.every(s => (s === null || s === void 0 ? void 0 : s.slotStaus) !== "AVAILABLE"));
|
|
24072
24068
|
const allAvailableSlots = slots === null || slots === void 0 ? void 0 : slots.filter(s => (s === null || s === void 0 ? void 0 : s.slotStaus) === "AVAILABLE");
|
|
@@ -24092,9 +24088,9 @@ const AvailabilityModal = ({
|
|
|
24092
24088
|
nightLight: (ad === null || ad === void 0 ? void 0 : ad.light) === "With Light",
|
|
24093
24089
|
bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
|
|
24094
24090
|
bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate
|
|
24095
|
-
});
|
|
24091
|
+
}, dateRange);
|
|
24096
24092
|
} else if ((existingForAd === null || existingForAd === void 0 ? void 0 : existingForAd.length) > 0) {
|
|
24097
|
-
onRemoveSlot(ad);
|
|
24093
|
+
onRemoveSlot(ad, dateRange);
|
|
24098
24094
|
}
|
|
24099
24095
|
setSelectedSlots([]);
|
|
24100
24096
|
setSelectAll(false);
|
|
@@ -24114,7 +24110,7 @@ const AvailabilityModal = ({
|
|
|
24114
24110
|
setSelectAll(false);
|
|
24115
24111
|
setSelectedSlots([]);
|
|
24116
24112
|
}
|
|
24117
|
-
}, [ad]);
|
|
24113
|
+
}, [ad, dateRange]);
|
|
24118
24114
|
const columns = [{
|
|
24119
24115
|
Header: () => /*#__PURE__*/React.createElement("input", {
|
|
24120
24116
|
type: "checkbox",
|
|
@@ -24319,12 +24315,10 @@ const CartModal = ({
|
|
|
24319
24315
|
onRemoveSlot,
|
|
24320
24316
|
t
|
|
24321
24317
|
}) => {
|
|
24322
|
-
const
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
const toggleExpand = adId => {
|
|
24327
|
-
setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(adId) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== adId) : [...prev, adId]);
|
|
24318
|
+
const getKey = ad => `${ad === null || ad === void 0 ? void 0 : ad.id}_${ad === null || ad === void 0 ? void 0 : ad.bookingStartDate}_${ad === null || ad === void 0 ? void 0 : ad.bookingEndDate}`;
|
|
24319
|
+
const [expanded, setExpanded] = useState(() => cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.map(item => getKey(item.ad)));
|
|
24320
|
+
const toggleExpand = key => {
|
|
24321
|
+
setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(key) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== key) : [...prev, key]);
|
|
24328
24322
|
};
|
|
24329
24323
|
const makeColumns = ad => [{
|
|
24330
24324
|
Header: t("ADS_DATE"),
|
|
@@ -24432,10 +24426,11 @@ const CartModal = ({
|
|
|
24432
24426
|
color: "#666"
|
|
24433
24427
|
}
|
|
24434
24428
|
}, t("ADS_NO_ITEMS_IN_CART")) : cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.map((item, idx) => {
|
|
24435
|
-
var _item$
|
|
24436
|
-
const
|
|
24429
|
+
var _item$ad, _item$ad2, _item$ad3, _item$slots;
|
|
24430
|
+
const key = getKey(item === null || item === void 0 ? void 0 : item.ad);
|
|
24431
|
+
const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(key);
|
|
24437
24432
|
return /*#__PURE__*/React.createElement("div", {
|
|
24438
|
-
key:
|
|
24433
|
+
key: key,
|
|
24439
24434
|
style: {
|
|
24440
24435
|
marginBottom: "16px",
|
|
24441
24436
|
border: "1px solid #ddd",
|
|
@@ -24454,21 +24449,24 @@ const CartModal = ({
|
|
|
24454
24449
|
alignItems: "center"
|
|
24455
24450
|
}
|
|
24456
24451
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24457
|
-
onClick: () =>
|
|
24458
|
-
var _item$ad2;
|
|
24459
|
-
return toggleExpand(item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.id);
|
|
24460
|
-
},
|
|
24452
|
+
onClick: () => toggleExpand(key),
|
|
24461
24453
|
style: {
|
|
24462
24454
|
cursor: "pointer",
|
|
24463
24455
|
flex: 1
|
|
24464
24456
|
}
|
|
24465
|
-
}, item === null || item === void 0 ? void 0 : (_item$
|
|
24457
|
+
}, item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.name, item !== null && item !== void 0 && (_item$ad2 = item.ad) !== null && _item$ad2 !== void 0 && _item$ad2.amount ? ` — ₹${((item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.amount) * 1.18 * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)).toFixed(2)}` : "", /*#__PURE__*/React.createElement("span", {
|
|
24466
24458
|
style: {
|
|
24467
24459
|
fontSize: "18px",
|
|
24468
24460
|
marginLeft: "8px"
|
|
24469
24461
|
}
|
|
24470
24462
|
}, isOpen ? "▾" : "▸")), /*#__PURE__*/React.createElement("button", {
|
|
24471
|
-
onClick: () =>
|
|
24463
|
+
onClick: () => {
|
|
24464
|
+
var _item$ad4, _item$ad5;
|
|
24465
|
+
return onRemoveSlot(item === null || item === void 0 ? void 0 : item.ad, {
|
|
24466
|
+
startDate: item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.bookingStartDate,
|
|
24467
|
+
endDate: item === null || item === void 0 ? void 0 : (_item$ad5 = item.ad) === null || _item$ad5 === void 0 ? void 0 : _item$ad5.bookingEndDate
|
|
24468
|
+
});
|
|
24469
|
+
},
|
|
24472
24470
|
style: {
|
|
24473
24471
|
padding: "6px 12px",
|
|
24474
24472
|
borderRadius: "6px",
|
|
@@ -24485,7 +24483,7 @@ const CartModal = ({
|
|
|
24485
24483
|
}
|
|
24486
24484
|
}, /*#__PURE__*/React.createElement(Table, {
|
|
24487
24485
|
t: t,
|
|
24488
|
-
data: item.slots,
|
|
24486
|
+
data: item === null || item === void 0 ? void 0 : item.slots,
|
|
24489
24487
|
columns: makeColumns(),
|
|
24490
24488
|
disableSort: true,
|
|
24491
24489
|
isPaginationRequired: false,
|
|
@@ -24891,40 +24889,53 @@ const ADSCitizenSecond = ({
|
|
|
24891
24889
|
});
|
|
24892
24890
|
setShowModal(true);
|
|
24893
24891
|
};
|
|
24894
|
-
const handleRemoveFromCart = ad => {
|
|
24895
|
-
setCartSlots(prev => prev.filter(item =>
|
|
24892
|
+
const handleRemoveFromCart = (ad, dateRange) => {
|
|
24893
|
+
setCartSlots(prev => prev.filter(item => {
|
|
24894
|
+
var _item$ad, _item$ad2, _item$ad3;
|
|
24895
|
+
return !((item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate));
|
|
24896
|
+
}));
|
|
24896
24897
|
setShowToast({
|
|
24897
|
-
label: `Removed
|
|
24898
|
+
label: `Removed slots for ${ad === null || ad === void 0 ? void 0 : ad.name} (${dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate} → ${dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate})`,
|
|
24898
24899
|
error: true
|
|
24899
24900
|
});
|
|
24900
24901
|
};
|
|
24901
|
-
const handleAddToCart = (slots, ad) => {
|
|
24902
|
+
const handleAddToCart = (slots, ad, dateRange) => {
|
|
24902
24903
|
setCartSlots(prev => {
|
|
24903
|
-
const enrichedSlots = slots.map(s => ({
|
|
24904
|
+
const enrichedSlots = slots === null || slots === void 0 ? void 0 : slots.map(s => ({
|
|
24904
24905
|
...s,
|
|
24905
24906
|
bookingStartDate: s === null || s === void 0 ? void 0 : s.bookingDate,
|
|
24906
24907
|
bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
|
|
24907
24908
|
bookingFromTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startTime,
|
|
24908
24909
|
bookingToTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endTime
|
|
24909
24910
|
}));
|
|
24910
|
-
const existing = prev.find(item =>
|
|
24911
|
+
const existing = prev.find(item => {
|
|
24912
|
+
var _item$ad4, _item$ad5, _item$ad6;
|
|
24913
|
+
return (item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad5 = item.ad) === null || _item$ad5 === void 0 ? void 0 : _item$ad5.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad6 = item.ad) === null || _item$ad6 === void 0 ? void 0 : _item$ad6.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate);
|
|
24914
|
+
});
|
|
24911
24915
|
let updated;
|
|
24912
24916
|
if (existing) {
|
|
24913
|
-
updated = prev.map(item =>
|
|
24914
|
-
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
+
updated = prev.map(item => {
|
|
24918
|
+
var _item$ad7, _item$ad8, _item$ad9;
|
|
24919
|
+
return (item === null || item === void 0 ? void 0 : (_item$ad7 = item.ad) === null || _item$ad7 === void 0 ? void 0 : _item$ad7.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad8 = item.ad) === null || _item$ad8 === void 0 ? void 0 : _item$ad8.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad9 = item.ad) === null || _item$ad9 === void 0 ? void 0 : _item$ad9.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate) ? {
|
|
24920
|
+
...item,
|
|
24921
|
+
slots: enrichedSlots
|
|
24922
|
+
} : item;
|
|
24923
|
+
});
|
|
24917
24924
|
setShowToast({
|
|
24918
|
-
label: `Updated ${enrichedSlots.length} slot(s) for ${ad.name}`,
|
|
24925
|
+
label: `Updated ${enrichedSlots.length} slot(s) for ${ad === null || ad === void 0 ? void 0 : ad.name} (${dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate} → ${dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate})`,
|
|
24919
24926
|
error: false
|
|
24920
24927
|
});
|
|
24921
24928
|
} else {
|
|
24922
24929
|
updated = [...prev, {
|
|
24923
|
-
ad
|
|
24930
|
+
ad: {
|
|
24931
|
+
...ad,
|
|
24932
|
+
bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
|
|
24933
|
+
bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate
|
|
24934
|
+
},
|
|
24924
24935
|
slots: enrichedSlots
|
|
24925
24936
|
}];
|
|
24926
24937
|
setShowToast({
|
|
24927
|
-
label: `Added ${enrichedSlots.length} slot(s) to ${ad.name}`,
|
|
24938
|
+
label: `Added ${enrichedSlots === null || enrichedSlots === void 0 ? void 0 : enrichedSlots.length} slot(s) to ${ad === null || ad === void 0 ? void 0 : ad.name} (${dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate} → ${dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate})`,
|
|
24928
24939
|
error: false
|
|
24929
24940
|
});
|
|
24930
24941
|
}
|