Example #1
0
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 ********************************************************************************/
?>

<?php 
$productNames = json_encode((object) Product::productNames());
$prices = json_encode((object) Product::productPrices());
$defaultCurrency = Yii::app()->params['currency'];
Yii::app()->clientScript->registerScript("productTableQuoteCreate", "\n\$(function() {\n\taddProduct('create', '{$defaultCurrency}', {$productNames}, {$prices});\n\t\$('#new-quote').hide();\n   \t/*\n\t\$('#create-quote-button').click(function() {\n\t\t" . CHtml::ajax(array('update' => '#history-list-wrapper', 'url' => Yii::app()->createUrl('contacts/quickUpdateHistory', array('id' => $contactId)))) . "\n\t}); */\n});\n", CClientScript::POS_END);
$form = $this->beginWidget('CActiveForm', array('id' => 'quote-form-inside', 'enableAjaxValidation' => false));
// Get Quotes field 'name'
$nameField = Fields::model()->findByAttributes(array('modelName' => 'Quotes', 'fieldName' => 'name'));
$expirationField = Fields::model()->findByAttributes(array('modelName' => 'Quotes', 'fieldName' => 'expirationDate'));
$existingProductsField = Fields::model()->findByAttributes(array('modelName' => 'Quotes', 'fieldName' => 'existingProducts'));
?>

<?php 
echo CHtml::button(Yii::t('quotess', 'New Quote'), array('id' => 'show-new-quote-button', 'onclick' => 'toggleNewQuote();', 'class' => 'x2-button'));
?>

<div id="new-quote">
<b><?php