Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
f65e0cd5bf
|
@ -262,10 +262,12 @@ export default class Calendar extends Component {
|
|||
*/
|
||||
select(index) {
|
||||
if (this.disabled) return;
|
||||
let day = this.days[index];
|
||||
day.index = index;
|
||||
let day = this.days[index].dated;
|
||||
|
||||
this.emit('selection', {values: [day]});
|
||||
this.emit('selection', {
|
||||
$days: [day],
|
||||
$type: 'day'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,15 +278,17 @@ export default class Calendar extends Component {
|
|||
selectAll(weekday) {
|
||||
if (this.disabled) return;
|
||||
|
||||
let selected = [];
|
||||
let days = [];
|
||||
for (let i in this.days) {
|
||||
const day = this.days[i];
|
||||
const date = day.dated;
|
||||
day.index = i;
|
||||
if (date.getDay() === weekday && date.getMonth() == this.defaultDate.getMonth())
|
||||
selected.push(day);
|
||||
const day = this.days[i].dated;
|
||||
if (day.getDay() === weekday && day.getMonth() == this.defaultDate.getMonth())
|
||||
days.push(day);
|
||||
}
|
||||
this.emit('selection', {values: selected});
|
||||
this.emit('selection', {
|
||||
$days: days,
|
||||
$type: 'weekday',
|
||||
$weekday: weekday
|
||||
});
|
||||
}
|
||||
|
||||
renderStyle(style) {
|
||||
|
|
|
@ -60,12 +60,17 @@ describe('Component vnCalendar', () => {
|
|||
describe('select()', () => {
|
||||
it(`should return the selected element, then emit a 'selection' event`, () => {
|
||||
spyOn(controller, 'emit');
|
||||
const days = [{dated: new Date()}];
|
||||
const dated = new Date();
|
||||
const days = [{dated}];
|
||||
controller.days = days;
|
||||
|
||||
controller.select(0);
|
||||
|
||||
expect(controller.emit).toHaveBeenCalledWith('selection', {values: days});
|
||||
let res = {
|
||||
$days: [dated],
|
||||
$type: 'day'
|
||||
};
|
||||
|
||||
expect(controller.emit).toHaveBeenCalledWith('selection', res);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
import Component from './component';
|
||||
|
||||
/**
|
||||
* Class with commonly injected services assigned as properties. It also has
|
||||
* abbreviations for commonly used methods like tranlation.
|
||||
*
|
||||
* @property {Object} $translate Angular tranlation service
|
||||
* @property {Object} $http Angular HTTP service
|
||||
* @property {Object} $state Router state service
|
||||
* @property {Object} $stateParams Router state parameters
|
||||
*/
|
||||
export default class Section extends Component {
|
||||
constructor($element, $scope, $translate, $http, $state) {
|
||||
super($element, $scope);
|
||||
Object.assign(this, {
|
||||
$translate,
|
||||
$http,
|
||||
$state,
|
||||
$stateParams: $state.params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates an string.
|
||||
*
|
||||
* @param {String} string String to translate
|
||||
* @param {Array} params Translate parameters
|
||||
* @return {String} The translated string
|
||||
*/
|
||||
_(string, params) {
|
||||
return this.$translate.instant(string, params, );
|
||||
}
|
||||
}
|
||||
Section.$inject = ['$element', '$scope', '$translate', '$http', '$state'];
|
|
@ -15,3 +15,4 @@ import './descriptor.scss';
|
|||
import './list.scss';
|
||||
import './modal-form.scss';
|
||||
import './photo-list.scss';
|
||||
import './width.scss';
|
||||
|
|
|
@ -99,11 +99,6 @@ html [pointer], .pointer{
|
|||
html [noDrop], .noDrop{
|
||||
cursor: no-drop;
|
||||
}
|
||||
html [compact], .compact{
|
||||
max-width: $width-compact;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
button {
|
||||
@extend %clickable;
|
||||
}
|
||||
|
@ -147,6 +142,12 @@ fieldset[disabled] .mdl-textfield .mdl-textfield__label,
|
|||
font-size: 0.7em
|
||||
}
|
||||
}
|
||||
[compact], .compact {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: $width-md;
|
||||
}
|
||||
|
||||
.vn-grid {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
|
|
|
@ -5,9 +5,11 @@ $mobile-width: 800px;
|
|||
|
||||
// Width
|
||||
|
||||
$width-small: 36em;
|
||||
$width-compact: 60em;
|
||||
$width-large: 80em;
|
||||
$width-xs: 25em;
|
||||
$width-sm: 32em;
|
||||
$width-md: 60em;
|
||||
$width-lg: 80em;
|
||||
$width-xl: 100em;
|
||||
|
||||
// Padding
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
@import "./variables";
|
||||
|
||||
%margin-auto {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.vn-w-xs {
|
||||
@extend %margin-auto;
|
||||
max-width: $width-xs;
|
||||
}
|
||||
.vn-w-sm {
|
||||
@extend %margin-auto;
|
||||
max-width: $width-sm;
|
||||
}
|
||||
.vn-w-md {
|
||||
@extend %margin-auto;
|
||||
max-width: $width-md;
|
||||
}
|
||||
.vn-w-lg {
|
||||
@extend %margin-auto;
|
||||
max-width: $width-lg;
|
||||
}
|
||||
.vn-w-xl {
|
||||
@extend %margin-auto;
|
||||
max-width: $width-xl;
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
skip="2"
|
||||
has-events="$ctrl.hasEvents($day)"
|
||||
get-class="$ctrl.getClass($day)"
|
||||
on-selection="$ctrl.onSelection($days, $type, $weekday)"
|
||||
on-move-next="ndMonth.moveNext(2)"
|
||||
on-move-previous="ndMonth.movePrevious(2)"
|
||||
vn-acl="deliveryBoss"
|
||||
|
@ -13,6 +14,7 @@
|
|||
skip="2"
|
||||
has-events="$ctrl.hasEvents($day)"
|
||||
get-class="$ctrl.getClass($day)"
|
||||
on-selection="$ctrl.onSelection($days, $type, $weekday)"
|
||||
default-date="$ctrl.ndMonthDate"
|
||||
vn-acl="deliveryBoss"
|
||||
display-controls="false"
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'core/lib/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($, $stateParams) {
|
||||
Object.assign(this, {
|
||||
$,
|
||||
$stateParams
|
||||
});
|
||||
class Controller extends Section {
|
||||
constructor($el, $, $t, $http, $state) {
|
||||
super($el, $, $t, $http, $state);
|
||||
|
||||
this.excls = {};
|
||||
this.resetEvents();
|
||||
|
@ -14,6 +12,10 @@ class Controller {
|
|||
this.ndMonthDate.setMonth(this.ndMonthDate.getMonth() + 1);
|
||||
}
|
||||
|
||||
onSelection($days, $type, $weekday) {
|
||||
this.emit('selection', {$days, $type, $weekday});
|
||||
}
|
||||
|
||||
resetEvents() {
|
||||
this.wdays = [];
|
||||
this.days = {};
|
||||
|
@ -96,8 +98,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$stateParams'];
|
||||
|
||||
ngModule.component('vnZoneCalendar', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
<vn-zone-descriptor zone="$ctrl.zone"></vn-zone-descriptor>
|
||||
<vn-left-menu></vn-left-menu>
|
||||
</vn-side-menu>
|
||||
<div class="content-block" ui-view></div>
|
||||
<div ui-view></div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="main-with-right-menu">
|
||||
<div class="vn-list" style="max-width: 30em;">
|
||||
<div class="vn-list vn-w-sm">
|
||||
<vn-card ng-if="data.length">
|
||||
<a
|
||||
ng-repeat="row in data"
|
||||
|
@ -64,23 +64,16 @@
|
|||
<vn-side-menu side="right">
|
||||
<vn-zone-calendar
|
||||
events="data"
|
||||
exclusions="exclusions">
|
||||
exclusions="exclusions"
|
||||
on-selection="$ctrl.onCreate($days, $type, $weekday)">
|
||||
</vn-zone-calendar>
|
||||
</vn-side-menu>
|
||||
<vn-float-button
|
||||
icon="add"
|
||||
translate-attr="{title: 'Add'}"
|
||||
vn-bind="+"
|
||||
ng-click="$ctrl.onCreate()"
|
||||
fixed-bottom-right
|
||||
style="z-index: 10;">
|
||||
</vn-float-button>
|
||||
<vn-dialog
|
||||
vn-id="dialog"
|
||||
on-response="$ctrl.onSave(response)">
|
||||
<tpl-body>
|
||||
<vn-vertical>
|
||||
<vn-vertical>
|
||||
<vn-vertical pad-medium-bottom>
|
||||
<vn-radio
|
||||
field="$ctrl.eventType"
|
||||
label="One day"
|
||||
|
@ -88,13 +81,13 @@
|
|||
</vn-radio>
|
||||
<vn-radio
|
||||
field="$ctrl.eventType"
|
||||
label="Range of dates"
|
||||
val="range">
|
||||
label="Indefinitely"
|
||||
val="indefinitely">
|
||||
</vn-radio>
|
||||
<vn-radio
|
||||
field="$ctrl.eventType"
|
||||
label="Indefinitely"
|
||||
val="indefinitely">
|
||||
label="Range of dates"
|
||||
val="range">
|
||||
</vn-radio>
|
||||
</vn-vertical>
|
||||
<div
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'core/lib/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($, _, $http, $stateParams) {
|
||||
Object.assign(this, {
|
||||
$,
|
||||
_,
|
||||
$http
|
||||
});
|
||||
class Controller extends Section {
|
||||
constructor($el, $, $t, $http, $state) {
|
||||
super($el, $, $t, $http, $state);
|
||||
|
||||
this.wdays = [
|
||||
{
|
||||
|
@ -36,15 +33,15 @@ class Controller {
|
|||
|
||||
this.abrWdays = {};
|
||||
for (let wday of this.wdays) {
|
||||
let locale = _.instant(wday.name);
|
||||
let locale = this._(wday.name);
|
||||
this.abrWdays[wday.code] = locale.substr(0, 3);
|
||||
wday.abr = locale.substr(0, 1);
|
||||
}
|
||||
|
||||
this.$http.get(`/api/Zones/${$stateParams.id}/exclusions`)
|
||||
this.$http.get(`/api/Zones/${this.$stateParams.id}/exclusions`)
|
||||
.then(res => this.$.exclusions = res.data);
|
||||
|
||||
this.path = `/api/Zones/${$stateParams.id}/events`;
|
||||
this.path = `/api/Zones/${this.$stateParams.id}/events`;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
@ -89,10 +86,19 @@ class Controller {
|
|||
this.$.dialog.show();
|
||||
}
|
||||
|
||||
onCreate() {
|
||||
onCreate($day, $type, $weekday) {
|
||||
this.isNew = true;
|
||||
this.eventType = 'day';
|
||||
this.selected = {};
|
||||
this.eventType = $type == 'day' ? 'day' : 'indefinitely';
|
||||
|
||||
if ($type == 'weekday') {
|
||||
let wdays = [];
|
||||
let index = $weekday - 1;
|
||||
if (index < 0) index = 7 - index;
|
||||
wdays[this.wdays[index].code] = true;
|
||||
this.selected = {wdays};
|
||||
} else
|
||||
this.selected = {from: $day[0]};
|
||||
|
||||
this.$.dialog.show();
|
||||
}
|
||||
|
||||
|
@ -153,7 +159,6 @@ class Controller {
|
|||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope', '$translate', '$http', '$stateParams'];
|
||||
|
||||
ngModule.component('vnZoneEvents', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
<vn-card
|
||||
ng-if="data.length"
|
||||
style="max-width: 25em; margin: 0 auto;">
|
||||
<vn-table>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="row in data | orderBy:'day'">
|
||||
<vn-td>{{::row.day | dateTime:'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td style="width: 1px; text-align: center">
|
||||
<vn-icon-button
|
||||
icon="delete"
|
||||
translate-attr="{title: 'Delete'}"
|
||||
ng-click="$ctrl.onDelete($index)">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
<vn-bg-title ng-if="!data">
|
||||
<vn-spinner enable="true"></vn-spinner>
|
||||
</vn-bg-title>
|
||||
<vn-bg-title ng-if="data.length == 0" translate>
|
||||
No records found
|
||||
</vn-bg-title>
|
||||
<vn-float-button
|
||||
icon="add"
|
||||
translate-attr="{title: 'Add'}"
|
||||
vn-bind="+"
|
||||
ng-click="$ctrl.onCreate()"
|
||||
fixed-bottom-right>
|
||||
</vn-float-button>
|
||||
<div class="main-with-right-menu">
|
||||
<vn-card ng-if="data.length" class="vn-w-xs">
|
||||
<vn-table>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="row in data | orderBy:'day'">
|
||||
<vn-td>{{::row.day | dateTime:'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td style="width: 1px; text-align: center">
|
||||
<vn-icon-button
|
||||
icon="delete"
|
||||
translate-attr="{title: 'Delete'}"
|
||||
ng-click="$ctrl.onDelete(row.id)">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
<vn-bg-title ng-if="!data">
|
||||
<vn-spinner enable="true"></vn-spinner>
|
||||
</vn-bg-title>
|
||||
<vn-bg-title ng-if="data.length == 0" translate>
|
||||
No records found
|
||||
</vn-bg-title>
|
||||
</div>
|
||||
<vn-side-menu side="right">
|
||||
<vn-zone-calendar
|
||||
events="events"
|
||||
exclusions="data"
|
||||
on-selection="$ctrl.onCreate($days)">
|
||||
</vn-zone-calendar>
|
||||
</vn-side-menu>
|
||||
<vn-dialog
|
||||
vn-id="dialog"
|
||||
on-response="$ctrl.onSave(response)">
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'core/lib/section';
|
||||
|
||||
class Controller {
|
||||
constructor($, $http, $stateParams) {
|
||||
Object.assign(this, {
|
||||
$,
|
||||
$http
|
||||
});
|
||||
class Controller extends Section {
|
||||
constructor($el, $, $t, $http, $state) {
|
||||
super($el, $, $t, $http, $state);
|
||||
|
||||
this.path = `/api/Zones/${$stateParams.id}/exclusions`;
|
||||
this.$http.get(`/api/Zones/${this.$stateParams.id}/events`)
|
||||
.then(res => this.$.events = res.data);
|
||||
|
||||
this.path = `/api/Zones/${this.$stateParams.id}/exclusions`;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
@ -16,9 +17,9 @@ class Controller {
|
|||
.then(res => this.$.data = res.data);
|
||||
}
|
||||
|
||||
onCreate() {
|
||||
onCreate($days) {
|
||||
this.isNew = true;
|
||||
this.selected = {};
|
||||
this.selected = {day: $days[0]};
|
||||
this.$.dialog.show();
|
||||
}
|
||||
|
||||
|
@ -36,23 +37,21 @@ class Controller {
|
|||
return false;
|
||||
}
|
||||
|
||||
onDelete(index) {
|
||||
onDelete(id) {
|
||||
this.$.confirm.show();
|
||||
this.deleteIndex = index;
|
||||
this.deleteId = id;
|
||||
}
|
||||
|
||||
delete(response) {
|
||||
if (response != 'ACCEPT') return;
|
||||
let id = this.$.data[this.deleteIndex].id;
|
||||
if (!id) return;
|
||||
this.$http.delete(`${this.path}/${id}`)
|
||||
if (!this.deleteId) return;
|
||||
this.$http.delete(`${this.path}/${this.deleteId}`)
|
||||
.then(() => {
|
||||
this.$.data.splice(this.deleteIndex, 1);
|
||||
this.deleteIndex = null;
|
||||
this.refresh();
|
||||
this.deleteId = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope', '$http', '$stateParams'];
|
||||
|
||||
ngModule.component('vnZoneExclusions', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'core/lib/section';
|
||||
|
||||
class Controller {
|
||||
constructor($, $http, $stateParams) {
|
||||
this.$ = $;
|
||||
this.$http = $http;
|
||||
this.$stateParams = $stateParams;
|
||||
}
|
||||
|
||||
class Controller extends Section {
|
||||
onSearch(params) {
|
||||
this.$.model.applyFilter(null, params);
|
||||
this.$.$applyAsync(() => this.$.treeview.refresh());
|
||||
|
@ -30,8 +25,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$http', '$stateParams'];
|
||||
|
||||
ngModule.component('vnZoneLocation', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<vn-card
|
||||
ng-if="data.length"
|
||||
style="max-width: 25em; margin: 0 auto;">
|
||||
<vn-card ng-if="data.length" class="vn-w-xs">
|
||||
<vn-table>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="row in data | orderBy:'warehouse.name'">
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'core/lib/section';
|
||||
|
||||
class Controller {
|
||||
constructor($, _, $http, $stateParams) {
|
||||
Object.assign(this, {
|
||||
$,
|
||||
$http
|
||||
});
|
||||
class Controller extends Section {
|
||||
constructor($el, $, $t, $http, $state) {
|
||||
super($el, $, $t, $http, $state);
|
||||
|
||||
this.path = `/api/Zones/${$stateParams.id}/warehouses`;
|
||||
this.path = `/api/Zones/${this.$stateParams.id}/warehouses`;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
@ -52,7 +50,6 @@ class Controller {
|
|||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope', '$translate', '$http', '$stateParams'];
|
||||
|
||||
ngModule.component('vnZoneWarehouses', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
vn-invoice-out-summary .summary {
|
||||
max-width: $width-large;
|
||||
max-width: $width-lg;
|
||||
|
||||
vn-icon[icon=insert_drive_file]{
|
||||
color: $color-font-secondary;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
@import "./variables";
|
||||
|
||||
vn-order-summary .summary{
|
||||
max-width: $width-large;
|
||||
max-width: $width-lg;
|
||||
|
||||
& > div > vn-horizontal > vn-one {
|
||||
min-width: 10em !important;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@import "./variables";
|
||||
|
||||
vn-route-index .index {
|
||||
max-width: $width-large;
|
||||
max-width: $width-lg;
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
vn-route-summary .summary {
|
||||
max-width: $width-large;
|
||||
max-width: $width-lg;
|
||||
|
||||
vn-icon[icon=insert_drive_file]{
|
||||
color: $color-font-secondary;
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
vn-route-tickets form{
|
||||
margin: 0 auto;
|
||||
max-width: $width-large;
|
||||
max-width: $width-lg;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
@import "./variables";
|
||||
|
||||
vn-ticket-summary .summary {
|
||||
max-width: $width-large;
|
||||
max-width: $width-lg;
|
||||
|
||||
vn-button {
|
||||
max-height: 27px;
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<vn-calendar pad-small
|
||||
data="$ctrl.currentWeek"
|
||||
default-date="$ctrl.defaultDate"
|
||||
on-selection="$ctrl.onSelection(values)"
|
||||
on-selection="$ctrl.onSelection($days)"
|
||||
on-move-next="$ctrl.onMoveNext()"
|
||||
on-move-previous="$ctrl.onMovePrevious()">
|
||||
</vn-calendar>
|
||||
|
|
|
@ -208,12 +208,9 @@ class Controller {
|
|||
this.refresh();
|
||||
}
|
||||
|
||||
onSelection(value) {
|
||||
const selected = value[0].dated;
|
||||
|
||||
this.defaultDate.setMonth(selected.getMonth());
|
||||
this.defaultDate.setDate(selected.getDate());
|
||||
|
||||
onSelection($days) {
|
||||
this.defaultDate.setMonth($days[0].getMonth());
|
||||
this.defaultDate.setDate($days[0].getDate());
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue