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