Skip to content

Commit

Permalink
Merge pull request #335 from TaiBIF/issue/issue-#316
Browse files Browse the repository at this point in the history
Issue/issue #316
  • Loading branch information
ts00617355 authored Oct 17, 2019
2 parents eed4830 + c01c28f commit c52310d
Show file tree
Hide file tree
Showing 8 changed files with 867 additions and 90 deletions.
61 changes: 54 additions & 7 deletions src/components/ProjectEdit/Trip/EditProjectTripBasic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
</div>
</form>
</div>
<div class="edit-project-trip-basic-footer float-right mt-3">
<div class="edit-project-trip-basic-footer float-right mt-3 mb-3">
<button
class="btn btn-green-border mr-3"
@click="closeEditProjectTripBasic"
Expand Down Expand Up @@ -190,10 +190,10 @@ export default {
openEditProjectTripCamera: {
type: Function,
},
addProjectTripRequest: {
addEditProjectTripRequest: {
type: Function,
},
setEditProjectTrip: {
setEditProjectTripData: {
type: Function,
},
editProjectTripData: {
Expand Down Expand Up @@ -301,9 +301,53 @@ export default {
if (this.projectTripCameraLocations[value]) {
cameraLocations = this.projectTripCameraLocations[value].map(
cameraLocation => {
let cameraLocationEvent = undefined;
let cameraLocationMark = undefined;
let projectCameras = undefined;
if (
this.editProjectTripData.id &&
this.editProjectTripData.studyAreas
) {
this.editProjectTripData.studyAreas.some(
studyAreaData => {
if (
studyAreaData.studyArea === value &&
studyAreaData.cameraLocations
) {
studyAreaData.cameraLocations.some(
cameraLocationData => {
if (
cameraLocationData.cameraLocation ===
cameraLocation.value
) {
cameraLocationEvent =
cameraLocationData.cameraLocationEvent;
cameraLocationMark =
cameraLocationData.cameraLocationMark;
if (
cameraLocationData.projectCameras &&
cameraLocationData.projectCameras.length > 0
)
projectCameras =
cameraLocationData.projectCameras;
return true;
}
},
);
}
if (projectCameras) {
return true;
}
},
);
}
return {
cameraLocation: cameraLocation.value,
title: cameraLocation.label,
cameraLocationEvent: cameraLocationEvent || '',
cameraLocationMark: cameraLocationMark || '',
projectCameras: projectCameras || [],
};
},
);
Expand All @@ -320,14 +364,17 @@ export default {
}
const { sn, member, mark } = this.projectTrip;
const body = {
let body = {
sn,
member,
mark,
studyAreas,
date: this.projectTripDate,
};
this.setEditProjectTrip(body);
if (this.editProjectTripData.id)
body = { id: this.editProjectTripData.id, ...body };
this.setEditProjectTripData(body);
if (this.showNextStep) {
if (emptyCameraLocation) this.openCheckCameraLocationsModal();
Expand Down Expand Up @@ -355,13 +402,13 @@ export default {
this.showCheckCameraLocationsModal = false;
},
checkAddProjectTripRequest() {
this.addProjectTripRequest(true);
this.addEditProjectTripRequest(true);
this.closeCheckStudyAreasModal();
this.closeEditProjectTripBasic();
},
checkGoEditProjectTripCamera() {
if (this.showNextStep) this.openEditProjectTripCamera();
else this.addProjectTripRequest(true);
else this.addEditProjectTripRequest(true);
this.closeCheckCameraLocationsModal();
this.closeEditProjectTripBasic();
Expand Down
Loading

0 comments on commit c52310d

Please sign in to comment.