shr.defineClass("shr.custom.CheckInApplicationSelf", shr.framework.Edit, {
	initalizeDOM: function () {
		shr.custom.CheckInApplicationSelf.superClass.initalizeDOM.call(this);
		var self = this;
		if ("VIEW" != this.operateState) {
			$("#entrys_checkInRoom").shrPromptBox("option", {
				verifyBeforeOpenCallback: function () {
					var checkInDate = $("#entrys_checkInDate").shrDateTimePicker("getValue");
					//必须先选择入住日期
					if (!checkInDate || checkInDate == '') {
						shr.showWarning({
							message: "请先选择入住日期！",
							hideAfter: 5
						});
						return false;
					}
					var checkInDate = $("#entrys_checkInDate").shrDateTimePicker("getValue");
					var checkoutDate = $("#entrys_checkoutDate").shrDateTimePicker("getValue");
					var personId = $("#entrys_person_el").val();
					var result = self.callServiceReturnResponse('getOptionalRoomIdsService', {
						checkInDate: checkInDate,
						checkoutDate: checkoutDate,
						personId: personId
					});
					if (result.code == 500) {
						shr.showWarning({
							message: result.errorMsg,
							hideAfter: 5
						});
						return false;
					}
					//设置过滤条件
					$("#entrys_checkInRoom").shrPromptBox("setFilter", "id in (" + result + ")");
					return true;
				}
			});
			$("#entrys_checkInDate").shrDateTimePicker("option", {
				onChange: function (event) {
					//当入住日期改变时清空入住房间
					$("#entrys_checkInRoom").shrPromptBox("setValue", null);
				}
			});
		}
		if ("0" == $("#billState").val()) {
			//未提交
			//隐藏流程图
			$('#workFlowDiagram').hide();
		}
	},
	/**
	 * 对保存、提交的数据进行确认
	 */
	verify: function () {
		// shr.showInfo({message: message});
		var checkInDate;
		var checkoutDate;
		if ("VIEW" == this.operateState) {
			checkInDate = $("#entrys_checkInDate").val();
			checkoutDate = $("#entrys_checkoutDate").val();
		} else {
			checkInDate = $("#entrys_checkInDate").shrDateTimePicker("getValue");
			checkoutDate = $("#entrys_checkoutDate").shrDateTimePicker("getValue");
		}
		if (checkoutDate <= checkInDate) {
			shr.showWarning({
				message: "退宿日期不能小于等于入住日期",
				hideAfter: 5
			});

			return false;
		}
		return true;
	},

});