이유식 추가 커밋

dev_bert
jeongcheewoo 3 years ago
parent f85dda00d1
commit 25d506f98c

@ -1058,4 +1058,28 @@ public class M_Bf_foodController extends AbstractControllerManager{
return redirect_url;
}
@RequestMapping(value="view_bf_commerce_input")
public String view_bf_commerce_input(@ModelAttribute("model") ModelMap model, HttpServletRequest request, HttpServletResponse response
, RedirectAttributes ra) {
DataMap paramMap = gmUtil.getDataMapFromRequest(request);
String redirect_url = "m/bf_food/view_bf_commerce_input";
try {
boolean is_login = gmUtil.setSessionForMobileMember(request, paramMap);
if(is_login == false) {
ra.addFlashAttribute("call_native_login", "Y");
redirect_url = "redirect:/m/login/view_login.do";
}else{
// 아이
DataMap rm_child = init_child(model, request, paramMap);
DataMap.putToModel(model, "rm_child", rm_child);
}
}catch(Exception ex1){ redirect_url = gmUtil.redirectError(true, ex1, request, paramMap, ra, ""); ex1.printStackTrace();}
gmUtil.redirectParam(model, paramMap);
return redirect_url;
}
}

@ -59,6 +59,12 @@
<span>모유/젖병</span>
</a>
</p>
<p>
<a href="view_bf_commerce_input.do?return_url=index">
<span>이유식 추가</span>
</a>
</p>
</div>
<div class="nutrition_subMain_search">

