Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17219 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17219 Rev 17221
Línea 471... Línea 471...
471
                method: 'get',
471
                method: 'get',
472
                url: '$routeAdd'
472
                url: '$routeAdd'
473
            })
473
            })
474
                .done(function (response) {
474
                .done(function (response) {
475
                    if (response['success']) {
475
                    if (response['success']) {
476
                        $('#form-add #table-capsules-add tbody').empty()
-
 
477
 
-
 
478
                        $('#form-add #capsule_uuid_add').children().not(':first').remove()
476
                        $('#form-add #capsule_uuid').children().not(':first').remove()
479
                        $.each(response['data']['capsules'], function (index, element) {
477
                        $.each(response['data']['capsules'], function (index, element) {
480
                            $('#form-add #capsule_uuid_add').append(
478
                            $('#form-add #capsule_uuid').append(
481
                                $('<option>', {
479
                                $('<option>', {
482
                                    value: element.uuid,
480
                                    value: element.uuid,
483
                                    text: element.name
481
                                    text: element.name
484
                                })
482
                                })
485
                            )
483
                            )
Línea 530... Línea 528...
530
            })
528
            })
531
                .done(function (response) {
529
                .done(function (response) {
532
                    if (response['success']) {
530
                    if (response['success']) {
533
                        $('#form-edit').attr('action', url)
531
                        $('#form-edit').attr('action', url)
Línea 534... Línea 532...
534
 
532
 
Línea 535... Línea 533...
535
                        $('#form-edit #capsule_uuid_edit').children().not(':first').remove()
533
                        $('#form-edit #capsule_uuid').children().not(':first').remove()
536
 
534
 
537
                        $.each(response['data']['capsules'], function (index, element) {
535
                        $.each(response['data']['capsules'], function (index, element) {
538
                            $('#form-edit #capsule_uuid_edit').append(
536
                            $('#form-edit #capsule_uuid').append(
539
                                $('<option>', {
537
                                $('<option>', {
540
                                    value: element.uuid,
538
                                    value: element.uuid,
541
                                    text: element.name,
539
                                    text: element.name,
542
                                    selected: element.selected
540
                                    selected: element.selected
543
                                })
-
 
544
                            )
541
                                })
545
 
-
 
546
                            if (element.selected) {
-
 
547
                                let data = {
-
 
548
                                    id: element.uuid,
-
 
549
                                    name: element.name
-
 
550
                                }
542
                            )
551
 
-
 
552
                                $('#form-edit #table-capsules-edit tbody').append(
-
 
553
                                    $('#trCapsuleTemplate').render(data)
543
                            if (element.selected) {
554
                                )
544
                                $('#form-edit #capsule_uuid').val(element.uuid)
Línea 555... Línea 545...
555
                            }
545
                            }
556
                        })
546
                        })
Línea 791... Línea 781...
791
            maxFileCount: 1,
781
            maxFileCount: 1,
792
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $marketplace_size',
782
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $marketplace_size',
793
            allowedFileExtensions: ['jpeg', 'jpg', 'png']
783
            allowedFileExtensions: ['jpeg', 'jpg', 'png']
794
        })
784
        })
Línea 795... Línea -...
795
 
-
 
796
        // Evento de botón de seleccionar capsule para formulario de agregar
-
 
797
        $('#btn-select-capsule-add').click(function (e) {
-
 
798
            e.preventDefault()
-
 
799
 
-
 
800
            var uuid = $('#capsule_uuid_add option:selected').val()
-
 
801
 
-
 
802
            if (!uuid) return false
-
 
803
 
-
 
804
            var name = $('#capsule_uuid_add option:selected').text()
-
 
805
            var key = '#tr_capsule_uuid_' + uuid
-
 
806
            var element = $(key)
-
 
807
 
-
 
808
            if (element.length > 0) return false
-
 
809
 
-
 
810
            if (name.length > 50) name = name.substr(0, 50) + '...'
-
 
811
 
-
 
812
            let data = { uuid, name }
-
 
813
 
-
 
814
            $('#table-capsules-add tbody').append($('#trCapsuleTemplate').render(data))
-
 
815
 
-
 
816
            return false
-
 
817
        })
-
 
818
 
-
 
819
        // Evento de botón de seleccionar capsule para formulario de editar
-
 
820
        $('#btn-select-capsule-edit').click(function (e) {
-
 
821
            e.preventDefault()
-
 
822
 
-
 
823
            var uuid = $('#capsule_uuid_edit option:selected').val()
-
 
824
 
-
 
825
            if (!uuid) return false
-
 
826
 
-
 
827
            var name = $('#capsule_uuid_edit option:selected').text()
-
 
828
            var key = '#tr_capsule_uuid_' + uuid
-
 
829
            var element = $(key)
-
 
830
 
-
 
831
            if (element.length > 0) return false
-
 
832
 
-
 
833
            if (name.length > 50) name = name.substr(0, 50) + '...'
-
 
834
 
-
 
835
            let data = { uuid, name }
-
 
836
 
-
 
837
            $('#table-capsules-edit tbody').append($('#trCapsuleTemplate').render(data))
-
 
838
 
-
 
839
            return false
-
 
840
        })
-
 
841
 
785
 
842
        // Configuración del formulario de creación
786
        // Configuración del formulario de creación
843
        $('#capsule_uuid_add').select2({
787
        $('#form-add #capsule_uuid').select2({
844
            theme: 'bootstrap-5',
788
            theme: 'bootstrap-5',
845
            width: '100%',
789
            width: '100%',
846
            placeholder: 'LABEL_SELECT',
790
            placeholder: 'LABEL_SELECT',
847
            multiple: true
791
            multiple: true
Línea 848... Línea 792...
848
        })
792
        })
849
 
793
 
850
        // Configuración del formulario de edición
794
        // Configuración del formulario de edición
851
        $('#capsule_uuid_edit').select2({
795
        $('#form-edit #capsule_uuid').select2({
852
            theme: 'bootstrap-5',
796
            theme: 'bootstrap-5',
853
            width: '100%',
797
            width: '100%',
854
            placeholder: 'LABEL_SELECT',
798
            placeholder: 'LABEL_SELECT',
Línea 855... Línea -...
855
            multiple: true
-
 
856
        })
-
 
857
 
-
 
858
        // Evento para remover cápsulas de las tablas
-
 
859
        $('body').on('click', '.btn-remove-capsule', function (e) {
-
 
860
            e.preventDefault()
-
 
861
            var uuid = $(this).data('uuid')
-
 
862
            $('#tr_capsule_uuid_' + uuid).remove()
-
 
863
            return false
799
            multiple: true
864
        })
800
        })
865
 
801
 
866
        // Configuración del editor de CKEditor para el formulario de creación
802
        // Configuración del editor de CKEditor para el formulario de creación
867
        CKEDITOR.replace('description_add', {
803
        CKEDITOR.replace('description_add', {
Línea 1092... Línea 1028...
1092
                        ?>
1028
                        ?>
1093
                    </div>
1029
                    </div>
1094
                </div>
1030
                </div>
Línea 1095... Línea 1031...
1095
 
1031
 
1096
                <div class="row">
-
 
1097
                    <div class="col-8 mt-3">
-
 
1098
                        <select name="capsule_uuid_add" id="capsule_uuid_add">
-
 
1099
                            <option value="">LABEL_SELECT</option>
-
 
1100
                        </select>
-
 
1101
                    </div>
-
 
1102
                    <div class="col-4 mt-3">
-
 
1103
                        <button type="button" class="btn btn-primary" id="btn-select-capsule-add" data-toggle="tooltip" title="LABEL_ADD LABEL_CAPSULE">LABEL_ADD LABEL_CAPSULE</button>
-
 
1104
                    </div>
-
 
1105
                </div>
-
 
1106
                
-
 
1107
                <div class="row">
1032
                <div class="row">
1108
                    <div class="col-12 mt-3">
-
 
1109
                        <table id="table-capsules-add" class="table table-bordered">
1033
                    <div class="col-12 mt-3">
1110
                            <thead>
1034
                        <?php
1111
                                <tr>
1035
                        $element = $form->get('capsule_uuid');
1112
                                    <th>LABEL_NAME</th>
1036
                        $element->setAttributes(['class' => 'form-control']);
1113
                                    <th>LABEL_ACTIONS</th>
-
 
1114
                                </tr>
1037
                        $element->setOptions(['label' => 'LABEL_CAPSULE']);
1115
                            </thead>
1038
                        echo $this->formLabel($element);
1116
                            <tbody>
-
 
1117
                            </tbody>
1039
                        echo $this->formSelect($element);
1118
                        </table>
1040
                        ?>
1119
                    </div>
1041
                    </div>
-
 
1042
                </div>
-
 
1043
                
1120
                </div>
1044
                
Línea 1121... Línea 1045...
1121
            </div>
1045
            </div>
1122
            
1046
            
1123
            <div class="card-footer text-right">
1047
            <div class="card-footer text-right">
Línea 1255... Línea 1179...
1255
                        ?>
1179
                        ?>
1256
                    </div>
1180
                    </div>
1257
                </div> 
1181
                </div> 
Línea 1258... Línea 1182...
1258
 
1182
 
1259
                <div class="row">
-
 
1260
                    <div class="col-8 mt-3">
-
 
1261
                        <select name="capsule_uuid_edit" id="capsule_uuid_edit">
-
 
1262
                            <option value="">LABEL_SELECT</option>
-
 
1263
                        </select>
-
 
1264
                    </div>
-
 
1265
                    <div class="col-4 mt-3">
-
 
1266
                        <button type="button" class="btn btn-primary" id="btn-select-capsule-edit" data-toggle="tooltip" title="LABEL_ADD LABEL_CAPSULE">LABEL_ADD LABEL_CAPSULE</button>
-
 
1267
                    </div>
-
 
1268
                </div>
-
 
1269
                
-
 
1270
                <div class="row">
1183
                <div class="row">
1271
                    <div class="col-12 mt-3">
-
 
1272
                        <table id="table-capsules-edit" class="table table-bordered">
1184
                    <div class="col-12 mt-3">
1273
                            <thead>
1185
                        <?php
1274
                                <tr>
1186
                        $element = $form->get('capsule_uuid');
1275
                                    <th>LABEL_NAME</th>
1187
                        $element->setAttributes(['class' => 'form-control']);
1276
                                    <th>LABEL_ACTIONS</th>
-
 
1277
                                </tr>
1188
                        $element->setOptions(['label' => 'LABEL_CAPSULE']);
1278
                            </thead>
1189
                        echo $this->formLabel($element);
1279
                            <tbody>
-
 
1280
                            </tbody>
1190
                        echo $this->formSelect($element);
1281
                        </table>
1191
                        ?>
1282
                    </div>
1192
                    </div>
1283
                </div>
1193
                </div>
Línea 1284... Línea 1194...
1284
            </div>
1194
            </div>
Línea 1384... Línea 1294...
1384
				<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
1294
				<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
1385
			</div>
1295
			</div>
Línea 1386... Línea 1296...
1386
 
1296
 
1387
		</div>
1297
		</div>
1388
	</div>
-
 
1389
</div>
-
 
1390
 
-
 
1391
<script id="trCapsuleTemplate" type="text/x-jsrender">
-
 
1392
    <tr id="tr_capsule_uuid_{{:uuid}}">
-
 
1393
       <td class="text-left">
-
 
1394
            <input type="hidden" class="capsule_uuid" name="capsule_uuid" value="{{:uuid}}" />      
-
 
1395
            <span class="d-none d-md-inline">{{:name}}</span>
-
 
1396
       </td>   
-
 
1397
       <td>
-
 
1398
            <button class="btn btn-default btn-remove-capsule" data-uuid="{{:uuid}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE">
-
 
1399
                <i class="fa fa-ban" aria-hidden="true"></i>
-
 
1400
                <span class="d-none d-md-inline">LABEL_DELETE</span>
-
 
1401
            </button>   
-
 
1402
       </td>
-
 
1403
   </tr>
-
 
1404
</script>
1298
	</div>
-
 
1299
</div>
1405
1300