diff --git a/harta-banilor-publici/ApiHelper.swift b/harta-banilor-publici/ApiHelper.swift index d657cde..7150b09 100644 --- a/harta-banilor-publici/ApiHelper.swift +++ b/harta-banilor-publici/ApiHelper.swift @@ -42,15 +42,40 @@ struct InstitutionLicitatie: Codable { } } +struct SearchResultLicitatie: Codable { + let id: Int + let titluContract: String + let valoareRON: String + let dataContract: String + + private enum CodingKeys: String, CodingKey { + case id = "LicitatieId", dataContract = "DataContract" + case titluContract = "TitluContract", valoareRON = "ValoareRON" + } +} + +struct SearchResultContract: Codable { + let id: Int + let titluContract: String + let valoareRON: String + let dataContract: String + + private enum CodingKeys: String, CodingKey { + case id = "ContracteId", dataContract = "DataContract" + case titluContract = "TitluContract", valoareRON = "ValoareRON" + } +} + + struct Contract: Codable { - let id, institutiePublicaID, companieId: Int + let id, institutiePublicaID, companieId, numarJustificari: Int let companieCUI, tipProcedura, institutiePublicaCUI, numarAnuntParticipare: String let dataAnuntParticipare, tipIncheiereContract, numarContract, dataContract: String let titluContract, cpvCode: String let valoareRON, valoareEUR: String private enum CodingKeys: String, CodingKey { - case id = "ContracteId", institutiePublicaID = "InstitutiePublicaID", companieId = "CompanieId" + case id = "ContracteId", institutiePublicaID = "InstitutiePublicaID", companieId = "CompanieId", numarJustificari = "NumarJustificari" case companieCUI = "CompanieCUI", tipProcedura = "TipProcedura", institutiePublicaCUI = "InstitutiePublicaCUI" case numarAnuntParticipare = "NumarAnuntParticipare", dataAnuntParticipare = "DataAnuntParticipare" case tipIncheiereContract = "TipIncheiereContract", numarContract = "NumarContract", dataContract = "DataContract" @@ -59,22 +84,23 @@ struct Contract: Codable { } struct Licitatie: Codable { - let id, institutiePublicaID: Int + let id, institutiePublicaID, companieId, numarOfertePrimite, cpvCodeID, numarJustificari: Int let companieCUI, tip, tipContract, tipProcedura, institutiePublicaCUI, tipActivitateAC, numarAnuntAtribuire: String - let dataAnuntAtribuire, tipIncheiereContract, tipCriteriiAtribuire, CUILicitatieElectronica, numarOfertePrimite: String - let subcontractat, numarContract, dataContract: String - let titluContract, cpvCodeID, cpvCode, numarAnuntParticipare, dataAnuntParticipare: String + let dataAnuntAtribuire, tipIncheiereContract, tipCriteriiAtribuire: String + let numarContract, dataContract: String + let titluContract, cpvCode, numarAnuntParticipare, dataAnuntParticipare: String let valoareEstimataParticipare, monedaValoareEstimataParticipare, depoziteGarantii, modalitatiFinantare: String let valoareRON, valoareEUR: String + let CUILicitatieElectronica, subcontractat: Bool private enum CodingKeys: String, CodingKey { - case id = "LicitatiiId", institutiePublicaID = "InstitutiePublicaID" - case companieCUI = "CompanieCUI", tip = "Tip", tipContract = "TipContract", tipProcedura = "TipProcedura" + case id = "LicitatiiId", institutiePublicaID = "InstitutiePublicaID", companieId = "CompanieId", numarOfertePrimite = "NumarOfertePrimite" + case companieCUI = "CompanieCUI", tip = "Tip", tipContract = "TipContract", tipProcedura = "TipProcedura", numarJustificari = "NumarJustificari" case institutiePublicaCUI = "InstitutiePublicaCUI", tipActivitateAC = "TipActivitateAC", numarAnuntAtribuire = "NumarAnuntAtribuire" case dataAnuntAtribuire = "DataAnuntAtribuire", tipIncheiereContract = "TipIncheiereContract", tipCriteriiAtribuire = "TipCriteriiAtribuire" - case CUILicitatieElectronica = "CUILicitatieElectronica", numarOfertePrimite = "NumarOfertePrimite", subcontractat = "Subcontractat" + case CUILicitatieElectronica = "CUILicitatieElectronica", subcontractat = "Subcontractat" case numarContract = "NumarContract", dataContract = "DataContract", titluContract = "TitluContract", valoareRON = "ValoareRON" - case valoareEUR = "ValoareEUR", cpvCodeID = "CPVCodeID", cpvCode = "CPVCode", numarAnuntParticipare = "NumarAnuntParticipare" + case valoareEUR = "ValoareEUR", cpvCodeID = "CPVCodeId", cpvCode = "CPVCode", numarAnuntParticipare = "NumarAnuntParticipare" case dataAnuntParticipare = "DataAnuntParticipare", valoareEstimataParticipare = "ValoareEstimataParticipare" case monedaValoareEstimataParticipare = "MonedaValoareEstimataParticipare", depoziteGarantii = "DepoziteGarantii", modalitatiFinantare = "ModalitatiFinantare" } @@ -607,9 +633,9 @@ class ApiHelper { } - func searchContracts(pattern: String, handler: @escaping ([InstitutionContract], URLResponse?, Error?) -> Void) { - var contractResults: [InstitutionContract] = [] - let url = self.apiURL + "SearchContract/" + pattern.folding(options: .diacriticInsensitive, locale: .current).trimmingCharacters(in: .whitespacesAndNewlines).addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)! + func searchContracts(pattern: String, handler: @escaping ([SearchResultContract], URLResponse?, Error?) -> Void) { + var contractResults: [SearchResultContract] = [] + let url = self.apiURL + "SearchAD/" + pattern.folding(options: .diacriticInsensitive, locale: .current).trimmingCharacters(in: .whitespacesAndNewlines).addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)! print("Searching Contracts: " + url) let task = URLSession.shared.dataTask(with: URL(string: url)!) { data, response, error in @@ -622,7 +648,7 @@ class ApiHelper { return } do { - contractResults = try JSONDecoder().decode([InstitutionContract].self, from: data) + contractResults = try JSONDecoder().decode([SearchResultContract].self, from: data) handler(contractResults, response, error) } catch let error { print("json error: \(error)") @@ -632,12 +658,12 @@ class ApiHelper { task.resume() } - func searchLicitatii(pattern: String, handler: @escaping ([InstitutionLicitatie], URLResponse?, Error?) -> Void) { - var licitatieResults: [InstitutionLicitatie] = [] + func searchLicitatii(pattern: String, handler: @escaping ([SearchResultLicitatie], URLResponse?, Error?) -> Void) { + var licitatieResults: [SearchResultLicitatie] = [] - let url = self.apiURL + "SearchTenters/" + pattern.folding(options: .diacriticInsensitive, locale: .current).trimmingCharacters(in: .whitespacesAndNewlines).addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)! + let url = self.apiURL + "SearchTender/" + pattern.folding(options: .diacriticInsensitive, locale: .current).trimmingCharacters(in: .whitespacesAndNewlines).addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)! print("Searching Licitatii for " + url) - + let task = URLSession.shared.dataTask(with: URL(string: url)!) { data, response, error in guard error == nil else { handler(licitatieResults, response, error) @@ -648,7 +674,7 @@ class ApiHelper { return } do { - licitatieResults = try JSONDecoder().decode([InstitutionLicitatie].self, from: data) + licitatieResults = try JSONDecoder().decode([SearchResultLicitatie].self, from: data) handler(licitatieResults, response, error) } catch let error { print("json error: \(error)") @@ -657,4 +683,51 @@ class ApiHelper { } task.resume() } + + func semnaleazaAD(contractId: Int) { + let url = self.apiURL + "JustifyAD/" + String(contractId) + print("Semnaleaza AD " + url) + + var request = URLRequest(url: URL(string: url)!) + request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") + request.httpMethod = "POST" + + + let task = URLSession.shared.dataTask(with: request) { data, response, error in + guard error == nil else { + print("error=\(String(describing: error))") + return + } + + if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200 { + print("statusCode should be 200, but is \(httpStatus.statusCode)") + print("response = \(String(describing: response))") + } + + } + task.resume() + } + + func semnaleazaTender(tenderId: Int) { + let url = self.apiURL + "JustifyTender/" + String(tenderId) + print("Semnaleaza AD " + url) + + var request = URLRequest(url: URL(string: url)!) + request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") + request.httpMethod = "POST" + + + let task = URLSession.shared.dataTask(with: request) { data, response, error in + guard error == nil else { + print("error=\(String(describing: error))") + return + } + + if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200 { + print("statusCode should be 200, but is \(httpStatus.statusCode)") + print("response = \(String(describing: response))") + } + } + task.resume() + } } diff --git a/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart.png b/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart.png deleted file mode 100644 index 84324af..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart@2x.png b/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart@2x.png deleted file mode 100644 index 116df33..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart@2x.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart@3x.png b/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart@3x.png deleted file mode 100644 index d30736b..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/barchart.imageset/barchart@3x.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/search.imageset/Contents.json b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/Contents.json similarity index 64% rename from harta-banilor-publici/Assets.xcassets/search.imageset/Contents.json rename to harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/Contents.json index 216ea4a..70512d5 100644 --- a/harta-banilor-publici/Assets.xcassets/search.imageset/Contents.json +++ b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/Contents.json @@ -2,17 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "search.png", + "filename" : "ic_info_outline_black.png", "scale" : "1x" }, { "idiom" : "universal", - "filename" : "search@2x.png", + "filename" : "ic_info_outline_black@2x.png", "scale" : "2x" }, { "idiom" : "universal", - "filename" : "search@3x.png", + "filename" : "ic_info_outline_black@3x.png", "scale" : "3x" } ], diff --git a/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black.png b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black.png new file mode 100644 index 0000000..8cd9fca Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black@2x.png b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black@2x.png new file mode 100644 index 0000000..ad36973 Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black@2x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black@3x.png b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black@3x.png new file mode 100644 index 0000000..44a7b28 Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_info_outline_black.imageset/ic_info_outline_black@3x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/barchart.imageset/Contents.json b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/Contents.json similarity index 68% rename from harta-banilor-publici/Assets.xcassets/barchart.imageset/Contents.json rename to harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/Contents.json index d4a1612..12f667a 100644 --- a/harta-banilor-publici/Assets.xcassets/barchart.imageset/Contents.json +++ b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/Contents.json @@ -2,17 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "barchart.png", + "filename" : "ic_map_black.png", "scale" : "1x" }, { "idiom" : "universal", - "filename" : "barchart@2x.png", + "filename" : "ic_map_black@2x.png", "scale" : "2x" }, { "idiom" : "universal", - "filename" : "barchart@3x.png", + "filename" : "ic_map_black@3x.png", "scale" : "3x" } ], diff --git a/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black.png b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black.png new file mode 100644 index 0000000..c9070d3 Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black@2x.png b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black@2x.png new file mode 100644 index 0000000..eb7382c Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black@2x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black@3x.png b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black@3x.png new file mode 100644 index 0000000..8796e80 Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_map_black.imageset/ic_map_black@3x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/info.imageset/Contents.json b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/Contents.json similarity index 67% rename from harta-banilor-publici/Assets.xcassets/info.imageset/Contents.json rename to harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/Contents.json index c7d3dae..06c4ce2 100644 --- a/harta-banilor-publici/Assets.xcassets/info.imageset/Contents.json +++ b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/Contents.json @@ -2,17 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "info.png", + "filename" : "ic_search_black.png", "scale" : "1x" }, { "idiom" : "universal", - "filename" : "info@2x.png", + "filename" : "ic_search_black@2x.png", "scale" : "2x" }, { "idiom" : "universal", - "filename" : "info@3x.png", + "filename" : "ic_search_black@3x.png", "scale" : "3x" } ], diff --git a/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black.png b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black.png new file mode 100644 index 0000000..d1d4492 Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black@2x.png b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black@2x.png new file mode 100644 index 0000000..accc3af Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black@2x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black@3x.png b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black@3x.png new file mode 100644 index 0000000..28a5f6a Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_search_black.imageset/ic_search_black@3x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/Contents.json b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/Contents.json similarity index 65% rename from harta-banilor-publici/Assets.xcassets/placeholder.imageset/Contents.json rename to harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/Contents.json index 996d3e7..59955cd 100644 --- a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/Contents.json +++ b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/Contents.json @@ -2,17 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "placeholder.png", + "filename" : "ic_show_chart_black.png", "scale" : "1x" }, { "idiom" : "universal", - "filename" : "placeholder@2x.png", + "filename" : "ic_show_chart_black@2x.png", "scale" : "2x" }, { "idiom" : "universal", - "filename" : "placeholder@3x.png", + "filename" : "ic_show_chart_black@3x.png", "scale" : "3x" } ], diff --git a/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black.png b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black.png new file mode 100644 index 0000000..c45537b Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black@2x.png b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black@2x.png new file mode 100644 index 0000000..7a2cf56 Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black@2x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black@3x.png b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black@3x.png new file mode 100644 index 0000000..ada2317 Binary files /dev/null and b/harta-banilor-publici/Assets.xcassets/ic_show_chart_black.imageset/ic_show_chart_black@3x.png differ diff --git a/harta-banilor-publici/Assets.xcassets/info.imageset/info.png b/harta-banilor-publici/Assets.xcassets/info.imageset/info.png deleted file mode 100644 index 0d3d22f..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/info.imageset/info.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/info.imageset/info@2x.png b/harta-banilor-publici/Assets.xcassets/info.imageset/info@2x.png deleted file mode 100644 index b6cecab..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/info.imageset/info@2x.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/info.imageset/info@3x.png b/harta-banilor-publici/Assets.xcassets/info.imageset/info@3x.png deleted file mode 100644 index 202ec6a..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/info.imageset/info@3x.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder.png b/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder.png deleted file mode 100644 index 882dd23..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder@2x.png b/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder@2x.png deleted file mode 100644 index 5c98552..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder@2x.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder@3x.png b/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder@3x.png deleted file mode 100644 index a351e36..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/placeholder.imageset/placeholder@3x.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/search.imageset/search.png b/harta-banilor-publici/Assets.xcassets/search.imageset/search.png deleted file mode 100644 index 219e200..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/search.imageset/search.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/search.imageset/search@2x.png b/harta-banilor-publici/Assets.xcassets/search.imageset/search@2x.png deleted file mode 100644 index 17438ff..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/search.imageset/search@2x.png and /dev/null differ diff --git a/harta-banilor-publici/Assets.xcassets/search.imageset/search@3x.png b/harta-banilor-publici/Assets.xcassets/search.imageset/search@3x.png deleted file mode 100644 index 36bb337..0000000 Binary files a/harta-banilor-publici/Assets.xcassets/search.imageset/search@3x.png and /dev/null differ diff --git a/harta-banilor-publici/Base.lproj/Main.storyboard b/harta-banilor-publici/Base.lproj/Main.storyboard index 4c711da..e845c50 100644 --- a/harta-banilor-publici/Base.lproj/Main.storyboard +++ b/harta-banilor-publici/Base.lproj/Main.storyboard @@ -282,6 +282,9 @@ + + + -