Commit b98a14ac by Nilu

adding google address field to capture google location in J001

parent 868d0474
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<column name="industry" type="String" nullable="true" length="200"/> <column name="industry" type="String" nullable="true" length="200"/>
<column name="culture_statement" type="String" nullable="true" length="2000"/> <column name="culture_statement" type="String" nullable="true" length="2000"/>
<column name="draft_location" type="String" nullable="true" length="200"/> <column name="draft_location" type="String" nullable="true" length="200"/>
<column name="google_address_text" type="String" nullable="true" length="300"/>
<column name="level_id" type="Long" length="11" nullable="true"/> <column name="level_id" type="Long" length="11" nullable="true"/>
<column name="client_id" type="Long" length="11" nullable="true"/> <column name="client_id" type="Long" length="11" nullable="true"/>
<column name="job_owner_id" type="Long" length="11" nullable="true"/> <column name="job_owner_id" type="Long" length="11" nullable="true"/>
......
...@@ -32,6 +32,7 @@ CREATE TABLE tl_job ( ...@@ -32,6 +32,7 @@ CREATE TABLE tl_job (
industry varchar(200) NULL, industry varchar(200) NULL,
culture_statement varchar(2000) NULL, culture_statement varchar(2000) NULL,
draft_location varchar(200) NULL, draft_location varchar(200) NULL,
google_address_text varchar(300) NULL,
level_id numeric(12) NULL, level_id numeric(12) NULL,
client_id numeric(12) NULL, client_id numeric(12) NULL,
job_owner_id numeric(12) NULL, job_owner_id numeric(12) NULL,
......
...@@ -33,6 +33,7 @@ CREATE TABLE tl_job ( ...@@ -33,6 +33,7 @@ CREATE TABLE tl_job (
industry varchar2(200) NULL, industry varchar2(200) NULL,
culture_statement varchar2(2000) NULL, culture_statement varchar2(2000) NULL,
draft_location varchar2(200) NULL, draft_location varchar2(200) NULL,
google_address_text varchar2(300) NULL,
level_id number(12) NULL, level_id number(12) NULL,
client_id number(12) NULL, client_id number(12) NULL,
job_owner_id number(12) NULL, job_owner_id number(12) NULL,
......
...@@ -33,6 +33,7 @@ CREATE TABLE tl_job ( ...@@ -33,6 +33,7 @@ CREATE TABLE tl_job (
industry varchar(200) NULL, industry varchar(200) NULL,
culture_statement varchar(2000) NULL, culture_statement varchar(2000) NULL,
draft_location varchar(200) NULL, draft_location varchar(200) NULL,
google_address_text varchar(300) NULL,
level_id numeric(12) NULL, level_id numeric(12) NULL,
client_id numeric(12) NULL, client_id numeric(12) NULL,
job_owner_id numeric(12) NULL, job_owner_id numeric(12) NULL,
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
<ATTRIB name="Industry" type="Industry" dbcol="industry" attribHelper="EnumeratedAttributeHelper"/> <ATTRIB name="Industry" type="Industry" dbcol="industry" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="CultureStatement" type="String" dbcol="culture_statement" length="2000"/> <ATTRIB name="CultureStatement" type="String" dbcol="culture_statement" length="2000"/>
<ATTRIB name="DraftLocation" type="DraftLocation" dbcol="draft_location" attribHelper="EnumeratedAttributeHelper"/> <ATTRIB name="DraftLocation" type="DraftLocation" dbcol="draft_location" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="GoogleAddressText" type="String" dbcol="google_address_text" length="300" />
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_id" mandatory="false"/> <SINGLEREFERENCE name="Level" type="Level" dbcol="level_id" mandatory="false"/>
<SINGLEREFERENCE name="Client" type="Client" dbcol="client_id" backreferenceName="Jobs"/> <SINGLEREFERENCE name="Client" type="Client" dbcol="client_id" backreferenceName="Jobs"/>
......
...@@ -160,7 +160,10 @@ ...@@ -160,7 +160,10 @@
return false; return false;
} }
</script> </script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&key=AIzaSyCaBh-MsMb8BBYJD_NcFzoCmygQbt5-QSw"></script>
<oneit:script>
<oneit:script src="/scripts/google_address.js"/>
</oneit:script>
<oneit:form name="editJob" method="post" enctype="multipart/form-data"> <oneit:form name="editJob" method="post" enctype="multipart/form-data">
<div class="container-fluid"> <div class="container-fluid">
...@@ -264,6 +267,12 @@ ...@@ -264,6 +267,12 @@
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12">
<label><oneit:label GUIName="Google Location"/></label>
<oneit:ormInput obj="<%= job %>" type="text" attributeName="GoogleAddressText" class="autoAddress" id="<%= "gAddress_"+job.getObjectID() %>" placeholder="Enter your address" cssClass="form-control" />
</div>
</div>
<div class="form-group row">
<div class="col-md-4"> <div class="col-md-4">
<div class="styled_checkboxes"> <div class="styled_checkboxes">
<div class="checkbox checkbox-primary"> <div class="checkbox checkbox-primary">
...@@ -277,7 +286,6 @@ ...@@ -277,7 +286,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="form-page-section"> <div class="form-page-section">
...@@ -545,5 +553,8 @@ ...@@ -545,5 +553,8 @@
<button type="button" value="Save Job Occupation" id="save-job-occ" class="btn btn-primary largeBtn" style="" >Save Job Occupation</button> <button type="button" value="Save Job Occupation" id="save-job-occ" class="btn btn-primary largeBtn" style="" >Save Job Occupation</button>
</div> </div>
</div> </div>
<script>
addGoogleAddressListener('#<%= "gAddress_"+ job.getObjectID() %>');
</script>
</oneit:form> </oneit:form>
</oneit:dynIncluded> </oneit:dynIncluded>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun --> <!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector"> <OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation"> <NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_job</tableName> <tableName factory="String">tl_job</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/> <column name="google_address_text" type="String" nullable="true" length="300"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="job_title" type="String" nullable="false" length="500"/>
<column name="job_description" type="CLOB" nullable="false"/>
<column name="job_status" type="String" nullable="false" length="200"/>
<column name="open_date" type="Date" nullable="true"/>
<column name="apply_by" type="Date" nullable="true"/>
<column name="include_assessment_criteria" type="Boolean" nullable="false"/>
<column name="assessment_type" type="String" nullable="false" length="200"/>
<column name="random_key" type="String" nullable="true" length="10"/>
<column name="job_type" type="String" nullable="false" length="200"/>
<column name="ref_number" type="String" nullable="true" length="100"/>
<column name="last_status_change_date" type="Date" nullable="true"/>
<column name="remote" type="Boolean" nullable="true"/>
<column name="city" type="String" nullable="true" length="100"/>
<column name="postcode" type="String" nullable="true" length="100"/>
<column name="location_radius" type="String" nullable="true" length="200"/>
<column name="state" type="String" nullable="true" length="200"/>
<column name="country" type="String" nullable="true" length="200"/>
<column name="require_cv" type="Boolean" nullable="true"/>
<column name="manually_closed" type="Boolean" nullable="true"/>
<column name="last_edited" type="Date" nullable="true"/>
<column name="is_ppj" type="Boolean" nullable="true"/>
<column name="industry" type="String" nullable="true" length="200"/>
<column name="culture_statement" type="String" nullable="true" length="2000"/>
<column name="draft_location" type="String" nullable="true" length="200"/>
<column name="level_id" type="Long" length="11" nullable="true"/>
<column name="client_id" type="Long" length="11" nullable="true"/>
<column name="job_owner_id" type="Long" length="11" nullable="true"/>
<column name="company_user_id" type="Long" length="11" nullable="true"/>
<column name="hiring_team_id" type="Long" length="11" nullable="true"/>
<column name="occupation_id" type="Long" length="11" nullable="true"/>
<column name="shortened_url_id" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job" indexName="idx_tl_job_client_id" isUnique="false"><column name="client_id"/></NODE> </NODE>
</OBJECTS>
</NODE></OBJECTS> \ No newline at end of file
\ No newline at end of file
var componentForm =
{
street_number: 'short_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'short_name',
country: 'long_name',
postal_code: 'short_name'
};
var googleAutoComplete = {};
function addGoogleAddressListener(domSelector)
{
var autocomplete = new google.maps.places.Autocomplete($(domSelector)[0]);
googleAutoComplete[domSelector] = autocomplete;
var place;
$(domSelector).change(function(){
if(!$(this).val() || !trim($(this).val()) || autocomplete.getPlace() == null || autocomplete.getPlace() == undefined || !autocomplete.getPlace().geometry)
{
var parentDiv = $(domSelector).closest('.googleAddress');
parentDiv.find(".latitude").val('');
parentDiv.find(".longitude").val('');
for (var component in componentForm)
{
parentDiv.find("." + component).val('');
}
}
})
$(domSelector).keypress(function(e) {
if (e.which == 13) {
e.preventDefault();
}
});
autocomplete.addListener('place_changed', function()
{
place = autocomplete.getPlace();
googleAutoComplete[domSelector] = place;
placeChanged(domSelector);
});
}
function placeChanged(domSelector)
{
var place = googleAutoComplete[domSelector];
if(place === undefined || !place.geometry)
{
return;
}
var parentDiv = $(domSelector).closest('.googleAddress');
parentDiv.find(".latitude").val(place.geometry.location.lat());
parentDiv.find(".longitude").val(place.geometry.location.lng());
for (var component in componentForm)
{
parentDiv.find("." + component).val('');
}
for (var i = 0; i < place.address_components.length; i++)
{
var addressType = place.address_components[i].types[0];
if (componentForm[addressType])
{
var val = place.address_components[i][componentForm[addressType]];
parentDiv.find("."+ addressType).val(val);
}
}
}
//remove left and right space
function trim(str)
{
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function toggleAddressMode(gAddressid)
{
var selection = $('input[googleid='+gAddressid+']').prop('checked');
var parentDiv = $('#'+gAddressid).closest('.googleAddress');
for (var component in componentForm)
{
if(!selection)
{
parentDiv.find("." + component).prop('readonly', 'true');
}
else
{
parentDiv.find("." + component).removeProp('readonly');
}
}
if(!selection)
{
$('#'+gAddressid).removeProp('readonly');
placeChanged('#'+gAddressid);
}
else
{
$('#'+gAddressid).prop('readonly', 'true');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment