FILES TO ADD FIELDS IN DATABASE FASTER.
CSV FILES 

When you use this files you will need to update the field Type for Images and for the urls, also for the Properties collection change field type reference to Reference and connect the agents collection. watch video for this to be clear. 

Members Code: This goes in the masterPage.js

import wixUsers from 'wix-users';

import wixData from 'wix-data';

import wixLocation from 'wix-location';

 

$w.onReady( () => {

  if(wixUsers.currentUser.loggedIn) {

    $w("#loginButton").label = "Logout";

    $w("#profileButton").show();

  } else {

    $w("#loginButton").label = "Login";

    $w("#profileButton").hide();

  }

} );

 

export function loginButton_click(event) { 

  // user is logged in

  if(wixUsers.currentUser.loggedIn) {

    // log the user out

    Promise.all( [ wixLocation.to('/#page1'), wixUsers.logout() ] )

      .then( () => {

        // update buttons accordingly

        $w("#loginButton").label = "Login";

        $w("#profileButton").hide();

    } );

  }

  // user is logged out

  else {

    let userId;

    let userEmail;

  

    // prompt the user to log in 

    wixUsers.promptLogin( {"mode": "login"} )

      .then( (user) => {

        userId = user.id;

        return user.getEmail();

      } )

      .then( (email) => {

        // check if there is an item for the user in the collection

        userEmail = email;

        return wixData.query("Agents")

          .eq("_id", userId)

          .find();

      } )

      .then( (results) => {

        // if an item for the user is not found

        if (results.items.length === 0) {

          // create an item

          const toInsert = {

            "_id": userId,

            "email": userEmail

          };

          // add the item to the collection

          wixData.insert("Agents", toInsert)

            .catch( (err) => {

              console.log(err);

            } );

        }

        // update buttons accordingly

        $w("#loginButton").label = "Logout";

        $w("#profileButton").show();

      } )

      .catch( (err) => {

        console.log(err);

      } );

  }

}

 

export function profileButton_click(event) {

  wixLocation.to(`/agents/${wixUsers.currentUser.id}`); 

}

DROPDOWN CODE

///////////////// THIS CODE GOES IN THE HOME PAGE. ////////////////

 

/////////// HOME DROPDOWN FILTERS //////

 

import wixData from 'wix-data';


 

export function search() {

 

    wixData.query("Properties")

    

 

        .contains("mainLocation", String($w("#dropdown1").value))

        .contains("type", String($w("#dropdown2").value))

        .contains("bathrooms", String($w("#dropdown3").value))

        .contains("bedrooms", String($w("#dropdown4").value))

        

        

 

 

        .find()

 

        .then( results => {

            $w("#repeatermain").data = results.items;    

             $w("#pagination1").hide();

         

        });

 

}

 

export function SubmitBTN_click(event) {

    search();               

}


 

export function ResetBTN_click(event) {

    $w('#searchDataset').setFilter(wixData.filter())

    $w("#pagination1").show();

    $w('#dropdown1').value = undefined;

    $w('#dropdown2').value = undefined;

    $w('#dropdown3').value = undefined;

    $w('#dropdown4').value = undefined;

    

    

}

BOX STATES - CHANGE USING BUTTONS

////////////////// BOX STATES - CHANGE STATE USING BUTTONS ///////////////

 

$w.onReady(function () {

 

    $w('#ProfileButton').onClick(() => {

        $w('#stateBox').changeState("Profile");

    })

    $w('#NewListingButton').onClick(() => {

        $w('#stateBox').changeState("NewListing");

    })

    $w('#UpdtadeListingButton').onClick(() => {

        $w('#stateBox').changeState("UpdateListing");

    })

    $w('#UpdateProfileButton').onClick(() => {

        $w('#stateBox').changeState("MyAccount");

    })

    

 

})

SINGLE DROPDOWN FOR UPDATE REPEATER

/////// UPDATE LISTING DROPDOWN /////////////


 

import wixData from 'wix-data';


 

export function dropdown1_change(event) {

    wixData.query("Properties")

    

        .contains("propertyName", String($w("#dropdown1").value))

 

        .find()

 

        .then( results => {

            $w("#repeatermain").data = results.items;    

             

         

        });

}