adding the lots in the correct section
This commit is contained in:
parent
b7a723866b
commit
715702658f
|
@ -5,6 +5,7 @@ from typing import Union
|
||||||
from boltons import urlutils
|
from boltons import urlutils
|
||||||
from citext import CIText
|
from citext import CIText
|
||||||
from flask import g
|
from flask import g
|
||||||
|
from flask_login import current_user
|
||||||
from sqlalchemy import TEXT
|
from sqlalchemy import TEXT
|
||||||
from sqlalchemy.dialects.postgresql import UUID
|
from sqlalchemy.dialects.postgresql import UUID
|
||||||
from sqlalchemy_utils import LtreeType
|
from sqlalchemy_utils import LtreeType
|
||||||
|
@ -103,6 +104,18 @@ class Lot(Thing):
|
||||||
def is_temporary(self):
|
def is_temporary(self):
|
||||||
return False if self.trade else True
|
return False if self.trade else True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_incominig(self):
|
||||||
|
if self.trade and self.trade.user_to == current_user:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_outgoing(self):
|
||||||
|
if self.trade and self.trade.user_from == current_user:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def descendantsq(cls, id):
|
def descendantsq(cls, id):
|
||||||
_id = UUIDLtree.convert(id)
|
_id = UUIDLtree.convert(id)
|
||||||
|
|
|
@ -255,16 +255,15 @@
|
||||||
<i class="bi bi-arrow-down-right"></i><span>Incoming Lots</span><i class="bi bi-chevron-down ms-auto"></i>
|
<i class="bi bi-arrow-down-right"></i><span>Incoming Lots</span><i class="bi bi-chevron-down ms-auto"></i>
|
||||||
</a>
|
</a>
|
||||||
<ul id="incoming-lots-nav" class="nav-content collapse" data-bs-parent="#sidebar-nav">
|
<ul id="incoming-lots-nav" class="nav-content collapse" data-bs-parent="#sidebar-nav">
|
||||||
|
{% for lot in lots %}
|
||||||
|
{% if lot.is_incominig %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#TODO incoming lot #1 details">
|
<a href="{{ url_for('inventory.devices.lotdevicelist', id=lot.id) }}">
|
||||||
<i class="bi bi-circle"></i><span>Incoming lot #1</span>
|
<i class="bi bi-circle"></i><span>{{ lot.name }}</span>
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#TODO incoming lot #2 details">
|
|
||||||
<i class="bi bi-circle"></i><span>Incoming lot #2</span>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li><!-- End Incoming Lots Nav -->
|
</li><!-- End Incoming Lots Nav -->
|
||||||
|
|
||||||
|
@ -273,16 +272,15 @@
|
||||||
<i class="bi bi-arrow-up-right"></i><span>Outgoing Lots</span><i class="bi bi-chevron-down ms-auto"></i>
|
<i class="bi bi-arrow-up-right"></i><span>Outgoing Lots</span><i class="bi bi-chevron-down ms-auto"></i>
|
||||||
</a>
|
</a>
|
||||||
<ul id="outgoing-lots-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
|
<ul id="outgoing-lots-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
|
||||||
|
{% for lot in lots %}
|
||||||
|
{% if lot.is_outgoing %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#TODO">
|
<a href="{{ url_for('inventory.devices.lotdevicelist', id=lot.id) }}">
|
||||||
<i class="bi bi-circle"></i><span>Outgoing lot #1</span>
|
<i class="bi bi-circle"></i><span>{{ lot.name }}</span>
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#TODO">
|
|
||||||
<i class="bi bi-circle"></i><span>Outgoing lot #2</span>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li><!-- End Outgoing Lots Nav -->
|
</li><!-- End Outgoing Lots Nav -->
|
||||||
|
|
||||||
|
@ -296,16 +294,15 @@
|
||||||
<i class="bi bi-plus" style="font-size: larger;"></i><span>New temporal lot</span>
|
<i class="bi bi-plus" style="font-size: larger;"></i><span>New temporal lot</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% for lot in lots %}
|
||||||
|
{% if lot.is_temporary %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#TODO">
|
<a href="{{ url_for('inventory.devices.lotdevicelist', id=lot.id) }}">
|
||||||
<i class="bi bi-circle"></i><span>Temporal lot #1</span>
|
<i class="bi bi-circle"></i><span>{{ lot.name }}</span>
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#TODO">
|
|
||||||
<i class="bi bi-circle"></i><span>Temporal lot #2</span>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li><!-- End Temporal Lots Nav -->
|
</li><!-- End Temporal Lots Nav -->
|
||||||
|
|
||||||
|
|
Reference in New Issue