Plugin Directory

Changeset 3232565


Ignore:
Timestamp:
01/31/2025 11:32:49 AM (13 months ago)
Author:
blafoley
Message:

feat: added re-order capability to items added in a notebook

Location:
project-notebooks/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • project-notebooks/trunk/assets/css/pto-admin-custom.css

    r3192750 r3232565  
    1212span.sorting-indicator {
    1313    display: inline-block;
     14}
     15ul.pto-project-user-section-desc-details-ul {
     16    max-height: 329px;
     17    overflow-y: scroll;
    1418}
    1519
  • project-notebooks/trunk/assets/js/pto-admin-custom.js

    r3219402 r3232565  
    12041204     tinymce.init( window.tinyMCEPreInit.mceInit[ "keyinfo" ] );
    12051205} )
     1206
     1207// Include jQuery UI
     1208jQuery(document).ready(function() {
     1209  // Initialize DataTable with no pagination, no search, no info, and sorting enabled
     1210  jQuery('#pto-meeting_table').DataTable({
     1211    paging: false,      // Disable pagination
     1212    searching: false,   // Disable search bar
     1213    info: false,        // Disable the information display (like "Showing 1 to 10 of 50 entries")
     1214    ordering: true,     // Enable sorting
     1215    dom: 't',           // Use only table without pagination or search box
     1216  });
     1217
     1218  // Make table rows draggable
     1219  jQuery('#pto-meeting_table tbody').sortable({
     1220    items: 'tr', // Make individual rows draggable
     1221    cursor: 'move', // Change the cursor style when dragging
     1222    stop: function(event, ui) { // Trigger the update after sorting is completed
     1223        let data_sorting = [];
     1224        let type = "";
     1225        // Collect the sorted post IDs
     1226        jQuery('#pto-meeting_table tbody tr').each(function() {
     1227            let id = jQuery(this).attr("post-id");
     1228            data_sorting.push(id); // Add to array of sorted post IDs
     1229            type = jQuery(this).attr("type");
     1230        });
     1231
     1232        let post_id = jQuery("#post_ID").val();
     1233
     1234        // Send the AJAX request with the sorted data
     1235        jQuery.ajax({
     1236            method: "POST",
     1237            url: custom.ajax_url,
     1238            data: {
     1239                action: "pto_notebook_meeting_notes_sorting",
     1240                datas: data_sorting,
     1241                type: type,
     1242                nonce: custom.nonce,
     1243                post_id: post_id
     1244            },
     1245            success: function(response) {
     1246                // Handle the success response here if needed
     1247            }
     1248        });
     1249    }
     1250});
     1251
     1252  jQuery('#pto-note_table').DataTable({
     1253    paging: false,      // Disable pagination
     1254    searching: false,   // Disable search bar
     1255    info: false,        // Disable the information display (like "Showing 1 to 10 of 50 entries")
     1256    ordering: true,     // Enable sorting
     1257    dom: 't',           // Use only table without pagination or search box
     1258  });
     1259
     1260  // Make table rows draggable
     1261  jQuery('#pto-note_table tbody').sortable({
     1262    items: 'tr', // Make individual rows draggable
     1263    cursor: 'move', // Change the cursor style when dragging
     1264    stop: function(event, ui) { // Trigger the update after sorting is completed
     1265        let data_sorting = [];
     1266        let type = "";
     1267        // Collect the sorted post IDs
     1268        jQuery('#pto-note_table tbody tr').each(function() {
     1269            let id = jQuery(this).attr("post-id");
     1270            data_sorting.push(id); // Add to array of sorted post IDs
     1271            type = jQuery(this).attr("type");
     1272        });
     1273
     1274        let post_id = jQuery("#post_ID").val();
     1275
     1276        // Send the AJAX request with the sorted data
     1277        jQuery.ajax({
     1278            method: "POST",
     1279            url: custom.ajax_url,
     1280            data: {
     1281                action: "pto_notebook_meeting_notes_sorting",
     1282                datas: data_sorting,
     1283                type: type,
     1284                nonce: custom.nonce,
     1285                post_id: post_id
     1286            },
     1287            success: function(response) {
     1288                // Handle the success response here if needed
     1289            }
     1290        });
     1291    }
     1292});
     1293});
  • project-notebooks/trunk/includes/class-ptoffice.php

    r2762677 r3232565  
    5050
    5151        add_filter( 'plugin_action_links', array($this,'misha_settings_link'), 10, 2 );
     52
     53
     54        add_action('wp_ajax_nopriv_pto_notebook_meeting_notes_sorting', array($this, 'pto_notebook_meeting_notes_sorting'));
     55        add_action('wp_ajax_pto_notebook_meeting_notes_sorting', array($this, 'pto_notebook_meeting_notes_sorting'));
     56    }
     57
     58    public function pto_notebook_meeting_notes_sorting(){
     59        if (!wp_verify_nonce($_POST['nonce'], 'ajax-nonce')) {
     60            die('Busted!');
     61        }
     62        if( isset($_POST['datas']) ){
     63            $datas = array_filter($_POST['datas']);
     64            $post_id = intval($_POST['post_id']);
     65            $all_post_data = get_post_meta($post_id, "pto_sub_menu_cpt_add", true);
     66
     67            $get_progect_listing_cpt = json_decode($all_post_data);
     68            $get_progect_listing_cpt = (array) $get_progect_listing_cpt;
     69            $remaining_values = array_diff_key($get_progect_listing_cpt, $datas);
     70
     71            $new_sort_array = array();
     72            echo "<pre>";
     73            print_r($datas);
     74            echo "</pre>";
     75            foreach( $datas as $v ){
     76                $new_sort_array[$v] =$v;
     77            }
     78            foreach( $get_progect_listing_cpt as $key => $value ){
     79                if( $value != 0 ){
     80                    $new_sort_array[$key] =$key;   
     81                }
     82            }           
     83            $new_sort_array = json_encode( $new_sort_array );
     84           
     85            update_post_meta( $post_id, "pto_sub_menu_cpt_add", $new_sort_array );
     86            die();           
     87        }
    5288    }
    5389
     
    187223            wp_enqueue_style('jquery-ui-css',  PTO_NB_MYPL_PLUGIN_BASEDIR_PATH . '/assets/kanbanboard/jquery-ui.css',  '1.0.20', true);
    188224            wp_enqueue_style('pto-admin-custom-css', PTO_NB_MYPL_PLUGIN_BASEDIR_PATH .  '/assets/css/pto-admin-custom.css');
     225            wp_enqueue_style('pto-admin-dataTables-css', PTO_NB_MYPL_PLUGIN_BASEDIR_PATH .  '/assets/css/jquery.dataTables.css');
     226           
    189227            //wp_enqueue_style('pto-admin-frontend-custom-css', PTO_NB_MYPL_PLUGIN_BASEDIR_PATH .  '/assets/css/pto-project-frontend-css.css');
    190228            wp_enqueue_style('pto-admin-frontend-custom-responsive-css', PTO_NB_MYPL_PLUGIN_BASEDIR_PATH . '/assets/css/pto-project-responsive-frontend.css');
     
    194232             * Enqueue necessary scripts
    195233             */
     234
     235
     236            wp_enqueue_script('jquery-dataTables', PTO_NB_MYPL_PLUGIN_BASEDIR_PATH . '/assets/js/jquery.dataTables.js', array('jquery'), '1.0.0', true);
     237
     238
    196239            wp_enqueue_script('jquery-spectrum', PTO_NB_MYPL_PLUGIN_BASEDIR_PATH . '/assets/kanbanboard/spectrum.min.js', array('jquery'), '1.0.0', true);
    197240           // wp_enqueue_script('jquery-ui', PTO_NB_MYPL_PLUGIN_BASEDIR_PATH .  '/assets/kanbanboard/jquery-ui.js', array('jquery'), '1.0.0', true);
  • project-notebooks/trunk/includes/ptoffice_cptlist.php

    r2736046 r3232565  
    4747        $project_id = $cpt_get_arr_list_detail['filter']['metadata']['pto_associated_project_id'];
    4848        $all_post_data = get_post_meta($project_id, "pto_sub_menu_cpt_add", true);
     49       
    4950        $get_progect_listing_cpt = json_decode($all_post_data);
    5051        $get_progect_listing_cpt = (array) $get_progect_listing_cpt;
     52
    5153        foreach ($get_progect_listing_cpt as $key => $cpt_single_datas) {
    5254            $id = $cpt_single_datas;
  • project-notebooks/trunk/includes/structure/pto_listing_project_cpt/pto_listing_cpt_project_details.php

    r3219402 r3232565  
    66    $tbl_tr_class = "tr-task-status-details-" . $id;
    77}
    8 $cpt_html_header .= '<tr class="' . $tbl_tr_class . '"><td><div class="cpt-single-record-details"><div class="pto_cpt_get_details_checkbox-cpt">
     8$cpt_html_header .= '<tr draggable="true" type="'. $post_type .'" post-id="'.$id.'" class="' . $tbl_tr_class . '"><td><div class="cpt-single-record-details"><div class="pto_cpt_get_details_checkbox-cpt">
    99<input type="checkbox" name="checkall" class="checkall_'.$post_type.'" post-id="'.$id.'">
    1010</div></td>';
  • project-notebooks/trunk/ptoffice.php

    r3219402 r3232565  
    44 * Plugin Name: PT Project Notebooks - Take meeting minutes, create budgets, track task management and more
    55 * Description: A unique information manager, PT Project Notebooks allows you to assign, plan, organize, share and manage any event, committee, or meeting with a simple-to-use interface. Perfect for committee chairs or event coordinators. Don’t recreate the wheel event after event - use PT Project Notebooks.
    6  * Version: 1.1.1
     6 * Version: 1.1.2
    77 * Author: MJS Software
    88 * Author URI: https://mjssoftware.com
  • project-notebooks/trunk/readme.txt

    r3219402 r3232565  
    55Tested up to: 6.5
    66Requires PHP: 8.0
    7 Stable tag: 1.1.1
     7Stable tag: 1.1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • project-notebooks/trunk/single-pto-project.php

    r3219402 r3232565  
    276276                                                                                <td><p>
    277277                                                                                    <?php
     278
     279                                                                                    // echo $budget_price_current;
    278280                                                                                    if ($budget_price_type == "expense") {
    279                                                                                         echo "-$" . number_format($budget_price_current,2);
     281                                                                                        echo "-$" . $budget_price_current;
    280282                                                                                    }else{
    281                                                                                         echo "$" . number_format($budget_price_current,2);
     283                                                                                        echo "$" . $budget_price_current;
    282284                                                                                    }
    283285                                                                                    ?>
     
    298300                                                        $budget_price = number_format($budget_price, 2, '.', ',');
    299301                                                        ?>
    300                                                         <h6 class='pto-header-six'>$<?php echo esc_html_e(number_format($budget_price,2)); ?></h6>
     302                                                        <h6 class='pto-header-six'>$<?php echo esc_html_e($budget_price); ?></h6>
    301303                                                    </div>
    302304
Note: See TracChangeset for help on using the changeset viewer.