Rev 19 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
//// CompanyListItemView.swift// twogetskills//// Created by Efrain Yanez Recanatini on 7/30/22.//import Foundationimport SwiftUIimport HTMLEntitiesstruct CompanyListItemView: View {@EnvironmentObject var appNavigation : AppNavigationprivate var companyModel : CompanyModelprivate var companyName : Stringprivate var appData = AppData.sharedInstanceinit (companyUuid : String) {let companyDao = CompanyDao.sharedInstanceself.companyModel = companyDao.selectByUuid(uuid: companyUuid)if companyModel.name.count > Constants.MYCAPSULE_TITLE_MAX_LENGTH {self.companyName = String(Array(companyModel.name)[0...Constants.MYCAPSULE_TITLE_MAX_LENGTH]) + "..."} else {self.companyName = companyModel.name}}var body: some View {VStack(spacing: 0 ) {Group {HStack {Group {if companyModel.image.isEmpty {Image(uiImage: UIImage(named: "logo") ?? UIImage()).resizable().resizable().aspectRatio(contentMode: .fit)} else {CustomAsyncImage(url: URL(string: companyModel.image)!,placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},image: {Image(uiImage: $0).resizable()})}} .frame(width: 48, height:48, alignment: .center).clipShape(Circle()).overlay(Circle().stroke(Color.white, lineWidth: 1)).padding(.top, 5).padding(.leading, 5)VStack(spacing: 0){HStack {Text(self.companyName).font(Font.custom(Config.FONT_NAME_BOLD, size: 14)).foregroundColor(Color("color_capsule_list_item_title_foreground"))Spacer()Button(action: {self.appData.companyUuidActive = self.companyModel.uuidself.appData.save()withAnimation {appNavigation.subpageActive = .progress}}, label: {Image(systemName: "arrowtriangle.right.fill").resizable().aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/).frame(width: 16, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)}).padding(.trailing, 10).foregroundColor(Color("color_capsule_list_item_title_foreground"))}}}}Divider()} .background(Color("color_capsule_list_item_background")).padding(.leading, 5).padding(.trailing, 5)}}struct CompanyListItemView_Previews: PreviewProvider {static var previews: some View {CompanyListItemView(companyUuid: "C123")}}