Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve add wetland site #3460

Merged
merged 5 commits into from
Aug 28, 2023
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
20 changes: 20 additions & 0 deletions bims/enums/ecosystem_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,23 @@
(HYDROPERIOD_SATURATED, HYDROPERIOD_SATURATED),
(HYDROPERIOD_DRY, HYDROPERIOD_DRY),
)

HYDROGEOMORPHIC_NONE = '-'
HYDROGEOMORPHIC_FLOODPLAIN = 'Floodplain'
HYDROGEOMORPHIC_CHANNELLED_VALLEY_BOTTOM = 'Channelled valley-bottom'
HYDROGEOMORPHIC_UNCHANNELLED_VALLEY_BOTTOM = 'Unchannelled valley-bottom'
HYDROGEOMORPHIC_SEEP = 'Seep'
HYDROGEOMORPHIC_DEPRESSION = 'Depression'
HYDROGEOMORPHIC_WETLAND_FLAT = 'Wetland flat'
HYDROGEOMORPHIC_UNKNOWN = 'Unknown'

HYDROGEOMORPHIC_CHOICES = (
(HYDROGEOMORPHIC_NONE, HYDROGEOMORPHIC_NONE),
(HYDROGEOMORPHIC_FLOODPLAIN, HYDROGEOMORPHIC_FLOODPLAIN),
(HYDROGEOMORPHIC_CHANNELLED_VALLEY_BOTTOM, HYDROGEOMORPHIC_CHANNELLED_VALLEY_BOTTOM),
(HYDROGEOMORPHIC_UNCHANNELLED_VALLEY_BOTTOM, HYDROGEOMORPHIC_UNCHANNELLED_VALLEY_BOTTOM),
(HYDROGEOMORPHIC_SEEP, HYDROGEOMORPHIC_SEEP),
(HYDROGEOMORPHIC_DEPRESSION, HYDROGEOMORPHIC_DEPRESSION),
(HYDROGEOMORPHIC_WETLAND_FLAT, HYDROGEOMORPHIC_WETLAND_FLAT),
(HYDROGEOMORPHIC_UNKNOWN, HYDROGEOMORPHIC_UNKNOWN),
)
35 changes: 35 additions & 0 deletions bims/migrations/0347_locationsite_hydrogeomorphic_type_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 4.1.10 on 2023-08-25 09:27

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('bims', '0346_alter_bimsdocument_authors_and_more'),
]

operations = [
migrations.AddField(
model_name='locationsite',
name='hydrogeomorphic_type',
field=models.CharField(blank=True, default='', max_length=128, null=True),
),
migrations.AddField(
model_name='locationsite',
name='user_hydrogeomorphic_type',
field=models.CharField(blank=True, choices=[('-', '-'), ('Floodplain', 'Floodplain'), ('Channelled valley-bottom', 'Channelled valley-bottom'), ('Unchannelled valley-bottom', 'Unchannelled valley-bottom'), ('Seep', 'Seep'), ('Depression', 'Depression'), ('Wetland flat', 'Wetland flat'), ('Unknown', 'Unknown')], default='-', max_length=128, null=True),
),
migrations.AddField(
model_name='locationsite',
name='user_wetland_name',
field=models.CharField(blank=True, default='', max_length=256, null=True),
),
migrations.AddField(
model_name='locationsite',
name='wetland_name',
field=models.CharField(blank=True, default='', max_length=256, null=True),
),
]
32 changes: 29 additions & 3 deletions bims/models/location_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
from bims.models.location_context import LocationContext
from bims.models.location_context_group import LocationContextGroup
from bims.utils.decorator import prevent_recursion
from bims.enums.ecosystem_type import ECOSYSTEM_TYPE_CHOICES
from bims.enums.ecosystem_type import (
ECOSYSTEM_TYPE_CHOICES, HYDROGEOMORPHIC_NONE, HYDROGEOMORPHIC_CHOICES
)

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -180,6 +182,31 @@ class LocationSite(DocumentLinksMixin, AbstractValidation):
default='',
null=True
)
wetland_name = models.CharField(
max_length=256,
blank=True,
default='',
null=True
)
user_wetland_name = models.CharField(
max_length=256,
blank=True,
default='',
null=True
)
hydrogeomorphic_type = models.CharField(
max_length=128,
blank=True,
default='',
null=True
)
user_hydrogeomorphic_type = models.CharField(
max_length=128,
blank=True,
null=True,
default=HYDROGEOMORPHIC_NONE,
choices=HYDROGEOMORPHIC_CHOICES
)

@property
def location_site_identifier(self):
Expand All @@ -200,8 +227,7 @@ def get_centroid(self):
""" Getting centroid of location site """

if (
self.geometry_point and
self.location_type.allowed_geometry == 'POINT'
self.geometry_point
):
return self.geometry_point
else:
Expand Down
44 changes: 44 additions & 0 deletions bims/static/css/site_form.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ body {
padding-bottom: 15px;
}

/* Loading overlay styles */
#loading {
position: absolute;
width: 600px;
height: 400px;
background: rgba(255, 255, 255, 0.8);
text-align: center;
line-height: 400px;
font-size: 24px;
}

#update-coordinate {
margin-top: 2px;
}
Expand Down Expand Up @@ -85,3 +96,36 @@ label.error {
color: white;
font-size: 10pt;
}


/* Loading overlay styles */
#map-loading {
display: none;
color: #444444;
position: absolute;
width: 100%;
max-height: 500px;
height: 500px;
background: rgba(255, 255, 255, 0.8);
line-height: 500px;
font-size: 24px;
top: 0;
left: 0;
z-index: 999;
justify-content: center;
}
#map-loading .loading-text {
width: 300px;
}
#map-loading .loading-text::after {
display: inline-block;
animation: dotty steps(1,end) 1s infinite;
content: '';
}
@keyframes dotty {
0% { content: ''; }
25% { content: '.'; }
50% { content: '..'; }
75% { content: '...'; }
100% { content: ''; }
}
5 changes: 3 additions & 2 deletions bims/static/js/non_requirejs/site_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ let addMarkerToMap = (lat, lon, zoomToMap = true) => {
anchor: [0.55, 43],
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
opacity: 0.75,
opacity: 1,
src: '/static/img/map-marker.png'
}))
});
Expand All @@ -348,10 +348,11 @@ let addMarkerToMap = (lat, lon, zoomToMap = true) => {
map.addLayer(new ol.layer.Vector({
source: markerSource,
style: markerStyle,
zIndex: 1000
}));
if (zoomToMap) {
map.getView().setCenter(locationSiteCoordinate);
map.getView().setZoom(6);
map.getView().setZoom(14);
}
if (allowToEdit) {
document.getElementById('update-site-code').disabled = false;
Expand Down
Loading
Loading