Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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