<!-- Text input-->
<div class="control-group form-group">
<label class="control-label col-lg-4" for="shopid">shopid</label>
<div class="controls col-lg-8">
<input id="shopid" name="shopid" type="text" value="<?php echo $userDetails['shopid']; ?>" class="input-xlarge form-control">
</div>
</div>
<!-- Text input-->
<div class="control-group form-group">
<label class="control-label col-lg-4" for="scid">scid</label>
<div class="controls col-lg-8">
<input id="scid" name="scid" type="text" value="<?php echo $userDetails['scid']; ?>" class="input-xlarge form-control">
</div>
</div>
<!-- Multiple Checkboxes -->
<div class="control-group">
<label class="control-label" for="paymetods">Способы оплаты, доступный вам в договоре</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="yandexmoney" id="yandexmoney" value="yandexmoney" <?php echo ($userDetails['yandexmoney']==1 ? 'checked' : '');?>>
Yandex.Money
</label>
<label class="checkbox">
<input type="checkbox" name="cards" id="cards" value="cards" <?php echo ($userDetails['cards']==1 ? 'checked' : '');?>>
Cards
</label>
<label class="checkbox">
<input type="checkbox" name="kiosks" id="kiosks" value="kiosks" <?php echo ($userDetails['kiosks']==1 ? 'checked' : '');?>>
Mobile.Phone
</label>
<label class="checkbox">
<input type="checkbox" name="mobile" id="mobile" value="mobile" <?php echo ($userDetails['mobile']==1 ? 'checked' : '');?>>
Kiosks
</label>
<label class="checkbox">
<input type="checkbox" name="webmoney" id="webmoney" value="webmoney" <?php echo ($userDetails['webmoney']==1 ? 'checked' : '');?>>
WebMoney
</label>
</div>
</div>
case "updateDetails":
$user = new ASUser(ASSession::get("user_id"));
$user->updateDetails($_POST['details']);
break;
public function updateDetails($details) {
$currDetails = $this->getDetails();
if(isset($currDetails['empty'])) {
$details["user_id"] = $this->userId;
$this->insert("as_user_details", $details);
}
else
$this->update(
"as_user_details",
$details,
"`user_id` = :id",
array( "id" => $this->userId )
);
}
profile.updateDetails = function () {
//remove error messages if there are any
asengine.removeErrorMessages();
//turn on button loading state
asengine.loadingButton($("#update_details"), "Updating...");
//prepare data that will be sent to server
var data = {
action : "updateDetails",
details: {
first_name: $("#first_name").val(),
last_name : $("#last_name").val(),
address : $("#address").val(),
shopid : $("#shopid").val(),
scid : $("#scid").val(),
yandexmoney: $("#yandexmoney").val(),
kiosks : $("#kiosks").val(),
mobile : $("#mobile").val(),
webmoney : $("#webmoney").val()
}
};
//send data to server
$.ajax({
url: "ASEngine/ASAjax.php",
type: "POST",
data: data,
success: function (result) {
//return button to normal state
asengine.removeLoadingButton($("#update_details"));
if(result == "") {
asengine.displaySuccessMessage($("#form-details"),"Details updated successfully.");
}
else {
//display error messages
console.log(result);
asengine.displayErrorMessage($("#form-details input"));
asengine.displayErrorMessage(
$("#phone"),
"Error while updating database. Please try again."
);
}
}
});
};
var data = {
action : "updateDetails",
details: {
first_name: $("#first_name").val(),
last_name : $("#last_name").val(),
address : $("#address").val(),
shopid : $("#shopid").val(),
scid : $("#scid").val(),
yandexmoney:$("#yandexmoney").prop('checked') ? 1 : 0,
kiosks : $("#kiosks").prop('checked') ? 1 : 0,
mobile : $("#mobile").prop('checked') ? 1 : 0,
cards : $("#cards").prop('checked') ? 1 : 0,
webmoney : $("#webmoney").prop('checked') ? 1 : 0
}
};
всем спасибо)