@redneckz/wildless-cms-uni-blocks 0.14.78 → 0.14.80
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +73 -28
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -3
- package/bundle/components/OfficesAtmsMap/renderCurrency.d.ts +3 -0
- package/bundle/components/OfficesAtmsMap/renderCurrentDaySchedule.d.ts +3 -0
- package/bundle/components/OfficesAtmsMap/renderDay.d.ts +3 -0
- package/bundle/components/OfficesAtmsMap/renderFoldButton.d.ts +3 -0
- package/bundle/components/OfficesAtmsMap/renderOfficeCard.d.ts +1 -4
- package/dist/components/LinkDocs/LinkDocItem.js +3 -2
- package/dist/components/LinkDocs/LinkDocItem.js.map +1 -1
- package/dist/components/LinkDocs/LinkDocs.js +8 -1
- package/dist/components/LinkDocs/LinkDocs.js.map +1 -1
- package/dist/components/OfficesAtmsMap/Badge.js +1 -1
- package/dist/components/OfficesAtmsMap/Badge.js.map +1 -1
- package/dist/components/OfficesAtmsMap/CardRow.js +1 -1
- package/dist/components/OfficesAtmsMap/CardRow.js.map +1 -1
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -3
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -1
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/dist/components/OfficesAtmsMap/renderAtmCard.js +8 -1
- package/dist/components/OfficesAtmsMap/renderAtmCard.js.map +1 -1
- package/dist/components/OfficesAtmsMap/renderCurrency.d.ts +3 -0
- package/dist/components/OfficesAtmsMap/renderCurrency.js +7 -0
- package/dist/components/OfficesAtmsMap/renderCurrency.js.map +1 -0
- package/dist/components/OfficesAtmsMap/renderCurrentDaySchedule.d.ts +3 -0
- package/dist/components/OfficesAtmsMap/renderCurrentDaySchedule.js +16 -0
- package/dist/components/OfficesAtmsMap/renderCurrentDaySchedule.js.map +1 -0
- package/dist/components/OfficesAtmsMap/renderDay.d.ts +3 -0
- package/dist/components/OfficesAtmsMap/renderDay.js +13 -0
- package/dist/components/OfficesAtmsMap/renderDay.js.map +1 -0
- package/dist/components/OfficesAtmsMap/renderFiltrationForm.js +1 -1
- package/dist/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/dist/components/OfficesAtmsMap/renderFoldButton.d.ts +3 -0
- package/dist/components/OfficesAtmsMap/renderFoldButton.js +9 -0
- package/dist/components/OfficesAtmsMap/renderFoldButton.js.map +1 -0
- package/dist/components/OfficesAtmsMap/renderOfficeCard.d.ts +1 -4
- package/dist/components/OfficesAtmsMap/renderOfficeCard.js +36 -26
- package/dist/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/LinkDocs/LinkDocItem.js +3 -2
- package/lib/components/LinkDocs/LinkDocItem.js.map +1 -1
- package/lib/components/LinkDocs/LinkDocs.js +8 -1
- package/lib/components/LinkDocs/LinkDocs.js.map +1 -1
- package/lib/components/OfficesAtmsMap/Badge.js +1 -1
- package/lib/components/OfficesAtmsMap/Badge.js.map +1 -1
- package/lib/components/OfficesAtmsMap/CardRow.js +1 -1
- package/lib/components/OfficesAtmsMap/CardRow.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -3
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -1
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/lib/components/OfficesAtmsMap/renderAtmCard.js +8 -1
- package/lib/components/OfficesAtmsMap/renderAtmCard.js.map +1 -1
- package/lib/components/OfficesAtmsMap/renderCurrency.d.ts +2 -0
- package/lib/components/OfficesAtmsMap/renderCurrency.js +4 -0
- package/lib/components/OfficesAtmsMap/renderCurrency.js.map +1 -0
- package/lib/components/OfficesAtmsMap/renderCurrentDaySchedule.d.ts +2 -0
- package/lib/components/OfficesAtmsMap/renderCurrentDaySchedule.js +13 -0
- package/lib/components/OfficesAtmsMap/renderCurrentDaySchedule.js.map +1 -0
- package/lib/components/OfficesAtmsMap/renderDay.d.ts +2 -0
- package/lib/components/OfficesAtmsMap/renderDay.js +10 -0
- package/lib/components/OfficesAtmsMap/renderDay.js.map +1 -0
- package/lib/components/OfficesAtmsMap/renderFiltrationForm.js +1 -1
- package/lib/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/lib/components/OfficesAtmsMap/renderFoldButton.d.ts +3 -0
- package/lib/components/OfficesAtmsMap/renderFoldButton.js +6 -0
- package/lib/components/OfficesAtmsMap/renderFoldButton.js.map +1 -0
- package/lib/components/OfficesAtmsMap/renderOfficeCard.d.ts +1 -4
- package/lib/components/OfficesAtmsMap/renderOfficeCard.js +34 -21
- package/lib/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +77 -32
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -3
- package/mobile/bundle/components/OfficesAtmsMap/renderCurrency.d.ts +3 -0
- package/mobile/bundle/components/OfficesAtmsMap/renderCurrentDaySchedule.d.ts +3 -0
- package/mobile/bundle/components/OfficesAtmsMap/renderDay.d.ts +3 -0
- package/mobile/bundle/components/OfficesAtmsMap/renderFoldButton.d.ts +3 -0
- package/mobile/bundle/components/OfficesAtmsMap/renderOfficeCard.d.ts +1 -4
- package/mobile/dist/components/LinkDocs/LinkDocItem.js +3 -2
- package/mobile/dist/components/LinkDocs/LinkDocItem.js.map +1 -1
- package/mobile/dist/components/LinkDocs/LinkDocs.js +8 -1
- package/mobile/dist/components/LinkDocs/LinkDocs.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/Badge.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/Badge.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/CardRow.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/CardRow.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -3
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderAtmCard.js +8 -1
- package/mobile/dist/components/OfficesAtmsMap/renderAtmCard.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderCurrency.d.ts +3 -0
- package/mobile/dist/components/OfficesAtmsMap/renderCurrency.js +7 -0
- package/mobile/dist/components/OfficesAtmsMap/renderCurrency.js.map +1 -0
- package/mobile/dist/components/OfficesAtmsMap/renderCurrentDaySchedule.d.ts +3 -0
- package/mobile/dist/components/OfficesAtmsMap/renderCurrentDaySchedule.js +16 -0
- package/mobile/dist/components/OfficesAtmsMap/renderCurrentDaySchedule.js.map +1 -0
- package/mobile/dist/components/OfficesAtmsMap/renderDay.d.ts +3 -0
- package/mobile/dist/components/OfficesAtmsMap/renderDay.js +13 -0
- package/mobile/dist/components/OfficesAtmsMap/renderDay.js.map +1 -0
- package/mobile/dist/components/OfficesAtmsMap/renderFiltrationForm.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderFoldButton.d.ts +3 -0
- package/mobile/dist/components/OfficesAtmsMap/renderFoldButton.js +9 -0
- package/mobile/dist/components/OfficesAtmsMap/renderFoldButton.js.map +1 -0
- package/mobile/dist/components/OfficesAtmsMap/renderOfficeCard.d.ts +1 -4
- package/mobile/dist/components/OfficesAtmsMap/renderOfficeCard.js +36 -26
- package/mobile/dist/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/LinkDocs/LinkDocItem.js +3 -2
- package/mobile/lib/components/LinkDocs/LinkDocItem.js.map +1 -1
- package/mobile/lib/components/LinkDocs/LinkDocs.js +8 -1
- package/mobile/lib/components/LinkDocs/LinkDocs.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/Badge.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/Badge.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/CardRow.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/CardRow.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapContent.d.ts +3 -3
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderAtmCard.js +8 -1
- package/mobile/lib/components/OfficesAtmsMap/renderAtmCard.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderCurrency.d.ts +3 -0
- package/mobile/lib/components/OfficesAtmsMap/renderCurrency.js +4 -0
- package/mobile/lib/components/OfficesAtmsMap/renderCurrency.js.map +1 -0
- package/mobile/lib/components/OfficesAtmsMap/renderCurrentDaySchedule.d.ts +3 -0
- package/mobile/lib/components/OfficesAtmsMap/renderCurrentDaySchedule.js +13 -0
- package/mobile/lib/components/OfficesAtmsMap/renderCurrentDaySchedule.js.map +1 -0
- package/mobile/lib/components/OfficesAtmsMap/renderDay.d.ts +3 -0
- package/mobile/lib/components/OfficesAtmsMap/renderDay.js +10 -0
- package/mobile/lib/components/OfficesAtmsMap/renderDay.js.map +1 -0
- package/mobile/lib/components/OfficesAtmsMap/renderFiltrationForm.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderFoldButton.d.ts +3 -0
- package/mobile/lib/components/OfficesAtmsMap/renderFoldButton.js +6 -0
- package/mobile/lib/components/OfficesAtmsMap/renderFoldButton.js.map +1 -0
- package/mobile/lib/components/OfficesAtmsMap/renderOfficeCard.d.ts +1 -4
- package/mobile/lib/components/OfficesAtmsMap/renderOfficeCard.js +34 -21
- package/mobile/lib/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
- package/mobile/src/components/LinkDocs/LinkDocItem.tsx +5 -3
- package/mobile/src/components/LinkDocs/LinkDocs.tsx +12 -1
- package/mobile/src/components/OfficesAtmsMap/Badge.tsx +1 -1
- package/mobile/src/components/OfficesAtmsMap/CardRow.tsx +1 -1
- package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapContent.ts +3 -3
- package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +2 -2
- package/mobile/src/components/OfficesAtmsMap/renderAtmCard.tsx +29 -10
- package/mobile/src/components/OfficesAtmsMap/renderCurrency.tsx +13 -0
- package/mobile/src/components/OfficesAtmsMap/renderCurrentDaySchedule.tsx +24 -0
- package/mobile/src/components/OfficesAtmsMap/renderDay.tsx +23 -0
- package/mobile/src/components/OfficesAtmsMap/renderFiltrationForm.tsx +1 -1
- package/mobile/src/components/OfficesAtmsMap/renderFoldButton.tsx +17 -0
- package/mobile/src/components/OfficesAtmsMap/renderOfficeCard.tsx +72 -68
- package/package.json +1 -1
- package/src/components/LinkDocs/LinkDocItem.tsx +5 -3
- package/src/components/LinkDocs/LinkDocs.tsx +12 -1
- package/src/components/OfficesAtmsMap/Badge.tsx +1 -1
- package/src/components/OfficesAtmsMap/CardRow.tsx +1 -1
- package/src/components/OfficesAtmsMap/OfficesAtmsMapContent.ts +3 -3
- package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +2 -2
- package/src/components/OfficesAtmsMap/renderAtmCard.tsx +29 -10
- package/src/components/OfficesAtmsMap/renderCurrency.tsx +13 -0
- package/src/components/OfficesAtmsMap/renderCurrentDaySchedule.tsx +24 -0
- package/src/components/OfficesAtmsMap/renderDay.tsx +23 -0
- package/src/components/OfficesAtmsMap/renderFiltrationForm.tsx +1 -1
- package/src/components/OfficesAtmsMap/renderFoldButton.tsx +17 -0
- package/src/components/OfficesAtmsMap/renderOfficeCard.tsx +72 -68
|
@@ -1,40 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { Foldable } from '../../ui-kit/Foldable/Foldable.js';
|
|
3
|
+
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection.js';
|
|
2
4
|
import { Icon } from '../../ui-kit/Icon/Icon.js';
|
|
3
5
|
import { Text } from '../../ui-kit/Text/Text.js';
|
|
4
|
-
import { Badge } from './Badge.js';
|
|
5
6
|
import { CardCell } from './CardCell.js';
|
|
6
7
|
import { CardRow } from './CardRow.js';
|
|
7
8
|
import { getScheduleDescription } from './getScheduleDescription.js';
|
|
8
9
|
import { getWorkScheduleWeek } from './getWorkScheduleWeek.js';
|
|
9
10
|
import { renderAlternativeDay, renderBusinessSchedule } from './renderBusinessSchedule.js';
|
|
10
|
-
|
|
11
|
+
import { renderCurrency } from './renderCurrency.js';
|
|
12
|
+
import { renderCurrentDaySchedule } from './renderCurrentDaySchedule.js';
|
|
13
|
+
import { renderDay } from './renderDay.js';
|
|
14
|
+
import { renderFoldButton } from './renderFoldButton.js';
|
|
11
15
|
export const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, index) => {
|
|
12
16
|
if (!workSchedule) {
|
|
13
17
|
return null;
|
|
14
18
|
}
|
|
19
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
20
|
+
return (_jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [_jsxs("div", { className: "sm:flex sm:justify-between", children: [_jsxs("div", { children: [_jsx(Text, { size: "text-h4", children: name }), address ? (_jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [_jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), _jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), _jsx("div", { className: "hidden sm:block", children: renderCardContent({
|
|
21
|
+
phone,
|
|
22
|
+
fax,
|
|
23
|
+
phoneBusiness,
|
|
24
|
+
phoneNatural,
|
|
25
|
+
phoneCallCentre,
|
|
26
|
+
phoneCurrencyControl,
|
|
27
|
+
workSchedule,
|
|
28
|
+
exchangeRate,
|
|
29
|
+
}) }), _jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
30
|
+
return (_jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent({
|
|
31
|
+
phone,
|
|
32
|
+
fax,
|
|
33
|
+
phoneBusiness,
|
|
34
|
+
phoneNatural,
|
|
35
|
+
phoneCallCentre,
|
|
36
|
+
phoneCurrencyControl,
|
|
37
|
+
workSchedule,
|
|
38
|
+
exchangeRate,
|
|
39
|
+
}) }));
|
|
40
|
+
},
|
|
41
|
+
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
42
|
+
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton({ isUnfolded, onToggle }) })] }, String(index)));
|
|
43
|
+
};
|
|
44
|
+
const renderCardContent = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
15
45
|
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
16
46
|
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
17
47
|
? 'Для физических лиц'
|
|
18
48
|
: 'Для физических и юридических лиц';
|
|
19
|
-
return (_jsxs("div", {
|
|
49
|
+
return (_jsxs("div", { children: [_jsxs(CardRow, { className: "flex-wrap", children: [_jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax }), _jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone }), _jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness }), _jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural }), _jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl }), _jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre })] }), workSchedule?.isMatchesPattern ? (_jsx(CardRow, { children: _jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: _jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (_jsxs(CardRow, { children: [_jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: _jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
|
|
20
50
|
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
21
|
-
: null, exchangeRate?.currencies?.length ? (_jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }
|
|
22
|
-
};
|
|
23
|
-
export const renderCurrency = ({ currency, buyExchangeRate, saleExchangeRate }, i) => (_jsxs("div", { className: "flex gap-lg h-full", children: [currency?.currency ? _jsx(CardCell, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", value: currency.currency }) : null, buyExchangeRate ? _jsx(CardCell, { label: "\u041A\u0443\u043F\u0438\u0442\u044C", value: String(buyExchangeRate) }) : null, saleExchangeRate ? _jsx(CardCell, { label: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C", value: String(saleExchangeRate) }) : null] }, String(i)));
|
|
24
|
-
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
25
|
-
export const renderCurrentDaySchedule = (workScheduleWeek) => {
|
|
26
|
-
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
27
|
-
if (!currentWeekDay) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
31
|
-
return status ? (_jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? _jsx(Badge, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? _jsx(Badge, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (_jsx(Badge, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
|
|
32
|
-
};
|
|
33
|
-
export const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, index) => (_jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch(lunchHour, hasLunch, status), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(index)));
|
|
34
|
-
const getSubTextLunch = (lunchHour, hasLunch = false, status = false) => {
|
|
35
|
-
if (!status) {
|
|
36
|
-
return 'Не работает';
|
|
37
|
-
}
|
|
38
|
-
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
51
|
+
: null, exchangeRate?.currencies?.length ? (_jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
39
52
|
};
|
|
40
53
|
//# sourceMappingURL=renderOfficeCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderOfficeCard.js","sourceRoot":"","sources":["../../../src/components/OfficesAtmsMap/renderOfficeCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"renderOfficeCard.js","sourceRoot":"","sources":["../../../src/components/OfficesAtmsMap/renderOfficeCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,EACE,IAAI,EACJ,OAAO,EACP,KAAK,EACL,GAAG,EACH,aAAa,EACb,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACL,EACT,KAAa,EACb,EAAE;IACF,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAE3D,OAAO,CACL,eAAyB,SAAS,EAAC,sDAAsD,aACvF,eAAK,SAAS,EAAC,4BAA4B,aACzC,0BACE,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,YAAE,IAAI,GAAQ,EACjC,OAAO,CAAC,CAAC,CAAC,CACT,eAAK,SAAS,EAAC,0BAA0B,aACvC,KAAC,IAAI,IAAC,IAAI,EAAC,iBAAiB,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAG,EACtD,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,YAAE,OAAO,GAAQ,IAChC,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,wBAAwB,CAAC,gBAAgB,CAAC,IACvC,EACN,cAAK,SAAS,EAAC,iBAAiB,YAC7B,iBAAiB,CAAC;oBACjB,KAAK;oBACL,GAAG;oBACH,aAAa;oBACb,YAAY;oBACZ,eAAe;oBACf,oBAAoB;oBACpB,YAAY;oBACZ,YAAY;iBACb,CAAC,GACE,EACN,KAAC,QAAQ,IACP,SAAS,EAAC,iBAAiB,EAC3B,qBAAqB,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;oBACxC,OAAO,CACL,KAAC,eAAe,IAAC,UAAU,EAAE,UAAU,YACpC,iBAAiB,CAAC;4BACjB,KAAK;4BACL,GAAG;4BACH,aAAa;4BACb,YAAY;4BACZ,eAAe;4BACf,oBAAoB;4BACpB,YAAY;4BACZ,YAAY;yBACb,CAAC,GACc,CACnB,CAAC;gBACJ,CAAC;gBACD,8DAA8D;gBAC9D,gBAAgB,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,GAC1F,KA7CM,MAAM,CAAC,KAAK,CAAC,CA8CjB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,EACzB,KAAK,EACL,GAAG,EACH,aAAa,EACb,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACL,EAAE,EAAE;IACX,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC3D,MAAM,aAAa,GAAG,YAAY,EAAE,0BAA0B;QAC5D,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,kCAAkC,CAAC;IAEvC,OAAO,CACL,0BACE,MAAC,OAAO,IAAC,SAAS,EAAC,WAAW,aAC5B,KAAC,QAAQ,IAAC,KAAK,EAAC,0BAAM,EAAC,KAAK,EAAE,GAAG,GAAI,EACrC,KAAC,QAAQ,IAAC,KAAK,EAAC,uFAAiB,EAAC,KAAK,EAAE,KAAK,GAAI,EAClD,KAAC,QAAQ,IAAC,KAAK,EAAC,iKAA+B,EAAC,KAAK,EAAE,aAAa,GAAI,EACxE,KAAC,QAAQ,IAAC,KAAK,EAAC,0JAA6B,EAAC,KAAK,EAAE,YAAY,GAAI,EACrE,KAAC,QAAQ,IAAC,KAAK,EAAC,kNAAwC,EAAC,KAAK,EAAE,oBAAoB,GAAI,EACxF,KAAC,QAAQ,IAAC,KAAK,EAAC,2EAAe,EAAC,KAAK,EAAE,eAAe,GAAI,IAClD,EACT,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAChC,KAAC,OAAO,cACN,KAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAC,QAAQ,EAAC,SAAS,EAAC,mBAAmB,YAC9E,cAAK,SAAS,EAAC,gDAAgD,YAC5D,gBAAgB,EAAE,GAAG,CAAC,SAAS,CAAC,GAC7B,GACG,GACH,CACX,CAAC,CAAC,CAAC,CACF,MAAC,OAAO,eACN,KAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAC,QAAQ,YAChD,cAAK,SAAS,EAAC,YAAY,YAAE,gBAAgB,EAAE,GAAG,CAAC,oBAAoB,CAAC,GAAO,GACtE,EACV,sBAAsB,CAAC,gBAAgB,CAAC,IACjC,CACX,EACA,YAAY,EAAE,0BAA0B;gBACvC,CAAC,CAAC,sBAAsB,CAAC,YAAY,EAAE,2BAA2B,CAAC;gBACnE,CAAC,CAAC,IAAI,EACP,YAAY,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAClC,KAAC,OAAO,IAAC,SAAS,EAAC,WAAW,YAAE,YAAY,EAAE,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAAW,CACzF,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ export interface LinkDocItemProps extends LinkDoc {
|
|
|
9
9
|
|
|
10
10
|
export const LinkDocItem = JSX<LinkDocItemProps>(
|
|
11
11
|
({ icon, text, href, target, fileFormat, fileSize }) => {
|
|
12
|
-
const prefix =
|
|
12
|
+
const prefix = fileSize && fileFormat ? ',' : '';
|
|
13
13
|
const size = fileSize ?? '';
|
|
14
14
|
const format = fileFormat ? String(fileFormat) : '';
|
|
15
15
|
|
|
@@ -23,11 +23,13 @@ export const LinkDocItem = JSX<LinkDocItemProps>(
|
|
|
23
23
|
{icon}
|
|
24
24
|
{text ? (
|
|
25
25
|
<Text size="text-l" font="font-light">
|
|
26
|
-
{text}
|
|
27
|
-
<Text color="text-secondary-text">{href && `${size
|
|
26
|
+
{text} {addSpace(size, format)}
|
|
27
|
+
<Text color="text-secondary-text">{href && `${size + prefix + format}`}</Text>
|
|
28
28
|
</Text>
|
|
29
29
|
) : null}
|
|
30
30
|
</a>
|
|
31
31
|
);
|
|
32
32
|
},
|
|
33
33
|
);
|
|
34
|
+
|
|
35
|
+
const addSpace = (size: string, format: string) => (size || format ? <span>, </span> : '');
|
|
@@ -74,7 +74,8 @@ const renderLinkDocItem =
|
|
|
74
74
|
? formatBytes(docBlockDef?.attachment?.fileSize || 0)
|
|
75
75
|
: docBlockDef?.fileSize;
|
|
76
76
|
|
|
77
|
-
const fileFormat =
|
|
77
|
+
const fileFormat =
|
|
78
|
+
docBlockDef?.docType === 'Attachment' ? getExtFromHref(href) : docBlockDef?.fileFormat;
|
|
78
79
|
|
|
79
80
|
return (
|
|
80
81
|
<div key={String(i)} role="listitem">
|
|
@@ -89,3 +90,13 @@ const renderLinkDocItem =
|
|
|
89
90
|
</div>
|
|
90
91
|
);
|
|
91
92
|
};
|
|
93
|
+
|
|
94
|
+
const getExtFromHref = (href?: string) => {
|
|
95
|
+
if (!href) {
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const index = href.lastIndexOf('.');
|
|
100
|
+
|
|
101
|
+
return index !== -1 ? href.substring(index + 1) : '';
|
|
102
|
+
};
|
|
@@ -18,7 +18,7 @@ export interface BadgeProps {
|
|
|
18
18
|
export const Badge = JSX<BadgeProps>(({ className, children, color = 'gray' }) => (
|
|
19
19
|
<div
|
|
20
20
|
className={style(
|
|
21
|
-
'p-s border border-gray rounded-md flex items-center',
|
|
21
|
+
'p-s sm:border sm:border-gray rounded-md flex items-center',
|
|
22
22
|
colorStyle[color].border,
|
|
23
23
|
className,
|
|
24
24
|
)}
|
|
@@ -8,7 +8,7 @@ export interface CardRowProps {
|
|
|
8
8
|
export const CardRow = JSX<CardRowProps>(({ className, children }) => (
|
|
9
9
|
<div
|
|
10
10
|
className={style(
|
|
11
|
-
'flex border-t border-solid border-main-divider py-xl gap-x-6xl gap-y-xl',
|
|
11
|
+
'sm:flex sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl',
|
|
12
12
|
className,
|
|
13
13
|
)}
|
|
14
14
|
>
|
|
@@ -11,7 +11,7 @@ export type ItemList = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @title
|
|
14
|
+
* @title Офисам
|
|
15
15
|
* @default {"dataType": "offices"}
|
|
16
16
|
*/
|
|
17
17
|
export type OfficesDef = {
|
|
@@ -19,7 +19,7 @@ export type OfficesDef = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* @title
|
|
22
|
+
* @title Банкоматам
|
|
23
23
|
* @default {"dataType": "atms"}
|
|
24
24
|
*/
|
|
25
25
|
export type AtmsDef = {
|
|
@@ -37,7 +37,7 @@ export type EmptyOfficesAtmsBlock = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* @title Данные
|
|
40
|
+
* @title Данные по
|
|
41
41
|
* @default { "dataType": "" }
|
|
42
42
|
*/
|
|
43
43
|
export type OfficesAtmsBlockDef = EmptyOfficesAtmsBlock | OfficesDef | AtmsDef;
|
|
@@ -74,14 +74,14 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm>>
|
|
|
74
74
|
|
|
75
75
|
const renderDescriptionBlock = ({ description, list }: AtmsDef) =>
|
|
76
76
|
description || list?.length ? (
|
|
77
|
-
<div className="p-xl mb-2xl border border-
|
|
77
|
+
<div className="p-xl mb-2xl border-b sm:border border-main-divider sm:rounded-md">
|
|
78
78
|
{description ? (
|
|
79
79
|
<Paragraph size="text-l" font="font-light">
|
|
80
80
|
{description}
|
|
81
81
|
</Paragraph>
|
|
82
82
|
) : null}
|
|
83
83
|
{list?.length ? (
|
|
84
|
-
<div className="flex gap-2xl flex-wrap pt-xs">
|
|
84
|
+
<div className="flex flex-col sm:flex-row gap-2xl sm:flex-wrap pt-xs">
|
|
85
85
|
{list.map((item, i) => (
|
|
86
86
|
<div key={String(i)} className="flex gap-xs items-center">
|
|
87
87
|
{item?.image ? <Img image={item.image} /> : null}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Foldable } from '../../ui-kit/Foldable/Foldable';
|
|
2
|
+
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
|
|
1
3
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
2
4
|
import { Text } from '../../ui-kit/Text/Text';
|
|
3
5
|
import { Badge } from './Badge';
|
|
4
6
|
import { CardCell } from './CardCell';
|
|
5
7
|
import { CardRow } from './CardRow';
|
|
6
8
|
import { type Atm } from './OfficesAtmsMapProps';
|
|
9
|
+
import { renderFoldButton } from './renderFoldButton';
|
|
7
10
|
|
|
8
11
|
export const renderAtmCard = (
|
|
9
12
|
{
|
|
@@ -36,18 +39,34 @@ export const renderAtmCard = (
|
|
|
36
39
|
];
|
|
37
40
|
|
|
38
41
|
return (
|
|
39
|
-
<div key={String(index)} className="bg-white col-span-12 p-3xl border-green border">
|
|
40
|
-
<div className="flex justify-between">
|
|
41
|
-
<
|
|
42
|
+
<div key={String(index)} className="bg-white col-span-12 p-3xl sm:border-green sm:border">
|
|
43
|
+
<div className="sm:flex sm:justify-between">
|
|
44
|
+
<div>
|
|
45
|
+
<Text size="text-h4">{capitalizedFirstLetter(location)}</Text>
|
|
46
|
+
{address ? (
|
|
47
|
+
<div className="flex pb-xl pt-xs gap-2xs">
|
|
48
|
+
<Icon name="GeolocationIcon" width="24" height="24" />
|
|
49
|
+
<Text size="text-l">{address}</Text>
|
|
50
|
+
</div>
|
|
51
|
+
) : null}
|
|
52
|
+
</div>
|
|
42
53
|
<Badge color="green">{capitalizedFirstLetter(workTime)}</Badge>
|
|
43
54
|
</div>
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
<div className="hidden sm:block">
|
|
56
|
+
<CardRow className="flex-wrap">{additionalInfo?.map(renderInfo)}</CardRow>
|
|
57
|
+
</div>
|
|
58
|
+
<Foldable
|
|
59
|
+
className="block sm:hidden"
|
|
60
|
+
renderFoldableSection={({ isUnfolded }) => {
|
|
61
|
+
return (
|
|
62
|
+
<FoldableSection isUnfolded={isUnfolded}>
|
|
63
|
+
<CardRow className="flex-wrap">{additionalInfo?.map(renderInfo)}</CardRow>
|
|
64
|
+
</FoldableSection>
|
|
65
|
+
);
|
|
66
|
+
}}
|
|
67
|
+
//** TODO: Remove styles with refactoring DefaultFoldButton*/
|
|
68
|
+
renderFoldButton={({ isUnfolded, onToggle }) => renderFoldButton({ isUnfolded, onToggle })}
|
|
69
|
+
/>
|
|
51
70
|
</div>
|
|
52
71
|
);
|
|
53
72
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CardCell } from './CardCell';
|
|
2
|
+
import { type Currency } from './OfficesAtmsMapProps';
|
|
3
|
+
|
|
4
|
+
export const renderCurrency = (
|
|
5
|
+
{ currency, buyExchangeRate, saleExchangeRate }: Currency,
|
|
6
|
+
i: number,
|
|
7
|
+
) => (
|
|
8
|
+
<div key={String(i)} className="flex gap-lg h-full">
|
|
9
|
+
{currency?.currency ? <CardCell label="Валюта" value={currency.currency} /> : null}
|
|
10
|
+
{buyExchangeRate ? <CardCell label="Купить" value={String(buyExchangeRate)} /> : null}
|
|
11
|
+
{saleExchangeRate ? <CardCell label="Продать" value={String(saleExchangeRate)} /> : null}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Badge } from './Badge';
|
|
2
|
+
import { type WorkScheduleWeek } from './OfficesAtmsMapProps';
|
|
3
|
+
|
|
4
|
+
const currentWeekDayIdx = new Date().getDay();
|
|
5
|
+
|
|
6
|
+
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
7
|
+
export const renderCurrentDaySchedule = (workScheduleWeek?: WorkScheduleWeek[]) => {
|
|
8
|
+
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
9
|
+
|
|
10
|
+
if (!currentWeekDay) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
15
|
+
|
|
16
|
+
return status ? (
|
|
17
|
+
<div className="flex gap-s items-start whitespace-nowrap">
|
|
18
|
+
{workTime ? <Badge color="green">{workTime}</Badge> : null}
|
|
19
|
+
{lunchHour && hasLunch ? <Badge color="yellow">{`перерыв: ${lunchHour}`}</Badge> : null}
|
|
20
|
+
</div>
|
|
21
|
+
) : (
|
|
22
|
+
<Badge color="red">Выходной</Badge>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CardCell } from './CardCell';
|
|
2
|
+
import { type WorkScheduleWeek } from './OfficesAtmsMapProps';
|
|
3
|
+
|
|
4
|
+
const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }: WorkScheduleWeek) => {
|
|
5
|
+
if (!status) {
|
|
6
|
+
return 'Не работает';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const renderDay = (
|
|
13
|
+
{ title, status, workTime, lunchHour, hasLunch }: WorkScheduleWeek,
|
|
14
|
+
index: number,
|
|
15
|
+
) => (
|
|
16
|
+
<CardCell
|
|
17
|
+
key={String(index)}
|
|
18
|
+
label={title}
|
|
19
|
+
value={status && workTime ? workTime : ''}
|
|
20
|
+
subText={getSubTextLunch({ lunchHour, hasLunch, status })}
|
|
21
|
+
subColor={!status || hasLunch ? 'text-error' : 'text-green-dark'}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
@@ -18,7 +18,7 @@ export const renderFiltrationForm = (
|
|
|
18
18
|
) => (
|
|
19
19
|
<div className="pb-2xl">
|
|
20
20
|
{filters?.length ? (
|
|
21
|
-
<div className="flex flex-wrap gap-3xl pb-2xl">
|
|
21
|
+
<div className="flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl">
|
|
22
22
|
{filters.map((key) => (
|
|
23
23
|
<Checkbox key={key} text={FILTRATION_LABELS[key]} {...field(key)} />
|
|
24
24
|
))}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type IconName } from '../../icons/IconName';
|
|
2
|
+
import { type VNode } from '../../model/VNode';
|
|
3
|
+
import { type FoldablePartProps } from '../../ui-kit/Foldable/FoldablePartProps';
|
|
4
|
+
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
5
|
+
|
|
6
|
+
const ICONS: IconName[] = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
7
|
+
const labels = ['Подробнее', 'Скрыть'];
|
|
8
|
+
|
|
9
|
+
export const renderFoldButton = ({ isUnfolded, onToggle }: FoldablePartProps): VNode => (
|
|
10
|
+
<button
|
|
11
|
+
className="w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider"
|
|
12
|
+
onClick={onToggle}
|
|
13
|
+
>
|
|
14
|
+
<div className="pr-m">{labels[Number(isUnfolded)]}</div>
|
|
15
|
+
<Icon className="text-primary-text" name={ICONS[Number(isUnfolded)]} width="16" height="16" />
|
|
16
|
+
</button>
|
|
17
|
+
);
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { Foldable } from '../../ui-kit/Foldable/Foldable';
|
|
2
|
+
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
|
|
1
3
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
2
4
|
import { Text } from '../../ui-kit/Text/Text';
|
|
3
|
-
import { Badge } from './Badge';
|
|
4
5
|
import { CardCell } from './CardCell';
|
|
5
6
|
import { CardRow } from './CardRow';
|
|
6
7
|
import { getScheduleDescription } from './getScheduleDescription';
|
|
7
8
|
import { getWorkScheduleWeek } from './getWorkScheduleWeek';
|
|
8
|
-
import { type Branch
|
|
9
|
+
import { type Branch } from './OfficesAtmsMapProps';
|
|
9
10
|
import { renderAlternativeDay, renderBusinessSchedule } from './renderBusinessSchedule';
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
import { renderCurrency } from './renderCurrency';
|
|
12
|
+
import { renderCurrentDaySchedule } from './renderCurrentDaySchedule';
|
|
13
|
+
import { renderDay } from './renderDay';
|
|
14
|
+
import { renderFoldButton } from './renderFoldButton';
|
|
12
15
|
|
|
13
16
|
export const renderOfficeCard = (
|
|
14
17
|
{
|
|
@@ -29,23 +32,76 @@ export const renderOfficeCard = (
|
|
|
29
32
|
return null;
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div key={String(index)} className="bg-white col-span-12 p-3xl sm:border-green sm:border">
|
|
39
|
+
<div className="sm:flex sm:justify-between">
|
|
40
|
+
<div>
|
|
41
|
+
<Text size="text-h4">{name}</Text>
|
|
42
|
+
{address ? (
|
|
43
|
+
<div className="flex pb-xl pt-xs gap-2xs">
|
|
44
|
+
<Icon name="GeolocationIcon" width="24" height="24" />
|
|
45
|
+
<Text size="text-l">{address}</Text>
|
|
46
|
+
</div>
|
|
47
|
+
) : null}
|
|
48
|
+
</div>
|
|
49
|
+
{renderCurrentDaySchedule(workScheduleWeek)}
|
|
50
|
+
</div>
|
|
51
|
+
<div className="hidden sm:block">
|
|
52
|
+
{renderCardContent({
|
|
53
|
+
phone,
|
|
54
|
+
fax,
|
|
55
|
+
phoneBusiness,
|
|
56
|
+
phoneNatural,
|
|
57
|
+
phoneCallCentre,
|
|
58
|
+
phoneCurrencyControl,
|
|
59
|
+
workSchedule,
|
|
60
|
+
exchangeRate,
|
|
61
|
+
})}
|
|
62
|
+
</div>
|
|
63
|
+
<Foldable
|
|
64
|
+
className="block sm:hidden"
|
|
65
|
+
renderFoldableSection={({ isUnfolded }) => {
|
|
66
|
+
return (
|
|
67
|
+
<FoldableSection isUnfolded={isUnfolded}>
|
|
68
|
+
{renderCardContent({
|
|
69
|
+
phone,
|
|
70
|
+
fax,
|
|
71
|
+
phoneBusiness,
|
|
72
|
+
phoneNatural,
|
|
73
|
+
phoneCallCentre,
|
|
74
|
+
phoneCurrencyControl,
|
|
75
|
+
workSchedule,
|
|
76
|
+
exchangeRate,
|
|
77
|
+
})}
|
|
78
|
+
</FoldableSection>
|
|
79
|
+
);
|
|
80
|
+
}}
|
|
81
|
+
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
82
|
+
renderFoldButton={({ isUnfolded, onToggle }) => renderFoldButton({ isUnfolded, onToggle })}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const renderCardContent = ({
|
|
89
|
+
phone,
|
|
90
|
+
fax,
|
|
91
|
+
phoneBusiness,
|
|
92
|
+
phoneNatural,
|
|
93
|
+
phoneCallCentre,
|
|
94
|
+
phoneCurrencyControl,
|
|
95
|
+
workSchedule,
|
|
96
|
+
exchangeRate,
|
|
97
|
+
}: Branch) => {
|
|
32
98
|
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
33
99
|
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
34
100
|
? 'Для физических лиц'
|
|
35
101
|
: 'Для физических и юридических лиц';
|
|
36
102
|
|
|
37
103
|
return (
|
|
38
|
-
<div
|
|
39
|
-
<div className="flex justify-between">
|
|
40
|
-
<Text size="text-h4">{name}</Text>
|
|
41
|
-
{renderCurrentDaySchedule(workScheduleWeek)}
|
|
42
|
-
</div>
|
|
43
|
-
{address ? (
|
|
44
|
-
<div className="flex pb-xl pt-xs gap-2xs">
|
|
45
|
-
<Icon name="GeolocationIcon" width="24" height="24" />
|
|
46
|
-
<Text size="text-l">{address}</Text>
|
|
47
|
-
</div>
|
|
48
|
-
) : null}
|
|
104
|
+
<div>
|
|
49
105
|
<CardRow className="flex-wrap">
|
|
50
106
|
<CardCell label="Факс" value={fax} />
|
|
51
107
|
<CardCell label="Телефон филиала" value={phone} />
|
|
@@ -54,7 +110,7 @@ export const renderOfficeCard = (
|
|
|
54
110
|
<CardCell label="Для консультаций по валютному контролю" value={phoneCurrencyControl} />
|
|
55
111
|
<CardCell label="Контакт-центр" value={phoneCallCentre} />
|
|
56
112
|
</CardRow>
|
|
57
|
-
{workSchedule
|
|
113
|
+
{workSchedule?.isMatchesPattern ? (
|
|
58
114
|
<CardRow>
|
|
59
115
|
<CardCell label={labelSchedule} labelSize="text-l" className="w-full max-w-none">
|
|
60
116
|
<div className="flex flex-wrap gap-xs sm:justify-between pt-xs">
|
|
@@ -79,55 +135,3 @@ export const renderOfficeCard = (
|
|
|
79
135
|
</div>
|
|
80
136
|
);
|
|
81
137
|
};
|
|
82
|
-
|
|
83
|
-
export const renderCurrency = (
|
|
84
|
-
{ currency, buyExchangeRate, saleExchangeRate }: Currency,
|
|
85
|
-
i: number,
|
|
86
|
-
) => (
|
|
87
|
-
<div key={String(i)} className="flex gap-lg h-full">
|
|
88
|
-
{currency?.currency ? <CardCell label="Валюта" value={currency.currency} /> : null}
|
|
89
|
-
{buyExchangeRate ? <CardCell label="Купить" value={String(buyExchangeRate)} /> : null}
|
|
90
|
-
{saleExchangeRate ? <CardCell label="Продать" value={String(saleExchangeRate)} /> : null}
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
95
|
-
export const renderCurrentDaySchedule = (workScheduleWeek?: WorkScheduleWeek[]) => {
|
|
96
|
-
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
97
|
-
|
|
98
|
-
if (!currentWeekDay) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
103
|
-
|
|
104
|
-
return status ? (
|
|
105
|
-
<div className="flex gap-s items-start whitespace-nowrap">
|
|
106
|
-
{workTime ? <Badge color="green">{workTime}</Badge> : null}
|
|
107
|
-
{lunchHour && hasLunch ? <Badge color="yellow">{`перерыв: ${lunchHour}`}</Badge> : null}
|
|
108
|
-
</div>
|
|
109
|
-
) : (
|
|
110
|
-
<Badge color="red">Выходной</Badge>
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const renderDay = (
|
|
115
|
-
{ title, status, workTime, lunchHour, hasLunch }: WorkScheduleWeek,
|
|
116
|
-
index: number,
|
|
117
|
-
) => (
|
|
118
|
-
<CardCell
|
|
119
|
-
key={String(index)}
|
|
120
|
-
label={title}
|
|
121
|
-
value={status && workTime ? workTime : ''}
|
|
122
|
-
subText={getSubTextLunch(lunchHour, hasLunch, status)}
|
|
123
|
-
subColor={!status || hasLunch ? 'text-error' : 'text-green-dark'}
|
|
124
|
-
/>
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
const getSubTextLunch = (lunchHour?: string, hasLunch = false, status = false) => {
|
|
128
|
-
if (!status) {
|
|
129
|
-
return 'Не работает';
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
133
|
-
};
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export interface LinkDocItemProps extends LinkDoc {
|
|
|
9
9
|
|
|
10
10
|
export const LinkDocItem = JSX<LinkDocItemProps>(
|
|
11
11
|
({ icon, text, href, target, fileFormat, fileSize }) => {
|
|
12
|
-
const prefix =
|
|
12
|
+
const prefix = fileSize && fileFormat ? ',' : '';
|
|
13
13
|
const size = fileSize ?? '';
|
|
14
14
|
const format = fileFormat ? String(fileFormat) : '';
|
|
15
15
|
|
|
@@ -23,11 +23,13 @@ export const LinkDocItem = JSX<LinkDocItemProps>(
|
|
|
23
23
|
{icon}
|
|
24
24
|
{text ? (
|
|
25
25
|
<Text size="text-l" font="font-light">
|
|
26
|
-
{text}
|
|
27
|
-
<Text color="text-secondary-text">{href && `${size
|
|
26
|
+
{text} {addSpace(size, format)}
|
|
27
|
+
<Text color="text-secondary-text">{href && `${size + prefix + format}`}</Text>
|
|
28
28
|
</Text>
|
|
29
29
|
) : null}
|
|
30
30
|
</a>
|
|
31
31
|
);
|
|
32
32
|
},
|
|
33
33
|
);
|
|
34
|
+
|
|
35
|
+
const addSpace = (size: string, format: string) => (size || format ? <span>, </span> : '');
|
|
@@ -74,7 +74,8 @@ const renderLinkDocItem =
|
|
|
74
74
|
? formatBytes(docBlockDef?.attachment?.fileSize || 0)
|
|
75
75
|
: docBlockDef?.fileSize;
|
|
76
76
|
|
|
77
|
-
const fileFormat =
|
|
77
|
+
const fileFormat =
|
|
78
|
+
docBlockDef?.docType === 'Attachment' ? getExtFromHref(href) : docBlockDef?.fileFormat;
|
|
78
79
|
|
|
79
80
|
return (
|
|
80
81
|
<div key={String(i)} role="listitem">
|
|
@@ -89,3 +90,13 @@ const renderLinkDocItem =
|
|
|
89
90
|
</div>
|
|
90
91
|
);
|
|
91
92
|
};
|
|
93
|
+
|
|
94
|
+
const getExtFromHref = (href?: string) => {
|
|
95
|
+
if (!href) {
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const index = href.lastIndexOf('.');
|
|
100
|
+
|
|
101
|
+
return index !== -1 ? href.substring(index + 1) : '';
|
|
102
|
+
};
|
|
@@ -18,7 +18,7 @@ export interface BadgeProps {
|
|
|
18
18
|
export const Badge = JSX<BadgeProps>(({ className, children, color = 'gray' }) => (
|
|
19
19
|
<div
|
|
20
20
|
className={style(
|
|
21
|
-
'p-s border border-gray rounded-md flex items-center',
|
|
21
|
+
'p-s sm:border sm:border-gray rounded-md flex items-center',
|
|
22
22
|
colorStyle[color].border,
|
|
23
23
|
className,
|
|
24
24
|
)}
|
|
@@ -8,7 +8,7 @@ export interface CardRowProps {
|
|
|
8
8
|
export const CardRow = JSX<CardRowProps>(({ className, children }) => (
|
|
9
9
|
<div
|
|
10
10
|
className={style(
|
|
11
|
-
'flex border-t border-solid border-main-divider py-xl gap-x-6xl gap-y-xl',
|
|
11
|
+
'sm:flex sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl',
|
|
12
12
|
className,
|
|
13
13
|
)}
|
|
14
14
|
>
|