From b4e5631cc74de784388c0fca3ac9d6b3b5af17ca Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 16 Mar 2022 14:58:07 +0100 Subject: [PATCH] feat(item_fixed-price): implement smart-table --- front/core/components/smart-table/table.scss | 4 + modules/item/front/fixed-price/index.html | 312 +++++++++---------- modules/item/front/fixed-price/index.js | 31 +- modules/item/front/fixed-price/index.spec.js | 15 + modules/item/front/fixed-price/style.scss | 5 - 5 files changed, 202 insertions(+), 165 deletions(-) diff --git a/front/core/components/smart-table/table.scss b/front/core/components/smart-table/table.scss index c38c149ca3..95d8efb49b 100644 --- a/front/core/components/smart-table/table.scss +++ b/front/core/components/smart-table/table.scss @@ -37,6 +37,10 @@ smart-table table { &[centered] { text-align: center; } + &[mid] { + width: 150px; + max-width: 150px; + } &[shrink] { width: 1px; text-align: center; diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index 34d63ffe2f..d531774a00 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -3,8 +3,8 @@ url="FixedPrices/filter" limit="20" data="prices" - auto-load="true" - order="itemFk"> + order="itemFk" + auto-load="false">
- - - - Item ID - Description - Warehouse - - P.P.U. - - - P.P.P. - - - Min price - Started - Ended - - - - - - - {{price.itemFk}} - - - {{::id}} - {{::name}} - - - - -
- - {{price.name}} - - -

{{price.subName}}

-
-
- - -
- - - - - - {{price.rate2 | currency: 'EUR':2}} - - - - - - - {{price.rate3 | currency: 'EUR':2}} - - - - - - - - - - - {{price.minPrice | currency: 'EUR':2}} - - - - - - - - - - - - - - - - - -
-
-
-
- - -
- - + options="$ctrl.smartTableOptions" + expr-builder="$ctrl.exprBuilder(param, value)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Item ID + + Description + + Warehouse + + P.P.U. + + P.P.P. + + Min price + + Started + + Ended +
+ + + {{::id}} + + + +
+ + {{price.name}} + + +

{{price.subName}}

+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + +
+
{ controller = $componentController('vnFixedPrice', {$element, $scope}); })); + describe('$onInit()', () => { + it('should perform a query to GET warehouses', () => { + $httpBackend.expectGET('Warehouses').respond('foo'); + + controller.$onInit(); + $httpBackend.flush(); + + expect(controller.warehousesData).toBe('foo'); + }); + }); + describe('upsertPrice()', () => { it('should do nothing if one or more required arguments are missing', () => { jest.spyOn(controller.vnApp, 'showSuccess'); @@ -55,6 +66,10 @@ describe('fixed price', () => { jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.$.model, 'remove'); + // $httpBackend.whenRoute('GET', 'Warehouses').respond(); + // $httpBackend.when('GET', 'Warehouses').respond(); + $httpBackend.expectGET('Warehouses').respond(); + controller.removePrice($index); expect(controller.vnApp.showSuccess).not.toHaveBeenCalled(); diff --git a/modules/item/front/fixed-price/style.scss b/modules/item/front/fixed-price/style.scss index 74df1800a6..e69de29bb2 100644 --- a/modules/item/front/fixed-price/style.scss +++ b/modules/item/front/fixed-price/style.scss @@ -1,5 +0,0 @@ -@import "variables"; - -vn-table vn-date-picker { - max-width: 90px; -} \ No newline at end of file