portal_emergency.xml 26.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    
    <template id="portal_my_maitenance_emergency" name="Mis Tickets">
        <t t-call="portal.portal_layout">
            <t t-set="breadcrumbs_searchbar" t-value="True" />
            
            <t t-call="portal.portal_searchbar">
                <t t-set="title">Emergencias</t>
                
            </t>
        
            <input type="hidden" name="mdl_shw" id="mdl_shw" t-att-value="created"/>

15
            <div id="createticketModalMaintenance" class="modal fade" role="dialog">
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
                <div class="modal-dialog">
                    <div class="modal-content" style="max-height:650px;">
                        <div class="modal-body">
                            <div class="row">
                                
                                <div class="col-sm-12 col-md-6 col-lg-6 border-right">
                                    <h4>Crear Ticket</h4>
                                    <form action="/portal-create-ticket-maintenance-emergency" method="POST" id="form_id" class="form-horizontal mt32" enctype="multipart/form-data">
                                        <input type="hidden" name="sh_file_size" id="sh_file_size" t-att-value="request.env.company.sh_file_size"/>
                                        <input type="hidden" name="tck_type" id="tck_type" value="emergencia_mantenimiento"/>
                                        <div class="form-group">

                                            <t t-if="request.env.user.has_group('base.group_portal') and request.env.user.sh_portal_user_access or not request.env.user.has_group('base.group_portal')">
                                                <label class="control-label" for="partner">Usuario:</label>
                                                <input class="form-control " list="partner_ids" name="partner" id="partner" />
                                                <input type="hidden" name="partner_id" id="partner_id" />
                                                <datalist id="partner_ids"> </datalist>
                                            </t>
                                        </div>
                                        
                                        <t t-if="request.env.user.has_group('base.group_portal') and not request.env.user.sh_portal_user_access">
                                            <div t-attf-class="form-group #{error and 'portal_contact_name' in error and 'has-error' or ''}">
                                                <label class="control-label" for="portal_contact_name">Nombre:</label>
                                                <input type="text" class="form-control" id="portal_contact_name" name="portal_contact_name" t-att-value="request.env.user.partner_id.name" readonly="True" />
                                            </div>
                                            <div name="portal_email_from_container" t-attf-class="form-group #{error and 'portal_email' in error and 'has-error' or ''}">
                                                <label class="control-label" for="portal_email">Correo:</label>
                                                <input type="email" class="form-control" id="portal_email" name="portal_email" t-att-value="request.env.user.partner_id.email" readonly="True" />
                                            </div>
                                        </t>

                                        <t t-else="">
                                            <div t-attf-class="form-group #{error and 'portal_contact_name' in error and 'has-error' or ''}">
                                                <label class="control-label" for="portal_contact_name">Nombre:</label>
                                                <input type="text" class="form-control" id="portal_contact_name" name="portal_contact_name" required="True" />
                                            </div>
                                            <div name="portal_email_from_container" t-attf-class="form-group #{error and 'portal_email' in error and 'has-error' or ''}">
                                                <label class="control-label" for="portal_email">Correo:</label>
                                                <input type="email" class="form-control" id="portal_email" name="portal_email" required="True" />
                                            </div>
                                        </t>

                                        <div t-attf-class="form-group s_website_form_required">
                                            <label class="control-label s_website_form_required" for="portal_phone">Teléfono:</label>
                                            <input type="text" class="form-control  form-field s_website_form_required" id="portal_phone" name="portal_phone" required="" />
                                        </div>
                                        
63 64


65 66 67
                                        <!--fecha de decteción de falla-->
                                        <div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_date_fail' in error and 'has-error' or ''}">
                                            <label class="control-label" for="portal_date_fail">¿Cuando detecto la falla?</label>
68
                                            <input type="text" class="form-control  form-field s_website_form_required" id="portal_date_fail" name="portal_date_fail" required="" />
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
                                        </div>
                                        
                                        <!--Descripción detallada de falla-->
                                        <div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_description' in error and 'has-error' or ''}">
                                            <label class="control-label" for="portal_description">Descripción</label>
                                            <textarea id="description" name="portal_description" class="form-control form-field o_website_form_required_custom" placeholder="Description" required=""/>
                                        </div>

                                        <!--Tipo de falla-->
                                        <div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_fail_type' in error and 'has-error' or ''}">
                                            <strong><span class="control-label" >Selecciona el tipo de falla:</span></strong><br/><br/>
                                            <input type="radio" class="mr5" name="portal_fail_type" id="portal_fail_type" value="fail">Falla</input>
                                            <input type="radio" class="mr5" name="portal_fail_type" id="portal_fail_type" value="warranty">Garantía</input>
                                        </div>

                                        <div name="portal_file_container" t-attf-class="form-group #{error and 'portal_file' in error and 'has-error' or ''}">
                                            <label class="control-label" for="portal_file">Evidencias:</label>
                                            <label class="custom-file">
                                                <input name="portal_file" id="portal_file" type="file" multiple="true" />
                                                <span class="custom-file-control" />
                                            </label>
                                        </div>
