- Backend: FastAPI app with all models, services, schemas, routes - Admin Panel: Next.js dashboard with all modules (CRM, POS, repairs, warranties, billing, notifications, etc.) - Ecommerce: storefront (submodule) + product catalog - AI Agents: .agents/ skill library for Antigravity IDE - Docs: architecture, billing, notification gateway markdown - Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
100 lines
2.7 KiB
Python
100 lines
2.7 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import List, Optional
|
|
from datetime import datetime
|
|
|
|
# --- BULK QUOTATION ITEM SCHEMAS ---
|
|
class CrmBulkQuotationItemCreate(BaseModel):
|
|
sku: str
|
|
description: str
|
|
quantity: int = Field(1, ge=1)
|
|
unit_price: float = Field(..., ge=0)
|
|
tax_percent: Optional[float] = 18.0
|
|
|
|
class CrmBulkQuotationItemResponse(CrmBulkQuotationItemCreate):
|
|
item_id: str
|
|
total_price: float
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
# --- BULK QUOTATION SCHEMAS ---
|
|
class CrmBulkQuotationCreate(BaseModel):
|
|
quote_number: Optional[str] = None
|
|
customer_id: Optional[str] = None
|
|
customer_name: Optional[str] = None
|
|
customer_phone: Optional[str] = None
|
|
customer_email: Optional[str] = None
|
|
valid_days: Optional[int] = 7
|
|
discount_amount: Optional[float] = 0.0
|
|
notes: Optional[str] = None
|
|
items: List[CrmBulkQuotationItemCreate]
|
|
|
|
class CrmBulkQuotationResponse(BaseModel):
|
|
quote_id: str
|
|
quote_number: str
|
|
tenant_id: str
|
|
customer_id: str
|
|
status: str
|
|
valid_until: Optional[datetime] = None
|
|
subtotal: float
|
|
discount_amount: float
|
|
tax_amount: float
|
|
grand_total: float
|
|
notes: Optional[str] = None
|
|
created_at: Optional[datetime] = None
|
|
items: List[CrmBulkQuotationItemResponse] = []
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
# --- GST INVOICE ITEM SCHEMAS ---
|
|
class CrmInvoiceItemCreate(BaseModel):
|
|
sku: str
|
|
description: str
|
|
hsn_sac_code: Optional[str] = "8517"
|
|
imei_serial: Optional[str] = None
|
|
quantity: int = Field(1, ge=1)
|
|
unit_price: float = Field(..., ge=0)
|
|
tax_percent: Optional[float] = 18.0
|
|
warranty_months: Optional[int] = 6
|
|
|
|
class CrmInvoiceItemResponse(CrmInvoiceItemCreate):
|
|
item_id: str
|
|
total_price: float
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
# --- GST INVOICE SCHEMAS ---
|
|
class CrmGstInvoiceCreate(BaseModel):
|
|
customer_id: str
|
|
invoice_type: Optional[str] = "RETAIL" # RETAIL, B2B, PROFORMA
|
|
is_interstate: Optional[bool] = False
|
|
discount_amount: Optional[float] = 0.0
|
|
notes: Optional[str] = None
|
|
items: List[CrmInvoiceItemCreate]
|
|
|
|
class CrmRecordPayment(BaseModel):
|
|
payment_amount: float = Field(..., gt=0)
|
|
notes: Optional[str] = None
|
|
|
|
class CrmGstInvoiceResponse(BaseModel):
|
|
invoice_id: str
|
|
invoice_number: str
|
|
tenant_id: str
|
|
customer_id: str
|
|
invoice_type: str
|
|
subtotal: float
|
|
discount_amount: float
|
|
cgst_amount: float
|
|
sgst_amount: float
|
|
igst_amount: float
|
|
grand_total: float
|
|
payment_status: str
|
|
paid_amount: float
|
|
notes: Optional[str] = None
|
|
created_at: Optional[datetime] = None
|
|
items: List[CrmInvoiceItemResponse] = []
|
|
|
|
class Config:
|
|
from_attributes = True
|