o
    g7                     @   s^  d dl mZ d dlZd dlmZmZmZmZmZ d dl	m
Z
 d dlmZmZ G dd dejZG dd	 d	ejZG d
d dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG d d! d!ejZG d"d# d#ejZdS )$    )modelsN)SKUProductsProductSubCategoryProductCategoryCustomProduct)Users)ShopProductionUnitc                   @   s   e Zd ZejddddZejddddZejeej	dddZ
ejdddgd	d
Zejdddgdd
ZejdddZejdddZdd ZdS )DeliveryBoys   T
max_lengthblanknull   	on_deleter   r   d   )assignedr   )not assignedr   r   r   choicesdefault)not verifiedr   )verifiedr   r   )auto_now_addr   )auto_nowr   c                 C   s   d| j  S )NzDelivery Boy )team_member_nameself r!   7/var/www/html/Testing_prj/Navya-Bakers/orders/models.py__str__   s   zDeliveryBoys.__str__N)__name__
__module____qualname__r   	CharFieldr   phone_number
ForeignKeyr	   CASCADEshopdelivery_boy_statusstatusDateTimeFieldcreated_dateupdated_dater#   r!   r!   r!   r"   r   	   s"    r   c                   @   s   e Zd ZejdejdddZejddZejddZ	ejddZ
ejddddZejddZejd	dddZejddZe Ze Ze Zejdg d
dZejddZdS )DropaddressTFprimary_keyr   uniqueeditable   r   r      r   2   ))homer:   )workr;   )othersr<   r   r   r   N)r$   r%   r&   r   	UUIDFielduuiduuid4r'   namehouse_number_or_namestreet	land_markcitydistrictstate_or_provinceIntegerFieldpin_code
FloatFieldlatitude	longitudeaddress_typecontact_numberr!   r!   r!   r"   r1      s&    
r1   c                   @   s  e Zd ZejdejdddZejddddZejdg ddZ	ej
ddd	Zej
ddd	Zej
ddd	Zej
ddd	Zejdg d
dZejeejddidZejeddejdZejeejdddZejeejdddZejeejdddZejddddZejddd	Z ejddd	Z!ej"ddd	Z#ej"ddd	Z$ej%ddd	Z&ej'ddd	Z(ejddg ddZ)ej"ddZ*ej"ddZ+ej"ddZ,ej
ddd	Z-ej
ddd	Z.ej
ddd	Z/ejddd	Z0ejddd	Z1dd Z2dS )OrdersTFr2      r   r9   ))Local OrdersrQ   )Long Distance OrdersrR   )Custom OrdersrS   Pick UprU   r=   r   r   ))	New OrderrW   )EnquiryrX   )	ConfirmedrY   )ViewedrZ   )Order Packedr[   )Delivery Assignedr\   )
Despatchedr]   )	Contactedr^   )Bill Createdr_   )	Deliveredr`   )Failedra   	user_typeCustomer)r   limit_choices_to)r   r   r   r   ))Whitere   )Yellowrf   )Orangerg   )Redrh   )zDark Redz	Dark  Red)r   r   r   r   r   c                 C   s   dt | j d t | j S )NzOrderID:z       Order_type    )strorder_ID
order_typer   r!   r!   r"   r#   ~   s   zOrders.__str__N)3r$   r%   r&   r   r>   r?   r@   r'   rl   rm   rJ   	sub_totaltaxes_and_chargesdelivery_chargesgrand_totalorder_statusr)   r   r*   	user_uuidr	   SET_NULL
store_uuidr
   pu_uuidr   custom_productOneToOneFieldr1   drop_addressdelivery_boy	TextFielddelivery_instructioncooking_instructionr.   order_assigntimeorder_delivered_time	DateFielddelivery_slot_date	TimeFielddelivery_slot_timecolor_statuscolor_status_updation_timer/   r0   total_savingscoupon_savingsdiscountdescriptionmessager#   r!   r!   r!   r"   rO   4   sf    
	


rO   c                   @   st   e Zd ZejdejdddZejddddZ	ej
eddejdZejddddZejdddZej
ed	ejd
ZdS )OrderProductsTFr2   rP   r   sku)related_namer   r   rV   
order_datar   r   N)r$   r%   r&   r   r>   r?   r@   order_product_idr'   product_namer)   r   rt   r   quantityrJ   pricerO   PROTECTorderr!   r!   r!   r"   r      s    


r   c                   @   s   e Zd Zejdg ddZejeejdddZ	ejddddZ
ejddddZejdddZejdddZejeejdddZd	S )
OrderDeliveryr9   ))Own Deliveryr   )Courier Deliveryr   rT   r=   Tr   rP   r   rV   N)r$   r%   r&   r   r'   delivery_typer)   r   r*   rz   courier_service_namepackage_numberr   expected_date_of_deliveryURLFieldtracking_linkrO   r   r!   r!   r!   r"   r      s    
r   c                   @   sd   e Zd ZejeddejdZejddddZ	ej
ddZej
ddZejdddejdZdd	 Zd
S )CartT)r   r   r   r9   r   r   r   ri   rj   Couponsc                 C   s"   d| j sd| j  S | j j S )Nz	Cart for zanonymous user)useranonymous_id
first_namer   r!   r!   r"   r#      s   "zCart.__str__N)r$   r%   r&   r   rx   r   r*   r   r'   r   r.   
created_at
updated_atr)   couponr#   r!   r!   r!   r"   r      s    r   c                   @   sB   e Zd ZejedejdZejdejdZej	ddZ
dd Zd	S )
CartItemitemsr   zproducts.SKUr      r   c                 C   s   | j  d| jj dS )Nz of z in Cart)r   r   sku_namer   r!   r!   r"   r#         zCartItem.__str__N)r$   r%   r&   r   r)   r   r*   cartr   PositiveIntegerFieldr   r#   r!   r!   r!   r"   r      s
    r   c                   @   s>  e Zd ZejddddZejddddZejddddZejddddZ	ej
edddZejg dd	d
Zej
eddZej
eddZej
eddZej
eddZejddddZejdddZejdddZejddgdd
Ze Ze Ze ZejddddZ ejdddZ!ejddZ"ejddddZ#dd Z$dS )r   r9   Tr   r8   zicons/	upload_tor   r   r   r   )Categoryr   )SubCategoryr   Productr   )Skur   (   r   r   r   r   )amountr   )
percentager   i  ri   z3Maximum discount amount when percentage is selected)r   r   	help_textc                 C      d| j  d| j S )NzCoupons--)
CouponName
CouponCoder   r!   r!   r"   r#         zCoupons.__str__N)%r$   r%   r&   r   r'   r   r   CouponDescription
ImageFieldIconManyToManyFieldr   
CouponUsedCouponOnr   ApplicableCategoryr   ApplicableSubCategoryr   ApplicableProductr   ApplicableSkurJ   TotalBillAmountrH   DiscountAmountDiscountPercentage
CouponTypeMaxNumberofUsersr.   Validity_start_datevalidity_end_dateTermsAndConditionsNotificationScheduler   MaxDiscountAmountForPercentager#   r!   r!   r!   r"   r      s.    r   c                   @   s\   e Zd Ze Ze ZejddZej	dddgddZ
ejddZd	d
 Zedd ZdS )DeliverySlotTr   r   )activeActive)inactiveInactiver   r   ri   c                 C   s   | j d d| jd S )Nz%H:%Mz to )
start_timestrftimeend_timer   r!   r!   r"   r#      s   zDeliverySlot.__str__c                 C   s   | j | j S N)r   r   r   r!   r!   r"   duration   s   zDeliverySlot.durationN)r$   r%   r&   r   r   r   r   BooleanFieldis_availabler'   r-   r.   r   r#   propertyr   r!   r!   r!   r"   r      s    
r   c                   @   s   e Zd ZejddddZejdddddZejddddZejg dddZej	e
dd	Zej	edd	Zej	edd	Zej	edd	Zejd
ddddZejddZejddddZejddddZdd ZdS )Discountr9   Tr   )r   r   r   r4   r8   r   r   r   r         )
max_digitsdecimal_placesr   r   ri   standard_images/r   banners/c                 C   r   )Nz	Discount-r   )DiscountNameDiscountCoder   r!   r!   r"   r#      r   zDiscount.__str__N)r$   r%   r&   r   r'   r   r   DiscountDescription
DiscountOnr   r   r   r   r   r   r   r   r   DecimalFieldr   r.   r   r   StandardImageBannerImager#   r!   r!   r!   r"   r      s    r   c                   @   s   e Zd ZejdejdddZg dZejddddZ	ejddddZ
ejdddd	Zejg d
ddZejddddZejddddZejeejdddZejeejdddZejeejdddZejddZdd Zdd ZdS )AdsTFr2   ))Topr   )Bottomr   )Bannerr   r9   r   r8   r   r   ))r   r   )Couponr   r   r   r   r   r   r   r   r   r   ri   c                 C      | j S r   )AdTitler   r!   r!   r"   r#        zAds.__str__c                    s.   t | j | js
g S  fdd| jdD S )Nc                    s   g | ]
}| v r | qS r!   r!   ).0	placementplacement_dictr!   r"   
<listcomp>  s    z-Ads.get_placement_display.<locals>.<listcomp>,)dictplacement_choicesAdPlacementsplitr   r!   r   r"   get_placement_display  s   
zAds.get_placement_displayN)r$   r%   r&   r   r>   r?   r@   r  r'   r   AdDescriptionr{   r  AdTyper   r   r   r)   r   r*   r   r   r   r   r.   r   r#   r  r!   r!   r!   r"   r      s"    
r   c                   @   sj   e Zd Zg dZejdejddZejdedZ	ej
dddZejeejdddZejdd	Zd
d ZdS )Message))Emailr  )SmsSMS)WhatsappWhatsAppTF)r3   r   r5   r   r=   r   r   ri   c                 C   r   r   )message_typer   r!   r!   r"   r#   &  r   zMessage.__str__N)r$   r%   r&   MESSAGE_TYPE_CHOICESr   r>   r?   r@   r'   r  r{   r   r)   r   r*   adsr.   r   r#   r!   r!   r!   r"   r
    s    r
  c                   @   sR   e Zd ZejeddiejdZejeejdZ	ej
ddZejddZd	d
 ZdS )Communicationrb   rc   )rd   r   r   Tri   Fr   c                 C   s   | j  d| j S )Nz - )r   r   r   r!   r!   r"   r#   0  s   zCommunication.__str__N)r$   r%   r&   r   r)   r   r*   r   r
  r   r.   r   r   is_sendr#   r!   r!   r!   r"   r  *  s    r  c                   @   sd   e Zd ZejeejdZejddddZ	ejddddZ
ejdg dddZejdd	Zd
d ZdS )Paymentr   rP   Tr   r9   ))pendingPending)paidPaid)failedra   r  r   ri   c                 C   s   d| j j d| j S )NzPayment for z - Status: )r   rl   payment_statusr   r!   r!   r"   r#   @  r   zPayment.__str__N)r$   r%   r&   r   rx   rO   r*   r   r'   razorpay_payment_idrazorpay_order_idr  r.   payment_dater#   r!   r!   r!   r"   r  5  s    r  c                   @   sh   e Zd ZejddZejeejdZ	eje
ejdZejddddZejddZejddZd	d
 ZdS )NotificationStatr   r7   r   i  Tr   ri   rj   c                 C   s   t | jt | j S r   )rk   OrderIDsendTor   r!   r!   r"   r#   N  r   zNotificationStat.__str__N)r$   r%   r&   r   r'   Sendmsgr)   r   r*   r!  rO   r   Descriptionr.   r/   r0   r#   r!   r!   r!   r"   r  F  s    r  )	django.dbr   r?   products.modelsr   r   r   r   r   accounts.modelsr   shops.modelsr	   r
   Modelr   r1   rO   r   r   r   r   r   r   r   r   r
  r  r  r  r!   r!   r!   r"   <module>   s(    S
