From 920b6e2ebad84baeea8cdec3cfe4baed0e75f879 Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 6 Apr 2016 16:09:11 +0300 Subject: [PATCH] dev --- client/modules/crm/css/vis.css | 17 ++++++-- .../crm/src/views/calendar/calendar.js | 6 ++- .../crm/src/views/calendar/timeline.js | 43 ++++++++----------- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/client/modules/crm/css/vis.css b/client/modules/crm/css/vis.css index 93889d0332..8fb3fc0043 100644 --- a/client/modules/crm/css/vis.css +++ b/client/modules/crm/css/vis.css @@ -1,3 +1,16 @@ +.vis-item .vis-item-content { + color: #FFF !important; + cursor: default; +} + +.vis-item.event-canceled .vis-item-content { + text-decoration: line-through !important; +} + +.vis-item.vis-range, .vis-item.vis-box { + border-radius: 0 !important; +} + .vis .overlay { position: absolute; top: 0; @@ -394,7 +407,6 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper { left: 0; top: 0; width: 100%; - color: #4d4d4d; box-sizing: border-box; } @@ -615,7 +627,6 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper { .vis-time-axis .vis-text { position: absolute; - color: #4d4d4d; padding: 3px; overflow: hidden; box-sizing: border-box; @@ -709,7 +720,6 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper { .vis-data-axis .vis-y-axis.vis-major { width: 100%; position: absolute; - color: #4d4d4d; white-space: nowrap; } @@ -739,7 +749,6 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper { .vis-data-axis .vis-y-axis.vis-title { position: absolute; - color: #4d4d4d; white-space: nowrap; bottom: 20px; text-align: center; diff --git a/client/modules/crm/src/views/calendar/calendar.js b/client/modules/crm/src/views/calendar/calendar.js index cb2288d2e9..a37a17ad31 100644 --- a/client/modules/crm/src/views/calendar/calendar.js +++ b/client/modules/crm/src/views/calendar/calendar.js @@ -134,7 +134,7 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi this.colors = this.getMetadata().get('clientDefs.Calendar.colors') || this.colors; this.modeList = this.getMetadata().get('clientDefs.Calendar.modeList') || this.modeList; - this.canceledStatusList = this.getMetadata().get('clientDefs.Calendar.completedStatusList') || this.canceledStatusList; + this.canceledStatusList = this.getMetadata().get('clientDefs.Calendar.canceledStatusList') || this.canceledStatusList; this.completedStatusList = this.getMetadata().get('clientDefs.Calendar.completedStatusList') || this.completedStatusList; this.scopeList = this.getMetadata().get('clientDefs.Calendar.scopeList') || Espo.Utils.clone(this.scopeList); this.allDayScopeList = this.getMetadata().get('clientDefs.Calendar.allDaySopeList') || this.allDayScopeList; @@ -279,7 +279,9 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi handleStatus: function (event) { if (~this.canceledStatusList.indexOf(event.status)) { event.className = 'event-canceled'; - } + } else { + event.className = ''; + } }, shadeColor: function (color, percent) { diff --git a/client/modules/crm/src/views/calendar/timeline.js b/client/modules/crm/src/views/calendar/timeline.js index 13ca3f870f..32ace337c9 100644 --- a/client/modules/crm/src/views/calendar/timeline.js +++ b/client/modules/crm/src/views/calendar/timeline.js @@ -107,6 +107,7 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V this.colors = this.getMetadata().get('clientDefs.Calendar.colors') || this.colors; this.modeList = this.getMetadata().get('clientDefs.Calendar.modeList') || this.modeList; + this.canceledStatusList = this.getMetadata().get('clientDefs.Calendar.canceledStatusList') || this.canceledStatusList; this.completedStatusList = this.getMetadata().get('clientDefs.Calendar.completedStatusList') || this.completedStatusList; this.scopeList = this.getMetadata().get('clientDefs.Calendar.scopeList') || Espo.Utils.clone(this.scopeList); this.allDayScopeList = this.getMetadata().get('clientDefs.Calendar.allDaySopeList') || this.allDayScopeList; @@ -159,16 +160,6 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V if (!this.header) { return; } - /*var view = this.$calendar.fullCalendar('getView'); - var today = new Date(); - - if (view.start <= today && today < view.end) { - this.$el.find('button[data-action="today"]').addClass('active'); - } else { - this.$el.find('button[data-action="today"]').removeClass('active'); - }*/ - - var title; if (this.options.userId && this.options.userName) { @@ -228,7 +219,7 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V var color = this.colors[event.scope]; var d = event.dateEnd; - color = this.shadeColor(color, 0.3); + color = this.shadeColor(color, 0.15); if (~this.completedStatusList.indexOf(event.status) || ~this.canceledStatusList.indexOf(event.status)) { color = this.shadeColor(color, 0.4); @@ -240,9 +231,11 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V }, handleStatus: function (event) { - if (~this.canceledStatusList.indexOf(event.status)) { - event.className = 'event-canceled'; - } + if (~this.canceledStatusList.indexOf(event.status)) { + event.className = 'event-canceled'; + } else { + event.className = ''; + } }, shadeColor: function (color, percent) { @@ -323,10 +316,10 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V var itemsDataSet = new Vis.DataSet(eventList); var timeline = this.timeline = new Vis.Timeline($timeline.get(0), itemsDataSet, this.groupsDataSet, { dataAttributes: 'all', - start: this.start, - end: this.end, + start: this.start.format(this.getDateTime().internalDateTimeFormat), + end: this.end.format(this.getDateTime().internalDateTimeFormat), moment: function (date) { - return Vis.moment(date).tz(this.getDateTime().timeZone); + return moment(date).tz(this.getDateTime().timeZone); }.bind(this), format: this.getFormatObject() }); @@ -378,7 +371,9 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V }, triggerView: function () { - this.trigger('view', this.start.clone().format(this.getDateTime().internalDateFormat), this.mode); + var m = this.start.clone().add('seconds', Math.round((this.end.unix() - this.start.unix()) / 2)); + + this.trigger('view', m.format(this.getDateTime().internalDateFormat), this.mode); }, initUserList: function () { @@ -398,11 +393,10 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V initDates: function () { if (this.date) { - this.start = this.getDateTime().toMomentDate(this.date); + this.start = moment.tz(this.date, this.getDateTime().timeZone); } else { - this.start = moment.utc(); + this.start = moment.tz(this.getDateTime().timeZone); } - this.start.add('day', 0); this.end = this.start.clone(); this.end.add('day', 1); @@ -428,6 +422,9 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V fetchEvents: function (from, to, callback) { Espo.Ui.notify(this.translate('Loading...')); + from = from.clone().add('days', -2); + to = to.clone().add('hours', 12); + var fromString = from.utc().format(this.getDateTime().internalDateTimeFormat); var toString = to.utc().format(this.getDateTime().internalDateTimeFormat); @@ -445,20 +442,16 @@ Espo.define('crm:views/calendar/timeline', ['view', 'lib!vis'], function (Dep, V url += '&scopeList=' + encodeURIComponent(this.enabledScopeList.join(',')); this.ajaxGetRequest(url).then(function (data) { - if (!this.fetchedStart || from.unix() < this.fetchedStart.unix) { this.fetchedStart = from.clone(); } - if (!this.fetchedEnd || to.unix() > this.fetchedEnd.unix) { this.fetchedEnd = to.clone(); } - var eventList = this.convertEventList(data); callback(eventList); this.notify(false); }.bind(this)); - }, addModel: function (model) {