-
+
Id
@@ -81,7 +73,7 @@
{{::zone.id}}
diff --git a/modules/zone/front/delivery-days/index.js b/modules/zone/front/delivery-days/index.js
index 12b1c57b1..21c65678f 100644
--- a/modules/zone/front/delivery-days/index.js
+++ b/modules/zone/front/delivery-days/index.js
@@ -74,33 +74,14 @@ class Controller extends Section {
zonesIds.push(event.zoneFk);
this.$.zoneEvents.show($event.target);
- const zoneModel = this.$.zoneModel;
- zoneModel.applyFilter({
- include: [
- {
- relation: 'agencyMode',
- scope: {fields: ['name']}
- },
- {
- relation: 'events',
- scope: {
- where: {dated: day}
- }
- },
- ],
- where: {
- id: {inq: zonesIds}
- }
- }).then(() => {
- const data = zoneModel.data;
- for (let row of data) {
- const [event] = row.events;
- if (event && event.hour)
- row.hour = event.hour;
- if (event && event.price)
- row.price = event.price;
- }
- });
+
+ const params = {
+ zonesId: zonesIds,
+ date: day
+ };
+
+ this.$http.post(`Zones/getZoneClosing`, params)
+ .then(res => this.zoneClosing = res.data);
}
preview(zone) {
diff --git a/modules/zone/front/delivery-days/index.spec.js b/modules/zone/front/delivery-days/index.spec.js
index c896021ed..3d71bc93f 100644
--- a/modules/zone/front/delivery-days/index.spec.js
+++ b/modules/zone/front/delivery-days/index.spec.js
@@ -96,46 +96,31 @@ describe('Zone Component vnZoneDeliveryDays', () => {
expect(controller.$.zoneEvents.show).not.toHaveBeenCalled();
});
- it('should call the show() method and then call the applyFilter() method with the expected ids', () => {
- const zoneModel = controller.$.zoneModel;
+ it('should call the show() method and call getZoneClosing() with the expected ids', () => {
jest.spyOn(controller.$.zoneEvents, 'show');
- jest.spyOn(zoneModel, 'applyFilter').mockReturnValue(new Promise(resolve => {
- zoneModel.data = [
- {id: 1, events: [{price: 25}]}
- ];
- }));
const event = new Event('click');
const target = document.createElement('div');
target.dispatchEvent(event);
+
+ const day = new Date();
const events = [
{zoneFk: 1},
{zoneFk: 2},
{zoneFk: 8}
];
-
- const day = new Date();
- controller.onSelection(event, events, [day]);
- const expectedFilter = {
- include: [
- {
- relation: 'agencyMode',
- scope: {fields: ['name']}
- },
- {
- relation: 'events',
- scope: {
- where: {dated: day}
- }
- }
- ],
- where: {
- id: {inq: [1, 2, 8]}
- }
+ const params = {
+ zonesId: [1, 2, 8],
+ date: [day][0]
};
+ const response = [{id: 1, hour: ''}];
+
+ $httpBackend.when('POST', 'Zones/getZoneClosing', params).respond({response});
+ controller.onSelection(event, events, [day]);
+ $httpBackend.flush();
expect(controller.$.zoneEvents.show).toHaveBeenCalledWith(target);
- expect(zoneModel.applyFilter).toHaveBeenCalledWith(expectedFilter);
+ expect(controller.zoneClosing.id).toEqual(response.id);
});
});
});
diff --git a/modules/zone/front/upcoming-deliveries/style.scss b/modules/zone/front/upcoming-deliveries/style.scss
index d3f33260a..b52231a09 100644
--- a/modules/zone/front/upcoming-deliveries/style.scss
+++ b/modules/zone/front/upcoming-deliveries/style.scss
@@ -15,6 +15,7 @@ vn-upcoming-deliveries {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ background-color: $color-bg;
}
vn-table vn-th.waste-family,