<?xml version="1.0"?>
<data name="Purchase Order" inherit_id="portal.portal_sidebar" primary="True">
      <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
          <t t-set="o_portal_fullwidth_alert" groups="purchase.group_purchase_manager">
              <t t-call="portal.portal_back_in_edit_mode">
                  <t t-set="backend_url" t-value="'/odoo/action-purchase.purchase_rfq/%s' % (order.id)"/>
              </t>
          </t>

          <div class="row o_portal_purchase_sidebar">
              <!-- Sidebar -->
              <t t-call="portal.portal_record_sidebar">
                  <t t-set="classes" t-value="'col-lg-4 col-xxl-3 d-print-none'"/>

                  <t t-set="title">
                      <h2 t-field="order.amount_total" data-id="total_amount" class="mb-0 text-break"/>
                  </t>
                  <t t-set="entries">
                    <div t-if="not request.env.user._is_public() and order.state in ['sent']" class="flex-grow-1 d-flex gap-2">
                        <div class="btn-group flex-grow-1 mb-1">
                            <a t-if="not order.mail_reception_confirmed" t-att-href="order.get_confirm_url(confirm_type='reception')" target="_self" class="btn btn-secondary btn-block px-3" name="accept" title="Accept" style="background-color: #875A7B;">Accept</a>
                            <a t-else="" href="#" class="btn btn-secondary btn-block px-3 disabled" style="background-color: #875A7B;" tabindex="-1" aria-disabled="true" name="accept" title="Accept">Accept</a>
                        </div>
                        <div class="btn-group flex-grow-1 mb-1">
                            <a t-if="not order.mail_reception_declined" t-att-href="order.get_confirm_url(confirm_type='decline')" target="_self" class="btn btn-secondary btn-block px-3" name="decline" title="Decline">Decline</a>
                            <a t-else="" href="#" class="btn btn-secondary btn-block px-3 disabled" tabindex="-1" aria-disabled="true" name="decline" title="Decline">Decline</a>
                        </div>
                    </div>

                      <div class="d-flex flex-column gap-4 mt-3">
                        <a class="btn btn-secondary o_print_btn o_portal_invoice_print" t-att-href="order.get_portal_url(report_type='pdf')" id="print_invoice_report" title="View Details" role="button" target="_blank"><i class="fa fa-print me-1"/>Download / Print</a>
                          <div class="navspy flex-grow-1 ps-0" t-ignore="true" role="complementary">
                              <ul class="nav flex-column bs-sidenav"/>
                          </div>
                          <div t-if="order.user_id">
                              <h6 class="small text-muted">Buyer</h6>
                                <t t-call="portal.portal_my_contact">
                                    <t t-set="_contactAvatar" t-value="image_data_uri(order.user_id.avatar_128)"/>
                                    <t t-set="_contactName" t-value="order.user_id.name"/>
                                    <t t-set="_contactLink" t-value="True"/>
                                    <div t-field="order.user_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;phone&quot;], &quot;no_marker&quot;: False}"/>
                                </t>
                          </div>

                          <div>
                            <button id="portal_connect_software_modal_btn" type="button" class="btn btn-primary invisible" data-bs-toggle="modal" data-bs-target="#portal_connect_software_modal">
                                Connect with your software!
                            </button>
                          </div>
                      </div>
                  </t>
              </t>

              <div class="modal fade" id="portal_connect_software_modal" tabindex="-1" role="dialog" aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-body">
                            <div>
                                <h5>Want to import this document in Odoo?</h5>
                                <p>Drag and drop the request for quotation PDF file into your list of quotations in Odoo. Enjoy the automation!</p>
                            </div>
                            <div>
                                <h5>Not using Odoo?</h5>
                                <div class="input-group mb-3 w-50">
                                    <t t-set="base_address" t-value="order.env['ir.config_parameter'].sudo().get_param('web.base.url')"/>
                                    <t t-set="doc_url" t-value="base_address + '/my/purchase/' + str(order.id) + '/download_edi?' + str(keep_query())"/>
                                    <input type="text" class="form-control" aria-describedby="copy-button" readonly="readonly" t-att-value="doc_url"/>
                                    <button class="btn btn-outline-secondary" type="button" id="copy-button" t-attf-onclick="navigator.clipboard.writeText('#{doc_url}')">Copy</button>
                                </div>
                                <p>Use the above REST URL to get structured data of the purchase order in UBL format.
                                    <a href="https://www.odoo.com/documentation/">Read the documentation </a>to learn all the ways to connect your software with <a href="https://www.odoo.com">Odoo</a>.
                                </p>
                            </div>
                            <div>
                                <h5>You don't use a good CRM software?</h5>
                                <p><a href="https://www.odoo.com/app/sales">Start on Odoo</a>, it's 100% free! You'll save time creating beautiful quotations and track sales.</p>
                            </div>
                        </div>
                        <div class="modal-footer justify-content-between">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                        </div>
                    </div>
                </div>
              </div>

              <!-- Page content -->
              <div id="quote_content" class="o_portal_content col-12 col-lg-8 col-xxl-9">

                  <!-- status messages -->
                  <div t-if="order.state == 'cancel'" class="alert alert-danger alert-dismissable d-print-none" role="alert">
                      <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="close"/>
                      <strong>This purchase has been cancelled.</strong>
                  </div>
                  <div t-if="order.mail_reception_confirmed and order.state not in ['purchase', 'done']" class="alert alert-success alert-dismissible d-print-none" role="alert">
                      <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="close"/>
                      <strong>This quotation has been accepted.</strong>
                  </div>
                  <div t-if="order.mail_reception_declined and order.state not in ['purchase', 'done']" class="alert alert-warning alert-dismissible d-print-none" role="alert">
                      <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="close"/>
                      <strong>This quotation has been declined.</strong>
                  </div>

                  <!-- main content -->
                  <div id="portal_purchase_content">
                      <div t-call="purchase.purchase_order_portal_content"/>
                  </div>

                  <!-- chatter -->
                  <hr/>
                  <div id="purchase_order_communication">
                      <h3>Communication history</h3>
                      <t t-call="portal.message_thread"/>
                  </div>
              </div><!-- // #quote_content -->
          </div>
      </xpath>
  <xpath expr="." position="attributes"><attribute name="t-name">purchase.portal_my_purchase_order</attribute></xpath></data>

  