Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6646 | Rev 6648 | 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
 
6388 efrain 809
    $.fn.reload()
810
 
811
    CKEDITOR.replace('description_question',{
812
        toolbar: [
813
                    { name: 'editing', items: ['Scayt'] },
814
                    { name: 'links', items: ['Link', 'Unlink'] },
815
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
816
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
817
                    '/',
818
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
819
                    { name: 'styles', items: ['Styles', 'Format'] },
820
                    { name: 'tools', items: ['Maximize'] }
821
                ],
822
                removePlugins: 'elementspath,Anchor',
823
                heigth: 100
824
    });
6521 efrain 825
 
826
    CKEDITOR.replace('description_answer',{
827
        toolbar: [
828
                    { name: 'editing', items: ['Scayt'] },
829
                    { name: 'links', items: ['Link', 'Unlink'] },
830
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
831
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
832
                    '/',
833
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
834
                    { name: 'styles', items: ['Styles', 'Format'] },
835
                    { name: 'tools', items: ['Maximize'] }
836
                ],
837
                removePlugins: 'elementspath,Anchor',
838
                heigth: 100
839
    });
6388 efrain 840
});
5050 efrain 841
JS;
6388 efrain 842
 
843
$this->inlineScript()->captureEnd();
844
$this->headLink()->appendStylesheet('/look-and-field/my-coach.css');
5050 efrain 845
?>
846
 
6645 stevensc 847
<section class="container px-0 d-flex flex-column gap-3">
6388 efrain 848
    <div class="company-title">
6645 stevensc 849
        <h1 class="title">LABEL_MY_COACH</h1>
6552 stevensc 850
        <?php if ($allowQuestionAdd) : ?>
6388 efrain 851
            <h2 class="title cursor-pointer" id="my-coach-add-question">
852
                LABEL_MY_COACH_QUESTION_ADD
853
            </h2>
6552 stevensc 854
        <?php endif; ?>
5050 efrain 855
 
6388 efrain 856
    </div>
5050 efrain 857
 
6388 efrain 858
    <div class="row gap-3" id="row-list">
6552 stevensc 859
        <div class="my-coach-category-list col-12 col-md-3">
6388 efrain 860
            <ul>
861
                <li class="my-coach-category-li my-coach-category-li-selected">
862
                    <a class="my-coach-category-a" href="" data-uuid="">LABEL_MY_COACH_CATEGORY_ALL</a>
863
                </li>
864
                <?php
6521 efrain 865
                foreach ($categories as $uuid => $name) :
6388 efrain 866
                ?>
867
                    <li class="my-coach-category-li">
6521 efrain 868
                        <a class="my-coach-category-a" href="" data-uuid="<?php echo $uuid ?>"><?php echo $name ?></a>
6388 efrain 869
                    </li>
870
 
871
                <?php endforeach; ?>
872
            </ul>
873
        </div>
874
 
875
 
876
        <div class="col px-0">
877
            <div class="search-box">
878
                <form id="form-filter" name="form-filter">
879
                    <input type="text" name="search" id="search" class="form-control"><button class="btn btn-search">LABEL_SEARCH</button>
880
                </form>
881
            </div>
882
 
6644 stevensc 883
            <div id="my-coach-record-list" class="my-coach-record-list mt-3 ">
6388 efrain 884
            </div>
885
 
886
            <div id="my-coach-pagination">
887
            </div>
888
 
889
        </div>
890
    </div>
6552 stevensc 891
 
892
 
6562 stevensc 893
    <div id="row-view" class="my-coach-answers-list" style="display: none">
6563 stevensc 894
        <div class="my-coach-record-card-container col-md-8 mx-auto">
895
            <div class="my-coach-record-card-details">
6562 stevensc 896
                <div class="my-coach-record-card-resume">
6563 stevensc 897
                    <img id="my-coach-question-user-image" src="" />
898
                    <p id="my-coach-question-user-name"></p>
6562 stevensc 899
                </div>
6597 stevensc 900
                <ul id="my-coach-answer-categories" class="my-coach-record-card-categories">
6596 stevensc 901
                </ul>
6563 stevensc 902
            </div>
6552 stevensc 903
 
6567 stevensc 904
            <h2 id="my-coach-question-title"></h2>
6568 stevensc 905
 
6595 stevensc 906
            <div class="d-flex flex-wrap align-items-center justify-content-between mb-3">
