def get_accepted_ticket_message(ticket): reservation = ticket.reservation vehicle = reservation.vehicle receiver_email = ticket.owner.email subject = 'Ticket aceptado' body = """ El siguiente ticket ha sido aceptado: Título: {0} Descripción: {1} Detalles de la reserva eliminada por su ticket: Marca: {2} Modelo: {3} Matricula: {4} Fecha de recogida: {5} Fecha de entrega: {6} """.format( ticket.title, ticket.description, vehicle.brand, vehicle.model, vehicle.number_plate, reservation.start, reservation.end ) return create_message(receiver_email=receiver_email, subject=subject, body=body)
def get_reservation_deleted_message(reservation): vehicle = reservation.vehicle receiver_email = reservation.owner.email subject = 'Reserva eliminada' body = """ Su reserva ha sido eliminada porque alguien tenía una mayor prioridad. Los detalles de su reserva eran: Título: {0} Descripción: {1} Marca: {2} Modelo: {3} Matricula: {4} Fecha de recogida: {5} Fecha de entrega: {6} """.format( reservation.title, reservation.description, vehicle.brand, vehicle.model, vehicle.number_plate, reservation.start, reservation.end ) return create_message(receiver_email=receiver_email, subject=subject, body=body)
def get_ticket_created_message(receiver_email, ticket): owner = ticket.owner.fullname reservation = ticket.reservation vehicle = reservation.vehicle subject = 'Un ticket ha sido creado' body = """ El usuario {0} ha presentado un ticket contra la reserva: Marca: {1} Modelo: {2} Matricula: {3} Descripción: {4} Fecha de recogida: {5} Fecha de entrega: {6} El motivo por el cual se ha presentado el ticket es: {7} """.format( owner, vehicle.brand, vehicle.model, vehicle.number_plate, reservation.description, reservation.start, reservation.end, ticket.description ) return create_message(receiver_email=receiver_email, subject=subject, body=body)
def get_denied_ticket_message(ticket): receiver_email = ticket.owner.email subject = 'Ticket denegado' body = """ El siguiente ticket ha sido denegado: Título: {0} Descripción: {1} """.format(ticket.title, ticket.description) return create_message(receiver_email=receiver_email, subject=subject, body=body)
def get_user_created_message(user, password): enterprise = 'Fleet Management' subject = 'Registro en {}'.format(enterprise) body = user_created_body.format(enterprise, user.fullname, user.email, password, url) return create_message(receiver_email=user.email, subject=subject, body=body)
def get_incident_was_created_message(receiver_email, incident): owner = incident.owner reservation = incident.reservation vehicle = reservation.vehicle incident_type = IncidentType(incident.type).label subject = 'Incidencia: {0} {1} - {2}'.format(vehicle.brand, vehicle.model, incident_type) body = incident_was_created_body.format( incident.title, incident_type, incident.date_stored, incident.description, owner.fullname, owner.email, vehicle.brand, vehicle.model, vehicle.number_plate, reservation.title, reservation.start, reservation.end, reservation.description) return create_message(receiver_email=receiver_email, subject=subject, body=body)