@fleetbase/pallet-engine
Version:
Inventory & Warehouse Management Extension for Fleetbase
56 lines (50 loc) • 1.39 kB
JavaScript
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ProductsIndexDetailsController extends Controller {
/**
* The currently active view tab ('details' by default).
*
* @type {String}
* @tracked
*/
view = 'details';
/**
* An array of query parameters to be serialized in the URL.
*
* @type {String[]}
* @tracked
*/
queryParams = ['view'];
/**
* Transitions back to the "products.index" route.
*
* @method
* @action
* @returns {Transition} The transition object representing the route change.
*/
transitionBack() {
return this.transitionToRoute('products.index');
}
/**
* Transitions to the edit view for a specific product.
*
* @method
* @param {productModel} product - The product to be edited.
* @action
* @returns {Transition} The transition object representing the route change.
*/
onEdit(product) {
return this.transitionToRoute('products.index.edit', product);
}
/**
* Updates the active view tab.
*
* @method
* @param {String} tab - The name of the tab to activate.
* @action
*/
onTabChanged(tab) {
this.view = tab;
}
}