示例#1
0
def trabajarTicket():
    if "ID" in session and session['Tipo'] == 4:
        if request.method == 'POST':
            objTicket = Ticket()
            objEmail = Email()
            objUsuario = Usuario()
            IdTicket = int(request.form['IdTicket'])

            objTicket.setID(IdTicket)
            ticket = objTicket.consultarID()
            objUsuario.setID(int(ticket[0].IdCreador))
            usuario = objUsuario.consultarID()

            if ticket[0].IdSolucionador != None:
                return "TicketTrabajando"
            else:            
                if objTicket.trabjarTicket():
                    if len(usuario) > 0:
                        email = usuario[0].Email
                        objEmail.emailActualizacionTicket(email,1,ticket[0].Titulo,0)
                    else:
                        return "Error"

                    return "Exito"
                else:
                    return "Error"
        else:
            return redirect(url_for('inicio.index'))
示例#2
0
def cerrarTicket():
        if "ID" in session and session['Tipo'] == 4:
            if request.method == 'POST':
                objTicket = Ticket()
                objEmail = Email()
                objUsuario = Usuario()
                IdTicket = int(request.form['IdTicket'])
                Resolucion = request.form['res']

                objTicket.setID(IdTicket)
                objTicket.setResolucion(Resolucion)
                ticket = objTicket.consultarID()
                objUsuario.setID(int(ticket[0].IdCreador))
                usuario = objUsuario.consultarID()
                
                if len(ticket) > 0:
                    if objTicket.cerrarTicket():

                        if len(usuario) > 0:
                            email = usuario[0].Email
                            objEmail.emailActualizacionTicket(email,2,ticket[0].Titulo,0)
                        else:
                            return "Error"

                        return "Exito"
                    else:
                        return "Error"
        else:
            return redirect(url_for('inicio.index'))
示例#3
0
    def test_ticket_creation(self):
        with self.app.app_context():
            self.db.session.add(self.user)
            tt = TicketType.query.filter_by(fixed_id=0).one()
            ticket = Ticket(type=tt, user_id=self.user.id)
            self.db.session.add(ticket)
            self.db.session.commit()

            # A ticket without a payment isn't sold...
            assert sum(TicketType.get_ticket_sales().values()) == 0
            assert ticket.id is not None

            ticket.paid = True
            self.db.session.flush()
            # ... but a paid one is
            assert sum(TicketType.get_ticket_sales().values()) == 1

            ticket.expires = datetime.utcnow() - timedelta(minutes=1)
            self.db.session.flush()
            # Expired tickets still count towards capacity
            assert sum(TicketType.get_ticket_sales().values()) == 1

            ticket.paid = False
            self.db.session.flush()
            assert sum(TicketType.get_ticket_sales().values()) == 0
示例#4
0
def cPanelClienteG():
    if "ID" in session and session["Tipo"] == 6:
        if request.method == 'GET':
            objEmpresa = Empresa()
            objEmpresa.setIdTipo(1)
            empresas = objEmpresa.ListarEmpresasXTipo()
            return render_template('clienteG/cPanelClienteG.html',
                                   avatar=session["Avatar"],
                                   empresas=empresas,
                                   ID=session['ID'])
        elif request.method == 'POST':
            titulo = request.form['titulo']
            detalle = request.form['detalle']
            urgencia = request.form['urgencia']
            empresa = request.form['empresa']

            objTicket = Ticket()
            objTicket.setTicket(titulo, detalle, empresa,
                                int(session['Empresa']), int(session['ID']),
                                urgencia)
            if objTicket.agregarTicket():
                return "Exito"
            else:
                return "Error"
        else:
            return redirect(url_for('index'))
    else:
        return redirect(url_for('index'))
