
    wg                        d dl mZmZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ  G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z  G d dee          Z! G d de          Z"dS )    )HttpRequestHttpResponse)View)IncrementSessionCountget_increment_session_count)get_raw_session_service)UserActions)ProductRepositoryInterface)CreateUserSesssionLogget_create_user_session_log)get_product_repository)RequestInterface)get_request_service)SettingsMixin)StylesMixinc                   |    e Zd ZU  e            Zeed<    ed          Ze	ed<    e
            Zeed<   dedefdZdS )	OpenedProductPopupViewproduct_repositoryprofile_actions_count increment_session_profile_actioncreate_user_session_logrequestreturnc                    t          |j                            d                    dz
  }|j                            d                              d          d         }| j                            |                    d          d         |          }|                     |           |                     |d| d	
           t          d          S )N
product_id   HTTP_REFERER/product_type_slugproduct_indexr   u   Открыл описание ""r   text   status)
intGETgetMETAsplitr   get_product_name_from_catalogr   r   r   selfr   productadressproduct_names        ./var/www/html/cms/web/site_statistics/views.pyr,   zOpenedProductPopupView.get   s    gkool3344q8!!.1177<<R@.LL$ll3//2' M 
 
 	--g->>>$$W;p_k;p;p;p$qqq3''''    N__name__
__module____qualname__r   r   r
   __annotations__r   r   r   r   r   r   r   r   r,    r6   r5   r   r      s         5K5K5M5M2MMM>Y>YZq>r>r$&;rrr5P5P5R5R2RRR(; (< ( ( ( ( ( (r6   r   c                   |    e Zd ZU  e            Zeed<    ed          Ze	ed<    e
            Zeed<   dedefdZdS )	OpenedProductLinkViewr   banks_countincrement_banks_countr   r   r   c                    t          |j                            d                    dz
  }|j                            d                              d          d         }| j                            |                    d          d         |          }|                     |           |                     |d| d	
           t          d          S )Nr   r   r   r   r   r    r#   u"   Перешел по ссылке "r$   r%   r'   r(   )
r*   r+   r,   r-   r.   r   r/   r@   r   r   r0   s        r5   r,   zOpenedProductLinkView.get0   s    gkool3344q8!!.1177<<R@.LL$ll3//2' M 
 
 	""7"333$$W;sbn;s;s;s$ttt3''''r6   Nr8   r9   r:   r   r   r
   r;   r   r@   r   r   r   r   r   r   r,   r<   r6   r5   r>   r>   +   s         5K5K5M5M2MMM3N3N}3]3]0]]]5P5P5R5R2RRR(; (< ( ( ( ( ( (r6   r>   c                   |    e Zd ZU  e            Zeed<    ed          Ze	ed<    e
            Zeed<   dedefdZdS )	OpenedProductPromoViewr   r?   r@   r   r   r   c                    t          |j                            d                    dz
  }| j                                        |         }|                     |           |                     |d| d           t          d          S )	Nr   r   r#   u$   Перешел по баннеру "r$   r%   r'   r(   )r*   r+   r,   r   
get_offersr@   r   r   r1   r   r2   r4   s       r5   r,   zOpenedProductPromoView.getC   s    gkool3344q8.99;;GD""7"333$$W;udp;u;u;u$vvv3''''r6   NrB   r<   r6   r5   rD   rD   >   s         5K5K5M5M2MMM3N3N}3]3]0]]]5P5P5R5R2RRR(; (< ( ( ( ( ( (r6   rD   c                   ^    e Zd ZU  ed          Zeed<    e            Ze	ed<   de
defdZdS )OpenedChangePasswordFormViewr   r   r   r   r   c                     |                      |           |                     |t          j                   t	          d          S )Nr#   r%   r'   r(   )r   r   r	   opened_password_changer   r1   r   s     r5   r,   z OpenedChangePasswordFormView.getR   sF    --g->>>$$W;;]$^^^3''''r6   N)r8   r9   r:   r   r   r   r;   r   r   r   r   r   r,   r<   r6   r5   rI   rI   N   sq         >Y>YZq>r>r$&;rrr5P5P5R5R2RRR(; (< ( ( ( ( ( (r6   rI   c                   |    e Zd ZU  e            Zeed<    ed          Ze	ed<    e
            Zeed<   dedefdZdS )	OpenedUpdateProductFormViewr   r   r   r   r   r   c                    | j                             t          |j                            d                              }|r|j        nd}|                     |           |                     |d| d           t          d	          S )
