ajout de planning.pt
This commit is contained in:
@@ -20,9 +20,9 @@ def execute_query(request, query, params):
|
||||
mark_changed(request.dbsession)
|
||||
transaction.commit()
|
||||
|
||||
def get_agendas(request):
|
||||
""" lire la liste des personnes ayant un agenda"""
|
||||
query = "SELECT * FROM p_users WHERE agenda <> 0 AND actif <> 0 ORDER BY nom;"
|
||||
def get_users_agenda(request):
|
||||
""" lire la liste des users ayant un agenda"""
|
||||
query = "SELECT * FROM p_users WHERE cd_uti <> 'N' and agenda <> 0 AND actif <> 0 ORDER BY nom;"
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
return results
|
||||
|
||||
@@ -77,18 +77,9 @@ def get_rendez_vous(request, itc):
|
||||
datedeb = d.strftime('%Y-%m-01')
|
||||
|
||||
# lire les rdv de l'ITC
|
||||
query = """
|
||||
(SELECT CONCAT(l.societe,"-OS-",l.no_id) as nodossier, l.rdv_debut, l.rdv_fin, e.c_nom FROM ordres_lig l
|
||||
INNER JOIN ordres e ON l.societe=e.societe AND l.no_id=e.no_id
|
||||
WHERE l.datevi >= :datedeb AND l.liste=:itc ORDER BY l.datevi, l.heurevi)
|
||||
UNION
|
||||
(SELECT CONCAT(l.societe,"-DD-",l.no_id) as nodossier, l.rdv_debut, l.rdv_fin, e.c_nom FROM dem_lig l
|
||||
query = """SELECT CONCAT(l.societe,"-DD-",l.no_id) as nodossier, l.rdv_debut, l.rdv_fin, e.c_nom FROM dem_lig l
|
||||
INNER JOIN dem_devis e ON l.societe=e.societe AND l.no_id=e.no_id
|
||||
WHERE l.datevi >= :datedeb AND l.liste=:itc ORDER BY l.datevi, l.heurevi)
|
||||
UNION
|
||||
(SELECT CONCAT(l.societe,"-RD-",l.no_id) as nodossier, l.rdv_debut, l.rdv_fin, e.c_nom FROM rdvous_lig l
|
||||
INNER JOIN rdvous e ON l.societe=e.societe AND l.no_id=e.no_id
|
||||
WHERE l.datevi >= :datedeb AND l.liste=:itc ORDER BY l.datevi, l.heurevi);
|
||||
WHERE l.datevi >= :datedeb AND l.liste=:itc ORDER BY l.datevi, l.heurevi
|
||||
"""
|
||||
results = request.dbsession.execute(query, {'datedeb': datedeb, 'itc': itc}).fetchall()
|
||||
return results
|
||||
|
||||
@@ -2,6 +2,7 @@ def includeme(config):
|
||||
config.add_static_view('static', 'static', cache_max_age=3600)
|
||||
config.add_route('home', '/')
|
||||
config.add_route('agenda', '/agenda')
|
||||
config.add_route('planning', '/planning')
|
||||
config.add_route('changer_mdp', '/changer_mdp')
|
||||
config.add_route('dossier_view', '/dossier_view/{nodossier}')
|
||||
config.add_route('rdv_edit','/rdv_edit/{nodossier}/{nolig}')
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p>
|
||||
<span class="label label-danger">RDV Peinture</span> <span class="label label-warning">RDV Menuiserie</span>
|
||||
<span class="label label-success">RDV Plomberiee</span> <span class="label label-info">RDV Polynet</span>
|
||||
<span class="label" style="background-color:LightYellow; color:black;">RDV Peinture</span>
|
||||
<span class="label" style="background-color:Gold; color:black;">RDV Menuiserie</span>
|
||||
<span class="label" style="background-color:LightGreen; color:black;">RDV Plomberie</span>
|
||||
<span class="label" style="background-color:LightBlue; color:black;">RDV Plomberie</span>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
@@ -43,6 +45,7 @@ $(document).ready(function() {
|
||||
right: 'today'
|
||||
},
|
||||
defaultView: 'agendaWeek',
|
||||
height: 'auto',
|
||||
minTime: "07:00:00",
|
||||
maxTime: "21:00:00",
|
||||
events:${fullcalendar_events},
|
||||
|
||||
@@ -8,23 +8,13 @@
|
||||
<a class="btn btn-primary" role="button" href="/">
|
||||
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
|
||||
</div>
|
||||
<form method="POST" id="frm">
|
||||
<div class="col-md-3" tal:condition="access >= 5">
|
||||
<select class="form-control" id="agenda" name="agenda" onChange="$('#frm').submit()">
|
||||
<div tal:repeat="item agendas">
|
||||
<option value="${item.CD_UTI}" tal:attributes="selected agenda==item.CD_UTI and 'selected' or None">${item.NOM}</option>
|
||||
</div>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3" tal:condition="access < 5">
|
||||
<input type="hidden" name="agenda" value="${agenda}"/>
|
||||
</div>
|
||||
</form>
|
||||
<div class="col-md-5">
|
||||
<p>
|
||||
<span class="label label-danger">RDV Peinture</span> <span class="label label-warning">RDV Menuiserie</span>
|
||||
<span class="label label-success">RDV Plomberiee</span> <span class="label label-info">RDV Polynet</span>
|
||||
</p>
|
||||
<p>
|
||||
<span class="label" style="background-color:LightYellow; color:black;">RDV Peinture</span>
|
||||
<span class="label" style="background-color:Gold; color:black;">RDV Menuiserie</span>
|
||||
<span class="label" style="background-color:LightGreen; color:black;">RDV Plomberie</span>
|
||||
<span class="label" style="background-color:LightBlue; color:black;">RDV Plomberie</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,15 +29,20 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#calendar').fullCalendar({
|
||||
locale: 'fr',
|
||||
header: {
|
||||
left: 'agendaDay agendaWeek month listMonth',
|
||||
center: 'prev title next',
|
||||
right: 'today'
|
||||
},
|
||||
defaultView: 'agendaWeek',
|
||||
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
|
||||
defaultView: 'timelineDay',
|
||||
minTime: "07:00:00",
|
||||
maxTime: "21:00:00",
|
||||
height: 'auto',
|
||||
locale: 'fr',
|
||||
header: {
|
||||
left: '',
|
||||
center: 'prev title next',
|
||||
right: 'timelineDay'
|
||||
},
|
||||
resourceAreaWidth: '20%',
|
||||
resourceLabelText: 'Intervenants',
|
||||
resources: ${fullcalendar_ressources},
|
||||
events:${fullcalendar_events},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
<span class="glyphicon glyphicon-calendar logo-small"></span><br />
|
||||
<h4>MON AGENDA</h4></a>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<a href="${request.application_url}/planning">
|
||||
<span class="glyphicon glyphicon-calendar logo-small"></span><br />
|
||||
<h4>PLANNING</h4></a>
|
||||
</div>
|
||||
</div> <!-- row 1 -->
|
||||
<br />
|
||||
<div class="row well" tal:condition="layout.isAdmin">
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
|
||||
<!-- Bootstrap core + Plug-ins CSS -->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.css" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar-scheduler/1.9.4/scheduler.min.css" rel="stylesheet">
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
|
||||
<link href="${request.static_url('mondumas:static/dist/datatable/dataTables.bootstrap.css')}" rel="stylesheet" media="all">
|
||||
<link href="${request.static_url('mondumas:static/dist/formvalidation/css/formValidation.min.css')}" rel="stylesheet">
|
||||
@@ -24,8 +25,9 @@
|
||||
<!-- Bootstrap Fullcalendar plugin -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/fr.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/locale/fr.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar-scheduler/1.9.4/scheduler.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/locale/fr.js"></script>
|
||||
<!-- Bootstrap Datepicker plugin -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<!-- Datatable -->
|
||||
|
||||
@@ -99,7 +99,7 @@ def agenda(request):
|
||||
logged_in = request.authenticated_userid
|
||||
|
||||
# liste des users avec agenda
|
||||
agendas = get_agendas(request)
|
||||
agendas = get_users_agenda(request)
|
||||
|
||||
# le user a-t-il un agenda ?
|
||||
agenda = 'JMD'
|
||||
@@ -117,35 +117,87 @@ def agenda(request):
|
||||
# construire la liste des events
|
||||
events = []
|
||||
for row in rows:
|
||||
event_url = 'dossier_view/%s' % (row.nodossier)
|
||||
event_title = row.c_nom
|
||||
|
||||
# déterminer la couleur de l'event selon la societe
|
||||
societe = row.nodossier[0:2]
|
||||
if societe == "PE":
|
||||
color = "#d9534f" # rouge danger
|
||||
color = "LightYellow"
|
||||
elif societe == "PL":
|
||||
color = "#5cb85c" # vert success
|
||||
color = "LightGreen"
|
||||
elif societe == "PO":
|
||||
color = "#5bc0de" # bleu info
|
||||
color = "LightBlue"
|
||||
else:
|
||||
color = "#f0ad4e" # orange warning
|
||||
color = "Gold"
|
||||
|
||||
json_event = {
|
||||
'title': event_title,
|
||||
'title': row.c_nom,
|
||||
'start': row.rdv_debut.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'end': row.rdv_fin.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'allDay': False,
|
||||
'color': color,
|
||||
'url': event_url,
|
||||
'textColor': 'Black',
|
||||
'url': 'dossier_view/%s' % (row.nodossier),
|
||||
}
|
||||
events.append(json_event)
|
||||
|
||||
|
||||
return {
|
||||
'page_title': 'Planning',
|
||||
'page_title': 'Agenda',
|
||||
'fullcalendar_events': json.dumps(events),
|
||||
'agendas': agendas,
|
||||
'agenda': agenda,
|
||||
}
|
||||
|
||||
@view_config(route_name='planning', renderer='../templates/agenda/planning.pt', permission='view')
|
||||
def planning(request):
|
||||
logged_in = request.authenticated_userid
|
||||
|
||||
# construire la liste des ressources
|
||||
# {"id":"a","title":"Auditorium A"}
|
||||
ressources = []
|
||||
# liste des users avec agenda
|
||||
users = get_users_agenda(request)
|
||||
for row in users:
|
||||
json_ressources = {
|
||||
'id': row.CD_UTI,
|
||||
'title': row.NOM
|
||||
}
|
||||
ressources.append(json_ressources)
|
||||
|
||||
# construire la liste des events
|
||||
events = []
|
||||
for user in users:
|
||||
rows = get_rendez_vous(request, user.CD_UTI)
|
||||
for row in rows:
|
||||
event_url = 'dossier_view/%s' % (row.nodossier)
|
||||
event_title = row.c_nom
|
||||
|
||||
# déterminer la couleur de l'event selon la societe
|
||||
societe = row.nodossier[0:2]
|
||||
if societe == "PE":
|
||||
color = "LightYellow"
|
||||
elif societe == "PL":
|
||||
color = "LightGreen"
|
||||
elif societe == "PO":
|
||||
color = "LightBlue"
|
||||
else:
|
||||
color = "Gold"
|
||||
|
||||
json_event = {
|
||||
'resourceId': user.CD_UTI,
|
||||
'title': event_title,
|
||||
'start': row.rdv_debut.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'end': row.rdv_fin.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'allDay': False,
|
||||
'color': color,
|
||||
'textColor': 'Black',
|
||||
'url': event_url,
|
||||
}
|
||||
events.append(json_event)
|
||||
|
||||
|
||||
return {
|
||||
'page_title': 'Planning',
|
||||
'fullcalendar_events': json.dumps(events),
|
||||
'fullcalendar_ressources': json.dumps(ressources),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user