Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5a07f5

Browse files
Added ability to customize Status (#575)
* Added ability to customize Status* Fixed git commit issues---------Co-authored-by: Chris <polonel@gmail.com>
1 parent6184e68 commitc5a07f5

File tree

27 files changed

+754
-176
lines changed

27 files changed

+754
-176
lines changed

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"nyc":"15.1.0",
186186
"patch":"0.0.1",
187187
"prettier-standard":"16.4.1",
188+
"sass":"1.55.0",
188189
"sass-loader":"13.0.2",
189190
"semantic-release":"19.0.3",
190191
"snyk":"1.965.0",

‎src/client/actions/tickets.js‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ import {
3131
DELETE_TICKET,
3232
TICKET_EVENT,
3333
TRANSFER_TO_THIRDPARTY,
34-
FETCH_TICKET_TYPES
34+
FETCH_TICKET_TYPES,
35+
UPDATE_STATUS,
36+
CREATE_STATUS,
37+
FETCH_STATUS,
38+
DELETE_STATUS
3539
}from'actions/types'
3640

3741
exportconstfetchTickets=createAction(FETCH_TICKETS.ACTION)
@@ -64,9 +68,22 @@ export const updatePriority = createAction(UPDATE_PRIORITY.ACTION, ({ id, name,
6468
overdueIn,
6569
htmlColor
6670
}))
71+
72+
exportconstcreateStatus=createAction(CREATE_STATUS.ACTION,({ name, htmlColor})=>({
73+
name,
74+
htmlColor
75+
}))
76+
exportconstupdateStatus=createAction(UPDATE_STATUS.ACTION,({ id, name, htmlColor})=>({
77+
id,
78+
name,
79+
htmlColor
80+
}))
81+
6782
exportconstdeletePriority=createAction(DELETE_PRIORITY.ACTION,({ id, newPriority})=>({ id, newPriority}))
83+
exportconstdeleteStatus=createAction(DELETE_STATUS.ACTION,(id)=>({ id}))
6884
exportconstgetTagsWithPage=createAction(GET_TAGS_WITH_PAGE.ACTION,({ limit, page})=>({ limit, page}))
6985
exportconsttagsUpdateCurrentPage=createAction(TAGS_UPDATE_CURRENT_PAGE.ACTION,currentPage=>({ currentPage}))
7086
exportconstcreateTag=createAction(CREATE_TAG.ACTION,({ name, currentPage})=>({ name, currentPage}))
7187
exportconsttransferToThirdParty=createAction(TRANSFER_TO_THIRDPARTY.ACTION,({ uid})=>({ uid}))
7288
exportconstfetchTicketTypes=createAction(FETCH_TICKET_TYPES.ACTION)
89+
exportconstfetchTicketStatus=createAction(FETCH_STATUS.ACTION)

‎src/client/actions/types.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ export const DELETE_TICKET_TYPE = defineAction('DELETE_TICKET_TYPE', [SUCCESS, E
5858
exportconstFETCH_PRIORITIES=defineAction('FETCH_PRIORITIES',[SUCCESS,PENDING,ERROR])
5959
exportconstCREATE_PRIORITY=defineAction('CREATE_PRIORITY',[SUCCESS,ERROR])
6060
exportconstUPDATE_PRIORITY=defineAction('UPDATE_PRIORITY',[SUCCESS,ERROR])
61+
62+
exportconstCREATE_STATUS=defineAction('CREATE_STATUS',[SUCCESS,ERROR])
63+
exportconstUPDATE_STATUS=defineAction('UPDATE_STATUS',[SUCCESS,ERROR])
64+
exportconstFETCH_STATUS=defineAction('FETCH_STATUS',[SUCCESS,PENDING,ERROR])
65+
6166
exportconstDELETE_PRIORITY=defineAction('DELETE_PRIORITY',[SUCCESS,ERROR])
67+
68+
exportconstDELETE_STATUS=defineAction('DELETE_STATUS',[SUCCESS,ERROR])
6269
exportconstGET_TAGS_WITH_PAGE=defineAction('GET_TAGS_WITH_PAGE',[SUCCESS,ERROR])
6370
exportconstTAGS_UPDATE_CURRENT_PAGE=defineAction('TAGS_UPDATE_CURRENT_PAGE',[SUCCESS,ERROR])
6471
exportconstCREATE_TAG=defineAction('CREATE_TAG',[SUCCESS,ERROR])

‎src/client/api/index.js‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,42 @@ api.tickets.updatePriority = ({ id, name, overdueIn, htmlColor }) => {
138138
returnres.data
139139
})
140140
}
141+
142+
api.tickets.createStatus=({ name, htmlColor})=>{
143+
returnaxios
144+
.post('/api/v1/tickets/status/create',{
145+
name,
146+
htmlColor
147+
})
148+
.then(res=>{
149+
returnres.data
150+
})
151+
}
152+
api.tickets.updateStatus=({ id, name, htmlColor})=>{
153+
returnaxios
154+
.put(`/api/v1/tickets/status/${id}`,{
155+
name,
156+
htmlColor
157+
})
158+
.then(res=>{
159+
returnres.data
160+
})
161+
}
162+
api.tickets.getStatus=()=>{
163+
returnaxios.get('/api/v1/tickets/status').then(res=>{
164+
returnres.data
165+
})
166+
}
167+
168+
169+
api.tickets.deleteStatus=({ id})=>{
170+
returnaxios
171+
.post(`/api/v1/tickets/status/${id}/delete`,{})
172+
.then(res=>{
173+
returnres.data
174+
})
175+
}
176+
141177
api.tickets.deletePriority=({ id, newPriority})=>{
142178
returnaxios
143179
.post(`/api/v1/tickets/priority/${id}/delete`,{
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* . .o8 oooo
3+
* .o8 "888 `888
4+
* .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo
5+
* 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P'
6+
* 888 888 888 888 888 888 888ooo888 `"Y88b. 888888.
7+
* 888 . 888 888 888 888 888 888 .o o. )88b 888 `88b.
8+
* "888" d888b `V88V"V8P' `Y8bod88P" `Y8bod8P' 8""888P' o888o o888o
9+
* ========================================================================
10+
* Author: Chris Brame
11+
* Updated: 2/4/19 1:47 AM
12+
* Copyright (c) 2014-2019. All rights reserved.
13+
*/
14+
15+
importReactfrom'react'
16+
importPropTypesfrom'prop-types'
17+
import{connect}from'react-redux'
18+
import{observer}from'mobx-react'
19+
import{makeObservable,observable}from'mobx'
20+
import{createStatus}from'actions/tickets'
21+
importBaseModalfrom'./BaseModal'
22+
importButtonfrom'components/Button'
23+
importColorSelectorfrom'components/ColorSelector'
24+
25+
import$from'jquery'
26+
importhelpersfrom'lib/helpers'
27+
28+
@observer
29+
classCreateStatusModalextendsReact.Component{
30+
@observablename=''
31+
@observablehtmlColor='#29B995'
32+
33+
constructor(props){
34+
super(props)
35+
makeObservable(this)
36+
}
37+
38+
componentDidMount(){
39+
helpers.UI.inputs()
40+
helpers.formvalidator()
41+
}
42+
43+
onCreateStatusSubmit(e){
44+
e.preventDefault()
45+
const$form=$(e.target)
46+
if(!$form.isValid(null,null,false))returntrue
47+
48+
// Form is valid... Submit..
49+
this.props.createStatus({
50+
name:this.name,
51+
htmlColor:this.htmlColor
52+
})
53+
}
54+
55+
render(){
56+
return(
57+
<BaseModal{...this.props}ref={i=>(this.base=i)}>
58+
<formclassName={'uk-form-stacked'}onSubmit={e=>this.onCreateStatusSubmit(e)}>
59+
<divclassName='uk-margin-medium-bottom uk-clearfix'>
60+
<h2>Create Status</h2>
61+
</div>
62+
63+
<div>
64+
<divclassName='uk-clearfix'>
65+
<divclassName='z-box uk-grid uk-grid-collpase uk-clearfix'>
66+
<divclassName='uk-width-1-3'>
67+
<label>Status Name</label>
68+
<input
69+
type='text'
70+
className={'md-input'}
71+
value={this.name}
72+
onChange={e=>(this.name=e.target.value)}
73+
data-validation='length'
74+
data-validation-length='min3'
75+
data-validation-error-msg='Invalid name (3+ characters)'
76+
/>
77+
</div>
78+
79+
<divclassName='uk-width-1-3'>
80+
<ColorSelector
81+
hideRevert={true}
82+
defaultColor={'#29B995'}
83+
validationEnabled={true}
84+
onChange={e=>(this.htmlColor=e.target.value)}
85+
/>
86+
</div>
87+
</div>
88+
<divclassName='uk-modal-footer uk-text-right'>
89+
<Buttontext={'Cancel'}type={'button'}extraClass={'uk-modal-close'}flat={true}waves={true}/>
90+
<Buttontext={'Create'}type={'submit'}flat={true}waves={true}style={'success'}/>
91+
</div>
92+
</div>
93+
</div>
94+
</form>
95+
</BaseModal>
96+
)
97+
}
98+
}
99+
100+
CreateStatusModal.propTypes={
101+
onPriorityCreated:PropTypes.func,
102+
createStatus:PropTypes.func.isRequired
103+
}
104+
105+
exportdefaultconnect(null,{ createStatus})(CreateStatusModal)

‎src/client/containers/Modals/FilterTicketsModal.jsx‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { connect } from 'react-redux'
1818
import{hideModal}from'actions/common'
1919
import{fetchGroups,unloadGroups}from'actions/groups'
2020
import{fetchAccounts,unloadAccounts}from'actions/accounts'
21-
import{getTagsWithPage,fetchTicketTypes}from'actions/tickets'
21+
import{getTagsWithPage,fetchTicketTypes,fetchTicketStatus}from'actions/tickets'
2222

2323
importBaseModalfrom'containers/Modals/BaseModal'
2424
importSingleSelectfrom'components/SingleSelect'
@@ -37,6 +37,7 @@ class FilterTicketsModal extends React.Component {
3737
this.props.fetchAccounts({page:0,limit:-1,type:'agents',showDeleted:false})
3838
this.props.getTagsWithPage({limit:-1})
3939
this.props.fetchTicketTypes()
40+
this.props.fetchTicketStatus()
4041
}
4142

4243
componentDidUpdate(){
@@ -90,13 +91,8 @@ class FilterTicketsModal extends React.Component {
9091
}
9192

9293
render(){
93-
conststatuses=[
94-
{text:'New',value:'0'},
95-
{text:'Open',value:'1'},
96-
{text:'Pending',value:'2'},
97-
{text:'Closed',value:'3'}
98-
]
99-
94+
conststatuses=this.props.ticketStatuses.map(s=>({text:s.get('name'),value:s.get('uid')})).toArray()
95+
10096
consttags=this.props.ticketTags
10197
.map(t=>{
10298
return{text:t.get('name'),value:t.get('_id')}
@@ -222,15 +218,18 @@ FilterTicketsModal.propTypes = {
222218
getTagsWithPage:PropTypes.func.isRequired,
223219
ticketTags:PropTypes.object.isRequired,
224220
fetchTicketTypes:PropTypes.func.isRequired,
225-
ticketTypes:PropTypes.object.isRequired
221+
ticketTypes:PropTypes.object.isRequired,
222+
fetchTicketStatus:PropTypes.func.isRequired,
223+
ticketStatuses:PropTypes.object.isRequired
226224
}
227225

228226
constmapStateToProps=state=>({
229227
viewdata:state.common.viewdata,
230228
groupsState:state.groupsState,
231229
accountsState:state.accountsState,
232230
ticketTags:state.tagsSettings.tags,
233-
ticketTypes:state.ticketsState.types
231+
ticketTypes:state.ticketsState.types,
232+
ticketStatuses:state.ticketsState.ticketStatuses,
234233
})
235234

236235
exportdefaultconnect(mapStateToProps,{
@@ -240,5 +239,6 @@ export default connect(mapStateToProps, {
240239
fetchAccounts,
241240
unloadAccounts,
242241
getTagsWithPage,
243-
fetchTicketTypes
242+
fetchTicketTypes,
243+
fetchTicketStatus
244244
})(FilterTicketsModal)

‎src/client/containers/Modals/index.jsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import DeleteTicketTypeModal from './DeleteTicketTypeModal'
2323
importFilterTicketModalfrom'./FilterTicketsModal'
2424
importAddPriorityToTypeModalfrom'./AddPriorityToTypeModal'
2525
importCreatePriorityModalfrom'./CreatePriorityModal'
26+
importCreateStatusModalfrom'./CreateStatusModal'
2627
importDeletePriorityModalfrom'./DeletePriorityModal'
2728
importCreateTagModalfrom'./CreateTagModal'
2829
importAddTagsModalfrom'./AddTagsModal'
@@ -53,6 +54,7 @@ const MODAL_COMPONENTS = {
5354
ADD_PRIORITY_TO_TYPE:AddPriorityToTypeModal,
5455
CREATE_PRIORITY:CreatePriorityModal,
5556
DELETE_PRIORITY:DeletePriorityModal,
57+
CREATE_STATUS:CreateStatusModal,
5658
CREATE_TAG:CreateTagModal,
5759
ADD_TAGS_MODAL:AddTagsModal,
5860
CREATE_ROLE:CreateRoleModal,

‎src/client/containers/Reports/subreports/ticketsByStatus.jsx‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ import helpers from 'lib/helpers'
1717

1818
constReportTicketsByStatus=()=>{
1919
constgroupsState=useSelector(state=>state.groupsState)
20+
conststatuses=useSelector((state)=>state.ticketsState.ticketStatuses)
2021
constdispatch=useDispatch()
2122

22-
conststatuses=[
23-
{text:'New',value:0},
24-
{text:'Open',value:1},
25-
{text:'Pending',value:2},
26-
{text:'Closed',value:3}
27-
]
23+
constmappedStatuses=statuses.map(s=>({text:s.get('name'),value:s.get('uid')}))
2824

2925
const[groups,setGroups]=useState([])
3026

@@ -153,7 +149,7 @@ const ReportTicketsByStatus = () => {
153149
<SingleSelect
154150
id={'status'}
155151
multiple={true}
156-
items={statuses}
152+
items={mappedStatuses}
157153
value={selectedStatuses}
158154
onSelectChange={(e,value)=>{
159155
setSelectedStatuses(value)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp