<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <!-- 
    <template id="matrix" inherit_id="survey.question_matrix" name="SH Custom Matrix">
        <xpath expr="//td" position="replace">
            <t t-if="question.matrix_subtype == 'sh_custom_matrix'">
                <td
                    t-att-class="'o_survey_matrix_btn text-primary border-0 position-relative %s'
                        % ('o_survey_selected' if answer else '')"
                >
                    <t t-if="col_label.sh_value_type == 'textbox'">
                        <input type="text" class="form-control" t-att-name="'%s_%s' % (question.id, row_label.id)" t-att-data-row-id="row_label.id" t-att-data-col-id="col_label.id" t-att-value="answer.value_text_box if answer else None" />
                    </t>

                    <t t-if="col_label.sh_value_type == 'free_text'">
<textarea class="form-control sh_textarea" rows="3" t-att-name="'%s_%s' % (question.id, row_label.id)" t-att-data-row-id="row_label.id" t-att-data-col-id="col_label.id" t-att-value="answer.value_char_box if answer else None"><t t-esc="answer.value_char_box if answer else None"/></textarea>

                    </t>

                    <t t-if="col_label.sh_value_type == 'numerical_box'">
                        <input
                            type="number"
                            step="any"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_numerical_box if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'date'">
                        <input type="date" class="form-control" t-att-name="'%s_%s' % (question.id, row_label.id)" t-att-data-row-id="row_label.id" t-att-data-col-id="col_label.id" t-att-value="answer.value_date if answer else None" />
                    </t>

                    <t t-if="col_label.sh_value_type == 'datetime'">
                        <t t-set="sh_survey_matrix_adv_datetime_id" t-value="str(question.id) + str(row_label.id)" />
                        <div
                            class="input-group o_survey_form_date"
                            t-attf-id="datetimepicker_#{sh_survey_matrix_adv_datetime_id}"
                            data-target-input="nearest"
                            t-att-data-mindate="question.validation_min_datetime"
                            t-att-data-maxdate="question.validation_max_datetime"
                        >
                            <input
                                type="text"
                                class="form-control datetimepicker-input o_survey_question_datetime bg-transparent text-dark rounded-0 p-0"
                                t-attf-data-target="#datetimepicker_#{sh_survey_matrix_adv_datetime_id}"
                                t-att-name="'%s_%s' % (question.id, row_label.id)"
                                t-att-data-row-id="row_label.id"
                                t-att-data-col-id="col_label.id"
                                t-att-value="format_datetime(answer.value_datetime) if answer else None"
                                data-question-type="datetime"
                            />
                            <div t-if="not survey_form_readonly" class="input-group-append position-absolute" t-attf-data-target="#datetimepicker_#{sh_survey_matrix_adv_datetime_id}" data-toggle="datetimepicker">
                                <div class="input-group-text text-primary border-0 bg-transparent p-0"><i class="fa fa-calendar"></i></div>
                            </div>
                        </div>
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_color'">
                        <input
                            type="color"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_color if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_email'">
                        <input
                            type="email"
                            placeholder="example@domain.com"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_email if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_url'">
                        <input
                            type="url"
                            placeholder="https://example.com"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_url if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_time'">
                        <input
                            type="time"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_time if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_range'">
                        <t t-set="sh_survey_matrix_adv_range_id" t-value="str(row_label.id) + str(col_label.id)" />
                        <input
                            type="range"
                            t-attf-oninput="document.getElementById(#{sh_survey_matrix_adv_range_id}).innerHTML = this.value"
                            class="form-control o_survey_question_email_box bg-transparent text-dark rounded-0 p-0"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_range if answer else None"
                        />
                        <label t-attf-id="#{sh_survey_matrix_adv_range_id}" style='margin-top: 0.4rem;margin-bottom: 0;'>
                        	<span style='color:#212121;' t-esc="answer.value_ans_sh_range if answer else None"></span>  
                        </label>
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_week'">
                        <input
                            type="week"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_week if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_month'">
                        <input
                            type="month"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_month if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_password'">
                        <input
                            type="password"
                            class="form-control"
                            t-att-name="'%s_%s' % (question.id, row_label.id)"
                            t-att-data-row-id="row_label.id"
                            t-att-data-col-id="col_label.id"
                            t-att-value="answer.value_ans_sh_password if answer else None"
                        />
                    </t>

                    <t t-if="col_label.sh_value_type == 'que_sh_file'">
                        <t t-if="review">
                            <a t-att-href="'/survey/matrix/download/'+str(question.id)+'/'+str(row_label.id)+'/'+str(col_label.id)+'/'+str(answer.user_input_id.access_token)">Click here to download file</a>
                        </t>
                        <t t-else="">
                            <input type="file" class="form-control sh_file_input" />

                            <input
                                type="text"
                                class="form-control o_survey_question_email_box bg-transparent text-dark rounded-0 p-0 sh_file_input_data"
                                t-att-id="sh_survey_matrix_adv_file_id"
                                t-att-name="'%s_%s' % (question.id, row_label.id)"
                                t-att-data-row-id="row_label.id"
                                t-att-data-col-id="col_label.id"
                                t-att-data-question-type="question.question_type"
                                style="display: none;"
                            />
                        </t>
                    </t>
                </td>
            </t>
            <t t-else="">
                <td
                    t-att-class="'o_survey_matrix_btn text-primary border-0 position-relative %s'
                        % ('o_survey_selected' if answer else '')"
                >
                    <input
                        t-att-type="'checkbox' if question.matrix_subtype == 'multiple' else 'radio'"
                        t-att-name="'%s_%s' % (question.id, row_label.id)"
                        t-att-value="col_label.id"
                        t-att-checked="'checked' if answer else None"
                        t-att-data-col-id="col_label.id"
                        t-att-data-row-id="row_label.id"
                        t-att-data-selection-key="letters[item_idx] if useKeySelection else ''"
                        class="o_survey_form_choice_item d-none"
                    />

                    <i
                        t-att-class="'o_survey_matrix_empty_checkbox fa fa-%s position-relative'
                            % ('square-o' if question.matrix_subtype == 'multiple' else 'circle-thin')"
                    ></i>
                    <i
                        t-att-class="'fa fa-%s position-relative'
                            % ('check-square' if question.matrix_subtype == 'multiple' else 'check-circle')"
                    ></i>
                    <t t-call="survey.survey_selection_key">
                        <t t-set="selection_key_class" t-value="'position-absolute float-right font-weight-bold %s' % ('o_survey_radio_btn' if question.matrix_subtype != 'multiple' else '')" />
                    </t>
                    <t t-set="item_idx" t-value="item_idx + 1" />
                </td>
            </t>
        </xpath>
    </template>
     -->
</odoo>
