Skip to content

Instantly share code, notes, and snippets.

/Podio-Fields-Add-Functions Secret

Created Dec 8, 2015
Embed
What would you like to do?
Scott-Costello-AutoCreate
<?php
function Field_Text($appId,$name,$desc,$delta,$size,$required) {
$flds = array(type => "text", config => array(label => "$name",description => "$desc", delta => $delta, settings => array(size=>"$size"),required => $required));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Image($appId,$name,$desc,$delta) {
$flds = array(type => "image", config => array(label => "$name",description => "$desc", delta => $delta));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Link($appId,$name,$desc,$delta) {
$flds = array(type => "embed", config => array(label => "$name",description => "$desc", delta => $delta));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Number($appId,$name,$desc,$delta,$decimals,$required) {
$flds = array(type => "number", config => array(label => "$name",description => "$desc", delta => $delta, settings => array(decimals=>$decimals),required => $required));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Money($appId,$name,$desc,$delta,$required) {
$flds = array(type => "money", config => array(label => "$name",description => "$desc", delta => $delta, settings => array(allowed_currencies => array("USD")),required => $required));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Calc($appId,$label,$desc,$delta,$script) {
$flds = array(type => "calculation", config => array(label => "$label",description => "$desc", delta => $delta, settings => array(script=>"$script")));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Phone($appId,$name,$desc,$delta,$required) {
$flds = array(type => "phone", config => array(label => "$name",description => "$desc", delta => $delta, required => $required));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Email($appId,$name,$desc,$delta,$required) {
$flds = array(type => "email", config => array(label => "$name",description => "$desc", delta => $delta, required => $required));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Location($appId,$name,$desc,$delta,$required) {
$flds = array(type => "location", config => array(label => "$name",description => "$desc", delta => $delta, required => $required));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Relationship($appId,$relId,$name,$desc,$delta,$multiple) {
$flds = array(type => "app", config => array(label => "$name",description => "$desc", delta => $delta, settings => array(referenced_apps => array(array(app_id=>$relId)), multiple => $multiple)));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Date($appId,$name,$desc,$delta,$calendar,$end,$time,$color,$required) {
//"calendar": True if the items should show up in the calendar, false otherwise,
//"end": Whether the end date is either "disabled", "enabled" or "required".
//"time": Whether the time component is either "disabled", "enabled" or "required",
//"color": The color of the events in the calendar. Possible colors: DCEBD8, F7D1D0, DDDDDD, D2E4EB, F7F0C5, E1D8ED, FFD5C2, D1F3EC
$flds = array(type => "text", config => array(label => "$name",description => "$desc", delta => $delta, settings => array(calendar=>"$calendar",end=>"$end",time=>"$time",color=>"$color"),required => $required));
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
function Field_Category($appId,$label,$desc,$delta,$categories,$display,$multiple) {
$items = explode(",",$categories);
$cats = array();
foreach ($items as $item) {
$cats[] = array("text" => $item);
}
$flds = array(type => "category",
config => array(label => "$label",
description => "$desc",
delta => $delta,
settings => array(
options => $cats,
multiple => $multiple,
display => "$display")
)
);
//echo "<br/>Code: " . json_encode($flds);
return PodioAppField::create($appId,$flds);
}
?>
<?php
function CreateAppContacts($spaceId) {
$ar = array(
space_id => $spaceId,
config => array(
type => "standard",
name => "Contacts",
item_name => "Contact",
description => "Add all Property and Personal Contacts here",
usage => "",
external_id => "7",
icon => "132.png",
allow_edit => true,
default_view => "badge",
allow_attachments => true,
allow_comments => true,
silent_creates => false,
silent_edits => false,
fivestar => false,
fivestar_label => "",
approved => false,
thumbs => false,
thumbs_label => "",
rsvp => false,
rsvp_label => "",
yesno => false,
yesno_label => "",
tasks => ""
//fields => $flds
)
//,fields => $flds
);
$response = PodioApp::create($ar);
$appId = $response->app_id;
return $appId;
}
function CreateFieldsContacts ($appId) {
Field_Text($appId,"First Name","",1,"small",true);
Field_Text($appId,"Last Name","",2,"small",true);
Field_Category($appId,"Type","",3,"Property,Personal","inline",false);
Field_Category($appId,"Who is this?","",4,"Owner,Executor,Attorney,Realtor,Title Company,Inspector,Other","inline",false);
Field_Text($appId,"Notes","Add any additional notes about this contact here",5,"large",false);
Field_email($appId,"Email","",6,true);
Field_email($appId,"Phone","",7,true);
}
?>
<?php
function CreateAppDeals($spaceId) {
$ar = array(
space_id => $spaceId,
config => array(
type => "standard",
name => "Deals",
item_name => "Deal",
description => "Add all Deals go here",
usage => "",
external_id => "6",
icon => "231.png",
allow_edit => true,
default_view => "badge",
allow_attachments => true,
allow_comments => true,
silent_creates => false,
silent_edits => false,
fivestar => false,
fivestar_label => "",
approved => false,
thumbs => false,
thumbs_label => "",
rsvp => false,
rsvp_label => "",
yesno => false,
yesno_label => "",
tasks => ""
//fields => $flds
)
//,fields => $flds
);
$response = PodioApp::create($ar);
$appId = $response->app_id;
return $appId;
}
function CreateFieldsDeals ($appId,$appProperties,$appBuyers) {
Field_Relationship($appId,$appProperties,"Property","",1,true);
$type_id = Field_Date($appId,"Date Closed","Closing date of the deal",2,false,"disabled","disabled","DCEBD8",true);
Field_Money($appId,"Sold Price","",3,false);
Field_Money($appId,"Profit","",4,false);
Field_Relationship($appId,$appBuyers,"Buyer(s)","",5,true);
Field_Calc($appId,">","",6,"var a = @[Placeholder](field_$type_id); " . '"# Testimonials \n --- \n The **Testimonials** section is where you record what your buyer and seller have to say about you and your service. You can upload any documents as well."');
Field_Text($appId,"Testimonial from Seller","",7,"large",true);
Field_Text($appId,"Testimonial from Buyer","",8,"large",true);
Field_Text($appId,"Notes","",9,"large",true);
}
?>
<?php
function CreateAppOffers($spaceId) {
$ar = array(
space_id => $spaceId,
config => array(
type => "standard",
name => "Offers",
item_name => "Offer",
description => "Add all Deal Offers here",
usage => "",
external_id => "4",
icon => "121.png",
allow_edit => true,
default_view => "badge",
allow_attachments => true,
allow_comments => true,
silent_creates => false,
silent_edits => false,
fivestar => false,
fivestar_label => "",
approved => false,
thumbs => false,
thumbs_label => "",
rsvp => false,
rsvp_label => "",
yesno => false,
yesno_label => "",
tasks => ""
//fields => $flds
)
//,fields => $flds
);
$response = PodioApp::create($ar);
$appId = $response->app_id;
return $appId;
}
function CreateFieldsOffers ($appId,$appProperties) {
Field_Relationship($appId,$appProperties,"Property","",1,true);
Field_Money($appId,"Offer Amount","",2,false);
Field_Date($appId,"Offer Date","Date you made the offer",3,false,"disabled","disabled","DCEBD8",true);
Field_Category($appId,"Offer Delivery","",4,"Mail,Email,Verbal,In Person,Through Realtor,Other","inline",false);
//Field_Category($appId,"Check List","",5,"Create Offer Letter,Made Offer,Follow Up","inline",true);
//Field_Category($appId,"Status","",6,"Pending,Offer Made,Accepted,Rejected,Countered","inline",false);
//Field_Text($appId,"Notes","",7,"large",true);
}
?>
<?php
function CreateAppPropDetails($spaceId) {
$ar = array(
space_id => $spaceId,
config => array(
type => "standard",
name => "Property Details",
item_name => "Detail",
description => "Add all Property Details here",
usage => "",
external_id => "2",
icon => "132.png",
allow_edit => true,
default_view => "badge",
allow_attachments => true,
allow_comments => true,
silent_creates => false,
silent_edits => false,
fivestar => false,
fivestar_label => "",
approved => false,
thumbs => false,
thumbs_label => "",
rsvp => false,
rsvp_label => "",
yesno => false,
yesno_label => "",
tasks => ""
//fields => $flds
)
//,fields => $flds
);
$response = PodioApp::create($ar);
$appId = $response->app_id;
return $appId;
}
function CreateFieldsPropDetails ($appId,$appProperties) {
/* Type */
Field_Relationship($appId,$appProperties,"Property","",1,false);
Field_Category($appId,"Type","Type of Property",3,"Single Family,Duplex,Multi-Family,Condo,Other","inline",false);
$type_id = Field_Number($appId,"# of Bedrooms","",4,0,false);
Field_Number($appId,"# of Bathrooms","",5,2,false);
Field_Category($appId,"Style","Style of house",6,"Rance,2-Story,Cape,Tri-Level,Colonial,Bi-Level,Condo,Patio Home,Split,Cottage,Other","inline",false);
Field_Category($appId,"Construction Type","Construction of the house",7,"Brick,Vinyl,Wood,Concrete,Other","inline",false);
Field_Category($appId,"Basement","",9,"None,Unfinished,Partially Finished,Finished,Slab,Crawl Space, Other","inline",false);
Field_Category($appId,"Garage","What type on how many cars",10,"None,Attached 1-Car,Attached 2-Car,Attached 3-Car,Detached 1-Car,Detached 2-Car,Under,Carport,Other","inline",false);
Field_Category($appId,"Heat","What type of heat is in the house",11,"Gas,Electric,Boiler,Other","inline",false);
Field_Number($appId,"Heat age (years)","",12,0,false);
Field_Category($appId,"Central AC","Does the house have Central Air Conditioning?",13,"Yes, NO","inline",false);
Field_Number($appId,"Central AC age (years)","",14,0,false);
Field_Category($appId,"Electrical Box","",15,"Breakers, Fuses","inline",false);
Field_Category($appId,"Public Water","",16,"Yes,No","inline",false);
Field_Category($appId,"Public Sewer","",17,"Septic,City Water,Other","inline",false);
Field_Category($appId,"Water On?","",18,"Yes,No","inline",false);
Field_Category($appId,"Oil Tank?","",19,"Yes,No","inline",false);
Field_Category($appId,"Roof Type","",20,"Composition Shingle,Asphalt,Slate/Tile,Metal,Flat,Cedar Shake,Other","inline",false);
Field_Number($appId,"Roof age (years)","",21,0,false);
Field_Category($appId,"Kitchen Last Updated","How long ago was the kitchen last updated?",22,"0-4 Years ago,5-9 Years ago,10+ Years ago","inline",false);
Field_Category($appId,"Bathroom Last Updated","How long ago were the bathrooms last updated?",23,"0-4 Years ago,5-9 Years ago,10-19+ Years ago,20+ Years ago","inline",false);
Field_Text($appId,"Additional Information","",24,"large",false);
Field_Text($appId,"Repairs Needed","",25,"large",false);
Field_Text($appId,"Updates Needed","",26,"large",false);
Field_Text($appId,"What Repairs and Updates would you do if you were going to stay in the house?","",27,"large",false);
Field_Text($appId,"Anything else I should know?","",28,"large",false);
Field_Category($appId,"Is there a mortgage on the house?","",30,"No Mortgage,1-Mortgage,2-Mortgages,N-Mortgages","inline",false);
Field_Text($appId,"Who Holds the Mortgages?","",31,"large",false);
Field_Money($appId,"How Much is Owed?","Total amount owed to all lenders",32,false);
Field_Number($appId,"Current Interest Rate","",33,4,false);
Field_Category($appId,"Is the Interest Rate fixed or variable?","",34,"Fixed Rate,Variable Rate","inline",false);
Field_Category($appId,"Are you behind on payments?","",35,"Current,Behind","inline",false);
Field_Number($appId,"How many payments are you bedhind?","",36,0,false);
Field_Category($appId,"Is the house in foreclosure?","",37,"In-Foreclosure,Not-In-Foreclosure","inline",false);
Field_Category($appId,"Who currently lives in the house?","",39,"Owner Occupied,Tenant,Non-Paying Tenant,Vacant","inline",false);
Field_Number($appId,"How long have you lived in the house?","",40,0,false);
Field_Text($appId,"Why are you selling?","",41,"large",false);
Field_Money($appId,"What is your asking price?","",42,false);
Field_Text($appId,"how did you get that price?","",43,"large",false);
Field_Money($appId,"Tax assessor's value?","",44,false);
Field_Category($appId,"Is the property currently listed?","",45,"Listed - With Realtor,Listed - FSBO,Not Listed","inline",false);
Field_Text($appId,"Listing Company","",46,"large",false);
Field_Text($appId,"Do you have other properties for sale?","",47,"large",false);
Field_Money($appId,"What is the least you would take?","",48,false);
Field_Category($appId,"Would you consider owner finance?","",49,"Yes - Consider Owner Finance,No","inline",false);
Field_Category($appId,"How fast do you need to sell?","",50,"0-3 months,3-6 months,6+ months","inline",false);
Field_Text($appId,"What will you do if you don't sell?","",51,"large",false);
// Add Calc Fields
Field_Calc($appId,">","",2,"var a = @[Placeholder](field_$type_id); " . '"# General Property Details \n --- \n The **General Property Details** section is where you keep track of all the basic info that you first ask for..like number of bedrooms, bathrooms, style of house and more"');
Field_Calc($appId,">","",8,"var a = @[Placeholder](field_$type_id); " . '"# Amenities \n --- \n The **Amenities** section is where you can keep track of all the things that come with the house such as Basement, Garage, HVAC and more..."');
Field_Calc($appId,">","",24,"var a = @[Placeholder](field_$type_id); " . '"# Repairs and Updates \n --- \n The **Repairs and Updates** section is where you ask the sellers about what they would do to the house to fix it up"');
Field_Calc($appId,">","",29,"var a = @[Placeholder](field_$type_id); " . '"# Mortgage Information \n --- \n The **Mortgage Information** section is where you keep track of any liens that are on the house such as mortgages, taxes or construction liens"');
Field_Calc($appId,">","",38,"var a = @[Placeholder](field_$type_id); " . '"# Personal Questions \n --- \n The **Personal Questions** section is where you ask the seller why they are selling, how much they are looking to get. You are trying to gauge their level of motivation in this area."');
}
?>
<?php
function CreateAppProperty($spaceId) {
echo "<br/>Passed in Contact App Id: " . $contactAppId;
$ar = array(
space_id => $spaceId,
config => array(
type => "standard",
name => "Properties",
item_name => "Property",
description => "Add all new property leads to this app. This is the dashboard for each lead",
usage => "",
external_id => "1",
icon => "410.png",
allow_edit => true,
default_view => "table",
allow_attachments => true,
allow_comments => true,
silent_creates => false,
silent_edits => false,
fivestar => false,
fivestar_label => "",
approved => false,
thumbs => false,
thumbs_label => "",
rsvp => false,
rsvp_label => "",
yesno => false,
yesno_label => "",
tasks => ""
//fields => $flds
)
//,fields => $flds
);
$response = PodioApp::create($ar);
$appId = $response->app_id;
return $appId;
}
function CreateFieldsProperties ($appId,$appContacts,$appDetails,$appDeals,$appOffers,$appContracts,$appWorkups) {
Field_Location($appId,"Address","",1,true);
Field_Relationship($appId,$appContracts,"Contact(s)","",3,true);
$type_id = Field_Category($appId,"Lead Sheet","",5,"Print Lead Sheet","inline",false);
Field_Category($appId,"Property Details","",6,"No Details,Create Details Record","inline",false);
Field_Relationship($appId,$appDetails,"Property Detail(s)","",7,true);
Field_Category($appId,"Workup","",8,"No Workup,Create Workup Record","inline",false);
Field_Relationship($appId,$appWorkups,".","",9,true);
Field_Category($appId,"Offer","",10,"No Offer,Create Offer Record","inline",false);
Field_Relationship($appId,$appOffers,".","",11,true);
Field_Category($appId,"Under Contract","",12,"No Contract,Create Under Contract Record","inline",false);
Field_Relationship($appId,$appContracts,".","",13,true);
Field_Category($appId,"Deal Details","",14,"No Deal,Create Deal Record","inline",false);
Field_Relationship($appId,$appDeals,".","",15,true);
Field_Category($appId,"Status","",17,"Active,Dead","inline",false);
Field_Category($appId,"Marketing Source","",18,"Direct Mail,Website,Bandit Sign,Referral,Other","inline",false);
Field_Category($appId,"Lead Type","",19,"Probate,Absentee Owner,Foreclosure,REO,Other","inline",false);
Field_Category($appId,"Stage","",20,"1 - Property Details,2 - Workup,3 - Offer Made,4 - Under Contract,5 - Deal Closed","inline",true);
// HEADERS //
Field_Calc($appId,">","",2,"var a = @[Placeholder](field_$type_id); " . '"# Contacts \n --- \n The **Contacts** section is where you can add the contact information for the owner, heirs, attorneys, brothers, sisters or anyone else who you need too."');
Field_Calc($appId,">","",4,"var a = @[Placeholder](field_$type_id); " . '"# Details \n --- \n The **Details Section** is where you add additional information about the property. You can add property details, do a property workup, keep track of your offers, record your contract information and also any post deal data. To create each, just click on the **Create {item} Record** for each item."');
Field_Calc($appId,">","",4,"var a = @[Placeholder](field_$type_id); " . '"# Lead Data \n --- \n The **Lead Data Section** is where you enter in details about the record"');
}
?>
<?php
function CreateAppUnderContracts($spaceId) {
$ar = array(
space_id => $spaceId,
config => array(
type => "standard",
name => "Under Contracts",
item_name => "Contract",
description => "Add all leads under contract",
usage => "",
external_id => "5",
icon => "72.png",
allow_edit => true,
default_view => "badge",
allow_attachments => true,
allow_comments => true,
silent_creates => false,
silent_edits => false,
fivestar => false,
fivestar_label => "",
approved => false,
thumbs => false,
thumbs_label => "",
rsvp => false,
rsvp_label => "",
yesno => false,
yesno_label => "",
tasks => ""
//fields => $flds
)
//,fields => $flds
);
$response = PodioApp::create($ar);
$appId = $response->app_id;
return $appId;
}
function CreateFieldsUnderContracts ($appId,$appProperties,$appBuyers) {
Field_Relationship($appId,$appProperties,"Property","",1,true);
$type_id = Field_Date($appId,"Date","Date you got the deal under contract",2,false,"disabled","disabled","DCEBD8",true);
Field_Money($appId,"Purchase Price","What you have the house under contract for",3,false);
Field_Money($appId,"Asking Price","How much you are going to ask for the house",4,false);
Field_Relationship($appId,$appBuyers,"Buyer(s)","List of potential buyers",5,true);
Field_Category($appId,"Status","",6,"No Buyer,Assigned,Expired Contract","inline",false);
Field_Category($appId,"Actions","",8,"1 - Create Marketing Material,2 - Start Title Search,3 - Send Email to Buyers,4 - Get Property Inspected","inline",true);
Field_Category($appId,"To-Closing checklist","",9,"1-,2-,3-,4-,5-","inline",true);
Field_Category($appId,"Marketing Methods","",10,"Bandit Signs,Email to Buyers,Cragislist,Other","inline",true);
Field_Date($appId,"Closing Date","Date the closing is set to take place",11,false,"disabled","disabled","DCEBD8",true);
Field_Date($appId,"Inspection Date","Date the inspection is set to take place",12,false,"disabled","disabled","DCEBD8",true);
Field_Text($appId,"Potential Issues","",13,"large",true);
Field_Calc($appId,">","",7,"var a = @[Placeholder](field_$type_id); " . '"# Actions \n --- \n The **Actions** section is where you can keep track of what you need to do and what you have done. The Actions are hooked up to GlobiFlow and will run process when selected. The Checklist is where you can keep track of what needs to be done to get to the Closing Table."');
}
?>
<?php
function CreateAppWorkups($spaceId) {
$ar = array(
space_id => $spaceId,
config => array(
type => "standard",
name => "Workups",
item_name => "Workup",
description => "Add all lead workups to this app",
usage => "",
external_id => "3",
icon => "65.png",
allow_edit => true,
default_view => "badge",
allow_attachments => true,
allow_comments => true,
silent_creates => false,
silent_edits => false,
fivestar => false,
fivestar_label => "",
approved => false,
thumbs => false,
thumbs_label => "",
rsvp => false,
rsvp_label => "",
yesno => false,
yesno_label => "",
tasks => ""
//fields => $flds
)
//,fields => $flds
);
$response = PodioApp::create($ar);
$appId = $response->app_id;
return $appId;
}
function CreateFieldsWorkups ($appId,$appProperties) {
$type_id = Field_Relationship($appId,$appProperties,"Property","",1,true);
$json_id = Field_Text($appId,"Address JSON","",24,"large",false);
$full_address_id = Field_Calc($appId,"Full Address","",25,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].formatted_address; String(ac); } catch (e) {'-'}");
Field_Calc($appId,"Street Number","",26,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'street_number') {ac[i].short_name; } } } catch (e) { 'Could not parse JSON' }");
Field_Calc($appId,"Street","",27,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'route') {ac[i].short_name; } } } catch (e) { 'Could not parse JSON' }");
Field_Calc($appId,"Neighborhood","",28,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'neighborhood') {ac[i].short_name; break; } else { '-' } } } catch (e) { '-' }");
Field_Calc($appId,"City","",29,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'city') {ac[i].short_name; break; } else { '-' } } } catch (e) { '-' }");
Field_Calc($appId,"County","",30,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'administrative_area_level_2') {ac[i].short_name; break; } else { '-' } } } catch (e) { '-' }");
Field_Calc($appId,"State","",31,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'administrative_area_level_1') {ac[i].short_name; break; } else { '-' } } } catch (e) { '-' }");
Field_Calc($appId,"Country","",32,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'country') {ac[i].short_name; break; } else { '-' } } } catch (e) { '-' }");
Field_Calc($appId,"Postal Code","",33,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'postal_code') {ac[i].short_name; break; } else { '-' } } } catch (e) { '-' }");
Field_Calc($appId,"Postal Code Suffix","",34,"try {var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].address_components; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == 'postal_code_suffix') {ac[i].short_name; break; } else { '-' } } } catch (e) { '-' }");
Field_Calc($appId,"Longitude","",35,"try { var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].geometry.location['lng']; String(ac); } catch (e) {
'Could not parse JSON'}");
Field_Calc($appId,"Latitude","",36,"try { var results = JSON.parse(@[Address JSON](field_$json_id)).results; var ac = results[0].geometry.location['lat']; String(ac); } catch (e) {
'Could not parse JSON'}");
Field_Calc($appId,"Zillow","A link to the property page in Zillow",2,"var url = @[Full Address](field_$full_address_id);" . 'if(url){ "http://www.zillow.com/homes/"+url.toString().replace(",","").replace(",","").replace(",","").split(" ").join("-") + "_rb" }');
Field_Calc($appId,"County Tax In","",3,"try {var results = JSON.parse(@[Full Address](field_$json_id)).results; var ac = results[0].address_components;" . 'var state = ""; var county = ""; for (var i = 0; i < ac.length; i++) {if(ac[i].types[0] == "administrative_area_level_2") { county = ac[i].short_name; } if(ac[i].types[0] == "administrative_area_level_1") {state = ac[i].short_name;}} "http://publicrecords.onlinesearches.com/" + state + "_" + county.split(" ")[0] + ".htm"; } catch (e) {"-"}');
Field_Calc($appId,"Aerial View","",4,"var prop = encodeURIComponent(@[Full Address](field_$full_address_id));" . '"![No Image](https://maps.googleapis.com/maps/api/staticmap?zoom=19&scale=1&size=600x300&maptype=satellite&markers=color:blue%7C" + prop + "&center=" + prop + "&pov=pitch)"');
Field_Calc($appId,"Street View","",5,"var prop = encodeURIComponent(@[Full Address](field_$full_address_id));" . '"![No Image](https://maps.googleapis.com/maps/api/streetview?size=600x300&location=" + prop + "&fov=150&mode=html5)"');
Field_Image($appId,"Property Images","",6);
Field_Calc($appId,">","",7,"var a = @[Full Address](field_$full_address_id); " . '"# Actions \n --- \n The **Actions** section is where you can keep track of what you have to do and what has been done."');
Field_Category($appId,"Check List","",8,"1 - Follow Up Call,2 - Go See House,3 - Pull Comps,4 - Tax Records,5 - Make Offer","inline",true);
Field_Calc($appId,">","",9,"var a = @[Full Address](field_$full_address_id); " . '"# Exit Planning \n --- \n The **Exit Planning** section is where you will keep track of what buyers might be a good fit for this property as well as what type of buyer would be good"');
Field_Category($appId,"Exit Strategy","",10,"Whoelsale,Fix and Flip,Rental","inline",true);
Field_Category($appId,"Target Buyer","",11,"Rehabbers, Landlords,Other","inline",true);
Field_Calc($appId,">","",12,"var a = @[Full Address](field_$full_address_id); " . '"# Offer Formula - (Arv * % Discount) - Repair Costs - Wholesale Fee \n --- \n The **Offer Formula** section is where you enter in the parameters of your offer formula. The Max Offer Allowed (MAO) will be autocalculated so you can quickly see what you can offer and still make money."');
Field_Money($appId,"Owner Asking","Amount owner is asking for the property",13,false);
$fld_arv = Field_Money($appId,"After Repair Value (ARV)","",14,false);
$fld_x = Field_Money($appId,"X% (in decimals)","Percentage off of ARV you use",15,false);
$fld_repairs = Field_Money($appId,"Repair Costs","Total estimated repair costs",16,false);
Field_Calc($appId,"Total w/o Fee","",17,"(@[After Repair Value (Arv)](field_$fld_arv) * @[X % (in decimals)](field_$fld_x)) - @[Repair Costs](field_$fld_repairs)");
$fld_fee = Field_Money($appId,"Wholesale Fee","how much are you going to ask for with your wholesale fee",18,false);
Field_Calc($appId,"Max Allowable Offer (MAO)","",19,"(@[After Repair Value (Arv)](field_$fld_arv) * @[X % (in decimals)](field_$fld_x)) - @[Repair Costs](field_$fld_repairs) - @[Wholesale Fee](field_$fld_fee)");
Field_Text($appId,"Additional Information","",20,"large",false);
Field_Calc($appId,">","",21,"var a = @[Full Address](field_$full_address_id); " . '"# Links \n --- \n The **Links** section is a good place to enter in website addresses for information about this property. Such links might be MLS Listing, Link to Pictures, Tax Records and more."');
Field_Link($appId,"Tax Assessment","",22);
Field_Link($appId,"MLS Listing","",23);
Field_Date($appId,"Hidden Date","Don't remove this field",24,false,"disabled","disabled","DCEBD8",false);
Field_Calc($appId,">","",12,"var a = @[Full Address](field_$full_address_id); " . '"# Google Address Information \n --- \n The **Google Address Information** section is automatically pulled from Google. This contains the full address (Street Number, Street Name, City, Neighborhood, State, County, Country, Zip and Zip+4) and Longitude/Latitude for the property."');
}
?>
<?php
require_once './PodioAPI.php';
require_once './podiobrowsersession.php';
// Set up the REDIRECT_URI -- which is just the URL for this file.
define("REDIRECT_URI", 'http://strugglinginvestor.com/podio/Podio-Authentication.php');
define("CLIENT_ID", 'realestatecrm');
define("CLIENT_SECRET", 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
include 'Podio-Fields-Add-Functions.php';
include 'Podio-Setup-Contacts.php';
include 'Podio-Setup-Properties.php';
include 'Podio-Setup-PropDetails.php';
include 'Podio-Setup-Deals.php';
include 'Podio-Setup-UnderContracts.php';
include 'Podio-Setup-Offers.php';
include 'Podio-Setup-Workup.php';
include 'Podio-Setup-Buyers.php';
$setup = Podio::setup(CLIENT_ID, CLIENT_SECRET, array('session_manager' => 'PodioBrowserSession'));
if (Podio::is_authenticated() && isset($_GET['orgid'])) {
Podio::set_debug(true, 'file');
try {
$spaceId = CreateSpace();
} catch(Exception $e) {
print "<br/>Problem creating Workspace";
}
// CREATE APPS
try {
$appContacts = CreateAppContacts($spaceId);
$appBuyers = CreateAppBuyers($spaceId);
$appDetails = CreateAppPropDetails($spaceId);
$appDeals = CreateAppDeals($spaceId);
$appOffers = CreateAppOffers($spaceId);
$appContracts = CreateAppUnderContracts($spaceId);
$appProperties = CreateAppProperty($spaceId);
$appWorkups = CreateAppWorkups($spaceId);
} catch(Exception $e) {
print "<br/>Problem creating Apps";
}
print "<br/>Apps Created!";
// CREATE FIELDS
try {
CreateFieldsContacts($appContacts);
CreateFieldsBuyers($appBuyers);
CreateFieldsPropDetails($appDetails,$appProperties);
CreateFieldsDeals($appDeals,$appProperties,$appBuyers);
CreateFieldsOffers($appOffers,$appProperties);
CreateFieldsUnderContracts($appContracts,$appProperties,$appBuyers);
CreateFieldsProperties($appProperties,$appContacts,$appDetails,$appDeals,$appOffers,$appContracts,$appWorkups);
CreateFieldsWorkups($appWorkups,$appProperties);
} catch(Exception $e) {
print "<br/>Problem creating Fields";
}
print "<br/>Fields Created!";
Podio::set_debug(false);
print "<br/>Finished!";
} else {
print "Missing Org Id";
}
function CreateSpace() {
$ar = array(
org_id => intval($_GET['orgid']),
privacy => "closed",
auto_join => false,
name => "AutomatedTest2",
post_on_new_app => false,
post_on_new_member => false
);
$response = PodioSpace::create($ar);
// echo serialize($response);
return $response['space_id'];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment