//
//  PackagesTotalsTVController.m
//  as350b3e
//
//  Created by Vadim on 5/21/14.
//
//

#import "PackagesTotalsTVController.h"
#import "EquipmentPackages.h"
#import "PackageTotalCell.h"

@interface PackagesTotalsTVController ()

@end

@implementation PackagesTotalsTVController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return MIN(5, _packages.packages.count);
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    PackageTotalCell *cell = (PackageTotalCell*)[tableView dequeueReusableCellWithIdentifier:@"packageTotal" forIndexPath:indexPath];
    // Configure the cell...
    cell.package = _packages.packages[indexPath.row];
    
   
    
    return cell;
}


#pragma mark- API methods and overrides

- (void)setPackages:(EquipmentPackages *)packages {
    _packages = packages;
    [self.tableView reloadData];
}

@end