6568 stevensc 907
                <span id="my-coach-question-answer-question-date">LABEL_MY_COACH_QUESTION </span>
908
                <span id="my-coach-question-answer-last-date">LABEL_MY_COACH_LAST_ANSWER </span>
909
            </div>
910
 
6567 stevensc 911
            <p id="my-coach-question-description"></p>
6552 stevensc 912
 
6596 stevensc 913
            <div class="my-coach-record-card-info">
914
                <span id="my-coach-question-answer-count-answers"> LABEL_MY_COACH_ANSWERS</span>
915
                <span id="my-coach-question-answer-count-reactions"> LABEL_MY_COACH_REACTIONS</span>
916
                <span id="my-coach-question-answer-count-views"> LABEL_MY_COACH_VIEWS</span>
917
                <span id="my-coach-question-answer-count-comments"> LABEL_COMMENTS</span>
918
            </div>
6552 stevensc 919
 
6579 stevensc 920
            <div class="my-coach-record-card-actions">
6586 stevensc 921
                <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 922
                <button class="feed__share-option" id="my-coach-question-answer-btn-answer"> <i class="fa fa-pencil" aria-hidden="true"></i> LABEL_REPLY </button>
923
                <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 924
            </div>
925
        </div>
926
 
6553 stevensc 927
        <div id="my-coach-question-answers-list" class="my-coach-answers-list">
6521 efrain 928
        </div>
6552 stevensc 929
    </div>
930
</section>
6521 efrain 931
 
6552 stevensc 932
 
6388 efrain 933
<!-- The Modal -->
934
<div class="modal" id="modal-question">
6646 stevensc 935
    <div class="modal-dialog  modal-lg">
6388 efrain 936
        <div class="modal-content">
937
 
938
            <!-- Modal Header -->
939
            <div class="modal-header">
6646 stevensc 940
                <h4 class="modal-title h4">LABEL_QUESTION</h4>
6388 efrain 941
                <button type="button" class="close" data-dismiss="modal">&times;</button>
942
            </div>
943
 
944
            <!-- Modal body -->
945
            <div class="modal-body">
946
                <?php
947
                $form = $this->formQuestion;
948
                $form->setAttributes([
949
                    'method'    => 'post',
950
                    'name'      => 'form-questiom',
951
                    'id'        => 'form-question'
952
                ]);
953
 
954
                $form->prepare();
955
                echo $this->form()->openTag($form);
956
                ?>
957
                <div class="form-group">
958
                    <?php
959
                    $element = $form->get('title');
960
                    $element->setOptions(['label' => 'LABEL_TITLE']);
961
                    $element->setAttributes(['class' => 'form-control']);
962
 
963
                    echo $this->formLabel($element);
964
                    echo $this->formText($element);
965
                    ?>
966
                </div>
6552 stevensc 967
                <div class="form-group">
6388 efrain 968
                    <?php
969
                    $element = $form->get('description');
970
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
971
                    $element->setAttributes(['class' => 'form-control', 'id' => 'description_question']);
6552 stevensc 972
 
6388 efrain 973
                    echo $this->formLabel($element);
974
                    echo $this->formTextArea($element);
975
                    ?>
976
                </div>
977
                <div class="form-group">
978
                    <?php
6552 stevensc 979
 
6388 efrain 980
                    $element = $form->get('category_id');
981
                    $element->setOptions(['label' => 'LABEL_CATEGORY']);
6552 stevensc 982
 
6388 efrain 983
                    echo $this->formLabel($element);
984
                    echo $this->formSelect($element);
985
                    ?>
986
                </div>
987
                <div class="text-right">
988
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
989
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
990
                </div>
991
                <?php echo $this->form()->closeTag($form); ?>
992
            </div>
993
 
994
 
995
        </div>
996
    </div>
997
</div>
6552 stevensc 998
 
6521 efrain 999
<div class="modal" id="modal-answer">
6647 stevensc 1000
    <div class="modal-dialog modal-lg">
6521 efrain 1001
        <div class="modal-content">
6388 efrain 1002
 
6521 efrain 1003
            <!-- Modal Header -->
1004
            <div class="modal-header">
6647 stevensc 1005
                <h4 class="modal-title h4" id="modal-answer-title"></h4>
6521 efrain 1006
                <button type="button" class="close" data-dismiss="modal">&times;</button>
1007
            </div>
6388 efrain 1008
 
