@plusscommunities/pluss-maintenance-app 7.0.0-beta.0 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/actions/JobActions.js +44 -1
- package/dist/module/actions/JobActions.js.map +1 -1
- package/dist/module/actions/types.js +3 -0
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js +2 -0
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/maintenanceActions.js +21 -6
- package/dist/module/apis/maintenanceActions.js.map +1 -1
- package/dist/module/components/FilterPopupMenu.js +34 -18
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +47 -56
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +39 -26
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +12 -12
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/PrioritySelectorPopup.js +82 -0
- package/dist/module/components/PrioritySelectorPopup.js.map +1 -0
- package/dist/module/components/StatusSelectorPopup.js +9 -14
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +7 -3
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/helper.js +39 -25
- package/dist/module/helper.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +31 -2
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +90 -18
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +430 -21
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/values.config.a.js +6 -1
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.default.js +6 -1
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.forms.js +6 -1
- package/dist/module/values.config.forms.js.map +1 -1
- package/dist/module/values.config.js +34 -29
- package/dist/module/values.config.js.map +1 -1
- package/package.json +2 -2
- package/src/actions/JobActions.js +53 -1
- package/src/actions/types.js +4 -0
- package/src/apis/index.js +4 -0
- package/src/apis/maintenanceActions.js +18 -6
- package/src/components/FilterPopupMenu.js +40 -21
- package/src/components/MaintenanceList.js +38 -47
- package/src/components/MaintenanceListItem.js +35 -21
- package/src/components/MaintenanceWidgetItem.js +16 -12
- package/src/components/PrioritySelectorPopup.js +79 -0
- package/src/components/StatusSelectorPopup.js +8 -14
- package/src/components/WidgetSmall.js +5 -3
- package/src/helper.js +50 -21
- package/src/reducers/JobsReducer.js +25 -1
- package/src/screens/RequestDetail.js +87 -24
- package/src/screens/RequestNotes.js +429 -30
- package/src/values.config.a.js +5 -0
- package/src/values.config.default.js +5 -0
- package/src/values.config.forms.js +5 -0
- package/src/values.config.js +34 -29
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","PureComponent","View","StyleSheet","TouchableOpacity","Text","connect","
|
1
|
+
{"version":3,"names":["React","PureComponent","View","StyleSheet","TouchableOpacity","Text","connect","getJobStatusOptions","Components","Colours","values","StatusSelectorPopup","render","title","includeAll","allText","onClose","onSelect","props","statuses","text","color","colourBrandingMain","createElement","MiddlePopup","style","styles","statusPopup","height","length","statusPopupTitle","statusPopupOptionsContainer","map","status","key","onPress","jobStatusContainer","backgroundColor","jobStatusText","create","width","padding","borderRadius","fontFamily","TEXT_DARK","fontSize","marginBottom","flex","justifyContent","flexDirection","alignItems","paddingHorizontal","textAlign","mapStateToProps","state","getMainBrandingColourFromState","statusTypes","reducerKey","jobstatuses"],"sources":["StatusSelectorPopup.js"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport { View, StyleSheet, TouchableOpacity, Text } from 'react-native';\nimport { connect } from 'react-redux';\nimport { getJobStatusOptions } from '../helper';\nimport { Components, Colours } from '../core.config';\nimport { values } from '../values.config';\n\nclass StatusSelectorPopup extends PureComponent {\n render() {\n const { title, includeAll, allText, onClose, onSelect } = this.props;\n let statuses = getJobStatusOptions(this.props);\n if (includeAll)\n statuses = [\n {\n text: allText || 'Show All',\n color: this.props.colourBrandingMain,\n },\n ...statuses,\n ];\n\n return (\n <Components.MiddlePopup style={[styles.statusPopup, { height: statuses.length * 50 + 40 }]} onClose={onClose}>\n <Text style={styles.statusPopupTitle}>{title || 'Select Status'}</Text>\n <View style={styles.statusPopupOptionsContainer}>\n {statuses.map(status => {\n return (\n <TouchableOpacity key={status.text} onPress={() => onSelect(status.text)}>\n <View style={[styles.jobStatusContainer, { backgroundColor: status.color }]}>\n <Text style={styles.jobStatusText}>{status.text}</Text>\n </View>\n </TouchableOpacity>\n );\n })}\n </View>\n </Components.MiddlePopup>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n statusPopup: {\n width: 160,\n padding: 16,\n borderRadius: 12,\n },\n statusPopupTitle: {\n fontFamily: 'sf-bold',\n color: Colours.TEXT_DARK,\n fontSize: 18,\n marginBottom: 16,\n },\n statusPopupOptionsContainer: {\n flex: 1,\n justifyContent: 'space-between',\n },\n jobStatusContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: 105,\n height: 30,\n paddingHorizontal: 8,\n borderRadius: 4,\n },\n jobStatusText: {\n color: '#fff',\n textAlign: 'center',\n fontFamily: 'sf-semibold',\n fontSize: 13,\n flex: 1,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: Colours.getMainBrandingColourFromState(state),\n statusTypes: state[values.reducerKey].jobstatuses,\n };\n};\n\nexport default connect(mapStateToProps, {})(StatusSelectorPopup);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAC5C,SAASC,IAAI,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACvE,SAASC,OAAO,QAAQ,aAAa;AACrC,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SAASC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB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} from 'react-native';
|
|
6
6
|
import { connect } from 'react-redux';
|
7
7
|
import _ from 'lodash';
|
8
8
|
import { maintenanceActions } from '../apis';
|
9
|
-
import { jobsLoaded } from '../actions';
|
9
|
+
import { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate } from '../actions';
|
10
10
|
import MaintenanceWidgetItem from './MaintenanceWidgetItem';
|
11
11
|
import { Services } from '../feature.config';
|
12
|
-
import { Colours, Components
|
12
|
+
import { Colours, Components } from '../core.config';
|
13
13
|
import { values } from '../values.config';
|
14
14
|
const MAX_ITEMS = 10;
|
15
15
|
class WidgetSmall extends Component {
|
@@ -61,6 +61,8 @@ class WidgetSmall extends Component {
|
|
61
61
|
};
|
62
62
|
}
|
63
63
|
componentDidMount() {
|
64
|
+
this.props.jobStatusesUpdate(this.props.site);
|
65
|
+
this.props.jobHideSeenUpdate(this.props.site);
|
64
66
|
this.refresh();
|
65
67
|
}
|
66
68
|
componentDidUpdate(prevProps) {
|
@@ -164,7 +166,9 @@ const mapStateToProps = state => {
|
|
164
166
|
};
|
165
167
|
};
|
166
168
|
export default connect(mapStateToProps, {
|
167
|
-
jobsLoaded
|
169
|
+
jobsLoaded,
|
170
|
+
jobStatusesUpdate,
|
171
|
+
jobHideSeenUpdate
|
168
172
|
}, null, {
|
169
173
|
forwardRef: true
|
170
174
|
})(WidgetSmall);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","Component","Text","View","ScrollView","StyleSheet","connect","_","maintenanceActions","jobsLoaded","MaintenanceWidgetItem","Services","Colours","Components","Config","values","MAX_ITEMS","WidgetSmall","constructor","props","_defineProperty","options","isEmpty","Title","strings","featureKey","textFeatureTitle","userCategory","EmptyText","emptyRequestsStaff","emptyRequestsUser","onLoadingChanged","res","getJobsRecursive","site","error","console","log","loading","callback","setState","state","navigation","navigate","screenMaintenance","componentDidMount","refresh","componentDidUpdate","prevProps","dataUpdated","renderContent","jobs","createElement","style","styles","loadingPadding","LoadingStateWidget","height","EmptyStateWidget","title","getEmptyStateText","horizontal","contentContainerStyle","paddingLeft","paddingRight","showsHorizontalScrollIndicator","slice","map","job","key","id","render","colourBrandingMain","sectionContainer","sectionPadding","sectionHeading","sectionTitle","getTitle","InlineButton","onPress","onPressAll","color","touchableStyle","paddingTop","textStyle","create","backgroundColor","paddingHorizontal","paddingBottom","marginBottom","flexDirection","alignContent","justifyContent","fontFamily","fontSize","TEXT_DARKEST","mapStateToProps","_state$strings","user","notifications","reducerKey","getMainBrandingColourFromState","orderBy","category","updateKey","config","forwardRef"],"sources":["WidgetSmall.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { Text, View, ScrollView, StyleSheet } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport { maintenanceActions } from '../apis';\nimport { jobsLoaded } from '../actions';\nimport MaintenanceWidgetItem from './MaintenanceWidgetItem';\nimport { Services } from '../feature.config';\nimport { Colours, Components, Config } from '../core.config';\nimport { values } from '../values.config';\n\nconst MAX_ITEMS = 10;\n\nclass WidgetSmall extends Component {\n constructor(props) {\n super(props);\n this.state = { loading: false };\n }\n\n componentDidMount() {\n this.refresh();\n }\n\n componentDidUpdate(prevProps) {\n if (!prevProps.dataUpdated && this.props.dataUpdated) this.refresh();\n }\n\n getTitle = () => {\n const { options } = this.props;\n if (options && !_.isEmpty(options.Title)) return options.Title;\n return this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;\n };\n\n getEmptyStateText = () => {\n const { options, userCategory } = this.props;\n if (options && !_.isEmpty(options.EmptyText)) return options.EmptyText;\n return userCategory === 'staff' ? values.emptyRequestsStaff : values.emptyRequestsUser;\n };\n\n refresh = () => {\n this.onLoadingChanged(true, async () => {\n try {\n const res = await maintenanceActions.getJobsRecursive(this.props.site);\n // console.log('WidgetSmall - refresh', res.data);\n this.props.jobsLoaded(res);\n } catch (error) {\n console.log('refresh error', error);\n } finally {\n this.onLoadingChanged(false);\n }\n });\n };\n\n onLoadingChanged = (loading, callback) => {\n this.setState({ loading }, () => {\n if (this.props.onLoadingChanged) this.props.onLoadingChanged(this.state.loading);\n if (callback) callback();\n });\n };\n\n onPressAll = () => {\n Services.navigation.navigate(values.screenMaintenance, { options: this.props.options });\n };\n\n renderContent() {\n const { jobs } = this.props;\n if (_.isEmpty(jobs)) {\n if (this.state.loading) {\n return (\n <View style={styles.loadingPadding}>\n <Components.LoadingStateWidget height={180} />\n </View>\n );\n }\n return (\n <View style={styles.loadingPadding}>\n <Components.EmptyStateWidget title={this.getEmptyStateText()} height={180} />\n </View>\n );\n }\n return (\n <ScrollView horizontal contentContainerStyle={{ paddingLeft: 6, paddingRight: 8 }} showsHorizontalScrollIndicator={false}>\n {jobs.slice(0, MAX_ITEMS).map(job => {\n return <MaintenanceWidgetItem key={job.id} job={job} />;\n })}\n </ScrollView>\n );\n }\n\n render() {\n const { colourBrandingMain } = this.props;\n\n return (\n <View style={styles.sectionContainer}>\n <View style={styles.sectionPadding}>\n <View style={styles.sectionHeading}>\n <Text style={styles.sectionTitle}>{this.getTitle()}</Text>\n <Components.InlineButton\n onPress={this.onPressAll}\n color={colourBrandingMain}\n touchableStyle={{ paddingTop: 6 }}\n textStyle={{ color: '#fff' }}\n >\n View All\n </Components.InlineButton>\n </View>\n </View>\n {this.renderContent()}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n sectionContainer: {\n backgroundColor: '#fff',\n paddingTop: 16,\n },\n sectionPadding: {\n paddingHorizontal: 16,\n paddingBottom: 6,\n },\n loadingPadding: {\n paddingHorizontal: 16,\n },\n sectionHeading: {\n marginBottom: 4,\n flexDirection: 'row',\n alignContent: 'flex-start',\n justifyContent: 'space-between',\n },\n sectionTitle: {\n fontFamily: 'sf-bold',\n fontSize: 24,\n color: Colours.TEXT_DARKEST,\n },\n});\n\nconst mapStateToProps = state => {\n const { user, notifications } = state;\n const jobs = state[values.reducerKey];\n return {\n colourBrandingMain: Colours.getMainBrandingColourFromState(state),\n jobs: _.orderBy(jobs.jobs, ['createdUnix'], ['desc']),\n site: user.site,\n userCategory: user.category,\n dataUpdated: notifications.dataUpdated[values.updateKey],\n strings: state.strings?.config || {},\n };\n};\n\nexport default connect(mapStateToProps, { jobsLoaded }, null, { forwardRef: true })(WidgetSmall);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AACjE,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,UAAU,QAAQ,YAAY;AACvC,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,OAAO,EAAEC,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AAC5D,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,MAAMC,SAAS,GAAG,EAAE;AAEpB,MAAMC,WAAW,SAAShB,SAAS,CAAC;EAClCiB,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,mBAYJ,MAAM;MACf,MAAM;QAAEC;MAAQ,CAAC,GAAG,IAAI,CAACF,KAAK;MAC9B,IAAIE,OAAO,IAAI,CAACd,CAAC,CAACe,OAAO,CAACD,OAAO,CAACE,KAAK,CAAC,EAAE,OAAOF,OAAO,CAACE,KAAK;MAC9D,OAAO,IAAI,CAACJ,KAAK,CAACK,OAAO,CAAC,GAAGT,MAAM,CAACU,UAAU,mBAAmB,CAAC,IAAIV,MAAM,CAACW,gBAAgB;IAC/F,CAAC;IAAAN,eAAA,4BAEmB,MAAM;MACxB,MAAM;QAAEC,OAAO;QAAEM;MAAa,CAAC,GAAG,IAAI,CAACR,KAAK;MAC5C,IAAIE,OAAO,IAAI,CAACd,CAAC,CAACe,OAAO,CAACD,OAAO,CAACO,SAAS,CAAC,EAAE,OAAOP,OAAO,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eAAe,GAAGvD,KAAK,IAAI;EAAA,IAAAwD,cAAA;EAC/B,MAAM;IAAEC,IAAI;IAAEC;EAAc,CAAC,GAAG1D,KAAK;EACrC,MAAMU,IAAI,GAAGV,KAAK,CAAC1B,MAAM,CAACqF,UAAU,CAAC;EACrC,OAAO;IACL5B,kBAAkB,EAAE5D,OAAO,CAACyF,8BAA8B,CAAC5D,KAAK,CAAC;IACjEU,IAAI,EAAE5C,CAAC,CAAC+F,OAAO,CAACnD,IAAI,CAACA,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrDjB,IAAI,EAAEgE,IAAI,CAAChE,IAAI;IACfP,YAAY,EAAEuE,IAAI,CAACK,QAAQ;IAC3BtD,WAAW,EAAEkD,aAAa,CAAClD,WAAW,CAAClC,MAAM,CAACyF,SAAS,CAAC;IACxDhF,OAAO,EAAE,EAAAyE,cAAA,GAAAxD,KAAK,CAACjB,OAAO,cAAAyE,cAAA,uBAAbA,cAAA,CAAeQ,MAAM,KAAI,CAAC;EACrC,CAAC;AACH,CAAC;AAED,eAAenG,OAAO,CAAC0F,eAAe,EAAE;EAAEvF;AAAW,CAAC,EAAE,IAAI,EAAE;EAAEiG,UAAU,EAAE;AAAK,CAAC,CAAC,CAACzF,WAAW,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["React","Component","Text","View","ScrollView","StyleSheet","connect","_","maintenanceActions","jobsLoaded","jobStatusesUpdate","jobHideSeenUpdate","MaintenanceWidgetItem","Services","Colours","Components","values","MAX_ITEMS","WidgetSmall","constructor","props","_defineProperty","options","isEmpty","Title","strings","featureKey","textFeatureTitle","userCategory","EmptyText","emptyRequestsStaff","emptyRequestsUser","onLoadingChanged","res","getJobsRecursive","site","error","console","log","loading","callback","setState","state","navigation","navigate","screenMaintenance","componentDidMount","refresh","componentDidUpdate","prevProps","dataUpdated","renderContent","jobs","createElement","style","styles","loadingPadding","LoadingStateWidget","height","EmptyStateWidget","title","getEmptyStateText","horizontal","contentContainerStyle","paddingLeft","paddingRight","showsHorizontalScrollIndicator","slice","map","job","key","id","render","colourBrandingMain","sectionContainer","sectionPadding","sectionHeading","sectionTitle","getTitle","InlineButton","onPress","onPressAll","color","touchableStyle","paddingTop","textStyle","create","backgroundColor","paddingHorizontal","paddingBottom","marginBottom","flexDirection","alignContent","justifyContent","fontFamily","fontSize","TEXT_DARKEST","mapStateToProps","_state$strings","user","notifications","reducerKey","getMainBrandingColourFromState","orderBy","category","updateKey","config","forwardRef"],"sources":["WidgetSmall.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { Text, View, ScrollView, StyleSheet } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport { maintenanceActions } from '../apis';\nimport { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate } from '../actions';\nimport MaintenanceWidgetItem from './MaintenanceWidgetItem';\nimport { Services } from '../feature.config';\nimport { Colours, Components } from '../core.config';\nimport { values } from '../values.config';\n\nconst MAX_ITEMS = 10;\n\nclass WidgetSmall extends Component {\n constructor(props) {\n super(props);\n this.state = { loading: false };\n }\n\n componentDidMount() {\n this.props.jobStatusesUpdate(this.props.site);\n this.props.jobHideSeenUpdate(this.props.site);\n this.refresh();\n }\n\n componentDidUpdate(prevProps) {\n if (!prevProps.dataUpdated && this.props.dataUpdated) this.refresh();\n }\n\n getTitle = () => {\n const { options } = this.props;\n if (options && !_.isEmpty(options.Title)) return options.Title;\n return this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;\n };\n\n getEmptyStateText = () => {\n const { options, userCategory } = this.props;\n if (options && !_.isEmpty(options.EmptyText)) return options.EmptyText;\n return userCategory === 'staff' ? values.emptyRequestsStaff : values.emptyRequestsUser;\n };\n\n refresh = () => {\n this.onLoadingChanged(true, async () => {\n try {\n const res = await maintenanceActions.getJobsRecursive(this.props.site);\n // console.log('WidgetSmall - refresh', res.data);\n this.props.jobsLoaded(res);\n } catch (error) {\n console.log('refresh error', error);\n } finally {\n this.onLoadingChanged(false);\n }\n });\n };\n\n onLoadingChanged = (loading, callback) => {\n this.setState({ loading }, () => {\n if (this.props.onLoadingChanged) this.props.onLoadingChanged(this.state.loading);\n if (callback) callback();\n });\n };\n\n onPressAll = () => {\n Services.navigation.navigate(values.screenMaintenance, { options: this.props.options });\n };\n\n renderContent() {\n const { jobs } = this.props;\n if (_.isEmpty(jobs)) {\n if (this.state.loading) {\n return (\n <View style={styles.loadingPadding}>\n <Components.LoadingStateWidget height={180} />\n </View>\n );\n }\n return (\n <View style={styles.loadingPadding}>\n <Components.EmptyStateWidget title={this.getEmptyStateText()} height={180} />\n </View>\n );\n }\n return (\n <ScrollView horizontal contentContainerStyle={{ paddingLeft: 6, paddingRight: 8 }} showsHorizontalScrollIndicator={false}>\n {jobs.slice(0, MAX_ITEMS).map(job => {\n return <MaintenanceWidgetItem key={job.id} job={job} />;\n })}\n </ScrollView>\n );\n }\n\n render() {\n const { colourBrandingMain } = this.props;\n\n return (\n <View style={styles.sectionContainer}>\n <View style={styles.sectionPadding}>\n <View style={styles.sectionHeading}>\n <Text style={styles.sectionTitle}>{this.getTitle()}</Text>\n <Components.InlineButton\n onPress={this.onPressAll}\n color={colourBrandingMain}\n touchableStyle={{ paddingTop: 6 }}\n textStyle={{ color: '#fff' }}\n >\n View All\n </Components.InlineButton>\n </View>\n </View>\n {this.renderContent()}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n sectionContainer: {\n backgroundColor: '#fff',\n paddingTop: 16,\n },\n sectionPadding: {\n paddingHorizontal: 16,\n paddingBottom: 6,\n },\n loadingPadding: {\n paddingHorizontal: 16,\n },\n sectionHeading: {\n marginBottom: 4,\n flexDirection: 'row',\n alignContent: 'flex-start',\n justifyContent: 'space-between',\n },\n sectionTitle: {\n fontFamily: 'sf-bold',\n fontSize: 24,\n color: Colours.TEXT_DARKEST,\n },\n});\n\nconst mapStateToProps = state => {\n const { user, notifications } = state;\n const jobs = state[values.reducerKey];\n return {\n colourBrandingMain: Colours.getMainBrandingColourFromState(state),\n jobs: _.orderBy(jobs.jobs, ['createdUnix'], ['desc']),\n site: user.site,\n userCategory: user.category,\n dataUpdated: notifications.dataUpdated[values.updateKey],\n strings: state.strings?.config || {},\n };\n};\n\nexport default connect(mapStateToProps, { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate }, null, { forwardRef: true })(WidgetSmall);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AACjE,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,UAAU,EAAEC,iBAAiB,EAAEC,iBAAiB,QAAQ,YAAY;AAC7E,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,OAAO,EAAEC,UAAU,QAAQ,gBAAgB;AACpD,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,MAAMC,SAAS,GAAG,EAAE;AAEpB,MAAMC,WAAW,SAASjB,SAAS,CAAC;EAClCkB,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,mBAcJ,MAAM;MACf,MAAM;QAAEC;MAAQ,CAAC,GAAG,IAAI,CAACF,KAAK;MAC9B,IAAIE,OAAO,IAAI,CAACf,CAAC,CAACgB,OAAO,CAACD,OAAO,CAACE,KAAK,CAAC,EAAE,OAAOF,OAAO,CAACE,KAAK;MAC9D,OAAO,IAAI,CAACJ,KAAK,CAACK,OAAO,CAAC,GAAGT,MAAM,CAACU,UAAU,mBAAmB,CAAC,IAAIV,MAAM,CAACW,gBAAgB;IAC/F,CAAC;IAAAN,eAAA,4BAEmB,MAAM;MACxB,MAAM;QAAEC,OAAO;QAAEM;MAAa,CAAC,GAAG,IAA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EAAE;EACrB,CAAC;EACDZ,cAAc,EAAE;IACdc,YAAY,EAAE,CAAC;IACfC,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAE,YAAY;IAC1BC,cAAc,EAAE;EAClB,CAAC;EACDhB,YAAY,EAAE;IACZiB,UAAU,EAAE,SAAS;IACrBC,QAAQ,EAAE,EAAE;IACZb,KAAK,EAAEpE,OAAO,CAACkF;EACjB;AACF,CAAC,CAAC;AAEF,MAAMC,eAAe,GAAGvD,KAAK,IAAI;EAAA,IAAAwD,cAAA;EAC/B,MAAM;IAAEC,IAAI;IAAEC;EAAc,CAAC,GAAG1D,KAAK;EACrC,MAAMU,IAAI,GAAGV,KAAK,CAAC1B,MAAM,CAACqF,UAAU,CAAC;EACrC,OAAO;IACL5B,kBAAkB,EAAE3D,OAAO,CAACwF,8BAA8B,CAAC5D,KAAK,CAAC;IACjEU,IAAI,EAAE7C,CAAC,CAACgG,OAAO,CAACnD,IAAI,CAACA,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrDjB,IAAI,EAAEgE,IAAI,CAAChE,IAAI;IACfP,YAAY,EAAEuE,IAAI,CAACK,QAAQ;IAC3BtD,WAAW,EAAEkD,aAAa,CAAClD,WAAW,CAAClC,MAAM,CAACyF,SAAS,CAAC;IACxDhF,OAAO,EAAE,EAAAyE,cAAA,GAAAxD,KAAK,CAACjB,OAAO,cAAAyE,cAAA,uBAAbA,cAAA,CAAeQ,MAAM,KAAI,CAAC;EACrC,CAAC;AACH,CAAC;AAED,eAAepG,OAAO,CAAC2F,eAAe,EAAE;EAAExF,UAAU;EAAEC,iBAAiB;EAAEC;AAAkB,CAAC,EAAE,IAAI,EAAE;EAAEgG,UAAU,EAAE;AAAK,CAAC,CAAC,CAACzF,WAAW,CAAC","ignoreList":[]}
|
package/dist/module/helper.js
CHANGED
@@ -1,33 +1,47 @@
|
|
1
|
-
import { label } from 'aws-amplify';
|
2
1
|
import { Colours } from './core.config';
|
2
|
+
const STATUS_NOT_ACTIONED = 'Not Actioned';
|
3
|
+
const STATUS_IN_PROGRESS = 'In Progress';
|
4
|
+
const STATUS_COMPLETED = 'Completed';
|
3
5
|
const jobStatusOptions = [{
|
4
|
-
|
5
|
-
|
6
|
-
color: Colours.LINEGREY
|
6
|
+
text: 'Open',
|
7
|
+
order: 0,
|
8
|
+
color: Colours.LINEGREY,
|
9
|
+
category: STATUS_NOT_ACTIONED
|
7
10
|
}, {
|
8
|
-
|
9
|
-
|
10
|
-
color: Colours.COLOUR_TEAL
|
11
|
+
text: 'In Progress',
|
12
|
+
order: 1,
|
13
|
+
color: Colours.COLOUR_TEAL,
|
14
|
+
category: STATUS_IN_PROGRESS
|
11
15
|
}, {
|
12
|
-
|
13
|
-
|
14
|
-
color: Colours.COLOUR_GREEN_LIGHT
|
16
|
+
text: 'Completed',
|
17
|
+
order: 2,
|
18
|
+
color: Colours.COLOUR_GREEN_LIGHT,
|
19
|
+
category: STATUS_COMPLETED
|
15
20
|
}];
|
16
|
-
const
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
const jobPriorityOptions = [{
|
22
|
+
label: 'Low',
|
23
|
+
color: Colours.COLOUR_GREEN,
|
24
|
+
default: true
|
25
|
+
}, {
|
26
|
+
label: 'Medium',
|
27
|
+
color: Colours.COLOUR_TANGERINE
|
28
|
+
}, {
|
29
|
+
label: 'High',
|
30
|
+
color: Colours.COLOUR_RED
|
31
|
+
}];
|
32
|
+
const getJobStatusOptions = props => {
|
33
|
+
var _props$statusTypes;
|
34
|
+
return props !== null && props !== void 0 && (_props$statusTypes = props.statusTypes) !== null && _props$statusTypes !== void 0 && _props$statusTypes.length ? props === null || props === void 0 ? void 0 : props.statusTypes : jobStatusOptions;
|
23
35
|
};
|
24
|
-
const
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
36
|
+
const getDefaultJobStatuses = props => getJobStatusOptions(props).filter(s => s.category === STATUS_NOT_ACTIONED);
|
37
|
+
const getIncompleteJobStatuses = props => getJobStatusOptions(props).filter(s => s.category === STATUS_IN_PROGRESS);
|
38
|
+
const getJobStatus = (status, props) => {
|
39
|
+
const statusOptions = getJobStatusOptions(props);
|
40
|
+
// console.log('getJobStatus', JSON.stringify({ status, statusOptions }, null, 2));
|
41
|
+
let statusOption = null;
|
42
|
+
if (status) statusOption = statusOptions.find(s => s.text === status);
|
43
|
+
return statusOption || getDefaultJobStatuses(props)[0];
|
31
44
|
};
|
32
|
-
|
45
|
+
const getJobPriority = priority => jobPriorityOptions.find(p => p.label === priority) || jobPriorityOptions.find(p => p.default);
|
46
|
+
export { jobStatusOptions, jobPriorityOptions, getJobStatusOptions, getDefaultJobStatuses, getIncompleteJobStatuses, getJobStatus, getJobPriority };
|
33
47
|
//# sourceMappingURL=helper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["Colours","STATUS_NOT_ACTIONED","STATUS_IN_PROGRESS","STATUS_COMPLETED","jobStatusOptions","text","order","color","LINEGREY","category","COLOUR_TEAL","COLOUR_GREEN_LIGHT","jobPriorityOptions","label","COLOUR_GREEN","default","COLOUR_TANGERINE","COLOUR_RED","getJobStatusOptions","props","_props$statusTypes","statusTypes","length","getDefaultJobStatuses","filter","s","getIncompleteJobStatuses","getJobStatus","status","statusOptions","statusOption","find","getJobPriority","priority","p"],"sources":["helper.js"],"sourcesContent":["import { Colours } from './core.config';\n\nconst STATUS_NOT_ACTIONED = 'Not Actioned';\nconst STATUS_IN_PROGRESS = 'In Progress';\nconst STATUS_COMPLETED = 'Completed';\n\nconst jobStatusOptions = [\n {\n text: 'Open',\n order: 0,\n color: Colours.LINEGREY,\n category: STATUS_NOT_ACTIONED,\n },\n {\n text: 'In Progress',\n order: 1,\n color: Colours.COLOUR_TEAL,\n category: STATUS_IN_PROGRESS,\n },\n {\n text: 'Completed',\n order: 2,\n color: Colours.COLOUR_GREEN_LIGHT,\n category: STATUS_COMPLETED,\n },\n];\n\nconst jobPriorityOptions = [\n {\n label: 'Low',\n color: Colours.COLOUR_GREEN,\n default: true,\n },\n {\n label: 'Medium',\n color: Colours.COLOUR_TANGERINE,\n },\n {\n label: 'High',\n color: Colours.COLOUR_RED,\n },\n];\n\nconst getJobStatusOptions = props => props?.statusTypes?.length ? props?.statusTypes : jobStatusOptions;\n\nconst getDefaultJobStatuses = props => getJobStatusOptions(props).filter(s => s.category === STATUS_NOT_ACTIONED);\n\nconst getIncompleteJobStatuses = props => getJobStatusOptions(props).filter(s => s.category === STATUS_IN_PROGRESS);\n\nconst getJobStatus = (status, props) => {\n const statusOptions = getJobStatusOptions(props);\n // console.log('getJobStatus', JSON.stringify({ status, statusOptions }, null, 2));\n let statusOption = null;\n if (status) statusOption = statusOptions.find(s => s.text === status);\n return statusOption || getDefaultJobStatuses(props)[0];\n}\n\nconst getJobPriority = priority => jobPriorityOptions.find(p => p.label === priority) || jobPriorityOptions.find(p => p.default);\n\nexport {\n jobStatusOptions,\n jobPriorityOptions,\n getJobStatusOptions,\n getDefaultJobStatuses,\n getIncompleteJobStatuses,\n getJobStatus,\n getJobPriority,\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,eAAe;AAEvC,MAAMC,mBAAmB,GAAG,cAAc;AAC1C,MAAMC,kBAAkB,GAAG,aAAa;AACxC,MAAMC,gBAAgB,GAAG,WAAW;AAEpC,MAAMC,gBAAgB,GAAG,CACvB;EACEC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAEP,OAAO,CAACQ,QAAQ;EACvBC,QAAQ,EAAER;AACZ,CAAC,EACD;EACEI,IAAI,EAAE,aAAa;EACnBC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAEP,OAAO,CAACU,WAAW;EAC1BD,QAAQ,EAAEP;AACZ,CAAC,EACD;EACEG,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,CAAC;EACRC,KAAK,EAA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,cAAc,GAAGC,QAAQ,IAAIrB,kBAAkB,CAACmB,IAAI,CAACG,CAAC,IAAIA,CAAC,CAACrB,KAAK,KAAKoB,QAAQ,CAAC,IAAIrB,kBAAkB,CAACmB,IAAI,CAACG,CAAC,IAAIA,CAAC,CAACnB,OAAO,CAAC;AAEhI,SACEX,gBAAgB,EAChBQ,kBAAkB,EAClBM,mBAAmB,EACnBK,qBAAqB,EACrBG,wBAAwB,EACxBC,YAAY,EACZK,cAAc","ignoreList":[]}
|
@@ -1,16 +1,27 @@
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
2
2
|
import _ from 'lodash';
|
3
3
|
import { REHYDRATE } from 'redux-persist';
|
4
|
-
import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED } from '../actions/types';
|
4
|
+
import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED, JOBS_STATUSES_LOADED, JOBS_HIDE_SEEN, JOB_FILTER_LOADED } from '../actions/types';
|
5
5
|
import { ActionTypes } from '../core.config';
|
6
6
|
import { values } from '../values.config';
|
7
7
|
const REDUCER_KEY = values.reducerKey;
|
8
8
|
const INITIAL_STATE = {
|
9
|
-
jobs: []
|
9
|
+
jobs: [],
|
10
|
+
jobstatuses: [],
|
11
|
+
hideSeen: false,
|
12
|
+
jobfilters: {
|
13
|
+
status: '',
|
14
|
+
statusText: '',
|
15
|
+
priority: '',
|
16
|
+
type: '',
|
17
|
+
assignee: '',
|
18
|
+
assigneeName: ''
|
19
|
+
}
|
10
20
|
};
|
11
21
|
export default (state = INITIAL_STATE, action) => {
|
12
22
|
let updateJobs = [];
|
13
23
|
let index = 0;
|
24
|
+
let jobstatuses = [];
|
14
25
|
switch (action.type) {
|
15
26
|
case ActionTypes.LOGOUT:
|
16
27
|
case ActionTypes.CHANGE_ROLE:
|
@@ -47,6 +58,24 @@ export default (state = INITIAL_STATE, action) => {
|
|
47
58
|
...state,
|
48
59
|
jobs: updateJobs
|
49
60
|
};
|
61
|
+
case JOBS_STATUSES_LOADED:
|
62
|
+
jobstatuses = _.orderBy(_.unionWith(action.payload, state.jobstatuses, (v1, v2) => {
|
63
|
+
return v1 != null && v2 != null && v1.text === v2.text;
|
64
|
+
}), 'order', 'asc');
|
65
|
+
return {
|
66
|
+
...state,
|
67
|
+
jobstatuses
|
68
|
+
};
|
69
|
+
case JOBS_HIDE_SEEN:
|
70
|
+
return {
|
71
|
+
...state,
|
72
|
+
hideSeen: action.payload
|
73
|
+
};
|
74
|
+
case JOB_FILTER_LOADED:
|
75
|
+
return {
|
76
|
+
...state,
|
77
|
+
jobfilters: action.payload
|
78
|
+
};
|
50
79
|
case REHYDRATE:
|
51
80
|
if (!action.payload) return state;
|
52
81
|
if (action.payload[REDUCER_KEY]) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_","REHYDRATE","JOBS_LOADED","JOB_ADDED","JOBS_ADDED","ActionTypes","values","REDUCER_KEY","reducerKey","INITIAL_STATE","jobs","state","action","updateJobs","index","
|
1
|
+
{"version":3,"names":["_","REHYDRATE","JOBS_LOADED","JOB_ADDED","JOBS_ADDED","JOBS_STATUSES_LOADED","JOBS_HIDE_SEEN","JOB_FILTER_LOADED","ActionTypes","values","REDUCER_KEY","reducerKey","INITIAL_STATE","jobs","jobstatuses","hideSeen","jobfilters","status","statusText","priority","type","assignee","assigneeName","state","action","updateJobs","index","LOGOUT","CHANGE_ROLE","payload","map","job","title","description","unionWith","j1","j2","id","findIndex","item","push","orderBy","v1","v2","text"],"sources":["JobsReducer.js"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport _ from 'lodash';\nimport { REHYDRATE } from 'redux-persist';\nimport { JOBS_LOADED, JOB_ADDED, JOBS_ADDED, JOBS_STATUSES_LOADED, JOBS_HIDE_SEEN, JOB_FILTER_LOADED } from '../actions/types';\nimport { ActionTypes } from '../core.config';\nimport { values } from '../values.config';\n\nconst REDUCER_KEY = values.reducerKey;\n\nconst INITIAL_STATE = {\n jobs: [],\n jobstatuses: [],\n hideSeen: false,\n jobfilters: {\n status: '',\n statusText: '',\n priority: '',\n type: '',\n assignee: '',\n assigneeName: '',\n },\n};\n\nexport default (state = INITIAL_STATE, action) => {\n let updateJobs = [];\n let index = 0;\n let jobstatuses = [];\n\n switch (action.type) {\n case ActionTypes.LOGOUT:\n case ActionTypes.CHANGE_ROLE:\n return INITIAL_STATE;\n case JOBS_LOADED:\n return { ...state, jobs: action.payload.map(job => ({ title: job.title || job.description, ...job })) };\n case JOBS_ADDED:\n updateJobs = action.payload.map(job => ({ title: job.title || job.description, ...job }));\n updateJobs = _.unionWith(updateJobs, state.jobs, (j1, j2) => {\n return j1.id === j2.id;\n });\n return { ...state, jobs: updateJobs };\n case JOB_ADDED:\n updateJobs = [...state.jobs];\n index = updateJobs.findIndex(item => item.id === action.payload.id);\n if (index > -1) {\n updateJobs[index] = action.payload;\n } else {\n updateJobs.push(action.payload);\n }\n return { ...state, jobs: updateJobs };\n case JOBS_STATUSES_LOADED:\n jobstatuses = _.orderBy(\n _.unionWith(action.payload, state.jobstatuses, (v1, v2) => {\n return v1 != null && v2 != null && v1.text === v2.text;\n }),\n 'order',\n 'asc',\n );\n return { ...state, jobstatuses };\n case JOBS_HIDE_SEEN:\n return { ...state, hideSeen: action.payload };\n case JOB_FILTER_LOADED:\n return { ...state, jobfilters: action.payload };\n case REHYDRATE:\n if (!action.payload) return state;\n if (action.payload[REDUCER_KEY]) {\n if (action.payload[REDUCER_KEY].jobs == null) {\n action.payload[REDUCER_KEY].jobs = [];\n }\n return action.payload[REDUCER_KEY];\n }\n return state;\n default:\n return state;\n }\n};\n"],"mappings":"AAAA;AACA,OAAOA,CAAC,MAAM,QAAQ;AACtB,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,WAAW,EAAEC,SAAS,EAAEC,UAAU,EAAEC,oBAAoB,EAAEC,cAAc,EAAEC,iBAAiB,QAAQ,kBAAkB;AAC9H,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,MAAM,QAAQ,kBAAkB;AAEz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,IAAI,IAAI,IAAI,EAAE;UAC5CW,MAAM,CAACK,OAAO,CAACnB,WAAW,CAAC,CAACG,IAAI,GAAG,EAAE;QACvC;QACA,OAAOW,MAAM,CAACK,OAAO,CAACnB,WAAW,CAAC;MACpC;MACA,OAAOa,KAAK;IACd;MACE,OAAOA,KAAK;EAChB;AACF,CAAC","ignoreList":[]}
|
@@ -9,9 +9,10 @@ import _ from 'lodash';
|
|
9
9
|
import moment from 'moment';
|
10
10
|
import { connect } from 'react-redux';
|
11
11
|
import { maintenanceActions } from '../apis';
|
12
|
-
import { jobAdded } from '../actions';
|
12
|
+
import { jobAdded, jobStatusesUpdate, jobHideSeenUpdate } from '../actions';
|
13
13
|
import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
14
|
-
import
|
14
|
+
import PrioritySelectorPopup from '../components/PrioritySelectorPopup';
|
15
|
+
import { getJobStatus, getJobPriority } from '../helper';
|
15
16
|
import { Services } from '../feature.config';
|
16
17
|
import { Colours, Helper, Components, Config } from '../core.config';
|
17
18
|
import { values } from '../values.config';
|
@@ -24,6 +25,7 @@ class RequestDetail extends Component {
|
|
24
25
|
}, async () => {
|
25
26
|
try {
|
26
27
|
const res = await maintenanceActions.getJob(this.props.job.site, this.props.job.id);
|
28
|
+
// console.log('getJob', JSON.stringify(res.data, null, 2));
|
27
29
|
this.props.jobAdded(res.data);
|
28
30
|
this.updateJobState(res.data);
|
29
31
|
} catch (error) {
|
@@ -136,6 +138,23 @@ class RequestDetail extends Component {
|
|
136
138
|
}
|
137
139
|
});
|
138
140
|
});
|
141
|
+
_defineProperty(this, "updateJobPriority", () => {
|
142
|
+
this.setState({
|
143
|
+
loading: true
|
144
|
+
}, async () => {
|
145
|
+
try {
|
146
|
+
const res = await maintenanceActions.editJobPriority(this.props.job.id, this.state.priority);
|
147
|
+
this.props.jobAdded(res.data.job);
|
148
|
+
this.getJob();
|
149
|
+
} catch (error) {
|
150
|
+
console.log('updateJobPriority error', error);
|
151
|
+
} finally {
|
152
|
+
this.setState({
|
153
|
+
loading: false
|
154
|
+
});
|
155
|
+
}
|
156
|
+
});
|
157
|
+
});
|
139
158
|
_defineProperty(this, "onPressBack", () => {
|
140
159
|
Services.navigation.goBack();
|
141
160
|
});
|
@@ -150,6 +169,7 @@ class RequestDetail extends Component {
|
|
150
169
|
});
|
151
170
|
});
|
152
171
|
_defineProperty(this, "onSelectStatus", status => {
|
172
|
+
if (this.state.loading) return;
|
153
173
|
this.setState({
|
154
174
|
status,
|
155
175
|
showStatusPopup: false
|
@@ -157,6 +177,25 @@ class RequestDetail extends Component {
|
|
157
177
|
this.updateJobStatus();
|
158
178
|
});
|
159
179
|
});
|
180
|
+
_defineProperty(this, "onOpenPriorityPicker", () => {
|
181
|
+
this.setState({
|
182
|
+
showPriorityPopup: true
|
183
|
+
});
|
184
|
+
});
|
185
|
+
_defineProperty(this, "onClosePriorityPopup", () => {
|
186
|
+
this.setState({
|
187
|
+
showPriorityPopup: false
|
188
|
+
});
|
189
|
+
});
|
190
|
+
_defineProperty(this, "onSelectPriority", priority => {
|
191
|
+
if (this.state.loading) return;
|
192
|
+
this.setState({
|
193
|
+
priority,
|
194
|
+
showPriorityPopup: false
|
195
|
+
}, () => {
|
196
|
+
this.updateJobPriority();
|
197
|
+
});
|
198
|
+
});
|
160
199
|
_defineProperty(this, "openStaffNotes", () => {
|
161
200
|
Services.navigation.navigate(values.screenRequestNotes, {
|
162
201
|
job: this.state.job,
|
@@ -280,11 +319,13 @@ class RequestDetail extends Component {
|
|
280
319
|
isDateTimePickerVisible: false,
|
281
320
|
popUpType: '',
|
282
321
|
status: '',
|
322
|
+
priority: '',
|
283
323
|
expectedDate: null,
|
284
324
|
expectedDateText: '',
|
285
325
|
seen: false,
|
286
326
|
showMore: true,
|
287
327
|
showStatusPopup: false,
|
328
|
+
showPriorityPopup: false,
|
288
329
|
loading: false,
|
289
330
|
showFullscreenVideo: false,
|
290
331
|
currentVideoUrl: '',
|
@@ -298,6 +339,8 @@ class RequestDetail extends Component {
|
|
298
339
|
this.commentSection = /*#__PURE__*/React.createRef();
|
299
340
|
}
|
300
341
|
componentDidMount() {
|
342
|
+
this.props.jobStatusesUpdate(this.props.job.site);
|
343
|
+
this.props.jobHideSeenUpdate(this.props.job.site);
|
301
344
|
this.getJob();
|
302
345
|
this.updateJobState(this.props.job);
|
303
346
|
this.getAssignees();
|
@@ -343,12 +386,11 @@ class RequestDetail extends Component {
|
|
343
386
|
status,
|
344
387
|
job
|
345
388
|
} = this.state;
|
346
|
-
const
|
347
|
-
|
348
|
-
statusColor
|
349
|
-
} = getJobStatusProps(status);
|
389
|
+
const statusOption = getJobStatus(status, this.props);
|
390
|
+
const priority = getJobPriority(job.priority);
|
350
391
|
const canEdit = this.hasPermission();
|
351
|
-
const
|
392
|
+
const isStaff = this.props.user.category === 'staff';
|
393
|
+
const showSeen = !status || status === getJobStatus(null, this.props).text;
|
352
394
|
return /*#__PURE__*/React.createElement(View, {
|
353
395
|
style: {
|
354
396
|
...Helper.getShadowStyle()
|
@@ -372,7 +414,7 @@ class RequestDetail extends Component {
|
|
372
414
|
color: this.props.colourBrandingMain
|
373
415
|
}],
|
374
416
|
numberOfLines: 2
|
375
|
-
}, job.type)), showSeen && this.state.seen && /*#__PURE__*/React.createElement(View, {
|
417
|
+
}, job.type)), !this.props.hideSeen && showSeen && this.state.seen && /*#__PURE__*/React.createElement(View, {
|
376
418
|
style: styles.jobSeenContainer
|
377
419
|
}, /*#__PURE__*/React.createElement(Icon, {
|
378
420
|
name: "check",
|
@@ -393,6 +435,8 @@ class RequestDetail extends Component {
|
|
393
435
|
}, /*#__PURE__*/React.createElement(Text, {
|
394
436
|
style: styles.textSectionText
|
395
437
|
}, moment(job.lastActivityUnix).format('ddd D MMMM, h:mm A'))))), /*#__PURE__*/React.createElement(View, {
|
438
|
+
style: styles.jobInfoContainer
|
439
|
+
}, /*#__PURE__*/React.createElement(View, {
|
396
440
|
style: styles.jobStatusExpectedContainer
|
397
441
|
}, /*#__PURE__*/React.createElement(View, {
|
398
442
|
style: styles.jobStatusOuterContainer
|
@@ -402,11 +446,11 @@ class RequestDetail extends Component {
|
|
402
446
|
onPress: canEdit ? this.onOpenStatusPicker : null
|
403
447
|
}, /*#__PURE__*/React.createElement(View, {
|
404
448
|
style: [styles.jobStatusContainer, {
|
405
|
-
backgroundColor:
|
449
|
+
backgroundColor: statusOption.color
|
406
450
|
}]
|
407
451
|
}, /*#__PURE__*/React.createElement(Text, {
|
408
452
|
style: styles.jobStatusText
|
409
|
-
},
|
453
|
+
}, statusOption === null || statusOption === void 0 ? void 0 : statusOption.text)))), this.hasPermission() && /*#__PURE__*/React.createElement(View, {
|
410
454
|
style: styles.jobStatusOuterContainer
|
411
455
|
}, /*#__PURE__*/React.createElement(Text, {
|
412
456
|
style: styles.jobStatusHeading
|
@@ -422,7 +466,19 @@ class RequestDetail extends Component {
|
|
422
466
|
iconStyle: styles.jobStatusIcon
|
423
467
|
}), /*#__PURE__*/React.createElement(Text, {
|
424
468
|
style: styles.jobStatusText
|
425
|
-
}, "Notes (", (job.Notes || []).length, ")")))))
|
469
|
+
}, "Notes (", (job.Notes || []).length, ")"))))), isStaff && /*#__PURE__*/React.createElement(View, {
|
470
|
+
style: styles.jobPriorityOuterContainer
|
471
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
472
|
+
style: styles.jobStatusHeading
|
473
|
+
}, "PRIORITY"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
474
|
+
onPress: canEdit ? this.onOpenPriorityPicker : null
|
475
|
+
}, /*#__PURE__*/React.createElement(View, {
|
476
|
+
style: [styles.jobStatusContainer, {
|
477
|
+
backgroundColor: priority.color
|
478
|
+
}]
|
479
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
480
|
+
style: styles.jobStatusText
|
481
|
+
}, priority.label))))));
|
426
482
|
}
|
427
483
|
renderPlayableImageUrl(images, index, containerStyle, showMore) {
|
428
484
|
const url = images[index || 0];
|
@@ -662,6 +718,13 @@ class RequestDetail extends Component {
|
|
662
718
|
onSelect: this.onSelectStatus
|
663
719
|
});
|
664
720
|
}
|
721
|
+
renderPriorityPopup() {
|
722
|
+
if (!this.state.showPriorityPopup) return null;
|
723
|
+
return /*#__PURE__*/React.createElement(PrioritySelectorPopup, {
|
724
|
+
onClose: this.onClosePriorityPopup,
|
725
|
+
onSelect: this.onSelectPriority
|
726
|
+
});
|
727
|
+
}
|
665
728
|
render() {
|
666
729
|
if (this.state.forbidden) {
|
667
730
|
return /*#__PURE__*/React.createElement(Components.Forbidden, null);
|
@@ -683,7 +746,7 @@ class RequestDetail extends Component {
|
|
683
746
|
}
|
684
747
|
}, /*#__PURE__*/React.createElement(View, {
|
685
748
|
style: styles.innerContainer
|
686
|
-
}, this.renderTop(), this.renderAssignee(), this.rendeDetails(), this.renderMessages())), this.renderMessagesReply(), this.renderStatusPopup(), this.renderImagePopup(), /*#__PURE__*/React.createElement(DateTimePicker, {
|
749
|
+
}, this.renderTop(), this.renderAssignee(), this.rendeDetails(), this.renderMessages())), this.renderMessagesReply(), this.renderStatusPopup(), this.renderPriorityPopup(), this.renderImagePopup(), /*#__PURE__*/React.createElement(DateTimePicker, {
|
687
750
|
isVisible: this.state.isDateTimePickerVisible,
|
688
751
|
onConfirm: this.onDateSelected,
|
689
752
|
onCancel: this.onCloseDatePicker,
|
@@ -752,15 +815,17 @@ const styles = StyleSheet.create({
|
|
752
815
|
fontSize: 13,
|
753
816
|
color: Colours.TEXT_LIGHT
|
754
817
|
},
|
755
|
-
|
756
|
-
flexDirection: 'row',
|
757
|
-
alignItems: 'flex-start',
|
758
|
-
justifyContent: 'space-between',
|
818
|
+
jobInfoContainer: {
|
759
819
|
borderTopWidth: 1,
|
760
820
|
borderTopColor: Colours.LINEGREY,
|
761
821
|
paddingVertical: 14,
|
762
822
|
paddingHorizontal: 12
|
763
823
|
},
|
824
|
+
jobStatusExpectedContainer: {
|
825
|
+
flexDirection: 'row',
|
826
|
+
alignItems: 'flex-start',
|
827
|
+
justifyContent: 'space-between'
|
828
|
+
},
|
764
829
|
jobStatusOuterContainer: {
|
765
830
|
// marginRight: 50,
|
766
831
|
},
|
@@ -792,6 +857,9 @@ const styles = StyleSheet.create({
|
|
792
857
|
flex: 1,
|
793
858
|
textAlign: 'center'
|
794
859
|
},
|
860
|
+
jobPriorityOuterContainer: {
|
861
|
+
marginTop: 12
|
862
|
+
},
|
795
863
|
jobExpectedDateContainer: {
|
796
864
|
backgroundColor: Colours.BOXGREY,
|
797
865
|
flexDirection: 'row',
|
@@ -970,10 +1038,14 @@ const mapStateToProps = state => {
|
|
970
1038
|
return {
|
971
1039
|
user: state.user,
|
972
1040
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
973
|
-
jobs: state[values.reducerKey].jobs
|
1041
|
+
jobs: state[values.reducerKey].jobs,
|
1042
|
+
statusTypes: state[values.reducerKey].jobstatuses,
|
1043
|
+
hideSeen: state[values.reducerKey].hideSeen
|
974
1044
|
};
|
975
1045
|
};
|
976
1046
|
export default connect(mapStateToProps, {
|
977
|
-
jobAdded
|
1047
|
+
jobAdded,
|
1048
|
+
jobStatusesUpdate,
|
1049
|
+
jobHideSeenUpdate
|
978
1050
|
})(RequestDetail);
|
979
1051
|
//# sourceMappingURL=RequestDetail.js.map
|