Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 8363 Rev 8364
Línea 1274... Línea 1274...
1274
    });
1274
    });
1275
    /**
1275
    /**
1276
     * Clicked save and continue new Form
1276
     * Clicked save and continue new Form
1277
     */
1277
     */
1278
    $('button.btn-form-save-continue').click(function(e) {
1278
    $('button.btn-form-save-continue').click(function(e) {
1279
        e.preventDefault();
1279
        for (var instanceName in CKEDITOR.instances) {
1280
        $('#form-main #form-continue').val('1')
1280
            CKEDITOR.instances[instanceName].updateElement();
1281
       
1281
        }
-
 
1282
        saveData(1);
1282
    });
1283
    });
1283
    /**
1284
    /**
1284
     * Clicked save and close new/edit Form
1285
     * Clicked save and close new/edit Form
1285
     */
1286
     */
1286
    $('button.btn-form-save-close').click(function(e) {
1287
    $('button.btn-form-save-close').click(function(e) {
1287
        e.preventDefault();
1288
        e.preventDefault();
1288
        $('#form-main #form-continue').val('0')
1289
        $('#form-main #form-continue').val('0')
1289
        $('#form-main').submit();
1290
        $('#form-main').submit();
1290
    });
1291
    });
-
 
1292
 
-
 
1293
    const saveData = (action) => {
-
 
1294
       
-
 
1295
            $.ajax({
-
 
1296
                'dataType': 'json',
-
 
1297
                'method': 'post',
-
 
1298
                'url': $('#form-main').attr('action'),
-
 
1299
                'data': {
-
 
1300
                    'name': $('#form-main #form-name').val(),
-
 
1301
                   
-
 
1302
                    'status': $('#form-main #form-status').val(),
-
 
1303
                    'description': $('#form-main #form-description').val(),
-
 
1304
                    'content': JSON.stringify(sections)
-
 
1305
                },
-
 
1306
            }).done(function(response) {
-
 
1307
                if (response['success']) {
-
 
1308
                    $.fn.showSuccess(response['data']);
-
 
1309
                    if (action == 1) {
-
 
1310
                        $('#form-main').attr('action', response['action_edit']);
-
 
1311
                    } else {
-
 
1312
                        $('#row-form').hide();
-
 
1313
                        $('#row-lists').show();
-
 
1314
                        /*---------- Reset Form -------- */
-
 
1315
                        $('#form-main')[0].reset();
-
 
1316
                        /*--------Reset Sections ----------*/
-
 
1317
                        sections = [];
-
 
1318
                        tableForm.fnDraw();
-
 
1319
                    }
-
 
1320
                    return;
-
 
1321
                } else {
-
 
1322
                    $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
-
 
1323
                    return;
-
 
1324
                }
-
 
1325
            });
-
 
1326
        
-
 
1327
    }
-
 
1328
 
1291
    /**
1329
    /**
1292
     * Modal Settings
1330
     * Modal Settings
1293
     */
1331
     */
1294
    $('#modal-section, #modal-question, #modal-option').modal({
1332
    $('#modal-section, #modal-question, #modal-option').modal({
1295
        backdrop: 'static',
1333
        backdrop: 'static',