diff --git a/frontend/client/modules/crm/src/views/call/record/list-expanded.js b/frontend/client/modules/crm/src/views/call/record/list-expanded.js new file mode 100644 index 0000000000..15241ab707 --- /dev/null +++ b/frontend/client/modules/crm/src/views/call/record/list-expanded.js @@ -0,0 +1,36 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + ************************************************************************/ + +Espo.define('crm:views/call/record/list-expanded', ['views/record/list-expanded', 'crm:views/call/record/list'], function (Dep, List) { + + return Dep.extend({ + + actionSetHeld: function (data) { + List.prototype.actionSetHeld.call(this, data); + }, + + actionSetNotHeld: function (data) { + List.prototype.actionSetNotHeld.call(this, data); + }, + + }); + +}); diff --git a/frontend/client/modules/crm/src/views/call/record/row-actions/dashlet.js b/frontend/client/modules/crm/src/views/call/record/row-actions/dashlet.js new file mode 100644 index 0000000000..94cd2d1ddf --- /dev/null +++ b/frontend/client/modules/crm/src/views/call/record/row-actions/dashlet.js @@ -0,0 +1,50 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + ************************************************************************/ + +Espo.define('crm:views/call/record/row-actions/dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) { + + return Dep.extend({ + + getActions: function () { + var actions = Dep.prototype.getActions.call(this); + + if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) { + actions.push({ + action: 'setHeld', + label: 'Set Held', + data: { + id: this.model.id + } + }); + actions.push({ + action: 'setNotHeld', + label: 'Set Not Held', + data: { + id: this.model.id + } + }); + } + + return actions; + } + }); + +}); diff --git a/frontend/client/modules/crm/src/views/call/record/row-actions/default.js b/frontend/client/modules/crm/src/views/call/record/row-actions/default.js index ca064fd605..88975345cd 100644 --- a/frontend/client/modules/crm/src/views/call/record/row-actions/default.js +++ b/frontend/client/modules/crm/src/views/call/record/row-actions/default.js @@ -19,7 +19,7 @@ * along with EspoCRM. If not, see http://www.gnu.org/licenses/. ************************************************************************/ -Espo.define('Crm:Views.Call.Record.RowActions.Default', 'Views.Record.RowActions.Default', function (Dep) { +Espo.define('crm:views/call/record/row-actions/default', 'views/record/row-actions/default', function (Dep) { return Dep.extend({ diff --git a/frontend/client/modules/crm/src/views/dashlets/calls.js b/frontend/client/modules/crm/src/views/dashlets/calls.js index 7ab37d76ee..51011473e2 100644 --- a/frontend/client/modules/crm/src/views/dashlets/calls.js +++ b/frontend/client/modules/crm/src/views/dashlets/calls.js @@ -19,7 +19,7 @@ * along with EspoCRM. If not, see http://www.gnu.org/licenses/. ************************************************************************/ -Espo.define('Crm:Views.Dashlets.Calls', 'Views.Dashlets.Abstract.RecordList', function (Dep) { +Espo.define('crm:views/dashlets/calls', 'views/dashlets/abstract/record-list', function (Dep) { return Dep.extend({ @@ -27,6 +27,10 @@ Espo.define('Crm:Views.Dashlets.Calls', 'Views.Dashlets.Abstract.RecordList', fu scope: 'Call', + listViewName: 'Crm:Call.Record.ListExpanded', + + rowActionsView: 'Crm:Call.Record.RowActions.Dashlet', + defaultOptions: { sortBy: 'dateStart', asc: true, diff --git a/frontend/client/modules/crm/src/views/dashlets/meetings.js b/frontend/client/modules/crm/src/views/dashlets/meetings.js index 86f6bda378..6d348ba85c 100644 --- a/frontend/client/modules/crm/src/views/dashlets/meetings.js +++ b/frontend/client/modules/crm/src/views/dashlets/meetings.js @@ -27,6 +27,10 @@ Espo.define('Crm:Views.Dashlets.Meetings', 'Views.Dashlets.Abstract.RecordList', scope: 'Meeting', + listViewName: 'Crm:Meeting.Record.ListExpanded', + + rowActionsView: 'Crm:Meeting.Record.RowActions.Dashlet', + defaultOptions: { sortBy: 'dateStart', asc: true, diff --git a/frontend/client/modules/crm/src/views/dashlets/tasks.js b/frontend/client/modules/crm/src/views/dashlets/tasks.js index 4eceb8bcbf..9aa273f46f 100644 --- a/frontend/client/modules/crm/src/views/dashlets/tasks.js +++ b/frontend/client/modules/crm/src/views/dashlets/tasks.js @@ -27,6 +27,10 @@ Espo.define('Crm:Views.Dashlets.Tasks', 'Views.Dashlets.Abstract.RecordList', fu scope: 'Task', + listViewName: 'Crm:Task.Record.ListExpanded', + + rowActionsView: 'Crm:Task.Record.RowActions.Dashlet', + defaultOptions: { sortBy: 'dateEnd', asc: true, diff --git a/frontend/client/modules/crm/src/views/meeting/record/list-expanded.js b/frontend/client/modules/crm/src/views/meeting/record/list-expanded.js new file mode 100644 index 0000000000..10c7b92de0 --- /dev/null +++ b/frontend/client/modules/crm/src/views/meeting/record/list-expanded.js @@ -0,0 +1,36 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + ************************************************************************/ + +Espo.define('crm:views/meeting/record/list-expanded', ['views/record/list-expanded', 'crm:views/meeting/record/list'], function (Dep, List) { + + return Dep.extend({ + + actionSetHeld: function (data) { + List.prototype.actionSetHeld.call(this, data); + }, + + actionSetNotHeld: function (data) { + List.prototype.actionSetNotHeld.call(this, data); + }, + + }); + +}); diff --git a/frontend/client/modules/crm/src/views/meeting/record/row-actions/dashlet.js b/frontend/client/modules/crm/src/views/meeting/record/row-actions/dashlet.js new file mode 100644 index 0000000000..ecf5a7f992 --- /dev/null +++ b/frontend/client/modules/crm/src/views/meeting/record/row-actions/dashlet.js @@ -0,0 +1,50 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + ************************************************************************/ + +Espo.define('crm:views/meeting/record/row-actions/dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) { + + return Dep.extend({ + + getActions: function () { + var actions = Dep.prototype.getActions.call(this); + + if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) { + actions.push({ + action: 'setHeld', + label: 'Set Held', + data: { + id: this.model.id + } + }); + actions.push({ + action: 'setNotHeld', + label: 'Set Not Held', + data: { + id: this.model.id + } + }); + } + + return actions; + } + }); + +}); diff --git a/frontend/client/modules/crm/src/views/task/record/list-expanded.js b/frontend/client/modules/crm/src/views/task/record/list-expanded.js new file mode 100644 index 0000000000..99e5601d60 --- /dev/null +++ b/frontend/client/modules/crm/src/views/task/record/list-expanded.js @@ -0,0 +1,34 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + ************************************************************************/ + +Espo.define('crm:views/task/record/list-expanded', ['views/record/list-expanded', 'crm:views/task/record/list'], function (Dep, List) { + + return Dep.extend({ + + rowActionsView: 'Crm:Task.Record.RowActions.Default', + + actionSetCompleted: function (data) { + List.prototype.actionSetCompleted.call(this, data); + }, + + }); + +}); diff --git a/frontend/client/modules/crm/src/views/task/record/list.js b/frontend/client/modules/crm/src/views/task/record/list.js index 1446d428e2..e787331b98 100644 --- a/frontend/client/modules/crm/src/views/task/record/list.js +++ b/frontend/client/modules/crm/src/views/task/record/list.js @@ -25,6 +25,28 @@ Espo.define('Crm:Views.Task.Record.List', 'Views.Record.List', function (Dep) { rowActionsView: 'Crm:Task.Record.RowActions.Default', + actionSetCompleted: function (data) { + var id = data.id; + if (!id) { + return; + } + var model = this.collection.get(id); + if (!model) { + return; + } + + model.set('status', 'Completed'); + + this.listenToOnce(model, 'sync', function () { + this.notify(false); + this.collection.fetch(); + }, this); + + this.notify('Saving...'); + model.save(); + + }, + }); }); diff --git a/frontend/client/modules/crm/src/views/task/record/row-actions/dashlet.js b/frontend/client/modules/crm/src/views/task/record/row-actions/dashlet.js new file mode 100644 index 0000000000..78c4be36e0 --- /dev/null +++ b/frontend/client/modules/crm/src/views/task/record/row-actions/dashlet.js @@ -0,0 +1,43 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + ************************************************************************/ + +Espo.define('crm:views/task/record/row-actions/dashlet', 'views/record/row-actions/view-and-edit', function (Dep) { + + return Dep.extend({ + + getActions: function () { + var actions = Dep.prototype.getActions.call(this); + + if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) { + actions.push({ + action: 'setCompleted', + label: 'Complete', + data: { + id: this.model.id + } + }); + } + + return actions; + } + }); + +}); diff --git a/frontend/client/modules/crm/src/views/task/record/row-actions/default.js b/frontend/client/modules/crm/src/views/task/record/row-actions/default.js index f9c7ebf517..60cb75f17c 100644 --- a/frontend/client/modules/crm/src/views/task/record/row-actions/default.js +++ b/frontend/client/modules/crm/src/views/task/record/row-actions/default.js @@ -17,15 +17,15 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ - + ************************************************************************/ + Espo.define('Crm:Views.Task.Record.RowActions.Default', 'Views.Record.RowActions.Default', function (Dep) { return Dep.extend({ - + getActions: function () { var actions = Dep.prototype.getActions.call(this); - + if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) { actions.push({ action: 'setCompleted', @@ -35,9 +35,9 @@ Espo.define('Crm:Views.Task.Record.RowActions.Default', 'Views.Record.RowActions } }); } - + return actions; - }, + } }); - + }); diff --git a/frontend/client/src/views/dashlets/abstract/record-list.js b/frontend/client/src/views/dashlets/abstract/record-list.js index 9b448be8ac..84409fc821 100644 --- a/frontend/client/src/views/dashlets/abstract/record-list.js +++ b/frontend/client/src/views/dashlets/abstract/record-list.js @@ -31,6 +31,8 @@ Espo.define('Views.Dashlets.Abstract.RecordList', ['Views.Dashlets.Abstract.Base listViewExpanded: 'Record.ListExpanded', + listViewName: null, + _template: '
{{{list}}}
', layoutType: 'expanded', @@ -62,7 +64,7 @@ Espo.define('Views.Dashlets.Abstract.RecordList', ['Views.Dashlets.Abstract.Base collection.maxSize = this.getOption('displayRecords'); collection.where = searchManager.getWhere(); - var viewName = (this.layoutType == 'expanded') ? this.listViewExpanded : this.listViewColumn; + var viewName = this.listViewName || ((this.layoutType == 'expanded') ? this.listViewExpanded : this.listViewColumn); this.listenToOnce(collection, 'sync', function () { this.createView('list', viewName, {