drop settings and last_name of agent
This commit is contained in:
parent
febff54c6b
commit
04cdb8181f
|
@ -79,11 +79,6 @@ class ProfileForm(FlaskForm):
|
||||||
[validators.Length(min=2, max=35)],
|
[validators.Length(min=2, max=35)],
|
||||||
render_kw={'class': "form-control"},
|
render_kw={'class': "form-control"},
|
||||||
)
|
)
|
||||||
last_name = StringField(
|
|
||||||
'Last name',
|
|
||||||
[validators.Length(min=2, max=35)],
|
|
||||||
render_kw={'class': "form-control"},
|
|
||||||
)
|
|
||||||
email = StringField(
|
email = StringField(
|
||||||
'Email Address',
|
'Email Address',
|
||||||
[validators.Length(min=6, max=35)],
|
[validators.Length(min=6, max=35)],
|
||||||
|
@ -101,7 +96,6 @@ class ProfileForm(FlaskForm):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if user:
|
if user:
|
||||||
self.name.data = user.name
|
self.name.data = user.name
|
||||||
self.last_name.data = user.last_name
|
|
||||||
self.email.data = user.email
|
self.email.data = user.email
|
||||||
self.telephone.data = user.telephone
|
self.telephone.data = user.telephone
|
||||||
if user.country:
|
if user.country:
|
||||||
|
@ -110,7 +104,6 @@ class ProfileForm(FlaskForm):
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
agent = g.user.individual
|
agent = g.user.individual
|
||||||
agent.name = self.name.data
|
agent.name = self.name.data
|
||||||
agent.last_name = self.last_name.data
|
|
||||||
agent.email = self.email.data
|
agent.email = self.email.data
|
||||||
agent.telephone = self.telephone.data
|
agent.telephone = self.telephone.data
|
||||||
agent.country = self.country.data
|
agent.country = self.country.data
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
"""add new fields in agent
|
|
||||||
|
|
||||||
Revision ID: 1b61613d1c19
|
|
||||||
Revises: 8571fb32c912
|
|
||||||
Create Date: 2022-04-06 12:23:37.644108
|
|
||||||
|
|
||||||
"""
|
|
||||||
import citext
|
|
||||||
import sqlalchemy as sa
|
|
||||||
from alembic import context, op
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '1b61613d1c19'
|
|
||||||
down_revision = '8571fb32c912'
|
|
||||||
branch_labels = None
|
|
||||||
depends_on = None
|
|
||||||
|
|
||||||
|
|
||||||
def get_inv():
|
|
||||||
INV = context.get_x_argument(as_dictionary=True).get('inventory')
|
|
||||||
if not INV:
|
|
||||||
raise ValueError("Inventory value is not specified")
|
|
||||||
return INV
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
op.add_column(
|
|
||||||
"agent",
|
|
||||||
sa.Column("last_name", citext.CIText(), nullable=True),
|
|
||||||
schema=f'{get_inv()}',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
op.drop_column('agent', 'last_name', schema=f'{get_inv()}')
|
|
|
@ -31,7 +31,6 @@ class Agent(Thing):
|
||||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid4)
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid4)
|
||||||
type = Column(Unicode, nullable=False)
|
type = Column(Unicode, nullable=False)
|
||||||
name = Column(CIText())
|
name = Column(CIText())
|
||||||
last_name = Column(CIText())
|
|
||||||
name.comment = """The name of the organization or person."""
|
name.comment = """The name of the organization or person."""
|
||||||
tax_id = Column(Unicode(length=STR_SM_SIZE), check_lower('tax_id'))
|
tax_id = Column(Unicode(length=STR_SM_SIZE), check_lower('tax_id'))
|
||||||
tax_id.comment = """The Tax / Fiscal ID of the organization,
|
tax_id.comment = """The Tax / Fiscal ID of the organization,
|
||||||
|
@ -50,8 +49,6 @@ class Agent(Thing):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def get_full_name(self):
|
def get_full_name(self):
|
||||||
if self.last_name:
|
|
||||||
return "{} {}".format(self.name, self.last_name)
|
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
@declared_attr
|
@declared_attr
|
||||||
|
|
|
@ -42,10 +42,6 @@
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-edit">Edit Profile</button>
|
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-edit">Edit Profile</button>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-settings">Settings</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-change-password">Change Password</button>
|
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-change-password">Change Password</button>
|
||||||
</li>
|
</li>
|
||||||
|
@ -153,48 +149,6 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade pt-3" id="profile-settings">
|
|
||||||
|
|
||||||
<!-- Settings Form -->
|
|
||||||
<form class="d-none">
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label for="fullName" class="col-md-4 col-lg-3 col-form-label">Email Notifications</label>
|
|
||||||
<div class="col-md-8 col-lg-9">
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="changesMade" checked>
|
|
||||||
<label class="form-check-label" for="changesMade">
|
|
||||||
Changes made to your account
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="newProducts" checked>
|
|
||||||
<label class="form-check-label" for="newProducts">
|
|
||||||
Information on new products and services
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="proOffers">
|
|
||||||
<label class="form-check-label" for="proOffers">
|
|
||||||
Marketing and promo offers
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="securityNotify" checked disabled>
|
|
||||||
<label class="form-check-label" for="securityNotify">
|
|
||||||
Security alerts
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
<button type="submit" class="btn btn-primary">Save Changes</button>
|
|
||||||
</div>
|
|
||||||
</form><!-- End settings Form -->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade pt-3" id="profile-change-password">
|
<div class="tab-pane fade pt-3" id="profile-change-password">
|
||||||
<!-- Change Password Form -->
|
<!-- Change Password Form -->
|
||||||
<form action="{{ url_for('core.set-password') }}" method="post">
|
<form action="{{ url_for('core.set-password') }}" method="post">
|
||||||
|
|
Reference in New Issue