Plugin Directory

Changeset 3137153


Ignore:
Timestamp:
08/18/2024 12:56:16 AM (7 months ago)
Author:
sunnysonic
Message:
  • fixed issue on saving date when marking invoice as paid
  • hovering over invoice/quote name in client profile shows now line items of invoice/quote
  • hovering over invoice/quote name in invoice list of main menu shows now line items of invoice/quote
Location:
wp-easy-crm
Files:
39 added
5 edited

Legend:

Unmodified
Added
Removed
  • wp-easy-crm/trunk/easy-crm.php

    r3136896 r3137153  
    44 * Plugin Name:       Easy CRM
    55 * Description:       Collect new leads, manage clients, quotations, invoices, tasks and more for your entire team
    6  * Version:           1.0.23
     6 * Version:           1.0.24
    77 * Author:            IT-iCO SRL
    88 * Author URI:        https://it-ico.com
  • wp-easy-crm/trunk/readme.txt

    r3136896 r3137153  
    44Requires at least: 5.9
    55Tested up to: 6.6.1
    6 Stable tag: 1.0.23
     6Stable tag: 1.0.24
    77Contributors: sunnysonic
    88License: GPLv2 or later
     
    6060
    6161== Changelog ==
     62
     63= 1.0.24 =
     64* fixed issue on saving date when marking invoice as paid
     65* hovering over invoice/quote name in client profile shows now line items of invoice/quote
     66* hovering over invoice/quote name in invoice list of main menu shows now line items of invoice/quote
    6267
    6368= 1.0.23 =
  • wp-easy-crm/trunk/views/addQuote.php

    r3136889 r3137153  
    2121
    2222if (!empty($action)) {
    23 
    2423 
    2524    if ($action == "delete") {
     
    7776    }
    7877    if ($action == "markpaid") {
    79 
    80         // Update the quote status to "paid" and set the created_at field
    8178        $updated = $wpdb->update(
    8279            $quoteTable,
    8380            array(
    8481                'quotestatus' => 'paid',
    85                 'created_at' => sanitize_text_field($registration_date)
     82                'lastupdate_at' => sanitize_text_field($registration_date)
    8683            ),
    8784            array('id' => $quoteid),
     
    9390        );
    9491   
     92        // Debugging: Log the SQL query
     93        error_log($wpdb->last_query);
     94   
    9595        if ($updated !== false) {
    9696            $msg = "<div class='updated update'>".esc_html(__('quote / invoice successfully marked as paid. You can return to the client profile or wait until you are redirected to the client profile.', 'wp-easy-crm'))."</div>";
    9797   
    98             // Redirect to the specified URL
    99             // Wait for 2 seconds and then redirect
    10098            echo "<script>
    10199                setTimeout(function() {
     
    107105        }
    108106    }
     107   
    109108   
    110109       
  • wp-easy-crm/trunk/views/clientProfile.php

    r3136896 r3137153  
    88$quotesInvoiceTable = $wpdb->prefix . 'quoteclient';
    99$accregionTable = $wpdb->prefix . 'eacraccountingregion';
     10$quoteItemTable = $wpdb->prefix . 'lineitemquote';
    1011
    1112
     
    192193  animation: wiggle 0.3s ease-in-out 2; /* Increase the duration to 1.5 seconds */
    193194}
     195
     196.tooltip {
     197    position: relative;
     198    display: inline-block;
     199    cursor: pointer;
     200}
     201
     202.tooltip .tooltiptext {
     203    visibility: hidden;
     204    width: 300px; /* Adjust the width if needed */
     205    background-color: #333;
     206    color: #fff;
     207    text-align: left;
     208    padding: 5px;
     209    border-radius: 5px;
     210    position: absolute;
     211    z-index: 1;
     212    bottom: 100%; /* Position above the element */
     213    left: calc(50% + 160px); /* Shift to the right by the width of the WordPress menu */
     214    transform: translateX(-50%);
     215    white-space: normal; /* Allow wrapping and line breaks */
     216}
     217
     218.tooltip:hover .tooltiptext {
     219    visibility: visible;
     220}
     221
     222
     223
    194224
    195225</style>
     
    294324
    295325});
     326
     327//tooltip show
     328document.addEventListener('DOMContentLoaded', function () {
     329    const tooltipElements = document.querySelectorAll('[data-tooltip]');
     330    const adminMenuWidth = document.getElementById('adminmenuwrap').offsetWidth; // Get the width of the WordPress admin menu
     331
     332    tooltipElements.forEach(function (elem) {
     333        const tooltipText = elem.getAttribute('data-tooltip');
     334        const tooltipDiv = document.createElement('div');
     335        tooltipDiv.className = 'tooltiptext';
     336        tooltipDiv.innerHTML = tooltipText;
     337
     338        const wrapper = document.createElement('span');
     339        wrapper.className = 'tooltip';
     340        elem.parentNode.insertBefore(wrapper, elem);
     341        wrapper.appendChild(elem);
     342        wrapper.appendChild(tooltipDiv);
     343
     344        // Adjust tooltip position based on admin menu width
     345        tooltipDiv.style.left = `calc(50% + ${adminMenuWidth}px)`;
     346    });
     347});
     348
     349
     350
     351
    296352</script>
    297353
     
    322378            <?php   
    323379
    324 function make_links_clickable($text) {
     380 function make_links_clickable($text) {
    325381    // Match URLs with http:// or https://
    326382    $text = preg_replace(
     
    345401
    346402    return $text;
    347 }
     403 }
    348404
    349405            if(count($alllogs) > 0){
     
    443499
    444500                    if($singlequote['quotestatus'] == "quote" || $singlequote['quotestatus'] == "cancelled"){
    445                         echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'">QUO-00'.esc_html($singlequote['id']).'</a></td>';
    446 
    447                     }
    448                     else{
    449                         //is invoice
    450                         echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'">INV-00'.esc_html($singlequote['id']).'</a></td>';
    451 
    452                     }
     501                        //is Quote
     502                        $lineItems = $wpdb->get_results(
     503                            $wpdb->prepare(
     504                                "SELECT * FROM $quoteItemTable WHERE quoteidfk = %d",
     505                                $singlequote['id']
     506                            ),
     507                            ARRAY_A
     508                        );
     509                   
     510                        $lineItemsTooltip = '';
     511                        if (!empty($lineItems)) {
     512                            foreach ($lineItems as $item) {
     513                                $lineItemsTooltip .= esc_html($item['lineitem']) . ' (Qty: ' . esc_html($item['quantity']) . ', Price: ' . esc_html($item['price']) . ', Tax: ' . esc_html($item['tax']) . '%)<br>';
     514                            }
     515                        } else {
     516                            $lineItemsTooltip = 'No line items available';
     517                        }
     518                       
     519                        echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'" data-tooltip="'.esc_attr($lineItemsTooltip).'">QUO-00'.esc_html($singlequote['id']).'</a></td>';
     520                    } else {
     521                        // Is invoice
     522                        $lineItems = $wpdb->get_results(
     523                            $wpdb->prepare(
     524                                "SELECT * FROM $quoteItemTable WHERE quoteidfk = %d",
     525                                $singlequote['id']
     526                            ),
     527                            ARRAY_A
     528                        );
     529                   
     530                        $lineItemsTooltip = '';
     531                        if (!empty($lineItems)) {
     532                            foreach ($lineItems as $item) {
     533                                $lineItemsTooltip .= esc_html($item['lineitem']) . ' (Qty: ' . esc_html($item['quantity']) . ', Price: ' . esc_html($item['price']) . ', Tax: ' . esc_html($item['tax']) . '%)<br>';
     534                            }
     535                        } else {
     536                            $lineItemsTooltip = 'No line items available';
     537                        }
     538                   
     539                        echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'" data-tooltip="'.esc_attr($lineItemsTooltip).'">INV-00'.esc_html($singlequote['id']).'</a></td>';
     540                    }                   
     541                   
     542                   
    453543
    454544                    if($singlequote['quotestatus'] == "quote"){
  • wp-easy-crm/trunk/views/quotationsInvoices.php

    r3106848 r3137153  
    22global $wpdb;
    33$quotesInvoiceTable = $wpdb->prefix . 'quoteclient';
     4$quoteItemTable = $wpdb->prefix . 'lineitemquote';
    45$clientTable = $wpdb->prefix . 'clients';
    56$accregionTable = $wpdb->prefix . 'eacraccountingregion';
     
    9394if(count($allquotes) > 0){
    9495?>
     96<style>
     97    .tooltip {
     98    position: relative;
     99    display: inline-block;
     100    cursor: pointer;
     101}
     102
     103.tooltip .tooltiptext {
     104    visibility: hidden;
     105    width: 300px; /* Adjust the width if needed */
     106    background-color: #333;
     107    color: #fff;
     108    text-align: left;
     109    padding: 5px;
     110    border-radius: 5px;
     111    position: absolute;
     112    z-index: 1;
     113    bottom: 100%; /* Position above the element */
     114    left: calc(50% + 160px); /* Shift to the right by the width of the WordPress menu */
     115    transform: translateX(-50%);
     116    white-space: normal; /* Allow wrapping and line breaks */
     117}
     118
     119.tooltip:hover .tooltiptext {
     120    visibility: visible;
     121}
     122
     123
     124
     125</style>
    95126
    96127<script>
     
    124155    });
    125156});
     157
     158//tooltip show
     159document.addEventListener('DOMContentLoaded', function () {
     160    const tooltipElements = document.querySelectorAll('[data-tooltip]');
     161    const adminMenuWidth = document.getElementById('adminmenuwrap').offsetWidth; // Get the width of the WordPress admin menu
     162
     163    tooltipElements.forEach(function (elem) {
     164        const tooltipText = elem.getAttribute('data-tooltip');
     165        const tooltipDiv = document.createElement('div');
     166        tooltipDiv.className = 'tooltiptext';
     167        tooltipDiv.innerHTML = tooltipText;
     168
     169        const wrapper = document.createElement('span');
     170        wrapper.className = 'tooltip';
     171        elem.parentNode.insertBefore(wrapper, elem);
     172        wrapper.appendChild(elem);
     173        wrapper.appendChild(tooltipDiv);
     174
     175        // Adjust tooltip position based on admin menu width
     176        tooltipDiv.style.left = `calc(50% + ${adminMenuWidth}px)`;
     177    });
     178});
     179
     180
    126181</script>
    127182   
     
    177232
    178233                    if($singlequote['quotestatus'] == "quote" || $singlequote['quotestatus'] == "cancelled"){
    179                         echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'">QUO-00'.esc_html($singlequote['id']).'</a></td>'; 
     234                        //is Quote
     235                        $lineItems = $wpdb->get_results(
     236                            $wpdb->prepare(
     237                                "SELECT * FROM $quoteItemTable WHERE quoteidfk = %d",
     238                                $singlequote['id']
     239                            ),
     240                            ARRAY_A
     241                        );
     242                   
     243                        $lineItemsTooltip = '';
     244                        if (!empty($lineItems)) {
     245                            foreach ($lineItems as $item) {
     246                                $lineItemsTooltip .= esc_html($item['lineitem']) . ' (Qty: ' . esc_html($item['quantity']) . ', Price: ' . esc_html($item['price']) . ', Tax: ' . esc_html($item['tax']) . '%)<br>';
     247                            }
     248                        } else {
     249                            $lineItemsTooltip = 'No line items available';
     250                        }
     251                       
     252                        echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'" data-tooltip="'.esc_attr($lineItemsTooltip).'">QUO-00'.esc_html($singlequote['id']).'</a></td>';
    180253                    } else {
    181                         //is invoice
    182                         echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'">INV-00'.esc_html($singlequote['id']).'</a></td>';
    183                     }
     254                        // Is invoice
     255                        $lineItems = $wpdb->get_results(
     256                            $wpdb->prepare(
     257                                "SELECT * FROM $quoteItemTable WHERE quoteidfk = %d",
     258                                $singlequote['id']
     259                            ),
     260                            ARRAY_A
     261                        );
     262                   
     263                        $lineItemsTooltip = '';
     264                        if (!empty($lineItems)) {
     265                            foreach ($lineItems as $item) {
     266                                $lineItemsTooltip .= esc_html($item['lineitem']) . ' (Qty: ' . esc_html($item['quantity']) . ', Price: ' . esc_html($item['price']) . ', Tax: ' . esc_html($item['tax']) . '%)<br>';
     267                            }
     268                        } else {
     269                            $lineItemsTooltip = 'No line items available';
     270                        }
     271                   
     272                        echo '<td class="column-columnname" style="width:20%">'.'<a href="admin.php?page=wp-easy-crm-quoteview&quoteid='.$singlequote['id'].'" data-tooltip="'.esc_attr($lineItemsTooltip).'">INV-00'.esc_html($singlequote['id']).'</a></td>';
     273                    }                 
    184274
    185275                    if($singlequote['quotestatus'] == "quote"){
Note: See TracChangeset for help on using the changeset viewer.