6521 efrain 1009
            <!-- Modal body -->
1010
            <div class="modal-body">
1011
                <?php
1012
                $form = $this->formAnswer;
1013
                $form->setAttributes([
1014
                    'method'    => 'post',
1015
                    'name'      => 'form-answer',
1016
                    'id'        => 'form-answer',
1017
                ]);
6388 efrain 1018
 
6521 efrain 1019
                $form->prepare();
1020
                echo $this->form()->openTag($form);
1021
                ?>
6552 stevensc 1022
                <div class="form-group">
6521 efrain 1023
                    <?php
1024
                    $element = $form->get('description');
1025
                    $element->setOptions(['label' => 'LABEL_TEXT']);
1026
                    $element->setAttributes(['class' => 'form-control', 'id' => 'description_answer']);
6552 stevensc 1027
 
6521 efrain 1028
                    echo $this->formLabel($element);
1029
                    echo $this->formTextArea($element);
1030
                    ?>
1031
                </div>
1032
                <div class="text-right">
1033
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1034
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
1035
                </div>
1036
                <?php echo $this->form()->closeTag($form); ?>
1037
            </div>
6388 efrain 1038
 
6521 efrain 1039
 
1040
        </div>
1041
    </div>
1042
</div>
1043
 
1044
<script id="answerTemplate" type="text/x-jsrender">
6557 stevensc 1045
    <div class="my-coach-record-card-container col-md-8 mx-auto" id="row-{{:uuid}}">
6554 stevensc 1046
            <div class="my-coach-record-card-details">
6556 stevensc 1047
                <div class="my-coach-record-card-resume">
1048
                    <img src="{{:user_image}}" />
1049
                    <p>{{:user_name}}</p>
1050
                </div>
6594 stevensc 1051
                <div class="my-coach-record-card-info">
1052
                    <span>LABEL_PUBLISHED LABEL_AGO_SMALL {{:time_elapsed}}</span>
1053
                    <span id="answer-total-comment-{{:uuid}}">{{:total_comments}} LABEL_COMMENTS</span>
1054
                    <span id="answer-total-reactions-{{:uuid}}">{{:total_reactions}} LABEL_REACTIONS</span>
1055
                </div>
6553 stevensc 1056
            </div>
6554 stevensc 1057
 
6556 stevensc 1058
            {{:text}}
6553 stevensc 1059
 
6557 stevensc 1060
            <div class="my-coach-record-card-actions">
1061
                {{if link_edit }}
6558 stevensc 1062
                <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 1063
                {{/if}}
6547 efrain 1064
 
6557 stevensc 1065
                {{if link_delete }}
6558 stevensc 1066
                <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 1067
                {{/if}}
1068
 
6582 stevensc 1069
                <div class="position-relative feed__share-option" id="reaction-container">
6577 stevensc 1070
                    <button class="btn reaction-btn p-0" data-answer="{{:uuid}}" data-link="{{:link_reaction_delete}}" data-reaction="{{:reaction}}" id="current-reaction-{{:uuid}}">
6521 efrain 1071
                        {{if reaction === '<?php echo ContentReaction::REACTION_FUN ?>'}}
1072
                        <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);">
1073
                            <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>
1074
                        </svg>
1075
                        LABEL_REACTION_FUN
1076
                        {{/if}}
1077
 
1078
                        {{if reaction === '<?php echo ContentReaction::REACTION_INTEREST ?>'}}
1079
                        <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);">
1080
                            <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>
1081
                        </svg>
1082
                        LABEL_REACTION_INTEREST
1083
                        {{/if}}
1084
 
1085
 
1086
                        {{if reaction === '<?php echo ContentReaction::REACTION_LOVE ?>'}}
1087
                        <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);">
1088
                            <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>
1089
                            <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>
1090
                        </svg>
1091
                        LABEL_REACTION_LOVE
1092
                        {{/if}}
1093
 
1094
 
1095
                        {{if reaction === '<?php echo ContentReaction::REACTION_RECOMMENDED ?>'}}
1096
                        <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);">
1097
                            <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>
1098
                        </svg>
1099
                        LABEL_REACTION_RECOMMENDED
1100
                        {{/if}}
1101
 
1102
                        {{if reaction === '<?php echo ContentReaction::REACTION_SUPPORT ?>'}}
1103
                        <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);">
1104
                            <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>
1105
                        </svg>
