aboutsummaryrefslogtreecommitdiffstats
path: root/jm2l/templates/Logistique/Dialog.mako
blob: ba2c8643a41ea7703adb655a4c976fafe2ac2dfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<%namespace name="dialogH" file="jm2l:templates/Logistique/Dialog_Heberg.mako"/>
<%namespace name="dialogC" file="jm2l:templates/Logistique/Dialog_Covoit.mako"/>
<%namespace name="dialogM" file="jm2l:templates/Logistique/Dialog_Matos.mako"/>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##                     Faire une Proposition
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="AddProposal(Type, form)"> \
<%
if Type=='H':
    CurTitle = u"un hébergement"
    CurIcon = "icon-home"
elif Type=='C':
    CurTitle = "un co-voiturage"
    CurIcon = "icon-road"
elif Type=='M':
    CurTitle = u"un prêt de matériel"
    CurIcon = "icon-shopping-cart"
%> \
    <!-- Modal -->
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="AddProp${Type}ModalLabel"> Je propose ${CurTitle} !</h3>
    </div>
    <div class="modal-body">
        %if 'exch_id' in form._fields.keys():
            <form id="ModalForm" action="javascript:DoPost('/2015/modal/Prop${Type}/${form.exch_id.data}');">
        %else:
            <form id="ModalForm" action="javascript:DoPost('/2015/modal/Prop${Type}/0');">         
        %endif
            <p>Je propose mes service pour ${CurTitle}</p>
            % if Type=='H':
                ${dialogH.Heberg_Proposal(form)}
            % elif Type=='C':
                ${dialogC.Covoit_Proposal(form)}
            % elif Type=='M':
                ${dialogM.Matos_Proposal(form)}
            % endif
        </form>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
        <button class="btn btn-primary" onclick="javascript:document.forms['ModalForm'].submit();">
        <i class="${CurIcon} icon-white"></i> Proposer !</button>
    </div>
</%def> \
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##                     Faire une Demande
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="AddAsk(Type, form)"> \
<%
if Type=='H':
    CurTitle = u"un hébergement"
    CurIcon = "icon-home"
elif Type=='C':
    CurTitle = "un co-voiturage"
    CurIcon = "icon-road"
elif Type=='M':
    CurTitle = u"un prêt de matériel"
    CurIcon = "icon-shopping-cart"
%>
    <!-- Modal -->
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="AddAsk${Type}ModalLabel"> Je demande ${CurTitle} !</h3>
    </div>
    <div class="modal-body"> 
    % if 'exch_id' in form._fields.keys():
        <form id="ModalForm" action="javascript:DoPost('/2015/modal/Ask${Type}/${form.exch_id.data}');">
    % else:
       <form id="ModalForm" action="javascript:DoPost('/2015/modal/Ask${Type}/0');">
    %endif       
            <p>Je demande ${CurTitle}</p>
            % if Type=='H':
                ${dialogH.Heberg_Ask(form)}
            % elif Type=='C':
                ${dialogC.Covoit_Ask(form)}
            % elif Type=='M':
                ${dialogM.Matos_Ask(form)}
            % endif
        </form>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
        <button class="btn btn-primary" onclick="javascript:document.forms['ModalForm'].submit();">
        <i class="${CurIcon} icon-white"></i> Demander !</button>
    </div>
</%def> \
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##                     Afficher les détails
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="Show(Type, Exch)"> \
<%
if Exch.exch_type=='H':
    CurTitle = u"de l'hébergement"
    CurIcon = "icon-home"
elif Exch.exch_type=='C':
    CurTitle = "du co-voiturage"
    CurIcon = "icon-road"
elif Exch.exch_type=='M':
    CurTitle = u"du prêt de matériel"
    CurIcon = "icon-shopping-cart"
%>
    <!-- Modal -->
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <i class="${CurIcon}"></i> <strong>Détails ${CurTitle}</strong>
    </div>
    <div class="modal-body">
        % if Type=='H':
            ${dialogH.ShowH(Exch)}
        % elif Type=='C':
            ${dialogC.ShowC(Exch)}
        % elif Type=='M':
            ${dialogM.ShowM(Exch)}
        % endif
        % if Exch.exch_state=='Ask':
            <form id="ModalForm" action="javascript:DoPost('/2015/exchange/Ask${Type}/${Exch.exch_id}/deal');"></form>
        % elif Exch.exch_state=='Proposal':
            <form id="ModalForm" action="javascript:DoPost('/2015/exchange/Prop${Type}/${Exch.exch_id}/deal');"></form>
        % endif        
    </div>
    <div class="modal-footer">
        % if not Exch.exch_done and (Exch.asker_id is None or Exch.provider_id is None):
            % if Exch.exch_state=='Proposal' and Exch.provider_id!=request.user.uid:
                <button class="btn btn-info" data-dismiss="modal" aria-hidden="true"
                    onclick="javascript:document.forms['ModalForm'].submit();">
                    % if Type=='H':
                        Je lui demande pour dormir chez lui/elle !
                    % elif Type=='C':
                        Je lui demande de venir me chercher !
                    % elif Type=='M':
                        Je lui demande de me prêter son matériel !
                    % endif
                </button>
            % elif Exch.exch_state=='Ask' and Exch.asker_id!=request.user.uid:
                <button class="btn btn-info" data-dismiss="modal" aria-hidden="true"
                    onclick="javascript:document.forms['ModalForm'].submit();">
                    % if Type=='H':
                        Je propose de l'héberger !
                    % elif Type=='C':
                        Je propose de venir le/la chercher !
                    % elif Type=='M':
                        Je lui propose mon matériel !
                    % endif
                </button>
            % endif
        % endif
        <button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
    </div>
</%def> \