pcm-shared-components 2.0.14 → 2.0.16
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/app/config/reservation_state.js +89 -0
- package/dist/app/config/yes_no_status.js +72 -0
- package/dist/app/tools/date_formatter.js +141 -0
- package/dist/app/tools/date_overlap.js +177 -0
- package/dist/app/tools/seasonal_dates.js +229 -0
- package/dist/components/Buttons/CustomFab/index.js +0 -27
- package/dist/components/Buttons/DropdownButton/index.js +3 -11
- package/dist/components/Buttons/HelpButton/index.js +1 -6
- package/dist/components/Buttons/ProductItemButton/index.js +8 -22
- package/dist/components/Buttons/TillButton/index.js +3 -10
- package/dist/components/Date/DateRangeCalendar/index.js +1 -21
- package/dist/components/Dialogs/GenericAppBar/components/GenericAppBarSubMenu.js +4 -7
- package/dist/components/Dialogs/GenericAppBar/index.js +24 -22
- package/dist/components/Dialogs/GenericDialogWindow/index.js +20 -34
- package/dist/components/Drawing/CanvasPaint/index.js +12 -37
- package/dist/components/Drawing/ImageCanvasDraw/components/Controls.js +13 -10
- package/dist/components/Drawing/ImageCanvasDraw/index.js +11 -18
- package/dist/components/Drawing/ImageCanvasDraw/service/image_tools.js +6 -6
- package/dist/components/Images/ImageStack/index.js +0 -5
- package/dist/components/Labels/SimpleLabel/index.js +1 -7
- package/dist/components/Layout/SimpleTab/components/TabPanel.js +2 -3
- package/dist/components/Layout/SimpleTab/index.js +8 -15
- package/dist/components/Layout/TwoColumnDisplay/index.js +0 -2
- package/dist/components/Links/HrefLink/index.js +1 -5
- package/dist/components/Loaders/LoadingBackdrop/index.js +4 -4
- package/dist/components/Loaders/WaitingGalaxy/index.js +1 -2
- package/dist/components/Menus/ReusablePopupMenu/components/GenericSubMenu.js +2 -7
- package/dist/components/Menus/ReusablePopupMenu/components/ReusableMenu.js +6 -7
- package/dist/components/Menus/ReusablePopupMenu/index.js +7 -10
- package/dist/components/NEW_COMPONENT/index.js +1 -2
- package/dist/components/NEW_COMPONENT/storybook/index.stories.js +0 -2
- package/dist/components/PcSharedComponentThemeInheritor/index.js +1 -1
- package/dist/components/Platform/PlatformPaymentPlans/components/PriceToggleButton/index.js +0 -2
- package/dist/components/Platform/PlatformPaymentPlans/index.js +12 -27
- package/dist/components/Platform/PlatformPlanPrices/index.js +3 -10
- package/dist/components/Platform/PlatformPlanTitles/index.js +0 -6
- package/dist/components/Sandbox/ScrollingInnerDiv/index.js +2 -5
- package/dist/components/TextBoxes/CurrencyTextInput/index.js +7 -42
- package/dist/components/TextBoxes/SearchBar/index.js +10 -14
- package/dist/components/Timelines/ReservationTimelineComponent/components/SearchLotsTextBox.js +34 -0
- package/dist/components/Timelines/ReservationTimelineComponent/components/TimelinePopUp.js +11 -0
- package/dist/components/Timelines/ReservationTimelineComponent/css/header.css +98 -0
- package/dist/components/Timelines/ReservationTimelineComponent/css/styles.css +121 -0
- package/dist/components/Timelines/ReservationTimelineComponent/css/styles.old +209 -0
- package/dist/components/Timelines/ReservationTimelineComponent/index.js +965 -0
- package/dist/components/Tools/CodeHighlight/index.js +17 -21
- package/dist/components/Tools/PCMScrollbar/index.js +3 -5
- package/dist/components/Tools/isValidFunction.js +0 -1
- package/dist/index.js +3 -1
- package/dist/languages/en/translations.json +1 -1
- package/dist/languages/es/translations.json +1 -1
- package/dist/languages/fr/translations.json +1 -1
- package/dist/locals/coreLocals.js +0 -8
- package/dist/locals/currencySymbol.js +0 -3
- package/dist/locals/i18n.js +11 -5
- package/dist/locals/translationResources.js +2 -1
- package/dist/styles/tailwind.css +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
export const weeks = {
|
|
3
|
+
first: 0,
|
|
4
|
+
second: 1,
|
|
5
|
+
third: 2,
|
|
6
|
+
fourth: 3,
|
|
7
|
+
last: 4
|
|
8
|
+
};
|
|
9
|
+
export const weekdays = {
|
|
10
|
+
sunday: 0,
|
|
11
|
+
monday: 1,
|
|
12
|
+
tuesday: 2,
|
|
13
|
+
wednesday: 3,
|
|
14
|
+
thursday: 4,
|
|
15
|
+
friday: 5,
|
|
16
|
+
saturday: 6
|
|
17
|
+
};
|
|
18
|
+
export const months = {
|
|
19
|
+
january: 0,
|
|
20
|
+
february: 1,
|
|
21
|
+
march: 2,
|
|
22
|
+
april: 3,
|
|
23
|
+
may: 4,
|
|
24
|
+
june: 5,
|
|
25
|
+
july: 6,
|
|
26
|
+
august: 7,
|
|
27
|
+
september: 8,
|
|
28
|
+
october: 9,
|
|
29
|
+
november: 10,
|
|
30
|
+
december: 11
|
|
31
|
+
};
|
|
32
|
+
export const getSeasonalStartDate = (year, seasonal_object) => {
|
|
33
|
+
seasonal_object = getWorkingSeasonalObject(year, seasonal_object);
|
|
34
|
+
if (Number(seasonal_object.use_fix_start_date) === 1) {
|
|
35
|
+
//use the date defined
|
|
36
|
+
// const test = moment([ year, months[returnLiteralString(months, seasonal_object.fix_dates.start.month)], seasonal_object.fix_dates.start.day ]).set({ hour: seasonal_object.arrival_hour, minute: seasonal_object.arrival_minute });
|
|
37
|
+
// console.log('debug Start Date Fixed ', test)
|
|
38
|
+
return moment([year, months[returnLiteralString(months, seasonal_object.fix_dates.start.month)], seasonal_object.fix_dates.start.day]).set({
|
|
39
|
+
hour: seasonal_object.arrival_hour,
|
|
40
|
+
minute: seasonal_object.arrival_minute
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
//need to find the date base on the literal date
|
|
44
|
+
// const test = getVariableDate(year, months[returnLiteralString(months, seasonal_object.variable_dates.start.month)], weeks[returnLiteralString(weeks, seasonal_object.variable_dates.start.week)], weekdays[returnLiteralString(weekdays, seasonal_object.variable_dates.start.weekday)]).set({ hour: seasonal_object.arrival_hour, minute: seasonal_object.arrival_minute });
|
|
45
|
+
// console.log('debug Start Variable Date ', test)
|
|
46
|
+
return getVariableDate(year, months[returnLiteralString(months, seasonal_object.variable_dates.start.month)], weeks[returnLiteralString(weeks, seasonal_object.variable_dates.start.week)], weekdays[returnLiteralString(weekdays, seasonal_object.variable_dates.start.weekday)]).set({
|
|
47
|
+
hour: seasonal_object.arrival_hour,
|
|
48
|
+
minute: seasonal_object.arrival_minute
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export const getSeasonalEndDate = (year, seasonal_object) => {
|
|
53
|
+
seasonal_object = getWorkingSeasonalObject(year, seasonal_object);
|
|
54
|
+
const end_year = getSeasonalEndDateYear(year, seasonal_object);
|
|
55
|
+
if (Number(seasonal_object.use_fix_end_date) === 1) {
|
|
56
|
+
//use the date defined
|
|
57
|
+
return moment([end_year, months[returnLiteralString(months, seasonal_object.fix_dates.end.month)], seasonal_object.fix_dates.end.day]).set({
|
|
58
|
+
hour: seasonal_object.departure_hour,
|
|
59
|
+
minute: seasonal_object.departure_minute
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
//need to find the date base on the literal date
|
|
63
|
+
return getVariableDate(end_year, months[returnLiteralString(months, seasonal_object.variable_dates.end.month)], weeks[returnLiteralString(weeks, seasonal_object.variable_dates.end.week)], weekdays[returnLiteralString(weekdays, seasonal_object.variable_dates.end.weekday)]).set({
|
|
64
|
+
hour: seasonal_object.departure_hour,
|
|
65
|
+
minute: seasonal_object.departure_minute
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const getSeasonalEndDateYear = (year, seasonal_object) => {
|
|
70
|
+
//This is used to make sure that we don't reuse the current year for the end date when our end month is > than the starting month.
|
|
71
|
+
// Meaning: Start month is December and End month is April. Because the start and end date are stored inside the same year object I need to increase the end year when this happens
|
|
72
|
+
/*
|
|
73
|
+
2020----------Dec=11-----------------April=3---------------------
|
|
74
|
+
^ start date ^ end date
|
|
75
|
+
|
|
76
|
+
So the above seasonal object would return and end date before the start date making the selection invalid because what we need is
|
|
77
|
+
- Start date Dec 2020
|
|
78
|
+
- End date April 2021
|
|
79
|
+
Returns the end date year to be used example: 2021 in the example above
|
|
80
|
+
*/
|
|
81
|
+
let start_month,
|
|
82
|
+
end_month,
|
|
83
|
+
start_day,
|
|
84
|
+
end_day,
|
|
85
|
+
has_variable_date = false;
|
|
86
|
+
|
|
87
|
+
// Get the starting and ending month and day index value
|
|
88
|
+
if (Number(seasonal_object.use_fix_start_date) === 1) {
|
|
89
|
+
start_month = returnIndexPosition(months, seasonal_object.fix_dates.start.month);
|
|
90
|
+
start_day = returnIndexPosition(weekdays, seasonal_object.fix_dates.start.day);
|
|
91
|
+
} else {
|
|
92
|
+
has_variable_date = true;
|
|
93
|
+
start_month = returnIndexPosition(months, seasonal_object.variable_dates.start.month);
|
|
94
|
+
start_day = returnIndexPosition(weekdays, seasonal_object.variable_dates.start.weekday);
|
|
95
|
+
}
|
|
96
|
+
if (Number(seasonal_object.use_fix_end_date) === 1) {
|
|
97
|
+
end_month = returnIndexPosition(months, seasonal_object.fix_dates.end.month);
|
|
98
|
+
end_day = returnIndexPosition(weekdays, seasonal_object.fix_dates.end.day);
|
|
99
|
+
} else {
|
|
100
|
+
has_variable_date = true;
|
|
101
|
+
end_month = returnIndexPosition(months, seasonal_object.variable_dates.end.month);
|
|
102
|
+
end_day = returnIndexPosition(weekdays, seasonal_object.variable_dates.end.weekday);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Now check to see if we need to increase our year by one
|
|
106
|
+
if (Number(end_month) < Number(start_month)) {
|
|
107
|
+
// Ending month is smaller than starting month we are automatically in a new year
|
|
108
|
+
year = Number(year) + 1;
|
|
109
|
+
} else if (Number(end_month) === Number(start_month) && has_variable_date) {
|
|
110
|
+
// Same month and we have a variable date for one or both dates.
|
|
111
|
+
// Automatically the ending year should be increased
|
|
112
|
+
year = Number(year) + 1;
|
|
113
|
+
} else if (Number(end_month) === Number(start_month) && Number(end_day) <= Number(start_day)) {
|
|
114
|
+
// Ending month is the same as the starting month and we have the same or smaller day.
|
|
115
|
+
// 2020----------Dec 2st-----------------Dec 2nd--------------------- We want a full year date to date
|
|
116
|
+
// 2020----------Dec 2st-----------------Dec 1nd--------------------- We want a full year minus one day
|
|
117
|
+
year = Number(year) + 1;
|
|
118
|
+
}
|
|
119
|
+
return year;
|
|
120
|
+
};
|
|
121
|
+
const getVariableDate = (year, month, week_number, week_day) => {
|
|
122
|
+
let loop_end = true;
|
|
123
|
+
let week_number_i = week_number;
|
|
124
|
+
//let leep_week = 0; //used to compensate for the start of the previous months when week 0 = previous month
|
|
125
|
+
// Check if we are not in the current month based on the week number and adjust accordingly
|
|
126
|
+
while (loop_end) {
|
|
127
|
+
let new_month = moment([year, month]).day(week_day + week_number_i * 7).month();
|
|
128
|
+
if (new_month === 11 && month === 0) {
|
|
129
|
+
//This is the cross over from January to December, need to bring it back to January
|
|
130
|
+
week_number_i++;
|
|
131
|
+
} else if (new_month === 0 && month === 11) {
|
|
132
|
+
//This is the cross over from December to January, need to bring it back to December
|
|
133
|
+
week_number_i--;
|
|
134
|
+
} else if (new_month < month) {
|
|
135
|
+
week_number_i++;
|
|
136
|
+
} else if (new_month > month) {
|
|
137
|
+
week_number_i--;
|
|
138
|
+
} else {
|
|
139
|
+
loop_end = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//condition to ensure we are not in the previous month
|
|
143
|
+
let condition1 = moment([year, month]).day(week_day + week_number_i * 7 - 7 * week_number_i).month() !== month;
|
|
144
|
+
|
|
145
|
+
//condition to ensure we are still in the specified month
|
|
146
|
+
let condition2 = week_number > 0 && (week_number < 5 && moment([year, month]).day(week_day + (week_number_i + 1) * 7).month()) === month;
|
|
147
|
+
if (condition1 && condition2) {
|
|
148
|
+
// if (moment([ year, month ]).day(week_day + week_number_i * 7 - 7 * week_number_i).month() !== month && (week_number > 0 && week_number < 5)) {
|
|
149
|
+
week_number_i++;
|
|
150
|
+
}
|
|
151
|
+
return moment([year, month]).day(week_day + week_number_i * 7);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
//Makes it possible to store 'may' or 4 in the database and still return the proper month,week etc...
|
|
155
|
+
export const returnLiteralString = (object, item) => {
|
|
156
|
+
//verify if object/month,weekdays etc is a string or int, so that i can support both example 'may' or 4=may
|
|
157
|
+
//get the literal string for the object/month,weekdays etc based on the zero based object/month,weekdays etc position 0=jan, 1=feb etc..
|
|
158
|
+
try {
|
|
159
|
+
if (parseInt(item, 10) || item === 0) {
|
|
160
|
+
item = Object.keys(object).find((m, idx) => idx === item);
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error(error);
|
|
164
|
+
}
|
|
165
|
+
return item;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
//Makes it possible to store 'may' or 4 in the database and still return the proper month,week index value etc...
|
|
169
|
+
export const returnIndexPosition = (object, item) => {
|
|
170
|
+
//verify if object/month,weekdays etc is a string or int, so that i can support both example 'may' or 4=may
|
|
171
|
+
//get the index position for the object/month,weekdays etc based on the zero based object/month,weekdays etc position 0=jan, 1=feb etc..
|
|
172
|
+
try {
|
|
173
|
+
if (parseInt(item, 10) || item === 0) {
|
|
174
|
+
//nothing to convert we already have the number index
|
|
175
|
+
} else {
|
|
176
|
+
//get the index position of the string literal
|
|
177
|
+
item = object[item];
|
|
178
|
+
// item = Object.keys(object).find((m, idx) => m === item);
|
|
179
|
+
}
|
|
180
|
+
} catch (error) {
|
|
181
|
+
console.error(error);
|
|
182
|
+
}
|
|
183
|
+
return item;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Returns the seasonal date object to use based on the year provided
|
|
188
|
+
*/
|
|
189
|
+
const getWorkingSeasonalObject = (year, seasonal_object) => {
|
|
190
|
+
//get the date object based on the requested year
|
|
191
|
+
let seasonal_object_working = seasonal_object.find(so => Number(so.seasonal_year) === Number(year));
|
|
192
|
+
|
|
193
|
+
//If no results returned then get the default date object and use it's parameters
|
|
194
|
+
if (!seasonal_object_working) {
|
|
195
|
+
seasonal_object_working = seasonal_object.find(so => Number(so.is_default) === 1);
|
|
196
|
+
}
|
|
197
|
+
return seasonal_object_working;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Returns the week in a nice sorted array example [first,second....] so the index position relates to the week etc...
|
|
202
|
+
* Returns the months in a nice sorted array example [january,february....] so the index position relates to the month etc...
|
|
203
|
+
* Returns the weekdays in a nice sorted array example [monday,tuesday....] so the index position relates to the weekdays etc...
|
|
204
|
+
*
|
|
205
|
+
* @returns
|
|
206
|
+
*/
|
|
207
|
+
export const sortedArray = array_months_weekdays_weekdays => {
|
|
208
|
+
let new_object = [];
|
|
209
|
+
let sorted = Object.keys(array_months_weekdays_weekdays).sort(function (a, b) {
|
|
210
|
+
return a.value - b.value;
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// eslint-disable-next-line no-unused-vars
|
|
214
|
+
for (const [key, value] of Object.entries(sorted)) {
|
|
215
|
+
// console.log(`${key}: ${value}`);
|
|
216
|
+
new_object = [...new_object, value];
|
|
217
|
+
}
|
|
218
|
+
return new_object;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// Month here is 1-indexed (January is 1, February is 2, etc). This is
|
|
222
|
+
// because we're using 0 as the day so that it returns the last day
|
|
223
|
+
// of the last month, so you have to add 1 to the month number
|
|
224
|
+
// so it returns the correct amount of days
|
|
225
|
+
//!Converting months to base zero (+1) the month since i'm used to using base zero
|
|
226
|
+
export const daysInMonth = (year, month) => {
|
|
227
|
+
// console.log('123 month: ', month, ' days: ', Number(new Date(year, month+1, 0).getDate())+1, ' date: ',new Date(year, month+1, 0))
|
|
228
|
+
return Number(new Date(year, month + 1, 0).getDate()) + 1;
|
|
229
|
+
};
|
|
@@ -7,45 +7,34 @@ import clsx from 'clsx';
|
|
|
7
7
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
8
8
|
import { ThemeProvider } from '@mui/system';
|
|
9
9
|
import { createTheme, useTheme } from '@mui/material/styles';
|
|
10
|
-
|
|
11
10
|
const getSize = size => {
|
|
12
11
|
switch (size) {
|
|
13
12
|
case 'x-small':
|
|
14
13
|
return 28;
|
|
15
|
-
|
|
16
14
|
case 'small':
|
|
17
15
|
return 40;
|
|
18
|
-
|
|
19
16
|
case 'medium':
|
|
20
17
|
return 48;
|
|
21
|
-
|
|
22
18
|
case 'large':
|
|
23
19
|
return 56;
|
|
24
|
-
|
|
25
20
|
default:
|
|
26
21
|
return 56;
|
|
27
22
|
}
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
const getPadding = size => {
|
|
31
25
|
switch (size) {
|
|
32
26
|
case 'x-small':
|
|
33
27
|
return '0px 8px 0px 8px';
|
|
34
|
-
|
|
35
28
|
case 'small':
|
|
36
29
|
return '0px 16px 0px 16px';
|
|
37
|
-
|
|
38
30
|
case 'medium':
|
|
39
31
|
return '0px 16px 0px 16px';
|
|
40
|
-
|
|
41
32
|
case 'large':
|
|
42
33
|
return '0px 16px 0px 16px';
|
|
43
|
-
|
|
44
34
|
default:
|
|
45
35
|
return '0px 16px 0px 16px';
|
|
46
36
|
}
|
|
47
37
|
};
|
|
48
|
-
|
|
49
38
|
const useStyles = makeStyles(() => ({
|
|
50
39
|
rootFabElement: {
|
|
51
40
|
margin: 2,
|
|
@@ -173,54 +162,38 @@ CustomFab.defaultProps = {
|
|
|
173
162
|
CustomFab.propTypes = {
|
|
174
163
|
/** onClick function passed to the button */
|
|
175
164
|
onClick: PropTypes.object,
|
|
176
|
-
|
|
177
165
|
/** Icon to be used in the button */
|
|
178
166
|
Icon: PropTypes.element,
|
|
179
|
-
|
|
180
167
|
/** Controls the size of the icon in pixels */
|
|
181
168
|
iconSize: PropTypes.number,
|
|
182
|
-
|
|
183
169
|
/** Controls the border radius of the button's rounded ends */
|
|
184
170
|
borderRadius: PropTypes.number,
|
|
185
|
-
|
|
186
171
|
/** Text inside of the button */
|
|
187
172
|
buttonText: PropTypes.string,
|
|
188
173
|
//** Font size of the button text */
|
|
189
174
|
buttonFontSize: PropTypes.number,
|
|
190
|
-
|
|
191
175
|
/** Either [circular or extended] if including text */
|
|
192
176
|
variant: PropTypes.oneOf(['extended', 'circular']),
|
|
193
|
-
|
|
194
177
|
/** Either [left or right] controls the location of the icon*/
|
|
195
178
|
iconLocation: PropTypes.oneOf(['left', 'right']),
|
|
196
|
-
|
|
197
179
|
/** The text to display in the tooltip */
|
|
198
180
|
tooltipText: PropTypes.string,
|
|
199
|
-
|
|
200
181
|
/** Display the drop shadow or not [none or undefined] */
|
|
201
182
|
boxShadow: PropTypes.bool,
|
|
202
|
-
|
|
203
183
|
/** Background color */
|
|
204
184
|
backgroundColor: PropTypes.string,
|
|
205
|
-
|
|
206
185
|
/** On hover background color. */
|
|
207
186
|
hoverBackgroundColor: PropTypes.string,
|
|
208
|
-
|
|
209
187
|
/** Font color */
|
|
210
188
|
textColor: PropTypes.string,
|
|
211
|
-
|
|
212
189
|
/** The color of the text and icon on hover */
|
|
213
190
|
hoverTextColor: PropTypes.string,
|
|
214
|
-
|
|
215
191
|
/** Size of the FAB icon ['small','medium','large'] */
|
|
216
192
|
size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
|
|
217
|
-
|
|
218
193
|
/** Classes to override */
|
|
219
194
|
className: PropTypes.string,
|
|
220
|
-
|
|
221
195
|
/** Theme colors if not using backgroundColor ['primary','secondary'] */
|
|
222
196
|
color: PropTypes.oneOf(['primary', 'secondary']),
|
|
223
|
-
|
|
224
197
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
225
198
|
theme: PropTypes.object
|
|
226
199
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
2
|
import React, { memo } from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
6
5
|
import { ThemeProvider } from '@mui/system';
|
|
7
|
-
import { createTheme, useTheme } from '@mui/material/styles';
|
|
8
|
-
|
|
6
|
+
import { createTheme, useTheme } from '@mui/material/styles';
|
|
7
|
+
// import { CustomFab } from '../CustomFab';
|
|
9
8
|
import { ReusablePopupMenu } from '../../Menus/ReusablePopupMenu';
|
|
10
9
|
import Button from '@mui/material/Button';
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Creates a generic button with a drop down.
|
|
13
13
|
* Uses:
|
|
@@ -22,7 +22,6 @@ import Button from '@mui/material/Button';
|
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
25
|
export const DropdownButton = props => {
|
|
27
26
|
const {
|
|
28
27
|
name,
|
|
@@ -63,25 +62,18 @@ DropdownButton.defaultProps = {
|
|
|
63
62
|
DropdownButton.propTypes = {
|
|
64
63
|
/** Name of the till being used. Note: if till name exist then inUse is true */
|
|
65
64
|
name: PropTypes.string,
|
|
66
|
-
|
|
67
65
|
/** Classes applied to the button */
|
|
68
66
|
className: PropTypes.string,
|
|
69
|
-
|
|
70
67
|
/** Type of button to use*/
|
|
71
68
|
variant: PropTypes.oneOf(['text', 'contained', 'outlined']),
|
|
72
|
-
|
|
73
69
|
/** Color of the button*/
|
|
74
70
|
color: PropTypes.oneOf(['primary', 'secondary']),
|
|
75
|
-
|
|
76
71
|
/** Menu items for the dropdown, see the ReusablePopupMenu component for a better understanding of the props parameters */
|
|
77
72
|
menuData: PropTypes.array,
|
|
78
|
-
|
|
79
73
|
/** Supported size of the button ['x-small', 'small','medium'] */
|
|
80
74
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
81
|
-
|
|
82
75
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
83
76
|
theme: PropTypes.object,
|
|
84
|
-
|
|
85
77
|
/** Controls the location of the dropdown popup menu */
|
|
86
78
|
menuAnchorLocation: PropTypes.oneOf(['left', 'center', 'right'])
|
|
87
79
|
};
|
|
@@ -45,22 +45,17 @@ HelpButton.defaultProps = {
|
|
|
45
45
|
HelpButton.propTypes = {
|
|
46
46
|
/** On click link, it's the URL to navigate too */
|
|
47
47
|
onClickLink: PropTypes.string.isRequired,
|
|
48
|
-
|
|
49
48
|
/** className override */
|
|
50
49
|
className: PropTypes.string,
|
|
51
|
-
|
|
52
50
|
/** Theme color primary or secondary */
|
|
53
51
|
color: PropTypes.oneOf(['primary', 'secondary']),
|
|
54
|
-
|
|
55
52
|
/** Just a tooltip text */
|
|
56
53
|
tooltipText: PropTypes.string,
|
|
57
|
-
|
|
58
54
|
/** The size of the Icon in pixel*/
|
|
59
55
|
iconSize: PropTypes.number,
|
|
60
|
-
|
|
61
56
|
/** The size of the button ['small','medium','large'] */
|
|
62
57
|
size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
|
|
63
|
-
|
|
64
58
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
59
|
+
|
|
65
60
|
theme: PropTypes.object
|
|
66
61
|
};
|
|
@@ -3,12 +3,12 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { ThemeProvider } from '@mui/system';
|
|
4
4
|
import { createTheme, useTheme } from '@mui/material/styles';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import Button from '@mui/material/Button';
|
|
7
|
-
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
// import { toFloat_2_decimal } from '../../../tools/string_formatter';
|
|
8
8
|
import IconButton from '@mui/material/IconButton';
|
|
9
|
-
import EditIcon from '@mui/icons-material/Edit';
|
|
9
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
10
|
+
// import { limitStringLength } from 'app/tools/string_formatter';
|
|
10
11
|
// import { RiBarcodeLine } from 'react-icons/ri';
|
|
11
|
-
|
|
12
12
|
import ImageStack from '../../Images/ImageStack';
|
|
13
13
|
import InfoIcon from '@mui/icons-material/Info';
|
|
14
14
|
import Tooltip from '@mui/material/Tooltip';
|
|
@@ -125,6 +125,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
125
125
|
fontSize: 10
|
|
126
126
|
}
|
|
127
127
|
}));
|
|
128
|
+
|
|
128
129
|
/**
|
|
129
130
|
* ## Importing the component in your project
|
|
130
131
|
*
|
|
@@ -135,7 +136,6 @@ const useStyles = makeStyles(theme => ({
|
|
|
135
136
|
```
|
|
136
137
|
*
|
|
137
138
|
*/
|
|
138
|
-
|
|
139
139
|
export const ProductItemButton = props => {
|
|
140
140
|
const {
|
|
141
141
|
productData,
|
|
@@ -160,7 +160,9 @@ export const ProductItemButton = props => {
|
|
|
160
160
|
hasFooterSection: FooterSection ? true : false
|
|
161
161
|
});
|
|
162
162
|
const compTheme = theme ? theme : useTheme();
|
|
163
|
-
const defaultTheme = createTheme(compTheme);
|
|
163
|
+
const defaultTheme = createTheme(compTheme);
|
|
164
|
+
|
|
165
|
+
//---------------------------------------------------
|
|
164
166
|
// Local Component
|
|
165
167
|
//---------------------------------------------------
|
|
166
168
|
|
|
@@ -172,7 +174,6 @@ export const ProductItemButton = props => {
|
|
|
172
174
|
fontSize: 14
|
|
173
175
|
}
|
|
174
176
|
}))(Tooltip);
|
|
175
|
-
|
|
176
177
|
const TierPricing = ({
|
|
177
178
|
price,
|
|
178
179
|
sub_title
|
|
@@ -192,7 +193,6 @@ export const ProductItemButton = props => {
|
|
|
192
193
|
className: clsx(classes.tierPriceSubtitle, '')
|
|
193
194
|
}, String(sub_title).substring(0, 2))))) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
194
195
|
};
|
|
195
|
-
|
|
196
196
|
const toFloat_2_decimal = value => {
|
|
197
197
|
try {
|
|
198
198
|
if (value) {
|
|
@@ -201,10 +201,8 @@ export const ProductItemButton = props => {
|
|
|
201
201
|
} catch (e) {
|
|
202
202
|
console.error(e.message);
|
|
203
203
|
}
|
|
204
|
-
|
|
205
204
|
return value;
|
|
206
205
|
};
|
|
207
|
-
|
|
208
206
|
const toFloat_0_decimal = value => {
|
|
209
207
|
try {
|
|
210
208
|
if (value) {
|
|
@@ -213,10 +211,8 @@ export const ProductItemButton = props => {
|
|
|
213
211
|
} catch (e) {
|
|
214
212
|
console.error(e.message);
|
|
215
213
|
}
|
|
216
|
-
|
|
217
214
|
return value;
|
|
218
215
|
};
|
|
219
|
-
|
|
220
216
|
return /*#__PURE__*/React.createElement("div", {
|
|
221
217
|
key: `product_list_items_${productData.product_id}`,
|
|
222
218
|
className: clsx(classes.productButtonWrapper, 'flex flex-row')
|
|
@@ -343,34 +339,24 @@ ProductItemButton.defaultProps = {
|
|
|
343
339
|
ProductItemButton.propTypes = {
|
|
344
340
|
/** Displays the edit button */
|
|
345
341
|
showEdit: PropTypes.bool,
|
|
346
|
-
|
|
347
342
|
/** Gutter around the button */
|
|
348
343
|
PRODUCT_BUTTON_GUTTER: PropTypes.number,
|
|
349
|
-
|
|
350
344
|
/** The hight of the button */
|
|
351
345
|
PRODUCT_BUTTON_HEIGHT: PropTypes.number,
|
|
352
|
-
|
|
353
346
|
/** Length of the small button when we are displaying a unit price */
|
|
354
347
|
PRODUCT_SMALL_BUTTON_WIDTH: PropTypes.number,
|
|
355
|
-
|
|
356
348
|
/** Product button width use to display a larger button however now it's by default the same length as the small button width */
|
|
357
349
|
PRODUCT_LARGE_BUTTON_WIDTH: PropTypes.number,
|
|
358
|
-
|
|
359
350
|
/** Any component to display on the footer of the button */
|
|
360
351
|
FooterSection: PropTypes.any,
|
|
361
|
-
|
|
362
352
|
/** The call back when the edit button is clicked. Returns the productData passed to the button when initialized */
|
|
363
353
|
onEditClick: PropTypes.any,
|
|
364
|
-
|
|
365
354
|
/** The onclick callback when the button is clicked. Returns the productData passed to the button when initialized */
|
|
366
355
|
onClick: PropTypes.any,
|
|
367
|
-
|
|
368
356
|
/** This is the product object */
|
|
369
357
|
productData: PropTypes.any,
|
|
370
|
-
|
|
371
358
|
/** The i18next needs to be passed in by the component or else they will be blank */
|
|
372
359
|
i18next: PropTypes.any,
|
|
373
|
-
|
|
374
360
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
375
361
|
theme: PropTypes.object
|
|
376
362
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
2
|
import React, { memo } from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
|
-
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
6
|
-
|
|
4
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
5
|
+
// import { ThemeProvider } from '@mui/system';
|
|
7
6
|
import { createTheme, useTheme } from '@mui/material/styles';
|
|
8
7
|
import { ReusablePopupMenu } from '../../Menus/ReusablePopupMenu';
|
|
9
8
|
import Button from '@mui/material/Button';
|
|
10
9
|
import i18next from 'i18next';
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Creates a till button from other PCM components to simplify the component.
|
|
13
13
|
* Uses:
|
|
@@ -25,7 +25,6 @@ import i18next from 'i18next';
|
|
|
25
25
|
```
|
|
26
26
|
*
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
28
|
export const TillButton = props => {
|
|
30
29
|
const {
|
|
31
30
|
inUse,
|
|
@@ -61,22 +60,16 @@ TillButton.defaultProps = {
|
|
|
61
60
|
TillButton.propTypes = {
|
|
62
61
|
/** Determines if a till is currently being used */
|
|
63
62
|
inUse: PropTypes.bool,
|
|
64
|
-
|
|
65
63
|
/** Name of the till being used. Note: if till name exist then inUse is true */
|
|
66
64
|
name: PropTypes.string,
|
|
67
|
-
|
|
68
65
|
/** Text used to identify the string in front of the till name. example: Till : Some name */
|
|
69
66
|
defaultText: PropTypes.string,
|
|
70
|
-
|
|
71
67
|
/** Menu items for the dropdown, see the ReusablePopupMenu component for a better understanding of the props parameters */
|
|
72
68
|
menuData: PropTypes.object,
|
|
73
|
-
|
|
74
69
|
/** Classes applied to the button */
|
|
75
70
|
className: PropTypes.string,
|
|
76
|
-
|
|
77
71
|
/** Supported size of the button ['x-small', 'small','medium'] */
|
|
78
72
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
79
|
-
|
|
80
73
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
81
74
|
theme: PropTypes.object
|
|
82
75
|
};
|
|
@@ -4,6 +4,7 @@ import { orange } from '@mui/material/colors';
|
|
|
4
4
|
import { DateRangeInput } from '@datepicker-react/styled';
|
|
5
5
|
import { ThemeProvider } from 'styled-components';
|
|
6
6
|
import './css/style.css';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* example with styling https://codesandbox.io/s/react-date-picker-rangeinput-jw726?from-embed=&file=/src/index.js:2503-2537
|
|
9
10
|
*
|
|
@@ -14,7 +15,6 @@ import './css/style.css';
|
|
|
14
15
|
```
|
|
15
16
|
*
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
18
|
export const DateRangeCalendar = props => {
|
|
19
19
|
const {
|
|
20
20
|
minBookingDate,
|
|
@@ -33,13 +33,11 @@ export const DateRangeCalendar = props => {
|
|
|
33
33
|
zIndex,
|
|
34
34
|
i18next
|
|
35
35
|
} = props;
|
|
36
|
-
|
|
37
36
|
const handleOnDayRender = date => {
|
|
38
37
|
return /*#__PURE__*/React.createElement(React.Fragment, null, onDayRender ? /*#__PURE__*/React.createElement(React.Fragment, null, onDayRender(date)) : /*#__PURE__*/React.createElement("span", {
|
|
39
38
|
className: ""
|
|
40
39
|
}, new Date(date).getDate()));
|
|
41
40
|
};
|
|
42
|
-
|
|
43
41
|
const handleIsDateBlocked = date => {
|
|
44
42
|
try {
|
|
45
43
|
if (typeof isDateBlocked === 'function') {
|
|
@@ -48,10 +46,8 @@ export const DateRangeCalendar = props => {
|
|
|
48
46
|
} catch (error) {
|
|
49
47
|
console.error(error);
|
|
50
48
|
}
|
|
51
|
-
|
|
52
49
|
return false;
|
|
53
50
|
};
|
|
54
|
-
|
|
55
51
|
const handleOnDatesChange = data => {
|
|
56
52
|
try {
|
|
57
53
|
if (typeof onDatesChange === 'function') {
|
|
@@ -61,7 +57,6 @@ export const DateRangeCalendar = props => {
|
|
|
61
57
|
console.error(error);
|
|
62
58
|
}
|
|
63
59
|
};
|
|
64
|
-
|
|
65
60
|
const handleOnFocusChange = data => {
|
|
66
61
|
try {
|
|
67
62
|
if (typeof onFocusChange === 'function') {
|
|
@@ -71,7 +66,6 @@ export const DateRangeCalendar = props => {
|
|
|
71
66
|
console.error(error);
|
|
72
67
|
}
|
|
73
68
|
};
|
|
74
|
-
|
|
75
69
|
return /*#__PURE__*/React.createElement("div", {
|
|
76
70
|
className: `m-auto pt-12 md:pt-0 ${variant === 'standard' ? 'bottom_border' : undefined}`,
|
|
77
71
|
style: {
|
|
@@ -152,46 +146,32 @@ DateRangeCalendar.defaultProps = {
|
|
|
152
146
|
DateRangeCalendar.propTypes = {
|
|
153
147
|
/** Used to provide the minimum booking date. To allow date selection past todays date simply pas it an old past date example 'new Date('1999-10-02')' */
|
|
154
148
|
minBookingDate: PropTypes.instanceOf(Date),
|
|
155
|
-
|
|
156
149
|
/** Number of calendar months to display.*/
|
|
157
150
|
numberOfMonthsVisible: PropTypes.number,
|
|
158
|
-
|
|
159
151
|
/** Date format to use when displaying the selected dates in the text boxes.*/
|
|
160
152
|
dateFormat: PropTypes.string,
|
|
161
|
-
|
|
162
153
|
/** Min booking days allowing the user to select a valid date range.*/
|
|
163
154
|
minBookingDays: PropTypes.number,
|
|
164
|
-
|
|
165
155
|
/** Provides a (date:date) props to the function and expects a React.ReactNode component to be returned */
|
|
166
156
|
onDayRender: PropTypes.func,
|
|
167
|
-
|
|
168
157
|
/** Provides a (date:date) props to the function and expects a boolean value returned which tells the calendar to either block or not that day*/
|
|
169
158
|
isDateBlocked: PropTypes.func,
|
|
170
|
-
|
|
171
159
|
/** Provides a (data) props to the function and doesn't expect any return value*/
|
|
172
160
|
onDatesChange: PropTypes.func,
|
|
173
|
-
|
|
174
161
|
/** Provides a instance of focusedInput ('START_DATE','END_DATE',null) prop to the function and doesn't expect any return value*/
|
|
175
162
|
onFocusChange: PropTypes.func,
|
|
176
|
-
|
|
177
163
|
/** The stat date of the calendar */
|
|
178
164
|
startDate: PropTypes.instanceOf(Date),
|
|
179
|
-
|
|
180
165
|
/** The end date of the calendar */
|
|
181
166
|
endDate: PropTypes.instanceOf(Date),
|
|
182
|
-
|
|
183
167
|
/** Determines on which input the calendar will be focused on. Null = nothing meaning the calendar should be closed if null*/
|
|
184
168
|
focusedInput: PropTypes.oneOf(['startDate', 'endDate', null]),
|
|
185
|
-
|
|
186
169
|
/** Controls the type of border to display around the date input boxes*/
|
|
187
170
|
variant: PropTypes.oneOf(['outlined', 'standard', 'none']),
|
|
188
|
-
|
|
189
171
|
/** Controls the orientation of the calendar */
|
|
190
172
|
vertical: PropTypes.bool,
|
|
191
|
-
|
|
192
173
|
/** Controls the z-index of the calendar dropdown date selection */
|
|
193
174
|
zIndex: PropTypes.number,
|
|
194
|
-
|
|
195
175
|
/** i18next localization to use for the component. Don't use the library localization or else it won't load properly on the consuming application */
|
|
196
176
|
i18next: PropTypes.any
|
|
197
177
|
};
|