diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c91f63 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +BaseLibrary +Verdnaturaventas/VerdnaturaventasTests +Verdnaturaventas/VerdnaturaventasuiTests \ No newline at end of file diff --git a/BaseLibrary/BaseLibrary.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist b/BaseLibrary/BaseLibrary.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist index 0efb056..576fb51 100644 --- a/BaseLibrary/BaseLibrary.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/BaseLibrary/BaseLibrary.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ BaseLibrary.xcscheme orderHint - 1 + 0 diff --git a/BaseLibrary/BaseLibrary/Model/ModelBase.swift b/BaseLibrary/BaseLibrary/Model/ModelBase.swift index 5cc6cf7..161c6ff 100644 --- a/BaseLibrary/BaseLibrary/Model/ModelBase.swift +++ b/BaseLibrary/BaseLibrary/Model/ModelBase.swift @@ -22,8 +22,8 @@ open class ModelBase: NSObject { } - - + + func generateDictionary() -> Dictionary{ var dictionary = Dictionary() @@ -50,37 +50,37 @@ open class ModelBase: NSObject { if(v != nil){ var val = toString(value!) switch(type){ - case "String": - setValue(val, forKey: property) - break + case "String": + setValue(val, forKey: property) + break - case "String, String": - val = val.replacingOccurrences(of: "{\n", with: "") - val = val.replacingOccurrences(of: "\n}", with: "") - val = val.replacingOccurrences(of: " ", with: "") - let array = val.components(separatedBy: ";\n") - var dictionary: Dictionary = Dictionary() + case "String, String": + val = val.replacingOccurrences(of: "{\n", with: "") + val = val.replacingOccurrences(of: "\n}", with: "") + val = val.replacingOccurrences(of: " ", with: "") + let array = val.components(separatedBy: ";\n") + var dictionary: Dictionary = Dictionary() + if property != "tags"{ for a in array{ let data = a.components(separatedBy: " = ") dictionary[data[0].replacingOccurrences(of: ";", with: "")] = data[1].replacingOccurrences(of: ";", with: "") } - - print(dictionary) - break + } + break - case "NSNumber": - let nVal = Double(val)! - if(nVal.truncatingRemainder(dividingBy: 1) == 0) - { - setValue(NSNumber(value: Int(nVal) as Int), forKey: property) - } - else{ - setValue(NSNumber(value: nVal as Double), forKey: property) - } - break + case "NSNumber": + let nVal = Double(val)! + if(nVal.truncatingRemainder(dividingBy: 1) == 0) + { + setValue(NSNumber(value: Int(nVal) as Int), forKey: property) + } + else{ + setValue(NSNumber(value: nVal as Double), forKey: property) + } + break - default: - break + default: + break } } } @@ -99,12 +99,12 @@ open class ModelBase: NSObject { func toBool(_ value: String) -> Bool? { switch (value){ - case "True", "true", "yes", "1": - return true - case "False", "false", "no", "0": - return false - default: - return nil + case "True", "true", "yes", "1": + return true + case "False", "false", "no", "0": + return false + default: + return nil } } } diff --git a/Verdnaturaventas/Verdnaturaventas.xcodeproj/project.pbxproj b/Verdnaturaventas/Verdnaturaventas.xcodeproj/project.pbxproj index bd88ede..f7f482b 100644 --- a/Verdnaturaventas/Verdnaturaventas.xcodeproj/project.pbxproj +++ b/Verdnaturaventas/Verdnaturaventas.xcodeproj/project.pbxproj @@ -225,6 +225,10 @@ A6F581561C6B50AE0003D27F /* CeldaPrecios.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6F581551C6B50AE0003D27F /* CeldaPrecios.swift */; }; A6F581581C6B6AF50003D27F /* DatosCompra.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6F581571C6B6AF50003D27F /* DatosCompra.swift */; }; A6F5815A1C6B76BA0003D27F /* CmdCrearOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6F581591C6B76BA0003D27F /* CmdCrearOrder.swift */; }; + EBF69B4A20CE82490015D1D8 /* Roboto-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EBF69B4920CE82440015D1D8 /* Roboto-Light.ttf */; }; + EBF69B4C20CE82530015D1D8 /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EBF69B4B20CE824F0015D1D8 /* Roboto-Bold.ttf */; }; + EBF69B4E20CE82620015D1D8 /* Roboto-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EBF69B4D20CE825D0015D1D8 /* Roboto-Regular.ttf */; }; + EBF69B5020CEA57A0015D1D8 /* CeldaTagDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBF69B4F20CEA57A0015D1D8 /* CeldaTagDetails.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -514,6 +518,10 @@ A6F581571C6B6AF50003D27F /* DatosCompra.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DatosCompra.swift; path = Model/DatosCompra.swift; sourceTree = ""; }; A6F581591C6B76BA0003D27F /* CmdCrearOrder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CmdCrearOrder.swift; path = Command/CmdCrearOrder.swift; sourceTree = ""; }; D88084E26A228A358E419BD7 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + EBF69B4920CE82440015D1D8 /* Roboto-Light.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Light.ttf"; sourceTree = ""; }; + EBF69B4B20CE824F0015D1D8 /* Roboto-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Bold.ttf"; sourceTree = ""; }; + EBF69B4D20CE825D0015D1D8 /* Roboto-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Regular.ttf"; sourceTree = ""; }; + EBF69B4F20CEA57A0015D1D8 /* CeldaTagDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CeldaTagDetails.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -859,6 +867,7 @@ A64EC3B11E8D36AE00B7166A /* CeldaTicketRecibido.swift */, A642113F1F2F562700DFBE10 /* CeldaArticuloTags.xib */, A630B94E1F30B1960029BF52 /* CeldaArticuloTags.swift */, + EBF69B4F20CEA57A0015D1D8 /* CeldaTagDetails.swift */, ); name = Celdas; sourceTree = ""; @@ -923,6 +932,7 @@ A6BABF821C33F8A00082BADE /* Verdnaturaventas */ = { isa = PBXGroup; children = ( + EBF69B4720CE82320015D1D8 /* fonts */, A677BF781C61F0F400100429 /* Pruebas.playground */, A6BABF8F1C33F8A00082BADE /* Info.plist */, A65F5E6F1C47BDF2004FEAE1 /* LaunchScreen.storyboard */, @@ -1021,6 +1031,16 @@ name = Pods; sourceTree = ""; }; + EBF69B4720CE82320015D1D8 /* fonts */ = { + isa = PBXGroup; + children = ( + EBF69B4D20CE825D0015D1D8 /* Roboto-Regular.ttf */, + EBF69B4920CE82440015D1D8 /* Roboto-Light.ttf */, + EBF69B4B20CE824F0015D1D8 /* Roboto-Bold.ttf */, + ); + name = fonts; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -1233,6 +1253,7 @@ A60340201C3FE07100BDF2ED /* Login.png in Resources */, A6AB5A2A1C4F9461004F068F /* flor.png in Resources */, A6366C7B1C90507000EF8470 /* OFL.txt in Resources */, + EBF69B4C20CE82530015D1D8 /* Roboto-Bold.ttf in Resources */, A6B0285E1C578F4700D679EF /* CeldaDobleString.xib in Resources */, A63D76B11C563D93009C2A16 /* disclouser.png in Resources */, A63FB0931C5B9D0300C42AF4 /* CeldaArticulo.xib in Resources */, @@ -1240,8 +1261,10 @@ A649B9C31C96E68400024538 /* Localizable.strings in Resources */, A69984241C686F3F002E8CCC /* CeldaCarrito.xib in Resources */, A64211401F2F562700DFBE10 /* CeldaArticuloTags.xib in Resources */, + EBF69B4A20CE82490015D1D8 /* Roboto-Light.ttf in Resources */, A6E3A4C51C7495F7009CE806 /* CeldaPrecioRecalculado.xib in Resources */, A676F1451C91802C00C0D751 /* buscar_fill25.png in Resources */, + EBF69B4E20CE82620015D1D8 /* Roboto-Regular.ttf in Resources */, A6366C7F1C90507000EF8470 /* Raleway-Heavy.ttf in Resources */, A676F12E1C917D1000C0D751 /* envios50.png in Resources */, A67B6DCA1C902D3000F03F3F /* inicio75.png in Resources */, @@ -1364,6 +1387,7 @@ A6957DF81C8457DB000A2219 /* ViewAccount.swift in Sources */, A66EDF201C8970B6008EF663 /* TicketRecepcionLinea.swift in Sources */, A6F581581C6B6AF50003D27F /* DatosCompra.swift in Sources */, + EBF69B5020CEA57A0015D1D8 /* CeldaTagDetails.swift in Sources */, A68095F41C7C67B800F3283C /* DialogValidarPedido.swift in Sources */, A69CEDCC1C3A82D700482F9B /* SecurityFacade.swift in Sources */, A69935EB1C51130400A94281 /* ViewListadoPedidosPendientes.swift in Sources */, diff --git a/Verdnaturaventas/Verdnaturaventas.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist b/Verdnaturaventas/Verdnaturaventas.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist index 14356c0..fde443d 100644 --- a/Verdnaturaventas/Verdnaturaventas.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Verdnaturaventas/Verdnaturaventas.xcodeproj/xcuserdata/enriqueblascoblanquer.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ Verdnaturaventas.xcscheme orderHint - 0 + 1 diff --git a/Verdnaturaventas/Verdnaturaventas.xcworkspace/xcuserdata/enriqueblascoblanquer.xcuserdatad/UserInterfaceState.xcuserstate b/Verdnaturaventas/Verdnaturaventas.xcworkspace/xcuserdata/enriqueblascoblanquer.xcuserdatad/UserInterfaceState.xcuserstate index f1e9ef6..02fb288 100644 Binary files a/Verdnaturaventas/Verdnaturaventas.xcworkspace/xcuserdata/enriqueblascoblanquer.xcuserdatad/UserInterfaceState.xcuserstate and b/Verdnaturaventas/Verdnaturaventas.xcworkspace/xcuserdata/enriqueblascoblanquer.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Address.imageset/Contents.json b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Address.imageset/Contents.json new file mode 100644 index 0000000..684a9eb --- /dev/null +++ b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Address.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "facebook-placeholder-for-locate-places-on-maps.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Address.imageset/facebook-placeholder-for-locate-places-on-maps.png b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Address.imageset/facebook-placeholder-for-locate-places-on-maps.png new file mode 100644 index 0000000..36b059d Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Address.imageset/facebook-placeholder-for-locate-places-on-maps.png differ diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Agency.imageset/Contents.json b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Agency.imageset/Contents.json new file mode 100644 index 0000000..7910b86 --- /dev/null +++ b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Agency.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "truck-icon (1).png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Agency.imageset/truck-icon (1).png b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Agency.imageset/truck-icon (1).png new file mode 100644 index 0000000..45deb5a Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Agency.imageset/truck-icon (1).png differ diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/AppIcon.appiconset/Contents.json b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/AppIcon.appiconset/Contents.json index b22f5b6..3581572 100644 --- a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -97,6 +97,11 @@ "idiom" : "ipad", "filename" : "Icon-83.5@2x.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Client.imageset/Contents.json b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Client.imageset/Contents.json new file mode 100644 index 0000000..e6f6b9a --- /dev/null +++ b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Client.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "user-silhouette (1).png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Client.imageset/user-silhouette (1).png b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Client.imageset/user-silhouette (1).png new file mode 100644 index 0000000..02d6dca Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Client.imageset/user-silhouette (1).png differ diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Date.imageset/Contents.json b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Date.imageset/Contents.json new file mode 100644 index 0000000..b444e70 --- /dev/null +++ b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Date.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "calendar (1).png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Date.imageset/calendar (1).png b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Date.imageset/calendar (1).png new file mode 100644 index 0000000..7c79567 Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Date.imageset/calendar (1).png differ diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Next.imageset/Contents.json b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Next.imageset/Contents.json new file mode 100644 index 0000000..7c58bf0 --- /dev/null +++ b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Next.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "next.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Next.imageset/next.png b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Next.imageset/next.png new file mode 100644 index 0000000..bee62aa Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Assets.xcassets/Next.imageset/next.png differ diff --git a/Verdnaturaventas/Verdnaturaventas/CeldaTagDetails.swift b/Verdnaturaventas/Verdnaturaventas/CeldaTagDetails.swift new file mode 100644 index 0000000..8bf69cf --- /dev/null +++ b/Verdnaturaventas/Verdnaturaventas/CeldaTagDetails.swift @@ -0,0 +1,27 @@ +// +// CeldaTagDetails.swift +// Verdnaturaventas +// +// Created by Enrique Blasco Blanquer on 11/6/18. +// Copyright © 2018 Nelo Sanchez Gomiz. All rights reserved. +// + +import UIKit + +class CeldaTagDetails: UITableViewCell { + + @IBOutlet weak var txtTitle: UILabel! + + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + // Configure the view for the selected state + } + +} diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticulo.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticulo.xib index a8de226..d6b5212 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticulo.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticulo.xib @@ -1,20 +1,20 @@ - + - + - - Raleway-Bold + + Roboto-Bold - - Raleway-Medium + + Roboto-Regular @@ -38,34 +38,34 @@ - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.swift b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.swift index 2bf342b..6cbfaf9 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.swift +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.swift @@ -15,7 +15,14 @@ class CeldaArticuloTags: UITableViewCell { @IBOutlet weak var lablDesde: UILabel! @IBOutlet weak var lablArticulo: UILabel! @IBOutlet weak var lablPrecio: UILabel! - // @IBOutlet weak var viewTags: ViewTags! + @IBOutlet weak var valCat1: UILabel! + @IBOutlet weak var valCat2: UILabel! + @IBOutlet weak var valCat3: UILabel! + @IBOutlet weak var valCat4: UILabel! + @IBOutlet weak var valCat5: UILabel! + @IBOutlet weak var valCat6: UILabel! + + // @IBOutlet weak var viewTags: ViewTags! func pintarCelda(_ articulo: ArticuloVentasTags) @@ -26,7 +33,12 @@ class CeldaArticuloTags: UITableViewCell { lablArticulo.text = articulo.Article if(ControllerPreferences.mostrarPrecios()) { - lablDesde.text = NSLocalizedString("desde", comment: "") + let valueRange = ("\(String(describing: articulo.available!)) \(NSLocalizedString("desde", comment: ""))" as NSString).range(of: "\(String(describing: articulo.available!))") + let attributedString = NSMutableAttributedString(string: "\(String(describing: articulo.available!)) \(NSLocalizedString("desde", comment: ""))", attributes: [NSFontAttributeName : UIFont.systemFont(ofSize: 15)]) + attributedString.setAttributes([NSFontAttributeName : UIFont.boldSystemFont(ofSize: 19)], range: valueRange) + + lablDesde.text = "\(String(describing: articulo.available!)) \(NSLocalizedString("desde", comment: ""))" + lablDesde.attributedText = attributedString lablPrecio.text = "\(UtilsNumbers.roundDouble(NSNumber(value: articulo.price!.doubleValue), decimals: 2))€" } else @@ -35,8 +47,55 @@ class CeldaArticuloTags: UITableViewCell { lablPrecio.text = " " } - //viewTags.setTags(tags: articulo.tags) + //print tags for article v1.0.5 + clearLabels() + printTags(articulo.tags) + + } + private func printTags(_ tags: Dictionary){ + var index = 1 + var valueRange:NSRange? + var attributedString:NSMutableAttributedString? + + for tag in tags{ + valueRange = ("\(tag.key): \(tag.value)" as NSString).range(of: tag.value) + attributedString = NSMutableAttributedString(string: "\(tag.key): \(tag.value)", attributes: [NSFontAttributeName : UIFont.systemFont(ofSize: 15)]) + attributedString?.setAttributes([NSForegroundColorAttributeName : UIColor.darkGray], range: valueRange!) + + switch index{ + case 1: valCat1.text = "\(tag.key): \(tag.value)" + valCat1.attributedText = attributedString + break + case 2:valCat2.text = "\(tag.key): \(tag.value)" + valCat2.attributedText = attributedString + break + case 3:valCat3.text = "\(tag.key): \(tag.value)" + valCat3.attributedText = attributedString + break + case 4:valCat4.text = "\(tag.key): \(tag.value)" + valCat4.attributedText = attributedString + break + case 5:valCat5.text = "\(tag.key): \(tag.value)" + valCat5.attributedText = attributedString + break + case 6:valCat6.text = "\(tag.key): \(tag.value)" + valCat6.attributedText = attributedString + break + default: + break + } + index += 1 + } + } + + private func clearLabels(){ + valCat1.text = "" + valCat2.text = "" + valCat3.text = "" + valCat4.text = "" + valCat5.text = "" + valCat6.text = "" } } diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.xib index e6cd049..92737e2 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaArticuloTags.xib @@ -1,98 +1,163 @@ - + - - - Raleway-Bold + + Roboto-Bold - - Raleway-Medium + + Roboto-Regular - - + + - + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.swift b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.swift index 1874858..c2b606f 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.swift +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.swift @@ -11,6 +11,7 @@ import UIKit class CeldaBoton: UICollectionViewCell { @IBOutlet weak var boton: UIImageView! + @IBOutlet weak var title: UILabel! func pintarCelda(_ b: String) { diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.xib index 21bb727..a509575 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaBoton.xib @@ -1,9 +1,18 @@ - - + + + + + - + + + + + Roboto-Regular + + @@ -20,18 +29,30 @@ + - + + + + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaCarrito.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaCarrito.xib index bb54a04..b281db8 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaCarrito.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaCarrito.xib @@ -1,17 +1,19 @@ - - + + + + + - + + - - Raleway - Raleway - Raleway - + + Roboto-Regular + @@ -20,34 +22,34 @@ - + - + @@ -68,7 +70,7 @@ - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaDobleString.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaDobleString.xib index 5298afe..ded2bfb 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaDobleString.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaDobleString.xib @@ -1,17 +1,17 @@ - + - + - - Raleway + + Roboto-Regular @@ -21,20 +21,20 @@ - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaImageTitle.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaImageTitle.xib index a9ae0fb..7285551 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaImageTitle.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaImageTitle.xib @@ -1,18 +1,18 @@ - + - + - - Raleway + + Roboto-Regular @@ -22,18 +22,18 @@ - + - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaLineasRecibidas.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaLineasRecibidas.xib index cb45b3d..e15a9e7 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaLineasRecibidas.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaLineasRecibidas.xib @@ -1,18 +1,18 @@ - + - + - - Raleway + + Roboto-Regular @@ -22,18 +22,18 @@ - + - + @@ -41,7 +41,7 @@ diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecioRecalculado.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecioRecalculado.xib index 09f694a..21a98d5 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecioRecalculado.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecioRecalculado.xib @@ -1,15 +1,18 @@ - - + + + + + - + + - - Raleway - Raleway - + + Roboto-Regular + @@ -18,22 +21,22 @@ - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecios.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecios.xib index f9e7099..ea3fafc 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecios.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaPrecios.xib @@ -1,20 +1,20 @@ - + - + - - Raleway + + Roboto-Bold - - Raleway-SemiBold + + Roboto-Regular @@ -24,36 +24,36 @@ - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaString.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaString.xib index a8c5343..1713098 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaString.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaString.xib @@ -1,14 +1,18 @@ - - + + + + + - + + - - Raleway - + + Roboto-Regular + @@ -17,13 +21,13 @@ - + @@ -34,7 +38,7 @@ - + diff --git a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaTicketRecibido.xib b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaTicketRecibido.xib index 2b24e6e..96d9c2a 100644 --- a/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaTicketRecibido.xib +++ b/Verdnaturaventas/Verdnaturaventas/Celdas/CeldaTicketRecibido.xib @@ -1,17 +1,17 @@ - + - + - - Raleway + + Roboto-Regular @@ -21,37 +21,37 @@ - + diff --git a/Verdnaturaventas/Verdnaturaventas/Dialog/DialogPrecios.swift b/Verdnaturaventas/Verdnaturaventas/Dialog/DialogPrecios.swift index 447cae8..b20eb95 100644 --- a/Verdnaturaventas/Verdnaturaventas/Dialog/DialogPrecios.swift +++ b/Verdnaturaventas/Verdnaturaventas/Dialog/DialogPrecios.swift @@ -13,6 +13,7 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tablaPrecios: UITableView! @IBOutlet weak var progressBar: UIActivityIndicatorView! + @IBOutlet weak var btnBack: UIButton! var ejecutando = false var articulo: ArticuloVentasTags? @@ -28,8 +29,12 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { tablaPrecios.rowHeight = 71 tablaPrecios.backgroundColor = UIColor.groupTableViewBackground tablaPrecios.tableFooterView = UIView() + btnBack.setTitle(NSLocalizedString("cancelar", comment: ""), for: UIControlState()) + } + + @IBAction func cancel(_ sender: Any) { + self.navigationController?.popViewController(animated: true) } - @IBAction func clickTrash(_ sender: AnyObject) { if(!ejecutando) @@ -40,7 +45,7 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { tablaPrecios.reloadData() } } - + } @@ -102,27 +107,27 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { let alert = AlertStock(v: self) alert.showDialog() } - + } } func mostrarValores(_ dato: DatosCompra) { var cantidad = 0 - + for d in datosSalvados { if(dato.tarifa == d.tarifa) { dato.Especificaciones = String(format: NSLocalizedString("dialog_comprar_bought", comment: ""), arguments: [d.Cantidad!.intValue]) } cantidad += (d.Cantidad?.intValue)! } - + } func addDatoCompra(_ dato: DatosCompra) { var existe = false - + for d in datosSalvados { if dato.tarifa == d.tarifa { let cantidad = (dato.Cantidad?.intValue)! + (d.Cantidad?.intValue)! @@ -131,13 +136,13 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { break } } - + if(!existe) { let da = ControllerPedido.generateDato(dato, t: nil, a: nil) datosSalvados.append(da) } - + } func getCantidadTotal() -> Int @@ -146,7 +151,7 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { for d in datosSalvados { cantidad += (d.Cantidad?.intValue)! } - + return cantidad } @@ -156,7 +161,7 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { singleTap.numberOfTapsRequired = 1 image.isUserInteractionEnabled = true image.addGestureRecognizer(singleTap) - + } func AgregarLinea() @@ -171,22 +176,22 @@ class DialogPrecios: MyViewVentas, UITableViewDelegate, UITableViewDataSource { handlerFinish: { self.aplication.pedido = cmd.order _ = self.navigationController?.popViewController(animated: true) - }, + }, handlerRetry: { for d in self.datosSalvados { ControllerPedido.borrarCompra(d) self.AgregarLinea() } - - }, + + }, handlerAccept: { for d in self.datosSalvados { ControllerPedido.borrarCompra(d) } self.prepareOrder(false) - } + } ) execute(cmd); } diff --git a/Verdnaturaventas/Verdnaturaventas/Facade/Commands.swift b/Verdnaturaventas/Verdnaturaventas/Facade/Commands.swift index a1dae8d..03ff29b 100644 --- a/Verdnaturaventas/Verdnaturaventas/Facade/Commands.swift +++ b/Verdnaturaventas/Verdnaturaventas/Facade/Commands.swift @@ -26,7 +26,7 @@ class Commands: NSObject { static let obtener_stock_tags = "obtener_stock_tags" - static let obtener_articulo_ventas = "obtener_articulo_ventas" + static let obtener_articulo_ventas = "obtener_articulo_ventas_tags" static let recalcular_precios = "recalcular_precios" diff --git a/Verdnaturaventas/Verdnaturaventas/Facade/FacadeVentasClient.swift b/Verdnaturaventas/Verdnaturaventas/Facade/FacadeVentasClient.swift index 0f21d8b..c2bd377 100644 --- a/Verdnaturaventas/Verdnaturaventas/Facade/FacadeVentasClient.swift +++ b/Verdnaturaventas/Verdnaturaventas/Facade/FacadeVentasClient.swift @@ -24,7 +24,7 @@ class FacadeVentasClient: FacadeClient, URLSessionDelegate { let url = HOST+facade+"/"+command let req = NSMutableURLRequest(url: URL(string: url)!) - print(ControllerPreferences.recuperarUsuario()) + req.httpMethod = POST req.timeoutInterval = 10 req.setValue(String(argsMessage!.characters.count), forHTTPHeaderField: "Content-Length") diff --git a/Verdnaturaventas/Verdnaturaventas/Info.plist b/Verdnaturaventas/Verdnaturaventas/Info.plist index 0d7c8aa..ae90772 100644 --- a/Verdnaturaventas/Verdnaturaventas/Info.plist +++ b/Verdnaturaventas/Verdnaturaventas/Info.plist @@ -24,11 +24,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.4 + 1.1.0 CFBundleSignature ???? CFBundleVersion - 6 + 7 LSApplicationCategoryType LSRequiresIPhoneOS @@ -41,6 +41,9 @@ UIAppFonts Raleway + Roboto-Regular.ttf + Roboto-Light.ttf + Roboto-Bold.ttf UILaunchStoryboardName LaunchScreen @@ -61,6 +64,8 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + CFBundleGetInfoString + UIViewControllerBasedStatusBarAppearance diff --git a/Verdnaturaventas/Verdnaturaventas/Main.storyboard b/Verdnaturaventas/Verdnaturaventas/Main.storyboard index c8d5aea..696dcf0 100644 --- a/Verdnaturaventas/Verdnaturaventas/Main.storyboard +++ b/Verdnaturaventas/Verdnaturaventas/Main.storyboard @@ -1,23 +1,30 @@ - + - - + + Raleway-Bold + Raleway Raleway-SemiBold + + Roboto-Bold + + + Roboto-Regular + @@ -29,27 +36,39 @@ - + - + + + + + + + + + + - + - + + + + - - + + - + - + @@ -57,31 +76,14 @@ - - - + + - + - + @@ -92,47 +94,56 @@ - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - + - + + + - - - + - - - + + + + + @@ -158,14 +169,14 @@ - + - + - + @@ -206,7 +217,7 @@ - + @@ -217,38 +228,64 @@ - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -259,135 +296,83 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - + - + - - - - - - + + + + + + + + + + + + + - - - - - - - - - + @@ -477,25 +440,48 @@ - + - - - - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + @@ -506,29 +492,47 @@ - + - + - + + - - - + + + - + + + + @@ -544,13 +548,14 @@ + - + @@ -561,14 +566,14 @@ - + - + - + @@ -600,7 +605,7 @@ - + @@ -611,11 +616,11 @@ - + - + @@ -624,7 +629,7 @@ - + @@ -639,7 +644,7 @@ - + @@ -650,11 +655,11 @@ - + - + @@ -689,7 +694,7 @@ - + @@ -700,14 +705,14 @@ - + - + - + @@ -735,7 +740,7 @@ - + @@ -746,164 +751,219 @@ - + - + - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - + @@ -921,29 +981,34 @@ - + - + - + + + + + + + + - - - - - - - + + + + + @@ -969,14 +1034,14 @@ - + - + - + @@ -1003,7 +1068,7 @@ - + @@ -1014,23 +1079,23 @@ - + - + - + - + - + - + @@ -1199,11 +1264,11 @@ - + - + @@ -1232,7 +1297,7 @@ - + @@ -1243,14 +1308,14 @@ - + - + - + @@ -1288,14 +1353,14 @@ - + - + - + @@ -1329,7 +1394,7 @@ - + @@ -1337,14 +1402,14 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -1947,7 +2013,7 @@ - + @@ -1966,7 +2032,7 @@ - + @@ -1979,7 +2045,7 @@ - + @@ -1989,7 +2055,7 @@ - + @@ -2008,7 +2074,7 @@ - + @@ -2025,7 +2091,7 @@ - + @@ -2033,14 +2099,14 @@ - + - + - + - + - + @@ -2190,17 +2256,17 @@ - + - + - + @@ -2209,7 +2275,7 @@ @@ -2352,21 +2418,21 @@ - + - + - + - + @@ -2380,16 +2446,16 @@ - + - + @@ -2409,7 +2475,7 @@ - + @@ -2471,7 +2537,7 @@ - + @@ -2506,9 +2572,12 @@ - + + + + + - - + diff --git a/Verdnaturaventas/Verdnaturaventas/Parser/ParserArticulo.swift b/Verdnaturaventas/Verdnaturaventas/Parser/ParserArticulo.swift index 77e31e7..e4d5d93 100644 --- a/Verdnaturaventas/Verdnaturaventas/Parser/ParserArticulo.swift +++ b/Verdnaturaventas/Verdnaturaventas/Parser/ParserArticulo.swift @@ -40,7 +40,13 @@ class ParserArticulo: Parser { articulo.parseJson(jsonDictionary) articulo.tarifas = ParserTarifa().parse(jsonDictionary["tarifas"] as! NSArray) - //articulo.tags = jsonDictionary["tags"] as! Dictionary + + + + if jsonDictionary["tags"] != nil && jsonDictionary["tags"] is Dictionary{ + articulo.tags = jsonDictionary["tags"] as! Dictionary + } + return articulo diff --git a/Verdnaturaventas/Verdnaturaventas/Roboto-Bold.ttf b/Verdnaturaventas/Verdnaturaventas/Roboto-Bold.ttf new file mode 100755 index 0000000..91ec212 Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Roboto-Bold.ttf differ diff --git a/Verdnaturaventas/Verdnaturaventas/Roboto-Light.ttf b/Verdnaturaventas/Verdnaturaventas/Roboto-Light.ttf new file mode 100755 index 0000000..d43e943 Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Roboto-Light.ttf differ diff --git a/Verdnaturaventas/Verdnaturaventas/Roboto-Regular.ttf b/Verdnaturaventas/Verdnaturaventas/Roboto-Regular.ttf new file mode 100755 index 0000000..7d9a6c4 Binary files /dev/null and b/Verdnaturaventas/Verdnaturaventas/Roboto-Regular.ttf differ diff --git a/Verdnaturaventas/Verdnaturaventas/Strings/ca.lproj/Localizable.strings b/Verdnaturaventas/Verdnaturaventas/Strings/ca.lproj/Localizable.strings index 7cf13f6..8412121 100644 Binary files a/Verdnaturaventas/Verdnaturaventas/Strings/ca.lproj/Localizable.strings and b/Verdnaturaventas/Verdnaturaventas/Strings/ca.lproj/Localizable.strings differ diff --git a/Verdnaturaventas/Verdnaturaventas/Strings/en.lproj/Localizable.strings b/Verdnaturaventas/Verdnaturaventas/Strings/en.lproj/Localizable.strings index c48697a..deca9a3 100644 Binary files a/Verdnaturaventas/Verdnaturaventas/Strings/en.lproj/Localizable.strings and b/Verdnaturaventas/Verdnaturaventas/Strings/en.lproj/Localizable.strings differ diff --git a/Verdnaturaventas/Verdnaturaventas/Strings/es.lproj/Localizable.strings b/Verdnaturaventas/Verdnaturaventas/Strings/es.lproj/Localizable.strings index d5e8190..86268b7 100644 Binary files a/Verdnaturaventas/Verdnaturaventas/Strings/es.lproj/Localizable.strings and b/Verdnaturaventas/Verdnaturaventas/Strings/es.lproj/Localizable.strings differ diff --git a/Verdnaturaventas/Verdnaturaventas/Strings/pt.lproj/Localizable.strings b/Verdnaturaventas/Verdnaturaventas/Strings/pt.lproj/Localizable.strings index 0db3898..70785aa 100644 Binary files a/Verdnaturaventas/Verdnaturaventas/Strings/pt.lproj/Localizable.strings and b/Verdnaturaventas/Verdnaturaventas/Strings/pt.lproj/Localizable.strings differ diff --git a/Verdnaturaventas/Verdnaturaventas/Views/ViewArticulos.swift b/Verdnaturaventas/Verdnaturaventas/Views/ViewArticulos.swift index b0f2e73..59c353a 100644 --- a/Verdnaturaventas/Verdnaturaventas/Views/ViewArticulos.swift +++ b/Verdnaturaventas/Verdnaturaventas/Views/ViewArticulos.swift @@ -14,6 +14,7 @@ class ViewArticulos: MyViewVentas, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var progressBar: UIActivityIndicatorView! @IBOutlet weak var tableArticulos: UITableView! + @IBOutlet weak var txtResultados: UILabel! var tipo = 0 var cadena = "" @@ -27,7 +28,7 @@ class ViewArticulos: MyViewVentas, UITableViewDelegate, UITableViewDataSource { progress = progressBar self.title = tipoNombre tableArticulos.backgroundColor = UIColor.groupTableViewBackground - tableArticulos.rowHeight = 196 + } override func viewWillAppear(_ animated: Bool) { @@ -49,6 +50,7 @@ class ViewArticulos: MyViewVentas, UITableViewDelegate, UITableViewDataSource { self.articulos = cmd.articulos! self.inicializado = true self.tableArticulos.reloadData() + self.txtResultados.text = "\(self.articulos.count) \(NSLocalizedString("resultados", comment: ""))" self.showProgress(false) }, handlerRetry: { @@ -58,10 +60,12 @@ class ViewArticulos: MyViewVentas, UITableViewDelegate, UITableViewDataSource { handlerAccept: { self.inicializado = true self.tableArticulos.reloadData() + self.txtResultados.text = "\(self.articulos.count) \(NSLocalizedString("resultados", comment: ""))" self.showProgress(false) } ) execute(cmd) + } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { @@ -94,6 +98,10 @@ class ViewArticulos: MyViewVentas, UITableViewDelegate, UITableViewDataSource { launchSegue("segueDetalleArticulo", sender: indexPath.row as AnyObject?) } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + + return CGFloat(68 + (articulos[indexPath.row].tags.count * 21)) + } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if(segue.identifier == "segueDetalleArticulo") diff --git a/Verdnaturaventas/Verdnaturaventas/Views/ViewCarrito.swift b/Verdnaturaventas/Verdnaturaventas/Views/ViewCarrito.swift index 67fd582..2beb984 100644 --- a/Verdnaturaventas/Verdnaturaventas/Views/ViewCarrito.swift +++ b/Verdnaturaventas/Verdnaturaventas/Views/ViewCarrito.swift @@ -120,4 +120,8 @@ class ViewCarrito: MyViewVentas, UITableViewDelegate, UITableViewDataSource { } + @IBAction func clickPendingOrder(sender: AnyObject) { + launchSegue("seguePedidosPendientes") + } + } diff --git a/Verdnaturaventas/Verdnaturaventas/Views/ViewDetalleArticulo.swift b/Verdnaturaventas/Verdnaturaventas/Views/ViewDetalleArticulo.swift index b95a09b..eb99590 100644 --- a/Verdnaturaventas/Verdnaturaventas/Views/ViewDetalleArticulo.swift +++ b/Verdnaturaventas/Verdnaturaventas/Views/ViewDetalleArticulo.swift @@ -9,37 +9,31 @@ import UIKit import BaseLibrary -class ViewDetalleArticulo: MyViewVentas { +class ViewDetalleArticulo: MyViewVentas, UITableViewDelegate, UITableViewDataSource { + + + + @IBOutlet weak var imageArticulo: UIImageViewAsyncVentas! @IBOutlet weak var progressBar: UIActivityIndicatorView! - - @IBOutlet weak var labelNombre: UILabel! - @IBOutlet weak var labelProductor: UILabel! - @IBOutlet weak var labelColor: UILabel! - @IBOutlet weak var labelMedida: UILabel! - @IBOutlet weak var labelDisponible: UILabel! - @IBOutlet weak var valueColor: UILabel! - @IBOutlet weak var valueMedida: UILabel! - @IBOutlet weak var valueDisponibler: UILabel! @IBOutlet weak var labelDesde: UILabel! @IBOutlet weak var valuePrice: UILabel! @IBOutlet weak var buttonComprar: UIButton! - @IBOutlet weak var scrollView: UIScrollView! + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var heightConstTable: NSLayoutConstraint! + var articulo: ArticuloVentasTags? - //var titlesDatos = [] - //var dataDatos = [] + override func createView() { - scrollView.isScrollEnabled = true + self.tableView.delegate = self + self.tableView.dataSource = self + heightConstTable.constant = CGFloat((self.articulo?.tags.count)! * 33) imageArticulo.clipsToBounds = true progress = progressBar - contenedor = scrollView - valueColor.textColor = UtilsIos.getColor(Colors.colors[(articulo?.Reino?.intValue)!]!) - valueMedida.textColor = UtilsIos.getColor(Colors.colors[(articulo?.Reino?.intValue)!]!) - valueDisponibler.textColor = UtilsIos.getColor(Colors.colors[(articulo?.Reino?.intValue)!]!) buttonComprar.backgroundColor = UtilsIos.getColor(Colors.colors[(articulo?.Reino?.intValue)!]!) buttonComprar.setTitle(NSLocalizedString("fragment_articulo_comprar", comment: ""), for: UIControlState()) self.navigationController?.navigationBar.barTintColor = UtilsIos.getColor(Colors.colors[(articulo?.Reino!.intValue)!]!, alpha: 0.0) @@ -67,18 +61,21 @@ class ViewDetalleArticulo: MyViewVentas { cmd.callbacks = CommandCallbacks( handlerStart: {}, handlerFinish: { + //cmd.articulo?.tags = (self.articulo?.tags)! self.articulo = cmd.articulo self.setValues() self.showProgress(false) self.inicializado = true - }, + self.tableView.reloadData() + self.heightConstTable.constant = CGFloat((self.articulo?.tags.count)! * 33) + }, handlerRetry: { self.showProgress(false) self.getArticulo() - }, + }, handlerAccept: { _ = self.navigationController?.popToRootViewController(animated: true) - } + } ) @@ -96,18 +93,19 @@ class ViewDetalleArticulo: MyViewVentas { } } - + func setValues() { imageArticulo.downloadImage(String(format: "%@%@", Values.BASE_URL_LARGE, self.articulo!.foto!)) - labelNombre.text = articulo?.Article - labelColor.text = NSLocalizedString("color", comment: "").uppercased() - labelDisponible.text = NSLocalizedString("disp", comment: "").uppercased() - labelMedida.text = NSLocalizedString("medida", comment: "").uppercased() - valueDisponibler.text = "\(articulo!.available!)" + if(ControllerPreferences.mostrarPrecios()) { - labelDesde.text = NSLocalizedString("desde", comment: "") + let valueRange = ("\(self.articulo!.available!) \(NSLocalizedString("desde", comment: ""))" as NSString).range(of: "\(String(describing: self.articulo!.available!))") + let attributedString = NSMutableAttributedString(string: "\(self.articulo!.available!) \(NSLocalizedString("desde", comment: ""))", attributes: [NSFontAttributeName : UIFont.systemFont(ofSize: 15)]) + attributedString.setAttributes([NSFontAttributeName : UIFont.boldSystemFont(ofSize: 25)], range: valueRange) + + labelDesde.text = "\(self.articulo!.available!) \(NSLocalizedString("desde", comment: ""))" + labelDesde.attributedText = attributedString valuePrice.text = "\(ControllerArticulo.getMinPrice(articulo!))€" } else @@ -117,6 +115,32 @@ class ViewDetalleArticulo: MyViewVentas { } } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return (self.articulo?.tags.count)! + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + + let cell = self.tableView.dequeueReusableCell(withIdentifier: "catcell", for: indexPath) as! CeldaTagDetails + + let valueRange = ("\(Array(self.articulo!.tags.keys)[indexPath.row]) \(Array(self.articulo!.tags.values)[indexPath.row])" as NSString).range(of: Array(self.articulo!.tags.values)[indexPath.row]) + let attributedString = NSMutableAttributedString(string: "\(Array(self.articulo!.tags.keys)[indexPath.row]) \(Array(self.articulo!.tags.values)[indexPath.row])", attributes: [NSFontAttributeName : UIFont.systemFont(ofSize: 17)]) + attributedString.setAttributes([NSForegroundColorAttributeName : UIColor.darkGray], range: valueRange) + + cell.txtTitle.text = "\(Array(self.articulo!.tags.keys)[indexPath.row]) \(Array(self.articulo!.tags.values)[indexPath.row])" + cell.txtTitle.attributedText = attributedString + + + return cell + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 33.0 + } + + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if(segue.identifier == "seguePrecios") { diff --git a/Verdnaturaventas/Verdnaturaventas/Views/ViewImage.swift b/Verdnaturaventas/Verdnaturaventas/Views/ViewImage.swift index 020dfcc..a252af5 100644 --- a/Verdnaturaventas/Verdnaturaventas/Views/ViewImage.swift +++ b/Verdnaturaventas/Verdnaturaventas/Views/ViewImage.swift @@ -9,9 +9,10 @@ import Foundation import BaseLibrary -class ViewImage: MyViewVentas{ +class ViewImage: MyViewVentas, UIScrollViewDelegate { + @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var imageFoto: UIImageViewAsyncVentas! var foto = "" @@ -20,9 +21,14 @@ class ViewImage: MyViewVentas{ super.viewWillAppear(animated) let url = String(format: "%@%@", Values.BASE_URL_FULL, foto) imageFoto.downloadImage(url) + scrollView.minimumZoomScale = 1.0 + scrollView.maximumZoomScale = 6.0 rewriteBackButton() } - + + func viewForZooming(in scrollView: UIScrollView) -> UIView? { + return imageFoto + } override func goBack() { self.navigationController?.popViewController(animated: true) } diff --git a/Verdnaturaventas/Verdnaturaventas/Views/ViewMain.swift b/Verdnaturaventas/Verdnaturaventas/Views/ViewMain.swift index 767429b..3c64d2f 100644 --- a/Verdnaturaventas/Verdnaturaventas/Views/ViewMain.swift +++ b/Verdnaturaventas/Verdnaturaventas/Views/ViewMain.swift @@ -17,20 +17,18 @@ class ViewMain: MyViewVentas, UICollectionViewDelegate, UICollectionViewDataSour @IBOutlet weak var lablStreet: UILabel! @IBOutlet weak var lablDate: UILabel! @IBOutlet weak var lablAgency: UILabel! - + @IBOutlet weak var btnPendientes: UIBarButtonItem! @IBOutlet weak var titleClient: UILabel! - @IBOutlet weak var titleStreet: UILabel! + @IBOutlet weak var titleConsignatorio: UILabel! @IBOutlet weak var titleDate: UILabel! @IBOutlet weak var titleAgency: UILabel! - @IBOutlet weak var titlePending: UILabel! - let titles = [NSLocalizedString("main_flowers", comment: ""), - NSLocalizedString("main_greens", comment: ""), - NSLocalizedString("main_plants", comment: ""), - NSLocalizedString("main_artificial", comment: ""), - NSLocalizedString("main_supplements", comment: ""), - NSLocalizedString("main_manufacturing", comment: "")] + NSLocalizedString("main_greens", comment: ""), + NSLocalizedString("main_plants", comment: ""), + NSLocalizedString("main_artificial", comment: ""), + NSLocalizedString("main_supplements", comment: ""), + NSLocalizedString("main_manufacturing", comment: "")] let images = ["flor.png", "verde.png", "planta.png", "artificial.png", "complemento.png", "confeccion.png"] @@ -42,6 +40,11 @@ class ViewMain: MyViewVentas, UICollectionViewDelegate, UICollectionViewDataSour self.tabBarController?.tabBar.tintColor = UtilsIos.getColor(0x3e3e3f) self.tabBarController?.tabBar.clipsToBounds = true self.navigationController!.viewControllers = [self] + self.btnPendientes.title = NSLocalizedString("fragment_pedidos_pendientes", comment: "") + self.titleClient.text = NSLocalizedString("fragment_configurar_pedido_cliente", comment: "").uppercased() + self.titleConsignatorio.text = NSLocalizedString("main_delivery_address", comment: "").uppercased() + self.titleDate.text = NSLocalizedString("main_arraival", comment: "").uppercased() + self.titleAgency.text = NSLocalizedString("main_agency", comment: "").uppercased() } override func viewWillAppear(_ animated: Bool) { @@ -63,16 +66,14 @@ class ViewMain: MyViewVentas, UICollectionViewDelegate, UICollectionViewDataSour } self.lablClient.text = aplication.pedido!.cliente!.Cliente self.lablStreet.text = aplication.pedido!.consignatarioActivo!.Domicilio + if (aplication.pedido?.agencia != nil){ + self.lablAgency.textColor = UIColor.darkGray + } } override func setTitles() { - titleClient.text = NSLocalizedString("fragment_configurar_pedido_cliente", comment: "").uppercased() - titleStreet.text = NSLocalizedString("main_delivery_address", comment: "").uppercased() - titleDate.text = NSLocalizedString("main_arraival", comment: "").uppercased() - titleAgency.text = NSLocalizedString("main_agency", comment: "").uppercased() - titlePending.text = NSLocalizedString("fragment_pedidos_pendientes", comment: "").uppercased() self.title = NSLocalizedString("order", comment: "") } @@ -88,6 +89,7 @@ class ViewMain: MyViewVentas, UICollectionViewDelegate, UICollectionViewDataSour internal func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CeldaBoton", for: indexPath as IndexPath) as! CeldaBoton cell.pintarCelda(images[indexPath.row]) + cell.title.text = titles[indexPath.row] return cell } @@ -100,10 +102,10 @@ class ViewMain: MyViewVentas, UICollectionViewDelegate, UICollectionViewDataSour else{ let alert = AlertAgency(v: self) alert.showDialog() - + lablAgency.textColor = UIColor.red } } - + } @@ -115,8 +117,12 @@ class ViewMain: MyViewVentas, UICollectionViewDelegate, UICollectionViewDataSour return CGSize(width: collectionViewWidth, height: collectionViewWidth) } - - + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsetsMake(0, 0, 0, 0) + } + + @IBAction func clickOrder(sender: UITapGestureRecognizer) { if((aplication.pedido?.rows?.count)! > 0){ @@ -129,17 +135,21 @@ class ViewMain: MyViewVentas, UICollectionViewDelegate, UICollectionViewDataSour } - @IBAction func clickPendingOrder(sender: AnyObject) { + @IBAction func clickPending(_ sender: Any) { launchSegue("seguePedidosPendientes") } + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if (segue.identifier! == "segueFamilias") { let viewFamilias = segue.destination as! ViewFamilias let parametros = sender as! ParametrosReino viewFamilias.parametros = parametros + }else if (segue.identifier! == "goclientes"){ + let view = segue.destination as! ViewSearch + view.tipo = view.TIPO_CLIENTES } } - + }