Nr2   )id r#   u2   Открыл настройку продукта "r$   r%   r'   r(   )r   r,   r*   r+   namer   r   r   rG   s       r5   r,   zOpenedUpdateProductFormView.get^   s    )--W[__Y5O5O1P1P-QQ'.6w||B--g->>>$$W  <Dr~  <D  <D  <D$  	E  	E  	E3''''r6   Nr7   r<   r6   r5   rN   rN   Y   s         5K5K5M5M2MMM>Y>YZq>r>r$&;rrr5P5P5R5R2RRR(; (< ( ( ( ( ( (r6   rN   c                   ^    e Zd ZU  ed          Zeed<    e            Ze	ed<   de
defdZdS )IncrementBanksCountViewr?   r@   r   r   r   c                     |                      |           |                     |t          j                   t	          d          S )Nr#   r%      r(   )r@   r   r	   opened_product_descriptionr   rL   s     r5   r,   zIncrementBanksCountView.getm   sF    ""7"333$$W;;a$bbb3''''r6   N)r8   r9   r:   r   r@   r   r;   r   r   r   r   r   r,   r<   r6   r5   rT   rT   i   sp         3N3N}3]3]0]]]5P5P5R5R2RRR(; (< ( ( ( ( ( (r6   rT   c                   "     e Zd ZdZ fdZ xZS )
CapchaViewzcommon/capcha.htmlc                 `     t                      j        |i ||                                 z  S )N)superget_context_dataget_styles_context)r1   argskwargs	__class__s      r5   r\   zCapchaView.get_context_dataw   s0    'uww'8884;R;R;T;TTTr6   )r8   r9   r:   template_namer\   __classcell__)r`   s   @r5   rY   rY   t   sF        (MU U U U U U U U Ur6   rY   c                       e Zd ZdedefdZdS )SubmitCapchar   r   c                     |j         rJt          t          |                    }t          |j                    |                    |j                    t          d          S )NrV   r(   )raw_sessionr   r   printsuccess_capchar   )r1   r   raw_session_services      r5   postzSubmitCapcha.post|   s^     	D"9:Mg:V:V"W"W'%&&&..w/BCCC3''''r6   N)r8   r9   r:   r   r   rj   r<   r6   r5   rd   rd   {   s7        (, ( ( ( ( ( ( (r6   rd   N)#django.httpr   r   django.views.genericr   'application.sessions.add_session_actionr   r   (application.sessions.raw_session_servicer   application.texts.user_sessionr	   domain.products.repositoryr
   7infrastructure.logging.user_activity.create_session_logr   r   :infrastructure.persistence.repositories.product_repositoryr   )infrastructure.requests.request_interfacer   infrastructure.requests.servicer   !web.settings.views.settings_mixinr   web.styles.viewsr   r   r>   rD   rI   rN   rT   rY   rd   r<   r6   r5   <module>rw      s   1 1 1 1 1 1 1 1 % % % % % %        M L L L L L 6 6 6 6 6 6 A A A A A A             G F F F F F ? ? ? ? ? ? ; ; ; ; ; ; ( ( ( ( ( (( ( ( ( (T ( ( (&( ( ( ( (D ( ( (&( ( ( ( (T ( ( ( ( ( ( ( (4 ( ( (( ( ( ( ($ ( ( ( ( ( ( ( (d ( ( (U U U U U U U U( ( ( ( (4 ( ( ( ( (r6   