Adding work item ticket number into to list

This commit is contained in:
John Lyon-Smith
2018-04-06 17:13:09 -07:00
parent 1f869ef4cc
commit a60abff226
3 changed files with 17 additions and 2 deletions

View File

@@ -3,5 +3,5 @@ import { Route, Redirect } from "react-router-native"
export const DefaultRoute = () => { export const DefaultRoute = () => {
// NOTE: When working on the app, change this to the page you are working on // NOTE: When working on the app, change this to the page you are working on
return <Route render={() => <Redirect to={"/workitemlist"} />} /> return <Route render={() => <Redirect to={"/home"} />} />
} }

View File

@@ -13,7 +13,7 @@ import { MessageModal } from "../Modal"
import autobind from "autobind-decorator" import autobind from "autobind-decorator"
import { SwipeListView } from "react-native-swipe-list-view" import { SwipeListView } from "react-native-swipe-list-view"
import { api } from "../API" import { api } from "../API"
import { workItemTypeEnum, formatLatLng, parseLatLng } from "../util" import { workItemTypeEnum, formatLatLng, parseLatLng, pad } from "../util"
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@@ -140,6 +140,15 @@ export class WorkItemList extends React.Component {
onPress={() => this.handleItemSelect(item, rowMap[item._id])}> onPress={() => this.handleItemSelect(item, rowMap[item._id])}>
<View <View
style={{ height: "100%", width: "100%", flexDirection: "row" }}> style={{ height: "100%", width: "100%", flexDirection: "row" }}>
<Text
style={{
fontSize: 10,
width: 45,
marginLeft: 5,
alignSelf: "center",
}}>
{pad(item.ticketNumber, 4)}
</Text>
<View <View
style={{ style={{
flexGrow: 1, flexGrow: 1,

View File

@@ -44,3 +44,9 @@ export const workItemTypeEnum = [
{ value: "inspection", text: "Inspection" }, { value: "inspection", text: "Inspection" },
{ value: "complaint", text: "Complaint" }, { value: "complaint", text: "Complaint" },
] ]
export const pad = (num, size) => {
var s = num + ""
while (s.length < size) s = "0" + s
return s
}