Implement datepicker in input advanced search

Discuss MySQL Ajax Table Editor Pro Version

Implement datepicker in input advanced search

Postby samms » Fri Sep 12, 2014 1:38 am

Hello administrator, I could help implement the date picker to a input text with id #mate1_as_strs_1 in the advanced search; I configured the advanced search by default, I only need to put the calendar text input.
Please Help me!!
I have tried all day and I could not, I would appreciate to help me, and sorry for the typo errors :D .

This is my code:

Code: Select all
<?php
require_once('../crud/Common.php');
require_once('../crud/php/lang/LangVars-en.php');
require_once('../crud/php/AjaxTablePayments.php');
class JoinExample extends Common
{
   protected $mateInstances = array('mate1_');

   function displayHtml()
   {
      $html = '
         
         <br />
         
         <div class="mateAjaxLoaderDiv"><div id="ajaxLoader1"><img src="../crud/images/ajax_loader.gif" alt="Loading..." /></div></div>
         
         <br /><br />
         
         <div id="'.$this->mateInstances[0].'information">
         </div>
         
         <div id="'.$this->mateInstances[0].'titleLayer" class="mateTitleDiv">
         </div>
         
         <div id="'.$this->mateInstances[0].'searchButtonsLayer" class="mateSearchBtnsDiv">
         </div>
         <br>
         <div id="'.$this->mateInstances[0].'recordLayer" class="mateRecordLayerDiv">
         </div>
         <br>
         <div id="'.$this->mateInstances[0].'tableLayer" class="mateTableDiv">
         </div>
         
         <div id="'.$this->mateInstances[0].'updateInPlaceLayer" class="mateUpdateInPlaceDiv">
         </div>';
      echo $html;
      // Set default session configuration variables here
      $defaultSessionData['orderByColumn'] = 'id_factura';
      $defaultSessionData['ascOrDesc'] = 'desc';
      $defaultSessionData['searchType'] = 'advanced';
      $defaultSessionData['displayNum'] = 2000;
      
      $defaultSessionData = base64_encode($this->Editor->jsonEncode($defaultSessionData));
      
      
      $javascript = '   
         <script type="text/javascript">
            var mateHashes = {};
            var mateForward = false;
            var '.$this->mateInstances[0].' = new mate("'.$this->mateInstances[0].'");
            '.$this->mateInstances[0].'.setAjaxInfo({url: "'.$this->getAjaxUrl().'", history: true});
            if('.$this->mateInstances[0].'.ajaxInfo.history == false) {
               '.$this->mateInstances[0].'.toAjaxTableEditor("update_html","");
            } else if(window.location.hash.length == 0) {
               mateHashes.'.$this->mateInstances[0].' = {info: "", action: "update_html", sessionData: "'.$defaultSessionData.'"};
               mateForward = true;
            }
            if(mateForward) {
               var sessionCookieName = '.$this->mateInstances[0].'.getSessionCookieName();
               if($.cookie(sessionCookieName) != undefined) {
                  window.location.href = window.location.href+"#"+$.cookie(sessionCookieName);
               } else {
                  window.location.href = window.location.href+"#"+Base64.encode($.toJSON(mateHashes));
               }
            }
            $(function() {
               $( "#mate1_as_strs_1" ).datepicker();
            });
         </script>';
      echo $javascript;
   }

