Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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