Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1037 Rev 1038
Línea 456... Línea 456...
456
        renderData(sections);
456
        renderData(sections);
457
    }
457
    }
458
    /**
458
    /**
459
     * Add Option to array
459
     * Add Option to array
460
     */
460
     */
461
    const addOption = (section, title) => {
461
    const addOption = (id_section, title) => {
462
        sections.map((item) => {
462
        sections.map((item) => {
463
            if (item.id_option == section) {
463
            if (item.id_section == id_section) {
464
                item.options.push({
464
                item.options.push({
465
                    'id_option': new Date().getTime(),
465
                    'id_option': new Date().getTime(),
466
                    'title': title,
466
                    'title': title,
467
                });
467
                });
468
            }
468
            }
Línea 470... Línea 470...
470
        renderData(sections);
470
        renderData(sections);
471
    }
471
    }
472
    /**
472
    /**
473
     * Edit item Option
473
     * Edit item Option
474
     */
474
     */
475
    const editOption = (section, id, tilte) => {
475
    const editOption = (id_section, id, tilte) => {
476
        sections.map((item) => {
476
        sections.map((item) => {
477
            if (item.id_section == section) {
477
            if (item.id_section == id_section) {
478
                item.options.map((opt) => {
478
                item.options.map((opt) => {
479
                    if (opt.id_option == id) {
479
                    if (opt.id_option == id) {
480
                        opt.title = title
480
                        opt.title = title
481
                    }
481
                    }
482
                });
482
                });
Línea 485... Línea 485...
485
        renderData(sections);
485
        renderData(sections);
486
    }
486
    }
487
    /**
487
    /**
488
     * Remove Option
488
     * Remove Option
489
     */
489
     */
490
    const removeOption = (section, id) => {
490
    const removeOption = (id_section, id) => {
491
        sections.map((item) => {
491
        sections.map((item) => {
492
            if (item.id_section == section) {
492
            if (item.id_section == id_section) {
493
                item.options = item.options.filter((opt) => opt.id_option != id) || []
493
                item.options = item.options.filter((opt) => opt.id_option != id) || []
494
            }
494
            }
495
        });
495
        });
496
        renderData(sections);
496
        renderData(sections);
497
    }
497
    }