Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6523 | Rev 6552 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
5050 efrain 1
<?php
6521 efrain 2
use LeadersLinked\Model\ContentReaction;
3
 
6388 efrain 4
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
5
$currentUser    = $this->currentUserHelper();
6
$roleName       = $currentUser->getUserTypeId();
5050 efrain 7
 
6388 efrain 8
$routeQuestions     = $this->url('my-coach/questions');
9
$routeQuestionAdd   = $this->url('my-coach/questions/add');
10
$allowQuestionAdd   = $acl->isAllowed($roleName, 'my-coach/questions/add') ? 1 : 0;
5050 efrain 11
 
6388 efrain 12
 
13
 
14
 
15
$this->inlineScript()->appendFile($this->basePath('vendors/ckeditor/ckeditor.js'));
16
 
17
$this->headLink()->appendStylesheet($this->basePath('vendors/nprogress/nprogress.css'));
18
$this->inlineScript()->appendFile($this->basePath('vendors/nprogress/nprogress.js'));
19
 
20
$this->headLink()->appendStylesheet($this->basePath('vendors/select2/css/select2.min.css'));
21
$this->headLink()->appendStylesheet($this->basePath('vendors/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
22
$this->inlineScript()->appendFile($this->basePath('vendors/select2/js/select2.min.js'));
23
 
24
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
25
$this->inlineScript()->appendFile($this->basePath('vendors/jsrender/jsrender.min.js'));
26
 
27
 
28
$this->inlineScript()->appendFile($this->basePath('vendors/jquery-validation/jquery.validate.js'));
29
$this->inlineScript()->appendFile($this->basePath('vendors/jquery-validation/additional-methods.js'));
30
$this->inlineScript()->appendFile($this->basePath('vendors/jquery-validation/localization/messages_es.js'));
31
 
6521 efrain 32
$this->headLink()->appendStylesheet($this->basePath('css/my-coach.css'));
6388 efrain 33
 
34
 
35
$this->inlineScript()->captureStart();
36
echo <<<JS
37
 
38
jQuery( document ).ready(function( $ ) {
39
 
6547 efrain 40
    $.fn.confirmationAnswers = function() {
6521 efrain 41
 
6547 efrain 42
        $('button.btn-my-coach-delete-answer').confirmation({
43
            rootSelector: 'button.btn-my-coach-delete-answer',
44
            title : 'LABEL_ARE_YOU_SURE',
45
            singleton : true,
46
            btnOkLabel: 'LABEL_YES',
47
            btnCancelLabel: 'LABEL_NO',
48
            onConfirm: function(value) {
49
                var action = $(this).data('link');
50
                var question = $(this).data('question');
51
                var answer = $(this).data('answer');
52
 
53
 
54
                NProgress.start();
55
                $.ajax({
56
                    'dataType'  : 'json',
57
                    'accept'    : 'application/json',
58
                    'method'    : 'post',
59
                    'url'       :  action,
60
                }).done(function(response) {
61
                    if(response['success']) {
62
 
63
                        $('#row-' + answer).remove();
64
 
65
                        $('#answers-' + question).html(response['data']['total_answers']);
66
                        $('#my-coach-question-answer-count-answers').html(response['data']['total_answers']);
67
 
68
                        $('#reactions-' + question).html( response['data']['total_reactions']);
69
                        $('#my-coach-question-answer-count-reactions').html( response['data']['total_reactions']);
70
 
71
                        $('#comments-' + question).html(response['data']['total_comments']);
72
                        $('#my-coach-question-answer-count-comments').html(response['data']['total_comments']);
73
 
74
                    } else {
75
                        $.fn.showError(response['data']);
76
                    }
77
                }).fail(function( jqXHR, textStatus, errorThrown) {
78
                    $.fn.showError(textStatus);
79
                }).always(function() {
80
                    NProgress.done();
81
                });
82
 
83
                return false;
84
            },
85
        });
86
    }
87
 
88
 
6521 efrain 89
    $.fn.reloadAnswers = function() {
90
 
91
        var action = $('#row-view').data('link-answers');
92
 
6388 efrain 93
        NProgress.start();
94
        $.ajax({
95
            'dataType'  : 'json',
96
            'accept'    : 'application/json',
97
            'method'    : 'get',
6521 efrain 98
            'url'       : action,
99
        }).done(function(response) {
100
            if(response['success']) {
101
                $('#my-coach-question-answers-list').empty();
102
                if(response['data']['items'].length > 0) {
103
                    $( "#my-coach-question-answers-list" ).html(
104
                		$( "#answerTemplate" ).render( response['data']['items'] )
105
                	);
6523 efrain 106
                }
6547 efrain 107
                $.fn.confirmationAnswers();
6521 efrain 108
 
6547 efrain 109
 
6521 efrain 110
 
111
            } else {
112
                $.fn.showError(response['data']);
113
            }
114
        }).fail(function( jqXHR, textStatus, errorThrown) {
115
            $.fn.showError(textStatus);
116
        }).always(function() {
117
            NProgress.done();
118
        });
119
 
120
    }
121
 
122
    $.fn.reload = function() {
123
 
124
        NProgress.start();
125
        $.ajax({
126
            'dataType'  : 'json',
127
            'accept'    : 'application/json',
128
            'method'    : 'get',
6388 efrain 129
            'url'       :  '$routeQuestions',
130
            'data'      : {
131
                'search' : $('#form-filter #search').val(),
132
                'category_id' : $('li.my-coach-category-li-selected > a.my-coach-category-a').data('uuid') ,
133
 
134
            }
135
        }).done(function(response) {
136
            if(response['success']) {
137
                $('#my-coach-record-list').empty();
138
 
139
 
140
                if(response['data']['items'].length > 0) {
141
 
142
 
143
 
144
                    $( "#my-coach-record-list" ).html(
145
                		$( "#recordTemplate" ).render( response['data']['items'] )
146
                	);
147
                } else {
148
                    var html = '<div class="company-title"><div class="widget widget-jobs"><div class="sd-title">ERROR_NO_RECORD_MATCHED_YOUR_QUERY</div></div></div>';
149
                    $( "#my-coach-record-list" ).html(html);
150
                }
151
 
152
 
6521 efrain 153
                $('button.btn-my-coach-delete-question').confirmation({
154
                    rootSelector: 'button.btn-my-coach-delete-question',
6388 efrain 155
                    title : 'LABEL_ARE_YOU_SURE',
156
                    singleton : true,
157
                    btnOkLabel: 'LABEL_YES',
158
                    btnCancelLabel: 'LABEL_NO',
159
                    onConfirm: function(value) {
160
                        var action = $(this).data('link');
161
                        NProgress.start();
162
                        $.ajax({
163
                            'dataType'  : 'json',
164
                            'accept'    : 'application/json',
165
                            'method'    : 'post',
166
                            'url'       :  action,
167
                        }).done(function(response) {
168
                            if(response['success']) {
169
                                $.fn.showSuccess(response['data']);
170
 
171
                                $.fn.reload();
172
                            } else {
173
                                $.fn.showError(response['data']);
174
                            }
175
                        }).fail(function( jqXHR, textStatus, errorThrown) {
176
                            $.fn.showError(textStatus);
177
                        }).always(function() {
178
                            NProgress.done();
179
                        });
180
 
181
                        return false;
182
                    },
183
                });
184
 
185
            } else {
186
                $.fn.showError(response['data']);
187
            }
188
        }).fail(function( jqXHR, textStatus, errorThrown) {
189
            $.fn.showError(textStatus);
190
        }).always(function() {
191
            NProgress.done();
192
        });
193
 
194
    }
195
 
196
 
197
    $.validator.setDefaults({
198
        debug: true,
199
        highlight: function(element) {
200
            $(element).addClass('is-invalid');
201
        },
202
        unhighlight: function(element) {
203
            $(element).removeClass('is-invalid');
204
        },
205
        errorElement: 'span',
206
        errorClass: 'error invalid-feedback',
207
        errorPlacement: function(error, element) {
208
            if(element.parent('.btn-file').length) {
209
                error.insertAfter(element.parent().parent());
210
            } else if(element.parent('.toggle').length) {
211
                error.insertAfter(element.parent().parent());
212
            } else {
213
                error.insertAfter(element.parent());
214
            }
215
        }
216
    });
217
 
218
 
219
    $.fn.showFormErrorValidator = function(fieldname, errors) {
220
        var field = $(fieldname);
221
        if(field) {
222
            $(field).addClass('is-invalid');
223
 
224
 
225
            var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
226
            if(element.parent('.btn-file').length) {
227
                error.insertAfter(element.parent().parent());
228
            } else if(element.parent('.toggle').length) {
229
                error.insertAfter(element.parent().parent());
230
            } else {
231
                error.insertAfter(element.parent());
232
            }
233
        }
234
    };
235
 
236
    var validatorQuestion = $('#form-question').validate({
237
        debug: true,
238
        onclick: false,
239
        onkeyup: false,
240
        ignore: [],
241
        rules: {
242
            'category_id': {
243
                required: true,
244
            },
245
            'title': {
246
                required: true,
247
                maxlength: 128,
248
            },
249
            'description': {
250
                updateCkeditor:function() {
251
                        CKEDITOR.instances.description_question.updateElement();
252
                },
253
 
254
                required: true
255
            },
256
 
257
        },
258
        submitHandler: function(form)
259
        {
260
 
261
 
262
			NProgress.start();
263
            $.ajax({
264
                'dataType'  : 'json',
265
                'accept'    : 'application/json',
266
                'method'    : 'post',
267
                'url'       :  $('#form-question').attr('action'),
268
                'data'      :  $('#form-question').serialize(),
269
 
270
            }).done(function(response) {
271
 
272
				if(response['success']) {
273
 
274
                    $('#modal-question').modal('hide');
275
 
276
                    $.fn.showSuccess(response['data']);
277
                    $.fn.reload();
278
 
279
 
280
 
281
                } else {
282
                    validatorQuestion.resetForm();
283
                    if(jQuery.type(response['data']) == 'string') {
284
                        $.fn.showError(response['data']);
285
                    } else  {
286
                        $.each(response['data'], function( fieldname, errors ) {
287
                            $.fn.showFormErrorValidator('#form-question #' + fieldname, errors);
288
                        });
289
                    }
290
                }
291
            }).fail(function( jqXHR, textStatus, errorThrown) {
292
                $.fn.showError(textStatus);
293
            }).always(function() {
294
                NProgress.done();
295
            });
296
            return false;
297
        },
298
        invalidHandler: function(form, validator) {
299
 
300
        }
301
    });
302
 
6547 efrain 303
    var  validatorAnswer = $('#form-answer').validate({
6521 efrain 304
        debug: true,
305
        onclick: false,
306
        onkeyup: false,
307
        ignore: [],
308
        rules: {
309
            'description': {
310
                updateCkeditor:function() {
311
                        CKEDITOR.instances.description_answer.updateElement();
312
                },
313
 
314
                required: true
315
            },
316
 
317
        },
318
        submitHandler: function(form)
319
        {
6547 efrain 320
 
6388 efrain 321
 
6521 efrain 322
			NProgress.start();
323
            $.ajax({
324
                'dataType'  : 'json',
325
                'accept'    : 'application/json',
326
                'method'    : 'post',
327
                'url'       :  $('#form-answer').attr('action'),
328
                'data'      :  $('#form-answer').serialize(),
329
 
330
            }).done(function(response) {
331
				if(response['success']) {
6547 efrain 332
                    var method = $('#form-answer').data('method');
333
                    var answer = $('#form-answer').data('answer');
334
 
335
 
6521 efrain 336
                    $('#modal-answer').modal('hide');
337
 
6547 efrain 338
                    if(method == 'add') {
339
                        var uuid = $('#row-view').data('question-uuid');
340
                        $('#answers-' + uuid).html(response['data']['answers']);
341
                        $('#my-coach-question-answer-count-answers').html(response['data']['answers']);
342
                        $('#my-coach-question-answers-list').prepend(
343
                            $('#answerTemplate').render(response['data']['item'])
344
                        );
345
                        $.fn.confirmationAnswers()
346
                    } else {
347
                        $('#answer-text-' + answer).empty();
348
                        $('#answer-text-' + answer).html(response['data']['description']);
349
 
350
                    }
6521 efrain 351
                } else {
352
                    validatorAnswer.resetForm();
353
                    if(jQuery.type(response['data']) == 'string') {
354
                        $.fn.showError(response['data']);
355
                    } else  {
356
                        $.each(response['data'], function( fieldname, errors ) {
357
                            $.fn.showFormErrorValidator('#form-answer #' + fieldname, errors);
358
                        });
359
                    }
360
                }
361
            }).fail(function( jqXHR, textStatus, errorThrown) {
362
                $.fn.showError(textStatus);
363
            }).always(function() {
364
                NProgress.done();
365
            });
366
            return false;
367
        },
368
        invalidHandler: function(form, validator) {
369
 
370
        }
371
    });
372
 
373
 
6388 efrain 374
    $('a.my-coach-category-a').click(function(e) {
375
        e.preventDefault();
376
 
377
 
378
        $('li.my-coach-category-li').removeClass('my-coach-category-li-selected');
379
        $(this).closest('li.my-coach-category-li').addClass('my-coach-category-li-selected');
380
 
381
        $.fn.reload();
382
    });
383
 
384
    $('body').on('click', 'button.btn-my-coach-edit', function(e) {
385
        e.preventDefault();
386
        var action = $(this).data('link');
387
        NProgress.start();
388
        $.ajax({
389
            'dataType'  : 'json',
390
            'accept'    : 'application/json',
391
            'method'    : 'get',
392
            'url'       :  action,
393
        }).done(function(response) {
394
            if(response['success']) {
395
 
396
                $('#form-question').attr('action', action);
397
                $('#form-question #category_id').val(response['data']['category_id']).trigger('change');
398
                $('#form-question #title').val(response['data']['title']);
399
                CKEDITOR.instances.description_question.setData(response['data']['description']);
400
 
401
                $('#modal-question').modal('show');
402
            } else {
403
                $.fn.showError(response['data']);
404
            }
405
        }).fail(function( jqXHR, textStatus, errorThrown) {
406
            $.fn.showError(textStatus);
407
        }).always(function() {
408
            NProgress.done();
409
        });
410
 
411
    });
412
 
413
 
414
    $('#form-filter #search').keyup(function(e) {
415
 
416
        e.preventDefault();
417
 
418
        $.fn.reload();
419
    })
420
 
421
    $('button.btn-search').click(function(e) {
422
        e.preventDefault();
423
 
424
        $.fn.reload();
425
    });
426
 
427
    $('#my-coach-add-question').click(function(e) {
428
        e.preventDefault();
429
 
430
        $('#form-question').attr('action', '$routeQuestionAdd');
431
        $('#form-question #title').val('');
432
        $('#form-question #category_id').val('').trigger('change');
433
        CKEDITOR.instances.description_question.setData('');
434
 
435
        $('#modal-question').modal('show');
436
    });
437
 
438
    $('#form-question #category_id').select2({
439
        theme: 'bootstrap4'
440
    })
441
 
442
    $('button.btn-cancel').click(function(e) {
443
        e.preventDefault();
444
 
445
 
446
        $('#modal-question').modal('hide');
6521 efrain 447
        $('#modal-answer').modal('hide');
6388 efrain 448
    });
449
 
6521 efrain 450
 
451
 
452
 
453
    $('#my-coach-question-answer-btn-delete').confirmation({
454
        rootSelector: 'button.my-coach-question-answer-btn-delete',
455
        title : 'LABEL_ARE_YOU_SURE',
456
        singleton : true,
457
        btnOkLabel: 'LABEL_YES',
458
        btnCancelLabel: 'LABEL_NO',
459
        onConfirm: function(value) {
460
            var action = $(this).data('link');
461
            var uuid = $(this).data('question-uuid');
462
 
463
            NProgress.start();
464
            $.ajax({
465
                'dataType'  : 'json',
466
                'accept'    : 'application/json',
467
                'method'    : 'post',
468
                'url'       :  action,
469
            }).done(function(response) {
470
                if(response['success']) {
471
                    $.fn.showSuccess(response['data']);
472
 
473
                    var uuid = $('#row-view').data('question-uuid');
474
                    var key = 'my-coach-record-card-question-' + uuid;
475
                    $('#' + key).remove();
476
 
477
                    $('#row-view').hide();
478
 
479
                    $('#my-coach-add-question').show();
480
                    $('#row-list').show();
481
 
482
 
483
 
484
                } else {
485
                    $.fn.showError(response['data']);
486
                }
487
            }).fail(function( jqXHR, textStatus, errorThrown) {
488
                $.fn.showError(textStatus);
489
            }).always(function() {
490
                NProgress.done();
491
            });
492
 
493
            return false;
494
        },
495
    });
496
 
497
 
498
    $('body').on('click', 'button.btn-my-coach-edit-view', function(e) {
499
        e.preventDefault();
500
        var action = $(this).data('link');
501
 
502
        NProgress.start();
503
        $.ajax({
504
            'dataType'  : 'json',
505
            'accept'    : 'application/json',
506
            'method'    : 'get',
507
            'url'       :  action,
508
        }).done(function(response) {
509
            if(response['success']) {
510
                $('#row-view').data('link-answers', response['data']['link_answers']);
511
                $('#row-view').data('question-uuid', response['data']['uuid']);
512
 
513
 
6547 efrain 514
                if(!response['data']['link_answers_add']) {
515
                    $('#my-coach-question-answer-btn-answer').hide();
516
                } else {
517
                    $('#my-coach-question-answer-btn-answer').data('link', response['data']['link_answers_add']);
518
                    $('#my-coach-question-answer-btn-answer').show();
519
                }
6521 efrain 520
 
6547 efrain 521
                if(!response['data']['link_delete']) {
522
                    $('#my-coach-question-answer-btn-delete').hide();
523
                } else {
524
                    $('#my-coach-question-answer-btn-delete').data('link', response['data']['link_delete']);
525
                    $('#my-coach-question-answer-btn-delete').show();
526
                }
6521 efrain 527
 
528
                $('#my-coach-question-user-image').attr('src', response['data']['user_image']);
529
                $('#my-coach-question-user-name').html(response['data']['user_name']);
530
                $('#my-coach-question-title').html(response['data']['title']);
531
                $('#my-coach-question-description').html(response['data']['description']);
532
 
533
                $('#my-coach-answer-categories').empty();
534
                $.each(response['data']['categories'], function(key, value) {
535
 
536
                    var li = $('<li>');
537
                    li.text(value.category).appendTo('#my-coach-answer-categories')
538
                });
539
 
540
                $('#my-coach-question-answer-question-date').html(response['data']['added_on']);
541
                $('#my-coach-question-answer-last-date').html(response['data']['last_answer_on']);
542
                $('#my-coach-question-answer-count-answers').html(response['data']['answers']);
543
                $('#my-coach-question-answer-count-reactions').html(response['data']['reactions']);
544
                $('#my-coach-question-answer-count-views').html(response['data']['views']);
545
                $('#my-coach-question-answer-count-comments').html(response['data']['comments']);
546
 
547
                $('#views-' + response['data']['uuid']).html( response['data']['views'] );
548
 
549
 
550
                $('#my-coach-add-question').hide();
551
                $('#row-list').hide();
552
                $('#row-view').show();
553
 
554
                $.fn.reloadAnswers();
555
 
556
            } else {
557
                $.fn.showError(response['data']);
558
            }
559
        }).fail(function( jqXHR, textStatus, errorThrown) {
560
            $.fn.showError(textStatus);
561
        }).always(function() {
562
            NProgress.done();
563
        });
564
    });
565
 
566
    $('#my-coach-question-answer-btn-back').click(function(e) {
567
        e.preventDefault();
568
 
569
        $('#my-coach-add-question').show();
570
        $('#row-view').hide();
571
        $('#row-list').show();
572
 
573
    });
574
 
6547 efrain 575
    /****** RESPUESTAS ******/
6521 efrain 576
 
6547 efrain 577
    $('body').on('click', 'button.btn-my-coach-edit-answer', function(e) {
578
        e.preventDefault();
579
        var action = $(this).data('link');
580
        var answer = $(this).data('answer');
581
        NProgress.start();
582
        $.ajax({
583
            'dataType'  : 'json',
584
            'accept'    : 'application/json',
585
            'method'    : 'get',
586
            'url'       :  action,
587
        }).done(function(response) {
588
            if(response['success']) {
589
 
590
                $('#modal-answer-title').html('LABEL_MY_COACH_ANSWER_EDIT');
591
                $('#form-answer').attr('action', action );
592
                $('#form-answer').data('method','edit');
593
                $('#form-answer').data('answer', answer);
594
                CKEDITOR.instances.description_answer.setData(response['data']['description']);
595
                validatorAnswer.resetForm();
596
 
597
                $('#modal-answer').modal('show');
598
            } else {
599
                $.fn.showError(response['data']);
600
            }
601
        }).fail(function( jqXHR, textStatus, errorThrown) {
602
            $.fn.showError(textStatus);
603
        }).always(function() {
604
            NProgress.done();
605
        });
606
 
607
    });
608
 
609
 
6521 efrain 610
    $('#my-coach-question-answer-btn-answer').click(function(e) {
611
        e.preventDefault();
6547 efrain 612
        console.log('agregar respuesta link = ' + $(this).data('link') );
6521 efrain 613
 
6547 efrain 614
        $('#modal-answer-title').html('LABEL_MY_COACH_ANSWER_ADD');
6521 efrain 615
        $('#form-answer').attr('action', $(this).data('link') );
6547 efrain 616
        $('#form-answer').data('method','add');
617
        $('#form-answer').data('answer', '');
6521 efrain 618
        CKEDITOR.instances.description_answer.setData('');
6547 efrain 619
        validatorAnswer.resetForm();
6521 efrain 620
 
621
        $('#modal-answer').modal('show');
622
    });
623
 
624
    $('body').on('click', 'a.btn-comment-trash', function(e) {
625
        e.preventDefault();
626
        var action = $(this).data('link');
627
        var unique = $(this).data('comment-unique');
628
        var answer_uuid = $(this).data('answer-uuid');
629
        var question_uuid = $('#row-view').data('question-uuid');
630
 
631
 
632
 
633
        NProgress.start();
634
        $.ajax({
635
            'dataType'  : 'json',
636
            'accept'    : 'application/json',
637
            'method'    : 'post',
638
            'url'       :  action,
639
        }).done(function(response) {
640
            if(response['success']) {
641
                $('div.comment-' + unique).remove();
642
 
643
                //Listado de la respuesta
644
                $('#answer-total-comment-' + answer_uuid).html( response['data']['total_comments_answer'] );
645
 
646
                //Encabezado pregunta del view
647
                $('#my-coach-question-answer-count-comments').html( response['data']['total_comments_question'] );
648
 
649
                //Listado de preguntas
650
                $('#comments-' + question_uuid).html( response['data']['total_comments_question'] );
651
 
652
 
653
            } else {
654
                $.fn.showError(response['data']);
655
            }
656
        }).fail(function( jqXHR, textStatus, errorThrown) {
657
            $.fn.showError(textStatus);
658
        }).always(function() {
659
            NProgress.done();
660
        });
661
 
662
    });
663
 
664
    $('body').on('submit', 'form.feedCommentContainer', function(e) {
665
        e.preventDefault();
666
 
667
        var action          = $(this).attr('action');
668
        var answer_uuid     = $(this).data('answer');
669
        var question_uuid   = $('#row-view').data('question-uuid');
670
        var form_id         = $(this).attr('id');
671
 
672
        var comment = $('#' + form_id + ' #comment').val().trim();
673
        if(comment.length == 0) {
674
            return;
675
        }
676
 
677
        NProgress.start();
678
        $.ajax({
679
            'dataType'  : 'json',
680
            'accept'    : 'application/json',
681
            'method'    : 'post',
682
            'url'       : action,
683
            'data'      : $(this).serialize()
684
 
685
        }).done(function(response) {
686
		  if(response['success']) {
687
            $('#' + form_id + ' #comment').val('');
688
            $('#comment-list-' + answer_uuid).prepend(
689
                $( "#commentTemplate" ).render( response['data']['item'] )
690
            );
691
 
692
            //Listado de la respuesta
693
            $('#answer-total-comment-' + answer_uuid).html( response['data']['total_comments_answer'] );
694
 
695
            //Encabezado pregunta del view
696
            $('#my-coach-question-answer-count-comments').html( response['data']['total_comments_question'] );
697
 
698
            //Listado de preguntas
699
            $('#comments-' + question_uuid).html( response['data']['total_comments_question'] );
700
 
701
          } else {
702
            $.fn.showError(textStatus);
703
          }
704
 
705
        }).fail(function( jqXHR, textStatus, errorThrown) {
706
            $.fn.showError(textStatus);
707
        }).always(function() {
708
            NProgress.done();
709
        });
710
        return false;
711
 
712
    });
713
 
714
  $('body').on('click', 'button.btn-save-reaction', function(e) {
715
        e.preventDefault();
716
        var reaction = $(this).data('reaction');
717
        var action = $(this).data('link');
718
        var answer_uuid = $(this).data('answer');
719
        var question_uuid   = $('#row-view').data('question-uuid');
720
 
721
        NProgress.start();
722
        $.ajax({
723
            'dataType'  : 'json',
724
            'accept'    : 'application/json',
725
            'method'    : 'post',
726
            'url'       :  action,
727
            'data'      : {
728
                'reaction' : reaction
729
            }
730
        }).done(function(response) {
731
            if(response['success']) {
732
 
733
                $('#reactions-' + question_uuid).html(response['data']['total_reactions_question']) ;
734
                $('#my-coach-question-answer-count-reactions').html(response['data']['total_reactions_question']) ;
735
                $('#answer-total-reactions-' + answer_uuid).html(response['data']['total_reactions_answer']) ;
736
 
737
                $('#' + 'current-reaction-' + answer_uuid).data('reaction', response['data']['reaction']);
738
                $('#' + 'current-reaction-' + answer_uuid).html(
739
                    $('#reactionTemplate').render({reaction: reaction})
740
                );
741
            } else {
742
                $.fn.showError(response['data']);
743
            }
744
        }).fail(function( jqXHR, textStatus, errorThrown) {
745
            $.fn.showError(textStatus);
746
        }).always(function() {
747
            NProgress.done();
748
        });
749
 
750
    });
751
 
752
    $('body').on('click', 'button.reaction-btn', function(e) {
753
        e.preventDefault();
754
        var reaction = $(this).data('reaction');
755
 
756
        if(!reaction) return
757
        var action = $(this).data('link');
758
 
759
        var answer_uuid = $(this).data('answer');
760
        var question_uuid   = $('#row-view').data('question-uuid');
761
 
762
        NProgress.start();
763
        $.ajax({
764
            'dataType'  : 'json',
765
            'accept'    : 'application/json',
766
            'method'    : 'post',
767
            'url'       :  action,
768
        }).done(function(response) {
769
            if(response['success']) {
770
                $('#' + 'current-reaction-' + answer_uuid).data('reaction', response['data']['reaction']);
771
                $('#' + 'current-reaction-' + answer_uuid).html(
772
                    $('#reactionTemplate').render({reaction: ''})
773
                );
774
 
775
                $('#reactions-' + question_uuid).html(response['data']['total_reactions_question']) ;
776
                $('#my-coach-question-answer-count-reactions').html(response['data']['total_reactions_question']) ;
777
                $('#answer-total-reactions-' + answer_uuid).html(response['data']['total_reactions_answer']) ;
778
 
779
            } else {
780
                $.fn.showError(response['data']);
781
            }
782
        }).fail(function( jqXHR, textStatus, errorThrown) {
783
            $.fn.showError(textStatus);
784
        }).always(function() {
785
            NProgress.done();
786
        });
787
    });
788
 
789
    let isMouseHover;
790
 
791
    $('body').on('mouseover', '#reaction-container', function(e) {
792
        isMouseHover = true;
793
        setTimeout(() => {
794
            $('.reactions').addClass('active');
795
        }, 500);
796
    });
797
 
798
    $('body').on('mouseout', '#reaction-container', function(e) {
799
        isMouseHover = false;
800
        setTimeout(() => {
801
            if(!isMouseHover) {
802
                $('.reactions').removeClass('active');
803
            }
804
        }, 500);
805
    });
806
 
807
    $('#paginator-process-comm').click(function(e) {
808
        e.preventDefault();
809
 
810
        var next_page = $(this).data('next-page');
811
        $.fn.reload(false, next_page);
812
 
813
    });
814
 
815
 
6388 efrain 816
    $.fn.reload()
817
 
818
 
819
    CKEDITOR.replace('description_question',{
820
        toolbar: [
821
                    { name: 'editing', items: ['Scayt'] },
822
                    { name: 'links', items: ['Link', 'Unlink'] },
823
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
824
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
825
                    '/',
826
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
827
                    { name: 'styles', items: ['Styles', 'Format'] },
828
                    { name: 'tools', items: ['Maximize'] }
829
                ],
830
                removePlugins: 'elementspath,Anchor',
831
                heigth: 100
832
    });
6521 efrain 833
 
834
 
835
    CKEDITOR.replace('description_answer',{
836
        toolbar: [
837
                    { name: 'editing', items: ['Scayt'] },
838
                    { name: 'links', items: ['Link', 'Unlink'] },
839
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
840
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
841
                    '/',
842
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
843
                    { name: 'styles', items: ['Styles', 'Format'] },
844
                    { name: 'tools', items: ['Maximize'] }
845
                ],
846
                removePlugins: 'elementspath,Anchor',
847
                heigth: 100
848
    });
6388 efrain 849
});
5050 efrain 850
JS;
6388 efrain 851
 
852
$this->inlineScript()->captureEnd();
853
$this->headLink()->appendStylesheet('/look-and-field/my-coach.css');
5050 efrain 854
?>
855
 
6521 efrain 856
<section class="container px-0">
6388 efrain 857
    <div class="company-title">
858
        <h1 class="title mx-auto">LABEL_MY_COACH</h1>
859
        <?php if($allowQuestionAdd) : ?>
860
            <h2 class="title cursor-pointer" id="my-coach-add-question">
861
                LABEL_MY_COACH_QUESTION_ADD
862
            </h2>
863
       <?php endif; ?>
5050 efrain 864
 
6388 efrain 865
    </div>
5050 efrain 866
 
6388 efrain 867
    <div class="row gap-3" id="row-list">
6521 efrain 868
		<div class="my-coach-category-list col-12 col-md-3">
6388 efrain 869
            <ul>
870
                <li class="my-coach-category-li my-coach-category-li-selected">
871
                    <a class="my-coach-category-a" href="" data-uuid="">LABEL_MY_COACH_CATEGORY_ALL</a>
872
                </li>
873
                <?php
6521 efrain 874
                foreach ($categories as $uuid => $name) :
6388 efrain 875
                ?>
876
                    <li class="my-coach-category-li">
6521 efrain 877
                        <a class="my-coach-category-a" href="" data-uuid="<?php echo $uuid ?>"><?php echo $name ?></a>
6388 efrain 878
                    </li>
879
 
880
                <?php endforeach; ?>
881
            </ul>
882
        </div>
883
 
884
 
885
        <div class="col px-0">
886
            <div class="search-box">
887
                <form id="form-filter" name="form-filter">
888
                    <input type="text" name="search" id="search" class="form-control"><button class="btn btn-search">LABEL_SEARCH</button>
889
                </form>
890
            </div>
891
 
892
            <div id="my-coach-record-list" class="my-coach-record-list mt-3">
893
            </div>
894
 
895
            <div id="my-coach-pagination">
896
            </div>
897
 
898
        </div>
899
    </div>
6521 efrain 900
 
901
 
902
    <div id="row-view" style="display: none">
903
 
904
    	<div class="row">
905
        	<div class="col-12 col-md-8 mx-auto">
906
 
907
            	<div class="my-coach-record-card" >
908
                	<div class="my-coach-record-card-container" >
909
                    	<div class="my-coach-record-card-resume" >
910
        					<div class="my_coach_question_detail_user_rectangle">
911
                        		<img id="my-coach-question-user-image" class="my_coach_question_detail_user_image" src="" />
912
                        		<p id="my-coach-question-user-name" class="my_coach_question_detail_user_name"></p>
913
                        	</div>
914
                    	</div>
915
                    	<div class="my-coach-record-card-content" >
916
                        	<h2 id="my-coach-question-title"></h2>
917
                        	<p id="my-coach-question-description"></p>
918
 
919
 
920
                        	<div class="d-flex align-items-center justify-content-between">
921
                            	<ul id="my-coach-answer-categories" class="d-flex align-items-center  my-coach-record-card-categories">
922
                            	</ul>
923
                        	</div>
924
 
925
                         	<div class="d-flex align-items-center justify-content-between">
926
 
927
                            	<div>LABEL_MY_COACH_QUESTION <br/>  <span  id="my-coach-question-answer-question-date"> </span></div>
928
                            	<div>LABEL_MY_COACH_LAST_ANSWER <br/> <span id="my-coach-question-answer-last-date"> </span></div>
929
 
930
 
931
                        	</div>
932
                         	<div class="d-flex align-items-center justify-content-between">
933
 
934
                            	<div><span id="my-coach-question-answer-count-answers"> </span> LABEL_MY_COACH_ANSWERS</div>
935
                            	<div><span id="my-coach-question-answer-count-reactions"></span> LABEL_MY_COACH_REACTIONS</div>
936
                            	<div><span id="my-coach-question-answer-count-views"> </span> LABEL_MY_COACH_VIEWS</div>
937
                            	<div><span id="my-coach-question-answer-count-comments"> </span> LABEL_COMMENTS</div>
938
                        	</div>
939
 
940
                          	<div class="d-flex align-items-center justify-content-between">
941
                          		<button id="my-coach-question-answer-btn-back"> <i class="fa fa-chevron-left" aria-hidden="true"></i> LABEL_BACK </button>
942
                            	<button id="my-coach-question-answer-btn-answer"> <i class="fa fa-pencil" aria-hidden="true"></i> LABEL_REPLY </button>
943
                            	<button id="my-coach-question-answer-btn-delete"> <i class="fa fa-trash" aria-hidden="true"></i> LABEL_DELETE </button>
944
                        	</div>
945
                    	</div>
946
                	</div>
947
				</div>
948
			</div>
949
		</div>
950
 
951
 
952
        <div id="my-coach-question-answers-list">
953
        </div>
954
	</div>
6388 efrain 955
 
956
 
6521 efrain 957
 
958
 
959
</section>
960
 
961
 
6388 efrain 962
<!-- The Modal -->
963
<div class="modal" id="modal-question">
964
    <div class="modal-dialog  modal-xl">
965
        <div class="modal-content">
966
 
967
            <!-- Modal Header -->
968
            <div class="modal-header">
969
                <h4 class="modal-title">LABEL_QUESTION</h4>
970
                <button type="button" class="close" data-dismiss="modal">&times;</button>
971
            </div>
972
 
973
            <!-- Modal body -->
974
            <div class="modal-body">
975
                <?php
976
                $form = $this->formQuestion;
977
                $form->setAttributes([
978
                    'method'    => 'post',
979
                    'name'      => 'form-questiom',
980
                    'id'        => 'form-question'
981
                ]);
982
 
983
                $form->prepare();
984
                echo $this->form()->openTag($form);
985
                ?>
986
                <div class="form-group">
987
                    <?php
988
                    $element = $form->get('title');
989
                    $element->setOptions(['label' => 'LABEL_TITLE']);
990
                    $element->setAttributes(['class' => 'form-control']);
991
 
992
                    echo $this->formLabel($element);
993
                    echo $this->formText($element);
994
                    ?>
995
                </div>
996
              	<div class="form-group">
997
                    <?php
998
                    $element = $form->get('description');
999
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
1000
                    $element->setAttributes(['class' => 'form-control', 'id' => 'description_question']);
1001
 
1002
                    echo $this->formLabel($element);
1003
                    echo $this->formTextArea($element);
1004
                    ?>
1005
                </div>
1006
                <div class="form-group">
1007
                    <?php
1008
 
1009
                    $element = $form->get('category_id');
1010
                    $element->setOptions(['label' => 'LABEL_CATEGORY']);
1011
 
1012
                    echo $this->formLabel($element);
1013
                    echo $this->formSelect($element);
1014
                    ?>
1015
                </div>
1016
                <div class="text-right">
1017
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1018
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
1019
                </div>
1020
                <?php echo $this->form()->closeTag($form); ?>
1021
            </div>
1022
 
1023
 
1024
        </div>
1025
    </div>
1026
</div>
1027
 
6521 efrain 1028
<div class="modal" id="modal-answer">
1029
    <div class="modal-dialog  modal-xl">
1030
        <div class="modal-content">
6388 efrain 1031
 
6521 efrain 1032
            <!-- Modal Header -->
1033
            <div class="modal-header">
6547 efrain 1034
                <h4 class="modal-title" id="modal-answer-title"></h4>
6521 efrain 1035
                <button type="button" class="close" data-dismiss="modal">&times;</button>
1036
            </div>
6388 efrain 1037
 
6521 efrain 1038
            <!-- Modal body -->
1039
            <div class="modal-body">
1040
                <?php
1041
                $form = $this->formAnswer;
1042
                $form->setAttributes([
1043
                    'method'    => 'post',
1044
                    'name'      => 'form-answer',
1045
                    'id'        => 'form-answer',
1046
                ]);
6388 efrain 1047
 
6521 efrain 1048
                $form->prepare();
1049
                echo $this->form()->openTag($form);
1050
                ?>
1051
              	<div class="form-group">
1052
                    <?php
1053
                    $element = $form->get('description');
1054
                    $element->setOptions(['label' => 'LABEL_TEXT']);
1055
                    $element->setAttributes(['class' => 'form-control', 'id' => 'description_answer']);
1056
 
1057
                    echo $this->formLabel($element);
1058
                    echo $this->formTextArea($element);
1059
                    ?>
1060
                </div>
1061
                <div class="text-right">
1062
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1063
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
1064
                </div>
1065
                <?php echo $this->form()->closeTag($form); ?>
1066
            </div>
6388 efrain 1067
 
6521 efrain 1068
 
1069
        </div>
1070
    </div>
1071
</div>
1072
 
1073
<script id="answerTemplate" type="text/x-jsrender">
6547 efrain 1074
<div class="row" id="row-{{:uuid}}">
6521 efrain 1075
    <div class="col-12 col-md-8 mx-auto">
1076
        <div class="my-coach-record-card-container" >
1077
            <div class="my-coach-record-card-resume" >
1078
                <div class="my_coach_question_detail_user_rectangle">
1079
                    <img class="my_coach_question_detail_user_image" src="{{:user_image}}" />
1080
                    <p class="my_coach_question_detail_user_name">{{:user_name}}</p>
1081
                </div>
1082
 
1083
            </div>
1084
            <div class="my-coach-record-card-content" >
6547 efrain 1085
                <div id="answer-text-{{:uuid}}" >{{:text}}</div>
6521 efrain 1086
                <div class="d-flex align-items-center justify-content-between">
1087
                   <div>LABEL_DATE  <span>{{:time_elapsed}} </span></div>
1088
                   <div>LABEL_COMMENTS <span id="answer-total-comment-{{:uuid}}">{{:total_comments}}<span></div>
1089
                   <div>LABEL_REACTIONS <span id="answer-total-reactions-{{:uuid}}">{{:total_reactions}}<span></div>
1090
                </div>
1091
            </div>
1092
 
1093
 
1094
            <div class="my-coach-record-card-actions">
6547 efrain 1095
                <div class="d-flex align-items-center justify-content-between">
1096
                    {{if link_edit }}
1097
                    <button data-link="{{>link_edit}}" data-answer="{{:uuid}}" class="btn-my-coach-edit-answer"> <i class="fa fa-pencil" aria-hidden="true"></i> LABEL_EDIT </button>
1098
                    {{/if}}
1099
                    {{if link_delete }}
1100
                    <button data-link="{{>link_delete}}" data-question="{{:question_uuid}}" data-answer="{{:uuid}}" class="btn-my-coach-delete-answer"> <i class="fa fa-trash" aria-hidden="true"></i> LABEL_DELETE </button>
1101
                    {{/if}}
1102
                </div>
1103
 
1104
 
6521 efrain 1105
                <div class="position-relative" id="reaction-container">
1106
                    <button class="btn reaction-btn" data-answer="{{:uuid}}" data-link="{{:link_reaction_delete}}" data-reaction="{{:reaction}}" id="current-reaction-{{:uuid}}">
1107
 
1108
 
1109
                        {{if reaction === '<?php echo ContentReaction::REACTION_FUN ?>'}}
1110
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="EmojiEmotionsIcon" style="color: rgb(255, 127, 80);">
1111
                            <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM8.5 8c.83 0 1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5 7.67 8 8.5 8zM12 18c-2.28 0-4.22-1.66-5-4h10c-.78 2.34-2.72 4-5 4zm3.5-7c-.83 0-1.5-.67-1.5-1.5S14.67 8 15.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path>
1112
                        </svg>
1113
                        LABEL_REACTION_FUN
1114
                        {{/if}}
1115
 
1116
                        {{if reaction === '<?php echo ContentReaction::REACTION_INTEREST ?>'}}
1117
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="TungstenIcon" style="color: rgb(245, 187, 92);transform: rotate(180deg);">
1118
                            <path d="M11 19h2v3h-2zm-9-8h3v2H2zm17 0h3v2h-3zm-3.106 6.8014 1.4072-1.4071 2.1213 2.1213-1.4071 1.4071zm-11.3099.7071 2.1214-2.1213 1.4071 1.4072-2.1213 2.1213zM15 8.02V3H9v5.02c-1.21.92-2 2.35-2 3.98 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.06-2-3.98zM11 5h2v2.1c-.32-.06-.66-.1-1-.1s-.68.04-1 .1V5z"></path>
1119
                        </svg>
1120
                        LABEL_REACTION_INTEREST
1121
                        {{/if}}
1122
 
1123
 
1124
                        {{if reaction === '<?php echo ContentReaction::REACTION_LOVE ?>'}}
1125
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="FavoriteTwoToneIcon" style="color: rgb(223, 112, 77);">
1126
                            <path d="M16.5 5c-1.54 0-3.04.99-3.56 2.36h-1.87C10.54 5.99 9.04 5 7.5 5 5.5 5 4 6.5 4 8.5c0 2.89 3.14 5.74 7.9 10.05l.1.1.1-.1C16.86 14.24 20 11.39 20 8.5c0-2-1.5-3.5-3.5-3.5z" opacity=".3"></path>
1127
                            <path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"></path>
1128
                        </svg>
1129
                        LABEL_REACTION_LOVE
1130
                        {{/if}}
1131
 
1132
 
1133
                        {{if reaction === '<?php echo ContentReaction::REACTION_RECOMMENDED ?>'}}
1134
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="RecommendIcon" style="color: rgb(116, 5, 249);">
1135
                            <path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm6 9.8a.9.9 0 0 1-.1.5l-2.1 4.9a1.34 1.34 0 0 1-1.3.8H9a2 2 0 0 1-2-2v-5a1.28 1.28 0 0 1 .4-1L12 5l.69.69a1.08 1.08 0 0 1 .3.7v.2L12.41 10H17a1 1 0 0 1 1 1z"></path>
1136
                        </svg>
1137
                        LABEL_REACTION_RECOMMENDED
1138
                        {{/if}}
1139
 
1140
                        {{if reaction === '<?php echo ContentReaction::REACTION_SUPPORT ?>'}}
1141
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="VolunteerActivismIcon" style="color: rgb(100, 149, 237);">
1142
                            <path d="M1 11h4v11H1zm15-7.75C16.65 2.49 17.66 2 18.7 2 20.55 2 22 3.45 22 5.3c0 2.27-2.91 4.9-6 7.7-3.09-2.81-6-5.44-6-7.7C10 3.45 11.45 2 13.3 2c1.04 0 2.05.49 2.7 1.25zM20 17h-7l-2.09-.73.33-.94L13 16h2.82c.65 0 1.18-.53 1.18-1.18 0-.49-.31-.93-.77-1.11L8.97 11H7v9.02L14 22l8.01-3c-.01-1.1-.9-2-2.01-2z"></path>
1143
                        </svg>
1144
                        LABEL_REACTION_SUPPORT
1145
                        {{/if}}
1146
 
1147
                        {{if reaction === ''}}
1148
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="RecommendIcon" style="color: gray;">
1149
                            <path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm6 9.8a.9.9 0 0 1-.1.5l-2.1 4.9a1.34 1.34 0 0 1-1.3.8H9a2 2 0 0 1-2-2v-5a1.28 1.28 0 0 1 .4-1L12 5l.69.69a1.08 1.08 0 0 1 .3.7v.2L12.41 10H17a1 1 0 0 1 1 1z"></path>
1150
                        </svg>
1151
                        LABEL_REACTION_UNSET
1152
                        {{/if}}
1153
 
1154
 
1155
                    </button>
1156
                    <div class="reactions">
1157
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_RECOMMENDED ?>" title="LABEL_REACTION_RECOMMENDED" data-answer="{{:uuid}}">
1158
                            <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="RecommendIcon" style="color: rgb(116, 5, 249);">
1159
                                <path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm6 9.8a.9.9 0 0 1-.1.5l-2.1 4.9a1.34 1.34 0 0 1-1.3.8H9a2 2 0 0 1-2-2v-5a1.28 1.28 0 0 1 .4-1L12 5l.69.69a1.08 1.08 0 0 1 .3.7v.2L12.41 10H17a1 1 0 0 1 1 1z"></path>
1160
                            </svg>
1161
                        </button>
1162
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_SUPPORT ?>" title="LABEL_REACTION_SUPPORT" data-answer="{{:uuid}}">
1163
                            <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="VolunteerActivismIcon" style="color: rgb(100, 149, 237);">
1164
                                <path d="M1 11h4v11H1zm15-7.75C16.65 2.49 17.66 2 18.7 2 20.55 2 22 3.45 22 5.3c0 2.27-2.91 4.9-6 7.7-3.09-2.81-6-5.44-6-7.7C10 3.45 11.45 2 13.3 2c1.04 0 2.05.49 2.7 1.25zM20 17h-7l-2.09-.73.33-.94L13 16h2.82c.65 0 1.18-.53 1.18-1.18 0-.49-.31-.93-.77-1.11L8.97 11H7v9.02L14 22l8.01-3c-.01-1.1-.9-2-2.01-2z"></path>
1165
                            </svg>
1166
                        </button>
1167
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_LOVE ?>" title="LABEL_REACTION_LOVE" data-answer="{{:uuid}}">
1168
                            <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="FavoriteTwoToneIcon" style="color: rgb(223, 112, 77);">
1169
                                <path d="M16.5 5c-1.54 0-3.04.99-3.56 2.36h-1.87C10.54 5.99 9.04 5 7.5 5 5.5 5 4 6.5 4 8.5c0 2.89 3.14 5.74 7.9 10.05l.1.1.1-.1C16.86 14.24 20 11.39 20 8.5c0-2-1.5-3.5-3.5-3.5z" opacity=".3"></path>
1170
                                <path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"></path>
1171
                            </svg>
1172
                        </button>
1173
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_INTEREST ?>" title="LABEL_REACTION_INTEREST" data-answer="{{:uuid}}">
1174
                            <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="TungstenIcon" style="color: rgb(245, 187, 92);transform: rotate(180deg);">
1175
                                <path d="M11 19h2v3h-2zm-9-8h3v2H2zm17 0h3v2h-3zm-3.106 6.8014 1.4072-1.4071 2.1213 2.1213-1.4071 1.4071zm-11.3099.7071 2.1214-2.1213 1.4071 1.4072-2.1213 2.1213zM15 8.02V3H9v5.02c-1.21.92-2 2.35-2 3.98 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.06-2-3.98zM11 5h2v2.1c-.32-.06-.66-.1-1-.1s-.68.04-1 .1V5z"></path>
1176
                            </svg>
1177
                        </button>
1178
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_FUN ?>" title="LABEL_REACTION_FUN" data-answer="{{:uuid}}">
1179
                            <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="EmojiEmotionsIcon" style="color: rgb(255, 127, 80);">
1180
                                <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM8.5 8c.83 0 1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5 7.67 8 8.5 8zM12 18c-2.28 0-4.22-1.66-5-4h10c-.78 2.34-2.72 4-5 4zm3.5-7c-.83 0-1.5-.67-1.5-1.5S14.67 8 15.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path>
1181
                             </svg>
1182
                        </button>
1183
                    </div>
1184
                </div>
1185
            </div>
1186
 
1187
            <div class="comments-container show px-3">
1188
                <form class="feedCommentContainer"  id="form-comment-{{:uuid}}" class="form-comment-{{:uuid}}" action="{{:link_add_comment}}" data-answer="{{:uuid}}">
1189
                    <input class="commentInput" type="text" name="comment" id="comment" maxlength="256" placeholder="LABEL_WRITE_A_COMMENT">
1190
                    <button class="btn btn-primary" type="submit">LABEL_SEND</button>
1191
                </form>
1192
                <ul id="comment-list-{{:uuid}}" class="comment-list">
1193
                    {{for comments}}
1194
 
1195
                    <li>
1196
                        <div class="comment-container">
1197
	                       <div class="comment-content comment-{{:unique}}" >
1198
	                           <div class="info">
1199
                                    <a href="{{>user_url}}">
1200
                                        <h3>{{>user_name}}</h3>
1201
                                    </a>
1202
                                    <span>
1203
                                        {{>time_elapsed}}
1204
                                        {{if link_delete}}
1205
                                        <a href="#" class="btn-comment-trash" data-link="{{:link_delete}}" data-comment-unique="{{>unique}}" data-answer-uuid="{{>answer_uuid}}">
1206
                                        <i class="fa fa-trash"></i>
1207
                                        </a>
1208
                                        {{/if}}
1209
                                    </span>
1210
                                </div>
1211
		                        <p>{{>comment}}</p>
1212
		                  </div>
1213
	                   </div>
1214
                    </li>
1215
 
1216
 
1217
                    {{/for}}
1218
                </ul>
1219
 
1220
            </div>
1221
        </div>
1222
    </div>
1223
</div>
1224
</script>
1225
 
1226
<script id="reactionTemplate" type="text/x-jsrender">
1227
                        {{if reaction === '<?php echo ContentReaction::REACTION_FUN ?>'}}
1228
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="EmojiEmotionsIcon" style="color: rgb(255, 127, 80);">
1229
                            <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM8.5 8c.83 0 1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5 7.67 8 8.5 8zM12 18c-2.28 0-4.22-1.66-5-4h10c-.78 2.34-2.72 4-5 4zm3.5-7c-.83 0-1.5-.67-1.5-1.5S14.67 8 15.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path>
1230
                        </svg>
1231
                        LABEL_REACTION_FUN
1232
                        {{/if}}
1233
 
1234
                        {{if reaction === '<?php echo ContentReaction::REACTION_INTEREST ?>'}}
1235
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="TungstenIcon" style="color: rgb(245, 187, 92);transform: rotate(180deg);">
1236
                            <path d="M11 19h2v3h-2zm-9-8h3v2H2zm17 0h3v2h-3zm-3.106 6.8014 1.4072-1.4071 2.1213 2.1213-1.4071 1.4071zm-11.3099.7071 2.1214-2.1213 1.4071 1.4072-2.1213 2.1213zM15 8.02V3H9v5.02c-1.21.92-2 2.35-2 3.98 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.06-2-3.98zM11 5h2v2.1c-.32-.06-.66-.1-1-.1s-.68.04-1 .1V5z"></path>
1237
                        </svg>
1238
                        LABEL_REACTION_INTEREST
1239
                        {{/if}}
1240
 
1241
 
1242
                        {{if reaction === '<?php echo ContentReaction::REACTION_LOVE ?>'}}
1243
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="FavoriteTwoToneIcon" style="color: rgb(223, 112, 77);">
1244
                            <path d="M16.5 5c-1.54 0-3.04.99-3.56 2.36h-1.87C10.54 5.99 9.04 5 7.5 5 5.5 5 4 6.5 4 8.5c0 2.89 3.14 5.74 7.9 10.05l.1.1.1-.1C16.86 14.24 20 11.39 20 8.5c0-2-1.5-3.5-3.5-3.5z" opacity=".3"></path>
1245
                            <path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"></path>
1246
                        </svg>
1247
                        LABEL_REACTION_LOVE
1248
                        {{/if}}
1249
 
1250
 
1251
                        {{if reaction === '<?php echo ContentReaction::REACTION_RECOMMENDED ?>'}}
1252
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="RecommendIcon" style="color: rgb(116, 5, 249);">
1253
                            <path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm6 9.8a.9.9 0 0 1-.1.5l-2.1 4.9a1.34 1.34 0 0 1-1.3.8H9a2 2 0 0 1-2-2v-5a1.28 1.28 0 0 1 .4-1L12 5l.69.69a1.08 1.08 0 0 1 .3.7v.2L12.41 10H17a1 1 0 0 1 1 1z"></path>
1254
                        </svg>
1255
                        LABEL_REACTION_RECOMMENDED
1256
                        {{/if}}
1257
 
1258
                        {{if reaction === '<?php echo ContentReaction::REACTION_SUPPORT ?>'}}
1259
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="VolunteerActivismIcon" style="color: rgb(100, 149, 237);">
1260
                            <path d="M1 11h4v11H1zm15-7.75C16.65 2.49 17.66 2 18.7 2 20.55 2 22 3.45 22 5.3c0 2.27-2.91 4.9-6 7.7-3.09-2.81-6-5.44-6-7.7C10 3.45 11.45 2 13.3 2c1.04 0 2.05.49 2.7 1.25zM20 17h-7l-2.09-.73.33-.94L13 16h2.82c.65 0 1.18-.53 1.18-1.18 0-.49-.31-.93-.77-1.11L8.97 11H7v9.02L14 22l8.01-3c-.01-1.1-.9-2-2.01-2z"></path>
1261
                        </svg>
1262
                        LABEL_REACTION_SUPPORT
1263
                        {{/if}}
1264
 
1265
                        {{if reaction === ''}}
1266
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="RecommendIcon" style="color: gray;">
1267
                            <path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm6 9.8a.9.9 0 0 1-.1.5l-2.1 4.9a1.34 1.34 0 0 1-1.3.8H9a2 2 0 0 1-2-2v-5a1.28 1.28 0 0 1 .4-1L12 5l.69.69a1.08 1.08 0 0 1 .3.7v.2L12.41 10H17a1 1 0 0 1 1 1z"></path>
1268
                        </svg>
1269
                        LABEL_REACTION_UNSET
1270
                        {{/if}}
1271
</script>
1272
 
1273
 
1274
 
1275
<script id="commentTemplate" type="text/x-jsrender">
1276
    <li>
1277
        <div class="comment-container">
1278
	        <div class="comment-content comment-{{:unique}}" >
1279
	            <div class="info">
1280
                    <a href="{{>user_url}}">
1281
                        <h3>{{>user_name}}</h3>
1282
                    </a>
1283
                    <span>
1284
                        {{>time_elapsed}}
1285
                        {{if link_delete}}
1286
                        <a href="#" class="btn-comment-trash" data-link="{{:link_delete}}" data-comment-unique="{{>unique}}"  data-answer-uuid="{{>answer_uuid}}">
1287
                            <i class="fa fa-trash"></i>
1288
                        </a>
1289
                        {{/if}}
1290
                    </span>
1291
                </div>
1292
		      <p>{{>comment}}</p>
1293
		  </div>
1294
	   </div>
1295
    </li>
1296
</script>
1297
 
1298
 
6388 efrain 1299
<script id="recordTemplate" type="text/x-jsrender">
6521 efrain 1300
    <div class="my-coach-record-card" id="my-coach-record-card-question-{{:uuid}}">
6388 efrain 1301
        <div class="my-coach-record-card-container" >
1302
            <div class="my-coach-record-card-resume" >
6521 efrain 1303
                <div class="my_coach_question_detail_user_rectangle">
1304
                    <img class="my_coach_question_detail_user_image" src="{{:user_image}}" />
1305
                    <p class="my_coach_question_detail_user_name">{{:user_name}}</p>
1306
                </div>
6388 efrain 1307
                <ul>
6481 efrain 1308
                    <li><span id="answers-{{:uuid}}"> {{:answers}} </span> LABEL_MY_COACH_ANSWERS</li>
1309
                    <li><span id="reactions-{{:uuid}}"> {{:reactions}} </span> LABEL_MY_COACH_REACTIONS</li>
1310
                    <li><span id="views-{{:uuid}}"> {{:views}} </span> LABEL_MY_COACH_VIEWS</li>
6521 efrain 1311
                    <li><span id="comments-{{:uuid}}"> {{:comments}} </span> LABEL_COMMENTS</li>
6388 efrain 1312
                </ul>
1313
            </div>
1314
            <div class="my-coach-record-card-content" >
6521 efrain 1315
                <h2 ><span class="my-coach-record-question-view" style="cursor: pointer;">{{>title}}</span></h2>
6388 efrain 1316
                <p>{{>description}}</p>
1317
                <div class="d-flex align-items-center justify-content-between">
1318
                    <ul class="d-flex align-items-center  my-coach-record-card-categories">
1319
                        {{for categories}}
1320
                        <li>{{:category}}</li>
1321
                        {{/for}}
1322
                    </ul>
1323
                    <span>LABEL_MY_COACH_QUESTION {{:added_on}} </span>
1324
                </div>
1325
            </div>
1326
        </div>
1327
 
1328
        <div class="d-flex align-items-center justify-content-between">
6521 efrain 1329
            <button data-link="{{:link_view}}" class="btn-my-coach-edit-view"> <i class="fa fa-external-link" aria-hidden="true"></i> LABEL_VIEW </button>
1330
 
6388 efrain 1331
            {{if link_edit }}
6521 efrain 1332
            <button data-link="{{>link_edit}}" class="btn-my-coach-edit-question"> <i class="fa fa-pencil" aria-hidden="true"></i> LABEL_EDIT </button>
6388 efrain 1333
            {{/if}}
1334
            {{if link_delete }}
6521 efrain 1335
            <button data-link="{{>link_delete}}" class="btn-my-coach-delete-question"> <i class="fa fa-trash" aria-hidden="true"></i> LABEL_DELETE </button>
6388 efrain 1336
            {{/if}}
1337
        </div>
1338
    </div>
1339
</script>