-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_servicehosting_config.html.twig
194 lines (186 loc) · 9.6 KB
/
mod_servicehosting_config.html.twig
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{% import 'macro_functions.html.twig' as mf %}
<div class="card-body">
<h5>{{ 'Hosting settings'|trans }}</h5>
<form method="post" action="{{ 'api/admin/product/update_config'|link }}" class="api-form save" data-api-msg="{{ 'Hosting settings updated'|trans }}">
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Server'|trans }}:</label>
<div class="col">
{{ mf.selectbox('config[server_id]', admin.Servicesaas_server_get_pairs, product.config.server_id, 0, 'Select server') }}
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Hosting plan'|trans }}:</label>
<div class="col">
{{ mf.selectbox('config[hosting_plan_id]', admin.Servicesaas_hp_get_pairs, product.config.hosting_plan_id, 0, 'Select hosting plan') }}
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Reseller hosting'|trans }}:</label>
<div class="col">
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioResellerYes" type="radio" name="config[reseller]" value="1"{% if product.config.reseller %} checked{% endif %}>
<label class="form-check-label" for="radioResellerYes">{{ 'Yes'|trans }}</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioResellerNo" type="radio" name="config[reseller]" value="0"{% if not product.config.reseller %} checked{% endif %}>
<label class="form-check-label" for="radioResellerNo">{{ 'No'|trans }}</label>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Free domain registration'|trans }}:</label>
<div class="col">
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioFreeRegistrationYes" type="radio" name="config[free_domain]" value="1"{% if product.config.free_domain %} checked{% endif %}>
<label class="form-check-label" for="radioFreeRegistrationYes">{{ 'Yes'|trans }}</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioFreeRegistrationNo" type="radio" name="config[free_domain]" value="0"{% if not product.config.free_domain %} checked{% endif %}>
<label class="form-check-label" for="radioFreeRegistrationNo">{{ 'No'|trans }}</label>
</div>
</div>
</div>
<div class="mb-3 row free-tlds-row">
<label class="form-label col-3 col-form-label">{{ 'Select free tlds'|trans }}</label>
<div class="col">
{% set tlds = guest.serviceDomain_tlds({ 'allow_register': 1 }) %}
<select class="form-select" name="config[free_tlds][]" multiple="multiple" size="{{ tlds|length }}"{% if product.config.free_domain %} required{% endif %}>
{% for id,tld in tlds %}
<option value="{{ tld.tld }}"{% if tld.tld in product.config.free_tlds %} selected{% endif %}>{{ tld.tld }}</option>
{% endfor %}
</select>
</div>
</div>
<!-- Select periods to offer free domains -->
<div class="mb-3 row free-periods-row">
<label class="form-label col-3 col-form-label">{{ 'Select free periods'|trans }}</label>
<div class="col">
<select class="form-select" name="config[free_domain_periods][]" multiple="multiple" size="6"{% if product.config.free_domain %} required{% endif %}>
<option value="1M"{% if "1M" in product.config.free_domain_periods %} selected{% endif %}>1 {{ 'Month'|trans }}</option>
<option value="3M"{% if "3M" in product.config.free_domain_periods %} selected{% endif %}>3 {{ 'Month'|trans }}</option>
<option value="6M"{% if "6M" in product.config.free_domain_periods %} selected{% endif %}>6 {{ 'Month'|trans }}</option>
<option value="1Y"{% if "1Y" in product.config.free_domain_periods %} selected{% endif %}>1 {{ 'Year'|trans }}</option>
<option value="2Y"{% if "2Y" in product.config.free_domain_periods %} selected{% endif %}>2 {{ 'Years'|trans }}</option>
<option value="3Y"{% if "3Y" in product.config.free_domain_periods %} selected{% endif %}>3 {{ 'Years'|trans }}</option>
</select>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Free domain transfer'|trans }}:</label>
<div class="col">
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioFreeTransferYes" type="radio" name="config[free_transfer]" value="1"{% if product.config.free_transfer %} checked{% endif %}>
<label class="form-check-label" for="radioFreeTransferYes">{{ 'Yes'|trans }}</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="radioFreeTransferNo" type="radio" name="config[free_transfer]" value="0"{% if not product.config.free_transfer %} checked{% endif %}>
<label class="form-check-label" for="radioFreeTransferNo">{{ 'No'|trans }}</label>
</div>
</div>
</div>
<input type="hidden" name="id" value="{{ product.id }}">
<button class="btn btn-primary w-100" type="submit">{{ 'Update'|trans }}</button>
</form>
<hr>
<div class="d-flex align-items-center mb-3">
<h5 class="mb-0">{{ 'Hosting plans'|trans }}</h5>
<a href="{{ 'Servicesaas#tab-new-server'|alink }}" class="ms-auto btn btn-primary">
<svg class="icon me-2">
<use xlink:href="#plus" />
</svg>
{{ 'New hosting plan'|trans }}
</a>
</div>
<table class="table card-table table-vcenter table-striped text-nowrap">
<thead>
<tr>
<th>{{ 'Title'|trans }}</th>
<th class="w-1"></th>
</tr>
</thead>
<tbody>
{% for id, plan in admin.Servicesaas_hp_get_pairs %}
<tr>
<td>
<a href="{{ '/Servicesaas/plan'|alink }}/{{ id }}">{{ plan }}</a>
</td>
<td>
<a class="btn btn-icon" href="{{ '/Servicesaas/plan'|alink }}/{{ id }}">
<svg class="icon">
<use xlink:href="#edit" />
</svg>
</a>
</td>
</tr>
{% else %}
<tr>
<td class="text-muted" colspan="2">{{ 'The list is empty'|trans }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<hr>
<div class="d-flex align-items-center mb-3">
<h5 class="mb-0">{{ 'Servers'|trans }}</h5>
<a href="{{ 'Servicesaas#tab-new-server'|alink }}" class="ms-auto btn btn-primary">
<svg class="icon me-2">
<use xlink:href="#plus" />
</svg>
{{ 'New server'|trans }}
</a>
</div>
<table class="table card-table table-vcenter table-striped text-nowrap">
<thead>
<tr>
<th>{{ 'Title'|trans }}</th>
<th class="w-1"></th>
</tr>
</thead>
<tbody>
{% for id, server in admin.Servicesaas_server_get_pairs %}
<tr>
<td>
<a href="{{ '/Servicesaas/server'|alink }}/{{ id }}">{{ server }}</a>
</td>
<td>
<a class="btn btn-icon" href="{{ '/Servicesaas/server'|alink }}/{{ id }}">
<svg class="icon">
<use xlink:href="#edit" />
</svg>
</a>
</td>
</tr>
{% else %}
<tr>
<td class="text-muted" colspan="7">{{ 'The list is empty'|trans }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
var free_domain_radios = $('input:radio[name="config[free_domain]"]');
var freeTldsRow = $('.free-tlds-row');
var freePerdsRow = $('.free-periods-row');
free_domain_radios.on('click', function() {
if ($(this).val() == 1){
freeTldsRow.fadeIn('slow');
freePerdsRow.fadeIn('slow');
$('select[name="config[free_tlds][]"]').prop('required', true);
$('select[name="config[free_domain_periods][]"]').prop('required', true);
}
if ($(this).val() == 0){
$('select[name="config[free_domain_periods][]"]').prop('required', false);
$('select[name="config[free_tlds][]"]').prop('required', false);
$('select[name="config[free_tlds][]"] option:selected').prop('selected', false);
$('select[name="config[free_domain_periods][]"] option:selected').prop('selected', false);
freeTldsRow.fadeOut('slow');
freePerdsRow.fadeOut('slow');
}
});
if (free_domain_radios.filter('[value=0]:checked').length > 0) {
freeTldsRow.hide();
freePerdsRow.hide();
}
</script>