/
index.php
140 lines (131 loc) · 6.73 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
extract($quotasData);
// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyQuotas');
?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class="row">
<div class="col-12 content-right">
<h3>
<?php eT("Survey quotas");?>
</h3>
<?php
$massiveAction = '';
if ($oDataProvider->itemCount > 0) {
if (Permission::model()->hasSurveyPermission($oSurvey->getPrimaryKey(), 'quotas', 'create')) {
$massiveAction = $this->renderPartial(
'viewquotas_massive_selector',
array(
'oSurvey' => $oSurvey,
'oQuota' => $oQuota,
'aQuotaLanguageSettings' => $aQuotaLanguageSettings,
),
true
);
}
}
?>
<?php if ($oDataProvider->itemCount > 0) :?>
<!-- Grid -->
<div class="row">
<div class="col-12 content-right">
<?php $this->widget('application.extensions.admin.grid.CLSGridView', [
'dataProvider' => $oDataProvider,
'id' => 'quota-grid',
'ajaxUpdate' => 'quota-grid',
'lsAfterAjaxUpdate' => ['onQuotaOpenAction();', 'bindListItemclick();'],
'emptyText' => gT('No quotas'),
'massiveActionTemplate' => $massiveAction,
'summaryText' => gT('Displaying {start}-{end} of {count} result(s).') . ' ' . sprintf(
gT('%s rows per page'),
CHtml::dropDownList(
'pageSize',
$iGridPageSize,
Yii::app()->params['pageSizeOptions'],
[
'class' => 'changePageSize form-select',
'style' => 'display: inline; width: auto',
'onchange' => "$.fn.yiiGridView.update('quota-grid',{ data:{ pageSize: $(this).val() }})"
]
)
),
'columns' => [
[
'id' => 'id',
'class' => 'CCheckBoxColumn',
'selectableRows' => '100',
'htmlOptions' => ['style' => 'vertical-align:top'],
],
[
'name' => gT('Quota members'),
'type' => 'raw',
'htmlOptions' => ['style' => 'vertical-align:top'],
'value' => function ($oQuota) use ($oSurvey, $aQuotaItems) {
/** @var Quota $oQuota */
$out = '<p>' . $this->renderPartial(
'/quotas/viewquotas_quota_members',
[
'oSurvey' => $oSurvey,
'oQuota' => $oQuota,
'aQuotaItems' => $aQuotaItems,
],
true
) . '<p>';
return $out;
},
],
[
'name' => 'completeCount',
'header' => gT('Completed'),
'type' => 'raw',
'htmlOptions' => ['style' => 'vertical-align:top'],
'footer' => $totalcompleted,
],
[
'name' => 'qlimit',
'header' => gT('Limit'),
'htmlOptions' => ['style' => 'vertical-align:top'],
'footer' => $totalquotas,
],
[
'header' => gT("Action"),
'name' => 'actions',
'type' => 'raw',
'value' => '$data->buttons',
'headerHtmlOptions' => ['class' => 'ls-sticky-column'],
'htmlOptions' => ['class' => 'text-center button-column ls-sticky-column'],
],
],
]);
?>
</div>
<?php endif; ?>
<?php if (Permission::model()->hasSurveyPermission($oSurvey->getPrimaryKey(), 'quotas', 'create')) :?>
<div class="float-end">
<?php echo CHtml::beginForm(array("quotas/newquota/surveyid/{$oSurvey->getPrimaryKey()}"), 'post'); ?>
<?php echo CHtml::hiddenField('sid', $oSurvey->getPrimaryKey());?>
<?php echo CHtml::hiddenField('action', 'quotas');?>
<?php echo CHtml::hiddenField('subaction', 'new_quota');?>
<?php echo CHtml::endForm();?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script>
var onQuotaOpenAction = function () {
$('.selector__quota_open_validation').each(function() {
$(this).remoteModal({
saveButton: false,
}, {
closeIcon : '<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\"></button>',
closeButton : '<button type=\"button\" class=\"btn btn-cancel\" data-bs-dismiss=\"modal\"><?= gT("Close")?></button>',
saveButton : '<button type=\"button\" class=\"btn btn-primary\"><?= gT("Close")?></button>'
})
});
}
</script>
<?php
Yii::app()->getClientScript()->registerScript('quotas_load_validationmodal', "onQuotaOpenAction()", LSYii_ClientScript::POS_POSTSCRIPT);
?>