public function actionUpdate($id) { if ($_GET['popup']) { $this->asPopup(); } $model = Offer::model()->findByPk($id); if (!$model) { throw new CHttpException(404, 'Offer [id = ' . $id . '] is not found'); } $this->edit($model); }
<?php /** * @var $this OfferController * @var $form AdminForm * @var $model Offer */ $form = $this->beginWidget('AdminForm'); $clientId = isset($clientId) ? $clientId : 0; if (!$model->off_deal && $model->instruction->dea_id) { $model->off_deal = $model->instruction->dea_id; } $acceptedOffer = Offer::model()->findByAttributes(['off_status' => Offer::STATUS_ACCEPTED, 'off_deal' => $model->off_deal]); $clientStatus = false; $differentStatusString = ''; $clientsHaveDifferentStatuses = false; if ($model->clients) { $clientStatus = $model->clients[0]->cli_salestatus; foreach ($model->clients as $client) { if (!$client->saleStatus) { continue; } $differentStatusString .= '<div>' . $client->getFullName() . ' — ' . $client->saleStatus->cst_title . ' </div>'; if ($client->cli_salestatus != $clientStatus) { $clientsHaveDifferentStatuses = true; } } } ?> <div class="container-fluid"> <div class="row-fluid">
<?php echo $form->controlLabel($model, 'dea_status'); ?> <div class="controls text"> <?php echo $model->dea_status; ?> <?php if ($model->dea_type == 'Lettings') { $tenantList = $model->property->getClientNames('tenants', ','); if (isset($tenantList)) { echo ' — ' . $tenantList . ' at '; echo Locale::formatPrice($model->getPrice('pcm'), true, 'pcm'); } } else { $acceptedOffer = Offer::model()->findByAttributes(['off_status' => 'Accepted', 'off_deal' => $model->dea_id]); if (in_array($model->dea_status, [Deal::STATUS_UNDER_OFFER, Deal::STATUS_EXCHANGED, Deal::STATUS_EXCHANGED]) && $acceptedOffer) { $clientName = $acceptedOffer->clients ? ' — ' . $acceptedOffer->clients[0]->fullName : ''; $offerPrice = is_double($acceptedOffer->off_price) ? ' at ' . Locale::formatPrice($acceptedOffer->off_price) : ''; echo $clientName . $offerPrice; } } ?> </div> <?php echo $form->endControlGroup(); ?> <div class="control-group"> <label class="control-label">Price</label>