Ejemplo n.º 1
0
def login():
    if request.method == "GET":
        return render_template("login.html")
    else:
        if request.form['username'] != "" and request.form['password'] != "":
            if operations.login(request.form['username'],
                                request.form['password']):
                template = env.get_template('Dashboard.html')

                connection = operations.get_connection()
                cursor = connection.cursor()
                cursor.execute(
                    "select id,nume,prenume,adresaProceduralaJudet,adresaProceduralaOras,cnp from lexbox.instance order by instance.dataProcesVerbal desc limit 15"
                )
                records = cursor.fetchall()
                connection.close()

                results = []
                for i in records:
                    results.append(
                        Record(i[1], i[2], i[3], i[4], i[5],
                               operations.getDownloadLink(i[0])))
                template.records = results

                return operations.setToken(template.render(records=results),
                                           request.form['username'], False)
            return render_template("loginFailed.html")
        else:
            return render_template("login.html")
Ejemplo n.º 2
0
def getInstitutions():

    con = get_connection()
    cursor = con.cursor()
    cursor.execute("SELECT * FROM lexbox.institutie")
    records = cursor.fetchall()
    con.close()

    toReplace = ""
    institutions = []

    for row in records:
        institutions.append(
            Institutie(row[0], row[1], row[2], row[3], row[4], row[5], row[6],
                       row[7], row[8]))
    institutions = sort(institutions)

    for i in institutions:
        toReplace += "<option value = \"{id}\" > {name} </option>".format(
            name=i.__repr__(), id=i.id) + " \n "

    res = ""
    HTMLresult = open("templates/Plangere.html", "r", encoding="utf-8")
    for line in HTMLresult:
        line = line.replace("              $$$A$$$", toReplace)
        res += line
    HTMLresult.close()

    return res
Ejemplo n.º 3
0
def getInstitution(id):
    con = get_connection()
    cursor = con.cursor()
    cursor.execute(
        "SELECT * FROM lexbox.institutie where id={id}".format(id=str(id)))
    records = cursor.fetchall()
    con.close()
    return Institutie(records[0][0], records[0][1], records[0][2],
                      records[0][3], records[0][4], records[0][5],
                      records[0][6], records[0][7], records[0][8])
Ejemplo n.º 4
0
def getLaw(articol, aliniat, litera):
    litera = litera.lower()
    connection = get_connection()
    cursor = connection.cursor()
    cursor.execute(
        "select textlege from lexbox.lege where articol='{articol}' and aliniat='{aliniat}' and litera='{litera}'"
        .format(articol=articol, aliniat=aliniat, litera=litera))
    records = cursor.fetchall()
    connection.close()
    try:
        return records[0][0]
    except:
        return ""
Ejemplo n.º 5
0
def search():
    if operations.checkToken(request.args.get('token')):
        template = env.get_template('Dashboard.html')

        connection = operations.get_connection()
        cursor = connection.cursor()
        cursor.execute(
            "select id,nume, prenume, adresaProceduralaJudet, adresaProceduralaOras, cnp from lexbox.instance where '{query}' like {criteria} limit 15"
            .format(criteria=request.args.get('criteria'),
                    query=request.args.get('keyword')))
        records = cursor.fetchall()
        connection.close()

        results = []

        for i in records:
            results.append(
                Record(i[1], i[2], i[3], i[4], i[5],
                       operations.getDownloadLink(i[0])))
        template.records = results
        return operations.setToken(template.render(records=results),
                                   request.args.get('token'), True)
    else:
        return render_template("loginFailed.html")
