
    g                     p    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	 d dl
mZ d dlmZ d Zd	 Zd
 Zd Zy)    )settings)EmailMultiAlternatives)render_to_string)reverse)timezone)
strip_tags)UserActivationCodec                  \    t        j                         } d| j                  cxk  rdk  ry yy)Nr      morning	afternoon)r   nowhour)current_times    =/var/www/peopleoo.sandbox-dev.co.uk/apps/carers/lib/emails.py_get_time_of_dayr      s/    <<>L 	L"" #     c                    t         j                  j                  |       \  }}d }| j                  r| j                  }n| j                  }t               }t        dd|j                  i      }|| j                  ||t        j                  |j                  d}t        d|      }t        |      }	t        d|	d	| j                   g
      }
|
j                  |d       |
j!                          y )Nuseractivate_accountuuidkwargs
first_nameusernametime_of_dayurlbase_urlorganisation_namezemails/staff_welcome_email.htmlcontext,Exciting news: You are now part of Peopleoo!hello@peopleoo.comsubjectbody
from_emailto	text/htmlr	   objectsget_or_creater   r   r   r   r   r   SITE_BASE_URLnamer   r   r   emailattach_alternativesendr   organisationactivation_obj_r   r   r   r#   html_messageplain_messagemessages              r   send_staff_welcome_emailr;      s    *22@@d@KNAJ__
]]
"$K
$fn6I6I-J
KC !MM"**)..G $$EwWL|,M$>'zzl	G |[9LLNr   c                    t         j                  j                  |       \  }}d }| j                  r| j                  }n| j                  }t               }t        dd|j                  i      }|| j                  ||t        j                  |j                  d}t        d|      }t        |      }	t        d|	d	| j                   g
      }
|
j                  |d       |
j!                          y )Nr   r   r   r   r   zemails/admin_welcome_email.htmlr"   r$   r%   r&   r+   r,   r4   s              r   send_admin_welcome_emailr=   :   s    *22@@d@KNAJ__
]]
"$K
$fn6I6I-J
KC !MM"**)..G $$EwWL|,M$>'zzl	G |[9LLNr   c                    t               }t        d      }||t        j                  | j                  d}t        d|      }t        |      }t        d|d| j                   g      }|j                  |d       |j                          y )	N	org_login)r   r   r    r!   z&emails/organisation_welcome_email.htmlr"   r$   r%   r&   r+   )r   r   r   r/   r0   r   r   r   r1   r2   r3   )r5   r   r   r#   r8   r9   r:   s          r   send_organisation_welcome_emailr@   _   s    "$K
+
C #**)..	G $$LV]^L|,M$>'!!"$	G |[9LLNr   N)django.confr   django.core.mailr   django.template.loaderr   django.urlsr   django.utilsr   django.utils.htmlr   apps.carers.modelsr	   r   r;   r=   r@    r   r   <module>rI      s0      3 3  ! ( 1"H!Jr   