Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @var \App\View\AppView $this
*/
$this->extend('/Base/portletCollapsed');
$this->assign('portlet_title', $sectionHeader ?? __('Related Bonds'));
$this->start("portlet_body");
$columns = $this->Admin->getDatatableColumns($headers, false);
$niceAlias = 'Bonds';
$tableId = 'table-' . \Cake\Utility\Text::slug(mb_strtolower($niceAlias));
function index(){
$bondCategoryId = $this->request->getQuery('bond_category_id');
$bondTypesByCategoryId = $this->BondTypes->find()->where(['bond_category_id' => $bondCategoryId] );
return $bondTypesByCategoryId;
}
public function generateAnyPdf($id = null)
{
$this->set('quote', $this->Quotes->get($id));
$this->set('templates', $this->Quotes->Sureties->Templates->find()->orderAsc('name'));
$this->set('sendTargets', $this->Quotes->getSendTargets($id));
}
$this->hasOne('InstantBondTypes')
->setStrategy('select');
$this->addFilter('InstantBondTypes.rate_calculation_type', [
'className' => 'Custom',
'method' => fn(Query $query, $field, $value, $data, $options) => $query
->contain(['InstantBondTypes'])
->where($query->newExpr()->like($query->identifier('InstantBondTypes.rate_calculation_type'), $value . '%')),
]);
->prependOption([
'title' => __('Rules'),
'url' => ['prefix' => 'Admin', 'plugin' => false, 'controller' => 'AppRules', 'action' => 'index'],
'icon' => 'fa fa-address-card fa-fw',
'class' => 'nav-item',
])
<div class="view" style="overflow:scroll;">
<div class="table-responsive" style="overflow-x: auto; max-width: 100%">
<?php
echo $this->Form->create($followUp, [
'id' => 'enableFollowUp',
'url' => [
'plugin' => false,
'prefix' => 'Admin',
'controller' => 'Bonds',
'action' => 'enableFollowUp',
$followUp = $this->Bonds->FollowUps->find()->where(['bond_id' => $bondId])->first();
if ($elemId == 'enableFollowUp') {
if ($followUp) {
$followUp->enabled = !$followUp->enabled;
} else {
$followupData = [
'last_run' => date('Y-m-d H:i:s'),
'email_daily_sent_count' => 0,
'email_monthly_sent_count' => 0,
'enabled' => 1,
$this->hasMany('Todos', [
'foreignKey' => 'foreign_key',
'className' => 'CakeDC/Todo.Todos',
'conditions' => [
'model' => 'Bonds',
],
]);
$this->hasOne('FollowUps', [
'foreignKey' => 'bond_id',
'joinType' => 'LEFT',
$this->hasMany('FollowUpsTodo', [
'foreignKey' => 'foreign_key',
'className' => 'CakeDC/Todo.Todos',
'conditions' => [
'model' => 'FollowUps',
],
]);