示例#5
0
def asignarTicket():
    if "ID" in session and session['Tipo'] == 3:
        if request.method == 'POST':
            objTicket = Ticket()
            objEmail = Email()
            objUsuario = Usuario()
            IdTicket = int(request.form['IdT'])
            IdDep = int(request.form['IdDep'])
            IdUsuario = int(request.form['User'])
            Prioridad = int(request.form['Prio'])

            objTicket.setID(IdTicket)
            objTicket.setPrioridad(Prioridad)
            objTicket.setIDDepartamento(IdDep)
            objTicket.setIDSolucionador(IdUsuario)

            ticket = objTicket.consultarID()
            objUsuario.setID(IdUsuario) if IdUsuario != None else objUsuario.setID(0)
            usuario = objUsuario.consultarID()

            if ticket[0].IdDepartamento == None: 
                if objTicket.asignarTicket():

                    if len(usuario) > 0:
                        email = usuario[0].Email
                        objEmail.emailActualizacionTicket(email,3,ticket[0].Titulo,Prioridad)

                    return "Exito"
                else:
                    return "Error"
            else:
                return "Ticket Ya Asignado"
        else:
            return redirect(url_for('index'))
    def depositar_vehiculo(self, matricula, tipo):
        depositado = False


        if(tipo.lower() == "turismo"):
            if(len(parking_servicio.plazas_libres_turismo()) > 0):
                plaza_asignada = parking_servicio.plazas_libres_turismo()[0]
                parking_servicio.plazas_libres_turismo()[0].ocupada = True
                depositado = True

        elif(tipo.lower() == "motocicleta"):
            if(len(parking_servicio.plazas_libres_moto()) > 0):
                plaza_asignada = parking_servicio.plazas_libres_moto()[0]
                parking_servicio.plazas_libres_moto()[0].ocupada = True
                depositado = True

        elif(tipo.lower() == "movilidad reducida"):
            if(len(parking_servicio.plazas_libres_movreducida()) > 0):
                plaza_asignada = parking_servicio.plazas_libres_movreducida()[0]
                parking_servicio.plazas_libres_movreducida()[0].ocupada = True
                depositado = True

        if(depositado):
            pin = randint(111111,999999)

            ticket = Ticket(matricula, datetime.now(), plaza_asignada.id, pin)
            ticket_servicio.save(ticket)


        else:
            raise DatosErroneos

        return depositado
def create_new_ticket():
    new_ticket = Ticket(name=api.payload['name'],
                        price=api.payload['price'],
                        description=api.payload['description'],
                        image=api.payload['image'],
                        user_id=get_jwt_identity())
    db.session.add(new_ticket)
    db.session.commit()
示例#8
0
 def create_ticket(cls, data):
     """Create a new ticket."""
     new_ticket = Ticket(
         ticket_id=cls.get_highest_ticket_id() + 1,
         name=data["name"]
     )
     cls._tickets.append(new_ticket)
     return new_ticket
示例#9
0
def create_basket():
    user_id = current_user.id
    items, total = get_basket_and_total()

    basket = [Ticket(type=tt, user_id=user_id) for tt in items]
    app.logger.debug('Added tickets to db for basket %s with total %s', basket,
                     total)
    return basket, total
示例#10
0
 def create_ticket(cls, data):
     """Create a new ticket."""
     highest_ticket_id = cls._get_highest_ticket_id() + 1
     new_ticket = Ticket(ticket_id=highest_ticket_id,
                         name=data["name"],
                         status=data["status"])
     cls._tickets.append(new_ticket)
     return new_ticket
示例#11
0
def get_basket():
    basket = []
    for code in session.get('basket', []):
        basket.append(Ticket(code=code))

    total = sum(t.type.get_price(get_user_currency()) for t in basket)

    app.logger.debug('Got basket %s with total %s', basket, total)
    return basket, total
示例#12
0
def cPanelAsignador():
    if "ID" in session and session['Tipo'] == 3:
        objTicket = Ticket()
        objDep = Departamento()
        deps = objDep.ListarDepartamentosXEstado(1)
        tickets = objTicket.ListarTicketsXAsignar(int(session['Empresa']))
        return render_template('asignador/cPanelAsignador.html', avatar=session["Avatar"], tickets=tickets, departamentos=deps, ID=session['ID'])
    else:
        return redirect(url_for('index'))
