One to Many

One to Many

svonwellersvonweller Posts: 12Questions: 3Answers: 0

I am using the "Join tables - one-to-many join logic" on "https://editor.datatables.net/examples/advanced/joinArray.html", but I get the following error:

"DataTables warning: table id=mgmt - Join was performed on the field 'id' which was not included in the Editor field list. The join field must be included as a regular field in the Editor instance."

Using the same libraries. Wondering why the example works and mine does not

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @svonweller ,

    As you say, the examples works so it must be something in your code. Would you be able to post your code here, or link to your page, so that we can take a look,

    Cheers,

    Colin

  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    edited December 2018

    ===

    PHP

    <?php
    // fastMgmt.php
    include( "/var/vendor/datatables.net/editor-php/DataTables.php" );
    use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;
    Editor::inst( $db, 'event as ev' )
       ->fields(
          Field::inst( 'ev.id' ),
          Field::inst( 'ev.class_id' ),
          Field::inst( 'ev.class_status_id' )
             ->options( Options::inst()
                ->table( 'class_status as cs' )
                ->value( 'id' )
                ->label( 'name' )
             ),
          Field::inst( 'cs.name' ),
          Field::inst( 'org.name' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'loc.class_city' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'st.code' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'pro.nickname' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'own.first_name' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'own.last_name' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'spn.first_name' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'spn.last_name' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'spn.work_email' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'trn.id' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'trn.first_name' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'trn.last_name' )
             ->SetFormatter( Format::ifEmpty( null ) ),
          Field::inst( 'ev.day1_date' ),
          Field::inst( 'ev.capacity' ),
          Field::inst( 'ev.cvent_count'),
          Field::inst( 'ev.net_terms' )
             ->validator(Validate::numeric()),
          Field::inst( 'dep.po_required' )
             ->setFormatter( function ( $val, $data, $opts ) {
                return ! $val ? 0 : 1;
             }),
          Field::inst( 'dep.do_not_factor' )
             ->setFormatter( function ( $val, $data, $opts ) {
                return ! $val ? 0 : 1;
             }),
          Field::inst( 'ev.book_date' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.host_packet_sent' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.msa_period' ),
          Field::inst( 'ev.google_calendar_added' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.web_calendar_added' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.faculty_scheduler_added' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.pdf_reminder' ),
          Field::inst( 'ev.pdf_received' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.brochure_draft' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.instructor_on_google' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.contract_reminder_sent' ),
          Field::inst( 'ev.tep_msa_signed' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.tep_addendum_signed' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.google_calendar_deleted' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.brochure_approved' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.brochure_verified' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.brochures_posters_sent' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.marketing_executed' ), 
          Field::inst( 'ev.open_on_cvent' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.registration_checked' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.host_notified' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.travel_budget' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.go_status_id' )
             ->options( Options::inst()
                ->table( 'go_status as go' )
                ->value( 'id' )
                ->label( 'name' )
             ),
          Field::inst( 'go.name' ),
          Field::inst( 'ev.audience_desc_reminder' ),
          Field::inst( 'ev.ads_count' )
             ->validator(Validate::numeric()),
          Field::inst( 'ev.one_week_confirmation' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.brochure_to_faculty' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.book_receipt_confirmed' ),
          Field::inst( 'ev.trunk_receipt_confirmed' ),
          Field::inst( 'ev.attendee_email_reminder' )
             ->validator( Validate::dateFormat( 'Y-m-d' ) )
             ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
             ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
          Field::inst( 'ev.email_signin_sheets' ),
          Field::inst( 'ev.compile_attendee_list' ),
          Field::inst( 'ev.eval_link_sent' ),
          Field::inst( 'ev.compile_evals' ), 
          Field::inst( 'ev.edit_evals' ),
          Field::inst( 'ev.eval_results_sent' ), 
          Field::inst( 'ev.faculty_feedback_review' ), 
          Field::inst( 'ev.attendee_count' )
             ->validator(Validate::numeric())
       )
       ->leftJoin( 'class_status  as cs', 'cs.id', '=', 'ev.class_status_id' )
       ->leftJoin( 'organization as org', 'org.id', '=', 'ev.organization_id' ) 
       ->leftJoin( 'department as dep', 'dep.id', '=', 'ev.department_id' )
       ->leftJoin( 'location as loc',  'loc.id', '=', 'ev.location_id' )
       ->leftJoin( 'state as st', 'st.id', '=', 'loc.class_state_id' )
       ->leftJoin( 'product as pro', 'pro.id', '=', 'ev.product_id' )
       ->leftJoin( 'go_status as go', 'go.id', '=', 'ev.go_status_id' )
       ->leftJoin( 'event_owner as eo', 'eo.event_id', '=', 'ev.id' )
       ->leftJoin( 'contact as own', 'own.id', '=', 'eo.contact_id' )
       ->join(
          Mjoin::inst( 'contact' )
             ->link( 'event.id', 'event_instructor.event_id' )
             ->link( 'event_instructor.contact_id', 'contact.id' )
             ->fields(
                Field::inst( 'id' )
                   ->set(false) // read only
                   ->options( Options::inst()
                      ->table( 'contact' )
                      ->value( 'id' )
                      ->label( 'instructor' )
                   ),
                Field::inst( 'first_name' )
                   ->set(false) // read only
             )
       )
       ->leftJoin( 'event_trainee as et', 'et.event_id', '=', 'ev.id' )
       ->leftJoin( 'contact as trn', 'trn.id', '=', 'et.contact_id' )
       ->leftJoin( 'event_sponsor as es', 'es.event_id', '=', 'ev.id' )
       ->leftJoin( 'contact as spn', 'spn.id', '=', 'es.contact_id' )
       ->leftJoin( 'event_host as eh', 'eh.event_id', '=', 'ev.id' )
       ->leftJoin( 'contact as hst', 'hst.id', '=', 'eh.contact_id' )
       ->where('ev.day1_date', date('Y-m-d', strtotime('-1 year')), '>')
       ->process( $_POST )
       ->json();
       
    
  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    edited December 2018

    ====

    HTML

    <!DOCTYPE html>
    <!-- index.htm (fastMgmt) -->
    <html>
    <head>
       <meta charset="utf-8">
       <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, user-scalable=no">
    
       <title>Fast Mgmt</title>
    
       <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
       <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.4/css/buttons.dataTables.min.css">
       <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css">
       <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedheader/3.1.2/css/fixedHeader.dataTables.min.css">
       <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedcolumns/3.2.6/css/fixedColumns.dataTables.css">   
       <link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">
       <link rel="stylesheet" type="text/css" href="css/shCore.css">
       <link rel="stylesheet" type="text/css" href="css/index.css">
       
       <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>  
       <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
       <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
       <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.5.4/js/dataTables.buttons.min.js"></script>
       <script type="text/javascript" src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js"></script>
       <script type="text/javascript" src="https://cdn.datatables.net/fixedheader/3.1.2/js/dataTables.fixedHeader.min.js"></script>
       <script type="text/javascript" src="https://cdn.datatables.net/fixedcolumns/3.2.6/js/dataTables.fixedColumns.min.js"></script>
       <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
       <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
       <script type="text/javascript" src="js/dataTables.editor.min.js"></script>
       <script type="text/javascript" src="js/shCore.js"></script>
       <script type="text/javascript" src="js/index.js"></script>
    </head>
    <body>
       <div>
          <section>
             <h1>Fast Mgmt</h1>
             <table id="mgmt" class="row-border order-column cell-border" cellspacing="0" width="100%">
                <thead>
                   <tr>
                      <th id='bg_fixed'   class='bg_fixed'   >Event</th>
                      <th id='bg_info'    class='bg_info'    ></th>
                      <th id='bg_booking' class='bg_booking' >Booking</th>
                      <th id='bg_setup'   class='bg_setup'   >Class Setup</th>
                      <th id='bg_prep'    class='bg_prep'    >Pre-Class Prep</th>
                      <th id='bg_twoWks'  class='bg_twoWks'  >2 Weeks Out</th>
                      <th id='bg_oneWk'   class='bg_oneWk'   >1 Week Out</th>
                      <th id='bg_post'    class='bg_post'    >Post Class</th>
                   </tr>
                   <tr>
                      <!-- Fixed -->
                      <th></th>
                      <th id='owner'                        title='Owner'>Owner</th>
                      <th id='course'                       title='Course'>Course</th>
                      <th id='date'                         title='Class Date'>Day 1</th>
                      <th id='status'                       title='Class Status'>Status</th>
                      <th id='class'                        title='Class Id'>Class</th>
                      <th id='city'                         title='Class City'>City</th>
                      <th id='state'                        title='Class State'>ST</th>
                      <th id='dtl'        class='bg_status' title='PDF Received (-120)'>D</th>
                      <th id='msa'        class='bg_status' title='TEP/MSA Signed (-90)'>M</th>
                      <th id='add'        class='bg_status' title='Addendum Signed (-90)'>A</th>
                      <th id='bro'        class='bg_status' title='Brochure Approved (-90)'>B</th>
                      <th id='staff'      class='bg_status' title='Staff is late'>S</th>
                      <!-- Info -->
                      <th id='org'                          title='Sponsor/Host'>Org</th>
                      <th id='contact'    class="hidden"    title='Contact'>Contact</th>
                      <th id='email'      class="hidden"    title='Work Email'>Email</th>
                      <th id='instructor'                   title='Instructor'>Instructor</th>
                      <th id='trainee'                      title='Trainee'>Trainee</th>
                      <th id='capacity'                     title='Room Capacity'>Rm Cap</th>
                      <th id='cventCnt'                     title='Cvent Count'>Cvent Cnt</th>
                      <th id='net'        class="hidden"    title='Net Terms'>Net</th>
                      <th id='po'         class="hidden"    title='PO Required'>PO</th>
                      <th id='dnf'        class="hidden"    title='Do Not Factor'>DNF</th>
                      <!-- Booking -->
                      <th id='bookDate'   class="hidden"    title='Class Booked'>Booked</th>
                      <th id='packetSent' class="hidden"    title='Host Packet Sent'>Packet Sent</th>
                      <th id='msaPeriod'  class="hidden"    title='MSA Period'>MSA</th>
                      <th id='clsGoogle'  class="hidden"    title='Class on Google Calendar'>Google Cal</th>
                      <th id='webCal'     class="hidden"    title='Class on Web Calendar'>Web Cal</th>
                      <th id='facSched'   class="hidden"    title='Class on Faculty Scheduler'>Fac Sched</th>
                      <th id='pdfRmdr'    class="hidden"    title='PDF Reminder Sent'>PDF Rmdr</th>
                      <!-- Setup -->
                      <th id='pdfRcvd'    class="hidden"    title='PDF Received (-120)'>PDF Rcvd</th>
                      <th id='broDraft'   class="hidden"    title='Brochure Draft (-120)'>Bro Draft</th>
                      <th id='insGoogle'  class="hidden"    title='Instructor on Google (-120)'>Ins on G.</th>
                      <th id='contract'   class="hidden"    title='Contract Due Reminder (-100)'>Contract</th>
                      <th id='tepMsa'     class="hidden"    title='TEP/MSA Signed (-90)'>TEP/MSA</th>
                      <th id='addendum'   class="hidden"    title='Addendum Signed (-90)'>Addendum</th>
                      <th id='remGoogle'  class="hidden"    title='Removed ??? from Google (-90)'>Del G. Cal</th>
                      <th id='broApprove' class="hidden"    title='Brochure Approved (-90)'>Bro Appr</th>
                      <th id='broVerify'  class="hidden"    title='Brochure Verified (-88)'>Bro Vrfy (B)</th>
                      <th id='posters'    class="hidden"    title='Brochures & Posters Sent (-88)'>Posters (B)</th>
                      <th id='marketing'  class="hidden"    title='Marketing Executed (-85)'>Marketing</th>
                      <th id='cventOpen'  class="hidden"    title='Open on Cvent (-85)'>Cvent Open</th>
                      <th id='regVerify'  class="hidden"    title='Registration Verified (-80)'>Reg Vrfy</th>
                      <th id='notifyHost' class="hidden"    title='Host Notified Registration is Open (-80)'>Notify Host</th>
                      <!-- Prep -->
                      <th id='travel'     class="hidden"    title='Travel Budget to Faculty (-35)'>Travel</th>
                      <th id='cventCnt'   class="hidden"    title='Cvent Count'>Cvent Cnt</th>
                      <th id='goStatus'                     title='56 Day Cancel or Go (-56)'>Go Status</th>
                      <!-- 2Wks -->
                      <th id='reminder'   class="hidden"    title='TCAR-PCAR Reminder (-30)'>Reminder</th>
                      <th id='adsCnt'     class="hidden"    title='Count to ADS (-12)'>ADS Cnt</th>
                      <th id='confirm'    class="hidden"    title='1+ Week logistics Confirmation (-12)'>1 Wk</th>
                      <th id='broSent'    class="hidden"    title='Send Audience Description & Brochure (-12)'>Bro to Fac</th>
                      <!-- 1Wk -->
                      <th id='bookRcpt'   class="hidden"    title='Book Receipt Confirmed (-7)'>Book Receipt</th>
                      <th id='trunkRcpt'  class="hidden"    title='Trunk Receipt Confirmed (-7)'>Trunk Receipt</th>
                      <th id='reminder2'  class="hidden"    title='Attendee Reminder (-7)'>Att Rmdr</th>
                      <th id='signin'     class="hidden"    title='Sign-in Sheets to Host & Faculty (-2)'>Signin Sheets</th>
                      <!-- Post -->
                      <th id='attendees'  class="hidden"    title='Compile Final Attendee List (7)'>Att List</th>
                      <th id='evalLink'   class="hidden"    title='Send Eval link (7)'>Send Link</th>
                      <th id='evalComp'   class="hidden"    title='Evals Compiled / Laura Notified (20)'>Evals (G)</th>
                      <th id='evalEdit'   class="hidden"    title='Edit Evals (22)'>Evals (L)</th>
                      <th id='evalSent'   class="hidden"    title='Send Eval Results (24)'>Results Sent</th>
                      <th id='feedback'   class="hidden"    title='Review Faculty Feedback (10)'>F/B (G)</th>
                      <th id='attCnt'     class="hidden"    title='Attendee Count'>Att Cnt</th>
                   </tr>
                </thead>
             </table>
          </section>
       </div>
    </body>
    </html>
    
  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    edited December 2018

    ==

    JS

    // index.js (fastMgmt)
    /*
     * Date Constants
     */
    const MILLI = 1000;
    const SECONDS = 60;
    const MINUTES = 60;
    const HOURS = 24;
    const DAY = HOURS*MINUTES*SECONDS*MILLI;
    /*
     * DOM Constants
     */
    const BUTTON = 'B';
    const FILTER = 'f';
    const FOOTER = 'F';
    const HEADER = 'H';
    const INFO = 'i';
    const LENGTH  = 'l';
    const PAGE = 'p';
    const PROCESS = 'r';
    const SELECT = 'S';
    const TABLE = 't';
    /*
     * String Constants
     */
    const STR_WAIT = 'W';
    const STR_LATE = 'L';
    const STR_CANCELLED = 'Cancelled'; 
    const STR_RELEASED = 'Released'; 
    const STR_RESCHEDULED = 'Rescheduled';
    const STR_RENEE = 'Renee';
    const STR_CHRISTINE = 'Christine';
    /*
     * Color Constants
     */
    const CLR_UNASSIGN = 'ffffff';
    const CLR_RENEE = '#f0defd';
    const CLR_CHRISTINE = '#defde0';
    const CLR_IGNORE = '#cccccc';
    const CLR_WAIT = '#ffff00';
    const CLR_WARN = '#FA8072';
    const CLR_LATE = '#ff3300';
    /*
     * Offset Constants
     */
    // Setup
    const OFF_PDF_RCVD = -120; // [D]
    const OFF_BRO_DRAFT = -120;
    const OFF_INS_GOOGLE = -120;
    const OFF_CONTRACT = -100;
    const OFF_TEP_MSA = -90; // [M]
    const OFF_ADDENDUM = -90; // [A]
    const OFF_REM_GOOGLE = -90;
    const OFF_BRO_APPROVE = -90; // [B]
    const OFF_BRO_VERIFY = -88;
    const OFF_POSTERS = -88;
    const OFF_MARKETING = -85;
    const OFF_CVENT_OPEN = -85;
    const OFF_REG_VERIFY = -80;
    const OFF_NOTIFY_HOST = -80;
    // Prep
    const OFF_TRAVEL = -35;
    const OFF_GO_STATUS = -56;
    // 2Wks
    const OFF_REMINDER = -30;
    const OFF_ADS_COUNT = -12;
    const OFF_CONFIRM = -12;
    const OFF_BRO_SENT = -12;
    // 1Wk
    const OFF_BOOK_RCPT = -7;
    const OFF_TRUNK_RCPT = -7;
    const OFF_REMINDER2 = -7;
    const OFF_SIGNIN = -2;
    // Post
    const OFF_ATTENDEES = 7;
    const OFF_EVAL_LINK = 7;
    const OFF_EVAL_COMP = 20;
    const OFF_EDIT_EVALS = 22;
    const OFF_EVAL_SENT = 24;
    const OFF_FEEDBACK = 10;
    /*
     * Position Constants
     */
    var idx = 0
    // Fixed
    const POS_CHK = idx++;
    const POS_OWNER = idx++;
    const POS_COURSE = idx++;
    const POS_DATE = idx++;
    const POS_STATUS = idx++;
    const POS_CLASS = idx++;
    const POS_CITY = idx++;
    const POS_STATE = idx++;
    const POS_DTL = idx++;
    const POS_MSA = idx++;
    const POS_ADD = idx++;
    const POS_BRO = idx++;
    const POS_STAFF = idx++;
    // Info
    const POS_ORG = idx++;
    const POS_CONTACT = idx++;
    const POS_EMAIL = idx++;
    const POS_INSTRUCTOR = idx++;
    const POS_TRAINEE = idx++;
    const POS_CAPACITY = idx++;
    const POS_CVENT_CNT = idx++;
    const POS_NET_TERMS = idx++;
    const POS_PO_REQUIRED = idx++;
    const POS_DO_NOT_FACTOR = idx++;
    // Booking
    const POS_BOOK_DATE = idx++;
    const POS_PACKET_SENT = idx++;
    const POS_MSA_PERIOD = idx++;
    const POS_CLS_GOOGLE = idx++;
    const POS_WEB_CAL = idx++;
    const POS_FAC_SCHED = idx++;
    const POS_PDF_RMDR = idx++;
    // Setup
    const POS_PDF_RCVD = idx++;
    const POS_BRO_DRAFT = idx++;
    const POS_INS_GOOGLE = idx++;
    const POS_CONTRACT = idx++;
    const POS_TEP_MSA = idx++;
    const POS_ADDENDUM = idx++;
    const POS_REM_GOOGLE = idx++;
    const POS_BRO_APPROVE = idx++;
    const POS_BRO_VERIFY = idx++;
    const POS_POSTERS = idx++;
    const POS_MARKETING = idx++;
    const POS_CVENT_OPEN = idx++;
    const POS_REG_VERIFY = idx++;
    const POS_NOTIFY_HOST = idx++;
    // Prep
    const POS_TRAVEL = idx++;
    const POS_CVENT_CNT2 = idx++;
    const POS_GO_STATUS = idx++;
    // 2Wks
    const POS_REMINDER = idx++;
    const POS_ADS_COUNT = idx++;
    const POS_CONFIRM = idx++;
    const POS_BRO_SENT = idx++;
    // 1Wk
    const POS_BOOK_RCPT = idx++;
    const POS_TRUNK_RCPT = idx++;
    const POS_REMINDER2 = idx++;
    const POS_SIGNIN = idx++;
    // Post
    const POS_ATTENDEES = idx++;
    const POS_EVAL_LINK = idx++;
    const POS_EVAL_COMP = idx++;
    const POS_EDIT_EVALS = idx++;
    const POS_EVAL_SENT = idx++;
    const POS_feedback = idx++;
    const POS_ATTENDEE_COUNT = idx++;
    // EOF
    const POS_END = idx;
    /*
     * Span Constants
     */
    const SPAN_FIXED = POS_ORG - POS_CHK;
    const SPAN_INFO = POS_BOOK_DATE - POS_ORG;
    const SPAN_BOOKING = POS_PDF_RCVD - POS_BOOK_DATE;
    const SPAN_SETUP = POS_TRAVEL - POS_PDF_RCVD;
    const SPAN_PREP = POS_REMINDER - POS_TRAVEL;
    const SPAN_TWO_WKS = POS_BOOK_RCPT - POS_REMINDER;
    const SPAN_ONE_WK = POS_ATTENDEES - POS_BOOK_RCPT;
    const SPAN_POST = POS_END - POS_ATTENDEES;
    /*
     * Variables
     */
    var table;
    var editor;
    var msaStatus;
    var addStatus;
    var broStatus;
    
    
  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    edited December 2018
    $(document).ready(function() {
        /*
         * ========================================
         * DataTables - Editor
         * ========================================
         */
        initTableSpans();
        editor = new $.fn.dataTable.Editor( {
            ajax: '/admin/fastMgmt/fastMgmt.php',
            table: '#mgmt',
            fields: [{
                name:  'own.first_name',
                type:  'readonly'
            },{
                name:  'pro.nickname',
                type:  'readonly'
            },{
                name:  'ev.day1_date',
                type:  'readonly'
            },{
                name:  'ev.class_status_id',
                type:  'select',
                placeholderDisabled: false,
                placeholder: ''
            },{
                name:  'ev.class_id',
                type:  'readonly'
            },{
                name:  'loc.class_city',
                type:  'readonly'
            },{
                name:  'st.code',
                type:  'readonly'
            },{
                name:  'org.name',
                type:  'readonly'
            },{
                name:  'spn.first_name',
                type:  'readonly'
            },{
                name:  'spn.last_name',
                type:  'readonly'
            },{
                name:  'spn.work_email',
                type:  'readonly'
            },{ 
                name:  'contact[].id', 
                type:  'checkbox' 
            },{
                name:  'trn.first_name',
                type:  'readonly'
            },{
                name:  'ev.capacity',
                type:  'readonly'
            },{
                name:  'ev.cvent_count',
                type:  'readonly'
            },{
                name:  'ev.net_terms'
            },{
                name:      'dep.po_required',
                type:      'checkbox',
                separator: '|',
                options:   [
                    { label: '', value: 1 }
                ]
            },{
                name:      'dep.do_not_factor',
                type:      'checkbox',
                separator: '|',
                options:   [
                    { label: '', value: 1 }
                ]
            },{
                name:  'ev.book_date',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.host_packet_sent'
            },{
                name:  'ev.msa_period'
            },{
                name:  'ev.google_calendar_added',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.web_calendar_added',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.faculty_scheduler_added',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.pdf_reminder'
            },{
                name:  'ev.pdf_received',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.brochure_draft',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.instructor_on_google',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.contract_reminder_sent'
            },{
                name:  'ev.tep_msa_signed',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.tep_addendum_signed',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.google_calendar_deleted',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.brochure_approved',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.brochure_verified',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.brochures_posters_sent',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.marketing_executed'
            },{
                name:  'ev.open_on_cvent',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.registration_checked',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.host_notified',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.travel_budget',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.go_status_id',
                type:  'select',
                placeholderDisabled: false,
                placeholder: ''
            },{
                name:  'ev.audience_desc_reminder'
            },{
                name:  'ev.ads_count'
            },{
                name:  'ev.one_week_confirmation',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.brochure_to_faculty',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.book_receipt_confirmed'
            },{
                name:  'ev.trunk_receipt_confirmed'
            },{
                name:  'ev.attendee_email_reminder',
                type:  'datetime',
                def:   function () { return new Date(); }
            },{
                name:  'ev.email_signin_sheets'             
            },{
                name:  'ev.compile_attendee_list'
            },{
                name:  'ev.eval_link_sent'
            },{
                name:  'ev.compile_evals'
            },{
                name:  'ev.edit_evals'
            },{
                name:  'ev.eval_results_sent'
            },{
                name:  'ev.faculty_feedback_review'
            },{
                name:  'ev.attendee_count'
            }]
        } ); 
        initEditorLabels();
    
  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    /*
     * ========================================
     * DataTables - Table
     * ========================================
     */ 
    table = $('#mgmt').DataTable( {
        ajax: '/admin/fastMgmt/fastMgmt.php',
        fixedColumns: {
            leftColumns: SPAN_FIXED
        }, 
        scrollX: true,
        scrollY: '75vh',
        dom: BUTTON + FILTER + PROCESS + TABLE + INFO,
        paging: false,
        columns: [
            {
                data: null,
                defaultContent: '',
                className: 'select-checkbox',
                orderable: false
            },{
                data: null,
                render: 'own.first_name'
            },{
                data: null,
                render: 'pro.nickname'
            },{
                data: null,
                render: 'ev.day1_date'
            },{
                data: 'cs.name', 
                editField: "ev.class_status_id"
            },{
                data: null,
                render: 'ev.class_id'
            },{
                data: null,
                render: 'loc.class_city'
            },{
                data: null,
                render: 'st.code'
            },{
                data: null,
                render: function(data,type,row) { 
                    return calcWaitStatus(row, row.ev.pdf_received, OFF_PDF_RCVD);
                }
            },{
                data: null,
                render: function(data,type,row) { 
                    msaStatus = calcWaitStatus(row, row.ev.tep_msa_signed, OFF_TEP_MSA);
                    return msaStatus;
                }
            },{
                data: null,
                render: function(data,type,row) { 
                    addStatus = calcWaitStatus(row, row.ev.tep_addendum_signed, OFF_ADDENDUM);
                    return addStatus;
                }
            },{
                data: null,
                render: function(data,type,row) { 
                    broStatus =  calcWaitStatus(row, row.ev.brochure_approved, OFF_BRO_APPROVE);
                    return broStatus;
                }
            },{
                data: null,
                render: function(data,type,row) { 
                    return calcLateStatus(row)
                }
            },{
                data: null,
                render: 'org.name'
            },{
                data: null,
                render: function(data,type,row) {
                    return getContactName(data, 'spn');
                }
            },{
                data: null,
                render: 'spn.work_email'
            },{
                data: 'contact', 
                render: '[, ].first_name'
            },{
                data: null,
                render: function(data,type,row) {
                    return getContactName(data, 'trn');
                }
            },{
                data: null,
                render: 'ev.capacity'
            },{
                data: null,
                render: 'ev.cvent_count'
            },{
                data: 'ev.net_terms'
            },{
                data: null,
                render: function(data, type, row) {
                    return displayCheckbox(row.dep.po_required)
                }
            },{
                data: null,
                render: function(data, type, row) {
                    return displayCheckbox(row.dep.do_not_factor)
                }
            },{
                data: 'ev.book_date'
            },{
                data: 'ev.host_packet_sent'
            },{
                data: 'ev.msa_period'
            },{
                data: 'ev.google_calendar_added'
            },{
                data: 'ev.web_calendar_added'
            },{
                data: 'ev.faculty_scheduler_added'
            },{
                data: 'ev.pdf_reminder'
            },{
                data: 'ev.pdf_received',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_PDF_RCVD); 
                }
            },{
                data: 'ev.brochure_draft',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_BRO_DRAFT); 
                }
            },{
                data: 'ev.instructor_on_google',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_INS_GOOGLE); 
                }
            },{
                data: 'ev.contract_reminder_sent',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_CONTRACT); 
                }
            },{
                data: 'ev.tep_msa_signed',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_TEP_MSA); 
                }
            },{
                data: 'ev.tep_addendum_signed',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_ADDENDUM); 
                }
            },{
                data: 'ev.google_calendar_deleted',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_REM_GOOGLE); 
                }
            },{
                data: 'ev.brochure_approved',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_BRO_APPROVE); 
                }
            },{
                data: 'ev.brochure_verified',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_BRO_VERIFY); 
                }
            },{
                data: 'ev.brochures_posters_sent',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_POSTERS); 
                }
            },{
                data: 'ev.marketing_executed',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_MARKETING); 
                }
            },{
                data: 'ev.open_on_cvent',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_CVENT_OPEN); 
                }
            },{
                data: 'ev.registration_checked',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_REG_VERIFY); 
                }
            },{
                data: 'ev.host_notified',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_NOTIFY_HOST); 
                }
            },{
                data: 'ev.travel_budget',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_TRAVEL); 
                }
            },{
                data: null,
                render: 'ev.cvent_count'
            },{
                data: 'go.name', editField: "ev.go_status_id",
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_GO_STATUS); 
                }
            },{
                data: 'ev.audience_desc_reminder',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_REMINDER); 
                }
            },{
                data: 'ev.ads_count',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_ADS_COUNT); 
                }
            },{
                data: 'ev.one_week_confirmation',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_CONFIRM); 
                }
            },{
                data: 'ev.brochure_to_faculty',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_BRO_SENT); 
                }
            },{
                data: 'ev.book_receipt_confirmed',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_BOOK_RCPT);
                }
            },{
                data: 'ev.trunk_receipt_confirmed',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_TRUNK_RCPT);
                }
            },{
                data: 'ev.attendee_email_reminder',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_REMINDER2); 
                }
            },{
                data: 'ev.email_signin_sheets',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_SIGNIN); 
                }
            },{
                data: 'ev.compile_attendee_list',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_ATTENDEES); 
                }
            },{
                data: 'ev.eval_link_sent',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_EVAL_LINK); 
                }
            },{
                data: 'ev.compile_evals',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_EVAL_COMP); 
                }
            },{
                data: 'ev.edit_evals',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_EDIT_EVALS); 
                }
            },{
                data: 'ev.eval_results_sent',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_EVAL_SENT); 
                }
            },{
                data: 'ev.faculty_feedback_review',
                render: function(data, type, row) {
                    return calcCellCountdown(row, data, OFF_FEEDBACK); 
                }
            },{
                data: 'ev.attendee_count'
            }        
        ],
    
  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    edited December 2018
            order: [
                [ POS_DATE, 'asc' ],
                [ POS_CLASS, 'asc' ]
            ],
            select: {
                style:    'os',
                selector: 'td.select-checkbox'
            },
            buttons: [
                { 
                    extend: 'edit',   
                    editor: editor
                },{
                    text: 'Summary',
                    action: function ( e, dt, node, config ) {
                        showHideColumns(false);
                    }
                },{
                    text: 'Setup',
                    className: 'edit',
                    enabled: false,
                    action: function ( e, dt, node, config ) {
                        var row = dt.row( { selected: true } ).data();
                        var classId = row.ev.class_id;
                        var url = '/admin/eventSetup/eventSetup.php?class_id=' + classId;
                        window.open(url);
                    }
                },{
                    text: 'Attendance',
                    className: 'edit',
                    enabled: false,
                    action: function ( e, dt, node, config ) {
                        var row = dt.row( { selected: true } ).data();
                        var id = row.ev.id;
                        var url = '/admin/eventAttendance/index.php?action=change&event_id=' + id;
                        window.open(url);
                    }
                },{
                    text: 'Finance',
                    className: 'edit',
                    enabled: false,
                    action: function ( e, dt, node, config ) {
                        var row = dt.row( { selected: true } ).data();
                        var classId = row.ev.class_id;
                        var url = '/admin/eventFinance/eventFinance.php?class_id=' + classId;
                        window.open(url);
                    }
                },{
                    text: 'Notes',
                    className: 'edit',
                    enabled: false,
                    action: function ( e, dt, node, config ) {
                        var row = dt.row( { selected: true } ).data();
                        var id = row.ev.id;
                        var url = '/admin/note?entity_id=4&record_id=' + id;
                        window.open(url);
                    }
                },{
                    extend: 'excelHtml5',
                    exportOptions: { orthogonal: 'export' }
                }       
            ],
            'rowCallback': function( row, data, dispNbr, dispIdx, dataIdx ) {
                styleRow(row);
                styleCells(row);
            }
        } );
        /*
         * ========================================
         * DataTables - Inline Editing
         * ========================================
         */
        $( table.table().container() ).on( 'click', 'tbody td:not(:first-child)', function (e) {
            editor.inline( this );
        } );
        $('#mgmt').on('select.dt deselect.dt', function() {
            table.buttons( ['.edit'] ).enable(
                table.rows( { selected: true } ).indexes().length === 1 ? true : false
            )
        } )
        /*
         * ========================================
         * DataTables - Sticky Header
         * ========================================
         */    
        $(function() {
            var stickyHeaderTop = $('#mgmt').offset().top;
            $(window).scroll(function() {
                 if ($(window).scrollTop() > stickyHeaderTop) {
                     $('.dataTables_scrollHead, .DTFC_LeftHeadWrapper').css('transform', 'translateY(0%)');
                     $('.DTFC_LeftHeadWrapper').css({position: 'fixed',top: '0px',zIndex: '1',left: 'auto'});
                     $('.dataTables_scrollHead').css({position: 'fixed',top: '0px', zIndex: '1' });
                     $('.DTFC_ScrollWrapper').css({height: ''});
                 } else {
                     $('.DTFC_LeftHeadWrapper, .DTFC_LeftHeadWrapper').css({position: 'relative',top: '0px'});
                     $('.dataTables_scrollHead').css({position: 'relative', top: '0px'});
                     $('.dataTables_scrollHead').css('transform', 'translateY(0%)');
                 }
            } );
        } );
    } );
    //$(window).bind('resize', function () {
    //  var NewHeight = $(document).height() - 260;
    //  var oSettings = table.fnSettings();
    //  oSettings.oScroll.sY = NewHeight + "px";
    //  table.fnDraw();
    //})
    
  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    edited December 2018
    /*
     * ========================================
     * Functions 
     * ========================================
     */
    function initTableSpans() {
        document.getElementById('bg_fixed').colSpan   = SPAN_FIXED;
        document.getElementById('bg_info').colSpan    = SPAN_INFO;
        document.getElementById('bg_booking').colSpan = SPAN_BOOKING;
        document.getElementById('bg_setup').colSpan   = SPAN_SETUP;
        document.getElementById('bg_prep').colSpan    = SPAN_PREP;
        document.getElementById('bg_twoWks').colSpan  = SPAN_TWO_WKS;
        document.getElementById('bg_oneWk').colSpan   = SPAN_ONE_WK;
        document.getElementById('bg_post').colSpan    = SPAN_POST;
    }
    function initEditorLabels() {
        editor.field( 'own.first_name' ).label( $("th[id='owner']").attr("title"));
        editor.field( 'pro.nickname' ).label( $("th[id='course']").attr("title"));
        editor.field( 'ev.day1_date' ).label( $("th[id='date']").attr("title"));
        editor.field( 'ev.class_status_id' ).label( $("th[id='status']").attr("title"));
        editor.field( 'ev.class_id' ).label( $("th[id='class']").attr("title"));
        editor.field( 'loc.class_city' ).label( $("th[id='city']").attr("title"));
        editor.field( 'st.code' ).label( $("th[id='state']").attr("title"));
        editor.field( 'org.name' ).label( $("th[id='org']").attr("title"));
        editor.field( 'spn.first_name' ).label( $("th[id='contact']").attr("title"));
        editor.field( 'spn.last_name' ).label( '');
        editor.field( 'spn.work_email' ).label( $("th[id='email']").attr("title"));
    //  editor.field( 'ins.first_name' ).label( $("th[id='instructor']").attr("title"));
        editor.field( 'trn.first_name' ).label( $("th[id='trainee']").attr("title"));
        editor.field( 'ev.capacity' ).label( $("th[id='capacity']").attr("title"));
        editor.field( 'ev.cvent_count' ).label( $("th[id='cventCnt']").attr("title"));
        editor.field( 'ev.book_date' ).label( $("th[id='bookDate']").attr("title"));
        editor.field( 'ev.host_packet_sent' ).label( $("th[id='packetSent']").attr("title"));
        editor.field( 'ev.msa_period' ).label( $("th[id='msaPeriod']").attr("title"));
        editor.field( 'ev.google_calendar_added' ).label( $("th[id='clsGoogle']").attr("title"));
        editor.field( 'ev.web_calendar_added' ).label( $("th[id='webCal']").attr("title"));
        editor.field( 'ev.faculty_scheduler_added' ).label( $("th[id='facSched']").attr("title"));
        editor.field( 'ev.pdf_reminder' ).label( $("th[id='pdfRmdr']").attr("title"));
        editor.field( 'ev.pdf_received' ).label( $("th[id='pdfRcvd']").attr("title"));
        editor.field( 'ev.brochure_draft' ).label( $("th[id='broDraft']").attr("title"));
        editor.field( 'ev.instructor_on_google' ).label( $("th[id='insGoogle']").attr("title"));
        editor.field( 'ev.contract_reminder_sent' ).label( $("th[id='contract']").attr("title"));
        editor.field( 'ev.tep_msa_signed' ).label( $("th[id='tepMsa']").attr("title"));
        editor.field( 'ev.tep_addendum_signed' ).label( $("th[id='addendum']").attr("title"));
        editor.field( 'ev.google_calendar_deleted' ).label( $("th[id='remGoogle']").attr("title"));
        editor.field( 'ev.brochure_approved' ).label( $("th[id='broApprove']").attr("title"));
        editor.field( 'ev.brochure_verified' ).label( $("th[id='broVerify']").attr("title"));
        editor.field( 'ev.brochures_posters_sent' ).label( $("th[id='posters']").attr("title"));
        editor.field( 'ev.marketing_executed' ).label( $("th[id='marketing']").attr("title"));
        editor.field( 'ev.open_on_cvent' ).label( $("th[id='cventOpen']").attr("title"));
        editor.field( 'ev.registration_checked' ).label( $("th[id='regVerify']").attr("title"));
        editor.field( 'ev.host_notified' ).label( $("th[id='notifyHost']").attr("title"));
        editor.field( 'ev.travel_budget' ).label( $("th[id='travel']").attr("title"));
        editor.field( 'ev.go_status_id' ).label( $("th[id='goStatus']").attr("title"));
        editor.field( 'ev.audience_desc_reminder' ).label( $("th[id='reminder']").attr("title"));
        editor.field( 'ev.ads_count' ).label( $("adsCnt").attr("title']"));
        editor.field( 'ev.one_week_confirmation' ).label( $("th[id='confirm']").attr("title"));
        editor.field( 'ev.brochure_to_faculty' ).label( $("th[id='broSent']").attr("title"));
        editor.field( 'ev.book_receipt_confirmed' ).label( $("th[id='bookRcpt']").attr("title"));
        editor.field( 'ev.trunk_receipt_confirmed' ).label( $("th[id='trunkRcpt']").attr("title"));
        editor.field( 'ev.attendee_email_reminder' ).label( $("th[id='reminder2']").attr("title"));
        editor.field( 'ev.email_signin_sheets' ).label( $("th[id='signin']").attr("title"));
        editor.field( 'ev.compile_attendee_list' ).label( $("th[id='attendees']").attr("title"));
        editor.field( 'ev.eval_link_sent' ).label( $("th[id='evalLink']").attr("title"));
        editor.field( 'ev.compile_evals' ).label( $("th[id='evalComp']").attr("title"));
        editor.field( 'ev.edit_evals' ).label( $("th[id='evalEdit']").attr("title"));
        editor.field( 'ev.eval_results_sent' ).label( $("th[id='evalSent']").attr("title"));
        editor.field( 'ev.faculty_feedback_review' ).label( $("th[id='feedback']").attr("title"));
        editor.field( 'ev.attendee_count' ).label( $("th[id='attCnt']").attr("title"));
        editor.field( 'ev.net_terms' ).label( $("th[id='net']").attr("title"));
        editor.field( 'dep.po_required' ).label( $("th[id='po']").attr("title"));
        editor.field( 'dep.do_not_factor' ).label( $("th[id='dnf']").attr("title"));
    }
    function getContactName(data, obj) {
        fn = (data[obj]['first_name']) ? data[obj]['first_name'] : '';
        ln = (data[obj]['last_name']) ? data[obj]['last_name'] : '';
        return (fn + ' ' + ln).trim();
    }
    function calcWaitStatus(row, value, offset) {
        if ((value) ||
            (row.cs.name == STR_CANCELLED) || 
            (row.cs.name == STR_RELEASED) || 
            (row.cs.name == STR_RESCHEDULED)
        ) return '';
        return calcDays(row, offset) < 0 ? STR_WAIT : '';
    }
    function calcLateStatus(row) {
        if ((row.cs.name == STR_CANCELLED) || 
            (row.cs.name == STR_RELEASED) || 
            (row.cs.name == STR_RESCHEDULED)
        ) return '';
        if ((calcResult(row, row.ev.brochure_draft,                     OFF_BRO_DRAFT)   < 0) ||
            (calcResult(row, row.ev.instructor_on_google,               OFF_INS_GOOGLE)  < 0) ||
            (calcResult(row, row.ev.contract_reminder_sent,             OFF_CONTRACT)    < 0) ||
            (calcResultWithDtlAdd(row, row.ev.google_calendar_deleted,  OFF_REM_GOOGLE)  < 0) || // Late only if TEP/MSA & Addendum have been received. 
            (calcResultWithBrochure(row, row.ev.brochure_verified,      OFF_BRO_VERIFY)  < 0) || // Late only if Brochure Approved has been received.
            (calcResultWithBrochure(row, row.ev.brochures_posters_sent, OFF_POSTERS)     < 0) || // Late only if Brochure Approved has been received.
            (calcResultWithBrochure(row, row.ev.marketing_executed,     OFF_MARKETING)   < 0) || // Late only if Brochure Approved has been received.
            (calcResultWithBrochure(row, row.ev.open_on_cvent,          OFF_CVENT_OPEN)  < 0) || // Late only if Brochure Approved has been received.
            (calcResultWithBrochure(row, row.ev.registration_checked,   OFF_REG_VERIFY)   < 0) || // Late only if Brochure Approved has been received.
            (calcResultWithBrochure(row, row.ev.host_notified,          OFF_NOTIFY_HOST) < 0) || // Late only if Brochure Approved has been received.
            (calcResult(row, row.ev.travel_budget,                      OFF_TRAVEL)      < 0) ||
            (calcResult(row, row.go.name,                               OFF_GO_STATUS)   < 0) ||
            (calcResult(row, row.ev.audience_desc_reminder,             OFF_REMINDER)    < 0) ||
            (calcResult(row, row.ev.ads_count,                          OFF_ADS_COUNT)   < 0) ||
            (calcResult(row, row.ev.one_week_confirmation,              OFF_CONFIRM)     < 0) ||
            (calcResult(row, row.ev.brochure_to_faculty,                OFF_BRO_SENT)    < 0) ||
            (calcResult(row, row.ev.book_receipt_confirmed,             OFF_BOOK_RCPT)   < 0) ||
            (calcResult(row, row.ev.trunk_receipt_confirmed,            OFF_TRUNK_RCPT)  < 0) ||
            (calcResult(row, row.ev.attendee_email_reminder,            OFF_REMINDER2)   < 0) ||
            (calcResult(row, row.ev.email_signin_sheets,                OFF_SIGNIN)      < 0) ||
            (calcResult(row, row.ev.compile_attendee_list,              OFF_ATTENDEES)   < 0) ||
            (calcResult(row, row.ev.eval_link_sent,                     OFF_EVAL_LINK)   < 0) ||
            (calcResult(row, row.ev.compile_evals,                      OFF_EVAL_COMP)   < 0) ||
            (calcResult(row, row.ev.edit_evals,                         OFF_EDIT_EVALS)  < 0) ||
            (calcResult(row, row.ev.eval_results_sent,                  OFF_EVAL_SENT)   < 0) ||
            (calcResult(row, row.ev.faculty_feedback_review,            OFF_FEEDBACK)    < 0)
        ) {
            value = STR_LATE;
        } else {
            value = '';
        }
        return value;
    }
    function calcResultWithDtlAdd(row, value, offset) {
        if ((value) || (msaStatus == STR_WAIT) || (addStatus == STR_WAIT)) return 0;
        return calcDays(row, offset)
    }
    function calcResultWithBrochure(row, value, offset) {
        if ((value) || (broStatus == STR_WAIT )) return 0;
        return calcDays(row, offset);
    }
    function calcResult(row, value, offset) {
        if (value) return 0;
        return calcDays(row, offset);
    }
    function calcCellCountdown(row, value, offset) {
        if ((value) ||
            (row.cs.name == STR_CANCELLED) || 
            (row.cs.name == STR_RELEASED) || 
            (row.cs.name == STR_RESCHEDULED)
        ) return value;
        return calcDays(row, offset);
    }
    function calcDays(row, offset) {
        var start = Date.parse(row.ev.day1_date);
        var today = new Date();
        today.setHours(0, 0, 0, 0);
        return  Math.floor((start - today) / DAY) + offset;
    }
    function styleRow(row) {
        if (($('td:eq(' + POS_STATUS + ')', row).text() == STR_CANCELLED) || 
            ($('td:eq(' + POS_STATUS + ')', row).text() == STR_RELEASED) || 
            ($('td:eq(' + POS_STATUS + ')', row).text() == STR_RESCHEDULED)
        ) {
            $('td', row).css('background-color', CLR_IGNORE);
        } else if ($('td:eq(' + POS_OWNER + ')', row).text() == STR_RENEE) {
            $('td', row).css('background-color', CLR_RENEE);
        } else if ($('td:eq(' + POS_OWNER + ')', row).text() == STR_CHRISTINE) {
            $('td', row).css('background-color', CLR_CHRISTINE);
        } else {
            $('td', row).css('background-color', CLR_UNASSIGN);
        }
    }
    
  • svonwellersvonweller Posts: 12Questions: 3Answers: 0
    edited December 2018
    function styleCells(row) {
        msaStatus = $('td:eq(' + POS_MSA + ')', row).text();
        addStatus = $('td:eq(' + POS_ADD + ')', row).text();
        broStatus = $('td:eq(' + POS_BRO + ')', row).text();
    
        // Calc Wait Columns
        calcWaitCell(row, POS_PDF_RCVD);
        calcWaitCell(row, POS_TEP_MSA);
        calcWaitCell(row, POS_ADDENDUM);
        calcWaitCell(row, POS_BRO_APPROVE);
    
        // Calc Warn Columns
        calcWarn1Cell(row, POS_REM_GOOGLE);  // TEP/MSA & Addendum
        calcWarn2Cell(row, POS_BRO_VERIFY);  // Brochure Approved
        calcWarn2Cell(row, POS_POSTERS);     // Brochure Approved
        calcWarn2Cell(row, POS_MARKETING);   // Brochure Approved
        calcWarn2Cell(row, POS_CVENT_OPEN);  // Brochure Approved
        calcWarn2Cell(row, POS_REG_VERIFY);  // Brochure Approved
        calcWarn2Cell(row, POS_NOTIFY_HOST); // Brochure Approved
        
        // Calc Late Columns
        calcLateCell(row, POS_BRO_DRAFT);
        calcLateCell(row, POS_INS_GOOGLE);
        calcLateCell(row, POS_CONTRACT);
        calcLateCell(row, POS_TRAVEL);
        calcLateCell(row, POS_GO_STATUS);
        calcLateCell(row, POS_REMINDER);
        calcLateCell(row, POS_ADS_COUNT);
        calcLateCell(row, POS_CONFIRM);
        calcLateCell(row, POS_BRO_SENT);
        calcLateCell(row, POS_BOOK_RCPT);
        calcLateCell(row, POS_TRUNK_RCPT);
        calcLateCell(row, POS_REMINDER2);
        calcLateCell(row, POS_SIGNIN);
        calcLateCell(row, POS_ATTENDEES);
        calcLateCell(row, POS_EVAL_LINK);
        calcLateCell(row, POS_EVAL_COMP);
        calcLateCell(row, POS_EDIT_EVALS);
        calcLateCell(row, POS_EVAL_SENT);
        calcLateCell(row, POS_feedback);
    
        // Calc Status Columns
        for (idx = POS_DTL; idx < POS_STAFF; idx++) {
            if ($('td:eq(' + idx + ')', row).text() == STR_WAIT)  $( 'td:eq(' + idx + ')', row ).css( 'background-color', CLR_WAIT );
        }
        if ($('td:eq(' + POS_STAFF + ')', row).text() == STR_LATE)  $( 'td:eq(' + POS_STAFF + ')', row ).css( 'background-color', CLR_LATE );
    }
    function calcWaitCell(row, col) {
        if ($('td:eq(' + col + ')', row).text() < 0)  $( 'td:eq(' + col + ')', row ).css( 'background-color', CLR_WAIT );   
    }
    function calcWarn1Cell(row, col) {
        if($('td:eq(' + col + ')', row).text() < 0)  {
            if ((msaStatus == STR_WAIT) || (addStatus == STR_WAIT)) {
                $( 'td:eq(' + col + ')', row ).css( 'background-color', CLR_WARN );
            } else {
                $( 'td:eq(' + col + ')', row ).css( 'background-color', CLR_LATE );
            }
        }
    }
    function calcWarn2Cell(row, col) {
        if ($('td:eq(' + col + ')', row).text() < 0)  {
            if (broStatus == STR_WAIT ) {
                $( 'td:eq(' + col + ')', row ).css( 'background-color', CLR_WARN ); 
            } else {
                $( 'td:eq(' + col + ')', row ).css( 'background-color', CLR_LATE );
            }
        }
    }
    function calcLateCell(row, col) {
        if ($('td:eq(' + col + ')', row).text() < 0)  $( 'td:eq(' + col + ')', row ).css( 'background-color', CLR_LATE );   
    }
    function showHideColumns(show) {
        table.columns( $('.hidden') ).visible( show );
    }
    function displayCheckbox(data) {
        checked = (data == '1') ? 'checked' : '';
        return "<input type='checkbox' value='" + data + "' disabled " + checked + ">";
    }
    
  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    edited December 2018

    Posts above - Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    I'm 99% certain that the issue is because of the use of an alias for the event / ev table. Could you remove your aliases and try it with just the long form names place?

    Thanks,
    Allan

  • svonwellersvonweller Posts: 12Questions: 3Answers: 0

    Now, I am getting:

    DataTables warning: table id=mgmt - JSON encoding error: Malformed UTF-8 characters, possibly incorrectly encoded

    Where (error on this line in jquery.dataTables.min.js):

    y(a);if("ssp"!=e||g)"ajax"==e?sa(a,[],function(c){var f=ta(a,c);for(b=0;b<f.length;b++)O(a,f[b]);a.iInitDisplayStart=d;T(a);C(a,!1);ua(a,c)},a):(C(a,!1),ua(a))}else setTimeout(function(){ha(a)},200)}function ua(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&$(a);r(a,null,"plugin-init",[a,b]);r(a,"aoInitComplete","init",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);r(a,null,"length",[a,c])}function pb(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=

    All of our tables are utf8mb4

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    I wonder if the PHP / database interface is not utf8 though. What database are you using? If its MySQL / MariaDb, try using:

    $db->sql("SET names utf8");
    

    just before the Editor::inst( ... ) factory call.

    Allan

This discussion has been closed.