Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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