示例#13
0
def ticket_choice_prompt(cinema, movie: MovieSchema, projection, movie_hall,
                         ticket_count: int):
    """
    Prompt the user to choose the seats for each ticket he wants to buy
    :param cinema: An object of class Cinema
    :param movie: A MovieSchema object for a movie from the Movie DB table
    :param projection: A ProjectionSchema object for a projection from the Projections DB table
    :param movie_hall: A 11x11 matrix representing the free seats in the movie hall
    :param ticket_count: The count of tickets the user wants to buy
    :return: A dictionary type: {ticket_idx:a Ticket object}
    """
    to_give_up = False
    tickets = {}  # type: {int:Ticket}
    for i in range(ticket_count):
        # loop until the user chooses a valid ticket
        while True:
            print("Please pick a spot for ticket #{}".format(i + 1))
            print_movie_hall(movie_hall)

            # Get the row/col for a seat and validate them
            row = input("Choose a row: (1-10): ")
            while not is_valid_row_or_col(row):
                if row == 'give up':
                    to_give_up = True
                    return None, to_give_up
                print('The row you entered is invalid.')
                row = input("Choose a row: (1-10): ")
            row = int(row)

            col = input("Choose a cow: (1-10): ")
            while not is_valid_row_or_col(col):
                if col == 'give up':
                    to_give_up = True
                    return None, to_give_up
                print('The col you entered is invalid.')
                col = input("Choose a col: (1-10): ")
            col = int(col)

            if movie_hall[row][col] == 'X':
                print('The spot you chose is taken!')
            else:
                # take the seat and add the ticket
                movie_hall[row][col] = 'X'
                ticket = Ticket(row,
                                col,
                                movie_name=movie.name,
                                projection_id=projection.id_,
                                proj_type=projection.type,
                                date=projection.proj_date,
                                hour=projection.time,
                                owner_id=cinema.user.id_)
                tickets[i + 1] = ticket
                break

    return tickets, to_give_up
示例#14
0
def get_basket():
    types = [TicketType.query.get(code) for code in session.get('basket', [])]

    total = sum(tt.get_price(get_user_currency()) for tt in types)

    basket = []
    for tt in types:
        basket.append(Ticket(type=tt))

    app.logger.debug('Got basket %s with total %s', basket, total)
    return basket, total
示例#15
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'))
示例#16
0
def eliminarTicket():
    if request.method != 'POST':
        return redirect(url_for('inicio.index'))
    else:
        if "ID" in session:
            IdTicket = int(request.form['IdTicket'])
            objTicket = Ticket()
            objTicket.setID(IdTicket)
            if len(objTicket.consultarID()) > 0:
                if objTicket.eliminarTicket():
                    return "Exito"
            else:
                return "ticketPrevElim"

    return "Error"
示例#17
0
def calificarTicket():
    if "ID" in session and session['Tipo'] == 6:
        if request.method == 'POST':
            calificacion = int(request.form['cal'])
            idTicket = int(request.form['idTicket'])

            objTicket = Ticket()
            objTicket.setCalificacion(calificacion)
            objTicket.setID(idTicket)

            if objTicket.calificarTicket():
                return "Exito"
            else:
                return "Error"
        else:
            return redirect(url_for('index'))
示例#18
0
def parse_response_to_tickets(query):
    print('\n🎟  Grabbing ticket info 🎟')

    tickets = []

    ticket_response = make_ticket_request(query)['issues']
    for ticket in ticket_response:
        issue = ticket['key']
        title = ticket['fields']['summary']
        labels = ticket['fields']['labels']
        created = ticket['fields']['created']
        ticket = Ticket(issue, title, labels, created)
        tickets.append(ticket)
        pprint.pprint(vars(ticket))

    return tickets
def __parse_ticket_from_issue(issue, cloudBase):
    # Parse Reporter
    reporter = User(issue['fields']['reporter']['displayName'])

    # Parse Assignee
    assignee = User("Not Assigned")
    try:
        assignee.username = issue['fields']['assignee']['displayName']
    except:
        pass

    # Parse Key
    key = issue['key']

    link = JIRA_USER_TICKET.replace(JIRA_USER_BASE_REPLACE, cloudBase)
    link = link.replace(JIRA_USER_TICKET_REPLACE, key)

    # Parse Id
    issueId = issue['id']

    # Parse Summary
    summary = issue['fields']['summary']

    # Parse created At
    createdAt = issue['fields']['created']
    createdAt = datetime.datetime.strptime(createdAt, '%Y-%m-%dT%H:%M:%S.%f%z')

    # Parse Labels
    labels = issue['fields']['labels']

    # Parse Status
    status = Status(issue['fields']['status']['statusCategory']['name'],
                    issue['fields']['status']['statusCategory']['colorName'])

    # Parse subtasks out
    subtasks = []
    for subtask in issue['fields']['subtasks']:
        subtasks.append(Subtask(subtask['key']))

    # Parse type
    ticket_type = issue['fields']['issuetype']['name']

    ticket = Ticket(issueId, key, summary, key, labels, createdAt, reporter,
                    assignee, subtasks, link, status, ticket_type)

    return ticket
