@selfcommunity/react-ui 0.10.5-payments.204 → 0.10.5-payments.205

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.
@@ -123,12 +123,12 @@ function PaymentOrders(inProps) {
123
123
  /**
124
124
  * Initial Invoices fetch
125
125
  */
126
- const fetchInvoices = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
126
+ const fetchInvoices = (searchValue = query) => tslib_1.__awaiter(this, void 0, void 0, function* () {
127
127
  setIsLoading(true);
128
128
  setHasMore(true);
129
129
  setInvoices([]);
130
130
  try {
131
- const res = yield api_services_1.PaymentService.getPaymentsOrder(Object.assign(Object.assign(Object.assign(Object.assign({ offset: 0, ordering: '-created_at' }, (query && { search: query })), (contentTypeFilter && contentTypeFilter !== types_1.SCContentType.ALL && { content_type: contentTypeFilter })), (startDate && { created_at__gte: formatDate(startDate) })), (endDate && { created_at__lt: formatDate(endDate) })));
131
+ const res = yield api_services_1.PaymentService.getPaymentsOrder(Object.assign(Object.assign(Object.assign(Object.assign({ offset: 0, ordering: '-created_at' }, (searchValue && { search: searchValue })), (contentTypeFilter && contentTypeFilter !== types_1.SCContentType.ALL && { content_type: contentTypeFilter })), (startDate && { created_at__gte: formatDate(startDate) })), (endDate && { created_at__lt: formatDate(endDate) })));
132
132
  if (res) {
133
133
  setInvoices(res.results);
134
134
  setHasMore(res.next !== null);
@@ -213,8 +213,8 @@ function PaymentOrders(inProps) {
213
213
  }, InputProps: {
214
214
  endAdornment: ((0, jsx_runtime_1.jsxs)(material_1.InputAdornment, Object.assign({ position: "end" }, { children: [query.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => {
215
215
  setQuery('');
216
- fetchInvoices();
217
- }, disabled: isLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))), isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: fetchInvoices, disabled: isLoading })) : ((0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", color: "secondary", onClick: fetchInvoices, endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }), disabled: isLoading }))] })))
216
+ fetchInvoices('');
217
+ }, disabled: isLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))), isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => fetchInvoices(), disabled: isLoading })) : ((0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchInvoices(), endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }), disabled: isLoading }))] })))
218
218
  } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({ select: true, fullWidth: true, disabled: isLoading, size: "small", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paymentOrders.contentTypeFilter", defaultMessage: "ui.paymentOrders.contentTypeFilter" }), value: contentTypeFilter, onChange: handleContentTypeChange }, { children: options.map((option) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: option.value }, { children: option.label }), option.value))) })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 4 }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default, localeText: {
219
219
  cancelButtonLabel: `${intl.formatMessage(messages.pickerCancelAction)}`,
220
220
  clearButtonLabel: `${intl.formatMessage(messages.pickerClearAction)}`
@@ -121,12 +121,12 @@ export default function PaymentOrders(inProps) {
121
121
  /**
122
122
  * Initial Invoices fetch
123
123
  */
124
- const fetchInvoices = () => __awaiter(this, void 0, void 0, function* () {
124
+ const fetchInvoices = (searchValue = query) => __awaiter(this, void 0, void 0, function* () {
125
125
  setIsLoading(true);
126
126
  setHasMore(true);
127
127
  setInvoices([]);
128
128
  try {
129
- const res = yield PaymentService.getPaymentsOrder(Object.assign(Object.assign(Object.assign(Object.assign({ offset: 0, ordering: '-created_at' }, (query && { search: query })), (contentTypeFilter && contentTypeFilter !== SCContentType.ALL && { content_type: contentTypeFilter })), (startDate && { created_at__gte: formatDate(startDate) })), (endDate && { created_at__lt: formatDate(endDate) })));
129
+ const res = yield PaymentService.getPaymentsOrder(Object.assign(Object.assign(Object.assign(Object.assign({ offset: 0, ordering: '-created_at' }, (searchValue && { search: searchValue })), (contentTypeFilter && contentTypeFilter !== SCContentType.ALL && { content_type: contentTypeFilter })), (startDate && { created_at__gte: formatDate(startDate) })), (endDate && { created_at__lt: formatDate(endDate) })));
130
130
  if (res) {
131
131
  setInvoices(res.results);
132
132
  setHasMore(res.next !== null);
@@ -211,8 +211,8 @@ export default function PaymentOrders(inProps) {
211
211
  }, InputProps: {
212
212
  endAdornment: (_jsxs(InputAdornment, Object.assign({ position: "end" }, { children: [query.length > 0 && (_jsx(IconButton, Object.assign({ onClick: () => {
213
213
  setQuery('');
214
- fetchInvoices();
215
- }, disabled: isLoading }, { children: _jsx(Icon, { children: "close" }) }))), isMobile ? (_jsx(IconButton, { onClick: fetchInvoices, disabled: isLoading })) : (_jsx(Button, { size: "small", variant: "contained", color: "secondary", onClick: fetchInvoices, endIcon: _jsx(Icon, { children: "search" }), disabled: isLoading }))] })))
214
+ fetchInvoices('');
215
+ }, disabled: isLoading }, { children: _jsx(Icon, { children: "close" }) }))), isMobile ? (_jsx(IconButton, { onClick: () => fetchInvoices(), disabled: isLoading })) : (_jsx(Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchInvoices(), endIcon: _jsx(Icon, { children: "search" }), disabled: isLoading }))] })))
216
216
  } }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(TextField, Object.assign({ select: true, fullWidth: true, disabled: isLoading, size: "small", label: _jsx(FormattedMessage, { id: "ui.paymentOrders.contentTypeFilter", defaultMessage: "ui.paymentOrders.contentTypeFilter" }), value: contentTypeFilter, onChange: handleContentTypeChange }, { children: options.map((option) => (_jsx(MenuItem, Object.assign({ value: option.value }, { children: option.label }), option.value))) })) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 4 }, { children: _jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? itLocale : enLocale, localeText: {
217
217
  cancelButtonLabel: `${intl.formatMessage(messages.pickerCancelAction)}`,
218
218
  clearButtonLabel: `${intl.formatMessage(messages.pickerClearAction)}`