o
    ht                     @   s$   d dl mZmZ dd Zdd ZdS )   )ThemeShopc              
   C   s   d}zt j }|st jjddd}W n ty2 } ztd|  t ddd}W Y d}~nd}~ww ||r9|jnd|r?|jnd|rH| dS ddS )z"Add theme context to all templatesNlightz#28a745)modeprimary_colorzError in theme_context: z#218838)theme
theme_moder   secondary_color)	r   objectsfirstcreate	Exceptionprintr   r   get_secondary_color)requestr   e r   4/var/www/html/kangema/settings/context_processors.pytheme_context   s$   

r   c              
   C   s   d}zt j }|st jjdddddd}W n# ty9 } ztd|  G d	d
 d
}| }W Y d}~nd}~ww ||r@|jnd|rF|jnd|rL|jnd|rR|j	nd|r[t
|ddnd|rht|drh|jdS ddS )z!Add shop details to all templatesNPOS 254Nairobi, Kenya+254700000000info@pos254.comhttps://pos254.com)nameaddressphoneemailwebsitezError in shop_details context: c                   @   s,   e Zd ZdZdZdZdZdZdZdd Z	dS )	z"shop_details.<locals>.FallbackShopr   r   r   r   r   Nc                 S   s   | j S )N)r   )selfr   r   r   __str__1   s   z*shop_details.<locals>.FallbackShop.__str__)
__name__
__module____qualname__r   r   r   r   r   logor    r   r   r   r   FallbackShop)   s    r%   r    r$   )shop	shop_name
shop_phone
shop_emailshop_addressshop_website	shop_logo)r   r
   r   r   r   r   r   r   r   r   getattrhasattrr$   )r   r'   r   r%   r   r   r   shop_details   s8   
r0   N)modelsr   r   r   r0   r   r   r   r   <module>   s   