public static function createAppointmentLinkUsingDeal($instructionId, $appStartDate, $appType = Appointment::TYPE_VIEWING) { if (!$instructionId || !$appStartDate) { return false; } $appointmentsByDeal = LinkDealToAppointment::model()->findAllByAttributes(['d2a_dea' => $instructionId]); $appIdsByDeal = []; foreach ($appointmentsByDeal as $value) { /** @var $value LinkDealToAppointment[ ] */ if ($value->appointment->app_start == $appStartDate && $value->appointment->app_type == $appType) { $appIdsByDeal[] = $value->appointment->app_id; } } return AppointmentController::createAppointmentUpdateLink(reset($appIdsByDeal)); }
public function actionFeedback($id) { /** @var $model LinkDealToAppointment */ $model = LinkDealToAppointment::model()->findByPk($id); if (!$model) { throw new CHttpException(404, 'Feedback [id=' . $id . '] is not found'); } if (isset($_POST['LinkDealToAppointment']) && $_POST['LinkDealToAppointment']) { $model->attributes = $_POST['LinkDealToAppointment']; if ($model->save()) { if (isset($_POST['submitOffer']) && $_POST['submitOffer']) { $this->redirect(['Offer/create', 'feedbackId' => $model->d2a_id]); } } } $this->render('feedback', ['model' => $model]); }
public function actionCreate($instructionId = null, $feedbackId = null) { /** @var $feedback LinkDealToAppointment */ if (isset($_GET['popup'])) { $this->asPopup(); } $model = new Offer(); $model->off_deal = $instructionId; $model->off_date = date('d/m/Y'); $model->off_status = Offer::STATUS_NOT_SUBMITTED; if ($feedbackId) { $feedback = LinkDealToAppointment::model()->findByPk($feedbackId); // we get clients and instruction out of feedback; $model->off_deal = $feedback->deal->dea_id; $model->clients = $feedback->appointment->clients; $model->off_app = $feedback->appointment->app_id; } if (!$model->instruction) { throw new BadMethodCallException('Offer must be assigned to instruction'); } $this->edit($model); }
?> <div class="control-group"> <label class="control-label">Date</label> <div class="controls text"> <?php echo Date::formatDate('d/m/Y H:i', $model->appointment->app_start); ?> </div> </div> <div class="control-group"> <label class="control-label">Outcome</label> <div class="controls"> <?php echo $form->radioButtonList($model, 'd2a_feedback', LinkDealToAppointment::getPossibleOutcomes(), ['separator' => ' ']); ?> </div> </div> <div class="control-group"> <label class="control-label">Add Note</label> <div class="controls"> <?php echo $form->textArea($model, 'd2a_cvnotes'); ?> </div> </div> <div class="block-buttons force-margin"> <input type="submit" value="Save Feedback" class="btn"/> <input type="submit" value="Submit Offer" name="submitOffer" class="btn"/>