updated contact setting functionality
This commit is contained in:
parent
12f7c8d213
commit
d9895cb353
3 changed files with 56 additions and 3 deletions
|
@ -41,5 +41,14 @@
|
||||||
echo $json_data;
|
echo $json_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['upd_contact'])){
|
||||||
|
$frm_data = filteration($_POST);
|
||||||
|
$q = "UPDATE `contact_detail` SET `address`=?,`booking_phone`=?,`booking_email`=?,`reserve_phone`=?,`reserve_email`=?,`recep_phone`=?,`recep_email`=?,`offi_name`=?,`offi_phone`=?,`offi_email`=? WHERE `sr_no`=?";
|
||||||
|
$values = [$frm_data['address'], $frm_data['booking_phone'], $frm_data['booking_email'], $frm_data['reserve_phone'], $frm_data['reserve_email'], $frm_data['recep_phone'], $frm_data['recep_email'], $frm_data['offi_name'], $frm_data['offi_phone'], $frm_data['offi_email'], 1];
|
||||||
|
$res = update($q, $values, 'ssssssssssi');
|
||||||
|
|
||||||
|
echo $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -46,6 +46,7 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #194141;
|
background-color: #194141;
|
||||||
color: white;
|
color: white;
|
||||||
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
.custom-alert-t{
|
.custom-alert-t{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|
|
@ -201,9 +201,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" onclick="" class="btn-cancle" data-bs-dismiss="modal">Cancle</button>
|
<button type="button" onclick="contact_input(contact_data)" class="btn-cancle" data-bs-dismiss="modal">Cancle</button>
|
||||||
<button type="submit" class="btn-third">Submit</button>
|
<button type="submit" class="btn-third">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -216,7 +215,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php require('components/script.php') ?>
|
<?php require('components/script.php') ?>
|
||||||
<script>
|
<script>
|
||||||
let general_data, contact_data;
|
let general_data, contact_data;
|
||||||
|
@ -224,6 +222,8 @@
|
||||||
let general_setting_form = document.getElementById('general_setting_form');
|
let general_setting_form = document.getElementById('general_setting_form');
|
||||||
let site_title_input = document.getElementById('site_title_input');
|
let site_title_input = document.getElementById('site_title_input');
|
||||||
|
|
||||||
|
let contact_setting_form = document.getElementById('contact_setting_form');
|
||||||
|
|
||||||
function get_general(){
|
function get_general(){
|
||||||
let site_title = document.getElementById('site_title');
|
let site_title = document.getElementById('site_title');
|
||||||
let shutdown_toggle = document.getElementById('shutdown_toggle');
|
let shutdown_toggle = document.getElementById('shutdown_toggle');
|
||||||
|
@ -312,6 +312,49 @@
|
||||||
xhr.send('get_contact');
|
xhr.send('get_contact');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function contact_input(data){
|
||||||
|
let contact_input_id = ['address_input', 'booking_phone_input', 'booking_email_input', 'reserve_phone_input', 'reserve_email_input', 'recep_phone_input', 'recep_email_input', 'offi_name_input', 'offi_phone_input', 'offi_email_input'];
|
||||||
|
|
||||||
|
for(i = 0; i < contact_input_id.length; i++){
|
||||||
|
document.getElementById(contact_input_id[i]).value = data[i+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contact_setting_form.addEventListener('submit', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
upd_contact();
|
||||||
|
})
|
||||||
|
|
||||||
|
function upd_contact(){
|
||||||
|
let index = ['address', 'booking_phone', 'booking_email', 'reserve_phone', 'reserve_email', 'recep_phone', 'recep_email', 'offi_name', 'offi_phone', 'offi_email'];
|
||||||
|
let contact_input_id = ['address_input', 'booking_phone_input', 'booking_email_input', 'reserve_phone_input', 'reserve_email_input', 'recep_phone_input', 'recep_email_input', 'offi_name_input', 'offi_phone_input', 'offi_email_input'];
|
||||||
|
let data_str = "";
|
||||||
|
|
||||||
|
for(i = 0; i < index.length; i++){
|
||||||
|
data_str += index[i] + "=" + document.getElementById(contact_input_id[i]).value + '&';
|
||||||
|
}
|
||||||
|
data_str += "upd_contact";
|
||||||
|
|
||||||
|
let xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", "ajax/settings_crud.php", true);
|
||||||
|
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||||
|
|
||||||
|
xhr.onload = function(){
|
||||||
|
var myModal = document.getElementById('contact-setting');
|
||||||
|
var modal = bootstrap.Modal.getInstance(myModal);
|
||||||
|
modal.hide();
|
||||||
|
|
||||||
|
if(this.responseText == 1){
|
||||||
|
alert('success', 'Your information is updated');
|
||||||
|
get_contact();
|
||||||
|
} else{
|
||||||
|
alert('error', 'Fail to update your information');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.send(data_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
window.onload = function(){
|
window.onload = function(){
|
||||||
get_general();
|
get_general();
|
||||||
|
|
Loading…
Add table
Reference in a new issue