Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72843feaac | ||
|
|
e072e77663 | ||
|
|
9a3bd413d6 | ||
|
|
2fa346e084 | ||
|
|
ecd3e45632 | ||
|
|
48ec2df10d | ||
|
|
bc61eeacd3 | ||
|
|
a051071a1b | ||
|
|
a0b939ccd7 | ||
|
|
0fc8fac5aa | ||
|
|
220c15b3fa | ||
|
|
a514c97409 | ||
|
|
77e2411a88 | ||
|
|
5565e923ab |
@@ -0,0 +1,24 @@
|
||||
"""FP
|
||||
|
||||
Revision ID: 48af31eb6f3f
|
||||
Revises: 12262aadbc08
|
||||
Create Date: 2023-08-07 13:01:05.401492
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '48af31eb6f3f'
|
||||
down_revision = '12262aadbc08'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_unique_constraint(op.f('uq_fingerprints_date'), 'fingerprints', ['date', 'employee_id'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint(op.f('uq_fingerprints_date'), 'fingerprints', type_='unique')
|
||||
@@ -1 +1 @@
|
||||
__version__ = "11.1.5"
|
||||
__version__ = "11.2.1"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import uuid
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy.orm import Mapped, relationship
|
||||
@@ -18,6 +20,30 @@ class Account(AccountBase):
|
||||
"Product", primaryjoin="Account.id==Product.account_id", back_populates="account"
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
type_id: int,
|
||||
is_starred: bool,
|
||||
is_active: bool,
|
||||
is_reconcilable: bool,
|
||||
cost_centre_id: uuid.UUID,
|
||||
code: int | None = None,
|
||||
id_: uuid.UUID | None = None,
|
||||
is_fixture: bool = False,
|
||||
) -> None:
|
||||
if code is not None:
|
||||
self.code = code
|
||||
self.name = name
|
||||
self.type_id = type_id
|
||||
self.is_starred = is_starred
|
||||
self.is_active = is_active
|
||||
self.is_reconcilable = is_reconcilable
|
||||
self.cost_centre_id = cost_centre_id
|
||||
if id_ is not None:
|
||||
self.id = id_
|
||||
self.is_fixture = is_fixture
|
||||
|
||||
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
||||
if len(self.products) > 0:
|
||||
return False, "Account has products"
|
||||
|
||||
@@ -70,13 +70,6 @@ class AccountBase:
|
||||
self.id = id_
|
||||
self.is_fixture = is_fixture
|
||||
|
||||
def create(self, db: Session) -> "AccountBase":
|
||||
self.code = db.execute(
|
||||
select(func.coalesce(func.max(AccountBase.code), 0) + 1).where(AccountBase.type_id == self.type_id)
|
||||
).scalar_one()
|
||||
db.add(self)
|
||||
return self
|
||||
|
||||
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
||||
if self.is_fixture:
|
||||
return False, f"{self.name} is a fixture and cannot be edited or deleted."
|
||||
|
||||
@@ -3,7 +3,7 @@ import uuid
|
||||
from datetime import datetime
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import DateTime, ForeignKey, Uuid
|
||||
from sqlalchemy import DateTime, ForeignKey, UniqueConstraint, Uuid
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from ..db.base_class import reg
|
||||
@@ -16,6 +16,7 @@ if TYPE_CHECKING:
|
||||
@reg.mapped_as_dataclass(unsafe_hash=True)
|
||||
class Fingerprint:
|
||||
__tablename__ = "fingerprints"
|
||||
__table_args__ = (UniqueConstraint("date", "employee_id"),)
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, insert_default=uuid.uuid4)
|
||||
employee_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("employees.id"), nullable=False)
|
||||
|
||||
@@ -40,3 +40,30 @@ class Recipe:
|
||||
tags: Mapped[list["Tag"]] = relationship(
|
||||
"Tag", secondary=RecipeTag.__table__, order_by="Tag.name", back_populates="recipes"
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
date_: date,
|
||||
source: str,
|
||||
instructions: str,
|
||||
garnishing: str,
|
||||
plating: str,
|
||||
notes: str,
|
||||
recipe_yield: Decimal,
|
||||
sku_id: uuid.UUID | None = None,
|
||||
sku: "StockKeepingUnit" | None = None,
|
||||
id_: uuid.UUID | None = None,
|
||||
):
|
||||
self.date_ = date_
|
||||
self.source = source
|
||||
self.instructions = instructions
|
||||
self.garnishing = garnishing
|
||||
self.plating = plating
|
||||
self.notes = notes
|
||||
self.recipe_yield = recipe_yield
|
||||
if sku_id is not None:
|
||||
self.sku_id = sku_id
|
||||
if sku is not None:
|
||||
self.sku = sku
|
||||
if id_ is not None:
|
||||
self.id = id_
|
||||
|
||||
@@ -29,3 +29,26 @@ class RecipeItem:
|
||||
|
||||
recipe: Mapped["Recipe"] = relationship("Recipe", back_populates="items")
|
||||
product: Mapped["Product"] = relationship("Product")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
quantity: Decimal,
|
||||
description: str = "",
|
||||
recipe_id: uuid.UUID | None = None,
|
||||
product_id: uuid.UUID | None = None,
|
||||
recipe: "Recipe" | None = None,
|
||||
product: "Product" | None = None,
|
||||
id_: uuid.UUID | None = None,
|
||||
):
|
||||
self.quantity = quantity
|
||||
self.description = description
|
||||
if recipe_id is not None:
|
||||
self.recipe_id = recipe_id
|
||||
if product_id is not None:
|
||||
self.product_id = product_id
|
||||
if recipe is not None:
|
||||
self.recipe = recipe
|
||||
if product is not None:
|
||||
self.product = product
|
||||
if id_ is not None:
|
||||
self.id = id_
|
||||
|
||||
@@ -35,15 +35,14 @@ def save(
|
||||
with SessionFuture() as db:
|
||||
item = Account(
|
||||
name=data.name,
|
||||
code=Account.get_code(data.type_, db),
|
||||
type_id=data.type_,
|
||||
is_starred=data.is_starred,
|
||||
is_active=data.is_active,
|
||||
is_reconcilable=data.is_reconcilable,
|
||||
cost_centre_id=data.cost_centre.id_,
|
||||
)
|
||||
item.code = db.execute(
|
||||
select(func.coalesce(func.max(Account.code), 0) + 1).where(Account.type_id == item.type_id)
|
||||
).scalar_one()
|
||||
|
||||
db.add(item)
|
||||
db.commit()
|
||||
except SQLAlchemyError as e:
|
||||
|
||||
@@ -8,7 +8,7 @@ from io import StringIO
|
||||
import brewman.schemas.fingerprint as schemas
|
||||
|
||||
from fastapi import APIRouter, Depends, File, HTTPException, UploadFile, status
|
||||
from sqlalchemy import bindparam, select
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.dialects.postgresql import insert as pg_insert
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -36,22 +36,13 @@ def upload_prints(
|
||||
for id_, code in db.execute(select(Employee.id, Employee.code)).all():
|
||||
employees[code] = id_
|
||||
file_data = read_file(fingerprints)
|
||||
prints = [d for d in fp(file_data, employees) if start <= d.date_.date() <= finish]
|
||||
prints = [d.model_dump() for d in fp(file_data, employees) if start <= d.date_.date() <= finish]
|
||||
for p in prints:
|
||||
p["id"] = p.pop("id_")
|
||||
paged_data = [prints[i : i + 100] for i in range(0, len(prints), 100)]
|
||||
for i, page in enumerate(paged_data):
|
||||
print(f"Processing page {i} of {len(paged_data)}")
|
||||
db.execute(
|
||||
pg_insert(Fingerprint)
|
||||
.values(
|
||||
{
|
||||
"id": bindparam("id"),
|
||||
"employee_id": bindparam("employee_id"),
|
||||
"date": bindparam("date"),
|
||||
}
|
||||
)
|
||||
.on_conflict_do_nothing(),
|
||||
[p.dict() for p in page],
|
||||
)
|
||||
db.execute(pg_insert(Fingerprint).on_conflict_do_nothing(), page)
|
||||
db.commit()
|
||||
except SQLAlchemyError as e:
|
||||
raise HTTPException(
|
||||
|
||||
@@ -58,6 +58,7 @@ def save(
|
||||
instructions=data.instructions,
|
||||
garnishing=data.garnishing,
|
||||
plating=data.plating,
|
||||
notes=data.notes,
|
||||
sku=recipe_sku,
|
||||
recipe_yield=round(data.recipe_yield, 2),
|
||||
)
|
||||
@@ -71,7 +72,8 @@ def save(
|
||||
r_item.recipe_id = recipe.id
|
||||
db.add(r_item)
|
||||
|
||||
check_recursion(set([recipe_sku.product_id]), set(), recipe, db)
|
||||
# TODO: Check recursion
|
||||
# check_recursion(set([recipe_sku.product_id]), set(), recipe, db)
|
||||
db.commit()
|
||||
return recipe_info(recipe)
|
||||
except SQLAlchemyError as e:
|
||||
|
||||
@@ -44,11 +44,13 @@ class ClientList(Client):
|
||||
|
||||
@field_validator("last_date", mode="before")
|
||||
@classmethod
|
||||
def parse_last_date(cls, value: datetime | str) -> datetime | None:
|
||||
def parse_last_date(cls, value: datetime | str | None) -> datetime | None:
|
||||
if value is None or value == "":
|
||||
return None
|
||||
if isinstance(value, datetime):
|
||||
return value
|
||||
return datetime.strptime(value, "%d-%b-%Y %H:%M")
|
||||
|
||||
@field_serializer("last_date")
|
||||
def serialize_last_date(self, value: datetime, info: FieldSerializationInfo) -> str:
|
||||
return value.strftime("%d-%b-%Y %H:%M")
|
||||
def serialize_last_date(self, value: datetime | None, info: FieldSerializationInfo) -> str | None:
|
||||
return None if value is None else value.strftime("%d-%b-%Y %H:%M")
|
||||
|
||||
@@ -20,11 +20,11 @@ class Fingerprint(BaseModel):
|
||||
|
||||
@field_validator("date_", mode="before")
|
||||
@classmethod
|
||||
def parse_date(cls, value: date | str) -> date:
|
||||
if isinstance(value, date):
|
||||
def parse_date(cls, value: datetime | str) -> datetime:
|
||||
if isinstance(value, datetime):
|
||||
return value
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
return datetime.strptime(value, "%d-%b-%Y %H:%M")
|
||||
|
||||
@field_serializer("date_")
|
||||
def serialize_date(self, value: date, info: FieldSerializationInfo) -> str:
|
||||
return value.strftime("%d-%b-%Y")
|
||||
return value.strftime("%d-%b-%Y %H:%M")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "brewman"
|
||||
version = "11.1.5"
|
||||
version = "11.2.1"
|
||||
description = "Accounting plus inventory management for a restaurant."
|
||||
authors = ["tanshu <git@tanshu.com>"]
|
||||
|
||||
|
||||
@@ -32,5 +32,5 @@ else
|
||||
echo "No version bump"
|
||||
fi
|
||||
cd "$parent_path/docker" || exit
|
||||
docker save brewman:latest | bzip2 | pv | ssh beacon 'bunzip2 | sudo docker load'
|
||||
docker save brewman:latest | bzip2 | pv | ssh gondor 'bunzip2 | sudo docker load'
|
||||
ansible-playbook --inventory hosts playbook.yml
|
||||
|
||||
@@ -2,15 +2,11 @@ HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_hinchco
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_{{ name }}
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=brewman_hinchco
|
||||
SECRET_KEY=7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
|
||||
MIDDLEWARE_SECRET_KEY=1e36e7f678
|
||||
SECRET_KEY={{ secret_key }}
|
||||
MIDDLEWARE_SECRET_KEY={{ middleware_key }}
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/acc
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
|
||||
MIDDLEWARE_SECRET_KEY=cb71666b9c
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/exp
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
|
||||
MIDDLEWARE_SECRET_KEY=da6fcd999b
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/hops
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
|
||||
MIDDLEWARE_SECRET_KEY=9c2bdd24be
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
@@ -1,17 +0,0 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=80
|
||||
LOG_LEVEL=WARN
|
||||
DEBUG=false
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/mhl
|
||||
MODULE_NAME=brewman.main
|
||||
PROJECT_NAME=brewman
|
||||
POSTGRES_SERVER=db
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=123456
|
||||
POSTGRES_DB=exp
|
||||
SECRET_KEY=c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
|
||||
MIDDLEWARE_SECRET_KEY=9183bdcfb0
|
||||
ALGORITHM=HS256
|
||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||
ALEMBIC_LOG_LEVEL=INFO
|
||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||
+5
-5
@@ -5,11 +5,11 @@
|
||||
# - A hostname/ip can be a member of multiple groups
|
||||
|
||||
[brewman]
|
||||
acc ansible_host=beacon var_file=vars/acc.yml
|
||||
exp ansible_host=beacon var_file=vars/exp.yml
|
||||
hops ansible_host=beacon var_file=vars/hops.yml
|
||||
mhl ansible_host=beacon var_file=vars/mhl.yml
|
||||
hinchco ansible_host=beacon var_file=vars/hinchco.yml
|
||||
acc ansible_host=gondor var_file=vars/acc.yml
|
||||
exp ansible_host=gondor var_file=vars/exp.yml
|
||||
hops ansible_host=gondor var_file=vars/hops.yml
|
||||
mhl ansible_host=gondor var_file=vars/mhl.yml
|
||||
hinchco ansible_host=gondor var_file=vars/hinchco.yml
|
||||
|
||||
[all:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
|
||||
+6
-3
@@ -6,6 +6,7 @@
|
||||
become: true
|
||||
vars_files:
|
||||
- "{{ var_file }}"
|
||||
- vars/default.yml
|
||||
|
||||
tasks:
|
||||
- name: Copy dockerfile
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
- name: Upload the .env file
|
||||
template:
|
||||
src: "{{ env_file }}"
|
||||
src: "files/.env"
|
||||
dest: "/var/lib/{{ host_directory }}/.env"
|
||||
|
||||
- name: Create brewman container
|
||||
@@ -40,8 +41,10 @@
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
env_file: "/var/lib/{{ host_directory }}/.env"
|
||||
links:
|
||||
- "postgres:db"
|
||||
etc_hosts:
|
||||
db : "{{ db_host }}"
|
||||
# links:
|
||||
# - "postgres:db"
|
||||
published_ports:
|
||||
- "127.0.0.1:{{ host_port }}:80"
|
||||
volumes:
|
||||
|
||||
+5
-2
@@ -1,6 +1,9 @@
|
||||
---
|
||||
name: acc
|
||||
|
||||
http_host: "acc.hopsngrains.com"
|
||||
http_conf: "acc.hopsngrains.com.conf"
|
||||
host_port: "8659"
|
||||
host_directory: "brewman-acc"
|
||||
env_file: "files/.env-acc"
|
||||
|
||||
secret_key: c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
|
||||
middleware_key: cb71666b9c
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
db_host: 172.26.12.67
|
||||
host_directory: "brewman-{{ name }}"
|
||||
db_name: "brewman_{{ name }}"
|
||||
+5
-2
@@ -1,6 +1,9 @@
|
||||
---
|
||||
name: exp
|
||||
|
||||
http_host: "exp.tanshu.com"
|
||||
http_conf: "exp.tanshu.com.conf"
|
||||
host_port: "8656"
|
||||
host_directory: "brewman-exp"
|
||||
env_file: "files/.env-exp"
|
||||
|
||||
secret_key: 8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
|
||||
middleware_key: da6fcd999b
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
name: hinchco
|
||||
|
||||
http_host: "acc.hinchco.in"
|
||||
http_conf: "acc.hinchco.in.conf"
|
||||
host_port: "8655"
|
||||
host_directory: "brewman-hinchco"
|
||||
env_file: "files/.env-hinchco"
|
||||
|
||||
secret_key: 7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
|
||||
middleware_key: 1e36e7f678
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
name: hops
|
||||
|
||||
http_host: "hops.hopsngrains.com"
|
||||
http_conf: "hops.hopsngrains.com.conf"
|
||||
host_port: "8658"
|
||||
host_directory: "brewman-hops"
|
||||
env_file: "files/.env-hops"
|
||||
|
||||
secret_key: cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
|
||||
middleware_key: 9c2bdd24be
|
||||
|
||||
+5
-2
@@ -1,6 +1,9 @@
|
||||
---
|
||||
name: mhl
|
||||
|
||||
http_host: "mhl.hopsngrains.com"
|
||||
http_conf: "mhl.hopsngrains.com.conf"
|
||||
host_port: "8657"
|
||||
host_directory: "brewman-mhl"
|
||||
env_file: "files/.env-mhl"
|
||||
|
||||
secret_key: c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
|
||||
middleware_key: 9183bdcfb0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "overlord",
|
||||
"version": "11.1.5",
|
||||
"version": "11.2.1",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
|
||||
@@ -193,10 +193,10 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.voucher.inventories.push(
|
||||
new Inventory({
|
||||
quantity,
|
||||
rate: this.batch.rate,
|
||||
tax: this.batch.tax,
|
||||
discount: this.batch.discount,
|
||||
amount: quantity * this.batch.rate * (1 + this.batch.tax) * (1 - this.batch.discount),
|
||||
rate: +this.batch.rate,
|
||||
tax: +this.batch.tax,
|
||||
discount: +this.batch.discount,
|
||||
amount: quantity * +this.batch.rate * (1 + +this.batch.tax) * (1 - +this.batch.discount),
|
||||
batch: this.batch,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="flex flex-row justify-around content-start items-start sm:max-lg:flex-col">
|
||||
<mat-form-field class="flex-auto basis-3/5 mr-5">
|
||||
<mat-form-field class="flex-auto basis-4/5 mr-5">
|
||||
<mat-label>Product</mat-label>
|
||||
<input
|
||||
type="text"
|
||||
@@ -43,7 +43,7 @@
|
||||
<mat-option *ngFor="let product of products | async" [value]="product">{{ product.name }}</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto basis-1/10 mr-5">
|
||||
<mat-form-field class="flex-auto basis-1/5">
|
||||
<mat-label>Yield</mat-label>
|
||||
<input type="text" matInput formControlName="recipeYield" autocomplete="off" />
|
||||
</mat-form-field>
|
||||
@@ -74,17 +74,12 @@
|
||||
<mat-label>Quantity</mat-label>
|
||||
<input type="text" matInput formControlName="quantity" autocomplete="off" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto basis-1/5 mr-5">
|
||||
<mat-form-field class="flex-auto basis-[30%] mr-5">
|
||||
<mat-label>Description</mat-label>
|
||||
<input type="text" matInput formControlName="description" autocomplete="off" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto basis-1/10 mr-5">
|
||||
<mat-label>Rate</mat-label>
|
||||
<input type="text" matInput formControlName="rate" autocomplete="off" />
|
||||
<span matTextPrefix>₹ </span>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-raised-button color="primary" (click)="addRow()" class="flex-auto basis-1/10">Add</button>
|
||||
<button mat-raised-button color="primary" (click)="addRow()" class="flex-auto basis-[10%]">Add</button>
|
||||
</div>
|
||||
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
|
||||
<!-- Ingredient Column -->
|
||||
|
||||
@@ -39,7 +39,6 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
ingredient: FormControl<string | null>;
|
||||
quantity: FormControl<string>;
|
||||
description: FormControl<string>;
|
||||
rate: FormControl<string>;
|
||||
}>;
|
||||
instructions: FormControl<string>;
|
||||
garnishing: FormControl<string>;
|
||||
@@ -75,7 +74,6 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
ingredient: new FormControl(''),
|
||||
quantity: new FormControl('', { nonNullable: true }),
|
||||
description: new FormControl('', { nonNullable: true }),
|
||||
rate: new FormControl('', { nonNullable: true }),
|
||||
}),
|
||||
instructions: new FormControl('', { nonNullable: true }),
|
||||
garnishing: new FormControl('', { nonNullable: true }),
|
||||
@@ -118,7 +116,6 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
ingredient: null,
|
||||
quantity: '',
|
||||
description: '',
|
||||
rate: '',
|
||||
},
|
||||
instructions: item.instructions,
|
||||
garnishing: item.garnishing,
|
||||
@@ -160,8 +157,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
return;
|
||||
}
|
||||
const quantity = this.math.parseAmount(formValue.quantity, 2);
|
||||
const rate = this.math.parseAmount(formValue.rate, 2);
|
||||
if (this.ingredient === null || quantity <= 0 || rate <= 0) {
|
||||
if (this.ingredient === null || quantity <= 0) {
|
||||
return;
|
||||
}
|
||||
const oldFiltered = this.item.items.filter((x) => x.product.id === (this.ingredient as ProductSku).id);
|
||||
|
||||
@@ -2,5 +2,5 @@ export const environment = {
|
||||
production: true,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
||||
version: '11.1.5',
|
||||
version: '11.2.1',
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ export const environment = {
|
||||
production: false,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
||||
version: '11.1.5',
|
||||
version: '11.2.1',
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user