Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 173 | Rev 175 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 173 Rev 174
Línea 1107... Línea 1107...
1107
    });
1107
    });
1108
    $('body').on('click', 'button.btn-edit-section', function(e) {
1108
    $('body').on('click', 'button.btn-edit-section', function(e) {
1109
        e.preventDefault();
1109
        e.preventDefault();
1110
        var slug = $(this).data('section');
1110
        var slug = $(this).data('section');
1111
        var section;
1111
        var section;
1112
        console.log(slug);
-
 
1113
        var showForm = false;
1112
        var showForm = false;
1114
        for (i = 0; i < objFormGenerator.sections.length; i++) {
1113
        for (i = 0; i < objFormGenerator.sections.length; i++) {
1115
            section = objFormGenerator.sections[i];
1114
            section = objFormGenerator.sections[i];
1116
            if (slug == section.slug_section) {
1115
            if (slug == section.slug_section) {
1117
                validatorFormSection.resetForm();
1116
                validatorFormSection.resetForm();
Línea 1247... Línea 1246...
1247
                }
1246
                }
1248
            }
1247
            }
1249
        });
1248
        });
1250
    });
1249
    });
Línea 1251... Línea 1250...
1251
 
1250
 
1252
        /**
1251
    /**
1253
     * Render Sections data
1252
     * Render Sections data
1254
     */
-
 
1255
    const renderData = (data) =>{
-
 
1256
        console.log(data);
1253
    */
1257
return $("#rows").html($("#sectionTemplate").render(data));
1254
    const renderData = (data) => $("#rows").html($("#sectionTemplate").render(data));
Línea 1258... Línea 1255...
1258
    } 
1255
    
1259
 
1256
 
