﻿// JScript File
//=======TAO REMINDER MỚI CHO TRAVELLING===============================

function writeReminder( txt_name, txt_name1, txt_name2 ) {
	
	var index = parseInt(document.getElementById('txtRowcountO').value);
	var set_TT = 'onkeypress=""return blockNonNumbers2(this, event, true, true);" onfocusout="set_ThanhTien('+ index +'); set_TongThanhTien(); fill_Negative(this, true);"';
	var html = '';
	
	html += '<table width="100%" cellpading="1" cellspacing="1" id="table_id_'+ index +'">';
	html += '	<tr>\n';
	//html += '		<td width="25" align="center">'+ (index+1);	
	//html += '		<input type="hidden" name="ID_' + index + '" value=""></td>';
	//===============START=============
	html += '		<td  align="right" style="padding-right:10px;width:200px;">'+ getInputBox( txt_name + index, '', 200, 255, set_TT ) +'</td>';	
	//===============END===============
	//html += '		<td width="50" align="center">';
	html += '		<td  align="left" style="padding-left:10px;">'+ getInputBox( txt_name1 + index, '', 100, 15, set_TT ) +'';
	html += '		<input id="btNgayNhanO_' + index + '" class="ButtonCalendar" name="btNgayNhanO_' + index + '" onmouseover="setup_calendar(Zapatec, datNgayHieuLucO_' + index + ', this)" type="button">';
	
	html += '		<input type="hidden" name="txt_delete_' + index + '" value="">';
	html += '		<input type="hidden" name="txtIdO_' + index + '" value="0">';
	html += '		<input type="button" class="button_delete" value="" onclick="deleteNewRecord(txt_delete_'+ index +", 'table_id_" + index + "'" + ');" />';
	html += '		</td>';
	html += '	</tr>';
	//======TAO PHUONG THUC THONG BAO GOM 3 RADIO=====
	html += '	<tr>\n';
	//html += '		<td  align="center"></td>';
	html += '		<td  align="left" style="padding-left:20px;">Phương thức thông báo</td>';
   	html += '		<td  align="left" style="padding-left:10px;">';
	html += '		<input type="radio" style="width:20px" id="rdEmailO_' + index + '" name="rdGroupO_' + index + '" checked class="textbox01" value="1" /><label for="rdEmailO_' + index + '"  checked style="width:50px;cursor:pointer">Email</label>';
    html += '		<input type="radio" style="width:20px" id="rdPhoneO_' + index + '" name="rdGroupO_' + index + '" class="textbox01" value="2" /><label for="rdPhoneO_' + index + '"  style="width:50px;cursor:pointer">Phone</label>';
    html += '		<input type="radio" style="width:20px" id="rdCaHaiO_' + index + '" name="rdGroupO_' + index + '" class="textbox01" value="3" /><label for="rdCaHaiO_' + index + '"  style="width:50px;cursor:pointer">Cả hai</label>';

	html += '		</td>';
	html += '	</tr>';
	//======TAO THOI GIAN THONG BAO GOM 3 RADIO=====
	html += '	<tr>\n';
	//html += '		<td  align="center"></td>';
	html += '		<td  align="left" style="padding-left:20px;">Thời gian thông báo</td>';
   	html += '		<td  align="left" style="padding-left:10px;">';
	html += '		<input type="radio" style="width:20px" id="rd3thangO_' + index + '" name="rdGroup2O_' + index + '" checked class="textbox01" value="90" /><label for="rd3thangO_' + index + '"  checked style="width:50px;cursor:pointer">3 tháng</label>';
    html += '		<input type="radio" style="width:20px" id="rd1thangO_' + index + '" name="rdGroup2O_' + index + '" class="textbox01" value="30" /><label for="rd1thangO_' + index + '"  style="width:50px;cursor:pointer">1 tháng</label>';
    html += '		<input type="radio" style="width:20px" id="rd1tuanO_' + index + '" name="rdGroup2O_' + index + '" class="textbox01" value="7" /><label for="rd1tuanO_' + index + '"  style="width:50px;cursor:pointer">1 tuần</label>';

	html += '		</td>';
	html += '	</tr>';
	
	html += '</table>';
	
	document.getElementById('UC_Center__ctl0_UC_Center__ctl0_lblReminderKhac').innerHTML += html;
			
	document.getElementById('txtRowcountO').value = index + 1;
}

function getInputBox( name, value, width, maxlength, valid ) {	
    
	return '<input class="" style="width:'+ width +'px" maxlength="'+ maxlength +'" type="text" name="'+ name +'" value="'+ value +'" />';
}


function deleteNewRecord( obj, table_id ) 
{
	
	var res = window.confirm("Bạn muốn xóa?")
	
	if( res ) 
	    {
	    if( obj )
	         {
		         obj.value = "delete";    		
	             var tbl = document.getElementById( ''+ table_id );	
	            if( !tbl ) 
	                {
		                return;
		            }
                else 
                {	
                tbl.style.display = 'none';
                }
            }
          }
}
