Esempio n. 1
0
def cPanelEmpleado():
    if "ID" in session and session['Tipo'] == 4:
        objTicket = Ticket()
        tickets = objTicket.ListarTicketsXEmpresaDep(session['Empresa'],
                                                     session['Departamento'],
                                                     1)
        ticketsUsario = objTicket.ListarTicketsXEmpleado(2, int(session['ID']))
        return render_template('empleado/cPanelEmpleado.html',
                               avatar=session["Avatar"],
                               tickets=tickets,
                               ID=session['ID'])
    else:
        return redirect(url_for('index'))
Esempio n. 2
0
def cargarTickets():
    if request.method == "POST" and "ID" in session:
        plantilla = ""
        idFiltro = request.form["idFiltro"]
        objTicket = Ticket()
        if session['Tipo'] == 1:
            tickets = objTicket.ListarTicketsXEstado(idFiltro)
        elif session['Tipo'] == 2:
            tickets = objTicket.ListarTicketsXEmpresaDep(session['Empresa'],session['Departamento'],idFiltro)
        elif session['Tipo'] == 4 and int(idFiltro) == 1:
            tickets = objTicket.ListarTicketsXEmpresaDep(session['Empresa'],session['Departamento'],idFiltro)
        elif session['Tipo'] == 4 and int(idFiltro) != 1:
            tickets = objTicket.ListarTicketsXEmpleado(idFiltro,session['ID'])
        elif session['Tipo'] == 3:
            tickets = objTicket.ListarTicketsXAsignar(session['Empresa'])
        elif session['Tipo'] == 5:
            tickets = objTicket.ListarTicketsXEmpresaCliente(session['Empresa'],idFiltro)
        elif session['Tipo'] == 6:
            tickets = objTicket.ListarTicketsXCliente(idFiltro,session['ID'])

        if len(tickets) > 0:
            for ticket in tickets:
                Asignador = ticket.Asignador if (ticket.Asignador != None) else 'Vacio'
                Solucionador = ticket.Solucionador if (ticket.Solucionador != None) else 'Vacio'
                Departamento = ticket.Departamento if (ticket.Departamento != None) else 'Vacio'
                FechaHoraResolucion = ticket.FechaHoraResolucion if (ticket.FechaHoraResolucion != None) else 'Vacio'
                Calificacion = ticket.Calificacion if (ticket.Calificacion != None) else 'Vacio'
                Resolucion = ticket.Resolucion if (ticket.Resolucion != None) else 'Vacio'
                Prioridad = ticket.Prioridad if (ticket.Prioridad != None) else 'Vacio'

                boton1 = "<button class='btn btn-success mt-1 mr-3' style='width: 120px !important;' detallesTicket>Ver</button>"
                boton2 = "<button data-toggle='modal' data-target='#asignarTicketModal' class='btn btn-warning mt-1' style='width: 120px !important;' IdTicketAs='"+str(ticket.IdTicket)+"'>Asignar</button>"

                if ticket.Estado == "Resuelto" and (session['Tipo'] == 1 or session['Tipo'] == 2):
                    boton2 = "<button class='btn btn-danger mt-1' style='width: 120px !important;' IdTicketElim="+str(ticket.IdTicket)+">Eliminar</button>"
                elif (ticket.Estado == "Pendiente" or ticket.Estado == "Trabajando") and (session['Tipo'] == 1 or session['Tipo'] == 2):
                    boton2 = ""
                elif ticket.Estado == "Pendiente" and session['Tipo'] == 3:
                    boton1 = "<button data-toggle='modal' data-target='#asignarTicketModal' class='btn btn-warning mt-1 mr-3' style='width: 120px !important;' IdTicketAs='"+str(ticket.IdTicket)+"'>Asignar</button>"
                    boton2 = "<button class='btn btn-danger mt-1' style='width: 120px !important;' IdTicketElim="+str(ticket.IdTicket)+">Eliminar</button>"
                elif ticket.Estado == "Pendiente" and session['Tipo'] == 4:
                    boton2 = "<button class='btn btn-primary mt-1' style='width: 120px !important;' IdTicketTrabajar='"+str(ticket.IdTicket)+"'>Trabajar</button>"
                elif ticket.Estado == "Trabajando" and session['Tipo'] == 4:
                    boton2 = "<button data-toggle='modal' data-target='#resolucionTicket' class='btn btn-primary mt-1' style='width: 120px !important;' IdTicketCerrar='"+str(ticket.IdTicket)+"'>Cerrar</button>"
                elif ticket.Estado == "Resuelto" and session['Tipo'] == 4:
                    boton2 = ""
                elif session['Tipo'] == 5:
                    boton2 = ""
                elif (ticket.Estado == "Trabajando" or ticket.Estado == "Pendiente") and session['Tipo'] == 6:
                    boton2 = ""
                elif ticket.Estado == "Resuelto" and session['Tipo'] == 6:
                    if ticket.Calificacion == None:
                        boton2 = "<button data-toggle='modal' data-target='#calificarTicketModal' class='btn btn-warning mt-1' style='width: 120px !important;' IdTicketCalificar='"+str(ticket.IdTicket)+"'>Calificar</button>"
                    else:
                        boton2 = ""

                botones = boton1+boton2

                plantilla += """<div class='card mb-3' style='max-width: 100%;'>
                <div class='row no-gutters'>
                <div class='col-12'>
                <div class='card-body'>
                <h5 class='card-title'>"""+ticket.Titulo+"""</h5>
                <p class='card-text'>"""+ticket.Detalle+"""</p>
                <p class='card-text'><small class='text-muted'>"""+str(ticket.FechaHoraCreacion)+"""</small></p>
                <div class='card-footer' style='display: none;'>
                    <p class='card-text'>Creador: """+ticket.Creador+"""</p>
                    <p class='card-text'>Asignador: """+Asignador+"""</p>
                    <p class='card-text'>Encargado: """+Solucionador+"""</p>
                    <p class='card-text'>Departamento: """+Departamento+"""</p>
                    <p class='card-text'>Prioridad: """+Prioridad+"""</p>
                    <p class='card-text'>Urgencia: """+str(ticket.Urgencia)+"""</p>
                    <p class='card-text'>Resuelto: """+str(FechaHoraResolucion)+"""</p>
                    <p class='card-text'>Estado: """+ticket.Estado+"""</p>
                    <p class='card-text'>Calificacion: """+str(Calificacion)+"""</p>
                    <p class='card-text'>Resolucion: """+str(Resolucion)+"""</p>
                    </div>"""+botones+"""
                </div>
                </div>
            </div>
            </div>"""


            return plantilla
        else:
            if session['Tipo'] == 3:
                return "<h4 class='text-center' style='text-transform:capitalize'>No hay tickets pendientes de asignacion</h4>"
            elif session['Tipo'] == 4 and int(idFiltro) != 1:
                return "<h4 class='text-center' style='text-transform:capitalize'>No posees tickets con este filtro</h4>"
            elif session['Tipo'] == 4:
                return "<h4 class='text-center' style='text-transform:capitalize;'>No hay tickets pendientes</h4>"

            return "<h4 class='text-center' style='text-transform:capitalize'>No existen tickets con este filtro</h4>"
    else:
        return redirect(url_for('inicio.index'))