@isoftdata/svelte-ecommerce 1.0.0-beta.0 → 1.0.0-beta.1

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.
@@ -1,16 +1,16 @@
1
1
  import type { EbayCategory, EbayPolicy, EcommerceCondition, ExtendedEcommerceConditionMap, EcommercePartnerConfiguration, ExtendedEbayCategoryMap, FileItem, InventoryListingDetail, InventoryRow, InventoryType, InventoryTypeListingDefaults, NewInventoryListingDetail } from './utils.js';
2
2
  interface Props {
3
- ebayCategoryList: EbayCategory[];
4
- ebayCategoryMapList: ExtendedEbayCategoryMap[];
5
- ebayPolicyList: EbayPolicy[];
6
- ecommerceConditionMapList: ExtendedEcommerceConditionMap[];
7
- ecommerceConditionList: EcommerceCondition[];
8
- ecommercePartnerConfigurationList: EcommercePartnerConfiguration[];
9
- listingList: InventoryListingDetail[];
10
- partFileList: FileItem[];
3
+ ebayCategoryList: Array<EbayCategory>;
4
+ ebayCategoryMapList: Array<ExtendedEbayCategoryMap>;
5
+ ebayPolicyList: Array<EbayPolicy>;
6
+ ecommerceConditionMapList: Array<ExtendedEcommerceConditionMap>;
7
+ ecommerceConditionList: Array<EcommerceCondition>;
8
+ ecommercePartnerConfigurationList: Array<EcommercePartnerConfiguration>;
9
+ listingList: Array<InventoryListingDetail>;
10
+ partFileList: Array<FileItem>;
11
11
  part: InventoryRow;
12
- inventoryTypeWithDefaultConfigList: InventoryTypeListingDefaults[];
13
- inventoryTypeList: InventoryType[];
12
+ inventoryTypeWithDefaultConfigList: Array<InventoryTypeListingDefaults>;
13
+ inventoryTypeList: Array<InventoryType>;
14
14
  save: (data: InventoryListingDetail | NewInventoryListingDetail) => Promise<void>;
15
15
  }
16
16
  declare const EcommerceListingDetails: import("svelte").Component<Props, {}, "">;
