Ejemplo n.º 1
0
		<div class="controls">
			<?php 
echo $model->valuationDate ?: 'N/A';
?>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label"><?php 
echo $form->controlLabel($model, 'dea_marketprice');
?>
</label>

		<div class="controls">
			<?php 
echo $form->textField($model, 'dea_marketprice', ['class' => 'input-xsmall', 'value' => Locale::formatCurrency($model->dea_marketprice, true, false)]);
?>
			<?php 
echo $form->dropDownList($model, 'dea_qualifier', Deal::getQualifiers(), ['class' => 'input-xsmall']);
?>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label"><?php 
echo $form->controlLabel($model, 'dea_commission');
?>
</label>

		<div class="controls">
			<?php 
echo $form->textField($model, 'dea_commission', ['class' => 'input-xsmall']);
Ejemplo n.º 2
0
 /**
  * This got messy
  *
  * @param $instructionId
  * @throws CHttpException
  */
 public function actionSendMailshot($instructionId)
 {
     $model = new Client('search');
     if (isset($_POST['send']) && $_POST['send']) {
         $instruction = Deal::model()->findByPk($instructionId);
         $type = MailshotType::model()->findByPk($_POST['MailshotType']);
         $model->attributes = $_GET['Client'];
         $dataProvider = $model->search();
         $dataProvider->setPagination(['pageSize' => 100]);
         if (!$type) {
             throw new CHttpException(404, 'Mailshot Type [name: ' . $_POST['MailshotType'] . '] was not found');
         }
         if (!$instruction) {
             throw new CHttpException(404, 'Instruction [id: ' . $instructionId . '] was not found');
         }
         $mailshot = new MandrillMailshot();
         $mailshot->instructionId = $instruction->dea_id;
         $mailshot->type = $type->name;
         $mailshot->save();
         if ($type->templatePath && file_exists($type->templatePath)) {
             ob_start();
             include $type->templatePath;
             $htmlTemplate = ob_get_clean();
         } else {
             $htmlTemplate = $this->execTemplate($type->htmlTemplate);
         }
         $textTemplate = $this->execTemplate($type->textTemplate);
         $mandrillMessagePreset = new MandrillMessage();
         $mandrillMessagePreset->setFrom(Yii::app()->params['mailshot']['sender_email'], Yii::app()->params['mailshot']['sender_name']);
         $mandrillMessagePreset->setHtmlBody($htmlTemplate);
         $mandrillMessagePreset->setTextBody($textTemplate);
         $mandrillMessagePreset->setSubject($type->subject);
         $mandrillMessagePreset->setPreserveRecepients(false);
         $mandrillMessagePreset->setGlobalMergeVar('MAILSHOT_ID', $mailshot->id);
         $mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_ID', $instruction->dea_id);
         $mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_PRICE', Locale::formatCurrency($instruction->dea_marketprice));
         $mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_TITLE', $instruction->title);
         $mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_STRAPLINE', $instruction->dea_strapline);
         $mandrillMessagePreset->setGlobalMergeVar('OFFICE_TITLE', $instruction->branch->office->title);
         $mandrillMessagePreset->setGlobalMergeVar('OFFICE_NUMBER', $instruction->branch->bra_tel);
         if (isset($_POST['test']) && $_POST['test']) {
             $mandrillMessagePreset->enableTest();
         }
         $iterator = new DataProviderIterator($dataProvider);
         /** @var $mandrillMessage MandrillMessage */
         $mandrillMessage = null;
         $x = 0;
         $staffEmails = array_fill_keys(Yii::app()->params['mailshot']['alwaysSendTo'], '?');
         if (Yii::app()->params['mandrill']['test_run']) {
             $testEmails = Yii::app()->params['mandrill']['test_emails'];
         }
         /** @var $client Client */
         foreach ($iterator as $client) {
             $email = $client->cli_email;
             if (isset($testEmails)) {
                 if (!$testEmails) {
                     break;
                 }
                 $email = array_shift($testEmails);
             }
             if (!$email) {
                 continue;
             }
             //we are sending emails to our staff in a different message
             if (array_key_exists($email, $staffEmails)) {
                 continue;
             }
             if ($x % Yii::app()->params['mandrill']['mails_in_message'] === 0) {
                 if ($mandrillMessage) {
                     $mandrillMessage->send();
                     $mailshot->addMessage($mandrillMessage);
                 }
                 $mandrillMessage = clone $mandrillMessagePreset;
             }
             $mandrillMessage->addTo($email, $client->getFullName());
             $mandrillMessage->setRecepientMergeVar($email, 'CLIENT_FULLNAME', $client->getFullName());
             $mandrillMessage->setRecepientMergeVar($email, 'CLIENT_SALUTATION', $client->cli_salutation);
             $mandrillMessage->setRecepientMergeVar($email, 'CLIENT_ID', $client->cli_id);
             $mandrillMessage->setRecepientMergeVar($email, 'CLIENT_EMAIL', $email);
             $mandrillMessage->setRecepientMetaData($email, 'clientId', $client->cli_id);
             $x++;
         }
         if (!$mandrillMessage->id) {
             $mandrillMessage->send();
             $mailshot->addMessage($mandrillMessage);
         }
         /**
          * doing a trick. will send an email to everyone in staff list to avoid complains
          */
         $staffMessage = clone $mandrillMessagePreset;
         $clients = Client::model()->findAll('cli_email IN (' . implode(', ', $staffEmails) . ')', array_keys($staffEmails));
         foreach ($clients as $client) {
             $email = $client->cli_email;
             $staffMessage->addTo($email, $client->getFullName());
             $staffMessage->setRecepientMergeVar($email, 'CLIENT_FULLNAME', $client->getFullName());
             $staffMessage->setRecepientMergeVar($email, 'CLIENT_SALUTATION', $client->cli_salutation);
             $staffMessage->setRecepientMergeVar($email, 'CLIENT_ID', $client->cli_id);
             $staffMessage->setRecepientMergeVar($email, 'CLIENT_EMAIL', $email);
             $staffMessage->setRecepientMetaData($email, 'clientId', $client->cli_id);
         }
         $staffMessage->send();
         $mailshot->addMessage($staffMessage);
         Yii::app()->user->setFlash('mailshot-sent', 'Mailshot successfully sent');
         $this->redirect(['instruction/summary', 'id' => $instructionId]);
     }
     $this->render('sendMailshot');
 }