def compare_winners():
    with open('models/zadanie.json') as js:
        data = json.load(js)

    numbers_quantity = data["numbers-quantity"]
    numbers_range = data["numbers-range"]
    numbers_range_min = numbers_range["min"]
    numbers_range_max = numbers_range["max"]

    global lottery_results
    lottery_results = lottery_engine(numbers_quantity, numbers_range_min,
                                     numbers_range_max)

    ticket = Ticket()
    all_tickets = ticket.load_all_tickets(cursor)
    winners = []
    winners_list = []
    ticket_list = []

    for ticket in all_tickets:
        tickets_from_db = ticket.selected_numbers[1:-1].split(", ")
        tickets_to_load = (list(tickets_from_db))
        player_dict = {}
        for numb in tickets_to_load:
            if int(numb) in lottery_results:
                winners.append(ticket)
                player_dict[ticket.id] = 1
                dict_to_add = player_dict
                if dict_to_add in ticket_list:
                    ticket_list.remove(dict_to_add)
                    player_dict[ticket.id] += 1
                    dict_to_change = player_dict
                    ticket_list.append(dict_to_change)
                else:
                    ticket_list.append(dict_to_add)
        if winners is not None:
            for person in winners:
                if person.id not in winners_list:
                    winners_list.append(person.id)

        return ticket_list
示例#21
0
def tickets_choose_free(user_id=None):
    has_price = TicketPrice.query.filter(TicketPrice.price_int > 0)

    free_tts = TicketType.query.filter(
        ~has_price.filter(TicketPrice.type.expression).exists(), ).order_by(
            TicketType.order).all()

    if user_id is None:
        form = FreeTicketsNewUserForm()
        user = None
        new_user = True
    else:
        form = FreeTicketsForm()
        user = User.query.get_or_404(user_id)
        new_user = False

    if request.method != 'POST':
        for tt in free_tts:
            form.types.append_entry()
            form.types[-1].type_id.data = tt.id

    tts = {tt.id: tt for tt in free_tts}
    for f in form.types:
        f._type = tts[f.type_id.data]
        # TODO: apply per-user limits
        values = range(f._type.personal_limit + 1)
        f.amount.values = values
        f._any = any(values)

    if form.validate_on_submit():
        if new_user:
            app.logger.info('Creating new user with email %s and name %s',
                            form.email.data, form.name.data)
            user = User(form.email.data, form.name.data)
            flash('Created account for %s' % form.email.data)

        tickets = []
        for f in form.types:
            if f.amount.data:
                tt = f._type
                for i in range(f.amount.data):
                    t = Ticket(type=tt, user_id=user_id)
                    t.paid = True
                    user.tickets.append(t)
                    tickets.append(t)

                app.logger.info('Allocated %s %s tickets to user',
                                f.amount.data, tt.name)

        db.session.add(user)
        db.session.commit()

        code = user.login_code(app.config['SECRET_KEY'])
        send_template_email('Your complimentary tickets to EMF',
                            user.email,
                            app.config['CONTACT_EMAIL'],
                            'emails/tickets-free.txt',
                            user=user,
                            code=code,
                            tickets=tickets,
                            new_user=new_user)

        flash('Allocated %s ticket(s)' % len(tickets))
        return redirect(url_for('.tickets_choose_free'))

    if new_user:
        users = User.query.order_by(User.id).all()
    else:
        users = None

    return render_template('admin/tickets-choose-free.html',
                           form=form,
                           tts=free_tts,
                           user=user,
                           users=users)
