Merge in from pre_0.1 branch
git-svn-id: file:///svn-source/pmgr/trunk/site@847 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -42,11 +42,12 @@ function customerContactDiv($obj, $values = null, $primary = false) {
|
||||
' CLASS="contact-%{id}-source" ' . "\n" .
|
||||
' ID="contact-%{id}-source-'.$stype.'"' . "\n" .
|
||||
' VALUE="'.$stype.'"' . "\n" .
|
||||
//' CHECKED' . "\n" .
|
||||
($stype == 'new' ? ' CHECKED' . "\n" : '') .
|
||||
' />' . "\n" .
|
||||
' <LABEL FOR="contact-%{id}-source-'.$stype.'">'.$sname.'</LABEL>' . "\n" .
|
||||
' ';
|
||||
}
|
||||
$div .= "<P>(Phone numbers / Addresses can be added later)";
|
||||
}
|
||||
$div .= "\n";
|
||||
|
||||
@@ -75,23 +76,35 @@ function customerContactDiv($obj, $values = null, $primary = false) {
|
||||
(
|
||||
'Customer.primary_contact_entry' => array
|
||||
('name' => 'Primary Contact',
|
||||
'label_attributes' => array('class' => null),
|
||||
'no_prefix' => true,
|
||||
'opts' => array
|
||||
('type' => 'radio',
|
||||
'options' => array('%{id}' => false),
|
||||
'value' => ($primary ? '%{id}' : 'bogus-value-to-suppress-hidden-input'),
|
||||
)),
|
||||
),
|
||||
'after' => ("Check this button if this contact will be the primary" .
|
||||
" contact for this customer (there can be only one primary" .
|
||||
" contact"),
|
||||
),
|
||||
|
||||
|
||||
'type' => array
|
||||
('opts' => array
|
||||
('label_attributes' => array('class' => 'required'),
|
||||
'opts' => array
|
||||
('options' => $obj->varstore['contactTypes'],
|
||||
'selected' => (isset($values) ? $values['ContactsCustomer']['type'] : null),
|
||||
)),
|
||||
),
|
||||
'after' => "An actual tenant, or just an alternate contact?"
|
||||
),
|
||||
|
||||
'comment' => array
|
||||
('opts' => array
|
||||
('label_attributes' => array('class' => 'optional empty'),
|
||||
'opts' => array
|
||||
('value' => (isset($values) ? $values['ContactsCustomer']['comment'] : null),
|
||||
)),
|
||||
),
|
||||
'after' => "Optional: Comments on the relationship between this customer and this contact."
|
||||
),
|
||||
|
||||
))) . "\n" .
|
||||
|
||||
@@ -115,22 +128,37 @@ function customerContactTypeDiv($obj, $stype, $values = null) {
|
||||
if ($stype === 'existing') {
|
||||
$fields = array
|
||||
('id' => array('name' => 'Contact',
|
||||
'opts' => array('options' => $obj->varstore['contacts'])),
|
||||
'label_attributes' => array('class' => 'required empty'),
|
||||
'opts' => array('options' => $obj->varstore['contacts']),
|
||||
'after' => "Select the existing contact."),
|
||||
);
|
||||
}
|
||||
elseif ($stype === 'new') {
|
||||
$fields = array
|
||||
('first_name' => true,
|
||||
'last_name' => true,
|
||||
'middle_name' => true,
|
||||
'display_name' => true,
|
||||
'company_name' => array('name' => 'Company'),
|
||||
'id_federal' => array('name' => 'SSN'),
|
||||
'id_local' => array('name' => 'ID #'),
|
||||
'id_local_state' => array('name' => 'ID State'),
|
||||
('last_name' => array('label_attributes' => array('class' => 'recommended empty'),
|
||||
'after' => "Recommended."),
|
||||
'first_name' => array('label_attributes' => array('class' => 'recommended empty'),
|
||||
'after' => "Recommended."),
|
||||
'middle_name' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional."),
|
||||
'company_name' => array('name' => 'Company',
|
||||
'label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Company name, if corporate contact."),
|
||||
'display_name' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional with first/last name; Required otherwise."),
|
||||
'id_federal' => array('name' => 'SSN',
|
||||
'label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Social Security Number."),
|
||||
'id_local' => array('name' => 'ID #',
|
||||
'label_attributes' => array('class' => 'recommended empty'),
|
||||
'after' => "Recommended: Driver's license, for example."),
|
||||
'id_local_state' => array('name' => 'ID State',
|
||||
'label_attributes' => array('class' => 'recommended empty'),
|
||||
'after' => "Recommended: State which issued the ID."),
|
||||
/* 'id_local_exp' => array('name' => 'ID Expiration', */
|
||||
/* 'opts' => array('empty' => true)), */
|
||||
'comment' => true,
|
||||
'comment' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => "Optional: Comments about this contact."),
|
||||
);
|
||||
}
|
||||
elseif ($stype === 'show') {
|
||||
@@ -151,14 +179,14 @@ function customerContactTypeDiv($obj, $stype, $values = null) {
|
||||
'<div ' . "\n" .
|
||||
' class="contact-%{id}-div"' . "\n" .
|
||||
' id="contact-%{id}-'.$stype.'-div"' . "\n" .
|
||||
(isset($values) ? '' : ' STYLE="display:none;"' . "\n") .
|
||||
((isset($values) || $stype == 'new') ? '' : ' STYLE="display:none;"' . "\n") .
|
||||
'>' . "\n" .
|
||||
|
||||
$obj->element
|
||||
($element,
|
||||
array('class' => "item contact {$class}",
|
||||
'field_prefix' => 'Contact.%{id}')
|
||||
+ compact('rows', 'fields', 'column_class')) .
|
||||
+ compact('rows', 'fields', 'row_class', 'column_class')) .
|
||||
|
||||
($stype === 'show'
|
||||
? '<input type="hidden" name="data[Contact][%{id}][id]" value="'.$values['id'].'"/>' . "\n"
|
||||
@@ -221,8 +249,28 @@ function customerContactTypeDiv($obj, $stype, $values = null) {
|
||||
.slideDown();
|
||||
}
|
||||
|
||||
function setEmpty(input_elem) {
|
||||
selector = "label[for=" + $(input_elem).attr("id") + "]";
|
||||
//$("#debug").append($(input_elem).attr("id") + ": " + $(input_elem).val() + "<BR>");
|
||||
if ($(input_elem).val() == '')
|
||||
$(selector).addClass('empty');
|
||||
else
|
||||
$(selector).removeClass('empty');
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
resetForm();
|
||||
|
||||
// In case refresh is hit with populated fields
|
||||
$(":input").each(function(i,elem){ setEmpty(elem); });
|
||||
|
||||
// keyup doesn't catch cut from menu
|
||||
$(":input").live('keyup', function(){
|
||||
setEmpty(this);
|
||||
});
|
||||
$(":input").live('mouseup', function(){
|
||||
setEmpty(this);
|
||||
});
|
||||
});
|
||||
|
||||
--></script>
|
||||
@@ -247,8 +295,12 @@ echo($this->element
|
||||
array('class' => 'item customer detail',
|
||||
'caption' => isset($this->data['Customer']) ? 'Edit Customer' : 'New Customer',
|
||||
'fields' => array
|
||||
('name' => true,
|
||||
'comment' => true,
|
||||
('name' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => ("Optional: If this field is left blank, the" .
|
||||
" customer name will be set to the name of" .
|
||||
" the primary contact, below.")),
|
||||
'comment' => array('label_attributes' => array('class' => 'optional empty'),
|
||||
'after' => 'Optional: Comments about this customer.'),
|
||||
))) . "\n");
|
||||
|
||||
echo $form->submit(isset($this->data['Customer']) ? 'Update' : 'Add New Customer') . "\n";
|
||||
@@ -268,6 +320,11 @@ echo $form->submit(isset($this->data['Customer']) ? 'Update' : 'Add New Customer
|
||||
<?php
|
||||
; // Alignment
|
||||
|
||||
if (!empty($movein['Unit']['id']))
|
||||
echo $form->input("movein.Unit.id",
|
||||
array('type' => 'hidden',
|
||||
'value' => $movein['Unit']['id'])) . "\n";
|
||||
|
||||
echo $form->submit(isset($this->data['Customer']) ? 'Update' : 'Add New Customer') . "\n";
|
||||
echo $form->submit('Cancel', array('name' => 'cancel')) . "\n";
|
||||
echo $form->end() . "\n";
|
||||
|
||||
Reference in New Issue
Block a user