   function initiateEditor()
   {
      $tableColumns['id_factura'] = array('display_text' => 'ID', 'perms' => '');
      $tableColumns['serie_factura'] = array('display_text' => 'Invoice #', 'perms' => 'EVCTAXQSHO', 'col_header_info' => 'style="text-align:center; width:auto;"', 'col_header_info' => 'style="text-align:center; width:95px;"', 'table_cell_info' => 'style="background-color:royalblue; color:white; text-align:center; width:95px;"');
      $tableColumns['id_afiliado'] = array('display_text' => 'Affiliate #', 'perms' => 'EVCTAXQSHO', 'join' => array('table' => 'usuarios', 'column' => 'id_usuario', 'display_mask' => "usuarios.numero_serie", 'alias' => 'u', 'type' => 'left'), 'select_query' => 'SELECT id_usuario, numero_serie FROM usuarios', 'col_header_info' => 'style="text-align:center; width:70px;"', 'table_cell_info' => 'style="background-color:tomato; color:white; text-align:center; width:70px;"');

      $tableColumns['tarifa_cotizada'] = array('display_text' => 'Quote Rate', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:80px;"', 'table_cell_info' => 'style="text-align:center; min-width:80px;"');
      $tableColumns['tarifa_descuento'] = array('display_text' => 'Discount Rate', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:88px;"', 'table_cell_info' => 'style="text-align:center; min-width:88px;"');
      $tableColumns['costo_viaje'] = array('display_text' => 'Trip Charge', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:80px;"', 'table_cell_info' => 'style="text-align:center; min-width:80px;"');
      $tableColumns['total_otros'] = array('display_text' => 'Other Charges', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:90px;"', 'table_cell_info' => 'style="text-align:center; min-width:90px;"');
      $tableColumns['total_general'] = array('display_text' => 'Subtotal', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:80px;"', 'table_cell_info' => 'style="text-align:center; min-width:80px;"');
      $tableColumns['ingreso_afiliado'] = array('display_text' => 'Af Commision', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:88px;"', 'table_cell_info' => 'style="text-align:center; min-width:88px;"');
      $tableColumns['propina'] = array('display_text' => 'Af Gratuity', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:80px;"', 'table_cell_info' => 'style="text-align:center; min-width:80px;"');
      $tableColumns['bruto_afiliado'] = array('display_text' => 'Af Revenue', 'perms' => 'EVCTAXQSHOZ', 'col_header_info' => 'style="text-align:center; min-width:88px;"', 'table_cell_info' => 'style="text-align:center; min-width:88px;"');

      $tableColumns['fecha_pagado'] = array('display_text' => 'Payment Date', 'perms' => 'CETAXQSHO', 'display_mask' => 'date_format(facturas.fecha_pagado,"%Y-%m-%d %H:%i:%s")', 'calendar' => '%Y-%m-%d %H:%i:%s','col_header_info' => 'style="text-align:center; width:125px;"', 'table_cell_info' => 'style="text-align:center; width:125px;"');
      $tableColumns['fecha_creado'] = array('display_text' => 'Created On', 'perms' => 'CTAXQSHO', 'display_mask' => 'date_format(facturas.fecha_creado,"%Y-%m-%d %H:%i:%s")', 'calendar' => '%Y-%m-%d %H:%i:%s','col_header_info' => 'style="text-align:center; width:125px;"', 'table_cell_info' => 'style="text-align:center; width:125px;"', 'hidden'=>true);
      $tableColumns['creado_por'] = array('display_text' => 'Created By', 'perms' => 'VCTAXQ', 'join' => array('table' => 'usuarios', 'column' => 'id_usuario', 'display_mask' => "CONCAT(usuarios.nombre,' ',usuarios.apellido)", 'type' => 'left'), 'col_header_info' => 'style="text-align:center; width:80px;"', 'table_cell_info' => 'style="text-align:center; width:80px; max-width:auto;"', 'hidden'=>true);
      $tableColumns['fecha_modificado'] = array('display_text' => 'Modified Date', 'perms' => 'CTAXQSHO', 'display_mask' => 'date_format(facturas.fecha_modificado,"%Y-%m-%d %H:%i:%s")', 'calendar' => '%Y-%m-%d %H:%i:%s','col_header_info' => 'style="width: 120px; max-width: 120px;"', 'hidden'=>true);
      $tableColumns['modificado_por'] = array('display_text' => 'Modified By', 'perms' => 'VCTAXQ', 'join' => array('table' => 'usuarios', 'column' => 'id_usuario', 'display_mask' => "CONCAT(usuarios.nombre,' ',usuarios.apellido)", 'type' => 'left'), 'col_header_info' => 'style="text-align:center; width:80px;"', 'table_cell_info' => 'style="text-align:center; width:80px; max-width:auto;"', 'hidden'=>true);//
//      $tableColumns['status'] = array('display_text' => 'Status', 'perms' => 'EVCTAXQSHO','col_header_info' => 'style="text-align:center; width:80px;"', 'table_cell_info' => 'style="text-align:center; width:80px;"');

      $tableName = 'facturas';
      $primaryCol = 'id_factura';
      $errorFun = array(&$this,'logError');
      $permissions = 'VEIPSXHMZ';

      require_once('../crud/php/AjaxTablePayments.php');
      $this->Editor = new AjaxTableEditor($tableName,$primaryCol,$errorFun,$permissions,$tableColumns);
      $this->Editor->setConfig('tableInfo','cellpadding="0" width="auto" class="mateTable"');
      $this->Editor->setConfig('tableTitle','OUTSTANDING AFFILIATES INVOICES');
      $this->Editor->setConfig('addRowTitle','ADD OUTSTANDING AFFILIATE INVOICE');
      $this->Editor->setConfig('editRowTitle','EDIT OUTSTANDING AFFILIATE INVOICE');
      $this->Editor->setConfig('viewRowTitle','OUTSTANDING AFFILIATE INVOICE INFO');
      $this->Editor->setConfig('sqlFilters','facturas.status = "PA" AND pago_afiliado = 0');
      $this->Editor->setConfig('paginationLinks',true);
//      $this->addJavascript($this->getCalJs($info['calendar'],$col,$inputInfo,$mateRowNum),2);
      $this->Editor->setConfig('editInPlace',true);
//      $this->Editor->setConfig('addInPlace',true);
   }
   
   function JoinExample()
   {
      session_start();
      ob_start();
      $this->mysqlConnect();
      $this->initiateEditor();
      if(isset($_POST['json']))
      {
         if(ini_get('magic_quotes_gpc'))
         {
            $_POST['json'] = stripslashes($_POST['json']);
         }
         $this->Editor->data = $this->Editor->jsonDecode($_POST['json'],true);
         $this->Editor->setDefaults();
         $this->Editor->main();
         echo $this->Editor->jsonEncode($this->Editor->retArr);
      }
      else if(isset($_GET['mate_export']))
      {
         $this->Editor->data['sessionData'] = $_GET['session_data'];
         $this->Editor->setDefaults();
         ob_end_clean();
         header('Cache-Control: no-cache, must-revalidate');
         header('Pragma: no-cache');
         header('Content-type: application/x-msexcel');
         header('Content-Type: text/csv');
         header('Content-Disposition: attachment; filename="'.$this->Editor->tableName.'.csv"');
         // Add utf-8 signature for windows/excel
         echo chr(0xEF).chr(0xBB).chr(0xBF);
         echo $this->Editor->exportInfo();
         exit();
      }
      else if(isset($_POST) && count($_POST) > 0)
      {
         $this->Editor->setDefaults();
         $this->Editor->handleFileUpload();
        }
      else
      {
         $this->displayHeaderHtml();
         $this->displayHtml();
         $this->displayFooterHtml();
      }
   }
}
$lte = new JoinExample();
?>
samms
 
Posts: 1
Joined: Fri Sep 12, 2014 1:25 am

Re: Implement datepicker in input advanced search

Postby admin » Sat Oct 11, 2014 5:32 am

Did you ever get this figured out?
admin
Site Admin
 
Posts: 1502
Joined: Fri Jul 11, 2008 1:34 am

Re: Implement datepicker in input advanced search

Postby Nonno » Sun Sep 25, 2016 9:49 am

Hi,

Could you help us with this question?
What code do I have to add to make this work?

$tableColumns['data'] = array(
'display_text' => 'Data',
'perms' => 'EVCTAXQSHOF',
'display_mask' => 'date_format(data,"%d %M %Y")',
'order_mask' => 'date_format(data,"%Y-%m-%d %T")',
'range_mask' => 'date_format(data,"%Y-%m-%d %T")',
'calendar' => array('js_format' => 'dd MM yy'),
);
Nonno
 
Posts: 1
Joined: Sun Sep 25, 2016 9:45 am


Return to Pro Version

Who is online

Users browsing this forum: No registered users and 1 guest

cron