-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bats): add dashboard, list and edit views
- Loading branch information
Showing
7 changed files
with
495 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
const angular = require('angular') | ||
const LocalCache = require('./mixins/local_cache') | ||
const countPendingReview = require('./mixins/countPendingReview') | ||
|
||
const COPY_PERSIST_PROPS = Object.fromEntries([ | ||
'latitude', | ||
'longitude', | ||
'geolocationAccuracy', | ||
'nameWaterBody', | ||
|
||
// common fields | ||
'observationMethodology', | ||
'source', | ||
'observationDateTime', | ||
'monitoringCode', | ||
'endDateTime', | ||
'startDateTime', | ||
'observers', | ||
'rain', | ||
'temperature', | ||
'windDirection', | ||
'windSpeed', | ||
'cloudiness', | ||
'cloudsType', | ||
'visibility', | ||
'mto', | ||
'notes', | ||
'threats', | ||
'track', | ||
'location', | ||
'user', | ||
'organization', | ||
|
||
// form fields | ||
'metodology', | ||
'tCave', | ||
'hCave', | ||
'typloc', | ||
'habitats' | ||
].map(k => [k, true])) | ||
|
||
require('../app').factory('FormBats', /* @ngInject */function ($resource, ENDPOINT_URL, db) { | ||
const FormBats = $resource(ENDPOINT_URL + '/bats/:id', { | ||
id: '@id' | ||
}, { | ||
// api methods | ||
export: { method: 'POST', url: ENDPOINT_URL + '/export/bats' }, | ||
countPendingReview | ||
}) | ||
|
||
// instance methods | ||
angular.extend(FormBats.prototype, { | ||
afterCreate: function () { | ||
this.initDefaults() | ||
}, | ||
getUser: function () { | ||
return db.users[this.user] | ||
}, | ||
getSpecies: function () { | ||
return db.species.fishes && db.species.fishes[this.species] | ||
}, | ||
hasSource: true, | ||
preCopy: function () { | ||
Object | ||
.keys(this) | ||
.filter(key => !key.startsWith('$') && !(key in COPY_PERSIST_PROPS)) | ||
.forEach(key => delete this[key]) | ||
}, | ||
postCopy: function () { | ||
this.initDefaults() | ||
}, | ||
initDefaults: function () { | ||
this.confidential = false | ||
this.moderatorReview = false | ||
}, | ||
hasNotes: true | ||
}) | ||
|
||
// class methods | ||
angular.extend(FormBats, { | ||
}) | ||
|
||
LocalCache.inject(FormBats, { | ||
name: 'bats' | ||
}) | ||
|
||
return FormBats | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<form name="smartform" | ||
role="form" | ||
confirm-on-exit="smartform.$dirty" | ||
confirm-message-window="{{'MONITORING_DETAIL_UNSAVED_DATA_ALERT_TITLE' | translate}}" | ||
confirm-message-route="{{'MONITORING_DETAIL_UNSAVED_DATA_ALERT_MESSAGE' | translate}}"> | ||
<div class="actions actions-detail"> | ||
<form-detail-buttons monitoring-detail-controller="monitoringDetailController"></form-detail-buttons> | ||
</div> | ||
<div class="row"> | ||
<div class="col-lg-12"> | ||
<h1 class="page-header"> | ||
<span ng-if="monitoringDetailController.data.id" translate>MONITORING_DETAIL_TITLE_EDIT</span> | ||
<span ng-if="!monitoringDetailController.data.id" translate>MONITORING_DETAIL_TITLE_NEW</span> | ||
</h1> | ||
</div> | ||
</div> | ||
|
||
<div ng-include="'/views/monitorings/common2.html'"></div> | ||
|
||
<div ng-include="'/views/monitorings/common.html'"></div> | ||
|
||
<div class="row"> | ||
<div class="col-md-7 col-lg-6" ng-include="'/views/monitorings/fields/geolocation.html'"></div> | ||
|
||
<div class="col-md-5 col-lg-6"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<field name="species" type="species" nomenclature="bats" required="true" | ||
label="{{'FIELD_SPECIES' | translate}}" | ||
model="monitoringDetailController.data.species"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6" ng-include="'/views/monitorings/fields/confidential.html'"></div> | ||
<div class="col-md-6 col-lg-6" ng-include="'/views/monitorings/fields/moderatorReview.html'"></div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="count" type="int" min="1" required="true" | ||
label="{{'FIELD_COUNT' | translate}}" | ||
model="monitoringDetailController.data.count"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="metodology" type="single-choice" nomenclature="bats_methodology" | ||
label="{{'BATS_DETAIL_METODOLOGY' | translate}}" | ||
model="monitoringDetailController.data.metodology"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="tCave" type="float" | ||
label="{{'BATS_DETAIL_T_CAVE' | translate}}" | ||
model="monitoringDetailController.data.tCave"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="hCave" type="float" | ||
label="{{'BATS_DETAIL_H_CAVE' | translate}}" | ||
model="monitoringDetailController.data.hCave"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="typloc" type="single-choice" nomenclature="bats_type_location" | ||
label="{{'BATS_DETAIL_TYPE_LOCATION' | translate}}" | ||
model="monitoringDetailController.data.typloc"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="sublocality" type="text" | ||
label="{{'BATS_DETAIL_SUBLOCALITY' | translate}}" | ||
model="monitoringDetailController.data.sublocality"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="swarming" type="bool" | ||
label="{{'BATS_DETAIL_SWARMING' | translate}}" | ||
help="{{'BATS_DETAIL_SWARMING_HELP' | translate}}" | ||
model="monitoringDetailController.data.swarming"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="age" type="single-choice" nomenclature="bats_age" | ||
label="{{'BATS_DETAIL_AGE' | translate}}" | ||
help="{{'BATS_DETAIL_AGE_HELP' | translate}}" | ||
model="monitoringDetailController.data.age"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="sex" type="single-choice" nomenclature="bats_sex" | ||
label="{{'BATS_DETAIL_SEX' | translate}}" | ||
help="{{'BATS_DETAIL_SEX_HELP' | translate}}" | ||
model="monitoringDetailController.data.sex"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="habitats" type="single-choice" nomenclature="bats_habitat" | ||
label="{{'BATS_DETAIL_HABITAT' | translate}}" | ||
model="monitoringDetailController.data.habitats"></field> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="condition" type="single-choice" nomenclature="bats_condition" | ||
label="{{'BATS_DETAIL_CONDITION' | translate}}" | ||
help="{{'BATS_DETAIL_CONDITION_HELP' | translate}}" | ||
model="monitoringDetailController.data.condition"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="typeCond" type="single-choice" nomenclature="bats_type_condition" | ||
label="{{'BATS_DETAIL_TYPE_CONDITION' | translate}}" | ||
model="monitoringDetailController.data.typeCond"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="reproductiveStatus" type="single-choice" nomenclature="bats_reproductive_status" | ||
label="{{'BATS_DETAIL_REPRODUCTIVE_STATUS' | translate}}" | ||
model="monitoringDetailController.data.reproductiveStatus"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="ring" type="single-choice" nomenclature="bats_ring" | ||
label="{{'BATS_DETAIL_RING' | translate}}" | ||
model="monitoringDetailController.data.ring"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="ringN" type="text" | ||
label="{{'BATS_DETAIL_RING_N' | translate}}" | ||
model="monitoringDetailController.data.ringN"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="bodyLength" type="float" | ||
label="{{'BATS_DETAIL_BODY_LENGTH' | translate}}" | ||
model="monitoringDetailController.data.bodyLength"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="tailLength" type="float" | ||
label="{{'BATS_DETAIL_TAIL_LENGTH' | translate}}" | ||
model="monitoringDetailController.data.tailLength"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="earLength" type="float" | ||
label="{{'BATS_DETAIL_EAR_LENGTH' | translate}}" | ||
model="monitoringDetailController.data.earLength"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="forearmLength" type="float" | ||
label="{{'BATS_DETAIL_FOREARM_LENGTH' | translate}}" | ||
model="monitoringDetailController.data.forearmLength"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="lengthThirdDigit" type="float" | ||
label="{{'BATS_DETAIL_LENGTH_THIRD_DIGIT' | translate}}" | ||
model="monitoringDetailController.data.lengthThirdDigit"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="lengthFifthDigit" type="float" | ||
label="{{'BATS_DETAIL_LENGTH_FIFTH_DIGIT' | translate}}" | ||
model="monitoringDetailController.data.lengthFifthDigit"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="lengthWS" type="float" | ||
label="{{'BATS_DETAIL_LENGTH_WS' | translate}}" | ||
model="monitoringDetailController.data.lengthWS"></field> | ||
</div> | ||
<div class="col-md-6 col-lg-6"> | ||
<field name="weight" type="float" | ||
label="{{'BATS_DETAIL_WEIGHT' | translate}}" | ||
model="monitoringDetailController.data.weight"></field> | ||
</div> | ||
</div> | ||
|
||
<div ng-include="'/views/monitorings/footer.html'"></div> | ||
|
||
<div class="row"> | ||
<form-pictures ng-model="monitoringDetailController.data.pictures"></form-pictures> | ||
</div> | ||
|
||
</form> |
Oops, something went wrong.