@ -0,0 +1,248 @@
<#include "/m/include/index_top.ftl">
<link rel="stylesheet" href="${URL_STATIC_ROOT}/m/css/anypicker-all.css">
<!-- 달력 datepicker -->
<script type="text/javascript" src="${URL_STATIC_ROOT}/m/js/anypicker.min.js"></script>
<link rel="stylesheet" href="${URL_STATIC_ROOT}/m/css/datepicker.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js"></script>
<#assign thumb_path = (model['rm_child']['append_300_img_file'])!>
<#if thumb_path?has_content>
<#assign thumb_path="/file/get_img.do?mt_file_seq="+thumb_path >
<#if thumb_path?index_of("http") != 0><#assign thumb_path = URL_ROOT + thumb_path></#if>
<#else>
<#if (model['rm_child']['gender'])! == 'F'>
<#assign thumb_path = '/bf/m/img/child/child_pic_04.png' >
<#else>
<#assign thumb_path = '/bf/m/img/child/child_pic_03.png' >
</#if>
</#if>
<script>
function CMD_MEASUREMENT_HEIGHT(smc_no) {
var cmd = 'CMD_MEASUREMENT_HEIGHT';
var args = {
smc_no: smc_no,
};
try{
window.interface.executeInterface(function(r){console.log('sussess:', r);}, function(r){console.log('fail:', r);}, cmd, args);
}catch(e){
alert(e);
}
}
</script>
<body><!--grey_bg / blue_w_bg /blue_g_bg-->
<div class="wrap">
<header class="header_wrapper">
<a href="javascript:back.return_url()" class="side_Lbtn hidden pre_btn">이전으로</a>
<h1 class="header_title">${model['rm_child']['name']} 이유식 추가</h1>
<div class="side_Rbtn">
<a href="#" class="growth_cal">
<input type="text" id="date">
</a>
</div>
</header>
<main class="m_child_direct_input" id="top_move">
<div class="profile_wrap">
<input type="hidden" id="smc_no" class="required" name="smc_no" value="${model['smc_no']}" data-tit="아이 코드"/>
<form class="profile_header" id="frmHeight" method="POST">
<div class="p_header_pic">
<div class="pic hidden" style="background: url(${thumb_path})">프로필 사진</div>
<div class="child_tit">
<div class="name"><a href="javascript:CMD_MEASUREMENT_HEIGHT('${model['rm_child']['smc_no']}');">${model['rm_child']['name']}</a></div>
<div class="age">${model['rm_child']['age_y']!}세 ${model['rm_child']['age_m']!}개월</div>
</div>
</div>
<div class="profile_list">
<h2 class="p_title">정보입력</h2>
<div class="p_list_item p_border_box">
<label for="child_height" class="p_label">섭취시간</label>
<div class="p_input_box">
<input type="number" id="eat_second" name="eat_second" value="${model['height']!}" class="required" placeholder="섭취시간(분)" data-tit="키" step="0.1">
<span class="unit">분</span>
<input type="number" id="eat_minute" name="eat_minute" value="${model['weight']!}" class="required" placeholder="섭취시간(초)" data-tit="체중" step="0.1">
<span class="unit">초</span>
</div>
</div>
<button type="submit" id="" name="" class="btns">저장</button>
</div>
<p class="p_info">
<span class="blue_tit">※ 입력하신 내용을 저장하시면 아래 목록에 추가됩니다.</span>
<span class="blue_tit">※ 동일한 날짜에 여러번 측정 혹은 입력하였을 시, 해당 날짜의 마지막 측정기록만 저장됩니다.</span>
</p>
</form>
<#if (model['lm_body'])??>
<div class="direct_input_wrap">
<h2 class="title"><span class="blue_tit">측정/입력</span> 리스트</h2>
<div class="result_list_box">
<#list model['lm_body'] as item>
<div class="r_list_item">
<div>
<div class="result_num_box">
<div class="height_result result_num">${item['height']?string('0.0')}<span class="unit">cm</span> / ${item['weight']?string('0.0')}<span class="unit">kg</span></div>
<#if item['data_from'] == '1'><span class="icon hidden">수기입력</span></#if>
</div>
<div class="date">
<span><span class="hidden icon">입력일 아이콘</span>입력일</span>${item['base_dt']?string('yyyy. MM. dd')}
</div>
</div>
<button type="button" id="" name="" class="hidden del_btn" onclick="javascript:growthBody.ajax_delete_growth_body(${item['sgb_no']})" >삭제</button>
</div>
</#list>
</div>
<#--페이지네이션-->
<ul class="pagination">
<@b.Paging url="${URL_PATH}/view_bf_growth_body_input.do"
pageCount="${model['page']['pageCount']?c}"
rowCount="${model['page']['rowCount']?c}"
rowMax="${model['page']['rowMax']?c}"
nowPage="${model['page']['nowPage']?c}"
params="smc_no=${model['smc_no']}&is_search=${model['is_search']!}&search_col=${model['search_col']!}&search_text=${model['search_text']!}&search_col_dt=${model['search_col_dt']!}&search_s_dt=${model['search_s_dt']!}&search_e_dt=${model['search_e_dt']!}&return_url=${model['return_url']!}&"
class_page_active=" active"
is_prev_first="N"
is_next_end="N"
/>
</ul>
</div>
</#if>
</div>
</main>
</div>
<!-- 하단 네비 iyu_nav -->
<#include "/m/include/index_bottom_menu.ftl">
<!-- //iyu_nav -->
<script type="text/javascript">
var growthBody = {
init: function(){
SNUtil.initInputAction()
$('#frmHeight').on('submit',function(e){
if (!SNValidator.validateWithAlert('#frmHeight')) {
e.preventDefault()
return;
}
if($('#child_height').val() >= 210 || $('#child_height').val() < 30){
Swal.fire({
text: '신장범위(30~210cm)를 초과했습니다'
}).then((result)=>{ $('#child_height').focus() })
e.preventDefault()
return;
}
if($('#child_weight').val() >= 100 || $('#child_weight').val() < 1){
Swal.fire({
text: '체중범위(1~100Kg)를 초과했습니다'
}).then((result)=>{ $('#child_weight').focus() })
e.preventDefault()
return;
}
this.ajax_insert_growth_body()
e.preventDefault()
return;
}.bind(this))
},
ajax_insert_growth_body: function(){
var data = {}
data.smc_no = $('#smc_no').val()
data.base_dt = moment( $('#input_date').val(),'YYYY. MM. DD' ).format('YYYYMMDD')
data.height = $('#child_height').val()
data.weight = $('#child_weight').val()
$.ajax({
url:'${URL_ROOT}/m/bf_growth_body/ajax_insert_bf_growth_body.do?1=1',
type:'post',
data: data,
dataType:'json',
error:function(request,status,error){
Swal.fire({text:"등록되지 않았습니다"})
},
success:function(result){
console.log(result)
var RESULT = result.RESULT
if(RESULT == 0){ //0:RESULT_SUCCESS
Swal.fire({text:"입력되었습니다"}).then((result) => { location.replace('./view_bf_growth_body_input.do?smc_no=${(model["smc_no"])!}') })
}else{
Swal.fire({text:"등록되지 않았습니다"})
}
},
})
},
ajax_delete_growth_body: function(sgb_no){
if(!sgb_no){return}
var data = {}
data.sgb_no = sgb_no
Swal.fire({
text: "기록을 삭제하시겠습니까?",
showCancelButton: true,
confirmButtonText: '네',
cancelButtonText: '취소'
}).then((result) => {
if(result.value){
$.ajax({
url:'${URL_ROOT}/m/bf_growth_body/ajax_delete_bf_growth_body.do?1=1',
type:'post',
data: data,
dataType:'json',
error:function(request,status,error){
Swal.fire({text:"삭제되지 않았습니다"})
},
success:function(result){
console.log(result)
var RESULT = result.RESULT
if(RESULT == 0){ //0:RESULT_SUCCESS
location.replace('./view_bf_growth_body_input.do?smc_no=${(model["smc_no"])!}')
}else{
Swal.fire({text:"삭제되지 않았습니다"})
}
},
})
}
})
}
}
$(function(){
growthBody.init();
var today = moment().format('YYYY.MM.DD');
$("#input_date").val(today)
var input_date = SNUtil.makeAnyPicker('input_date', $("#input_date").val(), -80, '.');
})
</script>
<script type="text/javascript">
// 달력 datepicker
jQuery("#date").datepicker({
showMonthAfterYear: true,
yearSuffix: '년',
showOn: "button",
buttonImage: "${URL_STATIC_ROOT}/m/img/growth/growth_cal_ico.png",
buttonImageOnly: true,
dateFormat: 'yy-mm-dd',
nextText: '다음 달',
prevText: '이전 달',
monthNames: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
monthNamesShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
dayNamesShort: ['일', '월', '화', '수', '목', '금', '토']
});
</script>
<#include "/m/bf_growth_body/include_return_url.ftl">
</body>
<#include "/m/include/index_bottom.ftl">
Loading…
Cancel
Save