Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 8775 Rev 15458
Línea 218... Línea 218...
218
                        });
218
                        });
219
                    },
219
                    },
220
                });
220
                });
221
            },
221
            },
222
            'aoColumns': [
222
            'aoColumns': [
223
                { 'mDataProp': 'id' },
223
                { 'mDataProp': 'code' },
224
                { 'mDataProp': 'title' },
224
                { 'mDataProp': 'title' },
225
                { 'mDataProp': 'status' },
225
                { 'mDataProp': 'status' },
226
                { 'mDataProp': 'actions' },
226
                { 'mDataProp': 'actions' },
227
    	    ],
227
    	    ],
228
            'columnDefs': [
228
            'columnDefs': [
Línea 254... Línea 254...
254
                        
254
                        
255
                        if(allowEdit &&  data['link_edit']) {
255
                        if(allowEdit &&  data['link_edit']) {
256
                            s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
256
                            s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
257
                        }
257
                        }
258
                        if(allowDelete && data['link_delete']) {
258
                        if(allowDelete && data['link_delete']) {
259
                            //s = s + '<button class="btn btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i></button>&nbsp;';
259
                            s = s + '<button class="btn btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
260
                        }
260
                        }
261
                        return s;
261
                        return s;
262
                    }
262
                    }
263
                }
263
                }
Línea 269... Línea 269...
269
            debug: true,
269
            debug: true,
270
            onclick: false,
270
            onclick: false,
271
            onkeyup: false,
271
            onkeyup: false,
272
            ignore: [],
272
            ignore: [],
