Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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