demand_component_util.html
1 <#-- Get the demand_type from a given id demand type -->
2 <#function getDemandType demand_types_list id_demand_type>
3 <#if demand_types_list?? && demand_types_list?has_content>
4 <#list demand_types_list as demand_type>
5 <#if demand_type.idDemandType = id_demand_type>
6 <#return demand_type>
7 </#if>
8 </#list>
9 </#if>
10 </#function>
11 <#function getMessageStatus message>
12 <#if message.idStatus?has_content>
13 <#if message.idStatus=="1">
14 <#return "En cours">
15 <#elseif message.idStatus=="2">
16 <#return "Clos">
17 <#else>
18 <#return "En attente de précision">
19 </#if>
20 </#if>
21 <#--
22 1 - En cours
23 2 - Clos
24 3 - En attente de précision
25 -->
26 </#function>
27 <#macro tabDemands listDemand displayArchiveAction="true">
28 <#assign noDemand = false />
29 <table class="table table-hover">
30 <thead class="hidden-xs">
31 <tr>
32 <th> </th>
33 <th class="demande-label"></th>
34 <th class="hidden-xs text-center">
35 <span>#i18n{crm.crm.columnStatus}</span>
36 </th>
37 <th class="hidden-xs text-center">
38 <span>#i18n{crm.crm.columnActions}</span>
39 </th>
40 </tr>
41 </thead>
42 <tbody>
43 <#list demands_list as demandGru>
44 <#if demandGru.type=="crm_demand">
45 <#if getDemandType( demand_types_list, demandGru.demand.idDemandType )?has_content>
46 <#assign demand_type = getDemandType( demand_types_list, demandGru.demand.idDemandType )>
47 </#if>
48 <#if demand_type??>
49 <tr id="crm-demand-${demandGru.demand.idDemand}" data-id="${demandGru.demand.idDemand!}" class="crm-demand-head">
50 <td class="text-center">
51 <#if ( demandGru.demand.getNumberNotifications( ) > 0 )>
52 <a class="btn btn-link btn-default" href="jsp/site/Portal.jsp?page=crm&action=manage_notifications&id_demand=${demandGru.demand.idDemand}">
53 <i class="fa fa-envelope-o hidden" title="#i18n{crm.crm.labelMail}"></i>
54 <#if ( demandGru.demand.getNumberUnreadNotifications( ) > 0 )>
55 <i class="fa fa-circle" title="${demandGru.demand.numberUnreadNotifications}"></i>
56 </#if>
57 </a>
58 </#if>
59 </td>
60 <td class="demand-label">
61 <h6>${demandGru.demand.dateModification?date?string["dd.MM.yyyy HH:mm"]}</h6>
62 <#if ( demandGru.demand.getNumberUnreadNotifications( ) > 0 )>
63 <h4>${demand_type.label!}</h4>
64 <#else>
65 <h5>${demand_type.label!}</h5>
66 </#if>
67 <strong class="visible-xs">${demandGru.demand.statusText}</strong>
68 </td>
69 <td class="text-center hidden-xs"><strong>${demandGru.demand.statusText}</strong></td>
70 <td class="text-center hidden-xs">
71 <a class="btn btn-link btn-default" href="jsp/site/Portal.jsp?page=crm&action=remove_demand&id_demand=${demandGru.demand.idDemand}" title="#i18n{crm.crm.buttonDelete}">
72 <!-- <i class="fa fa-trash fa-2x"></i> -->
73 <img src="images/local/skin/trash.png" alt="Supprimer" title="Supprimer">
74 </a>
75 <a class="btn btn-link btn-default" href="jsp/site/plugins/crm/DoEditDemand.jsp?id_demand=${demandGru.demand.idDemand}" target="${demand_type.target}" title="#i18n{crm.crm.buttonModify}">
76 <!-- <i class="fa fa-archive fa-2x"></i> -->
77 <img src="images/local/skin/archive.png" alt="Supprimer" title="Supprimer">
78 </a>
79 </td>
80 </tr>
81 </#if>
82 <#else>
83 <#--MESSAGE PARIS CONNECT-->
84 <tr id="msg-${demandGru.demand.idParent!}" data-id="${demandGru.demand.idParent!}" class="message-head" >
85 <td class="text-center">
86 </td>
87 <td class="demand-label">
88 <h6>${demandGru.demand.dateModification?date?string["dd.MM.yyyy HH:mm"]}<h6>
89 <h5>${demandGru.demand.subject!}</h5>
90 <strong class="visible-xs"> </strong>
91 </td>
92 <td class="text-center hidden-xs"><strong>${getMessageStatus(demandGru.demand)}</strong></td>
93 <td class="text-center hidden-xs">
94 <a class="btn btn-link btn-default" href="#" title="#i18n{crm.crm.buttonDelete}">
95 <!-- <i class="fa fa-trash fa-2x"></i> -->
96 <img src="images/local/skin/trash.png" alt="Supprimer" title="Supprimer">
97 </a>
98 <a class="btn btn-link btn-default" href="#" target="" title="#i18n{crm.crm.buttonModify}">
99 <!-- <i class="fa fa-archive fa-2x"></i> -->
100 <img src="images/local/skin/archive.png" alt="Supprimer" title="Supprimer">
101 </a>
102 </td>
103 </tr>
104 </#if>
105 </#list>
106 </tbody>
107 </table>
108
109 </#macro>
110
111 <script>
112
113 $(document).ready(function() {
114
115 $(".crm-demand-head").click(function(e) {
116 var idDemand = $(this).data("id")
117 e.preventDefault();
118 if ($("#sub-crm-demand-" + idDemand).length > 0) {
119 $("#sub-crm-demand-" + idDemand).toggle();
120 } else {
121
122 baseUrl = document.getElementsByTagName('base')[0].href;
123 jQuery.ajax(baseUrl + 'jsp/site/Portal.jsp?page=demandMyAcount&view=view_notifications&id_demand=' + idDemand, {
124 type: "GET",
125 cache: false,
126 success: function(data, status, xhr) {
127
128 $("#crm-demand-" + idDemand).after(data);
129
130 },
131 error: function(jqxhr, textStatus, errorThrown) {
132 if (jqxhr.status == 401) {
133
134 }
135 },
136
137 });
138
139 }
140 });
141 $(".message-head").click(function(e) {
142 var idMessage = $(this).data("id")
143 e.preventDefault();
144 if ($("#sub-msg-" + idMessage).length > 0) {
145 $("#sub-msg-" + idMessage).toggle();
146 } else {
147
148 baseUrl = document.getElementsByTagName('base')[0].href;
149 jQuery.ajax(baseUrl + 'jsp/site/Portal.jsp?page=demandMyAcount&view=view_messages&id_message=' + idMessage, {
150 type: "GET",
151 cache: false,
152 success: function(data, status, xhr) {
153
154 $("#msg-" + idMessage).after(data);
155
156 },
157 error: function(jqxhr, textStatus, errorThrown) {
158 if (jqxhr.status == 401) {
159
160 }
161 },
162
163 });
164
165 }
166 });
167 });
168
169 /*
170 $( function() {
171 $(".navbar-nav > li").removeClass("active");
172 $(".navbar-nav > li#demarches").addClass("active");
173 });
174 */
175 </script>