示例#22
0
def buscarTickets():
    if request.method == "POST" and "ID" in session:
        plantilla = ""
        objTicket = Ticket()
        objTicket.setIdEmpresa(int(session['Empresa']))
        objTicket.setIDDepartamento(session['Departamento']) if session['Departamento'] != None else 0
        filtro = request.form['filtro']

        resultado = objTicket.buscarTickets(filtro,int(session['Tipo']),int(session['ID']))
        if len(resultado) > 0:
            for r in resultado:
                Asignador = r.Asignador if (r.Asignador != None) else 'Vacio'
                Solucionador = r.Solucionador if (r.Solucionador != None) else 'Vacio'
                Departamento = r.Departamento if (r.Departamento != None) else 'Vacio'
                FechaHoraResolucion = r.FechaHoraResolucion if (r.FechaHoraResolucion != None) else 'Vacio'
                Calificacion = r.Calificacion if (r.Calificacion != None) else 'Vacio'
                Resolucion = r.Resolucion if (r.Resolucion != None) else 'Vacio'
                Prioridad = r.Prioridad if (r.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(r.IdTicket)+"'>Asignar</button>"

                if r.Estado == "Resuelto" and (session['Tipo'] == 1 or session['Tipo'] == 2):
                    boton2 = "<button class='btn btn-danger mt-1' style='width: 120px !important;' IdTicketElim="+str(r.IdTicket)+">Eliminar</button>"
                elif (r.Estado == "Pendiente" or r.Estado == "Trabajando") and (session['Tipo'] == 1 or session['Tipo'] == 2):
                    boton2 = ""
                elif r.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(r.IdTicket)+"'>Asignar</button>"
                    boton2 = "<button class='btn btn-danger mt-1' style='width: 120px !important;' IdTicketElim="+str(r.IdTicket)+">Eliminar</button>"
                elif r.Estado == "Pendiente" and session['Tipo'] == 4:
                    boton2 = "<button class='btn btn-primary mt-1' style='width: 120px !important;' IdTicketTrabajar='"+str(r.IdTicket)+"'>Trabajar</button>"
                elif r.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(r.IdTicket)+"'>Cerrar</button>"
                elif r.Estado == "Resuelto" and session['Tipo'] == 4:
                    boton2 = ""
                elif session['Tipo'] == 5:
                    boton2 = ""
                elif (r.Estado == "Trabajando" or r.Estado == "Pendiente") and session['Tipo'] == 6:
                    boton2 = ""
                elif r.Estado == "Resuelto" and session['Tipo'] == 6:
                    if r.Calificacion == None:
                        boton2 = "<button data-toggle='modal' data-target='#calificarTicketModal' class='btn btn-warning mt-1' style='width: 120px !important;' IdTicketCalificar='"+str(r.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'>"""+r.Titulo+"""</h5>
                <p class='card-text'>"""+r.Detalle+"""</p>
                <p class='card-text'><small class='text-muted'>"""+str(r.FechaHoraCreacion)+"""</small></p>
                <div class='card-footer' style='display: none;'>
                    <p class='card-text'>Creador: """+r.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(r.Urgencia)+"""</p>
                    <p class='card-text'>Resuelto: """+str(FechaHoraResolucion)+"""</p>
                    <p class='card-text'>Estado: """+r.Estado+"""</p>
                    <p class='card-text'>Calificacion: """+str(Calificacion)+"""</p>
                    <p class='card-text'>Resolucion: """+str(Resolucion)+"""</p>
                    </div>"""+botones+"""
                </div>
                </div>
                </div>
                </div>"""

        else:
            plantilla += "<h4 class='text-center' style='text-transform:capitalize'>No hay resultados para tu busqueda</h4>"

        return plantilla

    return redirect(url_for('inicio.index'))
示例#23
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'))
示例#24
0
    def lista_tickets(self, lista_tickets):
        self.__lista_tickets = lista_tickets

    def save(self, ticket):
        self.lista_tickets.append(ticket)

    def find_all(self):
        return self.lista_tickets

    def find_by_pin(self, pin):
        for ticket in self.lista_tickets:
            if (ticket.pin == pin):
                return ticket

    def find_by_matricula(self, matricula):
        for ticket in self.lista_tickets:
            if (ticket.matricula == matricula):
                return ticket


lista_tickets = [
    Ticket("1234BBB", datetime(2020, 12, 10, 15, 30), 6, 111111,
           datetime(2020, 12, 10, 17, 30), 5),
    Ticket("1234JJJ", datetime(2020, 12, 12, 15, 30), 6, 111111,
           datetime(2020, 12, 12, 17, 30), 5.50),
    Ticket("1234FFF", datetime(2020, 12, 14, 15, 30), 6, 111111,
           datetime(2020, 12, 14, 17, 30), 6)
]

ticket_repositorio = TicketRepositorio(lista_tickets)