diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/Meeting.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/Meeting.json index 4695fe144c..fab31af477 100644 --- a/application/Espo/Modules/Crm/Resources/i18n/en_US/Meeting.json +++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/Meeting.json @@ -29,9 +29,7 @@ "Create Meeting": "Create Meeting", "Set Held": "Set Held", "Set Not Held": "Set Not Held", - "Send Invitations": "Send Invitations", - "Saved as Held": "Saved as Held", - "Saved as Not Held": "Saved as Not Held" + "Send Invitations": "Send Invitations" }, "presetFilters": { "planned": "Planned", diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/Task.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/Task.json index 3248d1a4ec..8d5bcb4e59 100644 --- a/application/Espo/Modules/Crm/Resources/i18n/en_US/Task.json +++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/Task.json @@ -26,7 +26,8 @@ } }, "labels": { - "Create Task": "Create Task" + "Create Task": "Create Task", + "Complete": "Complete" }, "presetFilters": { "actual": "Actual", diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json index 7f32172640..f32bdd883d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json @@ -1,7 +1,11 @@ { "controller": "Controllers.Record", "views":{ - "detail":"Crm:Call.Detail" + "detail":"Crm:Call.Detail", + "list": "Crm:Call.List" + }, + "recordViews":{ + "list":"Crm:Call.Record.List" }, "menu": { "detail": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json index 0287432797..45a0882694 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json @@ -1,5 +1,12 @@ { "controller": "Controllers.Record", + "recordViews":{ + "list":"Crm:Task.Record.List" + }, + "views": { + "list": "Crm:Task.List", + "detail": "Crm:Task.Detail" + }, "presetFilters": [ { "name":"actual", diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json index 5dd171bcb6..47065a61cb 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json @@ -10,8 +10,7 @@ "default": "Planned", "view": "Fields.EnumStyled", "style": { - "Held": "success", - "Not Held": "danger" + "Held": "success" } }, "dateStart": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json index 89a75baf00..d2a74ca3ad 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json @@ -10,8 +10,7 @@ "default": "Planned", "view": "Fields.EnumStyled", "style": { - "Held": "success", - "Not Held": "danger" + "Held": "success" } }, "dateStart": { diff --git a/frontend/client/modules/crm/src/views/call/detail.js b/frontend/client/modules/crm/src/views/call/detail.js index d1adf8ae25..f7dea828f2 100644 --- a/frontend/client/modules/crm/src/views/call/detail.js +++ b/frontend/client/modules/crm/src/views/call/detail.js @@ -49,7 +49,7 @@ actionSendInvitations: function () { if (confirm(this.translate('confirmation', 'messages'))) { - this.$el.find('button[data-action="sendInvitations"]').addClass('disabled'); + this.$el.find('[data-action="sendInvitations"]').addClass('disabled'); this.notify('Sending...'); $.ajax({ url: 'Call/action/sendInvitations', @@ -59,10 +59,10 @@ }), success: function () { this.notify('Sent', 'success'); - this.$el.find('button[data-action="sendInvitations"]').removeClass('disabled'); + this.$el.find('[data-action="sendInvitations"]').removeClass('disabled'); }.bind(this), error: function () { - this.$el.find('button[data-action="sendInvitations"]').removeClass('disabled'); + this.$el.find('[data-action="sendInvitations"]').removeClass('disabled'); }.bind(this), }); } @@ -74,10 +74,10 @@ }, { patch: true, success: function () { - this.notify('Saved as Held', 'success'); - this.$el.find('button[data-action="sendInvitations"]').remove(); - this.$el.find('a[data-action="setHeld"]').remove(); - this.$el.find('a[data-action="setNotHeld"]').remove(); + this.notify('Saved', 'success'); + this.$el.find('[data-action="sendInvitations"]').remove(); + this.$el.find('[data-action="setHeld"]').remove(); + this.$el.find('[data-action="setNotHeld"]').remove(); }.bind(this), }); }, @@ -88,10 +88,10 @@ }, { patch: true, success: function () { - this.notify('Saved as Not Held', 'success'); - this.$el.find('button[data-action="sendInvitations"]').remove(); - this.$el.find('a[data-action="setHeld"]').remove(); - this.$el.find('a[data-action="setNotHeld"]').remove(); + this.notify('Saved', 'success'); + this.$el.find('[data-action="sendInvitations"]').remove(); + this.$el.find('[data-action="setHeld"]').remove(); + this.$el.find('[data-action="setNotHeld"]').remove(); }.bind(this), }); }, diff --git a/frontend/client/modules/crm/src/views/call/list.js b/frontend/client/modules/crm/src/views/call/list.js new file mode 100644 index 0000000000..f5177c0fc9 --- /dev/null +++ b/frontend/client/modules/crm/src/views/call/list.js @@ -0,0 +1,72 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 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.List', 'Views.List', function (Dep) { + + return Dep.extend({ + + actionSetHeld: function (data) { + var id = data.id; + if (!id) { + return; + } + var model = this.collection.get(id); + if (!model) { + return; + } + + model.set('status', 'Held'); + + this.listenToOnce(model, 'sync', function () { + this.notify(false); + this.collection.fetch(); + }, this); + + this.notify('Saving...'); + model.save(); + + }, + + actionSetNotHeld: function (data) { + var id = data.id; + if (!id) { + return; + } + var model = this.collection.get(id); + if (!model) { + return; + } + + model.set('status', 'Not Held'); + + 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/call/record/list.js b/frontend/client/modules/crm/src/views/call/record/list.js new file mode 100644 index 0000000000..d50d221f44 --- /dev/null +++ b/frontend/client/modules/crm/src/views/call/record/list.js @@ -0,0 +1,30 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 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', 'Views.Record.List', function (Dep) { + + return Dep.extend({ + + rowActionsView: 'Crm:Call.Record.RowActions.Default', + + }); + +}); 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 new file mode 100644 index 0000000000..31b3c9e933 --- /dev/null +++ b/frontend/client/modules/crm/src/views/call/record/row-actions/default.js @@ -0,0 +1,50 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 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.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 && !~['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/meeting/detail.js b/frontend/client/modules/crm/src/views/meeting/detail.js index 593f2580ac..89facf28b5 100644 --- a/frontend/client/modules/crm/src/views/meeting/detail.js +++ b/frontend/client/modules/crm/src/views/meeting/detail.js @@ -59,10 +59,10 @@ Espo.define('Crm:Views.Meeting.Detail', 'Views.Detail', function (Dep) { }), success: function () { this.notify('Sent', 'success'); - this.$el.find('button[data-action="sendInvitations"]').removeClass('disabled'); + this.$el.find('[data-action="sendInvitations"]').removeClass('disabled'); }.bind(this), error: function () { - this.$el.find('button[data-action="sendInvitations"]').removeClass('disabled'); + this.$el.find('[data-action="sendInvitations"]').removeClass('disabled'); }.bind(this), }); } @@ -74,10 +74,10 @@ Espo.define('Crm:Views.Meeting.Detail', 'Views.Detail', function (Dep) { }, { patch: true, success: function () { - Espo.Ui.success(this.translate('Saved as Held', 'labels', 'Meeting')); - this.$el.find('button[data-action="sendInvitations"]').remove(); - this.$el.find('a[data-action="setHeld"]').remove(); - this.$el.find('a[data-action="setNotHeld"]').remove(); + Espo.Ui.success(this.translate('Saved', 'labels', 'Meeting')); + this.$el.find('[data-action="sendInvitations"]').remove(); + this.$el.find('[data-action="setHeld"]').remove(); + this.$el.find('[data-action="setNotHeld"]').remove(); }.bind(this), }); }, @@ -88,10 +88,10 @@ Espo.define('Crm:Views.Meeting.Detail', 'Views.Detail', function (Dep) { }, { patch: true, success: function () { - Espo.Ui.success(this.translate('Saved as Not Held', 'labels', 'Meeting')); - this.$el.find('button[data-action="sendInvitations"]').remove(); - this.$el.find('a[data-action="setHeld"]').remove(); - this.$el.find('a[data-action="setNotHeld"]').remove(); + Espo.Ui.success(this.translate('Saved', 'labels', 'Meeting')); + this.$el.find('[data-action="sendInvitations"]').remove(); + this.$el.find('[data-action="setHeld"]').remove(); + this.$el.find('[data-action="setNotHeld"]').remove(); }.bind(this), }); }, diff --git a/frontend/client/modules/crm/src/views/task/detail.js b/frontend/client/modules/crm/src/views/task/detail.js new file mode 100644 index 0000000000..37a6b5b2a4 --- /dev/null +++ b/frontend/client/modules/crm/src/views/task/detail.js @@ -0,0 +1,57 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 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.Detail', 'Views.Detail', function (Dep) { + + return Dep.extend({ + + setup: function () { + Dep.prototype.setup.call(this); + if (!~['Completed', 'Canceled'].indexOf(this.model.get('status'))) { + if (this.getAcl().checkModel(this.model, 'edit')) { + this.menu.buttons.push({ + 'label': 'Complete', + 'action': 'setCompleted', + icon: 'glyphicon glyphicon-ok', + 'acl': 'edit', + }); + } + } + }, + + actionSetCompleted: function (data) { + var id = data.id; + + this.model.save({ + status: 'Completed' + }, { + patch: true, + success: function () { + Espo.Ui.success(this.translate('Saved')); + this.$el.find('[data-action="setCompleted"]').remove(); + }.bind(this), + }); + + }, + + }); + +}); diff --git a/frontend/client/modules/crm/src/views/task/list.js b/frontend/client/modules/crm/src/views/task/list.js new file mode 100644 index 0000000000..7283e7611d --- /dev/null +++ b/frontend/client/modules/crm/src/views/task/list.js @@ -0,0 +1,50 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 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.List', 'Views.List', function (Dep) { + + return Dep.extend({ + + 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/list.js b/frontend/client/modules/crm/src/views/task/record/list.js new file mode 100644 index 0000000000..7315c31628 --- /dev/null +++ b/frontend/client/modules/crm/src/views/task/record/list.js @@ -0,0 +1,30 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 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', 'Views.Record.List', function (Dep) { + + return Dep.extend({ + + rowActionsView: 'Crm:Task.Record.RowActions.Default', + + }); + +}); 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 new file mode 100644 index 0000000000..fd1f82def1 --- /dev/null +++ b/frontend/client/modules/crm/src/views/task/record/row-actions/default.js @@ -0,0 +1,43 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 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.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', + label: 'Complete', + data: { + id: this.model.id + } + }); + } + + return actions; + }, + }); + +});