1106
                        LABEL_REACTION_SUPPORT
1107
                        {{/if}}
1108
 
1109
                        {{if reaction === ''}}
1110
                        <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="RecommendIcon" style="color: gray;">
1111
                            <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>
1112
                        </svg>
1113
                        LABEL_REACTION_UNSET
1114
                        {{/if}}
1115
 
1116
 
1117
                    </button>
6582 stevensc 1118
                    <div class="reactions">
6521 efrain 1119
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_RECOMMENDED ?>" title="LABEL_REACTION_RECOMMENDED" data-answer="{{:uuid}}">
1120
                            <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);">
1121
                                <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>
1122
                            </svg>
1123
                        </button>
1124
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_SUPPORT ?>" title="LABEL_REACTION_SUPPORT" data-answer="{{:uuid}}">
1125
                            <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);">
1126
                                <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>
1127
                            </svg>
1128
                        </button>
1129
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_LOVE ?>" title="LABEL_REACTION_LOVE" data-answer="{{:uuid}}">
1130
                            <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);">
1131
                                <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>
1132
                                <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>
1133
                            </svg>
1134
                        </button>
1135
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_INTEREST ?>" title="LABEL_REACTION_INTEREST" data-answer="{{:uuid}}">
1136
                            <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);">
1137
                                <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>
1138
                            </svg>
1139
                        </button>
1140
                        <button class="btn-save-reaction" data-link="{{:link_save_reaction}}" data-reaction="<?php echo ContentReaction::REACTION_FUN ?>" title="LABEL_REACTION_FUN" data-answer="{{:uuid}}">
1141
                            <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);">
1142
                                <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>
1143
                             </svg>
1144
                        </button>
1145
                    </div>
1146
                </div>
1147
            </div>
1148
 
6561 stevensc 1149
            <div class="comments-container show">
6521 efrain 1150
                <form class="feedCommentContainer"  id="form-comment-{{:uuid}}" class="form-comment-{{:uuid}}" action="{{:link_add_comment}}" data-answer="{{:uuid}}">
1151
                    <input class="commentInput" type="text" name="comment" id="comment" maxlength="256" placeholder="LABEL_WRITE_A_COMMENT">
1152
                    <button class="btn btn-primary" type="submit">LABEL_SEND</button>
1153
                </form>
1154
                <ul id="comment-list-{{:uuid}}" class="comment-list">
1155
                    {{for comments}}
1156
 
1157
                    <li>
1158
                        <div class="comment-container">
1159
	                       <div class="comment-content comment-{{:unique}}" >
1160
	                           <div class="info">
1161
                                    <a href="{{>user_url}}">
1162
                                        <h3>{{>user_name}}</h3>
1163
                                    </a>
1164
                                    <span>
1165
                                        {{>time_elapsed}}
1166
                                        {{if link_delete}}
1167
                                        <a href="#" class="btn-comment-trash" data-link="{{:link_delete}}" data-comment-unique="{{>unique}}" data-answer-uuid="{{>answer_uuid}}">
1168
                                        <i class="fa fa-trash"></i>
1169
                                        </a>
1170
                                        {{/if}}
1171
                                    </span>
1172
                                </div>
1173
		                        <p>{{>comment}}</p>
1174
		                  </div>
1175
	                   </div>
1176
                    </li>
1177
 
1178
 
1179
                    {{/for}}
1180
                </ul>
1181
 
1182
            </div>
1183
    </div>
1184
</script>
1185
 
1186
<script id="reactionTemplate" type="text/x-jsrender">
6552 stevensc 1187
    {{if reaction === '<?php echo ContentReaction::REACTION_FUN ?>'}}
1188
    <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);">
1189
        <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>
1190
    </svg>
1191
    LABEL_REACTION_FUN
1192
    {{/if}}
6521 efrain 1193
 
6552 stevensc 1194
    {{if reaction === '<?php echo ContentReaction::REACTION_INTEREST ?>'}}
1195
    <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);">
1196
        <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>
1197
    </svg>
1198
    LABEL_REACTION_INTEREST
1199
    {{/if}}
6521 efrain 1200
 
1201
 
6552 stevensc 1202
    {{if reaction === '<?php echo ContentReaction::REACTION_LOVE ?>'}}
1203
    <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);">
1204
        <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>
1205
        <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>
1206
    </svg>
1207
    LABEL_REACTION_LOVE
1208
    {{/if}}
