[726] | 1 | <form id="admin_update_user_form"> |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | <div class="col-xs-12" style="margin: 5px;"> |
---|
| 5 | <div class="form-group"> |
---|
| 6 | <label for="form-field-first" class="col-sm-4 control-label no-padding-right">HỠvà tên</label> |
---|
| 7 | <div class="col-sm-8"> |
---|
| 8 | <input type="text" name="fullname" value="<?php echo @$user['fullname']; ?> " placeholder="HỠvà tên" id="form-field-first" class="col-xs-12 col-sm-10"> |
---|
| 9 | </div> |
---|
| 10 | </div> |
---|
| 11 | </div> |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | <div class="col-xs-12" style="margin: 5px;"> |
---|
| 16 | <div class="form-group"> |
---|
| 17 | <label for="form-field-username" class="col-sm-4 control-label no-padding-right">ÄÆ¡n vá»</label> |
---|
| 18 | <div class="col-sm-8"> |
---|
| 19 | <input type="text" name="school" value="<?php echo @$user['school']; ?>" placeholder="ÄÆ¡n vá»" id="form-field-username" class="col-xs-12 col-sm-10"> |
---|
| 20 | </div> |
---|
| 21 | </div> |
---|
| 22 | </div> |
---|
| 23 | |
---|
| 24 | <div class="col-xs-12" style="margin: 5px;"> |
---|
| 25 | <div class="form-group"> |
---|
| 26 | <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Tá»nh / Thà nh phá»</label> |
---|
| 27 | <div class="col-sm-8"> |
---|
[906] | 28 | <select name="province" id="form-field-province" class="form-field-province-user col-xs-12 col-sm-10"> |
---|
| 29 | <option></option> |
---|
[773] | 30 | <?php foreach ($provinces as $key => $pro): ?> |
---|
| 31 | <option value="<?php echo $key; ?>" <?php if ($user['province'] == $key) echo "selected"; ?>><?php echo $pro; ?></option> |
---|
[726] | 32 | <?php endforeach; ?> |
---|
| 33 | </select> |
---|
| 34 | </div> |
---|
| 35 | </div> |
---|
| 36 | </div> |
---|
[838] | 37 | <div class="col-xs-12" style="margin: 5px;"> |
---|
| 38 | <div class="form-group"> |
---|
| 39 | <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label> |
---|
| 40 | <div class="col-sm-8"> |
---|
[906] | 41 | <select name="district" id="form-field-district" class="form-field-district-user col-xs-12 col-sm-10"> |
---|
[770] | 42 | |
---|
[838] | 43 | </select> |
---|
| 44 | </div> |
---|
| 45 | </div> |
---|
| 46 | </div> |
---|
| 47 | |
---|
[770] | 48 | <input type="hidden" name="us_id" value="<?php echo $user['us_id'] ?>"> |
---|
| 49 | <?php |
---|
| 50 | if (in_array("editUserInfo", $roles)) { |
---|
| 51 | ?><div class="col-xs-12" style="margin: 5px;"> |
---|
| 52 | <div class="form-group"> |
---|
| 53 | <input class="btn btn-primary pull-right " type="button" value="Cáºp nháºt" onclick="admin_update_user();"/> |
---|
| 54 | </div> |
---|
| 55 | </div> |
---|
| 56 | <?php |
---|
| 57 | } |
---|
| 58 | ?> |
---|
[726] | 59 | </form> |
---|
[838] | 60 | <script> |
---|
| 61 | var district_id = "<?php echo $user['district']; ?>"; |
---|
[883] | 62 | var province_id = "<?php echo $user['province']; ?>"; |
---|
[906] | 63 | |
---|
[883] | 64 | $(document).ready(function(){ |
---|
[906] | 65 | $(".form-field-province-user").change(function(){ |
---|
[883] | 66 | changeEventProvince(province_id); |
---|
| 67 | }); |
---|
[906] | 68 | if ($(".form-field-province-user").val() !== 'undefined'){ |
---|
[883] | 69 | checkSelectedDistrict(province_id); |
---|
| 70 | } |
---|
[838] | 71 | }); |
---|
[906] | 72 | |
---|
| 73 | function changeEventProvince(provinceId){ |
---|
| 74 | $(".form-field-district-user").html(""); |
---|
| 75 | $.ajax({ |
---|
| 76 | url: '/frontend/user/getDistrict/' + provinceId, |
---|
| 77 | type: 'POST', |
---|
| 78 | success: function (data, textStatus, jqXHR) |
---|
| 79 | { |
---|
| 80 | result = jQuery.parseJSON(data); |
---|
| 81 | content = "<option></option>"; |
---|
| 82 | if (result != null){ |
---|
| 83 | for (var i in result){ |
---|
| 84 | content = content + '<option value="' + result[i].district_id + '">'+ result[i].type + " " + result[i].district_name + '</option>' |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | $(".form-field-district-user").html(content); |
---|
| 88 | } |
---|
| 89 | }); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | function checkSelectedDistrict(provinceId){ |
---|
| 93 | $.ajax({ |
---|
| 94 | url: '/frontend/user/getDistrict/' + provinceId, |
---|
| 95 | type: 'POST', |
---|
| 96 | success: function (data, textStatus, jqXHR) |
---|
| 97 | { |
---|
| 98 | result = jQuery.parseJSON(data); |
---|
| 99 | content = "<option></option>"; |
---|
| 100 | if (result != null){ |
---|
| 101 | for (var i in result){ |
---|
| 102 | if (result[i].district_id === district_id){ |
---|
| 103 | content = content + '<option value="' + result[i].district_id + '" selected >' + result[i].type + " " + result[i].district_name + '</option>'; |
---|
| 104 | }else{ |
---|
| 105 | content = content + '<option value="' + result[i].district_id + '">' + result[i].type + " " + result[i].district_name + '</option>'; |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | } |
---|
| 110 | $(".form-field-district-user").html(content); |
---|
| 111 | } |
---|
| 112 | }); |
---|
| 113 | } |
---|
[838] | 114 | </script> |
---|