Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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