File: survey_templates_print.xml

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (149 lines) | stat: -rw-r--r-- 11,982 bytes parent folder | download
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
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
    <!-- Survey: printable page view (all pages) -->
    <template id="survey_page_print" name="Survey: print page">
        <t t-call="survey.layout">
            <t t-set="survey_form_readonly" t-value="true"/>
            <t t-if="answer.test_entry" t-call="survey.survey_button_form_view" />
            <div class="wrap">
                <div class="o_survey_print o_container_small">
                    <div class="pt-5 mt32">
                        <h1><span t-field='survey.title' class="text-break"/></h1>
                        <t t-if="survey.description"><div t-field='survey.description' class="oe_no_empty text-break"/></t>
                        <div class="d-flex gap-2">
                            <t t-if="review" t-call="survey.survey_button_retake"/>
                            <p><a role="button" title="Print Results" class="btn btn-secondary btn-lg d-print-none o_survey_user_results_print">
                                <i class="fa fa-print"/>
                            </a></p>
                        </div>
                    </div>
                    <div t-if="graph_data" class="o_survey_result px-4">
                        <div class="survey_graph mb-4"
                                data-graph-type="doughnut"
                                t-att-data-graph-data="graph_data">
                            <canvas id="doughnut_chart" class="w-100 h-auto mx-auto"></canvas>
                        </div>
                        <div t-if="survey.page_ids" class="survey_graph d-none d-md-block"
                                data-graph-type="by_section"
                                t-att-data-graph-data="graph_data">
                            <canvas id="by_section_chart" class="w-100 h-auto mx-auto"></canvas>
                        </div>
                    </div>
                    <div class="mt-5">
                        <fieldset disabled="disabled">
                            <t t-set="question" t-value="False" />
                            <t t-foreach='survey.question_and_page_ids' t-as='question'>
                                <t t-if="question.is_page and
                                            (any(q in questions_to_display for q in question.question_ids)
                                            or not is_html_empty(question.description))">
                                    <hr t-if="question != survey.page_ids[0]" class="my-5"/>
                                    <div class="o_page_header mb-5">
                                        <h1 t-field='question.title' class="text-break fs-2" />
                                        <div t-if="question.description" t-field='question.description' class="oe_no_empty"/>
                                    </div>
                                </t>
                                <t t-if="not question.is_page and not answer or (question in answer.predefined_question_ids &amp; questions_to_display)" >
                                    <t t-set="answer_lines" t-value="answer.user_input_line_ids.filtered(lambda line: line.question_id == question)"/>
                                    <div class="js_question-wrapper" t-att-id="question.id">
                                        <h2 class="fs-4">
                                            <span t-field='question.title' class="text-break"/>
                                            <span t-if="question.constr_mandatory" class="text-danger">*</span>
                                            <span t-if="scoring_display_correction" class="badge rounded-pill" t-att-data-score-question="question.id"></span>
                                        </h2>
                                        <div class="text-muted oe_no_empty mt-1 text-break" t-if="not is_html_empty(question.description)" t-field='question.description'/>
                                        <t t-if="question.question_type in ['numerical_box', 'date', 'datetime', 'text_box', 'char_box']">
                                            <t t-if="answer_lines">
                                                <t t-set="answer_line" t-value="answer_lines[0]"/>
                                                <t t-if="answer_line.skipped">
                                                    <!-- question was skipped, display an orange block with the text "Skipped" in place of the answer -->
                                                    <div class="row g-0">
                                                        <div class="col-12 col-md-6 col-lg-4 rounded ps-4 o_survey_question_skipped">
                                                            <input type="text"
                                                                t-attf-class="form-control fst-italic o_survey_question_{{question.question_type}} bg-transparent rounded-0 p-0" value="Skipped"/>
                                                        </div>
                                                    </div>
                                                </t>
                                                <t t-elif="answer_line.survey_id.scoring_type != 'no_scoring' and question.question_type in ['numerical_box', 'date', 'datetime'] and question['answer_%s' % question.question_type]">
                                                    <div class="row g-0">
                                                        <div t-attf-class="col-12 col-md-6 col-lg-4 rounded ps-4 #{'bg-success' if answer_line.answer_is_correct else 'bg-danger'}">
                                                            <t t-if="question.question_type == 'numerical_box'" t-call="survey.question_numerical_box"/>
                                                            <t t-if="question.question_type == 'date'" t-call="survey.question_date"/>
                                                            <t t-if="question.question_type == 'datetime'" t-call="survey.question_datetime"/>
                                                        </div>
                                                    </div>
                                                </t>
                                                <t t-else="">
                                                    <t t-if="question.question_type == 'text_box'" t-call="survey.question_text_box"/>
                                                    <t t-if="question.question_type == 'char_box'" class="o_survey_print o_survey_comment_container p-0">
                                                        <span t-out="answer_lines[0].value_char_box or None"/>
                                                    </t>
                                                    <t t-if="question.question_type == 'numerical_box'" t-call="survey.question_numerical_box"/>
                                                    <t t-if="question.question_type == 'date'" t-call="survey.question_date"/>
                                                    <t t-if="question.question_type == 'datetime'" t-call="survey.question_datetime"/>
                                                </t>
                                                <t t-if="answer_lines.survey_id.scoring_type != 'no_scoring'
                                                    and question.question_type in ['numerical_box', 'date', 'datetime']
                                                    and question['answer_%s' % question.question_type]
                                                    and not answer_line.answer_is_correct">
                                                    <div class="row g-0">
                                                        <t t-set="correct_answer" t-value="question['answer_%s' % question.question_type ]"/>
                                                        <div class="col-12 text-success mt-1">
                                                            The correct answer was:
                                                            <strong t-esc="correct_answer" t-if="question.question_type == 'numerical_box'"/>
                                                            <strong t-esc="format_date(correct_answer)" t-if="question.question_type == 'date'"/>
                                                            <strong t-esc="format_datetime(correct_answer)" t-if="question.question_type == 'datetime'"/>
                                                        </div>
                                                    </div>
                                                </t>
                                            </t>
                                            <t t-else="">
                                                <t t-if="question.question_type == 'text_box'" t-call="survey.question_text_box"/>
                                                <t t-if="question.question_type == 'char_box'" t-call="survey.question_char_box"/>
                                                <t t-if="question.question_type == 'numerical_box'" t-call="survey.question_numerical_box"/>
                                                <t t-if="question.question_type == 'date'" t-call="survey.question_date"/>
                                                <t t-if="question.question_type == 'datetime'" t-call="survey.question_datetime"/>
                                            </t>
                                        </t>
                                        <t t-if="question.question_type == 'simple_choice'" t-call="survey.question_simple_choice"/>
                                        <t t-if="question.question_type == 'scale'" t-call="survey.question_scale"/>
                                        <t t-if="question.question_type == 'multiple_choice'" t-call="survey.question_multiple_choice"/>
                                        <t t-if="question.question_type == 'matrix'" t-call="survey.question_matrix"/>
                                        <t t-if="question.question_type in ['simple_choice', 'multiple_choice', 'matrix', 'scale']">
                                            <t t-if="answer_lines">
                                                <t t-if="answer_lines[0].skipped">
                                                    <div class="row g-0">
                                                        <div class="col-12 o_survey_choice_question_skipped mt-1">
                                                            This question was skipped
                                                        </div>
                                                    </div>
                                                </t>
                                            </t>
                                        </t>
                                        <div class="o_survey_question_error overflow-hidden border-0 py-0 px-3 alert alert-danger" role="alert"></div>
                                    </div>
                                </t>
                            </t>
                            <!--Set question to false to avoid background miss match as last question is still in context and is used in survey.layout t-call.-->
                            <t t-set="question" t-value="False"/>
                        </fieldset>
                    </div>
                </div>
            </div>
        </t>
    </template>

    <!-- simple template with no assets, to show title on the certification preview -->
    <template id="certification_preview">
        <html>
            <head>
                <title t-esc="'%s Preview' % page_title"/>
                <link rel="shortcut icon" href="/web/static/img/favicon.ico" type="image/x-icon"/>
            </head>
            <body style="margin:0;">
                <iframe type="application/pdf" t-att-src="preview_url" frameBorder="0" width="100%" height="100%"/>
            </body>
        </html>
    </template>
</data>
</odoo>