Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/browser/areas/form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,25 @@ class Filter extends Component {
if (nextProps.values[fields[j]] === 'all') add += 1;
else break;
}

const field = fields[i - add];
const filter = { type: fields[i + 1] };
filter[field] = nextProps.values[field];
if (field) {
filter[field] = nextProps.values[field];
}

if (fields[i + 1]) {
fetchAreaList(filter);
}
if (insertAreaId && items) {
const id = items.get(field).filter(x => x.id === nextProps.values[field]);

const currentField = items.get(field);
if (insertAreaId && items && currentField) {
const id = currentField.filter(x => x.id === nextProps.values[field]);
if (id.length > 0) {
change(formName, 'areaId', id[0].pathId);
}
}

this.removeToEnd(i + 1);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/auth/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const hasAreaAuthorization = (userAreas, area, role, exactRole = false) =
: (userAreaRoleId <= selectedRoleId);
}, false);

export const hasEventAuthorization = (user, event) => user.id === event.userId;
export const hasEventAuthorization = (user, event) => user.id === parseInt(event.userId, 10);

export const hasOrganizationAuthorization = (user, organization, roleId) => {
const o = user.organizations.filter(x => x.id === organization.id)[0];
Expand Down
4 changes: 2 additions & 2 deletions src/common/events/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import geolib from 'geolib';

export const getPointsBound = (points) => {
if (!points) return null;
if (!points || points.length === 0) return null;

const result = {
upperLeft: {},
Expand All @@ -47,7 +47,7 @@ export const getPointsBound = (points) => {

let coords = {};
if (points.length === 1 || isMultiplePoint(points)) {
const { lat, long } = points[0].gps;
const { lat, long } = ((points[0] || {}).gps || { lat: 0, long: 0 });
const pointObj = { lat, lon: long };
const upperLeftPoint = geolib.computeDestinationPoint(pointObj, 20, 315);
const bottomRightPoint = geolib.computeDestinationPoint(pointObj, 20, 135);
Expand Down
1 change: 1 addition & 0 deletions src/common/table/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export class CollectionPointFilter extends Record({
page: 1,
orderBy: '',
limit: 10,
collectionPointNote: '',
}, 'collectionPointFilter') {
constructor(values) {
if (!values) {
Expand Down