<?php echo CHtml::label('Supplier', 'Supplier', array('class' => 'col-lg-2')); ?> <div class="col-lg-10 "> <?php echo CHtml::dropDownList('Supplier', Yii::app()->request->getPost('Supplier'), Supplier::getDropdownListItems(), array('prompt' => ' - Select - ', 'class' => 'form-control')); ?> </div> </div> <div class="form-group"> <?php echo CHtml::label('Produce Type', 'SupplierProduct', array('class' => 'col-lg-2')); ?> <div class="col-lg-10 "> <?php echo CHtml::dropDownList('SupplierProduct', Yii::app()->request->getPost('SupplierProduct'), SupplierProduct::getDropdownListItems(), array('prompt' => ' - Select - ', 'class' => 'form-control')); ?> </div> </div> <div class="form-group"> <?php echo CHtml::label('Organic Status', 'organicStatus', array('class' => 'col-lg-2')); ?> <div class="col-lg-10 "> <?php echo CHtml::dropDownList('organicStatus', Yii::app()->request->getPost('organicStatus'), Supplier::getOSDropdownListItems(), array('prompt' => ' - Select - ', 'class' => 'form-control')); ?> </div> </div> <div class="form-group"> <div class="col-lg-10 col-lg-offset-2">
<?php foreach ($model->Products as $SPP) { ?> <?php echo $this->renderPartial('_spp_form', array('SPP' => $SPP, 'supplier_id' => $model->supplier_id)); ?> <?php } ?> </div> <div id="add-product-form"> <div class="form-group"> <div class="col-md-2"> <?php echo BsHtml::dropDownList('supplier_product_id', null, SupplierProduct::getDropdownListItems($model->supplier_id), array('class' => 'chosen', 'prompt' => '- Select -')); ?> </div> <div class="col-md-6"> <?php echo BsHtml::submitButton('Add Product', array('class' => 'add-product', 'name' => 'add_product')); ?> <!-- Button trigger modal --> <button class="btn btn-default" data-toggle="modal" data-target="#sp-form"> Create New Product </button> </div> </div> </div> <hr />
<div class="form-group"> <div class="col-md-12"> <div class="row"> <div class="col-md-2"> <?php echo BsHtml::activeDropDownList($SPP, 'supplier_product_id', SupplierProduct::getDropdownListItems($supplier_id), array('class' => 'chosen', 'prompt' => '- Select -', 'name' => 'SupplierPurchaseProducts[' . $SPP->id . '][supplier_product_id]')); ?> </div> <div class="col-md-2"> <?php echo BsHtml::activeTextField($SPP, 'quantity', array('name' => 'SupplierPurchaseProducts[' . $SPP->id . '][quantity]')); ?> </div> <div class="col-md-2"> <?php echo BsHtml::activeTextField($SPP, 'price', array('name' => 'SupplierPurchaseProducts[' . $SPP->id . '][price]')); ?> </div> <?php if ($SPP->Product) { ?> <div class="col-md-2"> <?php echo BsHtml::activeDateField($SPP->Product, 'customer_available_from', array('name' => 'SupplierProducts[' . $SPP->supplier_product_id . '][customer_available_from]')); ?> </div> <div class="col-md-2"> <?php echo BsHtml::activeDateField($SPP->Product, 'customer_available_to', array('name' => 'SupplierProducts[' . $SPP->supplier_product_id . '][customer_available_to]')); ?>
public function actionGetListItems($supplierId = null) { $items = SupplierProduct::getDropdownListItems($supplierId); echo json_encode($items); exit; }