| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- //
- // DurationPopupView.m
- // kneet2
- //
- // Created by Jason Lee on 1/25/16.
- // Copyright (c) 2015 ntels. All rights reserved.
- //
- #import "JDObject.h"
- #import "CustomLabel.h"
- #import "CustomButton.h"
- #import "DurationPopupView.h"
- #import "DatePickerButton.h"
- @interface DurationPopupView () {
-
- }
- @end
- @implementation DurationPopupView
- - (id)initFromNib {
- for (UIView *view in [CommonUtil nibViews:@"DurationPopupView"]) {
- if ([view isKindOfClass:[DurationPopupView class]]) {
- self = (DurationPopupView *)view;
- //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
- self.frame = [UIScreen mainScreen].bounds;
-
-
- _btnFrom.date = [NSDate systemDate];
- _btnTo.date = [NSDate systemDate];
-
- _btnFrom.placeHolder = _btnFrom.dateString; //[CommonUtil formattedDate:[CommonUtil stringFromDate:[NSDate systemDate]]];
- _btnTo.placeHolder = _btnTo.dateString; //[CommonUtil formattedDate:[CommonUtil stringFromDate:[NSDate systemDate]]];
-
- [self.imgTitleBar setImage:[UIImage imageNamed:@"img_popup_bg_head"]inset:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
-
-
- [self.btnConfirm setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_right"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
- [self.btnConfirm setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_right_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
-
-
- [self.btnCancel setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_left"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
- [self.btnCancel setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_left_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
-
- //Localization
- [self.btnConfirm setTitle:NSLocalizedString(@"확인", @"확인") forState:UIControlStateNormal];
- [self.btnCancel setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
- }
- }
- return self;
- }
- - (void)didMoveToSuperview {
-
- }
- - (void)setCondition:(ItemModel *)condition {
- _condition = condition;
-
- if (_condition.itemSubTypeCode && [_condition.itemSubTypeCode isEqualToString:ksConditionSubTypeCodeDueDate]) {
-
- // ItemSubModel *subCondition = _condition.subItems && _condition.subItems.count ? _condition.subItems[0] : nil;
- // if (subCondition) {
- // //set values.
- // NSArray *darray = [subCondition.cmdclsValueMsg componentsSeparatedByString:@"~"];
- //
- // //from
- // [_btnFrom setTitle:darray[0] forState:UIControlStateNormal];
- // if (darray.count > 1) {//to
- // [_btnTo setTitle:darray[1] forState:UIControlStateNormal];
- // }
- // }
-
- } else {
- _condition.itemName = @"이 기간동안만";
- _condition.itemSubTypeCode = ksConditionSubTypeCodeDueDate;
- }
- }
- #pragma mark - UI Events
- - (IBAction)btnConfirmTouched:(id)sender {
- //validate
-
- ItemSubModel *subCondition = nil;
- if (_condition.subItems && _condition.subItems.count) {
- subCondition = _condition.subItems[0];
- } else {
- subCondition = [[ItemSubModel alloc] init];
-
- _condition.subItems = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] init];
- [_condition.subItems addObject:subCondition];
- }
-
- // subCondition.sourceId = @"VAR";
- subCondition.conditionTypeCode = @"09";
- subCondition.cmdclsValue = [NSString stringWithFormat:@"%@~%@", _btnFrom.dateString, _btnTo.dateString];;
- subCondition.cmdclsValueMsg = [NSString stringWithFormat:@"%@ ~ %@", _btnFrom.formatString, _btnTo.formatString];;
-
- [super btnConfirmTouched:sender];
- }
- @end
|