Closing many tickets

This commit is contained in:
John Lyon-Smith
2018-04-22 15:22:36 -07:00
parent 4bc0a6cd30
commit 5cb13f7498
31 changed files with 392 additions and 100 deletions

View File

@@ -19,6 +19,7 @@ import {
formatLatLng,
parseLatLng,
pad,
geoDistance,
} from "../util"
const styles = StyleSheet.create({
@@ -36,6 +37,25 @@ export class WorkItemList extends React.Component {
this.state = {
messageModal: null,
}
const { search } = this.props.location
if (search) {
const params = new URLSearchParams(search)
const latLng = params.get("latLng")
if (latLng) {
const [lat, lng] = latLng.split(",")
if (lat && lng) {
this.position = {
latitude: parseFloat(lat),
longitude: parseFloat(lng),
}
}
}
}
api
.listWorkItems()
.then((list) => {
@@ -54,7 +74,7 @@ export class WorkItemList extends React.Component {
@autobind
handleItemSelect(item, ref) {
this.props.history.push(`/workitem?id=${item._id}`)
this.props.history.push(`/workItem?id=${item._id}`)
}
@autobind
@@ -95,7 +115,7 @@ export class WorkItemList extends React.Component {
@autobind
handleDonePress() {
this.props.history.push("/workitem")
this.props.history.push("/workItem")
}
@autobind
@@ -159,7 +179,17 @@ export class WorkItemList extends React.Component {
{workItemTypeText[item.workItemType]}
</Text>
<Text style={{ fontSize: 14, color: "gray" }}>
{`${item.address || "..."} | ??? mi`}
{`${item.address || "..."} | ${
this.position
? geoDistance(
this.position.latitude,
this.position.longitude,
item.location.coordinates[1],
item.location.coordinates[0],
"K"
).toFixed(2)
: "?"
} km`}
</Text>
</View>
<Icon