@@ -1,305 +1,277 @@
1
- <script lang="ts">
2
- import type { i18n } from 'i18next'
3
-
4
- import { getContext } from 'svelte'
5
-
6
- import Table from '@isoftdata/svelte-table'
7
- import Button from '@isoftdata/svelte-button'
8
- import Select from '@isoftdata/svelte-select'
9
- import Modal from '@isoftdata/svelte-modal'
10
- import Checkbox from '@isoftdata/svelte-checkbox'
11
- import klona from 'klona'
12
- import type { InventoryType } from './utils.js'
13
- import EcommerceDefaults from './EcommerceDefaults.svelte'
14
- import type {
15
- EbayPolicy,
16
- EcommerceCondition,
17
- EcommercePartnerConfiguration,
18
- EcommerceSharedDefaults,
19
- ExtendedInventoryTypeListingDefaults,
20
- InventoryTypeCategory,
21
- InventoryTypeListingDefaults,
22
- NewInventoryTypeListingDefaults,
23
- } from './utils.js'
24
-
25
- import { translate as defaultTranslate } from '@isoftdata/utility-string'
26
-
27
- const { t: translate } = getContext<i18n>('i18next') || { t: defaultTranslate }
28
-
29
- interface Props {
30
- // Props
31
- ebayPolicyList: EbayPolicy[]
32
- ecommerceConditionList: EcommerceCondition[]
33
- inventoryTypeList: InventoryType[]
34
- inventoryTypeWithDefaultConfigList: ExtendedInventoryTypeListingDefaults[]
35
- inventoryTypeCategoryList: InventoryTypeCategory[]
36
- partnerConfigurationList: EcommercePartnerConfiguration[]
37
- selectedEcommercePartnerId: number
38
- partTypeConfigurationChanged: (
39
- data: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults,
40
- ) => Promise<void>
41
- }
42
-
43
- let {
44
- ebayPolicyList = [],
45
- ecommerceConditionList = [],
46
- inventoryTypeList = [],
47
- inventoryTypeWithDefaultConfigList = $bindable([]),
48
- inventoryTypeCategoryList = [],
49
- partnerConfigurationList = [],
50
- selectedEcommercePartnerId,
51
- partTypeConfigurationChanged = async (_: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults) => {},
52
- }: Props = $props()
53
-
54
- // Template for new inventory type listing configurations
55
- const newInventoryTypeListingConfig: NewInventoryTypeListingDefaults = Object.freeze({
56
- active: true,
57
- categoryId: undefined,
58
- categoryName: '',
59
- defaults: {
60
- brandMapping: undefined,
61
- conditionDescription: undefined,
62
- conditionId: undefined,
63
- fulfillmentPolicies: undefined,
64
- fulfillmentTimeUnit: undefined,
65
- fulfillmentTimeValue: undefined,
66
- listingDescriptionTemplate: undefined,
67
- listingDuration: undefined,
68
- listingFormat: undefined,
69
- listingTitleTemplate: undefined,
70
- manufacturerPartNumberMapping: undefined,
71
- oemNumberMapping: undefined,
72
- packageType: undefined,
73
- paymentPolicies: undefined,
74
- pricingModifier: undefined,
75
- returnPolicies: undefined,
76
- shippingLengthUnit: undefined,
77
- shippingWeightUnit: undefined,
78
- storePickupAllowed: undefined,
79
- },
80
- ecommercePartnerId: 0,
81
- inventoryTypeId: 0,
82
- inventoryTypeListingConfigurationId: null,
83
- inventoryTypeName: '',
84
- inventoryType: null,
85
- descriptionTemplate: null,
86
- titleTemplate: null,
87
- })
88
-
89
- // Local state
90
- let isAddingListingConfig = false
91
- let selectedInventoryTypeListingConfig: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults = $state(
92
- klona(newInventoryTypeListingConfig),
93
- )
94
- let show = $state(false)
95
- let editInventoryTypeDisabled: boolean = $state(false)
96
- // Hard coded temp data for drop downs
97
- let showAllOption = true
98
-
99
- // Automatically update filtered categories when inventoryType changes
100
- let filteredCategories = $derived.by(() => {
101
- // Use the inventoryType from the selectedInventoryTypeListingConfig if available
102
- const typeToUse = selectedInventoryTypeListingConfig?.inventoryTypeId
103
-
104
- // If no inventory type is selected, return empty array
105
- if (!typeToUse) {
106
- return []
107
- }
108
-
109
- // First find any categories with a typeSetId matching the selected inventory type
110
- const categoriesByInventoryType = inventoryTypeCategoryList.filter(category => category.typeSetId === typeToUse)
111
-
112
- // Now filter out the ones that aren't already configured by the inventorytype and category combo
113
- return categoriesByInventoryType.filter(category => {
114
- // Check if this category is already configured for this inventory type
115
- const isAlreadyConfigured = inventoryTypeWithDefaultConfigList.some(
116
- config => config.inventoryTypeId === typeToUse && config.categoryId === category.categoryId,
117
- )
118
-
119
- // Always include the currently selected category (for editing existing records)
120
- const isCurrentlySelected = selectedInventoryTypeListingConfig?.categoryId === category.categoryId
121
-
122
- // Return categories that aren't already configured OR are currently selected
123
- return !isAlreadyConfigured || isCurrentlySelected
124
- })
125
- })
126
-
127
- // Called on add or edit inventory type config
128
- function editInventoryTypeConfig(row?: InventoryTypeListingDefaults) {
129
- if (row) {
130
- // Editing existing row - clone the provided row
131
- selectedInventoryTypeListingConfig = klona(row)
132
- editInventoryTypeDisabled = true
133
- } else {
134
- // Adding new row - ensure completely fresh copy from helper function
135
- selectedInventoryTypeListingConfig = newInventoryTypeListingConfig
136
- editInventoryTypeDisabled = false
137
- }
138
-
139
- show = true
140
- }
141
-
142
- // Function to prepare data and call for saving
143
- async function confirm() {
144
- if (!selectedInventoryTypeListingConfig) return
145
-
146
- // Create a copy of the data to avoid mutating state directly
147
- const listingConfigCopy = klona(selectedInventoryTypeListingConfig)
148
-
149
- // // TS hates this being possibly null
150
- // if (!selectedInventoryTypeListingConfig.inventoryTypeId) {
151
- // // Show error message or return early
152
- // console.error('Inventory Type is required')
153
- // return
154
- // }
155
-
156
- // Now create the object we want to save since there are some extras
157
-
158
- // Call the parent save function with prepared data
159
- await partTypeConfigurationChanged(listingConfigCopy)
160
-
161
- // Close the modal after saving
162
- close()
163
- }
164
-
165
- function close() {
166
- // Reset to a completely fresh template to prevent any state contamination
167
- selectedInventoryTypeListingConfig = newInventoryTypeListingConfig
168
- editInventoryTypeDisabled = false
169
- show = false
170
- }
171
-
172
- async function handlePartTypeDefaultsChange(newDefaults: EcommerceSharedDefaults) {
173
- // This function is called when the EcommerceDefaults component changes
174
- // The binding will automatically update selectedStoreConfigRow.defaults
175
- // Don't need to do anything here since we're not auto-saving, feels dumb having an empty method
176
- }
177
-
178
- function isRowSelected(row: ExtendedInventoryTypeListingDefaults): boolean {
179
- if (!selectedInventoryTypeListingConfig) return false
180
-
181
- // For existing records, compare IDs
182
- if ('inventoryTypeListingConfigurationId' in selectedInventoryTypeListingConfig) {
183
- return (
184
- selectedInventoryTypeListingConfig.inventoryTypeListingConfigurationId ===
185
- row.inventoryTypeListingConfigurationId
186
- )
187
- }
188
-
189
- // For new records, no row can be selected since they don't exist in the table yet
190
- return false
191
- }
192
- </script>
193
-
194
- <div class="card-header">
195
- <h4 class="mb-0">
196
- {translate('ecommerce.configuration.partTypeListingConfiguration', 'Part Type Listing Configuration')}
197
- </h4>
198
- <p class="text-muted mb-0">
199
- {translate(
200
- 'ecommerce.configuration.configurePartTypeCategory',
201
- 'Configure part type and category level settings for e-commerce listings',
202
- )}
203
- </p>
204
- </div>
205
- <div class="card-body">
206
- <div class="mb-3">
207
- <Button
208
- outline
209
- color="success"
210
- size="sm"
211
- iconClass="plus"
212
- onclick={() => editInventoryTypeConfig()}
213
- disabled={isAddingListingConfig}
214
- >
215
- {translate('ecommerce.configuration.add', 'Add')}
216
- </Button>
217
- </div>
218
- <Table
219
- rows={inventoryTypeWithDefaultConfigList}
220
- columns={[
221
- {
222
- property: 'inventoryTypeId',
223
- name: translate('ecommerce.configuration.typeNumber', 'Type #'),
224
- defaultSortColumn: true,
225
- },
226
- { property: 'inventoryTypeName', name: translate('ecommerce.configuration.name', 'Name') },
227
- { property: 'categoryName', name: translate('ecommerce.configuration.category', 'Category') },
228
- { property: 'active', name: translate('ecommerce.configuration.activeOnEbay', 'Active on eBay') },
229
- ]}
230
- >
231
- {#snippet children({ row })}
232
- <tr
233
- onclick={() => editInventoryTypeConfig(row)}
234
- class="cursor-pointer"
235
- class:table-primary={isRowSelected(row)}
236
- >
237
- <td>{row.inventoryTypeId}</td>
238
- <td>{row.inventoryTypeName}</td>
239
- <td>{row.categoryName}</td>
240
- <td
241
- >{row.active
242
- ? translate('ecommerce.configuration.yes', 'yes')
243
- : translate('ecommerce.configuration.no', 'No')}</td
244
- >
245
- </tr>
246
- {/snippet}
247
- </Table>
248
- </div>
249
- <Modal
250
- bind:show
251
- title={translate('ecommerce.configuration.addEditPartTypeCategory', 'Add/Edit Part Type & Category Configuration')}
252
- modalSize="lg"
253
- confirmButtonText={translate('ecommerce.configuration.save', 'Save')}
254
- cancelShown={true}
255
- {confirm}
256
- {close}
257
- >
258
- <Checkbox
259
- label={translate('ecommerce.configuration.activeOnEbay', 'Active On eBay')}
260
- bind:checked={selectedInventoryTypeListingConfig.active}
261
- onchange={() => {
262
- // Ensure active is always a boolean, not a string
263
- selectedInventoryTypeListingConfig.active = !!selectedInventoryTypeListingConfig.active
264
- }}
265
- />
266
- <div class="row">
267
- <div class="col-md-3">
268
- <Select
269
- label={translate('ecommerce.configuration.partType', 'Part Type')}
270
- showEmptyOption={showAllOption}
271
- emptyValue={null}
272
- emptyText={translate('ecommerce.configuration.selectType', 'Select Type')}
273
- disabled={editInventoryTypeDisabled}
274
- bind:value={selectedInventoryTypeListingConfig.inventoryTypeId}
275
- >
276
- {#each inventoryTypeList as type}
277
- <option value={type.inventoryTypeId}>{type.inventoryTypeId} - {type.name}</option>
278
- {/each}
279
- </Select>
280
- </div>
281
- <div class="col-md-3">
282
- <Select
283
- label={translate('ecommerce.configuration.category', 'Category')}
284
- showEmptyOption={showAllOption}
285
- emptyValue={null}
286
- emptyText={translate('ecommerce.configuration.selectCategory', 'Selectd Category')}
287
- disabled={!filteredCategories.length && !selectedInventoryTypeListingConfig.categoryId}
288
- bind:value={selectedInventoryTypeListingConfig.categoryId}
289
- >
290
- {#each filteredCategories as category}
291
- <option value={category.categoryId}>{category.name}</option>
292
- {/each}
293
- </Select>
294
- </div>
295
- </div>
296
- <hr />
297
- <EcommerceDefaults
298
- defaults={selectedInventoryTypeListingConfig.defaults}
299
- defaultsChanged={handlePartTypeDefaultsChange}
300
- {ebayPolicyList}
301
- {ecommerceConditionList}
302
- {partnerConfigurationList}
303
- {selectedEcommercePartnerId}
304
- />
305
- </Modal>
1
+ <script lang="ts">
2
+ import type { i18n } from 'i18next'
3
+
4
+ import { getContext } from 'svelte'
5
+
6
+ import Table from '@isoftdata/svelte-table'
7
+ import Button from '@isoftdata/svelte-button'
8
+ import Select from '@isoftdata/svelte-select'
9
+ import Modal from '@isoftdata/svelte-modal'
10
+ import Checkbox from '@isoftdata/svelte-checkbox'
11
+ import { klona } from 'klona'
12
+ import { booleanToYesNo } from '@isoftdata/utility-string'
13
+ import Autocomplete from '@isoftdata/svelte-autocomplete'
14
+ import EcommerceDefaults from './EcommerceDefaults.svelte'
15
+ import type {
16
+ EbayPolicy,
17
+ EcommerceCondition,
18
+ EcommercePartnerConfiguration,
19
+ ExtendedInventoryTypeListingDefaults,
20
+ InventoryType,
21
+ InventoryTypeCategory,
22
+ InventoryTypeListingDefaults,
23
+ NewInventoryTypeListingDefaults,
24
+ } from './utils.js'
25
+
26
+ import { translate as defaultTranslate } from '@isoftdata/utility-string'
27
+
28
+ const { t: translate } = getContext<i18n>('i18next') || { t: defaultTranslate }
29
+
30
+ interface Props {
31
+ // Props
32
+ ebayPolicyList: Array<EbayPolicy>
33
+ ecommerceConditionList: Array<EcommerceCondition>
34
+ inventoryTypeList: Array<InventoryType>
35
+ inventoryTypeWithDefaultConfigList: Array<ExtendedInventoryTypeListingDefaults>
36
+ inventoryTypeCategoryList: Array<InventoryTypeCategory>
37
+ partnerConfigurationList: Array<EcommercePartnerConfiguration>
38
+ selectedEcommercePartnerId: number
39
+ partTypeConfigurationChanged: (
40
+ data: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults,
41
+ ) => Promise<void>
42
+ }
43
+
44
+ let {
45
+ ebayPolicyList = [],
46
+ ecommerceConditionList = [],
47
+ inventoryTypeList = [],
48
+ inventoryTypeWithDefaultConfigList = $bindable([]),
49
+ inventoryTypeCategoryList = [],
50
+ partnerConfigurationList = [],
51
+ selectedEcommercePartnerId,
52
+ partTypeConfigurationChanged = async (_: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults) => {},
53
+ }: Props = $props()
54
+
55
+ // Template for new inventory type listing configurations
56
+ const newInventoryTypeListingConfig: NewInventoryTypeListingDefaults = Object.freeze({
57
+ active: true,
58
+ categoryId: undefined,
59
+ categoryName: '',
60
+ defaults: {
61
+ brandMapping: undefined,
62
+ conditionDescription: undefined,
63
+ conditionId: undefined,
64
+ fulfillmentPolicies: undefined,
65
+ fulfillmentTimeUnit: undefined,
66
+ fulfillmentTimeValue: undefined,
67
+ listingDescriptionTemplate: undefined,
68
+ listingDuration: undefined,
69
+ listingFormat: undefined,
70
+ listingTitleTemplate: undefined,
71
+ manufacturerPartNumberMapping: undefined,
72
+ oemNumberMapping: undefined,
73
+ packageType: undefined,
74
+ paymentPolicies: undefined,
75
+ pricingModifier: undefined,
76
+ returnPolicies: undefined,
77
+ shippingLengthUnit: undefined,
78
+ shippingWeightUnit: undefined,
79
+ storePickupAllowed: undefined,
80
+ },
81
+ ecommercePartnerId: 0,
82
+ inventoryTypeId: 0,
83
+ inventoryTypeListingConfigurationId: null,
84
+ inventoryTypeName: '',
85
+ inventoryType: null,
86
+ descriptionTemplate: null,
87
+ titleTemplate: null,
88
+ })
89
+
90
+ // Local state
91
+ let isAddingListingConfig = false
92
+ let selectedInventoryTypeListingConfig: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults = $state(
93
+ klona(newInventoryTypeListingConfig),
94
+ )
95
+ let show = $state(false)
96
+ let editInventoryTypeDisabled: boolean = $state(false)
97
+ let selectedInventoryType = $state<InventoryType | null>(null)
98
+ // Hard coded temp data for drop downs
99
+
100
+ // Automatically update filtered categories when inventoryType changes
101
+ let filteredCategories = $derived.by(() => {
102
+ // Use the inventoryType from the selectedInventoryTypeListingConfig if available
103
+ const typeToUse = selectedInventoryTypeListingConfig?.inventoryTypeId
104
+
105
+ // If no inventory type is selected, return empty array
106
+ if (!typeToUse) {
107
+ return []
108
+ }
109
+
110
+ // First find any categories with a typeSetId matching the selected inventory type
111
+ const categoriesByInventoryType = inventoryTypeCategoryList.filter(category => category.typeSetId === typeToUse)
112
+
113
+ // Now filter out the ones that aren't already configured by the inventorytype and category combo
114
+ return categoriesByInventoryType.filter(category => {
115
+ // Check if this category is already configured for this inventory type
116
+ const isAlreadyConfigured = inventoryTypeWithDefaultConfigList.some(
117
+ config => config.inventoryTypeId === typeToUse && config.categoryId === category.categoryId,
118
+ )
119
+
120
+ // Always include the currently selected category (for editing existing records)
121
+ const isCurrentlySelected = selectedInventoryTypeListingConfig?.categoryId === category.categoryId
122
+
123
+ // Return categories that aren't already configured OR are currently selected
124
+ return !isAlreadyConfigured || isCurrentlySelected
125
+ })
126
+ })
127
+
128
+ // Called on add or edit inventory type config
129
+ function editInventoryTypeConfig(row?: InventoryTypeListingDefaults) {
130
+ selectedInventoryTypeListingConfig = klona(row ?? newInventoryTypeListingConfig)
131
+ editInventoryTypeDisabled = !!row
132
+ // Sync the selectedInventoryType from the ID
133
+ selectedInventoryType =
134
+ inventoryTypeList.find(type => type.inventoryTypeId === selectedInventoryTypeListingConfig.inventoryTypeId) ??
135
+ null
136
+ show = true
137
+ }
138
+
139
+ // Function to prepare data and call for saving
140
+ async function confirm() {
141
+ if (!selectedInventoryTypeListingConfig) return
142
+
143
+ // Create a copy of the data to avoid mutating state directly
144
+ const listingConfigCopy = klona(selectedInventoryTypeListingConfig)
145
+
146
+ // Call the parent save function with prepared data
147
+ await partTypeConfigurationChanged(listingConfigCopy)
148
+
149
+ // Close the modal after saving
150
+ close()
151
+ }
152
+
153
+ function close() {
154
+ // Reset to a completely fresh template to prevent any state contamination
155
+ selectedInventoryTypeListingConfig = newInventoryTypeListingConfig
156
+ selectedInventoryType = null
157
+ editInventoryTypeDisabled = false
158
+ show = false
159
+ }
160
+
161
+ function isRowSelected(row: ExtendedInventoryTypeListingDefaults): boolean {
162
+ if (!selectedInventoryTypeListingConfig) return false
163
+
164
+ // For existing records, compare IDs
165
+ if ('inventoryTypeListingConfigurationId' in selectedInventoryTypeListingConfig) {
166
+ return (
167
+ selectedInventoryTypeListingConfig.inventoryTypeListingConfigurationId ===
168
+ row.inventoryTypeListingConfigurationId
169
+ )
170
+ }
171
+
172
+ // For new records, no row can be selected since they don't exist in the table yet
173
+ return false
174
+ }
175
+ </script>
176
+
177
+ <div class="card">
178
+ <div class="card-header">
179
+ <h4 class="mb-0">
180
+ {translate('ecommerce.configuration.partTypeListingConfiguration', 'Part Type Listing Configuration')}
181
+ </h4>
182
+ <p class="text-muted mb-0">
183
+ {translate(
184
+ 'ecommerce.configuration.configurePartTypeCategory',
185
+ 'Configure part type and category level settings for e-commerce listings',
186
+ )}
187
+ </p>
188
+ </div>
189
+ <div class="card-body">
190
+ <Table
191
+ rows={inventoryTypeWithDefaultConfigList}
192
+ columns={[
193
+ {
194
+ property: 'inventoryTypeId',
195
+ name: translate('ecommerce.configuration.typeNumber', 'Type #'),
196
+ defaultSortColumn: true,
197
+ },
198
+ { property: 'inventoryTypeName', name: translate('ecommerce.configuration.name', 'Name') },
199
+ { property: 'categoryName', name: translate('ecommerce.configuration.category', 'Category') },
200
+ { property: 'active', name: translate('ecommerce.configuration.activeOnEbay', 'Active on eBay') },
201
+ ]}
202
+ >
203
+ {#snippet children({ row })}
204
+ <tr
205
+ onclick={() => editInventoryTypeConfig(row)}
206
+ style="cursor: pointer;"
207
+ class:table-primary={isRowSelected(row)}
208
+ >
209
+ <td>{row.inventoryTypeId}</td>
210
+ <td>{row.inventoryTypeName}</td>
211
+ <td>{row.categoryName}</td>
212
+ <td>{booleanToYesNo(row.active, translate)}</td>
213
+ </tr>
214
+ {/snippet}
215
+ </Table>
216
+ </div>
217
+ <div class="card-footer">
218
+ <Button
219
+ outline
220
+ color="success"
221
+ size="sm"
222
+ icon="plus"
223
+ onclick={() => editInventoryTypeConfig()}
224
+ disabled={isAddingListingConfig}
225
+ >
226
+ {translate('common:add', 'Add')}...
227
+ </Button>
228
+ </div>
229
+ </div>
230
+ <Modal
231
+ bind:show
232
+ title={translate('ecommerce.configuration.addEditPartTypeCategory', 'Add/Edit Part Type & Category Configuration')}
233
+ size="lg"
234
+ confirmButtonText={translate('ecommerce.configuration.save', 'Save')}
235
+ {confirm}
236
+ {close}
237
+ >
238
+ <Checkbox
239
+ label={translate('ecommerce.configuration.activeOnEbay', 'Active On eBay')}
240
+ bind:checked={selectedInventoryTypeListingConfig.active}
241
+ />
242
+ <div class="row">
243
+ <div class="col-lg-4">
244
+ <Autocomplete
245
+ label={translate('ecommerce.configuration.partType', 'Part Type')}
246
+ options={inventoryTypeList}
247
+ bind:value={selectedInventoryType}
248
+ getLabel={option => (option ? `${option.inventoryTypeId} - ${option.name}` : '')}
249
+ change={option => {
250
+ if (option) {
251
+ selectedInventoryTypeListingConfig.inventoryTypeId = option.inventoryTypeId
252
+ }
253
+ }}
254
+ />
255
+ </div>
256
+ <div class="col-lg-4">
257
+ <Select
258
+ label={translate('ecommerce.configuration.category', 'Category')}
259
+ emptyText="-- {translate('ecommerce.configuration.selectCategory', 'Selectd Category')} --"
260
+ disabled={!filteredCategories.length && !selectedInventoryTypeListingConfig.categoryId}
261
+ bind:value={selectedInventoryTypeListingConfig.categoryId}
262
+ >
263
+ {#each filteredCategories as category}
264
+ <option value={category.categoryId}>{category.name}</option>
265
+ {/each}
266
+ </Select>
267
+ </div>
268
+ </div>
269
+ <hr />
270
+ <EcommerceDefaults
271
+ defaults={selectedInventoryTypeListingConfig.defaults}
272
+ {ebayPolicyList}
273
+ {ecommerceConditionList}
274
+ {partnerConfigurationList}
275
+ {selectedEcommercePartnerId}
276
+ />
277
+ </Modal>
@@ -1,12 +1,11 @@
1
- import type { InventoryType } from './utils.js';
2
- import type { EbayPolicy, EcommerceCondition, EcommercePartnerConfiguration, ExtendedInventoryTypeListingDefaults, InventoryTypeCategory, InventoryTypeListingDefaults, NewInventoryTypeListingDefaults } from './utils.js';
1
+ import type { EbayPolicy, EcommerceCondition, EcommercePartnerConfiguration, ExtendedInventoryTypeListingDefaults, InventoryType, InventoryTypeCategory, InventoryTypeListingDefaults, NewInventoryTypeListingDefaults } from './utils.js';
3
2
  interface Props {
4
- ebayPolicyList: EbayPolicy[];
5
- ecommerceConditionList: EcommerceCondition[];
6
- inventoryTypeList: InventoryType[];
7
- inventoryTypeWithDefaultConfigList: ExtendedInventoryTypeListingDefaults[];
8
- inventoryTypeCategoryList: InventoryTypeCategory[];
9
- partnerConfigurationList: EcommercePartnerConfiguration[];
3
+ ebayPolicyList: Array<EbayPolicy>;
4
+ ecommerceConditionList: Array<EcommerceCondition>;
5
+ inventoryTypeList: Array<InventoryType>;
6
+ inventoryTypeWithDefaultConfigList: Array<ExtendedInventoryTypeListingDefaults>;
7
+ inventoryTypeCategoryList: Array<InventoryTypeCategory>;
8
+ partnerConfigurationList: Array<EcommercePartnerConfiguration>;
10
9
  selectedEcommercePartnerId: number;
11
10
  partTypeConfigurationChanged: (data: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults) => Promise<void>;
12
11
  }