fix clear and copy week
This commit is contained in:
33
common/modules/event/views/event/_copy_week_form.php
Normal file
33
common/modules/event/views/event/_copy_week_form.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php /** @noinspection PhpUnhandledExceptionInspection */
|
||||
|
||||
use common\modules\event\models\copy\CopyWeekSearch;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $model CopyWeekSearch */
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Másolás</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<?php $form = ActiveForm::begin(['options' =>['class' => 'form-inline' ]]); ?>
|
||||
<?= $form->field($model, 'sourceDateString')->hiddenInput()->label(false) ?>
|
||||
<?= $form->field($model, 'targetDateString')->hiddenInput()->label(false) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inpSourceEvent">Forrás hét: </label>
|
||||
|
||||
<input type="text" id="inpSourceEvent" disabled class="form-control" value="<?=$model->sourceTimeTable->getWeekByIndex(0)->getWeekString()?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inpTargetEvent">Cél hét:</label>
|
||||
<input type="text" id="inpTargetEvent" disabled class="form-control" value="<?=$model->targetTimeTable->getWeekByIndex(0)->getWeekString()?>">
|
||||
</div>
|
||||
<?= Html::submitButton( 'Másol', ['class' => 'btn btn-success' ]) ?>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,7 +27,8 @@ use yii\widgets\ActiveForm;
|
||||
<?= $form->field($model, 'sourceDateString')->widget(DatePicker::class, [
|
||||
'pluginOptions' => [
|
||||
'autoclose' => true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
'format' => 'yyyy.mm.dd',
|
||||
'calendarWeeks'=> true
|
||||
],
|
||||
'options' => [
|
||||
'autocomplete' => 'off'
|
||||
@@ -38,7 +39,8 @@ use yii\widgets\ActiveForm;
|
||||
<?= $form->field($model, 'targetDateString')->widget(DatePicker::class, [
|
||||
'pluginOptions' => [
|
||||
'autoclose' => true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
'format' => 'yyyy.mm.dd',
|
||||
'calendarWeeks'=> true
|
||||
],
|
||||
'options' => [
|
||||
'autocomplete' => 'off'
|
||||
|
||||
@@ -24,7 +24,8 @@ use yii\widgets\ActiveForm;
|
||||
<?= $form->field($model, 'startDateString')->widget(DatePicker::class, [
|
||||
'pluginOptions' => [
|
||||
'autoclose' => true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
'format' => 'yyyy.mm.dd',
|
||||
'calendarWeeks'=> true
|
||||
],
|
||||
'options' => [
|
||||
'autocomplete' => 'off'
|
||||
|
||||
@@ -12,7 +12,10 @@ use common\modules\event\widgets\timetable\TimeTableMonthView;
|
||||
<?php
|
||||
|
||||
echo $this->render('_copy_week_search', ['model' => $model]);
|
||||
echo $this->render('_copy_week_form', ['model' => $model]);
|
||||
?>
|
||||
|
||||
|
||||
<h2>Forrás hét</h2>
|
||||
<?= TimeTableMonthView::widget(['timeTable' => $model->sourceTimeTable]) ?>
|
||||
<h2>Cél hét</h2>
|
||||
|
||||
@@ -7,13 +7,13 @@ use common\modules\event\models\timetable\TimeTableSearch;
|
||||
/* @var $model TimeTableSearch */
|
||||
/* @var $tableModel TimeTableModel */
|
||||
|
||||
|
||||
$tableModel = $model->tableModel;
|
||||
$timeTable = $model->tableModel->timeTableMonth;
|
||||
|
||||
|
||||
use common\modules\event\models\timetable\TimeTableModel;
|
||||
use common\modules\event\widgets\timetable\TimeTableMonthView;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
?>
|
||||
<h1>Órarend</h1>
|
||||
@@ -23,5 +23,36 @@ use common\modules\event\widgets\timetable\TimeTableMonthView;
|
||||
-
|
||||
<?= $timeTable->interval->firstActiveDate->format('m') ?>
|
||||
</h2>
|
||||
<?= TimeTableMonthView::widget(['timeTable' => $timeTable]) ?>
|
||||
<?= TimeTableMonthView::widget([
|
||||
'timeTable' => $timeTable,
|
||||
'actionsColumn' => ['class' => \yii\grid\ActionColumn::class,
|
||||
'template' =>'{delete}',
|
||||
'buttons' => [
|
||||
'delete' => static function ($url) { return Html::a( '<span class="glyphicon glyphicon-trash"> </span>', $url,
|
||||
[
|
||||
'title' => 'Események törlése',
|
||||
'data-confirm' => Yii::t('yii', 'Biztosan törölni szeretné a heti eseményeket?'),
|
||||
'data-method' => 'post',
|
||||
]
|
||||
); }
|
||||
],
|
||||
|
||||
'urlCreator' => /**
|
||||
* @param $action
|
||||
* @param common\modules\event\models\timetable\TimeTableMonthWeek $model
|
||||
* @param $key
|
||||
* @param $index
|
||||
* @return string|null
|
||||
*/ static function($action, $model, $key, $index){
|
||||
if ( $action === 'delete' ){
|
||||
|
||||
/** @var DateTime $start */
|
||||
$start = $model->getWeekStart();
|
||||
|
||||
return Url::toRoute( [ 'event/clear-week' , 'ClearWeekForm[targetDateString]' => $start->format('Y.m.d') ] );
|
||||
}
|
||||
return null;
|
||||
},
|
||||
]
|
||||
]) ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user