Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default class Ini extends Component(){
- deleteTrancation = (valueArticle, valueSales) => {
- title = 'Delete';
- body = 'Are You Sure Delete';
- Alert.alert(
- title,
- body,
- [
- {
- text: 'Cancel',
- onPress: () => console.log('Cancel Pressed'),
- style: 'cancel',
- },
- {text: 'OK', onPress: () => this.delTrans(valueArticle, valueSales)},
- ],
- {cancelable: false},
- )
- }
- delTrans = (valueArticle, valueSales) => {
- const { user,role } = this.props;
- axios({
- method: 'post',
- url: DELETE_TRASACTION_HEADER_URL,
- headers: {
- Authorization: `Bearer ${user}`,
- },
- data: {
- header: {
- id: 0,
- page: 1,
- sort: "ASC"
- },
- body: {
- sales_id: valueSales,
- article_id: valueArticle,
- },
- },
- }).then((response) => {
- if (response.data.header.response_code == 99) {
- console.log(response.data.header.response_description);
- // alert("sucess delete transaction");
- this.props.onFetch();
- } else {
- console.log(response.data.body);
- console.log(response.data.header.response_description);
- // alert('failed delete' + value);
- }
- });
- }
- render(){
- const { data } = this.props;
- console.log(data)
- return (
- <View style={styles.itemCardContainer}>
- <View>
- {/* <Text>{`No Urut: ${data.no_urut}`}</Text> */}
- <View style={[utility.flexRow, { justifyContent: 'space-between' }]}>
- {/* <TouchableOpacity
- onPress = {() => this.deleteTrancation(data.id, data.sales_id)}
- style={[styles.icons, common.backgroundWarn]}>
- <Icon name="clear" size={18} color={color.colorOff} />
- </TouchableOpacity> */} //comment
- {data.is_approved === '0' ? (
- <TouchableOpacity
- onPress = {() => this.deleteTrancation(data.id, data.sales_id)}
- style={[styles.icons, common.backgroundWarn]}>
- <Icon name="clear" size={18} color={color.colorOff} />
- </TouchableOpacity>
- ) : (
- <Text style={[common.textValid]}></Text>
- )}
- </View>
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement