From f95c01d729d7563a500c2cc72eeb20cb5168f667 Mon Sep 17 00:00:00 2001 From: Ignacio LUCATERO Date: Mon, 31 Aug 2015 19:35:58 +0200 Subject: [PATCH] fix #248 code that filtered the install button has been removed, now it lets always to install app OR launch teh service. Fix #246 Now the cache get the get cities like Barcelona, Drome, etc and display them in the multi-select box. --- .../mongo/dao/geo/GeographicalAreaCache.java | 39 ++++++++++--------- .../mongo/model/geo/GeographicalArea.java | 3 +- .../services/dc/geoarea/GeographicalDAO.java | 10 +++-- .../organization/DCOrganizationService.java | 6 +-- .../create-or-modify-organization.min.js | 2 +- .../js/network/search-organization.jsx.js | 5 ++- .../js/network/search-organization.min.js | 2 +- .../public/js/store/store-install-app.jsx.js | 9 ++--- .../public/js/store/store-install-app.min.js | 2 +- .../templates/appmanagement/myapps.html | 1 - portal-parent/pom.xml | 2 +- 11 files changed, 43 insertions(+), 38 deletions(-) diff --git a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/dao/geo/GeographicalAreaCache.java b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/dao/geo/GeographicalAreaCache.java index 89d5ebfbf..90493077b 100644 --- a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/dao/geo/GeographicalAreaCache.java +++ b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/dao/geo/GeographicalAreaCache.java @@ -34,7 +34,6 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Repository; import org.springframework.web.client.RestClientException; -import org.springframework.web.util.UriComponentsBuilder; import com.mongodb.BasicDBObject; import com.mongodb.BulkWriteOperation; @@ -84,6 +83,9 @@ public class GeographicalAreaCache { /** ex. Rhône-Alpes */ @Value("${application.geoarea.secondaryNameField:geo:name}") private String nameField; // "geoci:name"; + /** ex. "http://data.ozwillo.com/dc/type/geocifr:Commune_0/FR/FR-38/Saint-Clair-de-la-Tour" */ + @Value("${application.geoarea.searchCronField:@id}") + private String searchCronField; // "@id"; @Autowired private Tokenizer tokenizer; @@ -165,12 +167,12 @@ private Stream findOneToken(String country, String modelType, // we search irrespective of the replication status, but we deduplicate based on DC Resource URI. // sort spec means we want older results first - so that incoming replicates are discarded as long as // there is an online entry - String encodedCountry = country; - try{ + String encodedCountry = country; //comes already encoded + /*try{ encodedCountry = UriComponentsBuilder.fromUriString(country).build().encode().toString(); }catch(Exception e){ logger.debug("The country URI \"{}\" cannot be encoded : {}", country, e.toString()); - } + }*/ Criteria criteria = where("lang").is(lang); if (encodedCountry != null && !encodedCountry.trim().isEmpty()){ criteria.and("country").is(encodedCountry); //filter by country @@ -182,8 +184,8 @@ private Stream findOneToken(String country, String modelType, criteria.and("nameTokens").regex(name); return template.find( - query(criteria).with(new Sort(Sort.Direction.ASC, "replicationTime")), - GeographicalArea.class) + query(criteria).limit(100).with(new Sort(Sort.Direction.ASC, "replicationTime")), + GeographicalArea.class ) .stream() .map(DCUrlWrapper::new) .distinct() @@ -225,11 +227,11 @@ public void replicate() { portalSystemUserService.runAs(new Runnable() { @Override public void run() { - String lastNameFetched = null; + String lastDCIdFetched = null; do { logger.debug("Fetching batches of areas"); - lastNameFetched = fetchBatches(collection, loadedUris, lastNameFetched); - } while (lastNameFetched != null); + lastDCIdFetched = fetchBatches(collection, loadedUris, lastDCIdFetched); + } while (lastDCIdFetched != null); } }); @@ -253,14 +255,15 @@ public void run() { } - private String fetchBatches(DBCollection collection, Set loadedUris, String lastNameFetched) { + private String fetchBatches(DBCollection collection, Set loadedUris, String lastDCIdFetched) { BulkWriteOperation builder = collection.initializeUnorderedBulkOperation(); + String prevDcId = lastDCIdFetched; DCQueryParameters params; - params = lastNameFetched == null - ? new DCQueryParameters(nameField, DCOrdering.DESCENDING) - : new DCQueryParameters(nameField, DCOrdering.DESCENDING, DCOperator.LT, lastNameFetched); + params = lastDCIdFetched == null + ? new DCQueryParameters(searchCronField, DCOrdering.DESCENDING) + : new DCQueryParameters(searchCronField, DCOrdering.DESCENDING, DCOperator.LT, "\""+lastDCIdFetched+"\""); // (LT & descending order to leave possible null geo:name values at the end rather than having to skip them) logger.debug("Querying the Data Core"); @@ -285,7 +288,7 @@ private String fetchBatches(DBCollection collection, Set loadedUris, Str hasOne = true; if (name == null) { name = area.getName(); - logger.debug("{} - {}", name, area.getUri()); + //logger.debug("{} - {}", name, area.getUri()); } DBObject dbObject = new BasicDBObject(); @@ -300,10 +303,10 @@ private String fetchBatches(DBCollection collection, Set loadedUris, Str logger.debug("Area {} already inserted for language {}, skipping", area.getName(), language.getLanguage()); } } - } - if (name != null) { lastNameFetched = name; } + String id = res.getUri(); // ID resource in DC is always encoded, so to match values we need to encoded as well + if (id != null) { lastDCIdFetched = id; } } @@ -314,8 +317,8 @@ private String fetchBatches(DBCollection collection, Set loadedUris, Str logger.debug("Saved resources; total save time={} ms (avg = {} ms)", durationSave, durationSave / resources.size()); } - if (resources.size() < batchSize) return null; - else return lastNameFetched; + if ( (prevDcId != null && prevDcId.equals(lastDCIdFetched)) || resources.size() < batchSize){ return null;} + else return lastDCIdFetched; } } diff --git a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/model/geo/GeographicalArea.java b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/model/geo/GeographicalArea.java index e1118959b..a1df4ca80 100644 --- a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/model/geo/GeographicalArea.java +++ b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/core/mongo/model/geo/GeographicalArea.java @@ -15,7 +15,8 @@ @Document(collection = "geographical_area") @CompoundIndexes({ - @CompoundIndex(name = "lang_nametokens", def = "{'lang':1, 'nameTokens':1}") + @CompoundIndex(name = "lang_nametokens", def = "{'lang':1, 'nameTokens':1}"), + @CompoundIndex(name = "lang_nametokens_country", def = "{'lang':1, 'nameTokens':1, country:1}") }) public class GeographicalArea { diff --git a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/geoarea/GeographicalDAO.java b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/geoarea/GeographicalDAO.java index 30d6b5bea..cb90627c2 100644 --- a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/geoarea/GeographicalDAO.java +++ b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/geoarea/GeographicalDAO.java @@ -18,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import org.springframework.web.util.UriComponentsBuilder; /** * User: Ignacio @@ -107,7 +106,8 @@ private List fetchResourceByCountryAndNameStartingWith(String queryT String encodedCountryUri = countryUri; try{ if(encodedCountryUri != null && !encodedCountryUri.isEmpty()){ - encodedCountryUri = UriComponentsBuilder.fromUriString(countryUri).build().encode().toString(); + //encodedCountryUri = UriComponentsBuilder.fromUriString(countryUri).build().encode().toString(); + encodedCountryUri = countryUri; params.and(countryField.trim(), DCOperator.EQ, encodedCountryUri); } }catch(Exception e){ @@ -132,7 +132,7 @@ public GeographicalArea toGeographicalArea(DCResource r, String language, String } String name = null; for (Map nameMap : nameMaps) { - logger.debug("nameMaps: " + nameMaps.toString()); + //logger.debug("nameMaps: " + nameMaps.toString()); String l = nameMap.get("@language"); // TODO Q why ?? @language only in application/json+ld, otherwise l if (l == null) { continue; /* shouldn't happen */ } if (l.equals(language)) { @@ -145,7 +145,9 @@ public GeographicalArea toGeographicalArea(DCResource r, String language, String //TODO LATER: Create a full body DC interceptor to test request/response to DATACORE (similar to KernelLoggingInterceptor) } - String country = r.getAsString("geoci:country"); + String country = r.getAsString("geo:country"); /* The true value should be the main referenced model id (geo:country), but today + * it is not linked in the models. NB today it makes that some of the fields are not + * stored due to this field (been empty for those cases) */ List modelType = r.getAsStringList("@type"); GeographicalArea area = new GeographicalArea(); diff --git a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/organization/DCOrganizationService.java b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/organization/DCOrganizationService.java index ddef976f4..eeb4c33fc 100644 --- a/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/organization/DCOrganizationService.java +++ b/portal-parent/oasis-portal-front/src/main/java/org/oasis_eu/portal/services/dc/organization/DCOrganizationService.java @@ -298,7 +298,7 @@ public DCOrganization toDCOrganization(DCResource res, String language) { String jurisdiction_uri = getBestI18nValue(res, language, "orgpu:jurisdiction", null); String jurisdiction = jurisdiction_uri == null ? null : getBestI18nValue( - datacore.getResourceFromURI(dcOrgProjectName, jurisdiction_uri).getResource(), language, "geoci:displayName", null + datacore.getResourceFromURI(dcOrgProjectName, jurisdiction_uri).getResource(), language, "odisp:name", null ); String phoneNumber = getBestI18nValue(res, language, "org:phoneNumber", null); @@ -310,14 +310,14 @@ public DCOrganization toDCOrganization(DCResource res, String language) { String POBox = getBestI18nValue(res, language, "adrpost:POBox", null); String city_uri = getBestI18nValue(res, language, "adrpost:postName", null); String city = city_uri == null ? null : getBestI18nValue( - datacore.getResourceFromURI(dcOrgProjectName, city_uri).getResource(), language, "geoci:displayName", null + datacore.getResourceFromURI(dcOrgProjectName, city_uri).getResource(), language, "odisp:name", null ); String zip = getBestI18nValue(res, language, "adrpost:postCode", "org:postCode"); String cedex = getBestI18nValue(res, language, "adrpost:cedex", null); String country_uri = getBestI18nValue(res, language, "adrpost:country", null); String country = country_uri == null ? null : getBestI18nValue( - datacore.getResourceFromURI(dcOrgProjectName, country_uri).getResource(), language, "geoco:name", null + datacore.getResourceFromURI(dcOrgProjectName, country_uri).getResource(), language, "geo:name", null ); //String longitude= getBestI18nValue(res, "org:longitude", null); diff --git a/portal-parent/oasis-portal-front/src/main/resources/public/js/network/create-or-modify-organization.min.js b/portal-parent/oasis-portal-front/src/main/resources/public/js/network/create-or-modify-organization.min.js index 7bfd73d5b..c513149fc 100644 --- a/portal-parent/oasis-portal-front/src/main/resources/public/js/network/create-or-modify-organization.min.js +++ b/portal-parent/oasis-portal-front/src/main/resources/public/js/network/create-or-modify-organization.min.js @@ -1 +1 @@ -function getSectorTypeLabel(sector_type,type_restriction){return type_restriction&&(type_restriction.company?type_restriction.public_body||(sector_type="COMPANY"):sector_type="PUBLIC_BODY"),"COMPANY"===sector_type||"Private"===sector_type?t("search.organization.sector-type.COMPANY"):t("search.organization.sector-type.PUBLIC_BODY")}var default_org_data={organization:{exist:!1,legal_name:"",sector_type:"",in_activity:!0,alt_name:"",org_type:"",tax_reg_num:"",tax_reg_official_id:"",tax_reg_activity_uri:"",jurisdiction_uri:"",jurisdiction:"",phone_number:"",web_site:"",email:"",street_and_number:"",additional_address_field:"",po_box:"",city:"",city_uri:"",zip:"",cedex:"",country_uri:""},errors:[[],[]],typeRestriction:""},CreateOrModifyOrganizationModal=React.createClass({displayName:"CreateOrModifyOrganizationModal",getInitialState:function(){return default_org_data},componentDidMount:function(){$(this.refs.modalcreateOrModifyOrg.getDOMNode()).on("shown.bs.modal",function(){$("input",this).first().focus()})},show:function(org){if(org){var state=this.state;state.organization=org,this.setState(state)}this.refs.modalcreateOrModifyOrg.open()},close:function(org){this.refs.modalcreateOrModifyOrg.close(),this.props.successHandler&&this.props.successHandler(org)},onError:function(data){this.refs.modalError.open()},createOrModifOrg:function(event){return this.refs.tabbedForm.createOrModifOrg(event)},render:function(){var org=this.state.organization,typeRestriction=this.props.typeRestriction,saveButton=org.exist?t("ui.save"):t("my.network.create-org"),buttonLabels={cancel:t("ui.cancel"),save:saveButton},modalTitle=org.exist?t("my.network.modify-org"):t("my.network.create-org");return React.createElement("div",null,React.createElement(Modal,{large:!0,ref:"modalcreateOrModifyOrg",title:modalTitle,successHandler:this.createOrModifOrg,buttonLabels:buttonLabels},React.createElement(CreateOrModifyOrganizationForm,{ref:"tabbedForm",successHandler:this.close,errorHandler:this.onError,organization:org,typeRestriction:typeRestriction})),React.createElement(Modal,{ref:"modalError",title:t("ui.something_went_wrong_title"),infobox:!0,cancelHandler:null},React.createElement("div",null,React.createElement("h5",null,t("ui.unexpected_error"))),React.createElement("br",null),React.createElement("div",null,React.createElement("h5",null,"Err: Possibly the organization is already assigned in kernel"))))}}),CreateOrModifyOrganizationForm=React.createClass({displayName:"CreateOrModifyOrganizationForm",getDefaultProps:function(){return{organization:default_org_data.organization,errors:default_org_data.errors}},getInitialState:function(){return{organization:this.props.organization,errors:default_org_data.errors,activeTab:1}},switchTab:function(idx){this.refs.navtab.changeTab({id:idx})},validateFields:function(org){var errors=[],errTab1=[];org.legal_name&&""!=org.legal_name.trim()||errTab1.push("legal_name"),org.tax_reg_num&&""!=org.tax_reg_num.trim()||errTab1.push("tax_reg_num"),"PUBLIC_BODY"!==org.sector_type||org.jurisdiction_uri&&""!=org.jurisdiction_uri.trim()||errTab1.push("jurisdiction_uri"),errors.push(errTab1);var errTab2=[];return org.street_and_number&&""!=org.street_and_number.trim()||errTab2.push("street_and_number"),org.zip&&""!=org.zip.trim()||errTab2.push("zip"),org.city_uri&&""!=org.city_uri.trim()||(errTab2.push("city_uri"),errTab2.push("city")),org.exist||org.country_uri&&""!=org.country_uri.trim()||(errTab2.push("country_uri"),errTab2.push("country")),errors.push(errTab2),this.setState({errors:errors}),errors},callCreateOrganization:function(org){$.ajax({url:network_service+"/create-dc-organization",type:"post",contentType:"application/json",data:JSON.stringify(org),success:function(data){data||""!==data?this.props.successHandler(data):this.props.errorHandler(data)}.bind(this),error:function(xhr,status,err){this.props.errorHandler()}.bind(this)})},callUpdateOrganization:function(org){$.ajax({url:network_service+"/update-dc-organization",type:"post",contentType:"application/json",data:JSON.stringify(org),success:function(data){data?this.props.successHandler(data):this.props.errorHandler(data)}.bind(this),error:function(xhr,status,err){this.props.errorHandler()}.bind(this)})},createOrModifOrg:function(event){event&&event.preventDefault();var org=this.props.organization,errs=this.validateFields(org);return errs[0].length+errs[1].length>0?(errs[0].length>0?this.switchTab(1):this.switchTab(2),!1):(org.exist?this.callUpdateOrganization(org):this.callCreateOrganization(org),this.switchTab(1),this.props.successHandler&&this.props.successHandler(),!0)},render:function(){var tabList=[{id:1,name:t("my.network.organization.tab1.general_information"),url:"#"},{id:2,name:t("my.network.organization.tab2.address_geolocation"),url:"#"}],organization=this.props.organization;return React.createElement("div",{className:"form-horizontal"},React.createElement(NavTab,{ref:"navtab",tabList:tabList,currentTab:this.state.activeTab},React.createElement(Tab1,{id:1,orgData:organization,errors:this.state.errors[0],switchTab:this.switchTab,valdiate:this.validateFields,typeRestriction:this.props.typeRestriction}),React.createElement(Tab2,{id:2,orgData:organization,errors:this.state.errors[1],switchTab:this.switchTab,valdiate:this.validateFields,typeRestriction:this.props.typeRestriction})))}}),Field=React.createClass({displayName:"Field",renderLabel:function(htmlFor,class_name,label,isRequired){var cn=isRequired?React.createElement("label",{className:"error"},"*"):"";return React.createElement("label",{htmlFor:htmlFor,className:class_name},label," ",cn)},render:function(){var className="control-label col-sm-3",classNameDiv="col-sm-7";return this.props.class_name&&(className=this.props.class_name),this.props.error&&(className+=" error"),this.props.class_name_div&&(classNameDiv=this.props.class_name_div),React.createElement("div",{className:"form-group"},this.renderLabel(this.props.name,className,t("my.network.organization."+this.props.name),this.props.isRequired),React.createElement("div",{className:classNameDiv},this.props.children))}}),iconClassName="control-label col-sm-2",Tab1=React.createClass({displayName:"Tab1",getInitialState:function(){return{organization:this.props.orgData,errors:[],errorMsg:""}},moveTabRight:function(){var errors=this.props.valdiate(this.state.organization);0==errors[0].length&&this.props.switchTab(this.props.id+1)},changeInput:function(fieldname,isCheckbox){return function(event){var org=this.state.organization;isCheckbox?org[fieldname]=event.target.checked:(org[fieldname]=event.target.value,"jurisdiction_uri"===fieldname&&(org.jurisdiction=event.added?event.added.name:"")),this.setState({organization:org})}.bind(this)},updateUploadedIcon:function(servedImageUrlData){var org=this.state.organization;org.iconUrl=servedImageUrlData,this.setState({organization:org,errorMsg:""})},error:function(xhr,status,err){this.setState({errorMsg:t("ui.unexpected_error")})},render:function(){-1!=$.inArray("icon",this.props.errors)&&(iconClassName+=" error"),this.state.organization=this.props.orgData;var label_regNum,sectorType=getSectorTypeLabel(this.state.organization.sector_type,this.props.typeRestriction),label_regOfficialId="",label_regActivity="",n=this.state.organization.country_uri?this.state.organization.country_uri.lastIndexOf("/"):-1,acronymCountry=n>0?this.state.organization.country_uri.substring(n+1):"";switch(acronymCountry){case"BG":label_regNum="tax_reg_num.bg",label_regActivity="tax_reg_activity.bg";break;case"IT":label_regNum="tax_reg_num.it",label_regActivity="tax_reg_activity.it";break;case"FR":label_regNum="tax_reg_num.fr",label_regOfficialId="tax_reg_official_id.fr",label_regActivity="tax_reg_activity.fr";break;case"ES":label_regNum="tax_reg_num.es",label_regActivity="tax_reg_activity.es";break;case"TR":label_regNum="tax_reg_num.tr",label_regOfficialId="tax_reg_official_id.tr",label_regActivity="tax_reg_activity.tr";break;default:label_regNum="tax_reg_num.en"}return React.createElement("div",{id:"tab1"},React.createElement("div",{className:"container-fluid"},React.createElement("div",{className:"row"},React.createElement("br",null),React.createElement("div",{className:"col-sm-15"},React.createElement(Field,{name:"legal_name",class_name:"control-label col-sm-2",error:-1!=$.inArray("legal_name",this.props.errors),isRequired:!0},React.createElement("input",{className:"form-control",id:"legal_name",type:"text",value:this.state.organization.legal_name,onChange:this.changeInput("legal_name"),disabled:this.state.organization.exist}),React.createElement("label",null,sectorType),React.createElement("label",{className:"col-sm-offset-3"},t("my.network.organization.in_activity"),":  ",React.createElement("input",{id:"in_activity",type:"checkbox",checked:this.state.organization.in_activity,onChange:this.changeInput("in_activity",!0)}))),React.createElement("br",null),React.createElement(Field,{name:"alt_name",class_name:"control-label col-sm-2"},React.createElement("input",{className:"form-control",id:"alt_name",type:"text",value:this.state.organization.alt_name,onChange:this.changeInput("alt_name")}))))," ",React.createElement("div",{className:"row"},React.createElement("div",{className:"col-sm-8"},React.createElement(Field,{name:"org_type",class_name_div:"col-sm-5"},React.createElement("input",{className:"form-control",id:"org_type",type:"text",value:this.state.organization.org_type,onChange:this.changeInput("org_type"),placeholder:t("my.network.organization.org_type.placeholder")})),React.createElement(Field,{name:label_regNum,error:-1!=$.inArray("tax_reg_num",this.props.errors),isRequired:!0},React.createElement("input",{className:"form-control",id:"tax_reg_num",type:"text",value:this.state.organization.tax_reg_num,onChange:this.changeInput("tax_reg_num"),disabled:!0})),""!==label_regOfficialId&&"COMPANY"!==this.state.organization.sector_type?React.createElement(Field,{name:label_regOfficialId},React.createElement("input",{className:"form-control",id:"tax_reg_official_id",type:"text",value:this.state.organization.tax_reg_official_id,onChange:this.changeInput("tax_reg_official_id")})):"",React.createElement(Field,{name:label_regActivity,class_name_div:"col-sm-3"},React.createElement(GeoSingleSelect2Component,{ref:"geoSearchtaxRegActivity",className:"form-control",key:this.state.organization.tax_reg_activity_uri,name:"geoSearchRegActivity",urlResources:store_service+"/dc-taxRegActivity",onChange:this.changeInput("tax_reg_activity_uri"),minimumInputLength:2,countryFilter:{country_uri:this.state.organization.country_uri},placeholder:this.state.organization.tax_reg_activity_uri?this.state.organization.tax_reg_activity_uri.substring(this.state.organization.tax_reg_activity_uri.lastIndexOf("/")+1):" "})),React.createElement("br",null),"COMPANY"===this.state.organization.sector_type?"":React.createElement(Field,{name:"jurisdiction",error:-1!=$.inArray("jurisdiction_uri",this.props.errors),isRequired:!0},React.createElement(GeoSingleSelect2Component,{ref:"geoSearchJurisdiction",className:"form-control",key:this.state.organization.jurisdiction,name:"geoSearch",urlResources:store_service+"/geographicalAreas",onChange:this.changeInput("jurisdiction_uri"),countryFilter:{country_uri:this.state.organization.country_uri},placeholder:this.state.organization.jurisdiction})),React.createElement(Field,{name:"phone_number"},React.createElement("input",{className:"form-control",id:"phone_number",type:"text",value:this.state.organization.phone_number,onChange:this.changeInput("phone_number")})),React.createElement(Field,{name:"web_site"},React.createElement("input",{className:"form-control",id:"web_site",type:"text",value:this.state.organization.web_site,onChange:this.changeInput("web_site")})),React.createElement(Field,{name:"email"},React.createElement("input",{className:"form-control",id:"email",type:"email",value:this.state.organization.email,onChange:this.changeInput("email"),placeholder:t("my.network.organization.email.placeholder")}))),React.createElement("div",{className:"col-sm-2"},React.createElement("div",{className:"form-group"},React.createElement("div",{className:"control"},React.createElement("img",{src:this.state.organization.iconUrl}),React.createElement("div",{className:"btn btn-success-inverse btn-edit"},React.createElement("i",{className:"pull-left fa fa-pencil"}),React.createElement("label",null,t("my.network.organization.change-icon")),React.createElement(FileUploadInput,{className:"edit",uploadUrl:"/media/objectIcon/"+this.state.organization.tax_reg_num,success:this.updateUploadedIcon,error:this.error}))))))),React.createElement("div",{className:"error"},React.createElement("label",null,this.state.errorMsg)," "),React.createElement("button",{key:"next",className:"control pull-right btn btn-primary-inverse",onClick:this.moveTabRight},t("ui.next")))}}),isInteger=function(obj){return jQuery.isNumeric(obj)&&obj.indexOf(".")<0},Tab2=React.createClass({displayName:"Tab2",getInitialState:function(){return{organization:this.props.orgData,errors:[]}},moveTabLeft:function(){var errors=this.props.valdiate(this.state.organization);0==errors[1].length&&this.props.switchTab(this.props.id-1)},changeInput:function(fieldname,isNumericField){return function(event){this.changeInputAddress(fieldname,event.target.value,isNumericField)}.bind(this)},changeInputAddress:function(fieldname,value,isNumericField){var org=this.state.organization;isNumericField&&""!==value?org[fieldname]=isInteger(value)?value.trim():org[fieldname]:org[fieldname]=value,this.setState({organization:org})},render:function(){-1!=$.inArray("icon",this.props.errors)&&(iconClassName+=" error"),this.state.organization=this.props.orgData;var sectorType=getSectorTypeLabel(this.state.organization.sector_type,this.props.typeRestriction);return React.createElement("div",{id:"tab2"},React.createElement("div",{className:"container-fluid"},React.createElement("div",{className:"row"},React.createElement("br",null),React.createElement("div",{className:"col-sm-15"},React.createElement(Field,{name:"legal_name",class_name:"control-label col-sm-2",error:-1!=$.inArray("name",this.props.errors)},React.createElement("input",{className:"form-control",id:"legal_name",type:"text",value:this.state.organization.legal_name,onChange:this.changeInput("legal_name"),disabled:!0}),React.createElement("label",null,sectorType),React.createElement("label",{className:"col-sm-offset-3"},t("my.network.organization.in_activity"),":  ",React.createElement("input",{id:"in_activity",type:"checkbox",checked:this.state.organization.in_activity,disabled:!0}))),React.createElement("br",null)))," ",React.createElement("div",{className:"row"},React.createElement("div",{className:"col-sm-8"},React.createElement(AddressComponent,{errors:this.props.errors,addressContainer:this.state.organization,changeInput:this.changeInputAddress,addressType:"ORG",disabled:!0}))," ",React.createElement("div",{className:"col-sm-4"})))," ",React.createElement("button",{key:"next",className:"control pull-right btn btn-primary-inverse",onClick:this.moveTabLeft},t("ui.previous")))}}),AddressComponent=React.createClass({displayName:"AddressComponent",componentDidMount:function(){},changeInput:function(fieldname,isNumericField){return changeInput=this.props.changeInput,function(event){event.added?(changeInput(fieldname,event.added.name,isNumericField),changeInput(fieldname+"_uri",event.target.value,isNumericField)):"country"===fieldname?(changeInput(fieldname,event.target.selectedOptions[0].label,isNumericField),changeInput(fieldname+"_uri",event.target.value,isNumericField),changeInput("city","",isNumericField),changeInput("city_uri","",isNumericField),this.refs.geoSearchCity&&this.refs.geoSearchCity.clear()):changeInput(fieldname,event.target.value,isNumericField)}.bind(this)},render:function(){var address=this.props.addressContainer,addressType=this.props.addressType?this.props.addressType:"";return React.createElement("div",null,React.createElement(Field,{name:"street_and_number",error:-1!=$.inArray("street_and_number",this.props.errors),isRequired:"ORG"==addressType?!0:!1},React.createElement("input",{className:"form-control",id:"street_and_number",type:"text",value:address.street_and_number,onChange:this.changeInput("street_and_number")})),React.createElement(Field,{name:"additional_address_field"},React.createElement("input",{className:"form-control",id:"additional_address_field",type:"text",value:address.additional_address_field,onChange:this.changeInput("additional_address_field")})),"ORG"!==addressType?"":React.createElement(Field,{name:"po_box"},React.createElement("input",{className:"form-control",id:"po_box",type:"text",value:address.po_box,onChange:this.changeInput("po_box")})),React.createElement(Field,{name:"city",error:-1!=$.inArray("city",this.props.errors),isRequired:!0},React.createElement(GeoSingleSelect2Component,{ref:"geoSearchCity",className:"form-control",name:"geoSearchCity",key:address.city,urlResources:store_service+"/dc-cities",onChange:this.changeInput("city"),countryFilter:{country_uri:address.country_uri},placeholder:address.city})),React.createElement(Field,{name:"zip",class_name_div:"col-sm-3",error:-1!=$.inArray("zip",this.props.errors),isRequired:!0},React.createElement("input",{className:"form-control",id:"zip",type:"text",maxLength:6,value:address.zip,onChange:this.changeInput("zip",!0)})),"ORG"!==addressType?"":React.createElement(Field,{name:"cedex",class_name_div:"col-sm-2"},React.createElement("input",{className:"form-control",id:"cedex",type:"cedex",maxLength:3,value:address.cedex,onChange:this.changeInput("cedex",!0)})),React.createElement(Field,{name:"country",class_name_div:"col-sm-5",error:-1!=$.inArray("country_uri",this.props.errors),isRequired:!0},React.createElement(CountrySelect,{className:"form-control",url:store_service+"/dc-countries",value:address.country_uri,onChange:this.changeInput("country"),disabled:this.props.disabled})))}}); +function getSectorTypeLabel(sector_type,type_restriction){return type_restriction&&(type_restriction.company?type_restriction.public_body||(sector_type="COMPANY"):sector_type="PUBLIC_BODY"),"COMPANY"===sector_type||"Private"===sector_type?t("search.organization.sector-type.COMPANY"):t("search.organization.sector-type.PUBLIC_BODY")}var default_org_data={organization:{exist:!1,legal_name:"",sector_type:"",in_activity:!0,alt_name:"",org_type:"",tax_reg_num:"",tax_reg_official_id:"",tax_reg_activity_uri:"",jurisdiction_uri:"",jurisdiction:"",phone_number:"",web_site:"",email:"",street_and_number:"",additional_address_field:"",po_box:"",city:"",city_uri:"",zip:"",cedex:"",country_uri:""},errors:[[],[]],typeRestriction:""},CreateOrModifyOrganizationModal=React.createClass({displayName:"CreateOrModifyOrganizationModal",getInitialState:function(){return default_org_data},componentDidMount:function(){$(this.refs.modalcreateOrModifyOrg.getDOMNode()).on("shown.bs.modal",function(){$("input",this).first().focus()})},show:function(org){if(org){var state=this.state;state.organization=org,this.setState(state)}this.refs.modalcreateOrModifyOrg.open()},close:function(org){this.refs.modalcreateOrModifyOrg.close(),this.props.successHandler&&this.props.successHandler(org)},onError:function(data){this.refs.modalError.open()},createOrModifOrg:function(event){return this.refs.tabbedForm.createOrModifOrg(event)},render:function(){var org=this.state.organization,typeRestriction=this.props.typeRestriction,saveButton=org.exist?t("ui.save"):t("my.network.create-org"),buttonLabels={cancel:t("ui.cancel"),save:saveButton},modalTitle=org.exist?t("my.network.modify-org"):t("my.network.create-org");return React.createElement("div",null,React.createElement(Modal,{large:!0,ref:"modalcreateOrModifyOrg",title:modalTitle,successHandler:this.createOrModifOrg,buttonLabels:buttonLabels},React.createElement(CreateOrModifyOrganizationForm,{ref:"tabbedForm",successHandler:this.close,errorHandler:this.onError,organization:org,typeRestriction:typeRestriction})),React.createElement(Modal,{ref:"modalError",title:t("ui.something_went_wrong_title"),infobox:!0,cancelHandler:null},React.createElement("div",null,React.createElement("h5",null,t("ui.unexpected_error"))),React.createElement("br",null),React.createElement("div",null,React.createElement("h5",null,"Err: Possibly the organization is already assigned in kernel"))))}}),CreateOrModifyOrganizationForm=React.createClass({displayName:"CreateOrModifyOrganizationForm",getDefaultProps:function(){return{organization:default_org_data.organization,errors:default_org_data.errors}},getInitialState:function(){return{organization:this.props.organization,errors:default_org_data.errors,activeTab:1}},switchTab:function(idx){this.refs.navtab.changeTab({id:idx})},validateFields:function(org){var errors=[],errTab1=[];org.legal_name&&""!=org.legal_name.trim()||errTab1.push("legal_name"),org.tax_reg_num&&""!=org.tax_reg_num.trim()||errTab1.push("tax_reg_num"),"PUBLIC_BODY"!==org.sector_type||org.jurisdiction_uri&&""!=org.jurisdiction_uri.trim()||errTab1.push("jurisdiction_uri"),errors.push(errTab1);var errTab2=[];return org.street_and_number&&""!=org.street_and_number.trim()||errTab2.push("street_and_number"),org.zip&&""!=org.zip.trim()||errTab2.push("zip"),org.city_uri&&""!=org.city_uri.trim()||(errTab2.push("city_uri"),errTab2.push("city")),org.exist||org.country_uri&&""!=org.country_uri.trim()||(errTab2.push("country_uri"),errTab2.push("country")),errors.push(errTab2),this.setState({errors:errors}),errors},callCreateOrganization:function(org){$.ajax({url:network_service+"/create-dc-organization",type:"post",contentType:"application/json",data:JSON.stringify(org),success:function(data){data||""!==data?this.props.successHandler(data):this.props.errorHandler(data)}.bind(this),error:function(xhr,status,err){this.props.errorHandler()}.bind(this)})},callUpdateOrganization:function(org){$.ajax({url:network_service+"/update-dc-organization",type:"post",contentType:"application/json",data:JSON.stringify(org),success:function(data){data?this.props.successHandler(data):this.props.errorHandler(data)}.bind(this),error:function(xhr,status,err){this.props.errorHandler()}.bind(this)})},createOrModifOrg:function(event){event&&event.preventDefault();var org=this.props.organization,errs=this.validateFields(org);return errs[0].length+errs[1].length>0?(errs[0].length>0?this.switchTab(1):this.switchTab(2),!1):(org.exist?this.callUpdateOrganization(org):this.callCreateOrganization(org),this.switchTab(1),this.props.successHandler&&this.props.successHandler(),!0)},render:function(){var tabList=[{id:1,name:t("my.network.organization.tab1.general_information"),url:"#"},{id:2,name:t("my.network.organization.tab2.address_geolocation"),url:"#"}],organization=this.props.organization;return React.createElement("div",{className:"form-horizontal"},React.createElement(NavTab,{ref:"navtab",tabList:tabList,currentTab:this.state.activeTab},React.createElement(Tab1,{id:1,orgData:organization,errors:this.state.errors[0],switchTab:this.switchTab,valdiate:this.validateFields,typeRestriction:this.props.typeRestriction}),React.createElement(Tab2,{id:2,orgData:organization,errors:this.state.errors[1],switchTab:this.switchTab,valdiate:this.validateFields,typeRestriction:this.props.typeRestriction})))}}),Field=React.createClass({displayName:"Field",renderLabel:function(htmlFor,class_name,label,isRequired){var cn=isRequired?React.createElement("label",{className:"error"},"*"):"";return React.createElement("label",{htmlFor:htmlFor,className:class_name},label," ",cn)},render:function(){var className="control-label col-sm-3",classNameDiv="col-sm-7";return this.props.class_name&&(className=this.props.class_name),this.props.error&&(className+=" error"),this.props.class_name_div&&(classNameDiv=this.props.class_name_div),React.createElement("div",{className:"form-group"},this.renderLabel(this.props.name,className,t("my.network.organization."+this.props.name),this.props.isRequired),React.createElement("div",{className:classNameDiv},this.props.children))}}),iconClassName="control-label col-sm-2",Tab1=React.createClass({displayName:"Tab1",getInitialState:function(){return{organization:this.props.orgData,errors:[],errorMsg:""}},moveTabRight:function(){var errors=this.props.valdiate(this.state.organization);0==errors[0].length&&this.props.switchTab(this.props.id+1)},changeInput:function(fieldname,isCheckbox){return function(event){var org=this.state.organization;isCheckbox?org[fieldname]=event.target.checked:(org[fieldname]=event.target.value,"jurisdiction_uri"===fieldname&&(org.jurisdiction=event.added?event.added.name:"")),this.setState({organization:org})}.bind(this)},updateUploadedIcon:function(servedImageUrlData){var org=this.state.organization;org.iconUrl=servedImageUrlData,this.setState({organization:org,errorMsg:""})},error:function(xhr,status,err){this.setState({errorMsg:t("ui.unexpected_error")})},render:function(){-1!=$.inArray("icon",this.props.errors)&&(iconClassName+=" error"),this.state.organization=this.props.orgData;var label_regNum,sectorType=getSectorTypeLabel(this.state.organization.sector_type,this.props.typeRestriction),label_regOfficialId="",label_regActivity="",n=this.state.organization.country_uri?this.state.organization.country_uri.lastIndexOf("/"):-1,acronymCountry=n>0?this.state.organization.country_uri.substring(n+1):"";switch(acronymCountry){case"BG":label_regNum="tax_reg_num.bg",label_regActivity="tax_reg_activity.bg";break;case"IT":label_regNum="tax_reg_num.it",label_regActivity="tax_reg_activity.it";break;case"FR":label_regNum="tax_reg_num.fr",label_regOfficialId="tax_reg_official_id.fr",label_regActivity="tax_reg_activity.fr";break;case"ES":label_regNum="tax_reg_num.es",label_regActivity="tax_reg_activity.es";break;case"TR":label_regNum="tax_reg_num.tr",label_regOfficialId="tax_reg_official_id.tr",label_regActivity="tax_reg_activity.tr";break;default:label_regNum="tax_reg_num.en"}return React.createElement("div",{id:"tab1"},React.createElement("div",{className:"container-fluid"},React.createElement("div",{className:"row"},React.createElement("br",null),React.createElement("div",{className:"col-sm-15"},React.createElement(Field,{name:"legal_name",class_name:"control-label col-sm-2",error:-1!=$.inArray("legal_name",this.props.errors),isRequired:!0},React.createElement("input",{className:"form-control",id:"legal_name",type:"text",value:this.state.organization.legal_name,onChange:this.changeInput("legal_name"),disabled:this.state.organization.exist}),React.createElement("label",null,sectorType),React.createElement("label",{className:"col-sm-offset-3"},t("my.network.organization.in_activity"),":  ",React.createElement("input",{id:"in_activity",type:"checkbox",checked:this.state.organization.in_activity,onChange:this.changeInput("in_activity",!0)}))),React.createElement("br",null),React.createElement(Field,{name:"alt_name",class_name:"control-label col-sm-2"},React.createElement("input",{className:"form-control",id:"alt_name",type:"text",value:this.state.organization.alt_name,onChange:this.changeInput("alt_name")}))))," ",React.createElement("div",{className:"row"},React.createElement("div",{className:"col-sm-8"},React.createElement(Field,{name:"org_type",class_name_div:"col-sm-5"},React.createElement("input",{className:"form-control",id:"org_type",type:"text",value:this.state.organization.org_type,onChange:this.changeInput("org_type"),placeholder:t("my.network.organization.org_type.placeholder")})),React.createElement(Field,{name:label_regNum,error:-1!=$.inArray("tax_reg_num",this.props.errors),isRequired:!0},React.createElement("input",{className:"form-control",id:"tax_reg_num",type:"text",value:this.state.organization.tax_reg_num,onChange:this.changeInput("tax_reg_num"),disabled:!0})),""!==label_regOfficialId&&"COMPANY"!==this.state.organization.sector_type?React.createElement(Field,{name:label_regOfficialId},React.createElement("input",{className:"form-control",id:"tax_reg_official_id",type:"text",value:this.state.organization.tax_reg_official_id,onChange:this.changeInput("tax_reg_official_id")})):"",React.createElement(Field,{name:label_regActivity,class_name_div:"col-sm-3"},React.createElement(GeoSingleSelect2Component,{ref:"geoSearchtaxRegActivity",className:"form-control",key:this.state.organization.tax_reg_activity_uri,name:"geoSearchRegActivity",urlResources:store_service+"/dc-taxRegActivity",onChange:this.changeInput("tax_reg_activity_uri"),minimumInputLength:2,countryFilter:{country_uri:this.state.organization.country_uri},placeholder:this.state.organization.tax_reg_activity_uri?this.state.organization.tax_reg_activity_uri.substring(this.state.organization.tax_reg_activity_uri.lastIndexOf("/")+1):" "})),React.createElement("br",null),"COMPANY"===this.state.organization.sector_type?"":React.createElement(Field,{name:"jurisdiction",error:-1!=$.inArray("jurisdiction_uri",this.props.errors),isRequired:!0},React.createElement(GeoSingleSelect2Component,{ref:"geoSearchJurisdiction",className:"form-control",key:this.state.organization.jurisdiction,name:"geoSearch",urlResources:store_service+"/geographicalAreas",onChange:this.changeInput("jurisdiction_uri"),countryFilter:{country_uri:this.state.organization.country_uri},placeholder:this.state.organization.jurisdiction})),React.createElement(Field,{name:"phone_number"},React.createElement("input",{className:"form-control",id:"phone_number",type:"text",value:this.state.organization.phone_number,onChange:this.changeInput("phone_number")})),React.createElement(Field,{name:"web_site"},React.createElement("input",{className:"form-control",id:"web_site",type:"text",value:this.state.organization.web_site,onChange:this.changeInput("web_site")})),React.createElement(Field,{name:"email"},React.createElement("input",{className:"form-control",id:"email",type:"email",value:this.state.organization.email,onChange:this.changeInput("email"),placeholder:t("my.network.organization.email.placeholder")}))),React.createElement("div",{className:"col-sm-2"},React.createElement("div",{className:"form-group"},React.createElement("div",{className:"control"},React.createElement("img",{src:this.state.organization.iconUrl}),React.createElement("div",{className:"btn btn-success-inverse btn-edit"},React.createElement("i",{className:"pull-left fa fa-pencil"}),React.createElement("label",null,t("my.network.organization.change-icon")),React.createElement(FileUploadInput,{className:"edit",uploadUrl:"/media/objectIcon/"+this.state.organization.tax_reg_num+"/orgIcon.png",success:this.updateUploadedIcon,error:this.error}))))))),React.createElement("div",{className:"error"},React.createElement("label",null,this.state.errorMsg)," "),React.createElement("button",{key:"next",className:"control pull-right btn btn-primary-inverse",onClick:this.moveTabRight},t("ui.next")))}}),isInteger=function(obj){return jQuery.isNumeric(obj)&&obj.indexOf(".")<0},Tab2=React.createClass({displayName:"Tab2",getInitialState:function(){return{organization:this.props.orgData,errors:[]}},moveTabLeft:function(){var errors=this.props.valdiate(this.state.organization);0==errors[1].length&&this.props.switchTab(this.props.id-1)},changeInput:function(fieldname,isNumericField){return function(event){this.changeInputAddress(fieldname,event.target.value,isNumericField)}.bind(this)},changeInputAddress:function(fieldname,value,isNumericField){var org=this.state.organization;isNumericField&&""!==value?org[fieldname]=isInteger(value)?value.trim():org[fieldname]:org[fieldname]=value,this.setState({organization:org})},render:function(){-1!=$.inArray("icon",this.props.errors)&&(iconClassName+=" error"),this.state.organization=this.props.orgData;var sectorType=getSectorTypeLabel(this.state.organization.sector_type,this.props.typeRestriction);return React.createElement("div",{id:"tab2"},React.createElement("div",{className:"container-fluid"},React.createElement("div",{className:"row"},React.createElement("br",null),React.createElement("div",{className:"col-sm-15"},React.createElement(Field,{name:"legal_name",class_name:"control-label col-sm-2",error:-1!=$.inArray("name",this.props.errors)},React.createElement("input",{className:"form-control",id:"legal_name",type:"text",value:this.state.organization.legal_name,onChange:this.changeInput("legal_name"),disabled:!0}),React.createElement("label",null,sectorType),React.createElement("label",{className:"col-sm-offset-3"},t("my.network.organization.in_activity"),":  ",React.createElement("input",{id:"in_activity",type:"checkbox",checked:this.state.organization.in_activity,disabled:!0}))),React.createElement("br",null)))," ",React.createElement("div",{className:"row"},React.createElement("div",{className:"col-sm-8"},React.createElement(AddressComponent,{errors:this.props.errors,addressContainer:this.state.organization,changeInput:this.changeInputAddress,addressType:"ORG",disabled:!0}))," ",React.createElement("div",{className:"col-sm-4"})))," ",React.createElement("button",{key:"next",className:"control pull-right btn btn-primary-inverse",onClick:this.moveTabLeft},t("ui.previous")))}}),AddressComponent=React.createClass({displayName:"AddressComponent",componentDidMount:function(){},changeInput:function(fieldname,isNumericField){return changeInput=this.props.changeInput,function(event){event.added?(changeInput(fieldname,event.added.name,isNumericField),changeInput(fieldname+"_uri",event.target.value,isNumericField)):"country"===fieldname?(changeInput(fieldname,event.target.selectedOptions[0].label,isNumericField),changeInput(fieldname+"_uri",event.target.value,isNumericField),changeInput("city","",isNumericField),changeInput("city_uri","",isNumericField),this.refs.geoSearchCity&&this.refs.geoSearchCity.clear()):changeInput(fieldname,event.target.value,isNumericField)}.bind(this)},render:function(){var address=this.props.addressContainer,addressType=this.props.addressType?this.props.addressType:"";return React.createElement("div",null,React.createElement(Field,{name:"street_and_number",error:-1!=$.inArray("street_and_number",this.props.errors),isRequired:"ORG"==addressType?!0:!1},React.createElement("input",{className:"form-control",id:"street_and_number",type:"text",value:address.street_and_number,onChange:this.changeInput("street_and_number")})),React.createElement(Field,{name:"additional_address_field"},React.createElement("input",{className:"form-control",id:"additional_address_field",type:"text",value:address.additional_address_field,onChange:this.changeInput("additional_address_field")})),"ORG"!==addressType?"":React.createElement(Field,{name:"po_box"},React.createElement("input",{className:"form-control",id:"po_box",type:"text",value:address.po_box,onChange:this.changeInput("po_box")})),React.createElement(Field,{name:"city",error:-1!=$.inArray("city",this.props.errors),isRequired:!0},React.createElement(GeoSingleSelect2Component,{ref:"geoSearchCity",className:"form-control",name:"geoSearchCity",key:address.city,urlResources:store_service+"/dc-cities",onChange:this.changeInput("city"),countryFilter:{country_uri:address.country_uri},placeholder:address.city})),React.createElement(Field,{name:"zip",class_name_div:"col-sm-3",error:-1!=$.inArray("zip",this.props.errors),isRequired:!0},React.createElement("input",{className:"form-control",id:"zip",type:"text",maxLength:6,value:address.zip,onChange:this.changeInput("zip",!0)})),"ORG"!==addressType?"":React.createElement(Field,{name:"cedex",class_name_div:"col-sm-2"},React.createElement("input",{className:"form-control",id:"cedex",type:"cedex",maxLength:3,value:address.cedex,onChange:this.changeInput("cedex",!0)})),React.createElement(Field,{name:"country",class_name_div:"col-sm-5",error:-1!=$.inArray("country_uri",this.props.errors),isRequired:!0},React.createElement(CountrySelect,{className:"form-control",url:store_service+"/dc-countries",value:address.country_uri,onChange:this.changeInput("country"),disabled:this.props.disabled})))}}); diff --git a/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.jsx.js b/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.jsx.js index 1adf11279..b1980b01c 100644 --- a/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.jsx.js +++ b/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.jsx.js @@ -332,11 +332,12 @@ var CountrySelect = React.createClass({ render: function() { var label = this.props.defLabel; if(!this.props.value || this.props.value === ""){ - this.props.value = this.getValue(label); //This is to load the country_uri that couldn't be set + //This is to load the country_uri that couldn't be set | + this.props.value = (this.getValue(label)); // decodeURIComponent() } // the parameter "value=" is selected option. Default selected option can either be set here. Using browser-base fonctuion decodeURIComponent() return ( ); diff --git a/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.min.js b/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.min.js index 4826dad8c..10539ea0a 100644 --- a/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.min.js +++ b/portal-parent/oasis-portal-front/src/main/resources/public/js/network/search-organization.min.js @@ -1 +1 @@ -var SearchOrganization=React.createClass({displayName:"SearchOrganization",componentDidMount:function(){$(this.refs.modal.getDOMNode()).on("shown.bs.modal",function(){$("input",this).first().focus()})},show:function(){this.refs.form.resetSearchVals(),this.refs.form.getProfileInfo(),this.refs.modal.open()},close:function(){this.refs.modal.close(),this.props.successHandler&&this.props.successHandler()},openCreateOrModify:function(organization){organization?(this.close(),this.refs.createOrgDialog.show(organization)):this.refs.modalError.open()},searchOrg:function(){this.refs.form.searchOrganization()},render:function(){var buttonLabels={cancel:t("ui.cancel"),save:t("ui.search")};return React.createElement("div",null,React.createElement(Modal,{ref:"modal",title:t("my.network.find-or-create-organization"),successHandler:this.searchOrg,buttonLabels:buttonLabels},React.createElement(SearchOrganizationForm,{ref:"form",successHandler:this.openCreateOrModify})),React.createElement(CreateOrModifyOrganizationModal,{ref:"createOrgDialog",successHandler:this.close}),React.createElement(Modal,{ref:"modalError",title:t("ui.something_went_wrong_title"),infobox:!0,cancelHandler:null},React.createElement("div",null,React.createElement("h5",null,t("search.organization.cannot-be-used")))))}}),SearchOrganizationForm=React.createClass({displayName:"SearchOrganizationForm",getInitialState:function(){var sector_type="COMPANY",tax_reg_num="",legal_name="";return{orgSearchData:{contact_name:"",contact_lastname:"",contact_email:"",sector_type:sector_type,country:"",country_uri:"",legal_name:legal_name,tax_reg_num:tax_reg_num},errors:[],searching:!1}},getProfileInfo:function(){$.ajax({url:network_service+"/general-user-info",type:"get",contentType:"json",success:function(data){var state=this.state;state.orgSearchData.contact_name=data.user_name,state.orgSearchData.contact_lastname=data.user_lastname,state.orgSearchData.contact_email=data.user_email,state.orgSearchData.country=data.address.country,this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},resetSearchVals:function(event){this.state.orgSearchData={contact_name:"",contact_lastname:"",contact_email:"",sector_type:this.state.orgSearchData.sector_type,country:"",country_uri:"",legal_name:"",tax_reg_num:""}},searchOrganization:function(event){if(event&&event.preventDefault(),!this.state.searching){var org=this.state.orgSearchData,errors=[];org.contact_name&&""!=org.contact_name.trim()||errors.push("name"),org.contact_lastname&&""!=org.contact_lastname.trim()||errors.push("lastname"),org.contact_email&&""!=org.contact_email.trim()||errors.push("email"),org.country_uri&&""!=org.country_uri.trim()||errors.push("country"),org.legal_name&&""!=org.legal_name.trim()||errors.push("legal_name"),org.tax_reg_num&&""!=org.tax_reg_num.trim()||errors.push("tax_reg_num"),org.sector_type&&""!=org.sector_type.trim()||errors.push("sector_type"),0==errors.length?(this.state.searching=!0,$.ajax({url:network_service+"/search-organization",type:"get",contentType:"json",data:this.state.orgSearchData,success:function(data){if(this.props.successHandler){var organization=data,state={searching:!1,errors:[]};this.setState(state),this.props.successHandler(organization)}}.bind(this),error:function(xhr,status,err){var state=this.state;state.errors=["general"],state.searching=!1,this.setState(state)}.bind(this)})):(this.state.errors=errors,this.setState(this.state))}},changeInput:function(fieldname){return function(event){var org=this.state.orgSearchData;"country"===fieldname?(org[fieldname+"_uri"]=event.target.value,org[fieldname]=event.target.selectedOptions[0].label):org[fieldname]=event.target.value,this.setState({orgSearchData:org,errors:[],searching:!1})}.bind(this)},toggleType:function(event){var org=this.state.orgSearchData;org.sector_type=event.target.value,this.setState({orgSearchData:org,errors:[],searching:!1})},renderLabel:function(htmlFor,class_name,label){var cn=-1!=$.inArray(class_name,this.state.errors)?"col-sm-3 control-label error":"col-sm-3 control-label";return React.createElement("label",{htmlFor:htmlFor,className:cn},label,React.createElement("label",{className:"error"},"*"))},render:function(){return React.createElement("form",{onSubmit:this.searchOrganization,className:"form-horizontal"},React.createElement("h4",null,t("search.contact.title")),React.createElement(ContactSearchFormControl,{renderLabel:this.renderLabel,orgSearchData:this.state.orgSearchData,changeInput:this.changeInput}),React.createElement("h4",null,t("search.organization.title")),React.createElement(OrganizationSearchFormControl,{errors:this.state.errors,renderLabel:this.renderLabel,orgSearchData:this.state.orgSearchData,changeInput:this.changeInput,toggleType:this.toggleType}))}}),ContactSearchFormControl=React.createClass({displayName:"ContactSearchFormControl",render:function(){return React.createElement("div",{className:"form-group"},React.createElement("div",{className:"form-group"},this.props.renderLabel("contact-name","name",t("search.contact.name")),React.createElement("div",{className:"col-sm-8"},React.createElement("input",{type:"text",className:"form-control",value:this.props.orgSearchData.contact_name,onChange:this.props.changeInput("contact_name"),maxLength:100,placeholder:t("search.contact.name")}))),React.createElement("div",{className:"form-group"},this.props.renderLabel("contact-lastname","lastname",t("search.contact.lastname")),React.createElement("div",{className:"col-sm-8"},React.createElement("input",{type:"text",className:"form-control",value:this.props.orgSearchData.contact_lastname,onChange:this.props.changeInput("contact_lastname"),maxLength:100,placeholder:t("search.contact.lastname")}))),React.createElement("div",{className:"form-group"},this.props.renderLabel("contact-email","email",t("search.contact.email")),React.createElement("div",{className:"col-sm-8"},React.createElement("input",{type:"text",className:"form-control",value:this.props.orgSearchData.contact_email,onChange:this.props.changeInput("contact_email"),maxLength:100,placeholder:t("search.contact.email")}))))}}),OrganizationSearchFormControl=React.createClass({displayName:"OrganizationSearchFormControl",renderType:function(){var restriction=this.props.typeRestriction?this.props.typeRestriction:{company:!0,public_body:!0},public_body=null;restriction.public_body&&(public_body=React.createElement("label",{className:"radio-inline col-sm-3"},React.createElement("input",{type:"radio",value:"PUBLIC_BODY",checked:"PUBLIC_BODY"==this.props.orgSearchData.sector_type,onChange:this.props.toggleType},t("search.organization.sector-type.PUBLIC_BODY"))));var company=null;restriction.company&&(company=React.createElement("label",{className:"radio-inline col-sm-3"},React.createElement("input",{type:"radio",value:"COMPANY",checked:"COMPANY"==this.props.orgSearchData.sector_type,onChange:this.props.toggleType},t("search.organization.sector-type.COMPANY"))));var sectorTypeClassName="col-sm-3 control-label";return sectorTypeClassName=-1!=$.inArray("sector_type",this.props.errors)?sectorTypeClassName+" error":sectorTypeClassName,React.createElement("div",{className:"form-group"},React.createElement("label",{htmlFor:"organization-sector-type",className:sectorTypeClassName},t("search.organization.sector-type")),public_body,company)},render:function(){var label_regNum;switch(this.props.orgSearchData.country){case"България":label_regNum=t("search.organization.business-id.bg");break;case"Italia":label_regNum=t("search.organization.business-id.it");break;case"France":label_regNum=t("search.organization.business-id.fr");break;case"España":label_regNum=t("search.organization.business-id.es");break;case"Türkiye":label_regNum=t("search.organization.business-id.tr");break;default:label_regNum=t("search.organization.business-id.en")}return this.props.orgSearchData.country_uri&&""!==this.props.orgSearchData.country_uri||!this.refs.orgCountrySelect||(this.props.orgSearchData.country_uri=this.refs.orgCountrySelect.getValue(this.props.orgSearchData.country)),React.createElement("div",{className:"form-group"},this.renderType(),React.createElement("div",{className:"form-group"},this.props.renderLabel("organization-country-name","country",t("search.organization.country")),React.createElement("div",{className:"col-sm-5"},React.createElement(CountrySelect,{ref:"orgCountrySelect",className:"form-control",url:store_service+"/dc-countries",defLabel:this.props.orgSearchData.country,onChange:this.props.changeInput("country")}))),React.createElement("div",{className:"form-group"},this.props.renderLabel("organization-name","legal_name",t("search.organization.legal-name")),React.createElement("div",{className:"col-sm-8"},React.createElement("input",{type:"text",className:"form-control",value:this.props.orgSearchData.legal_name,onChange:this.props.changeInput("legal_name"),maxLength:100,placeholder:t("search.organization.legal-name")}))),React.createElement("div",{className:"form-group"},this.props.renderLabel("organization-business-id","tax_reg_num",label_regNum),React.createElement("div",{className:"col-sm-8"},React.createElement("input",{type:"text",className:"form-control",value:this.props.orgSearchData.tax_reg_num,onChange:this.props.changeInput("tax_reg_num"),maxLength:20,placeholder:t(label_regNum)}))))}}),CountrySelect=React.createClass({displayName:"CountrySelect",propTypes:{url:React.PropTypes.string.isRequired},getInitialState:function(){return{options:[],countries:[]}},onChange:function(event){this.props.onChange(event)},componentDidMount:function(){this.props.url&&$.ajax({url:this.props.url,type:"get",dataType:"json",data:{q:" "},success:function(data){var areas=data.areas,options=[{value:"",label:""}];areas=areas.filter(function(n){return null!==n});for(var i=0;i{t('launch')}; - } else { + /*} else { launchOrInstallButton = (); - } + }*/ } else { launchOrInstallButton = ( ); } diff --git a/portal-parent/oasis-portal-front/src/main/resources/public/js/store/store-install-app.min.js b/portal-parent/oasis-portal-front/src/main/resources/public/js/store/store-install-app.min.js index 4c707b46a..de16cc200 100644 --- a/portal-parent/oasis-portal-front/src/main/resources/public/js/store/store-install-app.min.js +++ b/portal-parent/oasis-portal-front/src/main/resources/public/js/store/store-install-app.min.js @@ -1 +1 @@ -var AppModal=React.createClass({displayName:"AppModal",getInitialState:function(){return{app:{rating:0,rateable:!0,tos:"",policy:"",longdescription:"",screenshots:null},orgs:[],selectedOrg:jQuery.extend(!0,{},default_org_data.organization),createOrg:!1,buying:!1,installing:!1,isInstalled:!1,error:!1}},componentDidMount:function(){$(this.refs.modal.getDOMNode()).on("hide.bs.modal",function(event){history.pushState({},"store",store_root)}.bind(this))},componentDidUpdate:function(){var desc=$(this.getDOMNode()).find(".app-description table");desc.addClass("table table-bordered table-condensed table-striped")},loadApp:function(){$.ajax({url:store_service+"/details/"+this.props.app.type+"/"+this.props.app.id,type:"get",dataType:"json",success:function(data){var state=this.state;state.app=data,this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},loadOrgs:function(){$.ajax({url:store_service+"/organizations/"+this.props.app.type+"/"+this.props.app.id,type:"get",dataType:"json",success:function(data){var state=this.state;state.orgs=data,this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},open:function(){this.setState(this.getInitialState());var href=store_root+"/"+this.props.app.type+"/"+this.props.app.id;"function"==typeof history.pushState&&history.pushState({},"application",href),this.loadApp(),logged_in&&this.loadOrgs(),this.refs.modal.open()},close:function(){this.state.isInstalled&&(window.location="/my/dashboard")},doInstallApp:function(organization,updateUserData){var state=this.state;state.installing=!1,state.buying=!0,this.setState(state);var request;updateUserData?(request=updateUserData,request.appId=this.props.app.id,request.appType=this.props.app.type):request={appId:this.props.app.id,appType:this.props.app.type},organization&&(request.organizationId=organization),$.ajax({url:store_service+"/buy",type:"post",data:JSON.stringify(request),contentType:"application/json",success:function(data){if(data.success)this.displaySucessfulInstallForm();else{var state=this.state;state.buying=!1,state.error=!0,this.setState(state)}}.bind(this),error:function(xhr,status,err){var state=this.state;state.buying=!1,this.setState(state)}.bind(this)})},orgCreated:function(org){var state=this.state;state.createOrg=!1,org&&this.doInstallApp(org.id),this.setState(state)},doCreateOrg:function(){this.refs.tabbedForm&&this.refs.tabbedForm.createOrModifOrg()},cancelCreateOrg:function(){var state=this.state;state.createOrg=!1,this.setState(state)},rateApp:function(rate){$.ajax({url:store_service+"/rate/"+this.props.app.type+"/"+this.props.app.id,type:"post",contentType:"application/json",data:JSON.stringify({rate:rate}),success:function(){var state=this.state;state.app.rateable=!1,state.app.rating=rate,this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},displayInstallForm:function(){var state=this.state;state.installing=!0,this.setState(state)},displaySucessfulInstallForm:function(){var state=this.state;state.buying=!1,state.isInstalled=!0,this.setState(state)},continueInstallProcess:function(){var state=this.state;state.installType=this.refs.instalForm.getInstallType();var installData=this.refs.instalForm.getInstallData();if("ORG"===state.installType){var orgSearchData=this.refs.instalForm.getOrgSearchData();orgSearchData.contact_name=installData.contact.contact_name,orgSearchData.contact_lastname=installData.contact.contact_lastname,orgSearchData.contact_email=installData.contact.contact_email,state.selectedOrg.typeInstallOrg=orgSearchData.typeInstallOrg,"NEW-ORGS"===orgSearchData.typeInstallOrg?$.ajax({url:network_service+"/search-organization",type:"get",contentType:"json",data:orgSearchData,success:function(data){data&&!data.exist&&data.sector_type===orgSearchData.sector_type&&data.tax_reg_num===orgSearchData.tax_reg_num&&data.legal_name===orgSearchData.legal_name?(state.installing=!1,state.createOrg=!0,state.selectedOrg=data,state.errors=[],this.setState(state)):(this.refs.modalError.open(),this.setState(state))}.bind(this),error:function(xhr,status,err){var state=this.state;state.errors=["general"],this.setState(state)}.bind(this)}):(state.installing=!1,this.doInstallApp(orgSearchData.selectedOrgId,orgSearchData))}else{var orgSearchData=this.refs.instalForm.state.installData.address;orgSearchData.contact_name=installData.contact.contact_name,orgSearchData.contact_lastname=installData.contact.contact_lastname,orgSearchData.contact_email=installData.contact.contact_email,this.doInstallApp(null,orgSearchData)}},orgTypeRestriction:function(){return{company:this.props.app.target_companies,public_body:this.props.app.target_publicbodies}},renderCreateNewOrganization:function(){return React.createElement("div",null,React.createElement("h3",null,this.state.selectedOrg.exist?t("modify-org"):t("create-new-org")),React.createElement(CreateOrModifyOrganizationForm,{ref:"tabbedForm",successHandler:this.orgCreated,typeRestriction:this.orgTypeRestriction(),organization:this.state.selectedOrg}),React.createElement("div",{className:"col-sm-4 col-sm-offset-8"},React.createElement("a",{className:"btn btn-default",onClick:this.cancelCreateOrg},t("ui.cancel")),React.createElement("a",{className:"btn btn-primary",onClick:this.doCreateOrg},t("create"))))},renderBuying:function(){return React.createElement("h3",null," ",React.createElement("i",{className:"fa fa-spinner fa-spin"})," ",t("buying"))},renderInstallingForm:function(){return React.createElement(InstallForm,{ref:"instalForm",installApp:this.installApp,url:this.state.app.serviceUrl,app:this.props.app,orgs:this.state.orgs,continueInstallProcess:this.continueInstallProcess})},renderAppDescription:function(){return React.createElement(AppDescriptionComponent,{app:this.props.app,stateApp:this.state.app,rateApp:this.rateApp,onInstallButton:this.displayInstallForm,error:this.state.error})},renderSucessfulInstallationForm:function(){return React.createElement("div",null,React.createElement("div",{className:"form-horizontal"},React.createElement("i",{id:"success-app-install",className:"fa fa-check pull-left col-sm-offset-1"}),React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-1")),React.createElement("br",null)),this.props.app.paid?React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-2")),React.createElement("br",null)):"","PERSONAL"===this.state.installType?"":React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-3")),React.createElement("br",null)),React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-4")),React.createElement("br",null))))},render:function(){var content=null;return content=this.state.buying?this.renderBuying():this.state.createOrg?this.renderCreateNewOrganization():this.state.installing?this.renderInstallingForm():this.state.isInstalled?this.renderSucessfulInstallationForm():this.renderAppDescription(),React.createElement("div",null,React.createElement(Modal,{ref:"modal",large:!0,infobox:!0,title:this.props.app.name,cancelHandler:this.close},content),React.createElement(Modal,{ref:"modalError",title:t("ui.something_went_wrong_title"),infobox:!0,cancelHandler:null},React.createElement("div",null,React.createElement("h5",null,t("search.organization.cannot-be-used")))))}}),converter=new Showdown.converter({extensions:["table"]}),AppDescriptionComponent=React.createClass({displayName:"AppDescriptionComponent",render:function(){var stateApp=this.props.stateApp,carousel=stateApp.screenshots&&stateApp.screenshots.length>0?React.createElement("div",{className:"row"},React.createElement(Carousel,{images:stateApp.screenshots})):null,error=this.props.error?React.createElement("div",{className:"alert alert-danger alert-dismissible",role:"alert"},React.createElement("button",{type:"button",className:"close","data-dismiss":"alert"},React.createElement("span",{"aria-hidden":"true"},"×"),React.createElement("span",{className:"sr-only"},t("ui.close"))),React.createElement("strong",null,t("sorry"))," ",t("could-not-install-app")):null,rateInfo=null;logged_in&&!stateApp.rateable&&(rateInfo=React.createElement("p",null,t("already-rated")));var launchOrInstallButton,description=converter.makeHtml(stateApp.longdescription);if(this.props.app.installed)launchOrInstallButton=this.props.stateApp?this.props.stateApp.serviceUrl?React.createElement("a",{className:"btn btn-primary",href:this.props.stateApp.serviceUrl,target:"_new"},t("launch")):React.createElement("label",null,t("installed")):React.createElement("label",null," ",React.createElement("i",{className:"fa fa-spinner fa-spin"})," ");else{var installButton=logged_in?React.createElement("button",{className:"btn btn-primary",onClick:this.props.onInstallButton},t("install")):React.createElement("a",{className:"btn btn-primary-inverse",href:store_root+"/login?appId="+this.props.app.id+"&appType="+this.props.app.type},t("install"));launchOrInstallButton=installButton}return React.createElement("div",null,React.createElement("div",{className:"row"},React.createElement("div",{className:"col-sm-1"},React.createElement("img",{src:this.props.app.icon,alt:this.props.app.name})),React.createElement("div",{className:"col-sm-7"},React.createElement("div",null,React.createElement("p",{className:"appname"},this.props.app.name),React.createElement("p",null,t("by")," ",this.props.app.provider))),React.createElement("div",{className:"col-sm-4 center-container install-application"},launchOrInstallButton)),React.createElement("div",{className:"row"},React.createElement(Rating,{rating:stateApp.rating,rateable:stateApp.rateable,rate:this.props.rateApp}),rateInfo),error,carousel,React.createElement("div",{className:"row"},React.createElement("div",{className:"col-md-6 app-description",dangerouslySetInnerHTML:{__html:description}}),React.createElement("div",{className:"col-md-6"},React.createElement("p",null,t("agree-to-tos")),React.createElement("p",null,React.createElement("a",{href:stateApp.tos,target:"_new"},t("tos"))),React.createElement("p",null,React.createElement("a",{href:stateApp.policy,target:"_new"},t("privacy"))))))}}),InstallForm=React.createClass({displayName:"InstallForm",getInitialState:function(){return this.getProfileInfo(),{installType:"PERSONAL",errors:[],installData:{contact:{contact_name:"",contact_lastname:"",contact_email:""},address:{exist:!1,street_and_number:"",additional_address_field:"",city:"",zip:"",country_uri:"",cedex:"",po_box:""}}}},getProfileInfo:function(){$.ajax({url:network_service+"/general-user-info",type:"get",contentType:"json",success:function(data){var state=this.state;state.installData.contact.contact_name=data.user_name,state.installData.contact.contact_lastname=data.user_lastname,state.installData.contact.contact_email=data.user_email,data.address&&(state.installData.address.street_and_number=data.address.street_address,state.installData.address.city=data.address.locality,state.installData.address.zip=data.address.postal_code,state.installData.address.country=data.address.country),this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},getInstallType:function(){var installTypeRestrictions={personal:this.hasCitizens(),org:this.hasOrganizations()};return"PERSONAL"===this.state.installType&&installTypeRestrictions.personal===!1?"ORG":"ORG"===this.state.installType&&installTypeRestrictions.org===!1?"PERSONAL":this.state.installType},getInstallData:function(){return this.state.installData},getOrgSearchData:function(){return this.refs.setOrgComponent.getOrgSearchData()},isOnlyForCitizens:function(){return this.props.app.target_citizens&&!this.props.app.target_companies&&!this.props.app.target_publicbodies},hasCitizens:function(){return this.props.app.target_citizens},hasOrganizations:function(){return this.props.app.target_companies||this.props.app.target_publicbodies},toggleType:function(event){var installType=this.state.installType;installType=event.target.value,this.setState({installType:installType})},renderInstallType:function(){var installTypeRestrictions={personal:this.hasCitizens(),org:this.hasOrganizations()},installType=this.getInstallType(),personal=installTypeRestrictions.personal?React.createElement("div",{className:"radio col-sm-offset-2"}," ",React.createElement("label",null,React.createElement("input",{type:"radio",value:"PERSONAL",checked:"PERSONAL"==installType,onChange:this.toggleType},t("install.org.type.PERSONAL")))," "):null,org=installTypeRestrictions.org?React.createElement("div",{className:"radio col-sm-offset-2"}," ",React.createElement("label",null,React.createElement("input",{type:"radio",value:"ORG",checked:"ORG"==installType,onChange:this.toggleType},t("install.org.type.ORG")))," "):null,sectorTypeClassName="col-sm-3 control-label ";return sectorTypeClassName=-1!=$.inArray("sector_type",this.props.errors)?sectorTypeClassName+" error":sectorTypeClassName,React.createElement("div",{className:"form-group"},personal,org)},renderLabel:function(htmlFor,class_name,label){var cn=-1!=$.inArray(class_name,this.state.errors)?"col-sm-3 control-label error":"col-sm-3 control-label";return React.createElement("label",{htmlFor:htmlFor,className:cn},label,React.createElement("label",{className:"error"},"*"))},changeInputContact:function(fieldname){return function(event){var org=this.state.installData;org.contact[fieldname]=event.target.value,this.setState({installData:org,errors:[]})}.bind(this)},changeInputAddress:function(fieldname,value,isNumericField){var org=this.state.installData;isNumericField&&""!==value?org.address[fieldname]=isInteger(value)?value.trim():org.address[fieldname]:org.address[fieldname]=value,this.setState({installData:org,errors:[]})},validateContact:function(){var errs=[],contact=this.state.installData.contact;return contact.contact_name&&""!=contact.contact_name.trim()||errs.push("name"),contact.contact_lastname&&""!=contact.contact_lastname.trim()||errs.push("lastname"),contact.contact_email&&""!=contact.contact_email.trim()||errs.push("email"),this.setState({errors:errs}),errs.length>0?!1:!0},validateAddress:function(){var errs=this.state.errors,address=this.state.installData.address;return address.city_uri&&""!=address.city.trim()||(errs.push("city_uri"),errs.push("city")),address.zip&&""!=address.zip.trim()||errs.push("zip"),address.country_uri&&""!=address.country_uri.trim()||errs.push("country_uri"),this.setState({errors:errs}),errs.length>0?!1:!0},validateAndContinue:function(){var installType=this.getInstallType();"PERSONAL"===installType?this.validateContact()&&this.validateAddress()&&this.props.continueInstallProcess():"ORG"===installType&&this.validateContact()&&this.refs.setOrgComponent&&this.refs.setOrgComponent.validate()&&this.props.continueInstallProcess()},render:function(){var installType=this.getInstallType();return React.createElement("div",{className:"form-horizontal"},this.renderInstallType(),React.createElement("h4",null,t("search.contact.title")),React.createElement(ContactSearchFormControl,{renderLabel:this.renderLabel,orgSearchData:this.state.installData.contact,changeInput:this.changeInputContact}),"PERSONAL"===installType||"service"===this.props.app.type?React.createElement("div",null,React.createElement("h4",null,t("search.contact.address.title")),React.createElement(AddressComponent,{ref:"addressComponent",errors:this.state.errors,addressContainer:this.state.installData.address,changeInput:this.changeInputAddress})):React.createElement("div",null,React.createElement("h4",null,t("search.organization.title")),React.createElement(SetOrganizationComponent,{ref:"setOrgComponent",url:this.props.url,app:this.props.app,orgs:this.props.orgs,isOnlyForCitizens:this.isOnlyForCitizens,onChangeSelectedOrg:this.onChangeSelectedOrg})),React.createElement("a",{className:"btn btn-primary pull-right",onClick:this.validateAndContinue},t("ui.next")))}});SetOrganizationComponent=React.createClass({displayName:"SetOrganizationComponent",getInitialState:function(){return{orgSearchData:{contact_name:"",contact_lastname:"",contact_email:"",sector_type:"",country:"France",legal_name:"",tax_reg_num:"",typeInstallOrg:"NEW-ORGS",selectedOrgId:""},errors:[]}},getOrgSearchData:function(){return this.state.orgSearchData},orgTypeRestriction:function(){return{company:this.props.app.target_companies,public_body:this.props.app.target_publicbodies}},onChangeOrgInput:function(fieldname){return function(event){var org=this.state.orgSearchData;"country"===fieldname?(org[fieldname+"_uri"]=event.target.value,org[fieldname]=event.target.selectedOptions[0].label):org[fieldname]=event.target.value,this.setState({orgSearchData:org,errors:[]})}.bind(this)},toggleInstallOrgType:function(event){var org=this.state.orgSearchData;org.typeInstallOrg=event.target.value,org.selectedOrgId=this.props.orgs[0].id,this.setState({orgSearchData:org,errors:[]})},toggleSectorType:function(event){var org=this.state.orgSearchData;org.sector_type=event.target.value,this.setState({orgSearchData:org,errors:[]})},renderOrganizations:function(){var opts=[];return this.props.orgs.map(function(org){opts.push(React.createElement("option",{key:org.id,className:"action-select-option",value:org.id},org.name))}.bind(this)),React.createElement("select",{className:"btn btn-default dropdown-toggle",onChange:this.onChangeOrgInput("selectedOrg")},opts)},validate:function(){var state=this.state,errors=[],orgSearchData=state.orgSearchData;return"EXISTING-ORGS"===orgSearchData.typeInstallOrg?""===orgSearchData.selectedOrgId.trim()&&errors.push("typeInstallOrg"):(orgSearchData.sector_type&&""!=orgSearchData.sector_type.trim()||errors.push("sector_type"),orgSearchData.country_uri&&""!=orgSearchData.country_uri.trim()||errors.push("country"),orgSearchData.legal_name&&""!=orgSearchData.legal_name.trim()||errors.push("legal_name"),orgSearchData.tax_reg_num&&""!=orgSearchData.tax_reg_num.trim()||errors.push("tax_reg_num")),state.errors=errors,this.setState(state),state.errors.length>0?!1:!0},renderLabel:function(htmlFor,class_name,label){var cn=-1!=$.inArray(class_name,this.state.errors)?"col-sm-3 control-label error":"col-sm-3 control-label";return React.createElement("label",{htmlFor:htmlFor,className:cn},label,React.createElement("label",{className:"error"},"*"))},render:function(){return React.createElement("div",{className:"form-group"},!this.props.isOnlyForCitizens()&&this.props.orgs&&this.props.orgs.length>0?React.createElement("div",{className:"radio col-sm-offset-2"},React.createElement("label",null,React.createElement("input",{type:"radio",value:"EXISTING-ORGS",checked:"EXISTING-ORGS"==this.state.orgSearchData.typeInstallOrg,onChange:this.toggleInstallOrgType}),t("search.organization.selection.existing"),"    "),this.renderOrganizations()):"",React.createElement("div",{className:"radio col-sm-offset-2"},React.createElement("label",null,React.createElement("input",{type:"radio",value:"NEW-ORGS",checked:"NEW-ORGS"==this.state.orgSearchData.typeInstallOrg,onChange:this.toggleInstallOrgType}),t("search.organization.selection.new")),React.createElement(OrganizationSearchFormControl,{errors:this.state.errors,renderLabel:this.renderLabel,typeRestriction:this.orgTypeRestriction(),orgSearchData:this.state.orgSearchData,changeInput:this.onChangeOrgInput,toggleType:this.toggleSectorType})))}});var Carousel=React.createClass({displayName:"Carousel",getInitialState:function(){return{index:0}},back:function(){var index=this.state.index;index=Math.max(0,index-1),this.setState({index:index})},forward:function(){var index=this.state.index;index=Math.min(this.props.images.length,index+1),this.setState({index:index})},render:function(){if(!this.props.images)return null;var back=null;this.state.index>0&&(back=React.createElement("a",{className:"back",onClick:this.back},React.createElement("i",{className:"fa fa-chevron-left"})));var forward=null;return this.state.indexrating?"0"+10*rating:10*rating;return className="rating-static rating-"+rt,React.createElement("div",{className:className,onMouseEnter:this.startEditing,onMouseLeave:this.stopEditing,onMouseMove:this.mouseMove,onClick:this.rate})}}); +var AppModal=React.createClass({displayName:"AppModal",getInitialState:function(){return{app:{rating:0,rateable:!0,tos:"",policy:"",longdescription:"",screenshots:null},orgs:[],selectedOrg:jQuery.extend(!0,{},default_org_data.organization),createOrg:!1,buying:!1,installing:!1,isInstalled:!1,error:!1}},componentDidMount:function(){$(this.refs.modal.getDOMNode()).on("hide.bs.modal",function(event){history.pushState({},"store",store_root)}.bind(this))},componentDidUpdate:function(){var desc=$(this.getDOMNode()).find(".app-description table");desc.addClass("table table-bordered table-condensed table-striped")},loadApp:function(){$.ajax({url:store_service+"/details/"+this.props.app.type+"/"+this.props.app.id,type:"get",dataType:"json",success:function(data){var state=this.state;state.app=data,this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},loadOrgs:function(){$.ajax({url:store_service+"/organizations/"+this.props.app.type+"/"+this.props.app.id,type:"get",dataType:"json",success:function(data){var state=this.state;state.orgs=data,this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},open:function(){this.setState(this.getInitialState());var href=store_root+"/"+this.props.app.type+"/"+this.props.app.id;"function"==typeof history.pushState&&history.pushState({},"application",href),this.loadApp(),logged_in&&this.loadOrgs(),this.refs.modal.open()},close:function(){this.state.isInstalled&&(window.location="/my/dashboard")},doInstallApp:function(organization,updateUserData){var state=this.state;state.installing=!1,state.buying=!0,this.setState(state);var request;updateUserData?(request=updateUserData,request.appId=this.props.app.id,request.appType=this.props.app.type):request={appId:this.props.app.id,appType:this.props.app.type},organization&&(request.organizationId=organization),$.ajax({url:store_service+"/buy",type:"post",data:JSON.stringify(request),contentType:"application/json",success:function(data){if(data.success)this.displaySucessfulInstallForm();else{var state=this.state;state.buying=!1,state.error=!0,this.setState(state)}}.bind(this),error:function(xhr,status,err){var state=this.state;state.buying=!1,this.setState(state)}.bind(this)})},orgCreated:function(org){var state=this.state;state.createOrg=!1,org&&this.doInstallApp(org.id),this.setState(state)},doCreateOrg:function(){this.refs.tabbedForm&&this.refs.tabbedForm.createOrModifOrg()},cancelCreateOrg:function(){var state=this.state;state.createOrg=!1,this.setState(state)},rateApp:function(rate){$.ajax({url:store_service+"/rate/"+this.props.app.type+"/"+this.props.app.id,type:"post",contentType:"application/json",data:JSON.stringify({rate:rate}),success:function(){var state=this.state;state.app.rateable=!1,state.app.rating=rate,this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},displayInstallForm:function(){var state=this.state;state.installing=!0,this.setState(state)},displaySucessfulInstallForm:function(){var state=this.state;state.buying=!1,state.isInstalled=!0,this.setState(state)},continueInstallProcess:function(){var state=this.state;state.installType=this.refs.instalForm.getInstallType();var installData=this.refs.instalForm.getInstallData();if("ORG"===state.installType){var orgSearchData=this.refs.instalForm.getOrgSearchData();orgSearchData.contact_name=installData.contact.contact_name,orgSearchData.contact_lastname=installData.contact.contact_lastname,orgSearchData.contact_email=installData.contact.contact_email,state.selectedOrg.typeInstallOrg=orgSearchData.typeInstallOrg,"NEW-ORGS"===orgSearchData.typeInstallOrg?$.ajax({url:network_service+"/search-organization",type:"get",contentType:"json",data:orgSearchData,success:function(data){data&&!data.exist&&data.sector_type===orgSearchData.sector_type&&data.tax_reg_num===orgSearchData.tax_reg_num&&data.legal_name===orgSearchData.legal_name?(state.installing=!1,state.createOrg=!0,state.selectedOrg=data,state.errors=[],this.setState(state)):(this.refs.modalError.open(),this.setState(state))}.bind(this),error:function(xhr,status,err){var state=this.state;state.errors=["general"],this.setState(state)}.bind(this)}):(state.installing=!1,this.doInstallApp(orgSearchData.selectedOrgId,orgSearchData))}else{var orgSearchData=this.refs.instalForm.state.installData.address;orgSearchData.contact_name=installData.contact.contact_name,orgSearchData.contact_lastname=installData.contact.contact_lastname,orgSearchData.contact_email=installData.contact.contact_email,this.doInstallApp(null,orgSearchData)}},orgTypeRestriction:function(){return{company:this.props.app.target_companies,public_body:this.props.app.target_publicbodies}},renderCreateNewOrganization:function(){return React.createElement("div",null,React.createElement("h3",null,this.state.selectedOrg.exist?t("modify-org"):t("create-new-org")),React.createElement(CreateOrModifyOrganizationForm,{ref:"tabbedForm",successHandler:this.orgCreated,typeRestriction:this.orgTypeRestriction(),organization:this.state.selectedOrg}),React.createElement("div",{className:"col-sm-4 col-sm-offset-8"},React.createElement("a",{className:"btn btn-default",onClick:this.cancelCreateOrg},t("ui.cancel")),React.createElement("a",{className:"btn btn-primary",onClick:this.doCreateOrg},t("create"))))},renderBuying:function(){return React.createElement("h3",null," ",React.createElement("i",{className:"fa fa-spinner fa-spin"})," ",t("buying"))},renderInstallingForm:function(){return React.createElement(InstallForm,{ref:"instalForm",installApp:this.installApp,url:this.state.app.serviceUrl,app:this.props.app,orgs:this.state.orgs,continueInstallProcess:this.continueInstallProcess})},renderAppDescription:function(){return React.createElement(AppDescriptionComponent,{app:this.props.app,stateApp:this.state.app,rateApp:this.rateApp,onInstallButton:this.displayInstallForm,error:this.state.error})},renderSucessfulInstallationForm:function(){return React.createElement("div",null,React.createElement("div",{className:"form-horizontal"},React.createElement("i",{id:"success-app-install",className:"fa fa-check pull-left col-sm-offset-1"}),React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-1")),React.createElement("br",null)),this.props.app.paid?React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-2")),React.createElement("br",null)):"","PERSONAL"===this.state.installType?"":React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-3")),React.createElement("br",null)),React.createElement("div",{className:"form-group"},React.createElement("h5",{className:"col-sm-offset-2"},t("install.org.success-msg-4")),React.createElement("br",null))))},render:function(){var content=null;return content=this.state.buying?this.renderBuying():this.state.createOrg?this.renderCreateNewOrganization():this.state.installing?this.renderInstallingForm():this.state.isInstalled?this.renderSucessfulInstallationForm():this.renderAppDescription(),React.createElement("div",null,React.createElement(Modal,{ref:"modal",large:!0,infobox:!0,title:this.props.app.name,cancelHandler:this.close},content),React.createElement(Modal,{ref:"modalError",title:t("ui.something_went_wrong_title"),infobox:!0,cancelHandler:null},React.createElement("div",null,React.createElement("h5",null,t("search.organization.cannot-be-used")))))}}),converter=new Showdown.converter({extensions:["table"]}),AppDescriptionComponent=React.createClass({displayName:"AppDescriptionComponent",render:function(){var stateApp=this.props.stateApp,carousel=stateApp.screenshots&&stateApp.screenshots.length>0?React.createElement("div",{className:"row"},React.createElement(Carousel,{images:stateApp.screenshots})):null,error=this.props.error?React.createElement("div",{className:"alert alert-danger alert-dismissible",role:"alert"},React.createElement("button",{type:"button",className:"close","data-dismiss":"alert"},React.createElement("span",{"aria-hidden":"true"},"×"),React.createElement("span",{className:"sr-only"},t("ui.close"))),React.createElement("strong",null,t("sorry"))," ",t("could-not-install-app")):null,rateInfo=null;logged_in&&!stateApp.rateable&&(rateInfo=React.createElement("p",null,t("already-rated")));var launchOrInstallButton,description=converter.makeHtml(stateApp.longdescription);if("service"==this.props.app.type&&this.props.app.installed)launchOrInstallButton=this.props.stateApp&&this.props.stateApp.serviceUrl?React.createElement("a",{className:"btn btn-primary",href:this.props.stateApp.serviceUrl,target:"_new"},t("launch")):React.createElement("label",null," ",React.createElement("i",{className:"fa fa-spinner fa-spin"})," ");else{var installButton=logged_in?React.createElement("button",{className:"btn btn-primary",onClick:this.props.onInstallButton},t("install")):React.createElement("a",{className:"btn btn-primary-inverse",href:store_root+"/login?appId="+this.props.app.id+"&appType="+this.props.app.type},t("install"));launchOrInstallButton=installButton}return React.createElement("div",null,React.createElement("div",{className:"row"},React.createElement("div",{className:"col-sm-1"},React.createElement("img",{src:this.props.app.icon,alt:this.props.app.name})),React.createElement("div",{className:"col-sm-7"},React.createElement("div",null,React.createElement("p",{className:"appname"},this.props.app.name),React.createElement("p",null,t("by")," ",this.props.app.provider))),React.createElement("div",{className:"col-sm-4 center-container install-application"},launchOrInstallButton)),React.createElement("div",{className:"row"},React.createElement(Rating,{rating:stateApp.rating,rateable:stateApp.rateable,rate:this.props.rateApp}),rateInfo),error,carousel,React.createElement("div",{className:"row"},React.createElement("div",{className:"col-md-6 app-description",dangerouslySetInnerHTML:{__html:description}}),React.createElement("div",{className:"col-md-6"},React.createElement("p",null,t("agree-to-tos")),React.createElement("p",null,React.createElement("a",{href:stateApp.tos,target:"_new"},t("tos"))),React.createElement("p",null,React.createElement("a",{href:stateApp.policy,target:"_new"},t("privacy"))))))}}),InstallForm=React.createClass({displayName:"InstallForm",getInitialState:function(){return this.getProfileInfo(),{installType:"PERSONAL",errors:[],installData:{contact:{contact_name:"",contact_lastname:"",contact_email:""},address:{exist:!1,street_and_number:"",additional_address_field:"",city:"",zip:"",country_uri:"",cedex:"",po_box:""}}}},getProfileInfo:function(){$.ajax({url:network_service+"/general-user-info",type:"get",contentType:"json",success:function(data){var state=this.state;state.installData.contact.contact_name=data.user_name,state.installData.contact.contact_lastname=data.user_lastname,state.installData.contact.contact_email=data.user_email,data.address&&(state.installData.address.street_and_number=data.address.street_address,state.installData.address.city=data.address.locality,state.installData.address.zip=data.address.postal_code,state.installData.address.country=data.address.country),this.setState(state)}.bind(this),error:function(xhr,status,err){}.bind(this)})},getInstallType:function(){var installTypeRestrictions={personal:this.hasCitizens(),org:this.hasOrganizations()};return"PERSONAL"===this.state.installType&&installTypeRestrictions.personal===!1?"ORG":"ORG"===this.state.installType&&installTypeRestrictions.org===!1?"PERSONAL":this.state.installType},getInstallData:function(){return this.state.installData},getOrgSearchData:function(){return this.refs.setOrgComponent.getOrgSearchData()},isOnlyForCitizens:function(){return this.props.app.target_citizens&&!this.props.app.target_companies&&!this.props.app.target_publicbodies},hasCitizens:function(){return this.props.app.target_citizens},hasOrganizations:function(){return this.props.app.target_companies||this.props.app.target_publicbodies},toggleType:function(event){var installType=this.state.installType;installType=event.target.value,this.setState({installType:installType})},renderInstallType:function(){var installTypeRestrictions={personal:this.hasCitizens(),org:this.hasOrganizations()},installType=this.getInstallType(),personal=installTypeRestrictions.personal?React.createElement("div",{className:"radio col-sm-offset-2"}," ",React.createElement("label",null,React.createElement("input",{type:"radio",value:"PERSONAL",checked:"PERSONAL"==installType,onChange:this.toggleType},t("install.org.type.PERSONAL")))," "):null,org=installTypeRestrictions.org?React.createElement("div",{className:"radio col-sm-offset-2"}," ",React.createElement("label",null,React.createElement("input",{type:"radio",value:"ORG",checked:"ORG"==installType,onChange:this.toggleType},t("install.org.type.ORG")))," "):null,sectorTypeClassName="col-sm-3 control-label ";return sectorTypeClassName=-1!=$.inArray("sector_type",this.props.errors)?sectorTypeClassName+" error":sectorTypeClassName,React.createElement("div",{className:"form-group"},personal,org)},renderLabel:function(htmlFor,class_name,label){var cn=-1!=$.inArray(class_name,this.state.errors)?"col-sm-3 control-label error":"col-sm-3 control-label";return React.createElement("label",{htmlFor:htmlFor,className:cn},label,React.createElement("label",{className:"error"},"*"))},changeInputContact:function(fieldname){return function(event){var org=this.state.installData;org.contact[fieldname]=event.target.value,this.setState({installData:org,errors:[]})}.bind(this)},changeInputAddress:function(fieldname,value,isNumericField){var org=this.state.installData;isNumericField&&""!==value?org.address[fieldname]=isInteger(value)?value.trim():org.address[fieldname]:org.address[fieldname]=value,this.setState({installData:org,errors:[]})},validateContact:function(){var errs=[],contact=this.state.installData.contact;return contact.contact_name&&""!=contact.contact_name.trim()||errs.push("name"),contact.contact_lastname&&""!=contact.contact_lastname.trim()||errs.push("lastname"),contact.contact_email&&""!=contact.contact_email.trim()||errs.push("email"),this.setState({errors:errs}),errs.length>0?!1:!0},validateAddress:function(){var errs=this.state.errors,address=this.state.installData.address;return address.city_uri&&""!=address.city.trim()||(errs.push("city_uri"),errs.push("city")),address.zip&&""!=address.zip.trim()||errs.push("zip"),address.country_uri&&""!=address.country_uri.trim()||errs.push("country_uri"),this.setState({errors:errs}),errs.length>0?!1:!0},validateAndContinue:function(){var installType=this.getInstallType();"PERSONAL"===installType?this.validateContact()&&this.validateAddress()&&this.props.continueInstallProcess():"ORG"===installType&&this.validateContact()&&this.refs.setOrgComponent&&this.refs.setOrgComponent.validate()&&this.props.continueInstallProcess()},render:function(){var installType=this.getInstallType();return React.createElement("div",{className:"form-horizontal"},this.renderInstallType(),React.createElement("h4",null,t("search.contact.title")),React.createElement(ContactSearchFormControl,{renderLabel:this.renderLabel,orgSearchData:this.state.installData.contact,changeInput:this.changeInputContact}),"PERSONAL"===installType||"service"===this.props.app.type?React.createElement("div",null,React.createElement("h4",null,t("search.contact.address.title")),React.createElement(AddressComponent,{ref:"addressComponent",errors:this.state.errors,addressContainer:this.state.installData.address,changeInput:this.changeInputAddress})):React.createElement("div",null,React.createElement("h4",null,t("search.organization.title")),React.createElement(SetOrganizationComponent,{ref:"setOrgComponent",url:this.props.url,app:this.props.app,orgs:this.props.orgs,isOnlyForCitizens:this.isOnlyForCitizens,onChangeSelectedOrg:this.onChangeSelectedOrg})),React.createElement("a",{className:"btn btn-primary pull-right",onClick:this.validateAndContinue},t("ui.next")))}});SetOrganizationComponent=React.createClass({displayName:"SetOrganizationComponent",getInitialState:function(){return{orgSearchData:{contact_name:"",contact_lastname:"",contact_email:"",sector_type:"",country:"France",legal_name:"",tax_reg_num:"",typeInstallOrg:"NEW-ORGS",selectedOrgId:""},errors:[]}},getOrgSearchData:function(){return this.state.orgSearchData},orgTypeRestriction:function(){return{company:this.props.app.target_companies,public_body:this.props.app.target_publicbodies}},onChangeOrgInput:function(fieldname){return function(event){var org=this.state.orgSearchData;"country"===fieldname?(org[fieldname+"_uri"]=event.target.value,org[fieldname]=event.target.selectedOptions[0].label):org[fieldname]=event.target.value,this.setState({orgSearchData:org,errors:[]})}.bind(this)},toggleInstallOrgType:function(event){var org=this.state.orgSearchData;org.typeInstallOrg=event.target.value,org.selectedOrgId=this.props.orgs[0].id,this.setState({orgSearchData:org,errors:[]})},toggleSectorType:function(event){var org=this.state.orgSearchData;org.sector_type=event.target.value,this.setState({orgSearchData:org,errors:[]})},renderOrganizations:function(){var opts=[];return this.props.orgs.map(function(org){opts.push(React.createElement("option",{key:org.id,className:"action-select-option",value:org.id},org.name))}.bind(this)),React.createElement("select",{className:"btn btn-default dropdown-toggle",onChange:this.onChangeOrgInput("selectedOrg")},opts)},validate:function(){var state=this.state,errors=[],orgSearchData=state.orgSearchData;return"EXISTING-ORGS"===orgSearchData.typeInstallOrg?""===orgSearchData.selectedOrgId.trim()&&errors.push("typeInstallOrg"):(orgSearchData.sector_type&&""!=orgSearchData.sector_type.trim()||errors.push("sector_type"),orgSearchData.country_uri&&""!=orgSearchData.country_uri.trim()||errors.push("country"),orgSearchData.legal_name&&""!=orgSearchData.legal_name.trim()||errors.push("legal_name"),orgSearchData.tax_reg_num&&""!=orgSearchData.tax_reg_num.trim()||errors.push("tax_reg_num")),state.errors=errors,this.setState(state),state.errors.length>0?!1:!0},renderLabel:function(htmlFor,class_name,label){var cn=-1!=$.inArray(class_name,this.state.errors)?"col-sm-3 control-label error":"col-sm-3 control-label";return React.createElement("label",{htmlFor:htmlFor,className:cn},label,React.createElement("label",{className:"error"},"*"))},render:function(){return React.createElement("div",{className:"form-group"},!this.props.isOnlyForCitizens()&&this.props.orgs&&this.props.orgs.length>0?React.createElement("div",{className:"radio col-sm-offset-2"},React.createElement("label",null,React.createElement("input",{type:"radio",value:"EXISTING-ORGS",checked:"EXISTING-ORGS"==this.state.orgSearchData.typeInstallOrg,onChange:this.toggleInstallOrgType}),t("search.organization.selection.existing"),"    "),this.renderOrganizations()):"",React.createElement("div",{className:"radio col-sm-offset-2"},React.createElement("label",null,React.createElement("input",{type:"radio",value:"NEW-ORGS",checked:"NEW-ORGS"==this.state.orgSearchData.typeInstallOrg,onChange:this.toggleInstallOrgType}),t("search.organization.selection.new")),React.createElement(OrganizationSearchFormControl,{errors:this.state.errors,renderLabel:this.renderLabel,typeRestriction:this.orgTypeRestriction(),orgSearchData:this.state.orgSearchData,changeInput:this.onChangeOrgInput,toggleType:this.toggleSectorType})))}});var Carousel=React.createClass({displayName:"Carousel",getInitialState:function(){return{index:0}},back:function(){var index=this.state.index;index=Math.max(0,index-1),this.setState({index:index})},forward:function(){var index=this.state.index;index=Math.min(this.props.images.length,index+1),this.setState({index:index})},render:function(){if(!this.props.images)return null;var back=null;this.state.index>0&&(back=React.createElement("a",{className:"back",onClick:this.back},React.createElement("i",{className:"fa fa-chevron-left"})));var forward=null;return this.state.indexrating?"0"+10*rating:10*rating;return className="rating-static rating-"+rt,React.createElement("div",{className:className,onMouseEnter:this.startEditing,onMouseLeave:this.stopEditing,onMouseMove:this.mouseMove,onClick:this.rate})}}); diff --git a/portal-parent/oasis-portal-front/src/main/resources/templates/appmanagement/myapps.html b/portal-parent/oasis-portal-front/src/main/resources/templates/appmanagement/myapps.html index 8e235caaa..cd5aec652 100644 --- a/portal-parent/oasis-portal-front/src/main/resources/templates/appmanagement/myapps.html +++ b/portal-parent/oasis-portal-front/src/main/resources/templates/appmanagement/myapps.html @@ -8,7 +8,6 @@ -