Commit b8bc934a authored by Choi Ga Young's avatar Choi Ga Young
Browse files

병합 후 수정

parent a390f249
...@@ -65,13 +65,13 @@ const ChartM = ({ ...@@ -65,13 +65,13 @@ const ChartM = ({
} }
return ( return (
<> <>
<View style={{ flexDirection: 'row' }}> <View style={{ flexDirection: 'row', justifyContent: "center", alignItems: "center"}}>
<Button icon={ <Button icon={
<Ionicons name='chevron-back-sharp' onPress={prevBtn} size={15} color='black' /> <Ionicons name='chevron-back-sharp' onPress={prevBtn} size={20} color='black' />
} type='clear' /> } type='clear' />
<Text>{year}.{month + 1}</Text> <Text style={{ fontFamily: 'GowunDodum-Regular', fontSize:20 }}>{year}.{month + 1}</Text>
<Button icon={ <Button icon={
<Ionicons name='chevron-forward-sharp' onPress={nextBtn} size={15} color='black' /> <Ionicons name='chevron-forward-sharp' onPress={nextBtn} size={20} color='black' />
} type='clear' /> } type='clear' />
</View> </View>
<View> <View>
......
...@@ -44,13 +44,13 @@ const ChartY = ({ resDataY, year, setYear }) => { ...@@ -44,13 +44,13 @@ const ChartY = ({ resDataY, year, setYear }) => {
return ( return (
<> <>
<View style={{ flexDirection: 'row' }}> <View style={{ flexDirection: 'row', justifyContent: "center", alignItems: "center" }}>
<Button icon={ <Button icon={
<Ionicons name='chevron-back-sharp' onPress={prevBtn} size={15} color='black' /> <Ionicons name='chevron-back-sharp' onPress={prevBtn} size={20} color='black' />
} type='clear' /> } type='clear' />
<Text style={{ fontFamily: 'GowunDodum-Regular' }}>{year}</Text> <Text style={{ fontFamily: 'GowunDodum-Regular', fontSize:20 }}>{year}</Text>
<Button icon={ <Button icon={
<Ionicons name='chevron-forward-sharp' onPress={nextBtn} size={15} color='black' /> <Ionicons name='chevron-forward-sharp' onPress={nextBtn} size={20} color='black' />
} type='clear' /> } type='clear' />
</View> </View>
<View style={{ flexDirection: 'row', justifyContent: "space-around" }}> <View style={{ flexDirection: 'row', justifyContent: "space-around" }}>
......
...@@ -18,7 +18,7 @@ const DetailItem = ({ item }) => { ...@@ -18,7 +18,7 @@ const DetailItem = ({ item }) => {
}}> }}>
<Text style={[style.itemText, item.type === 1 ? style.inputColor : style.outputColor]}>{item.category}</Text> <Text style={[style.itemText, item.type === 1 ? style.inputColor : style.outputColor]}>{item.category}</Text>
<Text style={[style.itemTextNum, style.Font]}>{item.contents}</Text> <Text style={[style.itemTextNum, style.Font]}>{item.contents}</Text>
<Text style={[style.itemTextNum, style.Font]}>{item.price}</Text> <Text style={[style.itemTextNum, style.Font]}>{(item.price).toLocaleString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}</Text>
</View> </View>
</> </>
); );
...@@ -28,7 +28,7 @@ const AssetItem = ({ item }) => { ...@@ -28,7 +28,7 @@ const AssetItem = ({ item }) => {
return ( return (
<View style={{ flexDirection: "row", width: 180 }}> <View style={{ flexDirection: "row", width: 180 }}>
<Text style={[style.Font, { width: "40%", textAlign: 'left' }]}>{item.name}</Text> <Text style={[style.Font, { width: "40%", textAlign: 'left' }]}>{item.name}</Text>
<Text style={[style.Font, { width: "60%", textAlign: 'right' }]}>{item.price} </Text> <Text style={[style.Font, { width: "60%", textAlign: 'right' }]}>{(item.price).toLocaleString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")} </Text>
</View> </View>
); );
}; };
...@@ -111,7 +111,7 @@ function MainScreen({ navigation }) { ...@@ -111,7 +111,7 @@ function MainScreen({ navigation }) {
</View> </View>
<View style={style.Contents}> <View style={style.Contents}>
<Text style={[style.Font, { fontWeight: 'bold' }]}> 자산</Text> <Text style={[style.Font, { fontWeight: 'bold' }]}> 자산</Text>
<Text style={style.totalMoney}><FontAwesome name="won" style={style.totalMoney} /> {totalMoney}</Text> <Text style={style.totalMoney}><FontAwesome name="won" style={style.totalMoney} /> {(totalMoney).toLocaleString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}</Text>
<View style={{ marginTop: 5 }}> <View style={{ marginTop: 5 }}>
{totalAssetsMoney.length !== 0 && totalAssetsMoney.map((item, index) => <AssetItem item={item} key={index} />)} {totalAssetsMoney.length !== 0 && totalAssetsMoney.map((item, index) => <AssetItem item={item} key={index} />)}
</View> </View>
......
...@@ -55,16 +55,6 @@ const PostMoney = ({ navigation }) => { ...@@ -55,16 +55,6 @@ const PostMoney = ({ navigation }) => {
setSelected_subcat(INIT_SUBCATEGORY) setSelected_subcat(INIT_SUBCATEGORY)
} }
console.log(
'type: ', selectedIndex,
'| date: ', date,
'| contents: ', contents,
'| price: ', price,
'| selected_asset_type: ', selected_asset_type.id,
'| 이동일 때 ', (selectedIndex === 2 ? { ['selected_deposit_asset_type']: selected_deposit_asset_type.id } : null),
'| selected_cat: ', selected_cat.id,
'| selected_subcat: ', selected_subcat.id)
const insertData = async () => { const insertData = async () => {
try { try {
let type = selectedIndex + 1; let type = selectedIndex + 1;
......
...@@ -12,8 +12,8 @@ const DateItem = ({ dateitem, textColor, onPress, flatListHeight }) => { ...@@ -12,8 +12,8 @@ const DateItem = ({ dateitem, textColor, onPress, flatListHeight }) => {
{ {
dateitem.type && dateitem.type &&
<View> <View>
<Text style={{ color: '#1E90FF' }}>{dateitem.type.input ? dateitem.type.input : null}</Text> <Text style={{ color: '#1E90FF' }}>{dateitem.type.input ? (dateitem.type.input).toLocaleString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : null}</Text>
<Text style={{ color: '#DC143C' }}>{dateitem.type.output ? dateitem.type.output : null}</Text> <Text style={{ color: '#DC143C' }}>{dateitem.type.output ? (dateitem.type.output).toLocaleString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : null}</Text>
</View> </View>
} }
</TouchableOpacity> </TouchableOpacity>
......
...@@ -8,12 +8,9 @@ function TodoItem({ item, onDeleteHandle }) { ...@@ -8,12 +8,9 @@ function TodoItem({ item, onDeleteHandle }) {
<Ionicons name='trash-outline' size={15} color='#333' onPress={onDeleteHandle} /> <Ionicons name='trash-outline' size={15} color='#333' onPress={onDeleteHandle} />
<Text style={styles.itemText}>{item.date}</Text> <Text style={styles.itemText}>{item.date}</Text>
<Text style={styles.itemText}>{item.message}</Text> <Text style={styles.itemText}>{item.message}</Text>
<Text style={styles.itemText}>{item.money}</Text> {item.money ? <Text style={styles.itemText}>{(item.repayment).toLocaleString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")} / {(item.money).toLocaleString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}</Text> : null}
<Text style={styles.itemText}>{item.remained_money}</Text>
</View> </View>
) )
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
...@@ -30,6 +27,7 @@ const styles = StyleSheet.create({ ...@@ -30,6 +27,7 @@ const styles = StyleSheet.create({
itemText: { itemText: {
fontFamily: 'GowunDodum-Regular', fontFamily: 'GowunDodum-Regular',
marginLeft: 10, marginLeft: 10,
fontSize: 15
} }
}) })
......
...@@ -7,21 +7,17 @@ enablePromise(true); ...@@ -7,21 +7,17 @@ enablePromise(true);
const insertDept = async (deptData) => { const insertDept = async (deptData) => {
const db = await getDb(); const db = await getDb();
const { date, loan, message, money, remained_money } = deptData const { date, loan, message, money, repayment } = deptData
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.transaction((tx) => { db.transaction((tx) => {
tx.executeSql('INSERT INTO dept (repayment_date, loan, loan_name, principal, repayment) VALUES (?,?,?,?,?);', tx.executeSql('INSERT INTO dept (repayment_date, loan, loan_name, principal, repayment) VALUES (?,?,?,?,?);',
[date, loan, message, money, remained_money], [date, loan, message, money, repayment],
(error) => console.log(error)) (error) => console.log(error))
resolve('데이터 삽입 완료'); resolve('데이터 삽입 완료');
}) })
}) })
}; };
const selectLoan = async (title) => { const selectLoan = async (title) => {
const db = await getDb(); const db = await getDb();
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -35,7 +31,7 @@ const selectLoan = async (title) => { ...@@ -35,7 +31,7 @@ const selectLoan = async (title) => {
const tempRepayment = results.rows.item(i).repayment; const tempRepayment = results.rows.item(i).repayment;
const tempRe_date = results.rows.item(i).repayment_date; const tempRe_date = results.rows.item(i).repayment_date;
const tempLoan_name = results.rows.item(i).loan_name; const tempLoan_name = results.rows.item(i).loan_name;
temp.push({ id: tempId, date: tempRe_date, loan: tempLoan, message: tempLoan_name, money: tempPrincipal, remained_money: tempRepayment }); temp.push({ id: tempId, date: tempRe_date, loan: tempLoan, message: tempLoan_name, money: tempPrincipal, repayment: tempRepayment });
} }
resolve(temp); resolve(temp);
...@@ -56,12 +52,12 @@ const deleteDept = async (id) => { ...@@ -56,12 +52,12 @@ const deleteDept = async (id) => {
const updateDept = async (deptData, id) => { const updateDept = async (deptData, id) => {
const db = await getDb(); const db = await getDb();
const { date, message, money, remained_money } = deptData const { date, message, money, repayment } = deptData
console.log(date, message, id) console.log(date, message, id)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.transaction((tx) => { db.transaction((tx) => {
tx.executeSql(`UPDATE dept set repayment_date =?, loan_name=?, principal=?, repayment=? where dept_id =${id};`, tx.executeSql(`UPDATE dept set repayment_date =?, loan_name=?, principal=?, repayment=? where dept_id =${id};`,
[date, message, money, remained_money], [date, message, money, repayment],
(error) => console.log(error)) (error) => console.log(error))
resolve('데이터 변경 완료'); resolve('데이터 변경 완료');
}) })
......
...@@ -15,17 +15,17 @@ function DeptDetails({ route, navigation }) { ...@@ -15,17 +15,17 @@ function DeptDetails({ route, navigation }) {
const [date, setDate] = useState(getDates()) const [date, setDate] = useState(getDates())
const [message, setMessage] = useState('') const [message, setMessage] = useState('')
const [money, setMoney] = useState('') const [money, setMoney] = useState('')
const [remained_money, setRemained_money] = useState('') const [repayment, setRepayment] = useState('')
useEffect(() => { useEffect(() => {
setDate(String(item.date)) setDate(String(item.date))
setMessage(item.message) setMessage(item.message)
setMoney(String(item.money)) setMoney(String(item.money))
setRemained_money(String(item.remained_money)) setRepayment(String(item.repayment))
}, []) }, [])
const onUpdateHandle = async () => { const onUpdateHandle = async () => {
await deptApi.updateDept({ date, message, money, remained_money }, item.id) await deptApi.updateDept({ date, message, money, repayment }, item.id)
loadLoan() loadLoan()
navigation.navigate('DeptPage') navigation.navigate('DeptPage')
} }
...@@ -48,17 +48,17 @@ function DeptDetails({ route, navigation }) { ...@@ -48,17 +48,17 @@ function DeptDetails({ route, navigation }) {
} }
/> />
<InputBox <InputBox
inputTitle="" inputTitle=""
value={money} value={money}
onChangeText={ onChangeText={
(money) => setMoney(money) (money) => setMoney(money)
} }
/> />
<InputBox <InputBox
inputTitle="은 금액" inputTitle="은 금액"
value={remained_money} value={repayment}
onChangeText={ onChangeText={
(remained_money) => setRemained_money(remained_money) (repayment) => setRepayment(repayment)
} }
/> />
</View> </View>
......
...@@ -15,15 +15,10 @@ const ReviewSchema = yup.object({ ...@@ -15,15 +15,10 @@ const ReviewSchema = yup.object({
.min(2), .min(2),
money: yup.number() money: yup.number()
.required(), .required(),
remained_money: yup.number() repayment: yup.number()
.required() .required()
}) })
const getDates = () => {
const date = new Date();
return (getDateStr(date))
}
function DeptForm({ addInfo }) { function DeptForm({ addInfo }) {
return ( return (
<TouchableWithoutFeedback onPress={() => { <TouchableWithoutFeedback onPress={() => {
...@@ -31,7 +26,7 @@ function DeptForm({ addInfo }) { ...@@ -31,7 +26,7 @@ function DeptForm({ addInfo }) {
}}> }}>
<View style={globalStyles.container} > <View style={globalStyles.container} >
<Formik <Formik
initialValues={{ date: '', message: '', money: '', remained_money: '' }} initialValues={{ date: getDateStr(), message: '', money: '', repayment: '' }}
validationSchema={ReviewSchema} validationSchema={ReviewSchema}
onSubmit={(values) => { onSubmit={(values) => {
addInfo(values); addInfo(values);
...@@ -41,7 +36,7 @@ function DeptForm({ addInfo }) { ...@@ -41,7 +36,7 @@ function DeptForm({ addInfo }) {
<View> <View>
<DatePicker <DatePicker
inputTitle='날짜' inputTitle='날짜'
date={values.date || getDates()} date={values.date}
setDate={handleChange('date')} setDate={handleChange('date')}
/> />
<InputBox <InputBox
...@@ -50,15 +45,15 @@ function DeptForm({ addInfo }) { ...@@ -50,15 +45,15 @@ function DeptForm({ addInfo }) {
value={values.message} value={values.message}
/> />
<InputBox <InputBox
inputTitle="" inputTitle=""
onChangeText={handleChange('money')} onChangeText={handleChange('money')}
value={values.money} value={values.money}
keyboardType="numeric" keyboardType="numeric"
/> />
<InputBox <InputBox
inputTitle="남은금액" inputTitle="갚은 금액"
onChangeText={handleChange('remained_money')} onChangeText={handleChange('repayment')}
value={values.remained_money} value={values.repayment}
keyboardType="numeric" keyboardType="numeric"
/> />
......
...@@ -16,11 +16,6 @@ const ReviewSchema = yup.object({ ...@@ -16,11 +16,6 @@ const ReviewSchema = yup.object({
}) })
const getDates = () => {
const date = new Date();
return (getDateStr(date))
}
function MemoForm({ addInfo }) { function MemoForm({ addInfo }) {
return ( return (
<TouchableWithoutFeedback onPress={() => { <TouchableWithoutFeedback onPress={() => {
...@@ -28,7 +23,7 @@ function MemoForm({ addInfo }) { ...@@ -28,7 +23,7 @@ function MemoForm({ addInfo }) {
}}> }}>
<View style={globalStyles.container} > <View style={globalStyles.container} >
<Formik <Formik
initialValues={{ date: '', message: '' }} initialValues={{ date: getDateStr(), message: '' }}
validationSchema={ReviewSchema} validationSchema={ReviewSchema}
onSubmit={(values) => { onSubmit={(values) => {
addInfo(values); addInfo(values);
...@@ -39,7 +34,7 @@ function MemoForm({ addInfo }) { ...@@ -39,7 +34,7 @@ function MemoForm({ addInfo }) {
<View> <View>
<DatePicker <DatePicker
inputTitle='날짜' inputTitle='날짜'
date={values.date || getDates()} date={values.date}
setDate={handleChange('date')} setDate={handleChange('date')}
/> />
<InputBox <InputBox
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment