From d849b991d22c196f7b372f36bdc3941bae097fba Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Thu, 8 Aug 2019 03:01:05 -0400 Subject: [PATCH] chore(departments): added view all public ticket option --- src/client/containers/Departments/index.jsx | 7 ++++ .../Modals/CreateDepartmentModal.jsx | 34 +++++++++++++++---- .../containers/Modals/EditDepartmentModal.jsx | 22 ++++++++++++ src/controllers/api/v2/tickets.js | 20 ++++------- src/models/department.js | 32 +++++++++++++---- 5 files changed, 87 insertions(+), 28 deletions(-) diff --git a/src/client/containers/Departments/index.jsx b/src/client/containers/Departments/index.jsx index 2444bb8b0..4f0323967 100644 --- a/src/client/containers/Departments/index.jsx +++ b/src/client/containers/Departments/index.jsx @@ -155,6 +155,13 @@ class DepartmentsContainer extends React.Component { )} + {department.get('publicGroups') === true && ( +
+
+ All Public Groups +
+
+ )} {department.get('allGroups') !== true && groups && groups.map(group => { diff --git a/src/client/containers/Modals/CreateDepartmentModal.jsx b/src/client/containers/Modals/CreateDepartmentModal.jsx index 9ce689121..55e398990 100644 --- a/src/client/containers/Modals/CreateDepartmentModal.jsx +++ b/src/client/containers/Modals/CreateDepartmentModal.jsx @@ -33,6 +33,7 @@ import MultiSelect from 'components/MultiSelect' class CreateDepartmentModal extends React.Component { @observable name = '' @observable allGroups = false + @observable publicGroups = false componentDidMount () { this.props.fetchTeams() @@ -60,21 +61,22 @@ class CreateDepartmentModal extends React.Component { e.preventDefault() const $form = $(e.target) if (!$form.isValid(null, null, false)) return false - - if(!this.allGroups && this.groupSelect.getSelected() == null){ + + if (!this.allGroups && !this.publicGroups && this.groupSelect.getSelected() == null) { helpers.UI.showSnackbar('Can not create department without a group selected or all groups enabled!', true) - return false; + return false } - - if(this.teamsSelect.getSelected() == null){ + + if (this.teamsSelect.getSelected() == null) { helpers.UI.showSnackbar('Can not create department without a team selected!', true) - return false; + return false } - + const payload = { name: this.name, teams: this.teamsSelect.getSelected(), allGroups: this.allGroups, + publicGroups: this.publicGroups, groups: this.allGroups ? [] : this.groupSelect.getSelected() } @@ -137,6 +139,24 @@ class CreateDepartmentModal extends React.Component { +
+
+

Access all current and new public groups?

+
+
+ +
+
{ this.allGroups = e.target.checked + this.publicGroups = this.allGroups if (this.allGroups) this.groupSelect.selectAll() else this.groupSelect.deselectAll() }} @@ -140,6 +144,24 @@ class EditDepartmentModal extends React.Component {
+
+
+

Access all current and new public groups?

+
+
+ +
+