MPH-Bali / green-village-project

Powering MPH recycling and composting facilities in Bali
MIT License
9 stars 8 forks source link

green-village-project

Powering MPH recycling and composting facilities in Bali.

Access the current deployed app at FirebaseApp

Links

Design Trello Board

UX Whiteboard - RealtimeBoard

Wireframes - Facility Manager

Wireframes - backend super admin

Wireframes - public facing web

Zeplin desings Make sure you are registered and added to the project to view those. If you need adding to the project contact Andrea (sovesove) or Daria (piggydoughnut) or Nick Sarafa (nicksarafa)


How to contribute

Git workflow

Internal team

External contributions

If you would like to become a part of our team and be added to the repository, please contact Daria (piggydoughnut) or Nick Sarafa (nicksarafa).


Front End with Vue.js ❤

The frontend can be found in the public directory and was initialised using Vue-CLI and the vuetify/webpack template.

Dependencies

DEV Dependencies

Style guides

Facility Manager - Architecture

The store is implemented using a single Vue instance that is made globably available through $firestore.

We're using firestore realtime data. Therefore all collections will be synced all the time and can be accessed from any component like this: $firestore.COLLECTION_NAME.

The following CRUD actions are available:

The app is designed to only look at a given day for all the forms and tables. The day can be changed using $firestore.changeDate(DATE).

Notifications

To use in-app toasts just $emit toast message to the manager component


Back End

Tests

Jest

Firebase Authentication

each user will have a corresponding user in Firebase

Security rules

Cloud Firestore Security rules structure allow you to control access to documents and collections in your database.


Firebase - example data

// All collections and are stored in the firestore
const settingsCollection = {
  name: 'Facility 1',
  village: 'Pererenan',
  importantVillageGuy: {
    id: 'Tu4SFfDhBUgAwGsvfopc', // person id
    name: 'Michael'
  },
  materialTypes: [
    {
      name: 'Plastic',
      pricePerKilo: 2000
    },
    {
      name: 'Metal',
      pricePerKilo: 2000
    }        
  ],
  expenseType: [
    'maintenance',
    'other'
  ],
  houseTypes: [
    'villa',
    'household',
    'business',
    'public facilities'
  ]
  // + other information about the facility that we might need
}

const personCollection = [
  {
    login: firebaseUserId, // Only for people with a login
    name: 'Test User',
    phone: '+62 123 123 123',
    whatsapp: '+62 123 123 123',
    address: 'Jalan Batu Mejan No. 88, Canggu, Kuta Utara, Kabupaten Badung, Bali 80361',
    email: 'some@address.com',
    geolocation: {
      latitude: '8.39111',
      longitude: '115.07361'
    },
    type: {
      employee: false,
      client: false,
      buyer: true
    },
    role: {
      communityManager: false,
      facilityManager: false,
      superAdmin: true
    },
    houseType: 'villa',
    approved: false,
        lastFeePaid: [Object fee]
  }
]

const deliveryCollection = [
  {
    timestamp: '2018-03-15T09:55:48.942Z',
    driver: {
      id: 'Tu4SFfDhBUgAwGsvfopc', // person id
      name: 'Michael'
    },
    banjar: {
      id: 'Tu4SFfDhBUgAwGsvfopc',
      name: 'Michael'
    }
  }
]

const workerHoursCollection = [
  {
    employee: {
      id: 'Tu4SFfDhBUgAwGsvfopc', // person id
      name: 'Michael'
    },
    in: '2018-03-15T09:55:48.942Z',
    out: null
  }
]

const stockCollection = [
  {
    timestamp: '2018-03-15T09:55:48.942Z',
    materialType: 'plastic',
    amount: 200
  }
]
const expenseCollection = [
  {
    description: 'Limited Furby Collection',
    amount: 20000000,
    person: {
      id: 'Tu4SFfDhBUgAwGsvfopc',
      name: 'Michael'
    }
  }
]

const saleCollection = [
  {
    buyer: {
      id: 'Tu4SFfDhBUgAwGsvfopc',
      name: 'Michael'
    },
    materials: [
      {
        materialType: 'plastic',
        kilo: 200,
        pricePerKilo: 20000
      }
    ]
  }
]

const feeCollection = [
  {
    timestamp: '2018-03-15T09:55:48.942Z',
    monthly_fee: 50,
    total_paid: 200,
    paid_until: '2018-07-15T09:55:48.942Z'
  }
]

const banjarCollection = [
  {
    name: 'Banjar Name',
    pickupTimes: [
      {
        day: 'Monday',
        time: '6am-2pm'
      },
      {
        day: 'Tuesday',
        time: '6am-2pm'
      }
    ]
  }
];

const materialCollection = [
 {
    worker: {
       id: 'Tu4SFfDhBUgAwGsvfopc',
       name: 'Worker name'
    },
    banjar: {
       id: 'Tu4SFfDhBUgAwGsvfopc',
       name: 'Banjar name'
    },
    organic: 10,
    inorganic: 10,
    timestamp: '2018-03-15T09:55:48.942Z'
   }
]

User roles

Community manager

Facility manager

Super admin

Other

There are more people in the system but they are not system users (have no login in the system) -


Predefined lists of values


Functionality

Auth

  1. Registration

    System users (community manager and facility manager) register using their mobile phone and an OTP sent to them via SMS.

  2. Application to register

    Customers apply to be added to the system, however they do not become system users.

  3. Authentication

    Firebase phone auth

    Phone numbers that end users provide for authentication will be sent and stored by Google to improve our spam and abuse prevention across Google services, including but not limited to Firebase. Developers should ensure they have appropriate end-user consent prior to using the Firebase Authentication phone number sign-in service.

    Users login through OTP. Users will only need to login if they change the device they are using.

Facility (community and facility managers)

  1. Add/edit delivery

    • driver (non system user, person)
    • banjar name(predefined list of values in db)
    • villas

    • households

    • businesses

    • public facilities

    • comment
  2. Add/edit material

    • worker (non system user, person)
    • inorganic material kg
    • organic material kg
    • banjar name (predefined list of values in db)
  3. Add/edit stock

    • weight kg
    • type of material (predefined list of values in db)
    • comment
  4. Add/edit worker hours

    • name
    • type
    • note
    • morning in/out hours
    • afternoon in/out hours
  5. Add/edit a new buyer

    • name
    • email
    • company
    • sms/call
    • whatsapp
    • address
    • notes
  6. Add/edit a sale

    • buyer name (chosen from existing customers in the database)
    • records with:
      • material name
      • kg
      • price per kg
      • total price
      • final price (can be negotiated to be different than adviced price)
  7. Add/edit an expense

    • type (predefined list of values in db, e.g. fuel, maintenance)
    • cost
    • notes
  8. Add/edit a customer - automatically prefilled from a customer application

    • name
    • type (household, villa, business)
    • email
    • company
    • sms/call
    • whatsapp
    • address
    • notes
  9. Approve customer application (community manager)

    add "approved" flag to the customer detail

  10. Collect the fee from a customer (community manager)

    1. Add a fee collection record

      • date time
      • monthly fee
      • total paid ?
      • paid until
    2. Send a confirmation email to the customer

  11. Add/edit daily note

    • note text
  12. User actions log

Community public page

  1. Submission of a feedback/contact us form

Cloud Functions


Definitions