From ab42a926ed017a290476932fabbf358a7c8465e9 Mon Sep 17 00:00:00 2001 From: TemuulenBM Date: Thu, 7 Dec 2023 18:00:47 +0800 Subject: [PATCH 1/4] fixed inventory,sales-order,purchase-order, and product small issues created basic structure for product category page --- addon/components/admin/product-category.hbs | 1 + addon/components/admin/product-category.js | 3 + .../components/admin/visibility-controls.hbs | 12 +++ addon/components/admin/visibility-controls.js | 81 +++++++++++++++++++ addon/components/inventory-form-panel.hbs | 4 +- addon/components/inventory-panel/details.hbs | 4 + addon/components/purchase-order-form-panel.js | 2 +- addon/components/supplier-form-panel.hbs | 3 +- addon/controllers/admin/product-category.js | 3 + addon/controllers/inventory/expired-stock.js | 23 +----- addon/controllers/inventory/index.js | 52 +----------- addon/controllers/inventory/low-stock.js | 20 ----- addon/controllers/sales-orders/index.js | 3 +- addon/engine.js | 33 +++++++- addon/models/stock-adjustment.js | 21 +++++ addon/routes/admin/product-category.js | 24 ++++++ addon/serializers/stock-adjustment.js | 15 ++++ addon/templates/admin/product-category.hbs | 17 ++++ app/components/admin/product-category.js | 1 + app/components/admin/visibility-controls.js | 1 + app/controllers/admin/product-category.js | 1 + app/routes/admin/product-category.js | 1 + app/serializers/stock-adjustment.js | 1 + app/templates/admin/product-category.js | 1 + .../Http/Controllers/InventoryController.php | 3 +- server/src/Http/Resources/Batch.php | 16 ++-- server/src/Http/Resources/Inventory.php | 1 - server/src/Http/Resources/StockAdjustment.php | 32 ++++++++ server/src/Models/Batch.php | 14 ++++ server/src/Models/Inventory.php | 25 +++--- server/src/Models/StockAdjustment.php | 24 +++++- .../components/admin/product-category-test.js | 26 ++++++ .../admin/visibility-controls-test.js | 26 ++++++ .../admin/product-category-test.js | 12 +++ .../routes/admin/product-category-test.js | 11 +++ .../unit/serializers/stock-adjustment-test.js | 23 ++++++ 36 files changed, 421 insertions(+), 119 deletions(-) create mode 100644 addon/components/admin/product-category.hbs create mode 100644 addon/components/admin/product-category.js create mode 100644 addon/components/admin/visibility-controls.hbs create mode 100644 addon/components/admin/visibility-controls.js create mode 100644 addon/controllers/admin/product-category.js create mode 100644 addon/routes/admin/product-category.js create mode 100644 addon/serializers/stock-adjustment.js create mode 100644 addon/templates/admin/product-category.hbs create mode 100644 app/components/admin/product-category.js create mode 100644 app/components/admin/visibility-controls.js create mode 100644 app/controllers/admin/product-category.js create mode 100644 app/routes/admin/product-category.js create mode 100644 app/serializers/stock-adjustment.js create mode 100644 app/templates/admin/product-category.js create mode 100644 server/src/Http/Resources/StockAdjustment.php create mode 100644 tests/integration/components/admin/product-category-test.js create mode 100644 tests/integration/components/admin/visibility-controls-test.js create mode 100644 tests/unit/controllers/admin/product-category-test.js create mode 100644 tests/unit/routes/admin/product-category-test.js create mode 100644 tests/unit/serializers/stock-adjustment-test.js diff --git a/addon/components/admin/product-category.hbs b/addon/components/admin/product-category.hbs new file mode 100644 index 00000000..fb5c4b15 --- /dev/null +++ b/addon/components/admin/product-category.hbs @@ -0,0 +1 @@ +{{yield}} \ No newline at end of file diff --git a/addon/components/admin/product-category.js b/addon/components/admin/product-category.js new file mode 100644 index 00000000..48b9c2ac --- /dev/null +++ b/addon/components/admin/product-category.js @@ -0,0 +1,3 @@ +import Component from '@glimmer/component'; + +export default class AdminProductCategoryComponent extends Component {} diff --git a/addon/components/admin/visibility-controls.hbs b/addon/components/admin/visibility-controls.hbs new file mode 100644 index 00000000..dc14590e --- /dev/null +++ b/addon/components/admin/visibility-controls.hbs @@ -0,0 +1,12 @@ + +

Visibility controls allow you to disable sections of Pallet. Toggle the checkbox to enable or disable sections to hide in Pallet