6521 efrain 1209
 
1210
 
6552 stevensc 1211
    {{if reaction === '<?php echo ContentReaction::REACTION_RECOMMENDED ?>'}}
1212
    <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);">
1213
        <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>
1214
    </svg>
1215
    LABEL_REACTION_RECOMMENDED
1216
    {{/if}}
6521 efrain 1217
 
6552 stevensc 1218
    {{if reaction === '<?php echo ContentReaction::REACTION_SUPPORT ?>'}}
1219
    <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);">
1220
        <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>
1221
    </svg>
1222
    LABEL_REACTION_SUPPORT
1223
    {{/if}}
1224
 
1225
    {{if reaction === ''}}
1226
    <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="RecommendIcon" style="color: gray;">
1227
        <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>
1228
    </svg>
1229
    LABEL_REACTION_UNSET
1230
    {{/if}}
6521 efrain 1231
</script>
1232
 
1233
 
1234
 
1235
<script id="commentTemplate" type="text/x-jsrender">
1236
    <li>
1237
        <div class="comment-container">
1238
	        <div class="comment-content comment-{{:unique}}" >
1239
	            <div class="info">
1240
                    <a href="{{>user_url}}">
1241
                        <h3>{{>user_name}}</h3>
1242
                    </a>
1243
                    <span>
1244
                        {{>time_elapsed}}
1245
                        {{if link_delete}}
1246
                        <a href="#" class="btn-comment-trash" data-link="{{:link_delete}}" data-comment-unique="{{>unique}}"  data-answer-uuid="{{>answer_uuid}}">
1247
                            <i class="fa fa-trash"></i>
1248
                        </a>
1249
                        {{/if}}
1250
                    </span>
1251
                </div>
1252
		      <p>{{>comment}}</p>
1253
		  </div>
1254
	   </div>
1255
    </li>
1256
</script>
1257
 
1258
 
6388 efrain 1259
<script id="recordTemplate" type="text/x-jsrender">
6586 stevensc 1260
 
6644 stevensc 1261
    <div class="my-coach-record-card-container col" id="my-coach-record-card-question-{{:uuid}}">
6594 stevensc 1262
        <div class="my-coach-record-card-details">
1263
            <div class="my-coach-record-card-resume" >
1264
                <img class="my_coach_question_detail_user_image" src="{{:user_image}}" />
1265
                <p class="my_coach_question_detail_user_name">{{:user_name}}</p>
1266
            </div>
1267
            <div class="my-coach-record-card-info">
6586 stevensc 1268
                <span id="answers-{{:uuid}}">{{:answers}} LABEL_MY_COACH_ANSWERS</span>
1269
                <span id="reactions-{{:uuid}}">{{:reactions}} LABEL_MY_COACH_REACTIONS</span>
1270
                <span id="views-{{:uuid}}">{{:views}} LABEL_MY_COACH_VIEWS</span>
1271
                <span id="comments-{{:uuid}}">{{:comments}} LABEL_COMMENTS</span>
6388 efrain 1272
            </div>
1273
        </div>
6594 stevensc 1274
        <h2>{{>title}}</h2>
1275
        <span>LABEL_MY_COACH_QUESTION {{:added_on}}</span>
1276
        <p class="my-3">{{>description}}</p>
6599 stevensc 1277
        <ul class="my-coach-record-card-categories mb-2">
6594 stevensc 1278
            {{for categories}}
1279
            <li>{{:category}}</li>
1280
            {{/for}}
1281
        </ul>
1282
        <div class="d-flex align-items-center justify-content-between">
1283
            <button data-link="{{:link_view}}" class="btn-my-coach-edit-view"> <i class="fa fa-external-link" aria-hidden="true"></i> LABEL_VIEW </button>
1284
 
1285
            {{if link_edit }}
1286
            <button data-link="{{>link_edit}}" class="btn-my-coach-edit-question"> <i class="fa fa-pencil" aria-hidden="true"></i> LABEL_EDIT </button>
1287
            {{/if}}
1288
            {{if link_delete }}
1289
            <button data-link="{{>link_delete}}" class="btn-my-coach-delete-question"> <i class="fa fa-trash" aria-hidden="true"></i> LABEL_DELETE </button>
1290
            {{/if}}
1291
        </div>
1292
    </div>
6388 efrain 1293
 
6586 stevensc 1294
 
6552 stevensc 1295
</script>