91
                                        
92 93 94 95 96 97 98 99
                                        <div class="row mb-2">
                                            <div class="col-12 text-center border-top ">
                                                <button type="submit" id="create_helpdesk_ticket" class="btn btn-primary mt-2 rounded">Crear Ticket</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                                <div class="col-sm-12 col-md-6 col-lg-6 o_center_object mt-2">
100
                                    <button type="button" class="btn btn-secondary rounded" data-dismiss="modal">Acceder</button>
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
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
                 
            <t t-if="not tickets">
                <p>No hay tickets relacionados.</p>
            </t>

            <t t-if="grouped_tickets" t-call="portal.portal_table">
                <t t-foreach="grouped_tickets" t-as="ticket">
                    <thead>
                        <tr t-attf-class="{{'thead-light' if not groupby == 'none' else ''}}">
                            <th t-if="groupby == 'create_by'">
                                <em class="font-weight-normal text-muted">Creado por:</em>
                                <span t-field="ticket[0].create_uid.name" />
                            </th>
                            <th t-if="groupby == 'ticket_type'">
                                <em class="font-weight-normal text-muted">Tipo de Ticket:</em>
                                <span t-field="ticket[0].ticket_type.name" />
                            </th>
                            <th t-if="groupby == 'status'">
                                <em class="font-weight-normal text-muted">Estado:</em>
                                <span t-esc="ticket[0].stage_id.name" />
                            </th>
                            
                            <th t-if="groupby == 'priority'">
                                <em class="font-weight-normal text-muted">Prioridad:</em>
                                <span t-esc="ticket[0].priority.name" />
                            </th>
                            <th t-if="groupby == 'state'">
                                <em class="font-weight-normal text-muted">Estatus de Respuesta:</em>
                                <span t-esc="ticket[0].state" />
                            </th>
137 138 139 140 141 142 143 144
                            <th t-if="groupby == 'maintenance_type'">
                                <em class="font-weight-normal text-muted">Tipo de mantenimiento:</em>
                                <span t-esc="ticket[0].maintenance_type_id.name" />
                            </th>
                            <th t-if="groupby == 'severity_type'">
                                <em class="font-weight-normal text-muted">Gravedad:</em>
                                <span t-esc="ticket[0].severity_type" />
                            </th>
145
                            <th>Fecha de creación</th>
146 147 148
                            <th>Tipo de mantenimiento</th>
                            <th>Gravedad</th>
                            <th>Tipo de falla</th>
149 150 151 152 153 154 155 156 157 158 159 160 161
                            <th>Estado</th>
                        </tr>
                    </thead>
                    <tbody>
                        <t t-foreach="ticket" t-as="t">
                            <tr>
                                <td>
                                    <a t-att-href="t.get_portal_url()" t-att-title="t.name">
                                        <t t-esc="t.name" t-if="t.name" />
                                        <em t-else="">Ticket</em>
                                    </a>
                                </td>
                                <td><span t-field="t.create_date" t-options='{"widget": "date"}' /></td>
