contact.tpl
9.94 KB
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
<div class="page-header">
<div class="container-fluid">
<div class="pull-right">
<button id="button-send" data-loading-text="<?php echo $text_loading; ?>" data-toggle="tooltip" title="<?php echo $button_send; ?>" class="btn btn-primary" onclick="send('index.php?route=marketing/contact/send&token=<?php echo $token; ?>');"><i class="fa fa-envelope"></i></button>
<a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
<h1><?php echo $heading_title; ?></h1>
<ul class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="container-fluid">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-envelope"></i> <?php echo $heading_title; ?></h3>
</div>
<div class="panel-body">
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label" for="input-store"><?php echo $entry_store; ?></label>
<div class="col-sm-10">
<select name="store_id" id="input-store" class="form-control">
<option value="0"><?php echo $text_default; ?></option>
<?php foreach ($stores as $store) { ?>
<option value="<?php echo $store['store_id']; ?>"><?php echo $store['name']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-to"><?php echo $entry_to; ?></label>
<div class="col-sm-10">
<select name="to" id="input-to" class="form-control">
<option value="newsletter"><?php echo $text_newsletter; ?></option>
<option value="customer_all"><?php echo $text_customer_all; ?></option>
<option value="customer_group"><?php echo $text_customer_group; ?></option>
<option value="customer"><?php echo $text_customer; ?></option>
<option value="affiliate_all"><?php echo $text_affiliate_all; ?></option>
<option value="affiliate"><?php echo $text_affiliate; ?></option>
<option value="product"><?php echo $text_product; ?></option>
</select>
</div>
</div>
<div class="form-group to" id="to-customer-group">
<label class="col-sm-2 control-label" for="input-customer-group"><?php echo $entry_customer_group; ?></label>
<div class="col-sm-10">
<select name="customer_group_id" id="input-customer-group" class="form-control">
<?php foreach ($customer_groups as $customer_group) { ?>
<option value="<?php echo $customer_group['customer_group_id']; ?>"><?php echo $customer_group['name']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group to" id="to-customer">
<label class="col-sm-2 control-label" for="input-customer"><span data-toggle="tooltip" title="<?php echo $help_customer; ?>"><?php echo $entry_customer; ?></span></label>
<div class="col-sm-10">
<input type="text" name="customers" value="" placeholder="<?php echo $entry_customer; ?>" id="input-customer" class="form-control" />
<div class="well well-sm" style="height: 150px; overflow: auto;"></div>
</div>
</div>
<div class="form-group to" id="to-affiliate">
<label class="col-sm-2 control-label" for="input-affiliate"><span data-toggle="tooltip" title="<?php echo $help_affiliate; ?>"><?php echo $entry_affiliate; ?></span></label>
<div class="col-sm-10">
<input type="text" name="affiliates" value="" placeholder="<?php echo $entry_affiliate; ?>" id="input-affiliate" class="form-control" />
<div class="well well-sm" style="height: 150px; overflow: auto;"></div>
</div>
</div>
<div class="form-group to" id="to-product">
<label class="col-sm-2 control-label" for="input-product"><span data-toggle="tooltip" title="<?php echo $help_product; ?>"><?php echo $entry_product; ?></span></label>
<div class="col-sm-10">
<input type="text" name="products" value="" placeholder="<?php echo $entry_product; ?>" id="input-product" class="form-control" />
<div class="well well-sm" style="height: 150px; overflow: auto;"></div>
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-subject"><?php echo $entry_subject; ?></label>
<div class="col-sm-10">
<input type="text" name="subject" value="" placeholder="<?php echo $entry_subject; ?>" id="input-subject" class="form-control" />
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-message"><?php echo $entry_message; ?></label>
<div class="col-sm-10">
<textarea name="message" placeholder="<?php echo $entry_message; ?>" id="input-message" class="form-control summernote"></textarea>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript"><!--
$('select[name=\'to\']').on('change', function() {
$('.to').hide();
$('#to-' + this.value.replace('_', '-')).show();
});
$('select[name=\'to\']').trigger('change');
//--></script>
<script type="text/javascript"><!--
// Customers
$('input[name=\'customers\']').autocomplete({
'source': function(request, response) {
$.ajax({
url: 'index.php?route=customer/customer/autocomplete&token=<?php echo $token; ?>&filter_name=' + encodeURIComponent(request),
dataType: 'json',
success: function(json) {
response($.map(json, function(item) {
return {
label: item['name'],
value: item['customer_id']
}
}));
}
});
},
'select': function(item) {
$('input[name=\'customers\']').val('');
$('#input-customer' + item['value']).remove();
$('#input-customer').parent().find('.well').append('<div id="customer' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" name="customer[]" value="' + item['value'] + '" /></div>');
}
});
$('#input-customer').parent().find('.well').delegate('.fa-minus-circle', 'click', function() {
$(this).parent().remove();
});
// Affiliates
$('input[name=\'affiliates\']').autocomplete({
'source': function(request, response) {
$.ajax({
url: 'index.php?route=marketing/affiliate/autocomplete&token=<?php echo $token; ?>&filter_name=' + encodeURIComponent(request),
dataType: 'json',
success: function(json) {
response($.map(json, function(item) {
return {
label: item['name'],
value: item['customer_id']
}
}));
}
});
},
'select': function(item) {
$('input[name=\'affiliates\']').val('');
$('#input-affiliate' + item['value']).remove();
$('#input-affiliate').parent().find('.well').append('<div id="affiliate' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" name="affiliate[]" value="' + item['value'] + '" /></div>');
}
});
$('#input-affiliate').parent().find('.well').delegate('.fa-minus-circle', 'click', function() {
$(this).parent().remove();
});
// Products
$('input[name=\'products\']').autocomplete({
'source': function(request, response) {
$.ajax({
url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_name=' + encodeURIComponent(request),
dataType: 'json',
success: function(json) {
response($.map(json, function(item) {
return {
label: item['name'],
value: item['product_id']
}
}));
}
});
},
'select': function(item) {
$('input[name=\'products\']').val('');
$('#input-product' + item['value']).remove();
$('#input-product').parent().find('.well').append('<div id="product' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" name="product[]" value="' + item['value'] + '" /></div>');
}
});
$('#input-product').parent().find('.well').delegate('.fa-minus-circle', 'click', function() {
$(this).parent().remove();
});
function send(url) {
// Summer not fix
$('textarea[name=\'message\']').val($('#input-message').code());
$.ajax({
url: url,
type: 'post',
data: $('#content select, #content input, #content textarea'),
dataType: 'json',
beforeSend: function() {
$('#button-send').button('loading');
},
complete: function() {
$('#button-send').button('reset');
},
success: function(json) {
$('.alert, .text-danger').remove();
if (json['error']) {
if (json['error']['warning']) {
$('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error']['warning'] + '</div>');
}
if (json['error']['subject']) {
$('input[name=\'subject\']').after('<div class="text-danger">' + json['error']['subject'] + '</div>');
}
if (json['error']['message']) {
$('textarea[name=\'message\']').parent().append('<div class="text-danger">' + json['error']['message'] + '</div>');
}
}
if (json['next']) {
if (json['success']) {
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');
send(json['next']);
}
} else {
if (json['success']) {
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');
}
}
}
});
}
//--></script></div>
<?php echo $footer; ?>