forked from ScoDoc/ScoDoc
parent
cf74708f83
commit
483c86d904
@ -833,7 +833,7 @@ def tab_absences_html(groups_infos, etat=None):
|
||||
"<li>",
|
||||
form_choix_jour_saisie_hebdo(groups_infos),
|
||||
"</li>",
|
||||
f"""<li><a href="{
|
||||
f"""<li><a class="stdlink" href="{
|
||||
url_for("assiduites.visu_assi_group", scodoc_dept=g.scodoc_dept, group_ids=group_ids, date_debut=formsemestre.date_debut.isoformat(), date_fin=formsemestre.date_fin.isoformat())
|
||||
}">État des assiduités du groupe</a></li>""",
|
||||
"</ul>",
|
||||
@ -890,76 +890,38 @@ def form_choix_jour_saisie_hebdo(groups_infos, moduleimpl_id=None):
|
||||
authuser = current_user
|
||||
if not authuser.has_permission(Permission.ScoAbsChange):
|
||||
return ""
|
||||
sem = groups_infos.formsemestre
|
||||
first_monday = sco_cal.ddmmyyyy(sem["date_debut"]).prev_monday()
|
||||
today_idx = datetime.date.today().weekday()
|
||||
|
||||
FA = [] # formulaire avec menu saisi absences
|
||||
FA.append(
|
||||
# TODO-ASSIDUITE et utiliser url_for... (was Absences/SignaleAbsenceGrSemestre)
|
||||
'<form id="form_choix_jour_saisie_hebdo" action="XXX" method="get">'
|
||||
)
|
||||
FA.append('<input type="hidden" name="datefin" value="%(date_fin)s"/>' % sem)
|
||||
FA.append(groups_infos.get_form_elem())
|
||||
if moduleimpl_id:
|
||||
FA.append(
|
||||
'<input type="hidden" name="moduleimpl_id" value="%s"/>' % moduleimpl_id
|
||||
)
|
||||
FA.append('<input type="hidden" name="destination" value=""/>')
|
||||
|
||||
FA.append(
|
||||
"""<input type="button" onclick="$('#form_choix_jour_saisie_hebdo')[0].destination.value=get_current_url(); $('#form_choix_jour_saisie_hebdo').submit();" value="Saisir absences du (NON DISPONIBLE) "/>"""
|
||||
)
|
||||
FA.append("""<select name="datedebut">""")
|
||||
date = first_monday
|
||||
i = 0
|
||||
for jour in sco_cal.day_names():
|
||||
if i == today_idx:
|
||||
sel = "selected"
|
||||
else:
|
||||
sel = ""
|
||||
i += 1
|
||||
FA.append('<option value="%s" %s>%s</option>' % (date, sel, jour))
|
||||
date = date.next_day()
|
||||
FA.append("</select>")
|
||||
FA.append("</form>")
|
||||
return "\n".join(FA)
|
||||
return f"""
|
||||
<button onclick="window.location='{
|
||||
url_for(
|
||||
"assiduites.signal_assiduites_group",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
group_ids=",".join(map(str,groups_infos.group_ids)),
|
||||
jour=datetime.date.today().isoformat(),
|
||||
formsemestre_id=groups_infos.formsemestre_id,
|
||||
moduleimpl_id="" if moduleimpl_id is None else moduleimpl_id
|
||||
)
|
||||
}';">Saisie du jour</button>
|
||||
"""
|
||||
|
||||
|
||||
# Ajout Le Havre
|
||||
# Formulaire saisie absences semaine
|
||||
# Saisie de l'assiduité par semaine
|
||||
def form_choix_saisie_semaine(groups_infos):
|
||||
authuser = current_user
|
||||
if not authuser.has_permission(Permission.ScoAbsChange):
|
||||
return ""
|
||||
# construit l'URL "destination"
|
||||
# (a laquelle on revient apres saisie absences)
|
||||
query_args = parse_qs(request.query_string)
|
||||
moduleimpl_id = query_args.get("moduleimpl_id", [""])[0]
|
||||
if "head_message" in query_args:
|
||||
del query_args["head_message"]
|
||||
destination = "%s?%s" % (
|
||||
request.base_url,
|
||||
urllib.parse.urlencode(query_args, True),
|
||||
)
|
||||
destination = destination.replace(
|
||||
"%", "%%"
|
||||
) # car ici utilisee dans un format string !
|
||||
|
||||
DateJour = time.strftime("%d/%m/%Y")
|
||||
datelundi = sco_cal.ddmmyyyy(DateJour).prev_monday()
|
||||
FA = [] # formulaire avec menu saisie hebdo des absences
|
||||
# XXX TODO-ASSIDUITE et utiliser un POST
|
||||
FA.append('<form action="Absences/SignaleAbsenceGrHebdo" method="get">')
|
||||
FA.append('<input type="hidden" name="datelundi" value="%s"/>' % datelundi)
|
||||
FA.append('<input type="hidden" name="moduleimpl_id" value="%s"/>' % moduleimpl_id)
|
||||
FA.append('<input type="hidden" name="destination" value="%s"/>' % destination)
|
||||
FA.append(groups_infos.get_form_elem())
|
||||
FA.append(
|
||||
'<input type="submit" class="button" value="Saisie à la semaine (NON DISPONIBLE)" />'
|
||||
) # XXX
|
||||
FA.append("</form>")
|
||||
return "\n".join(FA)
|
||||
moduleimpl_id = query_args.get("moduleimpl_id", [None])[0]
|
||||
semaine = datetime.date.today().isocalendar().week
|
||||
return f"""
|
||||
<button onclick="window.location='{url_for(
|
||||
"assiduites.signal_assiduites_diff",
|
||||
group_ids=",".join(map(str,groups_infos.group_ids)),
|
||||
semaine=semaine,
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=groups_infos.formsemestre_id,
|
||||
moduleimpl_id=moduleimpl_id
|
||||
)}';">Saisie à la semaine</button>
|
||||
"""
|
||||
|
||||
|
||||
def export_groups_as_moodle_csv(formsemestre_id=None):
|
||||
|
@ -331,6 +331,21 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
}&formsemestre_id={formsemestre.id}
|
||||
&moduleimpl_id={moduleimpl_id}
|
||||
"
|
||||
>Saisie Absences journée</a></span>
|
||||
"""
|
||||
)
|
||||
|
||||
H.append(
|
||||
f"""
|
||||
<span class="moduleimpl_abs_link"><a class="stdlink" href="{
|
||||
url_for(
|
||||
"assiduites.signal_assiduites_group",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
group_ids=group_id,
|
||||
jour=datetime.date.today().isoformat(),
|
||||
formsemestre_id=formsemestre.id,
|
||||
moduleimpl_id="" if moduleimpl_id is None else moduleimpl_id
|
||||
)}"
|
||||
>Saisie Absences hebdo</a></span>
|
||||
"""
|
||||
)
|
||||
|
@ -1002,7 +1002,9 @@ def signal_assiduites_diff():
|
||||
"assiduites/pages/signal_assiduites_diff.j2",
|
||||
diff=_differee(
|
||||
etudiants=etudiants,
|
||||
moduleimpl_select=_module_selector(formsemestre),
|
||||
moduleimpl_select=_module_selector(
|
||||
formsemestre, request.args.get("moduleimpl_id", None)
|
||||
),
|
||||
date=date,
|
||||
periode={
|
||||
"deb": formsemestre.date_debut.isoformat(),
|
||||
@ -1162,6 +1164,11 @@ def _module_selector(
|
||||
)
|
||||
modules.append({"moduleimpl_id": modimpl["moduleimpl_id"], "name": modname})
|
||||
|
||||
try:
|
||||
moduleimpl_id = int(moduleimpl_id)
|
||||
except (ValueError, TypeError):
|
||||
moduleimpl_id = None
|
||||
|
||||
return render_template(
|
||||
"assiduites/widgets/moduleimpl_selector.j2",
|
||||
selected=selected,
|
||||
|
Loading…
Reference in New Issue
Block a user