162 163 164
                                <td><span t-field="t.maintenance_type_id"/></td>
                                <td><span t-field="t.severity_type" /></td>
                                <td><span t-field="t.fail_type" /></td>
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
                                <td><span t-field="t.stage_id" /></td>
                            </tr>
                        </t>
                    </tbody>
                </t>
            </t>
        </t>
    </template>

    <template id="portal_ticket_page_maintenance_emergency" name="Ticket Portal Template" inherit_id="portal.portal_sidebar" primary="True">
        <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
            <div class="row mt16 o_portal_ticket_sidebar">
                <!-- Sidebar -->
                <t t-call="portal.portal_record_sidebar">
                    <t t-set="classes" t-value="'col-12 col-lg flex-lg-grow-0 d-print-none'" />
                    <t t-set="title">
                        <h2 class="mb-0">
                            <b t-if="m_emergency" t-field="m_emergency.name" />
                            <b t-else="" >TICKET</b>
                        </h2>
                    </t>

                    <t t-set="entries">
                        <ul class="list-group list-group-flush flex-wrap flex-row flex-lg-column">
                            <li class="list-group-item flex-grow-1">
                                <div class="o_download_pdf btn-toolbar flex-sm-nowrap">
                                    <div class="btn-group flex-grow-1 mr-1 mb-1">
                                        <a class="btn btn-secondary btn-block o_download_btn" t-att-href="m_emergency.get_portal_url(report_type='pdf', download=True)" title="Download"><i class="fa fa-download" /> Descargar</a>
                                    </div>
                                </div>
                            </li>
                            <li t-if="m_emergency.user_id" class="list-group-item flex-grow-1">
                                <div class="small mb-1"><strong class="text-muted">Contacto:</strong></div>
                                <div class="row">
                                    <div class="col flex-grow-0 pr-2">
                                        <img t-if="m_emergency.user_id.image_128" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(maintenance.user_id.image_128)" alt="Contact" />
                                        <img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact" />
                                    </div>
                                    <div class="col pl-0" style="min-width: 150px;">
                                        <span t-field="m_emergency.user_id" t-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": True}' />
                                        <a href="#discussion" class="small"><i class="fa fa-comment"></i> Mandar Mensaje</a>
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </t>
                </t>

                <!-- Page Content -->
                <div id="ticket_content" class="col-12 col-lg justify-content-end">
                    <div t-attf-class="card #{'pb-5' if report_type == 'html' else ''}">
                        <div t-call="helpdesk_maintenance.helpdesk_ticket_portal_content_maintenance_emergency" />
                    </div>

                    <!-- chatter -->
                    <div id="ticket_communication" class="mt-4">
                        <h2>Historia</h2>
                        <t t-call="portal.message_thread">
                            <t t-set="object" t-value="m_emergency" />
                        </t>
                    </div>
                </div>
            </div>
        </xpath>
    </template>


    <template id="helpdesk_ticket_portal_content_maintenance_emergency" name="Helpdesk Ticket Portal Content">
        <!-- Intro -->

        <div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}">
            <h2 class="my-0">
                <strong><em t-esc="m_emergency.name" /></strong>
            </h2>
        </div>
        <div t-attf-class="#{'card-body' if report_type == 'html' else ''}">
            <div id="informations">
                <div class="row">
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Tipo de Ticket: </strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.ticket_type" />
                            </div>
                        </div>
                    </div>
                    <div class=" col-6">
                        <div class="row mb-3">
                            <div class="col-6">
                                <strong>Fecha de creación:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.create_date" />
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="row">
                    <div class=" col-6">
                        <div class="row mb-3">
                            <div class="col-6">
                                <strong>Última actualización:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.write_date" />
                            </div>
                        </div>
                    </div>
                    <div class="col-6">
                        <div class="row mb-3">
                            <div class="col-6">
                                <strong>Nombre:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.person_name" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Correo electrónico:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.email" />
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="row">
                    <div class="col-6">
                        <div class="row mb-3 ">
                            <div class="col-6">
                                <strong>Fecha de replica:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.replied_date" />
                            </div>
                        </div>
                    </div>
                    <div class="col-6">
                        <div class="row mb-3 ">
                            <div class="col-6">
                                <strong>Fecha de cierre</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.close_date" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-6">
                        <div class="row mb-3">
                            <div class="col-6">
                                <strong>Tipo de mantenimiento:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.maintenance_type_id.name"/>
                            </div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-6">
                                <strong>Tipo de gravedad</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.severity_type" />
                            </div>
                        </div>
                    </div>
                    <div class="col-6">
                        <div class="row mb-3">
                            <div class="col-6">
                                <strong>Fecha en que detecto la falla:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.date_fail" />
                            </div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-6">
                                <strong>Tipo de Falla:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.fail_type" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Prioridad:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.priority" />
                            </div>
                        </div>
                    </div>
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Cerrado por: </strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.close_by" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Fecha de cancelación:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.cancel_date" />
                            </div>
                        </div>
                    </div>
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Cancelado por:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.cancel_by" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Estado:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.stage_id" />
                            </div>
                        </div>
                    </div>
                    <div class="mb-3 col-6">
                        <div class="row">
                            <div class="col-6">
                                <strong>Razón de cancelación:</strong>
                            </div>
                            <div class="col-6">
                                <span t-field="m_emergency.cancel_reason" />
                            </div>
                        </div>
                    </div>
                </div>
                <t t-if="m_emergency.comment">
                    <div class="row">
                        <div class="mb-3 col-12">
                            <strong>Comentario de cierre:</strong>
                        </div>
                    </div>
                    <div class="row">
                        <div class="mb-3 col-12">
                            <span t-field="m_emergency.comment" />
                        </div>
                    </div>
                </t>
                <t t-if="m_emergency.description">
                    <div class="row">
                        <div class="mb-3 col-12">
                            <strong>Descripción:</strong>
                        </div>
                    </div>
                    <div class="row">
                        <div class="mb-3 col-12">
                            <span t-field="m_emergency.description" />
                        </div>
                    </div>
                </t>
                <t t-if="m_emergency.priority_new and m_emergency.customer_comment">
                    <div class="row">
                        <div class="mb-3 col-6">
                            <div class="row">
                                <div class="col-6">
                                    <strong>Calificación del cliente:</strong>
                                </div>
                                <div class="col-6">
                                    <span class="float-right" title="Rating" role="img" t-attf-aria-label="Rating: #{m_emergency.priority_new} on 3">
                                        <t t-foreach="range(2, 7)" t-as="i">
                                            <span t-attf-class="fa fa-lg fa-star#{'' if i &lt;= int(m_emergency.priority_new) else '-o'}" />
                                        </t>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="mb-3 col-6">
                            <div class="row">
                                <div class="col-6">
                                    <strong>Comentario del cliente:</strong>
                                </div>
                                <div class="col-6">
                                    <span t-field="m_emergency.customer_comment" />
                                </div>
                            </div>
                        </div>
                    </div>
                </t>
            </div>
        </div>
    </template>

</odoo>