import { ADD_USER} from './actionTypes';
import { HELLO} from './actionTypes';
import firebase from 'react-native-firebase';
export const addUser = (surname, name, patronymic, phone) => {
return dispatch => {
var db = firebase.firestore();
let user = {
surname: surname,
name: name,
patronymic: patronymic,
phone: phone
}
var result = 'начальный';
var docRef = db.collection('users').doc(user.phone);
return docRef.get().then(function(doc) {
if (doc.exists) {
result = 'Такой номер уже есть';
console.log('Такой номер уже есть');
}else{
db.collection('users').doc(user.phone).set(user);
result = true;
console.log(true);
}
return result;
}).catch(function(error) {
result = 'Произошла ошибка';
console.log('Произошла ошибка');
return result;
});
};
};
this.props.onAddUser(
this.state.controls.surname.value,
this.state.controls.name.value,
this.state.controls.patronymic.value,
this.state.controls.phone.value
).then(result => {
console.log(result);
})
$('#orderForm').on("submit", function(e) {
e.preventDefault();
$.ajax({
type: 'post',
url: "../cart/order.php",
data: {'quant':$('.quantField').val(),'tid':$('.quantField').attr("tid"),'tprice':$('.quantField').attr("tprice"),'tart':$('.quantField').attr("tart"),'tpack':$('.checkPack').attr("tpack")},
response: 'text',
success: function(data){
$('.desFooter').hide();
$('.cartTotal').html(data).fadeIn();
$('.desForm').slideUp('fast', function(){$(this).remove();});
$('.ordered').fadeIn();
}
})
}
);
<?foreach($rs_result as $key => $prices_name):?>
<?foreach($prices_name['UF_PRICE_NAME'] as $name):?>
<?=name?><br>
<?endforeach?>
<?endforeach?>
<?foreach($rs_result as $key => $prices_name):?>
<?foreach($prices_name['UF_PRICE_NAME_VALUE'] as $name):?>
<?=name?><br>
<?endforeach?>
<?endforeach?>