|
@@ -131,6 +131,31 @@
|
|
return _clearBt;
|
|
return _clearBt;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (void)selectNetAction {
|
|
|
|
+ for (KWProductListFilterModel *mainM in self.vm.sourceArr) {
|
|
|
|
+ if ([mainM.attribute_id isEqualToString:@"price"]) {
|
|
|
|
+ KWProductListFilterSubModel *subM = mainM.attribute_data.firstObject;
|
|
|
|
+ if (subM.inputMax.length > 0 && subM.inputMin.length > 0) {
|
|
|
|
+ NSMutableArray *tempSubs = self.vm.selectDic[mainM.attribute_id];
|
|
|
|
+ if (tempSubs == nil) {
|
|
|
|
+ tempSubs = [NSMutableArray array];
|
|
|
|
+ }
|
|
|
|
+ [tempSubs addObject:subM];
|
|
|
|
+ self.vm.selectDic[mainM.attribute_id] = tempSubs;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (subM.inputMax.length <= 0 && subM.inputMin.length <= 0) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ [self makeToast:@"Both Max and Min prices need to be set or removed simultaneously"];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (self.resultFilterDic) {
|
|
|
|
+ self.resultFilterDic(self.vm.selectDic);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
- (void)doneBtAction {
|
|
- (void)doneBtAction {
|
|
for (KWProductListFilterModel *mainM in self.vm.sourceArr) {
|
|
for (KWProductListFilterModel *mainM in self.vm.sourceArr) {
|
|
if ([mainM.attribute_id isEqualToString:@"price"]) {
|
|
if ([mainM.attribute_id isEqualToString:@"price"]) {
|
|
@@ -174,6 +199,13 @@
|
|
[self doneBtAction];
|
|
[self doneBtAction];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (void)reloadDatas:(NSMutableDictionary<NSString *,NSMutableArray<KWProductListFilterSubModel *> *> *)arr {
|
|
|
|
+ self.vm.selectDic = [NSMutableDictionary dictionaryWithDictionary:arr];
|
|
|
|
+ [self.collectV reloadData];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
- (void)showAnimate:(NSMutableDictionary<NSString *,NSMutableArray<KWProductListFilterSubModel *> *> *)arr {
|
|
- (void)showAnimate:(NSMutableDictionary<NSString *,NSMutableArray<KWProductListFilterSubModel *> *> *)arr {
|
|
self.hidden = false;
|
|
self.hidden = false;
|
|
self.vm.selectDic = [NSMutableDictionary dictionaryWithDictionary:arr];
|
|
self.vm.selectDic = [NSMutableDictionary dictionaryWithDictionary:arr];
|
|
@@ -294,7 +326,7 @@
|
|
[tempSubs removeObject:subM];
|
|
[tempSubs removeObject:subM];
|
|
}
|
|
}
|
|
[self.collectV reloadData];
|
|
[self.collectV reloadData];
|
|
- [self doneBtAction];
|
|
|
|
|
|
+ [self selectNetAction];
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
NSMutableArray *tempSubs = [NSMutableArray array];
|
|
NSMutableArray *tempSubs = [NSMutableArray array];
|
|
@@ -306,7 +338,7 @@
|
|
self.vm.selectDic[mainM.attribute_id] = tempSubs;
|
|
self.vm.selectDic[mainM.attribute_id] = tempSubs;
|
|
|
|
|
|
[self.collectV reloadData];
|
|
[self.collectV reloadData];
|
|
- [self doneBtAction];
|
|
|
|
|
|
+ [self selectNetAction];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|