82 lines
2 KiB
PHP
Executable file
82 lines
2 KiB
PHP
Executable file
<script type="text/javascript">
|
|
$(function() {
|
|
|
|
$("#UserAddUserForm").validate();
|
|
|
|
$("#submitUserButton").button();
|
|
|
|
$("#UserAddUserForm").ajaxForm({
|
|
dataType: 'json',
|
|
// success identifies the function to invoke when the server response
|
|
// has been received
|
|
success: processJson
|
|
});
|
|
|
|
function processJson(data) {
|
|
if(data.status == 'success') {
|
|
window.location.reload();
|
|
}
|
|
else {
|
|
alert("Error while adding/editing this Contact");
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
<?php echo $form->create('User', array('action' => 'add_user')); ?>
|
|
|
|
|
|
|
|
<?php
|
|
echo $form->input('first_name', array('class' => 'required'));
|
|
echo $form->input('last_name', array('class' => ''));
|
|
echo $form->input('email', array('class' => 'required email'));
|
|
echo $form->input('job_title');
|
|
echo $form->input('phone');
|
|
echo $form->input('phone_extension');
|
|
echo $form->input('mobile');
|
|
echo $form->input('fax');
|
|
|
|
echo $form->input('direct_phone');
|
|
echo $form->input('notes');
|
|
|
|
|
|
switch ($type) {
|
|
case 'contact':
|
|
echo $form->input('customer_id', array('type' => 'hidden', 'value' => $customer_id));
|
|
echo $form->input('type', array('type' => 'hidden', 'value' => 'contact'));
|
|
$buttonStr = 'Contact';
|
|
break;
|
|
|
|
case 'principle':
|
|
echo $form->input('principle_id', array('type' => 'hidden', 'value' => $principle_id));
|
|
$buttonStr = 'Principle Contact';
|
|
echo $form->input('primary_contact');
|
|
|
|
case 'user':
|
|
$buttonStr = 'User';
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
switch ($action) {
|
|
case 'add':
|
|
$actionStr = 'Add';
|
|
break;
|
|
|
|
case 'edit':
|
|
$actionStr = 'Edit';
|
|
echo $form->input('id', array('type' => 'hidden', 'value' => $user_id));
|
|
|
|
break;
|
|
}
|
|
|
|
|
|
echo $form->submit($actionStr . ' ' . $buttonStr, array('id' => 'submitUserButton'));
|
|
?>
|