forked from ScoDoc/ScoDoc
preferences, modif export
This commit is contained in:
parent
aff01323c7
commit
722ec09eb5
@ -117,13 +117,13 @@ def verif_contact_data(contact_data):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# entreprise_id existant
|
# entreprise_id existant
|
||||||
entreprise = Entreprise.query.filter_by(id=contact_data[6]).first()
|
entreprise = Entreprise.query.filter_by(siret=contact_data[6]).first()
|
||||||
if entreprise is None:
|
if entreprise is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# contact possède le meme nom et prénom dans la meme entreprise
|
# contact possède le meme nom et prénom dans la meme entreprise
|
||||||
contact = EntrepriseContact.query.filter_by(
|
contact = EntrepriseContact.query.filter_by(
|
||||||
nom=contact_data[0], prenom=contact_data[1], entreprise_id=contact_data[6]
|
nom=contact_data[0], prenom=contact_data[1], entreprise_id=entreprise.id
|
||||||
).first()
|
).first()
|
||||||
if contact is not None:
|
if contact is not None:
|
||||||
return False
|
return False
|
||||||
|
@ -39,6 +39,7 @@ from wtforms import (
|
|||||||
HiddenField,
|
HiddenField,
|
||||||
SelectMultipleField,
|
SelectMultipleField,
|
||||||
DateField,
|
DateField,
|
||||||
|
BooleanField,
|
||||||
)
|
)
|
||||||
from wtforms.validators import ValidationError, DataRequired, Email, Optional
|
from wtforms.validators import ValidationError, DataRequired, Email, Optional
|
||||||
from wtforms.widgets import ListWidget, CheckboxInput
|
from wtforms.widgets import ListWidget, CheckboxInput
|
||||||
@ -356,3 +357,12 @@ class ImportForm(FlaskForm):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
submit = SubmitField("Importer", render_kw=SUBMIT_MARGE)
|
submit = SubmitField("Importer", render_kw=SUBMIT_MARGE)
|
||||||
|
|
||||||
|
|
||||||
|
class PreferencesForm(FlaskForm):
|
||||||
|
mail_entreprise = StringField(
|
||||||
|
"Mail notifications",
|
||||||
|
validators=[Optional(), Email(message="Adresse e-mail invalide")],
|
||||||
|
)
|
||||||
|
check_siret = BooleanField("Vérification SIRET")
|
||||||
|
submit = SubmitField("Valider", render_kw=SUBMIT_MARGE)
|
||||||
|
@ -27,7 +27,7 @@ class Entreprise(db.Model):
|
|||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {
|
return {
|
||||||
"siret": self.siret,
|
"siret": self.siret,
|
||||||
"nom": self.nom,
|
"nom_entreprise": self.nom,
|
||||||
"adresse": self.adresse,
|
"adresse": self.adresse,
|
||||||
"code_postal": self.codepostal,
|
"code_postal": self.codepostal,
|
||||||
"ville": self.ville,
|
"ville": self.ville,
|
||||||
@ -49,6 +49,7 @@ class EntrepriseContact(db.Model):
|
|||||||
service = db.Column(db.Text)
|
service = db.Column(db.Text)
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
|
entreprise = Entreprise.query.filter_by(id=self.entreprise_id).first()
|
||||||
return {
|
return {
|
||||||
"nom": self.nom,
|
"nom": self.nom,
|
||||||
"prenom": self.prenom,
|
"prenom": self.prenom,
|
||||||
@ -56,7 +57,7 @@ class EntrepriseContact(db.Model):
|
|||||||
"mail": self.mail,
|
"mail": self.mail,
|
||||||
"poste": self.poste,
|
"poste": self.poste,
|
||||||
"service": self.service,
|
"service": self.service,
|
||||||
"entreprise_id": self.entreprise_id,
|
"entreprise_siret": entreprise.siret,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,3 +139,10 @@ class EntrepriseOffreDepartement(db.Model):
|
|||||||
db.Integer, db.ForeignKey("are_entreprise_offre.id", ondelete="cascade")
|
db.Integer, db.ForeignKey("are_entreprise_offre.id", ondelete="cascade")
|
||||||
)
|
)
|
||||||
dept_id = db.Column(db.Integer, db.ForeignKey("departement.id", ondelete="cascade"))
|
dept_id = db.Column(db.Integer, db.ForeignKey("departement.id", ondelete="cascade"))
|
||||||
|
|
||||||
|
|
||||||
|
class EntreprisePreferences(db.Model):
|
||||||
|
__tablename__ = "are_preferences"
|
||||||
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
name = db.Column(db.Text)
|
||||||
|
value = db.Column(db.Text)
|
||||||
|
@ -24,6 +24,7 @@ from app.entreprises.forms import (
|
|||||||
AjoutFichierForm,
|
AjoutFichierForm,
|
||||||
ValidationConfirmationForm,
|
ValidationConfirmationForm,
|
||||||
ImportForm,
|
ImportForm,
|
||||||
|
PreferencesForm,
|
||||||
)
|
)
|
||||||
from app.entreprises import bp
|
from app.entreprises import bp
|
||||||
from app.entreprises.models import (
|
from app.entreprises.models import (
|
||||||
@ -34,6 +35,7 @@ from app.entreprises.models import (
|
|||||||
EntrepriseEtudiant,
|
EntrepriseEtudiant,
|
||||||
EntrepriseEnvoiOffre,
|
EntrepriseEnvoiOffre,
|
||||||
EntrepriseOffreDepartement,
|
EntrepriseOffreDepartement,
|
||||||
|
EntreprisePreferences,
|
||||||
)
|
)
|
||||||
from app.entreprises import app_relations_entreprises as are
|
from app.entreprises import app_relations_entreprises as are
|
||||||
from app.models import Identite
|
from app.models import Identite
|
||||||
@ -124,7 +126,7 @@ def fiche_entreprise(id):
|
|||||||
les offres de l'entreprise.
|
les offres de l'entreprise.
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||||
description=f"fiche entreprise {id} inconnu"
|
description=f"fiche entreprise {id} inconnue"
|
||||||
)
|
)
|
||||||
offres_with_files = []
|
offres_with_files = []
|
||||||
depts = are.get_depts()
|
depts = are.get_depts()
|
||||||
@ -188,7 +190,7 @@ def fiche_entreprise_validation(id):
|
|||||||
Permet d'afficher la fiche entreprise d'une entreprise a valider
|
Permet d'afficher la fiche entreprise d'une entreprise a valider
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=False).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=False).first_or_404(
|
||||||
description=f"fiche entreprise (validation) {id} inconnu"
|
description=f"fiche entreprise (validation) {id} inconnue"
|
||||||
)
|
)
|
||||||
contacts = entreprise.contacts
|
contacts = entreprise.contacts
|
||||||
return render_template(
|
return render_template(
|
||||||
@ -242,7 +244,7 @@ def offres_expirees(id):
|
|||||||
Permet d'afficher la liste des offres expirés d'une entreprise
|
Permet d'afficher la liste des offres expirés d'une entreprise
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||||
description=f"fiche entreprise {id} inconnu"
|
description=f"fiche entreprise {id} inconnue"
|
||||||
)
|
)
|
||||||
offres_expirees_with_files = []
|
offres_expirees_with_files = []
|
||||||
depts = are.get_depts()
|
depts = are.get_depts()
|
||||||
@ -318,7 +320,7 @@ def edit_entreprise(id):
|
|||||||
Permet de modifier une entreprise de la base avec un formulaire
|
Permet de modifier une entreprise de la base avec un formulaire
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||||
description=f"entreprise {id} inconnu"
|
description=f"entreprise {id} inconnue"
|
||||||
)
|
)
|
||||||
form = EntrepriseModificationForm()
|
form = EntrepriseModificationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -387,7 +389,7 @@ def delete_entreprise(id):
|
|||||||
Permet de supprimer une entreprise de la base avec un formulaire de confirmation
|
Permet de supprimer une entreprise de la base avec un formulaire de confirmation
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||||
description=f"entreprise {id} inconnu"
|
description=f"entreprise {id} inconnue"
|
||||||
)
|
)
|
||||||
form = SuppressionConfirmationForm()
|
form = SuppressionConfirmationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -424,7 +426,7 @@ def validate_entreprise(id):
|
|||||||
"""
|
"""
|
||||||
form = ValidationConfirmationForm()
|
form = ValidationConfirmationForm()
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=False).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=False).first_or_404(
|
||||||
description=f"entreprise (validation) {id} inconnu"
|
description=f"entreprise (validation) {id} inconnue"
|
||||||
)
|
)
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
entreprise.visible = True
|
entreprise.visible = True
|
||||||
@ -451,7 +453,7 @@ def delete_validation_entreprise(id):
|
|||||||
Permet de supprimer une entreprise en attente de validation avec une formulaire de validation
|
Permet de supprimer une entreprise en attente de validation avec une formulaire de validation
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=False).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=False).first_or_404(
|
||||||
description=f"entreprise (validation) {id} inconnu"
|
description=f"entreprise (validation) {id} inconnue"
|
||||||
)
|
)
|
||||||
form = SuppressionConfirmationForm()
|
form = SuppressionConfirmationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -473,7 +475,7 @@ def add_offre(id):
|
|||||||
Permet d'ajouter une offre a une entreprise
|
Permet d'ajouter une offre a une entreprise
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||||
description=f"entreprise {id} inconnu"
|
description=f"entreprise {id} inconnue"
|
||||||
)
|
)
|
||||||
form = OffreCreationForm()
|
form = OffreCreationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -518,7 +520,7 @@ def edit_offre(id):
|
|||||||
Permet de modifier une offre
|
Permet de modifier une offre
|
||||||
"""
|
"""
|
||||||
offre = EntrepriseOffre.query.filter_by(id=id).first_or_404(
|
offre = EntrepriseOffre.query.filter_by(id=id).first_or_404(
|
||||||
description=f"offre {id} inconnu"
|
description=f"offre {id} inconnue"
|
||||||
)
|
)
|
||||||
offre_depts = EntrepriseOffreDepartement.query.filter_by(offre_id=offre.id).all()
|
offre_depts = EntrepriseOffreDepartement.query.filter_by(offre_id=offre.id).all()
|
||||||
form = OffreModificationForm()
|
form = OffreModificationForm()
|
||||||
@ -575,7 +577,7 @@ def delete_offre(id):
|
|||||||
Permet de supprimer une offre
|
Permet de supprimer une offre
|
||||||
"""
|
"""
|
||||||
offre = EntrepriseOffre.query.filter_by(id=id).first_or_404(
|
offre = EntrepriseOffre.query.filter_by(id=id).first_or_404(
|
||||||
description=f"offre {id} inconnu"
|
description=f"offre {id} inconnue"
|
||||||
)
|
)
|
||||||
entreprise_id = offre.entreprise.id
|
entreprise_id = offre.entreprise.id
|
||||||
form = SuppressionConfirmationForm()
|
form = SuppressionConfirmationForm()
|
||||||
@ -610,7 +612,7 @@ def delete_offre(id):
|
|||||||
def delete_offre_recue(id):
|
def delete_offre_recue(id):
|
||||||
offre_recue = EntrepriseEnvoiOffre.query.filter_by(
|
offre_recue = EntrepriseEnvoiOffre.query.filter_by(
|
||||||
id=id, receiver_id=current_user.id
|
id=id, receiver_id=current_user.id
|
||||||
).first_or_404(description=f"offre recu {id} inconnu")
|
).first_or_404(description=f"offre recu {id} inconnue")
|
||||||
db.session.delete(offre_recue)
|
db.session.delete(offre_recue)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return redirect(url_for("entreprises.offres_recues"))
|
return redirect(url_for("entreprises.offres_recues"))
|
||||||
@ -623,7 +625,7 @@ def add_contact(id):
|
|||||||
Permet d'ajouter un contact a une entreprise
|
Permet d'ajouter un contact a une entreprise
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||||
description=f"entreprise {id} inconnu"
|
description=f"entreprise {id} inconnue"
|
||||||
)
|
)
|
||||||
form = ContactCreationForm(hidden_entreprise_id=entreprise.id)
|
form = ContactCreationForm(hidden_entreprise_id=entreprise.id)
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -746,7 +748,7 @@ def add_historique(id):
|
|||||||
Permet d'ajouter un étudiant ayant réalisé un stage ou une alternance sur la fiche entreprise de l'entreprise
|
Permet d'ajouter un étudiant ayant réalisé un stage ou une alternance sur la fiche entreprise de l'entreprise
|
||||||
"""
|
"""
|
||||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||||
description=f"entreprise {id} inconnu"
|
description=f"entreprise {id} inconnue"
|
||||||
)
|
)
|
||||||
form = HistoriqueCreationForm()
|
form = HistoriqueCreationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -791,7 +793,7 @@ def envoyer_offre(id):
|
|||||||
Permet d'envoyer une offre à un utilisateur
|
Permet d'envoyer une offre à un utilisateur
|
||||||
"""
|
"""
|
||||||
offre = EntrepriseOffre.query.filter_by(id=id).first_or_404(
|
offre = EntrepriseOffre.query.filter_by(id=id).first_or_404(
|
||||||
description=f"offre {id} inconnu"
|
description=f"offre {id} inconnue"
|
||||||
)
|
)
|
||||||
form = EnvoiOffreForm()
|
form = EnvoiOffreForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -876,7 +878,7 @@ def export_entreprises():
|
|||||||
"""
|
"""
|
||||||
entreprises = Entreprise.query.filter_by(visible=True).all()
|
entreprises = Entreprise.query.filter_by(visible=True).all()
|
||||||
if entreprises:
|
if entreprises:
|
||||||
keys = ["siret", "nom", "adresse", "ville", "code_postal", "pays"]
|
keys = ["siret", "nom_entreprise", "adresse", "ville", "code_postal", "pays"]
|
||||||
titles = keys[:]
|
titles = keys[:]
|
||||||
L = [
|
L = [
|
||||||
[entreprise.to_dict().get(k, "") for k in keys]
|
[entreprise.to_dict().get(k, "") for k in keys]
|
||||||
@ -901,13 +903,12 @@ def get_import_entreprises_file_sample():
|
|||||||
"nom_entreprise",
|
"nom_entreprise",
|
||||||
"adresse",
|
"adresse",
|
||||||
"ville",
|
"ville",
|
||||||
"codepostal",
|
"code_postal",
|
||||||
"pays",
|
"pays",
|
||||||
]
|
]
|
||||||
titles = keys[:]
|
titles = keys[:]
|
||||||
# lines = [["" for x in range(6)] for y in range(100)]
|
|
||||||
title = "ImportEntreprises"
|
title = "ImportEntreprises"
|
||||||
xlsx = sco_excel.excel_simple_table_test(titles=titles, sheet_name="Entreprises")
|
xlsx = sco_excel.excel_simple_table(titles=titles, sheet_name="Entreprises")
|
||||||
filename = title
|
filename = title
|
||||||
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
||||||
|
|
||||||
@ -930,7 +931,7 @@ def import_entreprises():
|
|||||||
entreprises_import = []
|
entreprises_import = []
|
||||||
siret_list = []
|
siret_list = []
|
||||||
ligne = 0
|
ligne = 0
|
||||||
titles = ["siret", "nom", "adresse", "ville", "code_postal", "pays"]
|
titles = ["siret", "nom_entreprise", "adresse", "ville", "code_postal", "pays"]
|
||||||
if data[1][0] != titles:
|
if data[1][0] != titles:
|
||||||
flash("Veuillez utilisez la feuille excel à remplir")
|
flash("Veuillez utilisez la feuille excel à remplir")
|
||||||
return render_template(
|
return render_template(
|
||||||
@ -1010,7 +1011,7 @@ def export_contacts():
|
|||||||
"mail",
|
"mail",
|
||||||
"poste",
|
"poste",
|
||||||
"service",
|
"service",
|
||||||
"entreprise_id",
|
"entreprise_siret",
|
||||||
]
|
]
|
||||||
titles = keys[:]
|
titles = keys[:]
|
||||||
L = [[contact.to_dict().get(k, "") for k in keys] for contact in contacts]
|
L = [[contact.to_dict().get(k, "") for k in keys] for contact in contacts]
|
||||||
@ -1035,7 +1036,7 @@ def get_import_contacts_file_sample():
|
|||||||
"mail",
|
"mail",
|
||||||
"poste",
|
"poste",
|
||||||
"service",
|
"service",
|
||||||
"entreprise_id",
|
"entreprise_siret",
|
||||||
]
|
]
|
||||||
titles = keys[:]
|
titles = keys[:]
|
||||||
title = "ImportContacts"
|
title = "ImportContacts"
|
||||||
@ -1069,7 +1070,7 @@ def import_contacts():
|
|||||||
"mail",
|
"mail",
|
||||||
"poste",
|
"poste",
|
||||||
"service",
|
"service",
|
||||||
"entreprise_id",
|
"entreprise_siret",
|
||||||
]
|
]
|
||||||
if data[1][0] != titles:
|
if data[1][0] != titles:
|
||||||
flash("Veuillez utilisez la feuille excel à remplir")
|
flash("Veuillez utilisez la feuille excel à remplir")
|
||||||
@ -1169,7 +1170,7 @@ def add_offre_file(offre_id):
|
|||||||
Permet d'ajouter un fichier à une offre
|
Permet d'ajouter un fichier à une offre
|
||||||
"""
|
"""
|
||||||
offre = EntrepriseOffre.query.filter_by(id=offre_id).first_or_404(
|
offre = EntrepriseOffre.query.filter_by(id=offre_id).first_or_404(
|
||||||
description=f"offre {offre_id} inconnu"
|
description=f"offre {offre_id} inconnue"
|
||||||
)
|
)
|
||||||
form = AjoutFichierForm()
|
form = AjoutFichierForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -1201,7 +1202,7 @@ def delete_offre_file(offre_id, filedir):
|
|||||||
Permet de supprimer un fichier d'une offre
|
Permet de supprimer un fichier d'une offre
|
||||||
"""
|
"""
|
||||||
offre = EntrepriseOffre.query.filter_by(id=offre_id).first_or_404(
|
offre = EntrepriseOffre.query.filter_by(id=offre_id).first_or_404(
|
||||||
description=f"offre {offre_id} inconnu"
|
description=f"offre {offre_id} inconnue"
|
||||||
)
|
)
|
||||||
form = SuppressionConfirmationForm()
|
form = SuppressionConfirmationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
@ -1223,3 +1224,45 @@ def delete_offre_file(offre_id, filedir):
|
|||||||
title="Suppression fichier d'une offre",
|
title="Suppression fichier d'une offre",
|
||||||
form=form,
|
form=form,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/preferences", methods=["GET", "POST"])
|
||||||
|
@permission_required(Permission.RelationsEntreprisesValidate)
|
||||||
|
def preferences():
|
||||||
|
form = PreferencesForm()
|
||||||
|
if form.validate_on_submit():
|
||||||
|
exists = EntreprisePreferences.query.filter_by(name="check_siret").first()
|
||||||
|
if not exists:
|
||||||
|
prefs = EntreprisePreferences(
|
||||||
|
name="check_siret", value=int(form.check_siret.data)
|
||||||
|
)
|
||||||
|
db.session.add(prefs)
|
||||||
|
else:
|
||||||
|
exists.value = int(form.check_siret.data)
|
||||||
|
db.session.commit()
|
||||||
|
exists = EntreprisePreferences.query.filter_by(
|
||||||
|
name="mail_notifications_entreprise"
|
||||||
|
).first()
|
||||||
|
if not exists and form.mail_entreprise.data:
|
||||||
|
prefs = EntreprisePreferences(
|
||||||
|
name="mail_notifications_entreprise",
|
||||||
|
value=form.mail_entreprise.data.strip(),
|
||||||
|
)
|
||||||
|
db.session.add(prefs)
|
||||||
|
else:
|
||||||
|
exists.value = form.mail_entreprise.data
|
||||||
|
db.session.commit()
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(url_for("entreprises.index"))
|
||||||
|
elif request.method == "GET":
|
||||||
|
mail = EntreprisePreferences.query.filter_by(
|
||||||
|
name="mail_notifications_entreprise"
|
||||||
|
).first()
|
||||||
|
check_siret = EntreprisePreferences.query.filter_by(name="check_siret").first()
|
||||||
|
form.mail_entreprise.data = mail.value
|
||||||
|
form.check_siret.data = int(check_siret.value)
|
||||||
|
return render_template(
|
||||||
|
"entreprises/preferences.html",
|
||||||
|
title="Préférences",
|
||||||
|
form=form,
|
||||||
|
)
|
||||||
|
@ -428,52 +428,6 @@ def excel_simple_table(
|
|||||||
return ws.generate()
|
return ws.generate()
|
||||||
|
|
||||||
|
|
||||||
def excel_simple_table_test(
|
|
||||||
titles=None, lines=None, sheet_name=b"feuille", titles_styles=None, comments=None
|
|
||||||
):
|
|
||||||
"""Export simple type 'CSV': 1ere ligne en gras, le reste tel quel"""
|
|
||||||
ws = ScoExcelSheet(sheet_name)
|
|
||||||
|
|
||||||
if titles is None:
|
|
||||||
titles = []
|
|
||||||
if lines is None:
|
|
||||||
lines = [[]]
|
|
||||||
if titles_styles is None:
|
|
||||||
style = excel_make_style(bold=True)
|
|
||||||
titles_styles = [style] * len(titles)
|
|
||||||
if comments is None:
|
|
||||||
comments = [None] * len(titles)
|
|
||||||
# ligne de titres
|
|
||||||
ws.append_row(
|
|
||||||
[
|
|
||||||
ws.make_cell(it, style, comment)
|
|
||||||
for (it, style, comment) in zip(titles, titles_styles, comments)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
default_style = excel_make_style()
|
|
||||||
text_style = excel_make_style(number_format=FORMAT_GENERAL)
|
|
||||||
int_style = excel_make_style()
|
|
||||||
float_style = excel_make_style(number_format=FORMAT_NUMBER_00)
|
|
||||||
for line in lines:
|
|
||||||
cells = []
|
|
||||||
for it in line:
|
|
||||||
cell_style = default_style
|
|
||||||
if type(it) == float:
|
|
||||||
cell_style = float_style
|
|
||||||
elif type(it) == int:
|
|
||||||
cell_style = int_style
|
|
||||||
else:
|
|
||||||
cell_style = text_style
|
|
||||||
cells.append(ws.make_cell(it, cell_style))
|
|
||||||
ws.append_row(cells)
|
|
||||||
|
|
||||||
# sheet = ws.wb.active
|
|
||||||
# for cell in sheet["A2":"A100"]:
|
|
||||||
# cell.number_format = FORMAT_GENERAL
|
|
||||||
|
|
||||||
return ws.generate()
|
|
||||||
|
|
||||||
|
|
||||||
def excel_feuille_saisie(e, titreannee, description, lines):
|
def excel_feuille_saisie(e, titreannee, description, lines):
|
||||||
"""Genere feuille excel pour saisie des notes.
|
"""Genere feuille excel pour saisie des notes.
|
||||||
E: evaluation (dict)
|
E: evaluation (dict)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<tr><td>mail</td><td>text</td><td>mail du contact</td></tr>
|
<tr><td>mail</td><td>text</td><td>mail du contact</td></tr>
|
||||||
<tr><td>poste</td><td>text</td><td>poste du contact</td></tr>
|
<tr><td>poste</td><td>text</td><td>poste du contact</td></tr>
|
||||||
<tr><td>service</td><td>text</td><td>service dans lequel travaille le contact</td></tr>
|
<tr><td>service</td><td>text</td><td>service dans lequel travaille le contact</td></tr>
|
||||||
<tr><td>entreprise_id</td><td>integer</td><td>l'id de l'entreprise</td></tr>
|
<tr><td>entreprise_siret</td><td>integer</td><td>SIRET de l'entreprise</td></tr>
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<table class="table">
|
<table class="table">
|
||||||
<thead><tr><td><b>Attribut</b></td><td><b>Type</b></td><td><b>Description</b></td></tr></thead>
|
<thead><tr><td><b>Attribut</b></td><td><b>Type</b></td><td><b>Description</b></td></tr></thead>
|
||||||
<tr><td>siret</td><td>text</td><td>siret de l'entreprise</td></tr>
|
<tr><td>siret</td><td>text</td><td>siret de l'entreprise</td></tr>
|
||||||
<tr><td>nom</td><td>text</td><td>nom de l'entreprise</td></tr>
|
<tr><td>nom_entreprise</td><td>text</td><td>nom de l'entreprise</td></tr>
|
||||||
<tr><td>adresse</td><td>text</td><td>adresse de l'entreprise</td></tr>
|
<tr><td>adresse</td><td>text</td><td>adresse de l'entreprise</td></tr>
|
||||||
<tr><td>ville</td><td>text</td><td>ville de l'entreprise</td></tr>
|
<tr><td>ville</td><td>text</td><td>ville de l'entreprise</td></tr>
|
||||||
<tr><td>code_postal</td><td>text</td><td>code postal de l'entreprise</td></tr>
|
<tr><td>code_postal</td><td>text</td><td>code postal de l'entreprise</td></tr>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<li><a href="{{ url_for('entreprises.offres_recues') }}">Offres reçues</a></li>
|
<li><a href="{{ url_for('entreprises.offres_recues') }}">Offres reçues</a></li>
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesValidate, None) %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesValidate, None) %}
|
||||||
<li><a href="{{ url_for('entreprises.validation') }}">Entreprises à valider</a></li>
|
<li><a href="{{ url_for('entreprises.validation') }}">Entreprises à valider</a></li>
|
||||||
|
<li><a href="{{ url_for('entreprises.preferences') }}">Préférences</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
15
app/templates/entreprises/preferences.html
Normal file
15
app/templates/entreprises/preferences.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{# -*- mode: jinja-html -*- #}
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
{% import 'bootstrap/wtf.html' as wtf %}
|
||||||
|
|
||||||
|
{% block app_content %}
|
||||||
|
{% include 'entreprises/nav.html' %}
|
||||||
|
|
||||||
|
<h1>Préférences module gestion entreprises</h1>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
{{ wtf.quick_form(form, novalidate=True) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -1,8 +1,8 @@
|
|||||||
"""tables module gestion relations entreprises
|
"""tables module gestion relations entreprises
|
||||||
|
|
||||||
Revision ID: 593451ab68b3
|
Revision ID: 717a8dfe2915
|
||||||
Revises: c95d5a3bf0de
|
Revises: b9aadc10227f
|
||||||
Create Date: 2022-02-04 17:06:02.519231
|
Create Date: 2022-02-22 20:18:57.171246
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
@ -10,8 +10,8 @@ import sqlalchemy as sa
|
|||||||
from sqlalchemy.dialects import postgresql
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "593451ab68b3"
|
revision = "717a8dfe2915"
|
||||||
down_revision = "c95d5a3bf0de"
|
down_revision = "b9aadc10227f"
|
||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
|
|
||||||
@ -44,6 +44,13 @@ def upgrade():
|
|||||||
sa.Column("visible", sa.Boolean(), nullable=True),
|
sa.Column("visible", sa.Boolean(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
|
op.create_table(
|
||||||
|
"are_preferences",
|
||||||
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
|
sa.Column("name", sa.Text(), nullable=True),
|
||||||
|
sa.Column("value", sa.Text(), nullable=True),
|
||||||
|
sa.PrimaryKeyConstraint("id"),
|
||||||
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"are_entreprise_contact",
|
"are_entreprise_contact",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
@ -148,14 +155,31 @@ def upgrade():
|
|||||||
op.drop_table("entreprise_correspondant")
|
op.drop_table("entreprise_correspondant")
|
||||||
op.drop_index("ix_entreprises_dept_id", table_name="entreprises")
|
op.drop_index("ix_entreprises_dept_id", table_name="entreprises")
|
||||||
op.drop_table("entreprises")
|
op.drop_table("entreprises")
|
||||||
|
op.drop_index("ix_apc_competence_id_orebut", table_name="apc_competence")
|
||||||
|
op.create_index(
|
||||||
|
op.f("ix_apc_competence_id_orebut"),
|
||||||
|
"apc_competence",
|
||||||
|
["id_orebut"],
|
||||||
|
unique=False,
|
||||||
|
)
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_index(op.f("ix_apc_competence_id_orebut"), table_name="apc_competence")
|
||||||
|
op.create_index(
|
||||||
|
"ix_apc_competence_id_orebut", "apc_competence", ["id_orebut"], unique=False
|
||||||
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"entreprises",
|
"entreprises",
|
||||||
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
|
sa.Column(
|
||||||
|
"id",
|
||||||
|
sa.INTEGER(),
|
||||||
|
server_default=sa.text("nextval('entreprises_id_seq'::regclass)"),
|
||||||
|
autoincrement=True,
|
||||||
|
nullable=False,
|
||||||
|
),
|
||||||
sa.Column("nom", sa.TEXT(), autoincrement=False, nullable=True),
|
sa.Column("nom", sa.TEXT(), autoincrement=False, nullable=True),
|
||||||
sa.Column("adresse", sa.TEXT(), autoincrement=False, nullable=True),
|
sa.Column("adresse", sa.TEXT(), autoincrement=False, nullable=True),
|
||||||
sa.Column("ville", sa.TEXT(), autoincrement=False, nullable=True),
|
sa.Column("ville", sa.TEXT(), autoincrement=False, nullable=True),
|
||||||
@ -180,18 +204,12 @@ def downgrade():
|
|||||||
["dept_id"], ["departement.id"], name="entreprises_dept_id_fkey"
|
["dept_id"], ["departement.id"], name="entreprises_dept_id_fkey"
|
||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint("id", name="entreprises_pkey"),
|
sa.PrimaryKeyConstraint("id", name="entreprises_pkey"),
|
||||||
|
postgresql_ignore_search_path=False,
|
||||||
)
|
)
|
||||||
|
op.create_index("ix_entreprises_dept_id", "entreprises", ["dept_id"], unique=False)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"entreprise_correspondant",
|
"entreprise_correspondant",
|
||||||
sa.Column(
|
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
|
||||||
"id",
|
|
||||||
sa.INTEGER(),
|
|
||||||
server_default=sa.text(
|
|
||||||
"nextval('entreprise_correspondant_id_seq'::regclass)"
|
|
||||||
),
|
|
||||||
autoincrement=True,
|
|
||||||
nullable=False,
|
|
||||||
),
|
|
||||||
sa.Column("entreprise_id", sa.INTEGER(), autoincrement=False, nullable=True),
|
sa.Column("entreprise_id", sa.INTEGER(), autoincrement=False, nullable=True),
|
||||||
sa.Column("nom", sa.TEXT(), autoincrement=False, nullable=True),
|
sa.Column("nom", sa.TEXT(), autoincrement=False, nullable=True),
|
||||||
sa.Column("prenom", sa.TEXT(), autoincrement=False, nullable=True),
|
sa.Column("prenom", sa.TEXT(), autoincrement=False, nullable=True),
|
||||||
@ -210,7 +228,6 @@ def downgrade():
|
|||||||
name="entreprise_correspondant_entreprise_id_fkey",
|
name="entreprise_correspondant_entreprise_id_fkey",
|
||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint("id", name="entreprise_correspondant_pkey"),
|
sa.PrimaryKeyConstraint("id", name="entreprise_correspondant_pkey"),
|
||||||
postgresql_ignore_search_path=False,
|
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"entreprise_contact",
|
"entreprise_contact",
|
||||||
@ -241,13 +258,13 @@ def downgrade():
|
|||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint("id", name="entreprise_contact_pkey"),
|
sa.PrimaryKeyConstraint("id", name="entreprise_contact_pkey"),
|
||||||
)
|
)
|
||||||
op.create_index("ix_entreprises_dept_id", "entreprises", ["dept_id"], unique=False)
|
|
||||||
op.drop_table("are_entreprise_offre_departement")
|
op.drop_table("are_entreprise_offre_departement")
|
||||||
op.drop_table("are_entreprise_envoi_offre_etudiant")
|
op.drop_table("are_entreprise_envoi_offre_etudiant")
|
||||||
op.drop_table("are_entreprise_envoi_offre")
|
op.drop_table("are_entreprise_envoi_offre")
|
||||||
op.drop_table("are_entreprise_offre")
|
op.drop_table("are_entreprise_offre")
|
||||||
op.drop_table("are_entreprise_etudiant")
|
op.drop_table("are_entreprise_etudiant")
|
||||||
op.drop_table("are_entreprise_contact")
|
op.drop_table("are_entreprise_contact")
|
||||||
|
op.drop_table("are_preferences")
|
||||||
op.drop_table("are_entreprises")
|
op.drop_table("are_entreprises")
|
||||||
op.drop_table("are_entreprise_log")
|
op.drop_table("are_entreprise_log")
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user