Merge remote-tracking branch 'origin/productComment'
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
from sqlalchemy import Table, Column, Integer, ForeignKey, ForeignKeyConstraint, UniqueConstraint
 | 
					from sqlalchemy import Table, Column, Integer, ForeignKey, ForeignKeyConstraint, UniqueConstraint, String
 | 
				
			||||||
from sqlalchemy.orm import relationship, mapped_column, Mapped
 | 
					from sqlalchemy.orm import relationship, mapped_column, Mapped
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from models.base import BaseModel
 | 
					from models.base import BaseModel
 | 
				
			||||||
@@ -90,6 +90,7 @@ class DealProduct(BaseModel):
 | 
				
			|||||||
    deal_id = Column(Integer, ForeignKey('deals.id'), primary_key=True, nullable=False, comment='ID Сделки')
 | 
					    deal_id = Column(Integer, ForeignKey('deals.id'), primary_key=True, nullable=False, comment='ID Сделки')
 | 
				
			||||||
    product_id = Column(Integer, ForeignKey('products.id'), primary_key=True, nullable=False, comment='ID Продукта')
 | 
					    product_id = Column(Integer, ForeignKey('products.id'), primary_key=True, nullable=False, comment='ID Продукта')
 | 
				
			||||||
    quantity = Column(Integer, nullable=False, comment='Кол-во продукта')
 | 
					    quantity = Column(Integer, nullable=False, comment='Кол-во продукта')
 | 
				
			||||||
 | 
					    comment = Column(String, nullable=False, server_default='', comment='Комментарий к товару')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    deal = relationship('Deal',
 | 
					    deal = relationship('Deal',
 | 
				
			||||||
                        back_populates='products',
 | 
					                        back_populates='products',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,6 +70,7 @@ class DealProductSchema(BaseSchema):
 | 
				
			|||||||
    product: ProductSchema
 | 
					    product: ProductSchema
 | 
				
			||||||
    services: List[DealProductServiceSchema]
 | 
					    services: List[DealProductServiceSchema]
 | 
				
			||||||
    quantity: int
 | 
					    quantity: int
 | 
				
			||||||
 | 
					    comment: str = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DealStatusHistorySchema(BaseSchema):
 | 
					class DealStatusHistorySchema(BaseSchema):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -471,7 +471,8 @@ class DealService(BaseService):
 | 
				
			|||||||
            deal_product = models.secondary.DealProduct(
 | 
					            deal_product = models.secondary.DealProduct(
 | 
				
			||||||
                deal_id=new_deal.id,
 | 
					                deal_id=new_deal.id,
 | 
				
			||||||
                product_id=old_deal_product.product.id,
 | 
					                product_id=old_deal_product.product.id,
 | 
				
			||||||
                quantity=old_deal_product.quantity
 | 
					                quantity=old_deal_product.quantity,
 | 
				
			||||||
 | 
					                comment=old_deal_product.comment,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            self.session.add(deal_product)
 | 
					            self.session.add(deal_product)
 | 
				
			||||||
            await self.session.flush()
 | 
					            await self.session.flush()
 | 
				
			||||||
@@ -936,6 +937,7 @@ class DealService(BaseService):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            # Updating product
 | 
					            # Updating product
 | 
				
			||||||
            deal_product.quantity = request.product.quantity
 | 
					            deal_product.quantity = request.product.quantity
 | 
				
			||||||
 | 
					            deal_product.comment = request.product.comment
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Updating deleting old employees
 | 
					            # Updating deleting old employees
 | 
				
			||||||
            delete_stmt = (
 | 
					            delete_stmt = (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,6 +79,22 @@
 | 
				
			|||||||
            {% endif %}
 | 
					            {% endif %}
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <!--#endregion -->
 | 
					        <!--#endregion -->
 | 
				
			||||||
 | 
					        <!--#region Product comment -->
 | 
				
			||||||
 | 
					        {% if product_data.deal_products|length == 1 and common_deal_product.comment  %}
 | 
				
			||||||
 | 
					            <table>
 | 
				
			||||||
 | 
					                <thead>
 | 
				
			||||||
 | 
					                <tr>
 | 
				
			||||||
 | 
					                    <th>Комментарий</th>
 | 
				
			||||||
 | 
					                </tr>
 | 
				
			||||||
 | 
					                </thead>
 | 
				
			||||||
 | 
					                <tbody>
 | 
				
			||||||
 | 
					                    <tr>
 | 
				
			||||||
 | 
					                        <td>{{ common_deal_product.comment }}</td>
 | 
				
			||||||
 | 
					                    </tr>
 | 
				
			||||||
 | 
					                </tbody>
 | 
				
			||||||
 | 
					            </table>
 | 
				
			||||||
 | 
					        {% endif %}
 | 
				
			||||||
 | 
					        <!--#endregion -->
 | 
				
			||||||
        <!--#region Product services -->
 | 
					        <!--#region Product services -->
 | 
				
			||||||
        {% if common_deal_product.services|length > 0 %}
 | 
					        {% if common_deal_product.services|length > 0 %}
 | 
				
			||||||
            <table>
 | 
					            <table>
 | 
				
			||||||
@@ -144,6 +160,14 @@
 | 
				
			|||||||
                        <td style="text-align: center">{{ deal_product.quantity }}</td>
 | 
					                        <td style="text-align: center">{{ deal_product.quantity }}</td>
 | 
				
			||||||
                        <td></td>
 | 
					                        <td></td>
 | 
				
			||||||
                    </tr>
 | 
					                    </tr>
 | 
				
			||||||
 | 
					                    {% if deal_product.comment %}
 | 
				
			||||||
 | 
					                        <tr></tr>
 | 
				
			||||||
 | 
					                        <tr>
 | 
				
			||||||
 | 
					                            <td colspan="4">
 | 
				
			||||||
 | 
					                                <b>Комментарий</b>: {{ deal_product.comment }}
 | 
				
			||||||
 | 
					                            </td>
 | 
				
			||||||
 | 
					                        </tr>
 | 
				
			||||||
 | 
					                    {% endif %}
 | 
				
			||||||
                {% endfor %}
 | 
					                {% endfor %}
 | 
				
			||||||
                </tbody>
 | 
					                </tbody>
 | 
				
			||||||
            </table>
 | 
					            </table>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user