{ return res.json() }) }"; public $getColor = "function (date, dates = null) { for (let contentDate of dates) { if (contentDate['dob'].substr(8, 2) == DateHelper.intToDate(date.getDate())) { return 'success'; } } }"; public $getHtmlContentForDate = 'function (content, date) { console.log(content) let flag = false let html = ``; for (let i = 1; i <= content.length; i++) { let model = content[i - 1]; if (model["dob"].substr(8, 2) == date.substr(8, 2)) { flag = true; html += `` html += `` html += `` html += `` html += `` html += `` } } html += `
# ФИО Дата рождения  
${i}${model["fio"]}${model["dob"]}
` if (flag) return html; return "empty" }'; /* CalendarHelper._updateContent = async function(){ let monthNumber = date.substr(5, 2); return fetch('../ajax/get-birthday-by-month?' + 'month=' + monthNumber) .then((res) => { return res.json() }) } CalendarHelper._getColor = function (date, dates = null) { for (let contentDate of dates) { if (contentDate['dob'].substr(8, 2) == DateHelper.intToDate(date.getDate())) { return 'success'; } } } CalendarHelper._getHtmlContentForDate = function (content, date) { console.log(content) let flag = false let html = ``; for (let i = 1; i <= content.length; i++) { let model = content[i - 1]; if (model['dob'].substr(8, 2) == date.substr(8, 2)) { flag = true; html += `` html += `` html += `` html += `` html += `` html += `` } } html += `
# ФИО Дата рождения  
${i}${model['fio']}${model['dob']}
` if (flag) return html; return "empty" } */ public function init() { parent::init(); $view = $this->getView(); AppAsset::register($view); } public function run() { echo Html::beginTag('section', ['class' => 'calendar-contain']); echo Html::beginTag('aside', ['class' => 'calendar__sidebar']); echo Html::beginTag('section', ['class' => 'title-bar']); echo $this->button; echo Html::input('date', null, date('Y-m-d'), ['class' => 'form-control', 'id' => 'date',]); echo Html::endTag('section'); echo Html::tag('h2', date('l') . '
' . date('F d'), ['class' => 'sidebar__heading']); echo Html::beginTag('ul', ['class' => 'sidebar__list']); echo Html::endTag('ul'); echo Html::endTag('aside'); echo Html::beginTag('section', ['class' => 'calendar__days']); echo Html::endTag('section'); echo Html::endTag('section'); $this->view->registerJs(' CalendarHelper._runBuild = ' . $this->runBuild . '; CalendarHelper._getHtmlContentForDate = ' . $this->getHtmlContentForDate . '; CalendarHelper._updateContent = async ' . $this->updateContent . '; CalendarHelper._getColor = ' . $this->getColor . '; CalendarHelper.main()' ); } } ?>