Adding title to lead table and the lead_contact table.
Adding code to the data classes and the forms to save the data.
Moving the fields in the main screen for lead edit.
Working on the pdf output.
Restrict them so they can only edit one note at a time.
Have the referred by grouped.
'use' => 'a',
),
+ 'title' => array(
+ 'field' => 'title',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a',
+ ),
+
'name' => array(
'field' => 'name',
'type' => 'text',
'use' => 'a'
),
+ 'title' => array(
+ 'field' => 'title',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a',
+ ),
+
'fname' => array(
'field' => 'fname',
'type' => 'text',
text-indent: -9000px;
margin: 10px;
}
+.glm-travel-edit .tlEdit {
+ display: inline-block;
+ width: 16px;
+ height: 16px;
+ background: url(../assets/user_edit.png) no-repeat;
+ margin: 10px;
+}
+.edit-log {
+ width: 100%;
+}
#addLog textarea {
width: 100%;
div.webform table, div.webform td {
border: 1px solid #aaa !important;
}
-/* Overriding JqueryUI */
-/* #travel-admin .ui-state-highlight { */
-/* margin-bottom: .5em; */
-/* padding: 15px; */
-/* } */
-/* #travel-admin .ui-state-highlight p { */
-/* margin: 0; */
-/* } */
-/* #travel-admin .ui-icon { */
-/* float: left; */
-/* margin-right: .3em; */
-/* display: block; */
-/* } */
-/* #tabs li a { */
-/* font-size: 13px; */
-/* font-size: 1.3rem; */
-/* } */
#travel-admin .tsLog {
margin: 10px 0;
border-top: 1px dotted #369;
/* Member travel leads */
#file_export fieldset {
- /* border-width: 2px; */
- /* border-style: groove; */
- /* border-color: grey; */
- /* position: relative; */
- /* width: 90%; */
- /* padding: 30px; */
}
.clearfix {
display: inline-block;
display: inline-block;
}
-
/* Members Travel Leads */
#intTogParent, #disTogParent, #intTogParent2, #intTogParent1, #locTogParent {
* version from this plugin.
*/
define('GLM_MEMBERS_TRAVEL_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_TRAVEL_PLUGIN_DB_VERSION', '0.0.3');
+define('GLM_MEMBERS_TRAVEL_PLUGIN_DB_VERSION', '0.0.4');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_TRAVEL_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
$contacts = $this->formatContacts( $lead['contacts'] );
$referred_by = $this->formatReferredBy( $lead['refs'] );
- $pdf->ezText( $lead['company'], $size );
+ $curY = $pdf->ezText( $lead['company'], $size );
+ $saveY = $curY;
$pdf->selectFont( $mainFont );
- $pdf->ezText( $lead['address'], $size );
- $pdf->ezText( $lead['city'] . ', ' . $lead['state']['value'] . ' ' . $lead['zip'], $size );
- $pdf->ezText( $lead['website'], $size );
- $pdf->ezText( "\n", $size );
+ $curY = $pdf->ezText( $lead['address'], $size );
+ $curY = $pdf->ezText( $lead['city'] . ', ' . $lead['state']['value'] . ' ' . $lead['zip'], $size );
+ if ( $lead['website'] ) {
+ $curY = $pdf->ezText( $lead['website'], $size );
+ }
+ if ( $lead['phone'] ) {
+ $pdf->ezText( '<b>Phone:</b> ' . $lead['phone'], $size, $option );
+ }
+ if ( $lead['fax'] ) {
+ $pdf->ezText( '<b>Fax:</b> ' . $lead['fax'], $size, $option );
+ }
+ $curY = $pdf->ezText( "\n", $size );
+ $endMainY = $curY;
+
+ // Main contact
+ $pdf->ezSetY( $saveY + 10 );
+ $option = array(
+ 'left' => 310
+ );
+ $lead_contact = '';
+ if ( $lead['fname'] ) {
+ $lead_contact .= $lead['fname'] . ' ' . $lead['lname'];
+ }
+ if ( $lead['title'] ) {
+ $lead_contact .= ', ' . $lead['title'];
+ }
+ $pdf->ezText( $lead_contact, $size, $option );
+ if ( $lead['email'] ) {
+ $pdf->ezText( $lead['email'], $size, $option );
+ }
+ $curY = $pdf->ezText( "\n", $size );
+
// Contacts
if ( $lead['contacts'] ) {
+ $pdf->ezSetY( $endMainY );
+ $curY = $pdf->ezText( '<b>Additional Contacts</b>', $size );
+ $column = 1;
+ $saveY = $curY;
+ $contact_string = '';
foreach ( $lead['contacts'] as $contact ) {
- $pdf->ezText( $contact['name'], $size );
- $pdf->ezText( $contact['email'], $size );
- $pdf->ezText( $contact['phone'], $size );
- $pdf->ezText( "\n", $size );
- }
- }
- // Notes
- if ( $lead['notes'] ) {
- foreach ( $lead['notes'] as $note ) {
- $pdf->selectFont( $mainFontBold );
- $pdf->ezText( $note['updated']['datetime'], $size );
- $pdf->selectFont( $mainFont );
- $pdf->ezText( $note['notes'], $size );
- $pdf->ezText( "\n", $size );
+ if ( $column > 3 ) {
+ $column = 1;
+ $saveY = $curY;
+ }
+ if ( $column > 1 ) {
+ $pdf->ezSetY( $saveY );
+ }
+ switch ( $column ) {
+ case 1:
+ $options = array( 'left' => 0 );
+ break;
+ case 2:
+ $options = array( 'left' => 160 );
+ break;
+ case 3:
+ $options = array( 'left' => 310 );
+ break;
+ }
+ $contact_name = '';
+ if ( $contact['name'] ) {
+ $contact_name .= $contact['name'];
+ }
+ if ( $contact['title'] ) {
+ $contact_name .= ', ' . $contact['title'];
+ }
+ $pdf->ezText( $contact_name, $size, $options );
+ if ( $contact['email'] ) {
+ $pdf->ezText( $contact['email'], $size, $options );
+ }
+ if ( $contact['phone'] ) {
+ $pdf->ezText( $contact['phone'], $size, $options );
+ }
+ $curY = $pdf->ezText( "\n", $size );
+ $column++;
}
}
+
// Referred By
if ( $lead['refs'] ) {
$pdf->selectFont( $mainFontBold );
}
$pdf->ezText( "\n", $size );
}
+ // Notes
+ if ( $lead['notes'] ) {
+ foreach ( $lead['notes'] as $note ) {
+ $pdf->selectFont( $mainFontBold );
+ $pdf->ezText( $note['updated']['datetime'], $size );
+ $pdf->selectFont( $mainFont );
+ $pdf->ezText( $note['notes'], $size );
+ $pdf->ezText( "\n", $size );
+ }
+ }
$lead_count++;
}
'updated' => date( 'Y-m-d H:i:s' ),
'lead' => $lead_id,
'name' => filter_var( $_REQUEST['name'] ),
+ 'title' => filter_var( $_REQUEST['title'] ),
'email' => filter_var( $_REQUEST['email'] ),
'phone' => filter_var( $_REQUEST['phone'] ),
array(
'%s', // updated
'%d', // lead
+ '%s', // title
'%s', // name
'%s', // email
'%s', // phone
default:
$lead_id = filter_var( $_REQUEST['lead_id'], FILTER_VALIDATE_INT );
$allReferredBy = $this->getList();
- // echo '<pre>$allReferredBy: ' . print_r( $allReferredBy, true ) . '</pre>';
$LeadReferredBy = new GlmDataTravelLeadsReferredBy( $this->wpdb, $this->config );
$leadReferredByData = $LeadReferredBy->getList( "T.lead = $lead_id" );
if ( $leadReferredByData ) {
}
}
+ // Sort results by hierarchy (Parent/Child and Alpha)
+ $allReferredBy = $this->sortParentChild($allReferredBy);
+ // echo '<pre>$allReferredBy: ' . print_r( $allReferredBy, true ) . '</pre>';
+
$view = 'list.html';
break;
}
status INT NOT NULL DEFAULT 0, -- Lead Status (active, inactive)
create_date DATE NOT NULL, -- Date contact was created
updated DATETIME NOT NULL, -- Updated Timestamp
+ title TEXT NULL, -- Title of Lead
fname TEXT NULL, -- First Name
lname TEXT NULL, -- Last Name
email TINYTEXT NULL, -- Email
id INT NOT NULL AUTO_INCREMENT,
lead INT NOT NULL, -- Reference to lead table
updated DATETIME NOT NULL, -- Updated Timestamp
+ title TINYTEXT NULL, -- Title of Contact
name TINYTEXT, -- Name of Contact
email TINYTEXT, -- Email of Contact
phone TINYTEXT, -- Phone of Contact
'0.0.1' => array('version' => '0.0.1', 'tables' => 4, 'date' => '05/18/18'),
'0.0.2' => array('version' => '0.0.2', 'tables' => 5, 'date' => '05/23/18'),
'0.0.3' => array('version' => '0.0.3', 'tables' => 6, 'date' => '05/31/18'),
+ '0.0.4' => array('version' => '0.0.4', 'tables' => 6, 'date' => '06/07/18'),
);
--- /dev/null
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 05/31/2018
+-- Database Version: 0.0.3
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Add Title to lead
+ALTER TABLE {prefix}leads ADD title TEXT NULL; -- Title for lead
+
+----
+
+-- Add Title to lead_contacts
+ALTER TABLE {prefix}leads_contacts ADD TINYTEXT NULL; -- Title for Contact
<fieldset>
<legend>Add New Contact</legend>
<table>
+ <tr>
+ <td><label for="new_name">Title</label></td>
+ <td><input id="new_title" type="text" name="title" class="glm-form-text-input-medium" /></td>
+ </tr>
<tr>
<td><label for="new_name">Name</label></td>
- <td><input id="new_name" type="text" name="name" /></td>
+ <td><input id="new_name" type="text" name="name" class="glm-form-text-input-medium" /></td>
</tr>
<tr>
<td><label for="new_email">Email</label></td>
- <td><input id="new_email" type="email" name="email" /></td>
+ <td><input id="new_email" type="email" name="email" class="glm-form-text-input-medium" /></td>
</tr>
<tr>
<td><label for="new_phone">Phone</label></td>
- <td><input id="new_phone" type="tel" name="phone" /></td>
+ <td><input id="new_phone" type="tel" name="phone" class="glm-form-text-input-medium" /></td>
</tr>
<tr>
<td colspan="2">
{* List of contacts *}
<table width="100%" class="wp-list-table striped glm-admin-table-single">
<thead>
+ <th> Title </th>
<th> Name </th>
<th> Phone </th>
<th> Email </th>
{if $contacts}
{foreach $contacts as $c}
<tr {if $c@iteration is div by 2}class="alternate"{/if}>
+ <td>{$c.title}</td>
<td>{$c.name}</td>
<td>{$c.phone}</td>
<td>{$c.email}</td>
{if $notes}
{foreach $notes as $n}
<div id="show-log-{$n.id}" class="tsLog">
- <h2>{$n.updated.datetime}</h2>
+ <h2>{$n.updated.datetime}<span class="tlEdit" data-id="{$n.id}"> </span></h2>
<p class="tsNote" data-id="{$n.id}">{$n.notes|nl2br}</p>
<a
class="tlDelete"
<div id="edit-log-{$n.id}" class="tsEditLog" style="display: none;">
<textarea class="edit-log" name="note_entry" cols="30" rows="5">{$n.notes}</textarea>
<input type="submit" class="button" value="Save" />
+ <button class="cancel-edit" data-id="{$n.id}">Cancel</button>
</div>
</form>
{/foreach}
<script>
jQuery(function($){
- $('.tsNote').click(function(){
+
+ var editMode = false;
+
+ // Function for the click event of tsNote
+ $('.tsNote, .tlEdit').click(function(){
+ if ( editMode ) {
+ alert( 'Please finish your current edit first!' );
+ return false;
+ }
+ editMode = true;
var dataId = $(this).data('id');
+
// Show the edit form
$('#edit-log-' + dataId).show();
+
// Hide the tsLog output
$('#show-log-' + dataId).hide();
});
+
+ $('.cancel-edit').click(function(e){
+ e.preventDefault();
+ var dataId = $(this).data('id');
+ editMode = false;
+
+ // Hide the edit form
+ $('#edit-log-' + dataId).hide();
+
+ // Show the tsLog output
+ $('#show-log-' + dataId).show();
+ });
+
$('.tlDelete').click(function(){
return confirm('This will delete this note entry! Are you sure?');
});
+
});
</script>
</div>
<table>
- <tr>
- <td>Referred By</td>
- </tr>
<tr>
<td>
{foreach $referredby as $r}
- <label class="glmCheckBox">
- <input
- type="checkbox"
- name="referredby[{$r.id}]"
- value="1"
- {if isset($refs[$r.id]) && $refs[$r.id]}checked{/if} />
- {$r.name}
- </label>
+ {if $r.parent.value == 0}
+ <h3>{$r.name}</h3>
+ {else}
+ <label class="glmCheckBox">
+ <input
+ type="checkbox"
+ name="referredby[{$r.id}]"
+ value="1"
+ {if isset($refs[$r.id]) && $refs[$r.id]}checked{/if} />
+ {$r.name}
+ </label>
+ {/if}
{/foreach}
</td>
</tr>
<tr>
<td {if $lead.fieldRequired.company}class="glm-required"{/if}>Company:</td>
<td {if $lead.fieldFail.company}class="glm-form-bad-input" data-tabid="glm-travel-company"{/if}>
- <input type="text" name="company" value="{$lead.fieldData.company}" class="glm-form-text-input">
+ <input type="text" name="company" value="{$lead.fieldData.company}" class="glm-form-text-input-medium">
{if $lead.fieldFail.company}<p>{$lead.fieldFail.company}</p>{/if}
</td>
</tr>
- <tr>
- <td {if $lead.fieldRequired.fname}class="glm-required"{/if}>First Name:</td>
- <td {if $lead.fieldFail.fname}class="glm-form-bad-input" data-tabid="glm-travel-fname"{/if}>
- <input type="text" name="fname" value="{$lead.fieldData.fname}" class="glm-form-text-input">
- {if $lead.fieldFail.fname}<p>{$lead.fieldFail.fname}</p>{/if}
- </td>
- </tr>
-
- <tr>
- <td {if $lead.fieldRequired.lname}class="glm-required"{/if}>Last Name:</td>
- <td {if $lead.fieldFail.lname}class="glm-form-bad-input" data-tabid="glm-travel-lname"{/if}>
- <input type="text" name="lname" value="{$lead.fieldData.lname}" class="glm-form-text-input">
- {if $lead.fieldFail.lname}<p>{$lead.fieldFail.lname}</p>{/if}
- </td>
- </tr>
-
<tr>
<td {if $lead.fieldRequired.address}class="glm-required"{/if}>Address:</td>
<td {if $lead.fieldFail.address}class="glm-form-bad-input" data-tabid="glm-travel-address"{/if}>
- <input type="text" name="address" value="{$lead.fieldData.address}" class="glm-form-text-input">
+ <input type="text" name="address" value="{$lead.fieldData.address}" class="glm-form-text-input-medium">
{if $lead.fieldFail.address}<p>{$lead.fieldFail.address}</p>{/if}
</td>
</tr>
<tr>
<td {if $lead.fieldRequired.address2}class="glm-required"{/if}>Address 2:</td>
<td {if $lead.fieldFail.address2}class="glm-form-bad-input" data-tabid="glm-travel-address2"{/if}>
- <input type="text" name="address2" value="{$lead.fieldData.address2}" class="glm-form-text-input">
+ <input type="text" name="address2" value="{$lead.fieldData.address2}" class="glm-form-text-input-medium">
{if $lead.fieldFail.address2}<p>{$lead.fieldFail.address2}</p>{/if}
</td>
</tr>
<tr>
<td {if $lead.fieldRequired.city}class="glm-required"{/if}>City:</td>
<td {if $lead.fieldFail.city}class="glm-form-bad-input" data-tabid="glm-travel-city"{/if}>
- <input type="text" name="city" value="{$lead.fieldData.city}" class="glm-form-text-input">
+ <input type="text" name="city" value="{$lead.fieldData.city}" class="glm-form-text-input-medium">
{if $lead.fieldFail.city}<p>{$lead.fieldFail.city}</p>{/if}
</td>
</tr>
<tr>
<td {if $lead.fieldRequired.zip}class="glm-required"{/if}>ZIP/Postal Code:</td>
<td {if $lead.fieldFail.zip}class="glm-form-bad-input" data-tabid="glm-travel-zip"{/if}>
- <input type="text" name="zip" value="{$lead.fieldData.zip}" class="glm-form-text-input">
+ <input type="text" name="zip" value="{$lead.fieldData.zip}" class="glm-form-text-input-medium">
{if $lead.fieldFail.zip}<p>{$lead.fieldFail.zip}</p>{/if}
</td>
</tr>
+ <tr>
+ <td {if $lead.fieldRequired.title}class="glm-required"{/if}>Title:</td>
+ <td {if $lead.fieldFail.title}class="glm-form-bad-input" data-tabid="glm-travel-title"{/if}>
+ <input type="text" name="title" value="{$lead.fieldData.title}" class="glm-form-text-input-medium">
+ {if $lead.fieldFail.title}<p>{$lead.fieldFail.title}</p>{/if}
+ </td>
+ </tr>
+
+ <tr>
+ <td {if $lead.fieldRequired.fname}class="glm-required"{/if}>First Name:</td>
+ <td {if $lead.fieldFail.fname}class="glm-form-bad-input" data-tabid="glm-travel-fname"{/if}>
+ <input type="text" name="fname" value="{$lead.fieldData.fname}" class="glm-form-text-input-medium">
+ {if $lead.fieldFail.fname}<p>{$lead.fieldFail.fname}</p>{/if}
+ </td>
+ </tr>
+
+ <tr>
+ <td {if $lead.fieldRequired.lname}class="glm-required"{/if}>Last Name:</td>
+ <td {if $lead.fieldFail.lname}class="glm-form-bad-input" data-tabid="glm-travel-lname"{/if}>
+ <input type="text" name="lname" value="{$lead.fieldData.lname}" class="glm-form-text-input-medium">
+ {if $lead.fieldFail.lname}<p>{$lead.fieldFail.lname}</p>{/if}
+ </td>
+ </tr>
+
<tr>
<td {if $lead.fieldRequired.email}class="glm-required"{/if}>Email:</td>
<td {if $lead.fieldFail.email}class="glm-form-bad-input" data-tabid="glm-travel-email"{/if}>
- <input type="text" name="email" value="{$lead.fieldData.email}" class="glm-form-text-input">
+ <input type="text" name="email" value="{$lead.fieldData.email}" class="glm-form-text-input-medium">
{if $lead.fieldFail.email}<p>{$lead.fieldFail.email}</p>{/if}
</td>
</tr>
<tr>
<td {if $lead.fieldRequired.phone}class="glm-required"{/if}>Phone:</td>
<td {if $lead.fieldFail.phone}class="glm-form-bad-input" data-tabid="glm-travel-phone"{/if}>
- <input type="text" name="phone" value="{$lead.fieldData.phone}" class="glm-form-text-input">
+ <input type="text" name="phone" value="{$lead.fieldData.phone}" class="glm-form-text-input-medium">
{if $lead.fieldFail.phone}<p>{$lead.fieldFail.phone}</p>{/if}
</td>
</tr>
<tr>
<td {if $lead.fieldRequired.fax}class="glm-required"{/if}>Fax:</td>
<td {if $lead.fieldFail.fax}class="glm-form-bad-input" data-tabid="glm-travel-fax"{/if}>
- <input type="text" name="fax" value="{$lead.fieldData.fax}" class="glm-form-text-input">
+ <input type="text" name="fax" value="{$lead.fieldData.fax}" class="glm-form-text-input-medium">
{if $lead.fieldFail.fax}<p>{$lead.fieldFail.fax}</p>{/if}
</td>
</tr>
<tr>
<td {if $lead.fieldRequired.website}class="glm-required"{/if}>Website:</td>
<td {if $lead.fieldFail.website}class="glm-form-bad-input" data-tabid="glm-travel-website"{/if}>
- <input type="text" name="website" value="{$lead.fieldData.website}" class="glm-form-text-input">
+ <input type="text" name="website" value="{$lead.fieldData.website}" class="glm-form-text-input-medium">
{if $lead.fieldFail.website}<p>{$lead.fieldFail.website}</p>{/if}
</td>
</tr>