Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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