addScopeJS(["Approach", "Component", "Listing"], {

	GetUserListings: function(context) {
		let current_prop = context.current_prop; // Assumes Approach_Subcomponent prop type with a label.AutoLabel and a ul.AutoList
		let binding_index = context.binding_index;
		let binding = context.binding;
		let data = context.data;
		let container = current_prop.find("select").first();

		let DataIntent = {
			"command": {
				"REFRESH": {
					"Component": "GetUserListings"
				}
			},
			"support": {
				"component_id": 0,
				"which_component": "Listing"
			}
		};
		console.log('Calling Intent: ', DataIntent.command);
		console.log('Supporting intent with data: ', DataIntent.support);
		var ReqData = {
			json: JSON.stringify(DataIntent)
		};

		$.ajax({
			url: "__api/Utility.php", //url of Utility.php
			type: "post",
			data: ReqData, //the json data
			dataType: "json",
			xhrFields: {
				withCredentials: true
			},
			crossDomain: true,
			success: function(json, status, xhr) {
				let payload = json["REFRESH"]["#Dynamics"];
				container.append(payload);
			}
		});

		// TODO: Add new slide button

		return true;
	}

});