+ {{#each this.visibilitySettings as |visibilityControl|}} + + + + {{/each}} +
+ +
+
\ No newline at end of file diff --git a/addon/components/admin/visibility-controls.js b/addon/components/admin/visibility-controls.js new file mode 100644 index 00000000..e6ea41bd --- /dev/null +++ b/addon/components/admin/visibility-controls.js @@ -0,0 +1,81 @@ +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; +import { isArray } from '@ember/array'; + +export default class AdminVisibilityControlsComponent extends Component { + @service fetch; + @tracked visibilitySettings = [ + // { name: 'Dashboard', route: 'operations.orders', visible: true }, + { name: 'Products', route: 'products', visible: true }, + { name: 'Warehouses', route: 'warehouses', visible: true }, + { name: 'Suppliers', route: 'suppliers', visible: true }, + { name: 'Inventory', route: 'inventory', visible: true }, + { name: 'Sales Orders', route: 'sales-orders', visible: true }, + { name: 'Purchase Orders', route: 'purchase-orders', visible: true }, + { name: 'Audits', route: 'audits', visible: true }, + { name: 'Reports', route: 'reports', visible: true }, + ]; + @tracked isLoading = false; + + constructor() { + super(...arguments); + this.loadVisibilitySettings(); + } + + @action mutateVisibility(route, visible) { + this.visibilitySettings = [...this.visibilitySettings].map((visibilityControl) => { + if (visibilityControl.route === route) { + return { + ...visibilityControl, + visible, + }; + } + + return visibilityControl; + }); + } + + @action loadVisibilitySettings() { + this.isLoading = true; + + this.fetch + .get('pallet/settings/visibility') + .then(({ visibilitySettings }) => { + if (isArray(visibilitySettings)) { + for (let i = 0; i < visibilitySettings.length; i++) { + const visibilityControl = visibilitySettings.objectAt(i); + this.mutateVisibility(visibilityControl.route, visibilityControl.visible); + } + } + }) + .catch((error) => { + this.notifications.serverError(error); + }) + .finally(() => { + this.isLoading = false; + }); + } + + @action saveVisibilitySettings() { + this.isLoading = true; + + this.fetch + .post('pallet/settings/visibility', { visibilitySettings: this.visibilitySettings }) + .then(({ visibilitySettings }) => { + if (isArray(visibilitySettings)) { + for (let i = 0; i < visibilitySettings.length; i++) { + const visibilityControl = visibilitySettings.objectAt(i); + this.mutateVisibility(visibilityControl.route, visibilityControl.visible); + } + } + }) + .catch((error) => { + this.notifications.serverError(error); + }) + .finally(() => { + this.isLoading = false; + }); + } +} diff --git a/addon/components/inventory-form-panel.hbs b/addon/components/inventory-form-panel.hbs index a30bc745..2df14492 100644 --- a/addon/components/inventory-form-panel.hbs +++ b/addon/components/inventory-form-panel.hbs @@ -55,7 +55,7 @@ @infiniteScroll={{false}} @renderInPlace={{true}} @onChange={{this.inventory.supplier.name}} - @onChangeId={{fn (mut this.inventory.product_uuid)}} + @onChangeId={{fn (mut this.inventory.supplier_uuid)}} as |model| > {{model.name}} @@ -96,7 +96,7 @@ - + diff --git a/addon/components/inventory-panel/details.hbs b/addon/components/inventory-panel/details.hbs index b01fc142..c201aeb3 100644 --- a/addon/components/inventory-panel/details.hbs +++ b/addon/components/inventory-panel/details.hbs @@ -17,6 +17,10 @@
Batch
{{n-a @inventory.batch.batch_number}}
+
+
Supplier
+
{{n-a @inventory.supplier.name}}
+
Expiry Date
{{n-a @inventory.expiry_date_at}}
diff --git a/addon/components/purchase-order-form-panel.js b/addon/components/purchase-order-form-panel.js index 7d21da2e..3e56a19e 100644 --- a/addon/components/purchase-order-form-panel.js +++ b/addon/components/purchase-order-form-panel.js @@ -143,7 +143,7 @@ export default class PurchaseOrderFormPanelComponent extends Component { @action onPressCancel() { return contextComponentCallback(this, 'onPressCancel', this.purchaseOrder); } - + @action setExpectedDeliveryDate(event) { const { target: { value }, diff --git a/addon/components/supplier-form-panel.hbs b/addon/components/supplier-form-panel.hbs index ab99f884..6180fb0f 100644 --- a/addon/components/supplier-form-panel.hbs +++ b/addon/components/supplier-form-panel.hbs @@ -54,7 +54,8 @@ @triggerClass="form-select form-input" @infiniteScroll={{false}} @renderInPlace={{true}} - @onChange={{this.supplier.place.address}} + @onChange={{fn (mut this.supplier.place)}} + @onChangeId={{fn (mut this.supplier.place_uuid)}} as |model| >
diff --git a/addon/controllers/admin/product-category.js b/addon/controllers/admin/product-category.js new file mode 100644 index 00000000..948d3a6e --- /dev/null +++ b/addon/controllers/admin/product-category.js @@ -0,0 +1,3 @@ +import Controller from '@ember/controller'; + +export default class AdminProductCategoryController extends Controller {} diff --git a/addon/controllers/inventory/expired-stock.js b/addon/controllers/inventory/expired-stock.js index 89bd0450..a4136955 100644 --- a/addon/controllers/inventory/expired-stock.js +++ b/addon/controllers/inventory/expired-stock.js @@ -69,7 +69,7 @@ export default class InventoryExpiredStockController extends Controller { */ @tracked page = 1; - @tracked view = 'expired_stock' + @tracked view = 'expired_stock'; /** * The maximum number of items to show per page @@ -136,6 +136,7 @@ export default class InventoryExpiredStockController extends Controller { { label: 'Product', valuePath: 'product.name', + action: this.viewInventory, width: '170px', cellComponent: 'cell/product-info', modelPath: 'product', @@ -159,16 +160,6 @@ export default class InventoryExpiredStockController extends Controller { valuePath: 'quantity', width: '120px', }, - { - label: 'Warehouse', - valuePath: 'warehouse.address', - width: '120px', - cellComponent: 'click-to-copy', - resizable: true, - sortable: true, - filterable: true, - filterComponent: 'filter/string', - }, { label: 'Batch', valuePath: 'batch.name', @@ -199,16 +190,6 @@ export default class InventoryExpiredStockController extends Controller { filterable: true, filterComponent: 'filter/date', }, - { - label: 'Expiry Date', - valuePath: 'expiredAt', - sortParam: 'expiry_date_at', - width: '10%', - resizable: true, - sortable: true, - filterable: true, - filterComponent: 'filter/date', - }, { label: 'Updated At', valuePath: 'updatedAt', diff --git a/addon/controllers/inventory/index.js b/addon/controllers/inventory/index.js index c9f60c47..6f93ba48 100644 --- a/addon/controllers/inventory/index.js +++ b/addon/controllers/inventory/index.js @@ -134,6 +134,7 @@ export default class InventoryIndexController extends Controller { { label: 'Product', valuePath: 'product.name', + action: this.viewInventory, width: '170px', cellComponent: 'cell/product-info', modelPath: 'product', @@ -157,16 +158,6 @@ export default class InventoryIndexController extends Controller { valuePath: 'quantity', width: '120px', }, - { - label: 'Warehouse', - valuePath: 'warehouse.address', - width: '120px', - cellComponent: 'click-to-copy', - resizable: true, - sortable: true, - filterable: true, - filterComponent: 'filter/string', - }, { label: 'Batch', valuePath: 'batch.batch_number', @@ -199,7 +190,7 @@ export default class InventoryIndexController extends Controller { }, { label: 'Expiry Date', - valuePath: 'expiredAt', + valuePath: 'expiryDate', sortParam: 'expiry_date_at', width: '10%', resizable: true, @@ -286,7 +277,7 @@ export default class InventoryIndexController extends Controller { * @void */ @action viewInventory(inventory) { - return this.transitionToRoute('inventory.index.details', inventory); + return this.transitionToRoute('inventory.index.details', inventory.public_id); } /** @@ -313,41 +304,4 @@ export default class InventoryIndexController extends Controller { @action async editInventory(inventory) { return this.transitionToRoute('inventory.index.edit', inventory); } - - /** - * Delete a `inventory` via confirm prompt - * - * @param {InventoryModel} inventory - * @param {Object} options - * @void - */ - @action deleteInventory(inventory, options = {}) { - this.crud.delete(inventory, { - onConfirm: () => { - return this.hostRouter.refresh(); - }, - ...options, - }); - } - - /** - * Bulk deletes selected `inventory` via confirm prompt - * - * @param {Array} selected an array of selected models - * @void - */ - @action bulkDeleteInventorys() { - const selected = this.table.selectedRows; - - this.crud.bulkDelete(selected, { - modelNamePath: `public_id`, - acceptButtonText: 'Delete Inventories', - fetchOptions: { - namespace: 'pallet/int/v1', - }, - onSuccess: () => { - return this.hostRouter.refresh(); - }, - }); - } } diff --git a/addon/controllers/inventory/low-stock.js b/addon/controllers/inventory/low-stock.js index 9c126114..8409f7af 100644 --- a/addon/controllers/inventory/low-stock.js +++ b/addon/controllers/inventory/low-stock.js @@ -159,16 +159,6 @@ export default class InventoryLowStockController extends Controller { valuePath: 'quantity', width: '120px', }, - { - label: 'Warehouse', - valuePath: 'warehouse.address', - width: '120px', - cellComponent: 'click-to-copy', - resizable: true, - sortable: true, - filterable: true, - filterComponent: 'filter/string', - }, { label: 'Batch', valuePath: 'batch.name', @@ -199,16 +189,6 @@ export default class InventoryLowStockController extends Controller { filterable: true, filterComponent: 'filter/date', }, - { - label: 'Expiry Date', - valuePath: 'expiredAt', - sortParam: 'expiry_date_at', - width: '10%', - resizable: true, - sortable: true, - filterable: true, - filterComponent: 'filter/date', - }, { label: 'Updated At', valuePath: 'updatedAt', diff --git a/addon/controllers/sales-orders/index.js b/addon/controllers/sales-orders/index.js index 904d080b..9394614c 100644 --- a/addon/controllers/sales-orders/index.js +++ b/addon/controllers/sales-orders/index.js @@ -77,7 +77,6 @@ export default class SalesOrdersIndexController extends Controller { */ @tracked page = 1; - /** * The maximum number of items to show per page * @@ -291,7 +290,7 @@ export default class SalesOrdersIndexController extends Controller { this.crud.bulkDelete(selected, { modelNamePath: 'public_id', - acceptButtonText: "Delete Sales Orders", + acceptButtonText: 'Delete Sales Orders', fetchOptions: { namespace: 'pallet/int/v1', }, diff --git a/addon/engine.js b/addon/engine.js index cd7809bb..944b547e 100644 --- a/addon/engine.js +++ b/addon/engine.js @@ -3,6 +3,7 @@ import loadInitializers from 'ember-load-initializers'; import Resolver from 'ember-resolver'; import config from './config/environment'; import services from '@fleetbase/ember-core/exports/services'; +import AdminVisibilityControlsComponent from './components/admin/visibility-controls'; const { modulePrefix } = config; const externalRoutes = ['console', 'extensions']; @@ -16,7 +17,37 @@ export default class PalletEngine extends Engine { }; setupExtension = function (app, engine, universe) { // register menu item in header - universe.registerHeaderMenuItem('Pallet', 'console.pallet', { icon: 'pallet', priority: 1 }); + universe.registerHeaderMenuItem('Pallet', 'console.pallet', { icon: 'pallet', priority: 0 }); + + // register admin settings -- create a pallet menu panel with it's own setting options + universe.registerAdminMenuPanel( + 'Pallet Config', + [ + { + title: 'Visibility Controls', + icon: 'eye', + component: AdminVisibilityControlsComponent, + }, + ], + { + slug: 'pallet', + } + ); + + // create primary registry for engine + universe.createRegistry('engine:pallet'); + + // register the product panel + universe.createRegistry('component:product-panel'); + + // register the inventory panel + universe.createRegistry('component:inventory-panel'); + + // register the supplier panel + universe.createRegistry('component:supplier-panel'); + + // register the warehouse panel + universe.createRegistry('component:warehouse-panel'); }; } diff --git a/addon/models/stock-adjustment.js b/addon/models/stock-adjustment.js index 4e13f5d0..4e6ec3be 100644 --- a/addon/models/stock-adjustment.js +++ b/addon/models/stock-adjustment.js @@ -37,6 +37,20 @@ export default class StockAdjustmentModel extends Model { return formatDistanceToNow(this.created_at); } + @computed('created_at') get createdAt() { + if (!isValidDate(this.created_at)) { + return null; + } + return formatDate(this.created_at, 'PPP p'); + } + + @computed('created_at') get createdAtShort() { + if (!isValidDate(this.created_at)) { + return null; + } + return formatDate(this.created_at, 'PP'); + } + @computed('updated_at') get updatedAgo() { if (!isValidDate(this.updated_at)) { return null; @@ -50,4 +64,11 @@ export default class StockAdjustmentModel extends Model { } return formatDate(this.updated_at, 'PPP p'); } + + @computed('updated_at') get updatedAtShort() { + if (!isValidDate(this.updated_at)) { + return null; + } + return formatDate(this.updated_at, 'PP'); + } } diff --git a/addon/routes/admin/product-category.js b/addon/routes/admin/product-category.js new file mode 100644 index 00000000..0ada6d8f --- /dev/null +++ b/addon/routes/admin/product-category.js @@ -0,0 +1,24 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class AdminProductCategoryRoute extends Route { + @service store; + + queryParams = { + page: { refreshModel: true }, + limit: { refreshModel: true }, + sort: { refreshModel: true }, + query: { refreshModel: true }, + created_at: { refreshModel: true }, + }; + + /** + * Fetch the model data based on the specified parameters. + * + * @param {Object} params - Query parameters for fetching notifications. + * @returns {Promise} - A promise that resolves with the notification data. + */ + model(params = {}) { + return this.store.query('notification', params); + } +} diff --git a/addon/serializers/stock-adjustment.js b/addon/serializers/stock-adjustment.js new file mode 100644 index 00000000..cd7e6745 --- /dev/null +++ b/addon/serializers/stock-adjustment.js @@ -0,0 +1,15 @@ +import ApplicationSerializer from '@fleetbase/ember-core/serializers/application'; +import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest'; + +export default class StockAdjustment extends ApplicationSerializer.extend(EmbeddedRecordsMixin) { + /** + * Embedded relationship attributes + * + * @var {Object} + */ + get attrs() { + return { + product: { embedded: 'always' }, + }; + } +} diff --git a/addon/templates/admin/product-category.hbs b/addon/templates/admin/product-category.hbs new file mode 100644 index 00000000..4abdd78c --- /dev/null +++ b/addon/templates/admin/product-category.hbs @@ -0,0 +1,17 @@ + +
+
+
    + {{#each this.categories as |category|}} +
    + {{category.name}} +
    +
    +
    + {{#each this.categories as |subCategory|}} + {{#if (and (eq subCategory.parent.id category.id) (not (eq subCategory.id category.id)))}} +
    + {{subCategory.name}} +
    +
    +
    + {{/if}} + {{/each}} + {{/each}} +
+
+ \ No newline at end of file diff --git a/addon/components/admin/product-category.js b/addon/components/admin/product-category.js index 48b9c2ac..f7c3e1e4 100644 --- a/addon/components/admin/product-category.js +++ b/addon/components/admin/product-category.js @@ -1,3 +1,134 @@ import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; +import { dasherize } from '@ember/string'; +export default class AdminProductCategoryComponent extends Component { + @service store; + @service modalsManager; + @service currentUser; + @service modalsManager; + @service notifications; + @service fetch; + @service hostRouter; + @tracked categories = []; + @tracked selectedCategory; + @tracked isLoading = false; + @tracked buttonTitle = null; -export default class AdminProductCategoryComponent extends Component {} + constructor() { + super(...arguments); + this.category = this.args.category; + this.fetchCategories(); + } + + @action async addCategory() { + const category = this.store.createRecord('category', { + for: 'pallet_product', + }); + + this.modalsManager.show('modals/create-product-category', { + title: 'Create a new product category', + acceptButtonIcon: 'check', + acceptButtonIconPrefix: 'fas', + declineButtonIcon: 'times', + declineButtonIconPrefix: 'fas', + category, + uploadNewPhoto: (file) => { + this.fetch.uploadFile.perform( + file, + { + path: `uploads/${category.company_uuid}/product-category-icon/${dasherize(category.name ?? this.currentUser.companyId)}`, + subject_uuid: category.id, + subject_type: `category`, + type: `category_icon`, + }, + (uploadedFile) => { + category.setProperties({ + icon_file_uuid: uploadedFile.id, + icon_url: uploadedFile.url, + icon: uploadedFile, + }); + } + ); + }, + confirm: (modal) => { + modal.startLoading(); + + return category.save().then(() => { + this.notifications.success('New product category created.'); + return this.fetchCategories(); + }); + }, + }); + } + + @action async fetchCategories() { + this.categories = await this.store.query('category', { + for: 'pallet_product', + }); + } + + @action async addSubCategory(category) { + const subCategory = this.store.createRecord('category', { + for: 'pallet_product', + parent: category, + }); + + this.modalsManager.show('modals/create-product-category', { + title: 'Create a new subcategory', + acceptButtonIcon: 'check', + acceptButtonIconPrefix: 'fas', + declineButtonIcon: 'times', + declineButtonIconPrefix: 'fas', + category: subCategory, + uploadNewPhoto: (file) => { + this.fetch.uploadFile.perform( + file, + { + path: `uploads/${subCategory.company_uuid}/product-category-icon/${dasherize(subCategory.name ?? this.currentUser.companyId)}`, + subject_uuid: subCategory.id, + subject_type: `category`, + type: `category_icon`, + }, + (uploadedFile) => { + subCategory.setProperties({ + icon_file_uuid: uploadedFile.id, + icon_url: uploadedFile.url, + icon: uploadedFile, + }); + } + ); + }, + confirm: async (modal) => { + modal.startLoading(); + + try { + await subCategory.save(); + this.notifications.success('New subcategory created.'); + await this.fetchCategories(); + } catch (error) { + this.notifications.error('Error creating subcategory.'); + console.error('Error creating subcategory:', error); + } finally { + modal.stopLoading(); + } + }, + }); + } + + @action async deleteCategory(category) { + const confirmation = confirm(`Are you sure you want to delete the category "${category.name}"?`); + + if (confirmation) { + try { + await category.destroyRecord(); + this.notifications.success('Category deleted successfully.'); + await this.fetchCategories(); + } catch (error) { + this.notifications.error('Error deleting category.'); + console.error('Error deleting category:', error); + } + } + } +} diff --git a/addon/components/admin/visibility-controls.hbs b/addon/components/admin/visibility-controls.hbs deleted file mode 100644 index dc14590e..00000000 --- a/addon/components/admin/visibility-controls.hbs +++ /dev/null @@ -1,12 +0,0 @@ - -

Visibility controls allow you to disable sections of Pallet. Toggle the checkbox to enable or disable sections to hide in Pallet

- {{#each this.visibilitySettings as |visibilityControl|}} - - - - {{/each}} -
- -
-
\ No newline at end of file diff --git a/addon/components/admin/visibility-controls.js b/addon/components/admin/visibility-controls.js deleted file mode 100644 index e6ea41bd..00000000 --- a/addon/components/admin/visibility-controls.js +++ /dev/null @@ -1,81 +0,0 @@ -import Component from '@glimmer/component'; -import { tracked } from '@glimmer/tracking'; -import { inject as service } from '@ember/service'; -import { action } from '@ember/object'; -import { isArray } from '@ember/array'; - -export default class AdminVisibilityControlsComponent extends Component { - @service fetch; - @tracked visibilitySettings = [ - // { name: 'Dashboard', route: 'operations.orders', visible: true }, - { name: 'Products', route: 'products', visible: true }, - { name: 'Warehouses', route: 'warehouses', visible: true }, - { name: 'Suppliers', route: 'suppliers', visible: true }, - { name: 'Inventory', route: 'inventory', visible: true }, - { name: 'Sales Orders', route: 'sales-orders', visible: true }, - { name: 'Purchase Orders', route: 'purchase-orders', visible: true }, - { name: 'Audits', route: 'audits', visible: true }, - { name: 'Reports', route: 'reports', visible: true }, - ]; - @tracked isLoading = false; - - constructor() { - super(...arguments); - this.loadVisibilitySettings(); - } - - @action mutateVisibility(route, visible) { - this.visibilitySettings = [...this.visibilitySettings].map((visibilityControl) => { - if (visibilityControl.route === route) { - return { - ...visibilityControl, - visible, - }; - } - - return visibilityControl; - }); - } - - @action loadVisibilitySettings() { - this.isLoading = true; - - this.fetch - .get('pallet/settings/visibility') - .then(({ visibilitySettings }) => { - if (isArray(visibilitySettings)) { - for (let i = 0; i < visibilitySettings.length; i++) { - const visibilityControl = visibilitySettings.objectAt(i); - this.mutateVisibility(visibilityControl.route, visibilityControl.visible); - } - } - }) - .catch((error) => { - this.notifications.serverError(error); - }) - .finally(() => { - this.isLoading = false; - }); - } - - @action saveVisibilitySettings() { - this.isLoading = true; - - this.fetch - .post('pallet/settings/visibility', { visibilitySettings: this.visibilitySettings }) - .then(({ visibilitySettings }) => { - if (isArray(visibilitySettings)) { - for (let i = 0; i < visibilitySettings.length; i++) { - const visibilityControl = visibilitySettings.objectAt(i); - this.mutateVisibility(visibilityControl.route, visibilityControl.visible); - } - } - }) - .catch((error) => { - this.notifications.serverError(error); - }) - .finally(() => { - this.isLoading = false; - }); - } -} diff --git a/addon/controllers/admin/product-category.js b/addon/controllers/admin/product-category.js deleted file mode 100644 index 948d3a6e..00000000 --- a/addon/controllers/admin/product-category.js +++ /dev/null @@ -1,3 +0,0 @@ -import Controller from '@ember/controller'; - -export default class AdminProductCategoryController extends Controller {} diff --git a/addon/engine.js b/addon/engine.js index 944b547e..afbe46fa 100644 --- a/addon/engine.js +++ b/addon/engine.js @@ -3,7 +3,7 @@ import loadInitializers from 'ember-load-initializers'; import Resolver from 'ember-resolver'; import config from './config/environment'; import services from '@fleetbase/ember-core/exports/services'; -import AdminVisibilityControlsComponent from './components/admin/visibility-controls'; +import AdminProductCategoryComponent from './components/admin/product-category'; const { modulePrefix } = config; const externalRoutes = ['console', 'extensions']; @@ -17,37 +17,22 @@ export default class PalletEngine extends Engine { }; setupExtension = function (app, engine, universe) { // register menu item in header - universe.registerHeaderMenuItem('Pallet', 'console.pallet', { icon: 'pallet', priority: 0 }); + universe.registerHeaderMenuItem('Pallet', 'console.pallet', { icon: 'pallet', priority: 1 }); // register admin settings -- create a pallet menu panel with it's own setting options universe.registerAdminMenuPanel( 'Pallet Config', [ { - title: 'Visibility Controls', + title: 'Product Category', icon: 'eye', - component: AdminVisibilityControlsComponent, + component: AdminProductCategoryComponent, }, ], { slug: 'pallet', } ); - - // create primary registry for engine - universe.createRegistry('engine:pallet'); - - // register the product panel - universe.createRegistry('component:product-panel'); - - // register the inventory panel - universe.createRegistry('component:inventory-panel'); - - // register the supplier panel - universe.createRegistry('component:supplier-panel'); - - // register the warehouse panel - universe.createRegistry('component:warehouse-panel'); }; } diff --git a/addon/routes/admin/product-category.js b/addon/routes/admin/product-category.js deleted file mode 100644 index 0ada6d8f..00000000 --- a/addon/routes/admin/product-category.js +++ /dev/null @@ -1,24 +0,0 @@ -import Route from '@ember/routing/route'; -import { inject as service } from '@ember/service'; - -export default class AdminProductCategoryRoute extends Route { - @service store; - - queryParams = { - page: { refreshModel: true }, - limit: { refreshModel: true }, - sort: { refreshModel: true }, - query: { refreshModel: true }, - created_at: { refreshModel: true }, - }; - - /** - * Fetch the model data based on the specified parameters. - * - * @param {Object} params - Query parameters for fetching notifications. - * @returns {Promise} - A promise that resolves with the notification data. - */ - model(params = {}) { - return this.store.query('notification', params); - } -} diff --git a/addon/templates/admin/product-category.hbs b/addon/templates/admin/product-category.hbs deleted file mode 100644 index 4abdd78c..00000000 --- a/addon/templates/admin/product-category.hbs +++ /dev/null @@ -1,17 +0,0 @@ - -
+
+ {{category.name}} +
+
- {{#each this.categories as |subCategory|}} - {{#if (and (eq subCategory.parent.id category.id) (not (eq subCategory.id category.id)))}} -
- {{subCategory.name}} -
-
+ + {{#if category.subcategories}} +
    + {{#each category.subcategories as |subCategory|}} +
    +
  • {{subCategory.name}}
  • +
    +
    -
- {{/if}} - {{/each}} + {{/each}} + + {{/if}} {{/each}}
diff --git a/addon/components/admin/product-category.js b/addon/components/admin/product-category.js index f7c3e1e4..27ec16de 100644 --- a/addon/components/admin/product-category.js +++ b/addon/components/admin/product-category.js @@ -3,6 +3,7 @@ import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { dasherize } from '@ember/string'; + export default class AdminProductCategoryComponent extends Component { @service store; @service modalsManager; @@ -19,7 +20,7 @@ export default class AdminProductCategoryComponent extends Component { constructor() { super(...arguments); this.category = this.args.category; - this.fetchCategories(); + this.fetchCategoryHierarchy(); } @action async addCategory() { @@ -57,22 +58,28 @@ export default class AdminProductCategoryComponent extends Component { return category.save().then(() => { this.notifications.success('New product category created.'); - return this.fetchCategories(); + return this.fetchCategoryHierarchy(); }); }, }); } - @action async fetchCategories() { - this.categories = await this.store.query('category', { + @action async fetchCategoryHierarchy() { + const allCategories = await this.store.query('category', { for: 'pallet_product', + with_subcategories: true, + }); + + this.categories = allCategories.filter((category) => !category.parent); + this.categories.forEach((parentCategory) => { + parentCategory.subcategories = allCategories.filter((subcategory) => subcategory.parent?.id === parentCategory.id); }); } - @action async addSubCategory(category) { + @action async addSubCategory(parentCategory) { const subCategory = this.store.createRecord('category', { + parent: parentCategory, for: 'pallet_product', - parent: category, }); this.modalsManager.show('modals/create-product-category', { @@ -86,13 +93,13 @@ export default class AdminProductCategoryComponent extends Component { this.fetch.uploadFile.perform( file, { - path: `uploads/${subCategory.company_uuid}/product-category-icon/${dasherize(subCategory.name ?? this.currentUser.companyId)}`, - subject_uuid: subCategory.id, + path: `uploads/${category.company_uuid}/product-category-icon/${dasherize(category.name ?? this.currentUser.companyId)}`, + subject_uuid: category.id, subject_type: `category`, type: `category_icon`, }, (uploadedFile) => { - subCategory.setProperties({ + category.setProperties({ icon_file_uuid: uploadedFile.id, icon_url: uploadedFile.url, icon: uploadedFile, @@ -106,12 +113,10 @@ export default class AdminProductCategoryComponent extends Component { try { await subCategory.save(); this.notifications.success('New subcategory created.'); - await this.fetchCategories(); + await this.fetchCategoryHierarchy(); } catch (error) { this.notifications.error('Error creating subcategory.'); console.error('Error creating subcategory:', error); - } finally { - modal.stopLoading(); } }, }); @@ -124,7 +129,7 @@ export default class AdminProductCategoryComponent extends Component { try { await category.destroyRecord(); this.notifications.success('Category deleted successfully.'); - await this.fetchCategories(); + await this.fetchCategoryHierarchy(); } catch (error) { this.notifications.error('Error deleting category.'); console.error('Error deleting category:', error); From 47ac23a2448577cb4991345914a731eba730b6cf Mon Sep 17 00:00:00 2001 From: Turtuvshin Date: Wed, 13 Mar 2024 15:21:16 +0800 Subject: [PATCH 4/4] Remove unused context component utilities and imported from ember-core `applyContextComponentArguments`, `contextComponentCallback` functions moved to `ember-core` for shared usage. --- addon/components/batch-form-panel.js | 4 +-- addon/components/batch-panel.js | 4 +-- addon/components/inventory-form-panel.js | 4 +-- addon/components/inventory-panel.js | 4 +-- addon/components/product-form-panel.js | 4 +-- addon/components/product-panel.js | 4 +-- addon/components/purchase-order-form-panel.js | 4 +-- addon/components/purchase-order-panel.js | 4 +-- addon/components/sales-order-form-panel.js | 4 +-- addon/components/sales-order-panel.js | 4 +-- .../components/stock-adjustment-form-panel.js | 4 +-- addon/components/supplier-form-panel.js | 4 +-- addon/components/supplier-panel.js | 4 +-- addon/components/warehouse-form-panel.js | 4 +-- addon/components/warehouse-panel.js | 4 +-- .../apply-context-component-arguments.js | 31 ------------------- addon/utils/context-component-callback.js | 16 ---------- .../apply-context-component-arguments.js | 1 - app/utils/context-component-callback.js | 1 - .../apply-context-component-arguments-test.js | 10 ------ .../utils/context-component-callback-test.js | 10 ------ 21 files changed, 30 insertions(+), 99 deletions(-) delete mode 100644 addon/utils/apply-context-component-arguments.js delete mode 100644 addon/utils/context-component-callback.js delete mode 100644 app/utils/apply-context-component-arguments.js delete mode 100644 app/utils/context-component-callback.js delete mode 100644 tests/unit/utils/apply-context-component-arguments-test.js delete mode 100644 tests/unit/utils/context-component-callback-test.js diff --git a/addon/components/batch-form-panel.js b/addon/components/batch-form-panel.js index ce7e6444..a43f1fda 100644 --- a/addon/components/batch-form-panel.js +++ b/addon/components/batch-form-panel.js @@ -2,8 +2,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class BatchFormPanelComponent extends Component { /** diff --git a/addon/components/batch-panel.js b/addon/components/batch-panel.js index 7e339641..8948e80b 100644 --- a/addon/components/batch-panel.js +++ b/addon/components/batch-panel.js @@ -4,8 +4,8 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { isArray } from '@ember/array'; import BatchPanelDetailsComponent from './batch-panel/details'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class BatchPanelComponent extends Component { /** diff --git a/addon/components/inventory-form-panel.js b/addon/components/inventory-form-panel.js index ea8c63b3..568ccdf7 100644 --- a/addon/components/inventory-form-panel.js +++ b/addon/components/inventory-form-panel.js @@ -2,8 +2,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class InventoryFormPanelComponent extends Component { /** diff --git a/addon/components/inventory-panel.js b/addon/components/inventory-panel.js index a15c4be1..5a3e73fc 100644 --- a/addon/components/inventory-panel.js +++ b/addon/components/inventory-panel.js @@ -4,8 +4,8 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { isArray } from '@ember/array'; import InventoryPanelDetailsComponent from './inventory-panel/details'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class InventoryPanelComponent extends Component { /** diff --git a/addon/components/product-form-panel.js b/addon/components/product-form-panel.js index c19d1a1c..f7323b69 100644 --- a/addon/components/product-form-panel.js +++ b/addon/components/product-form-panel.js @@ -3,8 +3,8 @@ import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import getWithDefault from '@fleetbase/ember-core/utils/get-with-default'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class ProductFormPanelComponent extends Component { /** diff --git a/addon/components/product-panel.js b/addon/components/product-panel.js index d6e47057..90bf16ee 100644 --- a/addon/components/product-panel.js +++ b/addon/components/product-panel.js @@ -4,8 +4,8 @@ import { action } from '@ember/object'; import { inject as service } from '@ember/service'; import { isArray } from '@ember/array'; import ProductPanelDetailComponent from './product-panel/details'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class ProductPanelComponent extends Component { /** diff --git a/addon/components/purchase-order-form-panel.js b/addon/components/purchase-order-form-panel.js index 3e56a19e..a6adead9 100644 --- a/addon/components/purchase-order-form-panel.js +++ b/addon/components/purchase-order-form-panel.js @@ -2,8 +2,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class PurchaseOrderFormPanelComponent extends Component { /** diff --git a/addon/components/purchase-order-panel.js b/addon/components/purchase-order-panel.js index 5b940b34..0ccb208e 100644 --- a/addon/components/purchase-order-panel.js +++ b/addon/components/purchase-order-panel.js @@ -4,8 +4,8 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { isArray } from '@ember/array'; import PurchaseOrderPanelDetailsComponent from './purchase-order-panel/details'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class PurchaseOrderPanelComponent extends Component { /** diff --git a/addon/components/sales-order-form-panel.js b/addon/components/sales-order-form-panel.js index 52c07fe9..25e7635c 100644 --- a/addon/components/sales-order-form-panel.js +++ b/addon/components/sales-order-form-panel.js @@ -3,8 +3,8 @@ import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { isValid as isValidDate } from 'date-fns'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class SalesOrderFormPanelComponent extends Component { /** diff --git a/addon/components/sales-order-panel.js b/addon/components/sales-order-panel.js index 21ce38a7..bdfeef3b 100644 --- a/addon/components/sales-order-panel.js +++ b/addon/components/sales-order-panel.js @@ -4,8 +4,8 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { isArray } from '@ember/array'; import SalesOrderPanelDetailsComponent from './sales-order-panel/details'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class SalesOrderPanelComponent extends Component { /** diff --git a/addon/components/stock-adjustment-form-panel.js b/addon/components/stock-adjustment-form-panel.js index 622f72cd..45410a98 100644 --- a/addon/components/stock-adjustment-form-panel.js +++ b/addon/components/stock-adjustment-form-panel.js @@ -2,8 +2,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class StockAdjustmentFormPanelComponent extends Component { /** diff --git a/addon/components/supplier-form-panel.js b/addon/components/supplier-form-panel.js index ca5e3c9e..38d5ee86 100644 --- a/addon/components/supplier-form-panel.js +++ b/addon/components/supplier-form-panel.js @@ -2,8 +2,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class SupplierFormPanelComponent extends Component { /** diff --git a/addon/components/supplier-panel.js b/addon/components/supplier-panel.js index a1866af0..efa9b2e0 100644 --- a/addon/components/supplier-panel.js +++ b/addon/components/supplier-panel.js @@ -4,8 +4,8 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { isArray } from '@ember/array'; import SupplierPanelDetailsComponent from './supplier-panel/details'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class SupplierPanelComponent extends Component { /** diff --git a/addon/components/warehouse-form-panel.js b/addon/components/warehouse-form-panel.js index 21b47520..b57c7625 100644 --- a/addon/components/warehouse-form-panel.js +++ b/addon/components/warehouse-form-panel.js @@ -5,8 +5,8 @@ import { action } from '@ember/object'; import { isBlank } from '@ember/utils'; import { all } from 'rsvp'; import Point from '@fleetbase/fleetops-data/utils/geojson/point'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class WarehouseFormPanelComponent extends Component { /** diff --git a/addon/components/warehouse-panel.js b/addon/components/warehouse-panel.js index a60e52ff..60dfad3a 100644 --- a/addon/components/warehouse-panel.js +++ b/addon/components/warehouse-panel.js @@ -4,8 +4,8 @@ import { action } from '@ember/object'; import { inject as service } from '@ember/service'; import { isArray } from '@ember/array'; import WarehousePanelDetailComponent from './warehouse-panel/details'; -import contextComponentCallback from '../utils/context-component-callback'; -import applyContextComponentArguments from '../utils/apply-context-component-arguments'; +import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; +import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; export default class WarehousePanelComponent extends Component { /** diff --git a/addon/utils/apply-context-component-arguments.js b/addon/utils/apply-context-component-arguments.js deleted file mode 100644 index a715a6fb..00000000 --- a/addon/utils/apply-context-component-arguments.js +++ /dev/null @@ -1,31 +0,0 @@ -import getModelName from '@fleetbase/ember-core/utils/get-model-name'; - -/** - * Applies context and dynamic arguments to a given component. - * - * @param {Component} component - The component to which context and arguments will be applied. - */ -export default function applyContextComponentArguments(component) { - const { context, dynamicArgs = {} } = component.args; - - // Apply context model if available - if (context) { - const contextModelName = getModelName(context); - if (contextModelName) { - component[contextModelName] = context; - } - } - - // Execute any apply callback present in dynamic arguments - const { applyCallback } = dynamicArgs; - if (typeof applyCallback === 'function') { - applyCallback(component); - } - - // Apply other dynamic arguments to the component - for (const [key, value] of Object.entries(dynamicArgs)) { - if (key !== 'applyCallback') { - component[key] = value; - } - } -} diff --git a/addon/utils/context-component-callback.js b/addon/utils/context-component-callback.js deleted file mode 100644 index a31c2a30..00000000 --- a/addon/utils/context-component-callback.js +++ /dev/null @@ -1,16 +0,0 @@ -export default function contextComponentCallback(component, name, ...params) { - let callbackInvoked = false; - - if (typeof component.args[name] === 'function') { - component.args[name](...params); - callbackInvoked = true; - } - - // now do for context options - if (typeof component.args.options === 'object' && typeof component.args.options[name] === 'function') { - component.args.options[name](...params); - callbackInvoked = true; - } - - return callbackInvoked; -} diff --git a/app/utils/apply-context-component-arguments.js b/app/utils/apply-context-component-arguments.js deleted file mode 100644 index ba44c2f2..00000000 --- a/app/utils/apply-context-component-arguments.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@fleetbase/pallet-engine/utils/apply-context-component-arguments'; diff --git a/app/utils/context-component-callback.js b/app/utils/context-component-callback.js deleted file mode 100644 index 88cc0cb7..00000000 --- a/app/utils/context-component-callback.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@fleetbase/pallet-engine/utils/context-component-callback'; diff --git a/tests/unit/utils/apply-context-component-arguments-test.js b/tests/unit/utils/apply-context-component-arguments-test.js deleted file mode 100644 index 17998ef4..00000000 --- a/tests/unit/utils/apply-context-component-arguments-test.js +++ /dev/null @@ -1,10 +0,0 @@ -import applyContextComponentArguments from 'dummy/utils/apply-context-component-arguments'; -import { module, test } from 'qunit'; - -module('Unit | Utility | apply-context-component-arguments', function () { - // TODO: Replace this with your real tests. - test('it works', function (assert) { - let result = applyContextComponentArguments(); - assert.ok(result); - }); -}); diff --git a/tests/unit/utils/context-component-callback-test.js b/tests/unit/utils/context-component-callback-test.js deleted file mode 100644 index b0855fb9..00000000 --- a/tests/unit/utils/context-component-callback-test.js +++ /dev/null @@ -1,10 +0,0 @@ -import contextComponentCallback from 'dummy/utils/context-component-callback'; -import { module, test } from 'qunit'; - -module('Unit | Utility | context-component-callback', function () { - // TODO: Replace this with your real tests. - test('it works', function (assert) { - let result = contextComponentCallback(); - assert.ok(result); - }); -});