Ejemplo n.º 6
0
    def save(self):
        uploadedFiles = ""
        insertQuery = """INSERT INTO instance(
            nume,
            prenume,
            telefon,
            serieBuletin,
            numarBuletin,
            cnp,
            adresaProceduralaStrada,
            adresaProceduralaNumar,
            adresaProceduralaOras,
            adresaProceduralaJudet,
            adresaProceduralaBloc,
            adresaProceduralaScara,
            adresaProceduralaApartament,
            adresaProceduralaCodPostal,
            numeAgent,
            prenumeAgent,
            calitateAgent,
            institutieAgent,
            locSavarsireContraventie,
            posesieProcesVerbalContraventie,
            serieProcesVerbal,
            numarProcesVerbal,
            dataProcesVerbal,
            posesieProcesVerbal,
            dataInmanariiProcesVerbal,
            dataSavarsireFaptaProcesVerbal,
            plataAmenda,
            plataAmendaFile,
            solicitareInstanta,
            prezentareSituatieProcesVerbal,
            prezentareSituatieDPDVPropriu,
            articolFapta,
            aliniatFapta,
            normaLegalaFapta,
            articolSanctiune,
            aliniatSanctiune,
            normaLegalaSanctiune,
            martori,
            adeverintaVenit,
            adeverintaMedicala,
            alteDocumente,
            carteIdentitate,
            procesVerbalContraventie,
            chitantaPlata,
            alteDocumente2,
            prezentaJudecata,
            asistareJudecata,
            plangere
            ) VALUES (""" + "%s," * 48
        insertQuery = insertQuery[:-1] + ")"
        if self.plataAmendaFile == b'':
            self.plataAmendaFile = None
        else:
            uploadedFiles += "- Poza plata amenda\n"
        if self.adeverintaVenit == b'':
            self.adeverintaVenit = None
        else:
            uploadedFiles += "- Adeverinta Venit/Pensie\n"
        if self.adeverintaMedicala == b'':
            self.adeverintaMedicala = None
        else:
            uploadedFiles += "- Adeverinta Medicala\n"
        if self.alteDocumente == b'':
            self.alteDocumente = None
        else:
            uploadedFiles += "- Alte Documente\n"
        if self.carteIdentitate == b'':
            self.carteIdentitate = None
        else:
            uploadedFiles += "- Carte de identitate\n"
        if self.procesVerbalContraventie == b'':
            self.procesVerbalContraventie = None
        else:
            uploadedFiles += "- Proces verbal de contraventie\n"
        if self.chitantaPlata == b'':
            self.chitantaPlata = None
        else:
            uploadedFiles += "- Chitanta plata\n"
        if self.alteDocumente2 == b'':
            self.alteDocumente2 = None
        else:
            uploadedFiles += "- Alte Documente2"

        insertBlobTouple = (
            self.nume, self.prenume, self.telefon, self.serieBuletin,
            self.numarBuletin, self.cnp, self.adresaProceduralaStrada,
            self.adresaProceduralaNumar, self.adresaProceduralaOras,
            self.adresaProceduralaJudet, self.adresaProceduralaBloc,
            self.adresaProceduralaScara, self.adresaProceduralaApartament,
            self.adresaProceduralaCodPostal, self.numeAgent, self.prenumeAgent,
            self.calitateAgent, self.institutieAgent,
            self.locSavarsireContraventie,
            self.posesieProcesVerbalContraventie, self.serieProcesVerbal,
            self.numarProcesVerbal, self.dataProcesVerbal,
            self.posesieProcesVerbal, self.dataInmanariiProcesVerbal,
            self.dataSavarsireFaptaProcesVerbal, self.plataAmenda,
            self.plataAmendaFile, self.solicitareInstanta,
            self.prezentareSituatieProcesVerbal,
            self.prezentareSituatieDPDVPropriu, self.articolFapta,
            self.aliniatFapta, self.normaLegalaFapta, self.articolSanctiune,
            self.aliniatSanctiune, self.normaLegalaSanctiune, self.martori,
            self.adeverintaVenit, self.adeverintaMedicala, self.alteDocumente,
            self.carteIdentitate, self.procesVerbalContraventie,
            self.chitantaPlata, self.alteDocumente2, self.prezentaJudecata,
            self.asistareJudecata, self.getCompletedForm(uploadedFiles))
        con = get_connection()
        cursor = con.cursor()
        result = cursor.execute(insertQuery, insertBlobTouple)
        con.commit()
        con.close()