Features

Order (fx-orderapp)

The bundled ordering and courier app for the city's businesses, how it installs into the phone, its main settings and its exports.

#What it is

fx-orderapp is an ordering and courier app for the city's businesses. A boss registers the business from the app and builds its menu from the items in its stock. A customer orders for courier delivery or pickup and pays on delivery with cash, bank or an invoice.

The app also runs without a phone as a tablet, opened with a command.

FX Phone only lets the app start when ['fx-orderapp'] is true in Config.BundledApps (configs/config_apps.lua). Check that entry if the app does not start. See Apps.

#Requirements

Resource Required
ox_lib Yes
oxmysql Yes
ox_inventory Yes (stock, products, handing over items)
A framework qb-core, qbx_core, ESX or standalone through bridge/server.lua
fx-phone No. Without a phone the app opens as a tablet
fx-billingapp Only for the invoice payment method

#Installation

Start it after ox_lib, oxmysql, ox_inventory, the framework and the phone:

cfgensure fx-phone
ensure fx-orderapp
  • The tables are created on first start (fxo_businesses, fxo_orders, fxo_ledger, fxo_reviews, fxo_favorites, fxo_wallets, fxo_pending).
  • Admin permission:
cfgadd_ace group.admin fxorder.admin allow

The qb-core permission groups in Config.Admin.Groups also count as admins.

#How it registers into the phone

With Config.Phone.Resource = 'auto' the first started phone is used: fx-phone, then lb-phone, then cylex_phone. The FX Phone adapter (client/phone/fxphone.lua) registers the app with exports['fx-phone']:AddCustomApp, using Config.Phone.AppIdentifier (default fx_order), AppName, Description, Developer, Icon, DefaultApp and Size.

#Setting up a business

  1. The boss of a job sends the registration from the Business tab. With Config.Registration.RequireApproval = true an admin approves it from the Admin tab. An admin can also open a business for a job directly.
  2. Points. The boss or an admin stands at the counter and sets it. The courier bike point is optional; stand facing the way the bike should face.
  3. The business stock opens at the counter point. Put the products to sell there.
  4. Menu. Add products from ox_inventory items, give them a price and category, and build combos.
  5. Profile (cover, logo, description, type, featured items) and Settings (published, taking orders, courier and pickup, payment methods, courier cut, employee commission).

A business is listed once it is approved, published and has a counter point.

#Order flow

  • The customer places the order. Staff can also send an offer to a customer by id, which the customer accepts within Config.Orders.OfferSeconds.
  • An employee on duty near the counter packs the order. The products move from stock to the order.
  • A courier takes it from the counter; the bike comes out against a deposit. Next to the customer the courier marks it delivered, and the customer pays within Config.Orders.PayWindow. On payment the products go to the customer's inventory.
  • From the total, tax (Config.Payout.Tax), the courier cut and the employee commission are taken; the rest goes to the business account. Every movement is in the business ledger and every order has a timeline in the records.
  • Cancelling is free before packing. After packing the customer pays Config.Orders.CancelFee percent and the products return to stock.

#Config highlights

Setting Meaning
Config.Locale tr or en
Config.Phone Phone choice, AppIdentifier, AppName, Title, Icon, DefaultApp, Theme, Notify
Config.Standalone Tablet mode: Enabled, Command (default siparis), Key, AllowWithPhone
Config.Admin ACE name and framework groups that count as admin
Config.Registration Enabled, RequireApproval, Fee, BlockedJobs, AllowedJobs
Config.Points Who may set points, ranges for stock, packing and pickup, stock size
Config.Menu Product and combo limits, price range, blocked items and patterns
Config.Orders Cooldown, open-order limits, prepare and deliver timeouts, cancel fee, handover range, pay window, courier limits, history length
Config.Payments Which payment methods are on: Cash, Bank, Invoice
Config.Payout Tax, CourierCut, Commission ranges and where commission is paid
Config.Bike The courier bike and its deposit
Config.Society, Config.Billing, Config.Keys Which society account, billing and key resources to use; auto detects them
Config.Reviews, Config.Chat, Config.Map Reviews, order chat and map markers
Config.ImageHosts Hosts that business images may come from
Config.Ledger, Config.Log Ledger page size and retention, action log

Bridge files that are not encrypted:

File For
bridge/server.lua Framework: qb-core, qbx_core, ESX, standalone
bridge/society.lua Business account: tgiann-bank, Renewed-Banking, qb-management, esx_society. If none is found the money is kept in the app's own till and the boss withdraws it from Settings
bridge/inventory.lua ox_inventory
bridge/billing.lua fx-billingapp: the invoice is issued in the business's name
bridge/keys.lua Bike keys
client/phone/*.lua Phone adapters

#Logs

Every step is written to data/log.json (Config.Log). The server console command fxolog searches it by order id, business, citizen id, player id or event.

#Exports

Export Side Purpose
GetBusiness(job) Server Returns { key, label, status, listed } for the job's business, or nil
OpenApp() Client Opens the app as a tablet
CloseApp() Client Closes the tablet
lualocal business = exports['fx-orderapp']:GetBusiness('burgershot')