Web based app to manage products, customers' data and customers' orders in a local shop.
Final capstone project at Bloc before graduating.
Demo available here on Heroku platform.
The source code is on GitHub at: https://github.com/silvio-galli/paperless
Skip to Features | Users | Welcome page | Products | Customers | Orders
The project is based on Ruby on Rails, uses Bootstrap for the layout and other elements on the page.
Database seeding is obtained using the Faker gem.
The project makes also use of the jquery-barcode javascript library to insert products' barcode on the order page to easily pass the product at the counter.
Environment variables and keys are managed with the help of Figaro gem.
Authentication is managed through the Devise gem.
The application needed to give user creation prerogative to admin users only and no possibility to sign up from the outside. As Devise do not allow signed in users to access registrations#new, I added before_action :require_admin and skip_before_action :require_no_authentication callback and def sign_up(resource_name, resource) true end to RegistrationsController to allow already authenticated admin users to access registrations#new in Devise::RegistrationsController and avoid automatic sign in after new user creation.
Authorization is not implemented yet.
There's only a require_admin method in the ApplicationController class to prevent non admin users to access users' resources. It is called in Admin::UsersController and Admin::DashboardController (where admin users can manage standard users to reset their password) and inside RegistrationsController to prevent standard users to create new users (only admin users are allowed to).
I implemented a simple Search function after watching this screencast on CodeSchool.com.
The search runs on Product or Customer tables only.
The files involved are search.rb, search_controller.rb and search/index.html.rb.
Background jobs are managed using the Sidekiq gem.
The applications uses two jobs:
ImportProductsFromCsvJobto import products into the database from a CSV file.SendEmailNotificationJobto email customers when their product arrive.
Pagination is implemented through will_paginate gem.
Changes on orders are tracked using the PaperTrail gem.
When dealing with customers' order it is possible to encounter problems and it could be useful to understand where and why the order processing stuck. Tracking changes on orders can be useful to approach possible problems.
Localization: English/Italian.
Known Issues:
ImportProductsFromCsvJobdoes not work in demo app running on Heroku. As I want the import function to run as a background job, I decided to save data on a file in public folder so that they could be reached later. This works perfectly locally, but on Heroku the filesystem is ephemeral and changes do not persist. So I will need to save data on an external storage service if I want to keep import as a background job
Landing page:
Sign in page:
The assumption is:
- users are employees in the shop;
- users can be
adminor standard; - users do not have email address;
- only
adminuser can create new users;
Users can sign in and out, through name and password.
Every user can create new products, orders and customers.
Every user can edit and update products, orders and customers created by other users.
Only admin users can import products into the db through a CSV file.
Admin page:
Only admin users can access this page.
Links to demo users and adminedit, are hidden in order to mantain these users available on heroku demo app.
However, it is still possible to access users#edit and modify users data. This will be fixed as soon as possible through authorization controller.
Landing page after sign in:
On this page the user can find many informations and links to products, orders and customers.
On the products table, products status is displayed through a meaningful coloured background:
- light green ->
in_stock - light yellow ->
arrivingon time - light red ->
arrivinglate On the right you can find the Arrived button. Clicking on that button will change thestatusof the product and start the email notification process to customers waiting for it.
On the orders table, users can find orders' progressive numbers, orders' customer name and on the right the Close button, which users have to click on when customer come and collect their products.
New product page:
Products are described by:
initiative, the fact that they can be included in a promo; usually, indicated by promo number/current year;- if left blank,
initiativewill default to no promo value; local_code, an numeric code that refers to the product (required);description(required);barcode(required);default_promo, product price without promotion (required ifpromo_priceis blank);promo_price, product price when included in promotion (required ifdefault_priceis blank);quantity, available or arriving (required);status, can be in stock or arriving (required);arriving_date, is required ifproduct.statusis set to arriving.
Product index page:
This page shows many products and their important data.
Products status is displayed through a coloured Bootstrap label, while the right you can find the Arrived button. Clicking on that button will change the status of the product and start the email notification process to customers waiting for it.
Customers index page:
This page takes a list of customers and their info.
On the right you have links to show and edit pages and a button to create a new order for customers.
Customers show page:
The customers/show page brings all informations about the customer and a Orders history table were the users can retrieve customer's orders and their status, displayed through a coloured label.
Orders index page:
The table here is very similar to the one on the landing page after sign in.
It stores all data from orders; status is displayed through a coloured label, while on the right there's a button to close the order when customers come and collect their products.
Orders show page:
This page brings informations on order's customer (name, email, phone), on the shop and on order's products (barcode, description, quantity, item price and total price).
This is a crucial page for the application. Here users can add and remove products from customers' orders.
Products can be added to order from a dropdwon menu, while they can be removed clicking on the Remove button on the right.
The dropdown menu lists the available products and their remaining quantity.
Once the product quantity reaches zero, it disappears from the dropdown list.
Users can print this page, cleared of useless info with @media print css styling, as a receipt for the customer.