Ejemplo n.º 3
0
?>
	</div>
	<?php 
echo $form->endControlGroup();
?>

	<div class="control-group">
		<label class="control-label">Price</label>

		<div class="controls text">
			<?php 
if ($model->dea_type == 'Lettings') {
    echo Locale::formatPrice($model->dea_marketprice, true, 'pcm') . ' - ' . Locale::formatPrice($model->getPrice('p/w'), true, 'p/w');
} else {
    $thisPrice = $model->getPrice();
    echo Locale::formatCurrency($thisPrice);
    echo $tenure = empty($thisPrice) ? ' (Valuation)' : ' ' . $model->dea_tenure;
}
?>
		</div>
	</div>

	<?php 
if ($model->owner) {
    ?>
		<div class="control-group">
			<label class="control-label">Vendors</label>

			<div class="controls text">
				<?php 
    $o = [];
Ejemplo n.º 4
0
	</fieldset>
<?php 
$this->endWidget();
$this->widget("AdminGridView", array('title' => 'Instruction Alerts', 'dataProvider' => $model->searchMissedFollowUp(), 'id' => 'missedFollowUps-list', 'columns' => array(array('type' => 'raw', 'htmlOptions' => ['class' => 'centered-text'], 'value' => function (Deal $data) {
    return CHtml::link(CHtml::image(Icon::EDIT_ICON, 'Edit instruction'), ['instruction/summary', 'id' => $data->dea_id]) . CHtml::link(CHtml::image(Icon::BLUE_PRINT_ICON, 'Print instruction'), ['/property/pdf', 'id' => $data->dea_id], ['target' => '_blank']);
}), array('name' => 'dea_created', 'header' => 'Created', 'value' => 'Date::formatDate("d/m/Y", $data->dea_created)'), 'address.searchString::Address', 'propertyType.pty_title::Type', array('name' => 'negotiator.use_fname', 'header' => "Neg'", 'type' => 'raw', 'value' => function (Deal $data) {
    if (!$data->negotiator) {
        return '<span class="negotiator-color empty"></span>N/A';
    }
    return '<span class="negotiator-color" style="background: #' . $data->negotiator->use_colour . '"></span><span title="' . $data->negotiator->getFullName() . '">' . $data->negotiator->getInitials() . '</span>';
}), array('name' => 'owners', 'header' => 'Vendors', 'type' => 'raw', 'value' => function (Deal $data) {
    $owners = [];
    foreach ($data->owner as $owner) {
        $owners[] = CHtml::link($owner->getFullName(), ['client/update', 'id' => $owner->cli_id], ['class' => 'table-link']);
    }
    return implode(', ', $owners);
}), array('name' => 'followUpDue', 'header' => 'Follow Up date', 'value' => 'Date::formatDate("d/m/Y", $data->followUpDue)'), array('header' => 'Follow Up User', 'type' => 'raw', 'value' => function (Deal $data) {
    if ($data->followUpAppointment) {
        return '<span class="negotiator-color" style="background: #' . $data->followUpAppointment->user->use_colour . '"></span>
															<span title="' . $data->followUpAppointment->user->getFullName() . '">' . $data->followUpAppointment->user->getInitials() . '</span>';
    } else {
        return '<span class="negotiator-color empty"></span>N/A';
    }
}), array('header' => 'val. price', 'name' => 'dea_valueprice', 'value' => function (Deal $data) {
    if ($data->dea_valueprice) {
        return Locale::formatCurrency($data->dea_valueprice, true, false);
    } else {
        return 'N/A';
    }
}), 'branch.bra_title::Office')));