Code Monkey home page Code Monkey logo

fidelity-cards's Introduction

Fidelity Cards

screenshot This is an application to manage fidelity cards of a small business. This system is able to manage different type of cards:

  • Business
  • Standard
  • Gift card

Type of cards

The business, as the standard, is a cards type that is able to collect points whenever they are added and then return a discount value when enough point are collected. The value are parameters that can be set in config/config.js file (see config file section below). The gift card instead, is thought as a card that store a certain amount of point at the beginning and then is able to use that points later.

Config File

The configuration files contains several values that can be used to customize the app. It can be created starting from the template, in the src/config folder. It contains an object, called discounts that store the minimum quantity of points that a card must have to be able to use a discount, and, given that amount of point, how many € the customer receives. With the default configuration, every 200 points, a customer is able to use 10€ discount if it is a business user, or, every 50 points the customer can use 5€ discount if it is a standard user.

export const appConfig = {
    appName: 'Fidelity Cards',
    discounts: {
        business: {
            at: 200,
            value: 10,
        },
        standard: {
            at: 50,
            value: 5,
        }
    },
    minAmountAtEndOfTheYear: 200,
};

How to translate the app

mkdir i18n && npx ttag init uk i18n/uk.po  # Generate the po file if not present, otherwise...
npx ttag update i18n/uk.po src/  # ... just update it
npx ttag po2json i18n/uk.po > src/i18n/uk.json  # Convert it to a JSON to be loaded by the app

Now that you have a JSON file, you can duplicated and translate it in your language (PR are well accepted :D). Then in the App.js file, change imported line with your current locale:

import translation from './i18n/it.json';

Apache Configuration

This application uses React Router. It requires Apache rewrite rules correctly set to work. The following example assumes the application runs in cards subdirectory.

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# Fallback all other routes to index.html
RewriteRule ^ /cards/index.html [L]

DEMO

You can try a demo here using account:

TO DO LIST

  • Avoid to remove Gift Cards when "Remove all Cards" or "Remove Cards under 200 pt" is clicked in the All Cards page
  • Avoid to show Chart when Gift Card

fidelity-cards's People

Contributors

alessandro308 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

josep112

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.