273
            rules: {
273
            rules: {
274
                'id': {
274
                'code': {
275
                    required: true,
275
                    required: true,
276
                    maxlength: 64,
276
                    maxlength: 64,
277
                },
277
                },
278
                'title': {
278
                'title': {
279
                    required: true,
279
                    required: true,
Línea 301... Línea 301...
301
        $('body').on('click', 'button.btn-add', function(e) {
301
        $('body').on('click', 'button.btn-add', function(e) {
302
            e.preventDefault();
302
            e.preventDefault();
Línea 303... Línea 303...
303
 
303
 
304
            $('span[id="form-title"]').html('LABEL_ADD');
304
            $('span[id="form-title"]').html('LABEL_ADD');
305
            $('#form').attr('action', '$routeAdd');
305
            $('#form').attr('action', '$routeAdd');
306
            $('#form #id').val('');
306
            $('#form #code').val('');
307
            $('#form #id').removeAttr('disabled');
307
            $('#form #code').removeAttr('disabled');
308
            $('#form #title').val('');
308
            $('#form #title').val('');
309
            $('#form #type').val('$typePAGE').trigger('change');
309
            $('#form #type').val('$typePAGE').trigger('change');
310
            $('#form #status').bootstrapToggle('on');
310
            $('#form #status').bootstrapToggle('on');
311
            CKEDITOR.instances.content.setData('');
311
            CKEDITOR.instances.content.setData('');
Línea 312... Línea 312...
312
            $('#form #url').val('');
312
            $('#form #url').val('');
-
 
313
 
-
 
314
 
-
 
315
            validator.resetForm();
313
 
316
 
-
 
317
            $('#row-header').hide();
314
 
318
            $('#row-list').hide();
Línea 315... Línea 319...
315
            validator.resetForm();
319
            $('#row-form').show();
316
            $('#modal').modal('show');
320
 
317
        });
321
        });
Línea 329... Línea 333...
329
            }).done(function(response) {
333
            }).done(function(response) {
330
                if(response['success']) {
334
                if(response['success']) {
Línea 331... Línea 335...
331
 
335
 
332
                    $('span[id="form-title"]').html('LABEL_EDIT');
336
                    $('span[id="form-title"]').html('LABEL_EDIT');
333
                    $('#form').attr('action', action);
337
                    $('#form').attr('action', action);
334
                    $('#form #id').val(response['data']['id']);   
338
                    $('#form #code').val(response['data']['code']);   
335
                    $('#form #id').attr('disabled','disabled');
339
                    $('#form #code').attr('disabled','disabled');
336
                    $('#form #title').val(response['data']['title']);
340
                    $('#form #title').val(response['data']['title']);
337
                    $('#form #type').val(response['data']['type']).trigger('change');
341
                    $('#form #type').val(response['data']['type']).trigger('change');
Línea 338... Línea 342...
338
                    $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
342
                    $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
339
 
343
 
340
                    var content = $.trim(response['data']['content']);
344
                    var content = $.trim(response['data']['content']);
Línea 341... Línea 345...
341
                    CKEDITOR.instances.content.setData(content.length > 0 ? content : '');
345
                    CKEDITOR.instances.content.setData(content.length > 0 ? content : '');
Línea -... Línea 346...
-
 
346
                    $('#form #url').val(response['data']['url']);
-
 
347
 
342
                    $('#form #url').val(response['data']['url']);
348
                    validator.resetForm();
-
 
349
                    
343
 
350
                    $('#row-header').hide();
344
                    validator.resetForm();
351
                    $('#row-list').hide();
345
                    
352
                    $('#row-form').show();
346
                    $('#modal').modal('show');
353
 
347
                } else {
354
                } else {
Línea 360... Línea 367...
360
        });
367
        });
Línea 361... Línea 368...
361
        
368
        
362
 
369
 
363
        $('body').on('click', 'button.btn-cancel', function(e) {
370
        $('body').on('click', 'button.btn-cancel', function(e) {
-
 
371
            e.preventDefault();
-
 
372
            $('#row-form').hide();
-
 
373
 
-
 
374
            $('#row-header').show();
-
 
375
            $('#row-list').show();
364
            e.preventDefault();
376
            
Línea 365... Línea 377...
365
            $('#modal').modal('hide');
377
 
366
        });
378
        });
367
 
379
 
Línea 395... Línea 407...
395
                $.ajax({
407
                $.ajax({
396
                    'dataType'  : 'json',
408
                    'dataType'  : 'json',
397
                    'accept'    : 'application/json',
409
                    'accept'    : 'application/json',
398
                    'method'    : 'post',
410
                    'method'    : 'post',
399
                    'url'       :  $('#form').attr('action'),
411
                    'url'       :  $('#form').attr('action'),
-
 
412
                    'data'      :  {
-
 
413
                        'code': $('#form #code').val(),
-
 
414
                        'title': $('#form #title').val(),
400
                    'data'      :  $('#form').serialize()
415
                        'type' : $('#form #type').val(),
-
 
416
                        'content':$('#form #content').val(),
-
 
417
                        'url': $('#form #url').val(),
-
 
418
                        'status': $('#form #status').val(),
-
 
419
                  }
401
                }).done(function(response) {
420
                }).done(function(response) {
402
                    NProgress.start();
421
                    NProgress.start();
403
                    if(response['success']) {
422
                    if(response['success']) {
404
                        $.fn.showSuccess(response['data']);
423
                        $.fn.showSuccess(response['data']);
Línea 405... Línea 424...
405
                        
424
                        
-
 
425
                        $('#row-form').hide();
-
 
426
                        $('#row-header').show();
406
                        $('#modal').modal('hide');
427
                        $('#row-list').show();
407
                         gridTable.api().ajax.reload(null, false);
428
                         gridTable.api().ajax.reload(null, false);
408
                    } else {
429
                    } else {
409
                        validator.resetForm();
430
                        validator.resetForm();
410
                        if(jQuery.type(response['data']) == 'string') {
431
                        if(jQuery.type(response['data']) == 'string') {
Línea 448... Línea 469...
448
?>
469
?>
Línea 449... Línea 470...
449
  
470
  
450
		
471
		
451
			
472
			
452
<!-- Content Header (Page header) -->
473
<!-- Content Header (Page header) -->
453
<section class="content-header">
474
<section class="content-header" id="row-header">
454
	<div class="container-fluid">
475
	<div class="container-fluid">
455
    	<div class="row mb-2">
476
    	<div class="row mb-2">
456
        	<div class="col-sm-12">
477
        	<div class="col-sm-12">
457
            	<h1>LABEL_PAGES</h1>
478
            	<h1>LABEL_PAGES</h1>
458
			</div>
479
			</div>
Línea 459... Línea 480...
459
		</div>
480
		</div>
460
	</div><!-- /.container-fluid -->
481
	</div><!-- /.container-fluid -->
461
</section>
482
</section>
462
 
483
 
463
<section class="content">
484
<section class="content" id="row-list">
464
	<div class="container-fluid">
485
	<div class="container-fluid">
Línea 491... Línea 512...
491
           	</div>     
512
           	</div>     
492
        </div>          
513
        </div>          
493
 	</div>
514
 	</div>
494
</section> 	
515
</section> 	
Línea -... Línea 516...
-
 
516
 
495
 
517
 
496
<!-- The Modal -->
518
<section class="content" id="row-form" style="display: none">
497
<div class="modal" id="modal">
519
	<div class="container-fluid">
498
	<div class="modal-dialog  modal-xl">
520
    	<div class="row">
499
    	<div class="modal-content">
-
 
500
 
521
        	<div class="col-12">
501
            <!-- Modal Header -->
522
				<div class="card">    
502
      		<div class="modal-header">
523
					<div class="card-header">
503
        		<h4 class="modal-title">LABEL_PAGES - <span id="form-title"></span></h4>
-
 
504
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
524
						<h4>LABEL_PAGES - <span id="form-title"></span></h4>
505
      		</div>
-
 
506
 
-
 
507
            <!-- Modal body -->
525
					</div>                
508
      		<div class="modal-body">
526
					<div class="card-body">
509
       			 <?php 
527
    					<?php 
510
                    $form = $this->form;
528
                        $form = $this->form;
511
            		$form->setAttributes([
529
                		$form->setAttributes([
512
                        'method'    => 'post',
530
                            'method'    => 'post',
513
                        'name'      => 'form',
531
                            'name'      => 'form',
514
                        'id'        => 'form'
532
                            'id'        => 'form'
515
                    ]);
533
                        ]);
516
    
534
        
517
                    $form->prepare();
535
                        $form->prepare();
518
                    echo $this->form()->openTag($form);
536
                        echo $this->form()->openTag($form);
519
                    ?>		
537
                        ?>		
520
                       	<div class="form-group">
538
                           	<div class="form-group">
521
        					<?php 
539
            					<?php 
522
                            $element = $form->get('id');
540
                                $element = $form->get('code');
-
 
541
                                $element->setOptions(['label' => 'LABEL_CODE']);
-
 
542
                                $element->setAttributes(['class' => 'form-control']);
-
 
543
                                                
-
 
544
                                echo $this->formLabel($element);
-
 
545
                                echo $this->formText($element);
-
 
546
                                ?>
-
 
547
    						</div>					
-
 
548
        					<div class="form-group">
-
 
549
            					<?php 
-
 
550
                                $element = $form->get('title');
523
                            $element->setOptions(['label' => 'LABEL_ID']);
551
                                $element->setOptions(['label' => 'LABEL_TITLE']);
524
                            $element->setAttributes(['class' => 'form-control']);
552
                                $element->setAttributes(['class' => 'form-control']);
525
                                            
553
                                                
526
                            echo $this->formLabel($element);
554
                                echo $this->formLabel($element);
-
 
555
                                echo $this->formText($element);
-
 
556
                                ?>
-
 
557
    						</div>
-
 
558
    						<div class="form-group">
-
 
559
                          	<?php 
-
 
560
                                $element = $form->get('type');
-
 
561
                                $element->setOptions(['label' => 'LABEL_TYPE']);
-
 
562
                                $element->setAttributes(['class' => 'form-control']);
-
 
563
                                                
-
 
564
                                echo $this->formLabel($element);
527
                            echo $this->formText($element);
565
                                echo $this->formSelect($element);
528
                            ?>
566
                            ?>
529
						</div>					
567
    						</div>
530
    					<div class="form-group">
568
    						<div class="form-group">
531
        					<?php 
569
                        	<?php 
532
                            $element = $form->get('title');
570
                                $element = $form->get('content');
533
                            $element->setOptions(['label' => 'LABEL_TITLE']);
571
                                $element->setOptions(['label' => 'LABEL_CONTENT']);
534
                            $element->setAttributes(['class' => 'form-control']);
572
                                $element->setAttributes(['class' => 'form-control']);
535
                                            
573
    
536
                            echo $this->formLabel($element);
574
                                echo $this->formLabel($element);
537
                            echo $this->formText($element);
575
                                echo $this->formTextArea($element);
538
                            ?>
576
                            ?>
539
						</div>
577
    						</div>
540
						<div class="form-group">
578
    						<div class="form-group">
541
                      	<?php 
579
            					<?php 
542
                            $element = $form->get('type');
580
                                $element = $form->get('url');
543
                            $element->setOptions(['label' => 'LABEL_TYPE']);
581
                                $element->setOptions(['label' => 'LABEL_URL']);
544
                            $element->setAttributes(['class' => 'form-control']);
582
                                $element->setAttributes(['class' => 'form-control']);
545
                                            
583
                                                
546
                            echo $this->formLabel($element);
584
                                echo $this->formLabel($element);
547
                            echo $this->formSelect($element);
585
                                echo $this->formText($element);
548
                        ?>
586
                                ?>
549
						</div>
587
    						</div>
550
						<div class="form-group">
588
    						<div class="form-group">
551
                    	<?php 
589
                          	<?php 
552
                            $element = $form->get('content');
-
 
553
                            $element->setOptions(['label' => 'LABEL_CONTENT']);
-
 
554
                            $element->setAttributes(['class' => 'form-control']);
-
 
555
 
-
 
556
                            echo $this->formLabel($element);
-
 
557
                            echo $this->formTextArea($element);
-
 
558
                        ?>
-
 
559
						</div>
-
 
560
						<div class="form-group">
-
 
561
        					<?php 
-
 
562
                            $element = $form->get('url');
-
 
563
                            $element->setOptions(['label' => 'LABEL_URL']);
590
                                $element = $form->get('status');
564
                            $element->setAttributes(['class' => 'form-control']);
-
 
565
                                            
591
                                $element->setAttributes(['class' => 'form-control']);
566
                            echo $this->formLabel($element);
-
 
567
                            echo $this->formText($element);
592
                                echo $this->formCheckbox($element);
568
                            ?>
593
                            ?>
569
						</div>
-
 
570
						<div class="form-group">
-
 
571
                      	<?php 
-
 
572
                            $element = $form->get('status');
-
 
573
                            $element->setAttributes(['class' => 'form-control']);
-
 
574
                            echo $this->formCheckbox($element);
-
 
575
                        ?>
-
 
576
						</div>
594
    						</div>
577
								
595
    								
578
        				<div class="form-group">
596
            				<div class="form-group">
579
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
597
                        		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
580
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
598
                        		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
581
                   		</div>
599
                       		</div>
582
     	      		<?php echo $this->form()->closeTag($form); ?>
600
         	      		<?php echo $this->form()->closeTag($form); ?>
583
      		</div>
-
 
584
 
601
					</div>
585
            <!-- Modal footer -->
602
					<div class="card-footer">
586
      		<div class="modal-footer">
-
 
587
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
603
					</div>
588
      		</div>
604
				</div>
589
 
605
			</div>
590
    	</div>
606
		</div>
591
	</div>
-
 
592
</div>   			
-
 
593
			
-
 
594
 
-
 
595
 
-
 
596
 
-
 
597
	
-
 
598
			
-
 
599
			
-
 
600
			
-
 
601
 
-
 
602
 
-
 
603
 
-
 
604
	
-
 
605
		
607
	</div>
-
 
608
</section>