forked from ScoDoc/ScoDoc
import export données application relations entreprises
This commit is contained in:
parent
e96d714545
commit
9e751722e6
@ -223,21 +223,45 @@ def get_excel_book_are(export=False):
|
|||||||
"ville",
|
"ville",
|
||||||
"code_postal",
|
"code_postal",
|
||||||
"pays",
|
"pays",
|
||||||
"association",
|
|
||||||
"visible",
|
|
||||||
"active",
|
|
||||||
"notes_active",
|
|
||||||
]
|
]
|
||||||
sites_keys = [
|
sites_keys = [
|
||||||
"siret_entreprise",
|
[
|
||||||
|
"siret_entreprise",
|
||||||
|
"id",
|
||||||
|
"nom_site",
|
||||||
|
"adresse",
|
||||||
|
"ville",
|
||||||
|
"code_postal",
|
||||||
|
"pays",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"civilite",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
"telephone",
|
||||||
|
"mail",
|
||||||
|
"poste",
|
||||||
|
"service",
|
||||||
|
"origine",
|
||||||
|
"notes",
|
||||||
|
],
|
||||||
|
]
|
||||||
|
correspondants_keys = [
|
||||||
|
"id",
|
||||||
|
"civilite",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
"telephone",
|
||||||
|
"mail",
|
||||||
|
"poste",
|
||||||
|
"service",
|
||||||
|
"origine",
|
||||||
|
"notes",
|
||||||
"nom_site",
|
"nom_site",
|
||||||
"adresse",
|
|
||||||
"ville",
|
|
||||||
"code_postal",
|
|
||||||
"pays",
|
|
||||||
]
|
]
|
||||||
entreprises_titles = entreprises_keys[:]
|
entreprises_titles = entreprises_keys[:]
|
||||||
sites_titles = sites_keys[:]
|
sites_titles = sites_keys[:]
|
||||||
|
correspondants_titles = correspondants_keys[:]
|
||||||
wb = sco_excel.ScoExcelBook()
|
wb = sco_excel.ScoExcelBook()
|
||||||
ws1 = wb.create_sheet("Entreprises")
|
ws1 = wb.create_sheet("Entreprises")
|
||||||
ws1.append_row(
|
ws1.append_row(
|
||||||
@ -254,8 +278,26 @@ def get_excel_book_are(export=False):
|
|||||||
[
|
[
|
||||||
ws2.make_cell(it, style)
|
ws2.make_cell(it, style)
|
||||||
for (it, style) in zip(
|
for (it, style) in zip(
|
||||||
sites_titles,
|
sites_titles[0],
|
||||||
[sco_excel.excel_make_style(bold=True)] * len(sites_titles),
|
[sco_excel.excel_make_style(bold=True)] * len(sites_titles[0]),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
+ [
|
||||||
|
ws2.make_cell(it, style)
|
||||||
|
for (it, style) in zip(
|
||||||
|
sites_titles[1],
|
||||||
|
[sco_excel.excel_make_style(bold=True, color=sco_excel.COLORS.RED)]
|
||||||
|
* len(sites_titles[1]),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
ws3 = wb.create_sheet("Correspondants")
|
||||||
|
ws3.append_row(
|
||||||
|
[
|
||||||
|
ws3.make_cell(it, style)
|
||||||
|
for (it, style) in zip(
|
||||||
|
correspondants_titles,
|
||||||
|
[sco_excel.excel_make_style(bold=True)] * len(correspondants_titles),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -267,12 +309,22 @@ def get_excel_book_are(export=False):
|
|||||||
.filter_by(visible=True)
|
.filter_by(visible=True)
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
correspondants = (
|
||||||
|
db.session.query(EntrepriseCorrespondant)
|
||||||
|
.join(Entreprise, EntrepriseCorrespondant.entreprise_id == Entreprise.id)
|
||||||
|
.filter_by(visible=True)
|
||||||
|
.all()
|
||||||
|
)
|
||||||
entreprises_lines = [
|
entreprises_lines = [
|
||||||
[entreprise.to_dict().get(k, "") for k in entreprises_keys]
|
[entreprise.to_dict().get(k, "") for k in entreprises_keys]
|
||||||
for entreprise in entreprises
|
for entreprise in entreprises
|
||||||
]
|
]
|
||||||
sites_lines = [
|
sites_lines = [
|
||||||
[site.to_dict().get(k, "") for k in sites_keys] for site in sites
|
[site.to_dict().get(k, "") for k in sites_keys[0]] for site in sites
|
||||||
|
]
|
||||||
|
correspondants_lines = [
|
||||||
|
[correspondant.to_dict().get(k, "") for k in correspondants_keys]
|
||||||
|
for correspondant in correspondants
|
||||||
]
|
]
|
||||||
for line in entreprises_lines:
|
for line in entreprises_lines:
|
||||||
cells = []
|
cells = []
|
||||||
@ -284,4 +336,9 @@ def get_excel_book_are(export=False):
|
|||||||
for it in line:
|
for it in line:
|
||||||
cells.append(ws2.make_cell(it))
|
cells.append(ws2.make_cell(it))
|
||||||
ws2.append_row(cells)
|
ws2.append_row(cells)
|
||||||
|
for line in correspondants_lines:
|
||||||
|
cells = []
|
||||||
|
for it in line:
|
||||||
|
cells.append(ws3.make_cell(it))
|
||||||
|
ws3.append_row(cells)
|
||||||
return wb
|
return wb
|
||||||
|
@ -67,6 +67,7 @@ class EntrepriseSite(db.Model):
|
|||||||
entreprise = Entreprise.query.get_or_404(self.entreprise_id)
|
entreprise = Entreprise.query.get_or_404(self.entreprise_id)
|
||||||
return {
|
return {
|
||||||
"siret_entreprise": entreprise.siret,
|
"siret_entreprise": entreprise.siret,
|
||||||
|
"id": self.id,
|
||||||
"nom_site": self.nom,
|
"nom_site": self.nom,
|
||||||
"adresse": self.adresse,
|
"adresse": self.adresse,
|
||||||
"code_postal": self.codepostal,
|
"code_postal": self.codepostal,
|
||||||
@ -93,8 +94,9 @@ class EntrepriseCorrespondant(db.Model):
|
|||||||
notes = db.Column(db.Text)
|
notes = db.Column(db.Text)
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
entreprise = Entreprise.query.filter_by(id=self.entreprise_id).first()
|
site = EntrepriseSite.query.get_or_404(self.site_id)
|
||||||
return {
|
return {
|
||||||
|
"id": self.id,
|
||||||
"civilite": self.civilite,
|
"civilite": self.civilite,
|
||||||
"nom": self.nom,
|
"nom": self.nom,
|
||||||
"prenom": self.prenom,
|
"prenom": self.prenom,
|
||||||
@ -104,7 +106,7 @@ class EntrepriseCorrespondant(db.Model):
|
|||||||
"service": self.service,
|
"service": self.service,
|
||||||
"origine": self.origine,
|
"origine": self.origine,
|
||||||
"notes": self.notes,
|
"notes": self.notes,
|
||||||
"entreprise_siret": entreprise.siret,
|
"nom_site": site.nom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1374,9 +1374,9 @@ def json_responsables():
|
|||||||
return jsonify(results=list)
|
return jsonify(results=list)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/export_entreprises")
|
@bp.route("/export_donnees")
|
||||||
@permission_required(Permission.RelationsEntreprisesExport)
|
@permission_required(Permission.RelationsEntreprisesExport)
|
||||||
def export_entreprises():
|
def export_donnees():
|
||||||
"""
|
"""
|
||||||
Permet d'exporter la liste des entreprises sous format excel (.xlsx)
|
Permet d'exporter la liste des entreprises sous format excel (.xlsx)
|
||||||
"""
|
"""
|
||||||
@ -1384,28 +1384,27 @@ def export_entreprises():
|
|||||||
if entreprise:
|
if entreprise:
|
||||||
wb = are.get_excel_book_are(export=True)
|
wb = are.get_excel_book_are(export=True)
|
||||||
xlsx = wb.generate()
|
xlsx = wb.generate()
|
||||||
filename = "ExportEntreprisesSites"
|
filename = "ExportApplicationRelationsEntreprises"
|
||||||
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
||||||
else:
|
else:
|
||||||
flash("Aucune entreprise dans la base.")
|
|
||||||
return redirect(url_for("entreprises.index"))
|
return redirect(url_for("entreprises.index"))
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/import_entreprises/get_import_entreprises_file_sample")
|
@bp.route("/import_donnees/get_file_sample")
|
||||||
@permission_required(Permission.RelationsEntreprisesExport)
|
@permission_required(Permission.RelationsEntreprisesExport)
|
||||||
def get_import_entreprises_file_sample():
|
def get_import_donnees_file_sample():
|
||||||
"""
|
"""
|
||||||
Permet de récupérer un fichier exemple vide pour pouvoir importer des entreprises
|
Permet de récupérer un fichier exemple vide pour pouvoir importer des entreprises
|
||||||
"""
|
"""
|
||||||
wb = are.get_excel_book_are()
|
wb = are.get_excel_book_are()
|
||||||
xlsx = wb.generate()
|
xlsx = wb.generate()
|
||||||
filename = "ImportEntreprisesSites"
|
filename = "ImportApplicationRelationsEntreprises"
|
||||||
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/import_entreprises", methods=["GET", "POST"])
|
@bp.route("/import_donnees", methods=["GET", "POST"])
|
||||||
@permission_required(Permission.RelationsEntreprisesExport)
|
@permission_required(Permission.RelationsEntreprisesExport)
|
||||||
def import_entreprises():
|
def import_donnees():
|
||||||
"""
|
"""
|
||||||
Permet d'importer des entreprises a l'aide d'un fichier excel (.xlsx)
|
Permet d'importer des entreprises a l'aide d'un fichier excel (.xlsx)
|
||||||
"""
|
"""
|
||||||
@ -1418,61 +1417,8 @@ def import_entreprises():
|
|||||||
file.save(file_path)
|
file.save(file_path)
|
||||||
data = sco_excel.excel_file_to_list(file_path)
|
data = sco_excel.excel_file_to_list(file_path)
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
entreprises_import = []
|
print(data)
|
||||||
siret_list = []
|
return redirect(url_for("entreprises.import_donnees"))
|
||||||
ligne = 0
|
|
||||||
titles = ["siret", "nom_entreprise", "adresse", "ville", "code_postal", "pays"]
|
|
||||||
if data[1][0] != titles:
|
|
||||||
flash("Veuillez utilisez la feuille excel à remplir")
|
|
||||||
return render_template(
|
|
||||||
"entreprises/import_entreprises.html",
|
|
||||||
title="Importation entreprises",
|
|
||||||
form=form,
|
|
||||||
)
|
|
||||||
for entreprise_data in data[1][1:]:
|
|
||||||
ligne += 1
|
|
||||||
if (
|
|
||||||
are.verif_entreprise_data(entreprise_data)
|
|
||||||
and entreprise_data[0].replace(" ", "") not in siret_list
|
|
||||||
):
|
|
||||||
siret_list.append(entreprise_data[0].replace(" ", ""))
|
|
||||||
entreprise = Entreprise(
|
|
||||||
siret=entreprise_data[0].replace(" ", ""),
|
|
||||||
nom=entreprise_data[1].strip(),
|
|
||||||
adresse=entreprise_data[2].strip(),
|
|
||||||
ville=entreprise_data[3].strip(),
|
|
||||||
codepostal=entreprise_data[4].strip(),
|
|
||||||
pays=entreprise_data[5].strip(),
|
|
||||||
visible=True,
|
|
||||||
)
|
|
||||||
entreprises_import.append(entreprise)
|
|
||||||
else:
|
|
||||||
flash(f"Erreur lors de l'importation (ligne {ligne})")
|
|
||||||
return render_template(
|
|
||||||
"entreprises/import_entreprises.html",
|
|
||||||
title="Importation entreprises",
|
|
||||||
form=form,
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(entreprises_import) > 0:
|
|
||||||
for entreprise in entreprises_import:
|
|
||||||
db.session.add(entreprise)
|
|
||||||
log = EntrepriseLog(
|
|
||||||
authenticated_user=current_user.user_name,
|
|
||||||
text=f"Importation de {len(entreprises_import)} entreprise(s)",
|
|
||||||
)
|
|
||||||
db.session.add(log)
|
|
||||||
db.session.commit()
|
|
||||||
flash(f"Importation réussie de {len(entreprises_import)} entreprise(s)")
|
|
||||||
return render_template(
|
|
||||||
"entreprises/import_entreprises.html",
|
|
||||||
title="Importation entreprises",
|
|
||||||
form=form,
|
|
||||||
entreprises_import=entreprises_import,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
flash('Feuille "Entreprises" vide')
|
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"entreprises/import_entreprises.html",
|
"entreprises/import_entreprises.html",
|
||||||
title="Importation entreprises",
|
title="Importation entreprises",
|
||||||
@ -1480,175 +1426,6 @@ def import_entreprises():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/export_correspondants")
|
|
||||||
@permission_required(Permission.RelationsEntreprisesExport)
|
|
||||||
def export_correspondants():
|
|
||||||
"""
|
|
||||||
Permet d'exporter la liste des correspondants sous format excel (.xlsx)
|
|
||||||
"""
|
|
||||||
correspondants = (
|
|
||||||
db.session.query(EntrepriseCorrespondant)
|
|
||||||
.join(Entreprise, EntrepriseCorrespondant.entreprise_id == Entreprise.id)
|
|
||||||
.filter_by(visible=True, active=True)
|
|
||||||
.all()
|
|
||||||
)
|
|
||||||
if correspondants:
|
|
||||||
keys = [
|
|
||||||
"civilite",
|
|
||||||
"nom",
|
|
||||||
"prenom",
|
|
||||||
"telephone",
|
|
||||||
"mail",
|
|
||||||
"poste",
|
|
||||||
"service",
|
|
||||||
"origine",
|
|
||||||
"notes",
|
|
||||||
"entreprise_siret",
|
|
||||||
]
|
|
||||||
titles = keys[:]
|
|
||||||
L = [
|
|
||||||
[correspondant.to_dict().get(k, "") for k in keys]
|
|
||||||
for correspondant in correspondants
|
|
||||||
]
|
|
||||||
title = "Correspondants"
|
|
||||||
xlsx = sco_excel.excel_simple_table(titles=titles, lines=L, sheet_name=title)
|
|
||||||
filename = title
|
|
||||||
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
|
||||||
else:
|
|
||||||
flash("Aucun correspondant dans la base.")
|
|
||||||
return redirect(url_for("entreprises.correspondants"))
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/import_correspondants/get_import_correspondants_file_sample")
|
|
||||||
@permission_required(Permission.RelationsEntreprisesExport)
|
|
||||||
def get_import_correspondants_file_sample():
|
|
||||||
"""
|
|
||||||
Permet de récupérer un fichier exemple vide pour pouvoir importer des correspondants
|
|
||||||
"""
|
|
||||||
titles = [
|
|
||||||
"civilite",
|
|
||||||
"nom",
|
|
||||||
"prenom",
|
|
||||||
"telephone",
|
|
||||||
"mail",
|
|
||||||
"poste",
|
|
||||||
"service",
|
|
||||||
"origine",
|
|
||||||
"notes",
|
|
||||||
"entreprise_siret",
|
|
||||||
]
|
|
||||||
title = "ImportCorrespondants"
|
|
||||||
xlsx = sco_excel.excel_simple_table(titles=titles, sheet_name="Correspondants")
|
|
||||||
filename = title
|
|
||||||
return scu.send_file(xlsx, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/import_correspondants", methods=["GET", "POST"])
|
|
||||||
@permission_required(Permission.RelationsEntreprisesExport)
|
|
||||||
def import_correspondants():
|
|
||||||
"""
|
|
||||||
Permet d'importer des correspondants a l'aide d'un fichier excel (.xlsx)
|
|
||||||
"""
|
|
||||||
form = ImportForm()
|
|
||||||
if form.validate_on_submit():
|
|
||||||
file = form.fichier.data
|
|
||||||
file_path = os.path.join(
|
|
||||||
Config.SCODOC_VAR_DIR, "tmp", secure_filename(file.filename)
|
|
||||||
)
|
|
||||||
file.save(file_path)
|
|
||||||
data = sco_excel.excel_file_to_list(file_path)
|
|
||||||
os.remove(file_path)
|
|
||||||
correspondants_import = []
|
|
||||||
correspondant_list = []
|
|
||||||
ligne = 0
|
|
||||||
titles = [
|
|
||||||
"civilite",
|
|
||||||
"nom",
|
|
||||||
"prenom",
|
|
||||||
"telephone",
|
|
||||||
"mail",
|
|
||||||
"poste",
|
|
||||||
"service",
|
|
||||||
"origine",
|
|
||||||
"notes",
|
|
||||||
"entreprise_siret",
|
|
||||||
]
|
|
||||||
if data[1][0] != titles:
|
|
||||||
flash("Veuillez utilisez la feuille excel à remplir")
|
|
||||||
return render_template(
|
|
||||||
"entreprises/import_correspondants.html",
|
|
||||||
title="Importation correspondants",
|
|
||||||
form=form,
|
|
||||||
)
|
|
||||||
for correspondant_data in data[1][1:]:
|
|
||||||
ligne += 1
|
|
||||||
if (
|
|
||||||
are.verif_correspondant_data(correspondant_data)
|
|
||||||
and (
|
|
||||||
correspondant_data[1].strip(),
|
|
||||||
correspondant_data[2].strip(),
|
|
||||||
correspondant_data[9].strip(),
|
|
||||||
)
|
|
||||||
not in correspondant_list
|
|
||||||
):
|
|
||||||
correspondant_list.append(
|
|
||||||
(
|
|
||||||
correspondant_data[1].strip(),
|
|
||||||
correspondant_data[2].strip(),
|
|
||||||
correspondant_data[9].strip(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
entreprise = Entreprise.query.filter_by(
|
|
||||||
siret=correspondant_data[9].strip()
|
|
||||||
).first()
|
|
||||||
correspondant = EntrepriseCorrespondant(
|
|
||||||
civilite=correspondant_data[0].strip(),
|
|
||||||
nom=correspondant_data[1].strip(),
|
|
||||||
prenom=correspondant_data[2].strip(),
|
|
||||||
telephone=correspondant_data[3].strip(),
|
|
||||||
mail=correspondant_data[4].strip(),
|
|
||||||
poste=correspondant_data[5].strip(),
|
|
||||||
service=correspondant_data[6].strip(),
|
|
||||||
origine=correspondant_data[7].strip(),
|
|
||||||
notes=correspondant_data[8].strip(),
|
|
||||||
entreprise_id=entreprise.id,
|
|
||||||
)
|
|
||||||
correspondants_import.append(correspondant)
|
|
||||||
else:
|
|
||||||
flash(f"Erreur lors de l'importation (ligne {ligne})")
|
|
||||||
return render_template(
|
|
||||||
"entreprises/import_correspondants.html",
|
|
||||||
title="Importation correspondants",
|
|
||||||
form=form,
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(correspondants_import) > 0:
|
|
||||||
for correspondant in correspondants_import:
|
|
||||||
db.session.add(correspondant)
|
|
||||||
log = EntrepriseLog(
|
|
||||||
authenticated_user=current_user.user_name,
|
|
||||||
text=f"Importation de {len(correspondants_import)} correspondant(s)",
|
|
||||||
)
|
|
||||||
db.session.add(log)
|
|
||||||
db.session.commit()
|
|
||||||
flash(
|
|
||||||
f"Importation réussie de {len(correspondants_import)} correspondant(s)"
|
|
||||||
)
|
|
||||||
return render_template(
|
|
||||||
"entreprises/import_correspondants.html",
|
|
||||||
title="Importation correspondants",
|
|
||||||
form=form,
|
|
||||||
correspondants_import=correspondants_import,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
flash('Feuille "Correspondants" vide')
|
|
||||||
return render_template(
|
|
||||||
"entreprises/import_correspondants.html",
|
|
||||||
title="Importation correspondants",
|
|
||||||
form=form,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/get_offre_file/<int:entreprise_id>/<int:offre_id>/<string:filedir>/<string:filename>"
|
"/get_offre_file/<int:entreprise_id>/<int:offre_id>/<string:filedir>/<string:filename>"
|
||||||
)
|
)
|
||||||
|
@ -22,15 +22,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="container boutons">
|
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
|
|
||||||
<a class="btn btn-default" href="{{ url_for('entreprises.import_correspondants') }}">Importer des correspondants</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) and correspondants %}
|
|
||||||
<a class="btn btn-default" href="{{ url_for('entreprises.export_correspondants') }}">Exporter la liste des correspondants</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container" style="margin-bottom: 10px;">
|
<div class="container" style="margin-bottom: 10px;">
|
||||||
<h1>Liste des correspondants</h1>
|
<h1>Liste des correspondants</h1>
|
||||||
<table id="table-correspondants">
|
<table id="table-correspondants">
|
||||||
|
@ -27,10 +27,10 @@
|
|||||||
<a class="btn btn-default" href="{{ url_for('entreprises.add_entreprise') }}">Ajouter une entreprise</a>
|
<a class="btn btn-default" href="{{ url_for('entreprises.add_entreprise') }}">Ajouter une entreprise</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
|
||||||
<a class="btn btn-default" href="{{ url_for('entreprises.import_entreprises') }}">Importer des entreprises</a>
|
<a class="btn btn-default" href="{{ url_for('entreprises.import_donnees') }}">Importer des données</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) and entreprises %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) and entreprises %}
|
||||||
<a class="btn btn-default" href="{{ url_for('entreprises.export_entreprises') }}">Exporter la liste des entreprises</a>
|
<a class="btn btn-default" href="{{ url_for('entreprises.export_donnees') }}">Exporter des données</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
{# -*- mode: jinja-html -*- #}
|
|
||||||
{% extends 'base.html' %}
|
|
||||||
{% import 'bootstrap/wtf.html' as wtf %}
|
|
||||||
|
|
||||||
{% block styles %}
|
|
||||||
{{super()}}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block app_content %}
|
|
||||||
<h1>Importation correspondants</h1>
|
|
||||||
<br>
|
|
||||||
<div>
|
|
||||||
<a href="{{ url_for('entreprises.get_import_correspondants_file_sample') }}">Obtenir la feuille excel à remplir</a>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<p>
|
|
||||||
(*) champs requis
|
|
||||||
</p>
|
|
||||||
{{ wtf.quick_form(form, novalidate=True) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if not correspondants_import %}
|
|
||||||
<table class="table">
|
|
||||||
<thead><tr><td><b>Attribut</b></td><td><b>Type</b></td><td><b>Description</b></td></tr></thead>
|
|
||||||
<tr><td>civilite</td><td>text</td><td>civilite du correspondant (H ou F)</td></tr>
|
|
||||||
<tr><td>nom</td><td>text</td><td>nom du correspondant</td></tr>
|
|
||||||
<tr><td>prenom</td><td>text</td><td>prenom du correspondant</td></tr>
|
|
||||||
<tr><td>telephone</td><td>text</td><td>telephone du correspondant</td></tr>
|
|
||||||
<tr><td>mail</td><td>text</td><td>mail du correspondant</td></tr>
|
|
||||||
<tr><td>poste</td><td>text</td><td>poste du correspondant</td></tr>
|
|
||||||
<tr><td>service</td><td>text</td><td>service dans lequel travaille le correspondant</td></tr>
|
|
||||||
<tr><td>origine</td><td>text</td><td>origine du correspondant</td></tr>
|
|
||||||
<tr><td>notes</td><td>text</td><td>notes sur le correspondant</td></tr>
|
|
||||||
<tr><td>entreprise_siret</td><td>text</td><td>SIRET de l'entreprise</td></tr>
|
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if correspondants_import %}
|
|
||||||
<br><div>Importation de {{ correspondants_import|length }} correspondant(s)</div>
|
|
||||||
{% for correspondant in correspondants_import %}
|
|
||||||
<div class="correspondant">
|
|
||||||
<div>
|
|
||||||
Civilité : {{ correspondant.civilite|get_civilité }}<br>
|
|
||||||
Nom : {{ correspondant.nom }}<br>
|
|
||||||
Prénom : {{ correspondant.prenom }}<br>
|
|
||||||
{% if correspondant.telephone %}
|
|
||||||
Téléphone : {{ correspondant.telephone }}<br>
|
|
||||||
{% endif %}
|
|
||||||
{% if correspondant.mail %}
|
|
||||||
Mail : {{ correspondant.mail }}<br>
|
|
||||||
{% endif %}
|
|
||||||
{% if correspondant.poste %}
|
|
||||||
Poste : {{ correspondant.poste }}<br>
|
|
||||||
{% endif %}
|
|
||||||
{% if correspondant.service %}
|
|
||||||
Service : {{ correspondant.service }}<br>
|
|
||||||
{% endif %}
|
|
||||||
{% if correspondant.origine %}
|
|
||||||
Origine : {{ correspondant.origine }}<br>
|
|
||||||
{% endif %}
|
|
||||||
{% if correspondant.notes %}
|
|
||||||
Notes : {{ correspondant.notes }}<br>
|
|
||||||
{% endif %}
|
|
||||||
<a href="{{ url_for('entreprises.fiche_entreprise', id=correspondant.entreprise_id )}}" target="_blank">lien vers l'entreprise</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
@ -10,7 +10,7 @@
|
|||||||
<h1>Importation entreprises</h1>
|
<h1>Importation entreprises</h1>
|
||||||
<br>
|
<br>
|
||||||
<div>
|
<div>
|
||||||
<a href="{{ url_for('entreprises.get_import_entreprises_file_sample') }}">Obtenir la feuille excel à remplir</a>
|
<a href="{{ url_for('entreprises.get_import_donnees_file_sample') }}">Obtenir la feuille excel à remplir</a>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -43,21 +43,20 @@
|
|||||||
<tr><td>code_postal</td><td>text</td><td>code postal du site</td></tr>
|
<tr><td>code_postal</td><td>text</td><td>code postal du site</td></tr>
|
||||||
<tr><td>pays</td><td>text</td><td>pays du site</td></tr>
|
<tr><td>pays</td><td>text</td><td>pays du site</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
<div>Feuille Correspondants</div>
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr><td><b>Attribut</b></td><td><b>Type</b></td><td><b>Description</b></td></tr></thead>
|
||||||
|
<tr><td>civilite</td><td>text</td><td>civilite du correspondant (H ou F)</td></tr>
|
||||||
|
<tr><td>nom</td><td>text</td><td>nom du correspondant</td></tr>
|
||||||
|
<tr><td>prenom</td><td>text</td><td>prenom du correspondant</td></tr>
|
||||||
|
<tr><td>telephone</td><td>text</td><td>telephone du correspondant</td></tr>
|
||||||
|
<tr><td>mail</td><td>text</td><td>mail du correspondant</td></tr>
|
||||||
|
<tr><td>poste</td><td>text</td><td>poste du correspondant</td></tr>
|
||||||
|
<tr><td>service</td><td>text</td><td>service dans lequel travaille le correspondant</td></tr>
|
||||||
|
<tr><td>origine</td><td>text</td><td>origine du correspondant</td></tr>
|
||||||
|
<tr><td>notes</td><td>text</td><td>notes sur le correspondant</td></tr>
|
||||||
|
<tr><td>nom_site</td><td>text</td><td>nom du site lié au correspondant</td></tr>
|
||||||
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if entreprises_import %}
|
|
||||||
<br><div>Importation de {{ entreprises_import|length }} entreprise(s)</div>
|
|
||||||
{% for entreprise in entreprises_import %}
|
|
||||||
<div class="entreprise">
|
|
||||||
<div>
|
|
||||||
SIRET : {{ entreprise.siret }}<br>
|
|
||||||
Nom : {{ entreprise.nom }}<br>
|
|
||||||
Adresse : {{ entreprise.adresse }}<br>
|
|
||||||
Code postal : {{ entreprise.codepostal }}<br>
|
|
||||||
Ville : {{ entreprise.ville }}<br>
|
|
||||||
Pays : {{ entreprise.pays }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user