1260
    $('body').on('click', 'button.btn-add-option', function(e) {
1257
    $('body').on('click', 'button.btn-add-option', function(e) {
1261
        e.preventDefault();
1258
        e.preventDefault();
Línea 1514... Línea 1511...
1514
            </div>
1511
            </div>
1515
        </div>
1512
        </div>
1516
    </div>
1513
    </div>
Línea 1517... Línea 1514...
1517
 
1514
 
-
 
1515
    <!-- Create/Edit Form -->
-
 
1516
 
-
 
1517
<!---Template Sections --->
-
 
1518
    <script id="sectionTemplate" type="text/x-jsrender">
-
 
1519
       <div class="panel panel-default" id="panel-{{:slug_section}}">
-
 
1520
   <div class="panel-heading">
-
 
1521
      <h4 class="panel-title">
-
 
1522
         <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
-
 
1523
         <span class="section-name{{:slug_section}}">
-
 
1524
         {{:name}}
-
 
1525
         </span>
-
 
1526
         </a>
-
 
1527
      </h4>
-
 
1528
   </div>
-
 
1529
   <div id="collapse-{{:slug_section}}" class="panel-collapse">
-
 
1530
      <div class="panel-body">
-
 
1531
         <div class="table-responsive">
-
 
1532
            <table class="table table-bordered">
-
 
1533
               <thead>
-
 
1534
                  <tr>
-
 
1535
                     <th>LABEL_ELEMENT</th>
-
 
1536
                     <th>LABEL_TEXT</th>
-
 
1537
                     <th>LABEL_VALUE</th>
-
 
1538
                     <th>LABEL_TYPE</th>
-
 
1539
                     <th>LABEL_ACTIONS</th>
-
 
1540
                  </tr>
-
 
1541
               </thead>
-
 
1542
               <tbody>
-
 
1543
                  <tr class="tr-section">
-
 
1544
                     <td class="text-left">LABEL_SECTION</td>
-
 
1545
                     <td class="text-left">{{:name}}</td>
-
 
1546
                     <td>{{:value}}</td>
-
 
1547
                     <td></td>
1518
    <!-- Create/Edit Form -->
1548
                     <td>
1519
    <?php
1549
                        <button class="btn btn-default btn-edit-section" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>
1520
    echo $this->partial('modals/forms.phtml', array(
1550
                        <button class="btn btn-default btn-delete-section" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button> 
-
 
1551
                        <button class="btn btn-default btn-add-question" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_QUESTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_QUESTION </button> 
-
 
1552
                     </td>
-
 
1553
                  </tr>
-
 
1554
                  {{for questions}}
-
 
1555
                  <tr class="tr-question">
-
 
1556
                     <td class="text-left">--LABEL_QUESTION</td>
-
 
1557
                     <td class="text-left">
-
 
1558
                        {{:text}}
-
 
1559
                     </td>
-
 
1560
                     <td><font color="red">{{:value}}</font></td>
-
 
1561
                     <td class="text-capitalize">{{:type}}</td>
1521
        'status_inactive' => $status_inactive,
1562
                     <td>
1522
        'status_active' => $status_active,
1563
                        <button class="btn btn-default btn-edit-question" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_QUESTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_QUESTION</button> 
1523
        'lang_es' => $lang_es,
1564
                        <button class="btn btn-default btn-delete-question" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_QUESTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_QUESTION</button> 
-
 
1565
                        <button class="btn btn-default btn-add-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_OPTION</button> 
-
 
1566
                     </td>
-
 
1567
                  </tr>
-
 
1568
                  {{for options}}
-
 
1569
                  <tr class="tr-option">
-
 
1570
                     <td class="text-left">---LABEL_OPTION</td>
-
 
1571
                     <td class="text-left">
-
 
1572
                        {{:text}}
-
 
1573
                     </td>
-
 
1574
                     <td>
-
 
1575
                        {{if question_type == 'multiple' || question_type == 'rating-open'  }}
-
 
1576
                        {{:value}}
-
 
1577
                        {{/if}}
-
 
1578
                     </td>
-
 
1579
                     <td class="text-left">
-
 
1580
                        {{if question_type != rating-open'}}
-
 
1581
                        {{if correct == 1}}
-
 
1582
                        <font color="green">LABEL_CORRECT</font>
-
 
1583
                        {{/if}}
-
 
1584
                        {{if correct == 0}}
-
 
1585
                        <font color="red">LABEL_FAIL</font>
-
 
1586
                        {{/if}}
-
 
1587
                        {{/if}}
-
 
1588
                     </td>
1524
        'lang_en' => $lang_en
1589
                     <td>
1525
    ));
1590
                        <button class="btn btn-default btn-edit-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-slug="{{:slug_option}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_OPTION</button> 
-
 
1591
                        <button class="btn btn-default btn-delete-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-slug="{{:slug_option}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_OPTION</button> 
-
 
1592
                     </td>
-
 
1593
                  </tr>
-
 
1594
                  {{/for}}
-
 
1595
                  {{/for}}
-
 
1596
               </tbody>
-
 
1597
            </table>
-
 
1598
         </div>
-
 
1599
      </div>
-
 
1600
   </div>
-
 
1601
</div>
-
 
1602
    </script>
-
 
1603
    
-
 
1604
    <!-- End Template Sections-->
-
 
1605
 
-
 
1606
    <div class="row" id="row-edit" style="display: none">
-
 
1607
        <div class="col-xs-12 col-md-12">
-
 
1608
            <form action="#" name="form-main" id="form-main">
-
 
1609
                <input type="hidden" name="form-id" id="form-id" value="0" />
-
 
1610
                <input type="hidden" name="form-continue" id="form-continue" value="0" />
-
 
1611
                <div class="form-group">
-
 
1612
                    <label for="form-name">LABEL_FIRST_NAME</label>
-
 
1613
                    <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
-
 
1614
                </div>
-
 
1615
                <div class="form-group">
-
 
1616
                    <label for="form-description">LABEL_DESCRIPTION</label>
-
 
1617
                    <!--  ckeditor -->
-
 
1618
                    <textarea  name="form-description" id="form-description" rows="5" class="ckeditor form-control"></textarea>
-
 
1619
                </div>
-
 
1620
                <div class="form-group">
-
 
1621
                    <label for="form-text">LABEL_TEXT</label>
-
 
1622
                    <!--  ckeditor -->
-
 
1623
                    <textarea  name="form-text" id="form-text" rows="5" class="ckeditor form-control"></textarea>
-
 
1624
                </div>
-
 
1625
                <div class="form-group">
-
 
1626
                    <label for="form-language">LABEL_LANGUAGES</label>
-
 
1627
                    <select name="form-language" id="form-language" class="form-control">
-
 
1628
                        <option value="<?php echo $this->lang_en; ?>">LABEL_ENGLISH</option>
-
 
1629
                        <option value="<?php echo $this->lang_es; ?>">LABEL_SPANISH</option>
-
 
1630
                    </select>
-
 
1631
                </div>
-
 
1632
                <div class="form-group">
-
 
1633
                    <label for="form-status">LABEL_STATUS</label>
-
 
1634
                    <select name="form-status" id="form-status" class="form-control">
-
 
1635
                        <option value="<?php echo $this->status_inactive; ?>">LABEL_INACTIVE</option>
-
 
1636
                        <option value="<?php echo $this->status_active; ?>">LABEL_ACTIVE</option>
-
 
1637
                    </select>
-
 
1638
                </div>
-
 
1639
                <br/>
-
 
1640
                <div class="row">
-
 
1641
                    <div class="col-xs-12 col-md-12 text-right">
-
 
1642
                        <button class="btn btn-primary" id="btn-add-section" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION</button>
-
 
1643
                    </div>
-
 
1644
                </div>
-
 
1645
                <br />	
-
 
1646
                <div class="row">
-
 
1647
                    <div class="col-xs-12 col-md-12">
-
 
1648
                        <div class="panel-group" id="rows"></div>
-
 
1649
                    </div>
-
 
1650
                </div>
-
 
1651
                <div class="form-group">
-
 
1652
                    <button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
-
 
1653
                    <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
-
 
1654
                    <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
-
 
1655
                </div>
-
 
1656
            </form>
-
 
1657
        </div>
-
 
1658
    </div>
1526
    ?>
1659
 
Línea 1527... Línea 1660...
1527
    <!-- Create/Edit Form-->
1660
    <!-- Create/Edit Form-->
Línea 1528... Línea 1661...
1528
 
1661
 
-
 
1662
    <!-- Modals -->
1529
    <!-- Modals -->
1663
 
-
 
1664
    <!-- Section Modal -->
-
 
1665
    <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
-
 
1666
        <div class="modal-dialog modal-lg" role="document">
-
 
1667
            <form action="#" name="form-section" id="form-section">
-
 
1668
                <input type="hidden" name="section-slug" id="section-slug" value="" />
-
 
1669
                <div class="modal-content">
-
 
1670
                    <div class="modal-header">
-
 
1671
                        <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
-
 
1672
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-
 
1673
                            <span aria-hidden="true">&times;</span>
-
 
1674
                        </button>
-
 
1675
                    </div>
-
 
1676
                    <div class="modal-body">
-
 
1677
                        <div class="form-group">
-
 
1678
                            <label for="section-name">LABEL_FIRST_NAME</label>
-
 
1679
                            <input type="text" name="section-name" id="section-name" class="form-control" maxlength="50" value="" />
-
 
1680
                        </div>
-
 
1681
                        <div class="form-group">
-
 
1682
                            <label for="section-text">LABEL_TEXT</label>
-
 
1683
                            <!--  ckeditor -->
-
 
1684
                            <textarea  name="section-text" id="section-text" rows="5" class="ckeditor form-control"></textarea>
-
 
1685
                        </div>
-
 
1686
                        <div class="form-group">
-
 
1687
                            <label for="section-value">LABEL_VALUE</label>
-
 
1688
                            <input type="text" name="section-value" id="section-value"  class="form-control" value="0" />
-
 
1689
                        </div>
-
 
1690
                    </div>
-
 
1691
                    <div class="modal-footer">
-
 
1692
                        <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
1693
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
-
 
1694
                    </div>
-
 
1695
                </div>
1530
 
1696
            </form>
Línea 1531... Línea 1697...
1531
    <!-- Section Modal -->
1697
        </div>
Línea -... Línea 1698...
-
 
1698
    </div>
1532
<?php echo $this->partial('modals/sections.phtml'); ?>
1699
    <!-- End Modal Section -->
-
 
1700
 
-
 
1701
    <!-- Question Modal -->
-
 
1702
 
-
 
1703
    <div  id="modal-question" class="modal" tabindex="-1" role="dialog">
-
 
1704
        <div class="modal-dialog modal-lg" role="document">
-
 
1705
            <form action="#" name="form-question" id="form-question">
-
 
1706
                <input type="hidden" name="question-section" id="question-section" />
-
 
1707
                <input type="hidden" name="question-slug" id="question-slug" />
-
 
1708
                <div class="modal-content">
-
 
1709
                    <div class="modal-header">
-
 
1710
                        <h4 class="modal-title">LABEL_ADD LABEL_QUESTION</h4>
-
 
1711
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-
 
1712
                            <span aria-hidden="true">&times;</span>
-
 
1713
                        </button>
-
 
1714
                    </div>
-
 
1715
                    <div class="modal-body">
-
 
1716
                        <div class="form-group">
-
 
1717
                            <label for="question-text">LABEL_TEXT</label>
-
 
1718
                            <!--  ckeditor -->
-
 
1719
                            <textarea  name="question-text" id="question-text" rows="5" class="ckeditor form-control"></textarea>
-
 
1720
                        </div>
-
 
1721
                        <div class="form-group">
-
 
1722
                            <label for="question-value">LABEL_VALUE</label>
-
 
1723
                            <input type="text" name="question-value" id="question-value"  class="form-control" />
-
 
1724
                        </div>
-
 
1725
                        <div class="form-group">
-
 
1726
                            <label for="question-type">LABEL_TYPE</label>
-
 
1727
                            <select name="question-type" id="question-type" class="form-control">
-
 
1728
                                <option value="open">LABEL_OPEN</option>
-
 
1729
                                <option value="simple">Simple</option>
-
 
1730
                                <option value="multiple">Multiple</option>
-
 
1731
                                <option value="rating-open">LABEL_RATING_OPEN</option>
-
 
1732
                                <option value="rating-range">LABEL_RATING_RANGE</option>
-
 
1733
                            </select>
-
 
1734
                        </div>
-
 
1735
                        <div class="form-group">
-
 
1736
                            <label for="question-max-length">LABEL_MAXLENGTH</label>
-
 
1737
                            <input type="text" name="question-max-length" id="question-max-length"  class="form-control" />
-
 
1738
                        </div>
-
 
1739
                        <div class="form-group">
-
 
1740
                            <label for="question-multiline">LABEL_MULTI_LINE</label>
-
 
1741
                            <select name="question-multiline" id="question-multiline" class="form-control">
-
 
1742
                                <option value="1">LABEL_YES</option>
-
 
1743
                                <option value="0">LABEL_NOT</option>
-
 
1744
                            </select>
-
 
1745
                        </div>
-
 
1746
                        <div class="form-group">
-
 
1747
                            <label for="question-range">LABEL_RANGE</label>
-
 
1748
                            <select name="question-range" id="question-range" class="form-control">
-
 
1749
                                <option value="10">1-10</option>
-
 
1750
                                <option value="6">1-6</option>
-
 
1751
                                <option value="5">1-5</option>
-
 
1752
                            </select>
-
 
1753
                        </div>
-
 
1754
                    </div>
-
 
1755
                    <div class="modal-footer">
-
 
1756
                        <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
1757
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
Línea 1533... Línea 1758...
1533
    <!-- End Modal Section -->
1758
                    </div>
Línea 1534... Línea 1759...
1534
 
1759
                </div>
Línea -... Línea 1760...
-
 
1760
            </form>
1535
    <!-- Question Modal -->
1761
        </div>
-
 
1762
    </div>
-
 
1763
 
-
 
1764
    <!-- End Modal Question -->
-
 
1765
 
-
 
1766
    <!-- Modal Options -->
-
 
1767
 
-
 
1768
    <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
-
 
1769
        <div class="modal-dialog modal-lg" role="document">
-
 
1770
            <form action="#" name="form-option" id="form-option">
-
 
1771
                <input type="hidden" name="option-section" id="option-section" value="" />
-
 
1772
                <input type="hidden" name="option-question" id="option-question" value="" />
-
 
1773
                <input type="hidden" name="question-type" id="question-type" value="" />
-
 
1774
                <input type="hidden" name="option-slug" id="option-slug" value="" />
-
 
1775
                <div class="modal-content">
-
 
1776
                    <div class="modal-header">
-
 
1777
                        <h4 class="modal-title">LABEL_OPTION</h4>
-
 
1778
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-
 
1779
                            <span aria-hidden="true">&times;</span>
-
 
1780
                        </button>
-
 
1781
                    </div>
-
 
1782
                    <div class="modal-body">
-
 
1783
                        <div class="form-group">
-
 
1784
                            <label for="option-text">LABEL_TEXT</label>
-
 
1785
                            <!--  ckeditor -->
-
 
1786
                            <textarea  name="option-text" id="option-text" rows="5" class="ckeditor form-control"></textarea>
-
 
1787
                        </div>
-
 
1788
                        <div class="form-group">
-
 
1789
                            <label for="option-correct">LABEL_ANSWER_CORRECT</label>
-
 
1790
                            <select name="option-correct" id="option-correct" class="form-control">
-
 
1791
                                <option value="1">LABEL_YES</option>
-
 
1792
                                <option value="0">LABEL_NOT</option>
-
 
1793
                            </select>
-
 
1794
                        </div>
-
 
1795
                        <div class="form-group">
-
 
1796
                            <label for="option-value">LABEL_VALUE</label>
-
 
1797
                            <input type="text" name="option-value" id="option-value" class="form-control" />
-
 
1798
                        </div>
-
 
1799
                    </div>
-
 
1800
                    <div class="modal-footer">
1536
 
1801
                        <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
Línea 1537... Línea 1802...
1537
<?php echo $this->partial('modals/questions.phtml'); ?>
1802
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
Línea 1538... Línea 1803...
1538
 
1803
                    </div>
1539
    <!-- End Modal Question -->
1804
                </div>