-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-profile.php
More file actions
330 lines (310 loc) · 18.6 KB
/
Copy pathuser-profile.php
File metadata and controls
330 lines (310 loc) · 18.6 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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?php osc_current_web_theme_path( 'head.php' ); ?>
<body>
<?php osc_current_web_theme_path( 'header.php' ); ?>
<div class="row">
<div class="col-md-4">
<?php include 'user-sidebar.php'; ?>
</div>
<div class="col-md-8">
<div class=" tfc-item">
<div class="panel-heading">
<div class="panel-title"><?php _e( 'Manage Your Profile' , 'shopclass' ); ?></div>
</div>
<div class="content user_account panel-body">
<div id="main" class="modify_profile">
<legend><?php _e( 'Update your profile' , 'shopclass' ); ?></legend>
<?php tfc_avatar_upload(); ?>
<form class="tfc-form form-group" rol="form" action="<?php echo osc_base_url( true ); ?>"
method="post">
<input type="hidden" name="page" value="user"/>
<input type="hidden" name="action" value="profile_post"/>
<fieldset>
<div class="form-group ">
<label class="col-md-3 control-label"
for="name"><?php _e( 'Name' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php UserForm::name_text( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="email"><?php _e( 'E-mail' , 'shopclass' ); ?></label>
<div class="input-group col-md-3 col-xs-12">
<?php echo osc_user_email(); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="user_type"><?php _e( 'User type' , 'shopclass' ); ?></label>
<div class="input-group col-md-5 col-xs-12">
<?php UserForm::is_company_select( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="phoneMobile"><?php _e( 'Cell phone' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php UserForm::mobile_text( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="phoneLand"><?php _e( 'Phone' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php UserForm::phone_land_text( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="country"><?php _e( 'Country' , 'shopclass' ); ?> *</label>
<div class="input-group col-md-5 col-xs-12">
<?php UserForm::country_select( osc_get_countries() , osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="region"><?php _e( 'Region' , 'shopclass' ); ?> *</label>
<div class="input-group col-md-5 col-xs-12">
<?php UserForm::region_select( osc_get_regions() , osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label" for="city"><?php _e( 'City' , 'shopclass' ); ?>
*</label>
<div class="input-group col-md-5 col-xs-12">
<?php UserForm::city_select( osc_get_cities() , osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="s_zip"><?php _e( 'Zip/Pin Code' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php UserForm::zip_text( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="city_area"><?php _e( 'City area' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php UserForm::city_area_text( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="address"><?php _e( 'Address' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php UserForm::address_text( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"
for="webSite"><?php _e( 'Website' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php UserForm::website_text( osc_user() ); ?>
</div>
</div>
<div class="form-group ">
<label class="col-md-3 control-label"><?php _e( 'Your Description' , 'shopclass' ); ?></label>
<div class="input-group col-md-7 col-xs-12">
<?php
$locales = osc_get_locales();
$user = osc_user();
$num_locales = count( $locales );
if ( $num_locales > 1 ) {
echo '<ul class="nav nav-pills" role="tablist">';
foreach ( $locales as $locale ) {
$localeId = osc_sanitize_string( strtolower( $locale[ 's_name' ] . $locale[ 'pk_c_code' ] ) );
$localeName = $locale[ 's_name' ];
$localeCode = $locale[ 'pk_c_code' ];
$activeClass = ( osc_current_user_locale() == $localeCode ) ? 'active' : '';
echo '<li class="nav-item ' . $activeClass . '">';
echo '<a class="nav-link" id="' . $localeId . '-tab" data-toggle="tab" href="#' . $localeId . '" role="tab" aria-controls="' . $localeId . '" aria-selected="true">' . $localeName . '</a>';
echo '</li>';
unset( $localeId , $localeName , $localeCode , $activeClass );
}
echo '</ul>';
}
if ( $num_locales > 1 ) {
echo '<div class="tab-content" id="user-info-area-tabs">';
}
foreach ( $locales as $locale ) {
$localeId = osc_sanitize_string( strtolower( $locale[ 's_name' ] . $locale[ 'pk_c_code' ] ) );
$localeName = $locale[ 's_name' ];
$localeCode = $locale[ 'pk_c_code' ];
$activeClass = ( osc_current_user_locale() == $localeCode ) ? 'active' : '';
if ( $num_locales > 1 ) {
echo '<div class="tab-pane ' . $activeClass . '" id="' . $localeId . '" role="tab-panel" aria-labelledby="' . $localeId . '-tab">';
};
//if($num_locales > 1) { echo '<h4>' . $locale['s_name'] . '</h4>'; }
$info = '';
if ( is_array( $user ) ) {
if ( isset( $user[ 'locale' ][ $locale[ 'pk_c_code' ] ] ) ) {
if ( isset( $user[ 'locale' ][ $locale[ 'pk_c_code' ] ][ 's_info' ] ) ) {
$info = $user[ 'locale' ][ $locale[ 'pk_c_code' ] ][ 's_info' ];
}
}
}
UserForm::info_textarea( 's_info' , $locale[ 'pk_c_code' ] , $info );
if ( $num_locales > 1 ) {
echo '</div>';
};
unset( $localeId , $localeName , $localeCode , $activeClass );
}
if ( $num_locales > 1 ) {
echo '</div>';
};
//UserForm::multilanguage_info(osc_get_locales(), osc_user()); ?>
</div>
<?php osc_run_hook( 'user_form' ); ?>
</div>
</fieldset>
<button class="btn btn-default" type="submit"><?php _e( 'Update' , 'shopclass' ); ?></button>
</form>
<hr>
<button class="btn btn-danger btn-lg" data-toggle="modal" data-target="#delete-account">
<?php _e( 'Delete Account' , 'shopclass' ) ?>
</button>
<!-- Modal -->
<div class="modal fade" id="delete-account" tabindex="-1" role="dialog"
aria-labelledby="deletAccountLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title"
id="deletAccountLabel"><?php _e( 'Deleting your account.' , 'shopclass' ); ?></h4>
</div>
<div class="modal-body text-warning">
<strong><?php _e( 'Are you sure you want to delete your account? This cannot be undone.' , 'shopclass' ); ?></strong>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal"><?php _e( 'Cancel' , 'shopclass' ) ?></button>
<button id="deleteprofile" type="button"
class="btn btn-danger"><?php _e( 'OK' , 'shopclass' ) ?></button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</div>
</div>
</div>
</div>
</div>
<?php osc_current_web_theme_path( 'footer.php' ); ?>
<script>
$(document).ready(function () {
$("button#deleteprofile").click(function () {
window.location = '<?php echo osc_base_url( 'true' ); ?>?page=user&action=delete&id=<?php echo osc_user_id(); ?>&secret=<?php echo osc_user_field( "s_secret" ); ?>';
});
});
</script>
<script>
$(document).ready(function () {
$("#countryId").on("change", function () {
var pk_c_code = $(this).val();
<?php if($path == "admin") { ?>
var url = '<?php echo osc_admin_base_url( true ) . "?page=ajax&action=regions&countryId="; ?>' + pk_c_code;
<?php } else { ?>
var url = '<?php echo osc_base_url( true ) . "?page=ajax&action=regions&countryId="; ?>' + pk_c_code;
<?php }; ?>
var result = '';
if (pk_c_code != '') {
$("#regionId").attr('disabled', false);
$("#cityId").attr('disabled', true);
$.ajax({
type: "POST",
url: url,
dataType: 'json',
success: function (data) {
var length = data.length;
if (length > 0) {
result += '<option value=""><?php _e( "Select a region..." ); ?></option>';
for (key in data) {
result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>';
}
$("#region").before('<select name="regionId" id="regionId" ></select>');
$("#region").remove();
$("#city").before('<select name="cityId" id="cityId" ></select>');
$("#city").remove();
} else {
result += '<option value=""><?php _e( 'No results' ) ?></option>';
$("#regionId").before('<input type="text" name="region" id="region" />');
$("#regionId").remove();
$("#cityId").before('<input type="text" name="city" id="city" />');
$("#cityId").remove();
}
$("#regionId").html(result);
$("#cityId").html('<option selected value=""><?php _e( "Select a city..." ); ?></option>');
}
});
} else {
// add empty select
$("#region").before('<select name="regionId" id="regionId" ><option value=""><?php _e( "Select a region..." ); ?></option></select>');
$("#region").remove();
$("#city").before('<select name="cityId" id="cityId" ><option value=""><?php _e( "Select a city..." ); ?></option></select>');
$("#city").remove();
if ($("#regionId").length > 0) {
$("#regionId").html('<option value=""><?php _e( "Select a region..." ); ?></option>');
} else {
$("#region").before('<select name="regionId" id="regionId" ><option value=""><?php _e( "Select a region..." ); ?></option></select>');
$("#region").remove();
}
if ($("#cityId").length > 0) {
$("#cityId").html('<option value=""><?php _e( "Select a city..." ); ?></option>');
} else {
$("#city").before('<select name="cityId" id="cityId" ><option value=""><?php _e( "Select a city..." ); ?></option></select>');
$("#city").remove();
}
$("#regionId").attr('disabled', true);
$("#cityId").attr('disabled', true);
}
});
$("#regionId").on("change", function () {
var pk_c_code = $(this).val();
var url = '<?php echo osc_base_url( true ) . "?page=ajax&action=cities®ionId="; ?>' + pk_c_code;
var result = '';
if (pk_c_code != '') {
$("#cityId").attr('disabled', false);
$.ajax({
type: "POST",
url: url,
dataType: 'json',
success: function (data) {
var length = data.length;
if (length > 0) {
result += '<option selected value=""><?php _e( "Select a city..." ); ?></option>';
for (key in data) {
result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>';
}
$("#city").before('<select name="cityId" id="cityId" ></select>');
$("#city").remove();
} else {
result += '<option value=""><?php _e( 'No results' ) ?></option>';
$("#cityId").before('<input type="text" name="city" id="city" />');
$("#cityId").remove();
}
$("#cityId").html(result);
}
});
} else {
$("#cityId").attr('disabled', true);
}
});
if ($("#regionId").attr('value') == "") {
$("#cityId").attr('disabled', true);
}
if ($("#countryId").prop('type').match(/select-one/)) {
if ($("#countryId").attr('value') == "") {
$("#regionId").attr('disabled', true);
}
}
});
</script>
</body>
</html>