From 6b6aef33f651c6f10e0d61c2f5b90c86d2ea0b38 Mon Sep 17 00:00:00 2001 From: Michael Howden Date: Sat, 2 May 2015 14:03:05 +1200 Subject: [PATCH] * Minor Homepage enhancements for Nepal + remove CMS Menu * Enable & Enhance Inv for Nepal --- controllers/inv.py | 5 + modules/s3db/inv.py | 5 +- modules/s3db/supply.py | 2 +- modules/templates/Nepal/config.py | 126 +- modules/templates/Nepal/controllers.py | 99 +- modules/templates/Nepal/css.cfg | 43 - modules/templates/Nepal/menus.py | 105 + modules/templates/Nepal/tasks.cfg | 11 + modules/templates/Nepal/views/index.html | 25 +- modules/templates/Nepal/views/inv_index.html | 33 + modules/templates/default/css.cfg | 2 +- .../fonts/font-awesome/css/font-awesome.css | 1801 +++++++++++++++++ .../font-awesome/css/font-awesome.min.css | 4 + .../fonts/font-awesome/fonts/FontAwesome.otf | Bin 0 -> 93888 bytes .../fonts/fontawesome-webfont.eot | Bin 0 -> 60767 bytes .../fonts/fontawesome-webfont.svg | 565 ++++++ .../fonts/fontawesome-webfont.ttf | Bin 0 -> 122092 bytes .../fonts/fontawesome-webfont.woff | Bin 0 -> 71508 bytes .../fonts/fontawesome-webfont.woff2 | Bin 0 -> 56780 bytes static/fonts/font-awesome/less/animated.less | 34 + .../font-awesome/less/bordered-pulled.less | 16 + static/fonts/font-awesome/less/core.less | 13 + .../fonts/font-awesome/less/fixed-width.less | 6 + .../fonts/font-awesome/less/font-awesome.less | 17 + static/fonts/font-awesome/less/icons.less | 596 ++++++ static/fonts/font-awesome/less/larger.less | 13 + static/fonts/font-awesome/less/list.less | 19 + static/fonts/font-awesome/less/mixins.less | 27 + static/fonts/font-awesome/less/path.less | 15 + .../font-awesome/less/rotated-flipped.less | 20 + static/fonts/font-awesome/less/stacked.less | 20 + static/fonts/font-awesome/less/variables.less | 606 ++++++ static/fonts/font-awesome/scss/_animated.scss | 34 + .../font-awesome/scss/_bordered-pulled.scss | 16 + static/fonts/font-awesome/scss/_core.scss | 13 + .../fonts/font-awesome/scss/_fixed-width.scss | 6 + static/fonts/font-awesome/scss/_icons.scss | 596 ++++++ static/fonts/font-awesome/scss/_larger.scss | 13 + static/fonts/font-awesome/scss/_list.scss | 19 + static/fonts/font-awesome/scss/_mixins.scss | 27 + static/fonts/font-awesome/scss/_path.scss | 15 + .../font-awesome/scss/_rotated-flipped.scss | 20 + static/fonts/font-awesome/scss/_stacked.scss | 20 + .../fonts/font-awesome/scss/_variables.scss | 606 ++++++ .../fonts/font-awesome/scss/font-awesome.scss | 17 + static/themes/CERT/homepage.css | 28 +- static/themes/default/eden.min.css | 2 +- 47 files changed, 5554 insertions(+), 106 deletions(-) delete mode 100644 modules/templates/Nepal/css.cfg create mode 100644 modules/templates/Nepal/menus.py create mode 100644 modules/templates/Nepal/views/inv_index.html create mode 100644 static/fonts/font-awesome/css/font-awesome.css create mode 100644 static/fonts/font-awesome/css/font-awesome.min.css create mode 100644 static/fonts/font-awesome/fonts/FontAwesome.otf create mode 100644 static/fonts/font-awesome/fonts/fontawesome-webfont.eot create mode 100644 static/fonts/font-awesome/fonts/fontawesome-webfont.svg create mode 100644 static/fonts/font-awesome/fonts/fontawesome-webfont.ttf create mode 100644 static/fonts/font-awesome/fonts/fontawesome-webfont.woff create mode 100644 static/fonts/font-awesome/fonts/fontawesome-webfont.woff2 create mode 100644 static/fonts/font-awesome/less/animated.less create mode 100644 static/fonts/font-awesome/less/bordered-pulled.less create mode 100644 static/fonts/font-awesome/less/core.less create mode 100644 static/fonts/font-awesome/less/fixed-width.less create mode 100644 static/fonts/font-awesome/less/font-awesome.less create mode 100644 static/fonts/font-awesome/less/icons.less create mode 100644 static/fonts/font-awesome/less/larger.less create mode 100644 static/fonts/font-awesome/less/list.less create mode 100644 static/fonts/font-awesome/less/mixins.less create mode 100644 static/fonts/font-awesome/less/path.less create mode 100644 static/fonts/font-awesome/less/rotated-flipped.less create mode 100644 static/fonts/font-awesome/less/stacked.less create mode 100644 static/fonts/font-awesome/less/variables.less create mode 100644 static/fonts/font-awesome/scss/_animated.scss create mode 100644 static/fonts/font-awesome/scss/_bordered-pulled.scss create mode 100644 static/fonts/font-awesome/scss/_core.scss create mode 100644 static/fonts/font-awesome/scss/_fixed-width.scss create mode 100644 static/fonts/font-awesome/scss/_icons.scss create mode 100644 static/fonts/font-awesome/scss/_larger.scss create mode 100644 static/fonts/font-awesome/scss/_list.scss create mode 100644 static/fonts/font-awesome/scss/_mixins.scss create mode 100644 static/fonts/font-awesome/scss/_path.scss create mode 100644 static/fonts/font-awesome/scss/_rotated-flipped.scss create mode 100644 static/fonts/font-awesome/scss/_stacked.scss create mode 100644 static/fonts/font-awesome/scss/_variables.scss create mode 100644 static/fonts/font-awesome/scss/font-awesome.scss diff --git a/controllers/inv.py b/controllers/inv.py index 4f8e31148a..155d0298af 100644 --- a/controllers/inv.py +++ b/controllers/inv.py @@ -1009,6 +1009,11 @@ def set_track_attr(status): tracktable.recv_bin.writable = True def prep(r): + if r.vars.get("recv.status") == '2': + s3.crud_strings.inv_recv.title_list = T("Existing Shipments to Received") + if r.vars.get("recv.status__ne") == '2': + s3.crud_strings.inv_recv.title_list = T("Received Shipments") + record = r.record if record and \ record.status not in (SHIP_STATUS_IN_PROCESS, SHIP_STATUS_SENT): diff --git a/modules/s3db/inv.py b/modules/s3db/inv.py index 11aa3b55ed..4ca8d6e524 100644 --- a/modules/s3db/inv.py +++ b/modules/s3db/inv.py @@ -2142,7 +2142,8 @@ def inv_send_controller(cls): s3 = response.s3 # Limit site_id to sites the user has permissions for - error_msg = T("You do not have permission for any facility to send a shipment.") + error_msg = T("You do not have permission for any %(site)s to send a shipment.") % \ + dict(site=current.deployment_settings.get_inv_facility_label) current.auth.permitted_facilities(table=sendtable, error_msg=error_msg) # Set Validator for checking against the number of items in the warehouse @@ -2534,7 +2535,7 @@ def inv_send_process(): site_id = send_record.to_site_id, comments = send_record.comments, status = SHIP_STATUS_SENT, - type = 1, # 1:"Another Inventory" + type = 11, # 11:"Another Inventory" ) # Change the status for all track items in this shipment to In transit diff --git a/modules/s3db/supply.py b/modules/s3db/supply.py index 8c4f6faebd..4fe25e3ec3 100644 --- a/modules/s3db/supply.py +++ b/modules/s3db/supply.py @@ -434,7 +434,7 @@ def model(self): supply_item_represent, sort=True), sortby = "name", - widget = S3AutocompleteWidget("supply", "item"), + #widget = S3AutocompleteWidget("supply", "item"), comment=S3AddResourceLink(c="supply", f="item", label=ADD_ITEM, diff --git a/modules/templates/Nepal/config.py b/modules/templates/Nepal/config.py index d5754b9175..42fb6ac247 100644 --- a/modules/templates/Nepal/config.py +++ b/modules/templates/Nepal/config.py @@ -23,7 +23,7 @@ def config(settings): T = current.T settings.base.system_name = T("Nepal Sahana Disaster Management Platform") - #settings.base.system_name_short = T("Sahana") + settings.base.system_name_short = T("Sahana") # PrePopulate data settings.base.prepopulate = ("Nepal", "default/users") @@ -128,6 +128,108 @@ def config(settings): # Uncomment to disable the Commit step in the workflow & simply move direct to Ship settings.req.use_commit = False + def customise_inv_home(): + response = current.response + response.title = T("Sahana : Warehouse Management") + s3 = response.s3 + s3.stylesheets.append("../themes/CERT/homepage.css") + response.title + from s3 import S3CustomController + S3CustomController._view("Nepal","inv_index.html") + menus = [{"title": T("Receive"), + "icon": "sign-in", + "description": T("Receive a New shipment or an Existing shipment at your site"), + "module": "inv", + "function": "recv", + "args": None, + "vars": {"recv.status":2}, + "buttons": [{"args": "create", + "icon": "plus", + "label": T("New"), + }, + {"args":"list", + "vars": {"recv.status":2}, + "icon": "list", + "label": T("Existing"), + }] + }, + {"title": T("Send"), + "icon": "sign-out", + "description": T("Send a shipment from your site."), + "module": "inv", + "function": "send", + "args": "create", + "buttons": [{"args": "create", + "icon": "plus", + "label": T("New"), + }] + }, + {"title": T("Stock"), + "icon": "cubes", + "description": T("List of stock at sites"), + "module": "inv", + "function": "inv_item", + "args": None, + "buttons": [{"args": "create", + "icon": "square", + "label": T("Your Site"), #@ToDo: look up name of facility + }, + {"args": "list", + "icon": "th", + "label": T("All"), + }] + }, + {"title": T("Received Shipments"), + "icon": "indent", + "description": T("List of received shipments"), + "module": "inv", + "function": "recv", + "args": "summary", + "vars": {"recv.status__ne":2}, + "buttons": [{"args":"list", + "vars": {"recv.status__ne":2}, + "icon": "square", + "label": T("Your Site"), #@ToDo: look up name of facility + }, + {"args":"list", + "vars": {"recv.status__ne":2}, + "icon": "th", + "label": T("All"), + }] + }, + {"title": T("Sent Shipments"), + "icon": "outdent", + "description": T("List of sent shipments"), + "module": "inv", + "function": "send", + "args": "summary", + "buttons": [{"args": "create", + "icon": "square", + "label": T("Your Site"), #@ToDo: look up name of facility + }, + {"args": "list", + "icon": "th", + "label": T("All"), + }] + }, + {"title": T("Warehouses"), + "icon": "th", + "description": T("List of Warehouses."), + "module": "inv", + "function": "warehouse", + "args": "summary", + "buttons": [{"args": "create", + "icon": "plus", + "label": T("Create"), #@ToDo: look up name of facility + }, + {"args": "summary", + "icon": "list", + "label": T("All"), + }] + }, + ] + return dict(menus = menus) + settings.customise_inv_home = customise_inv_home # ------------------------------------------------------------------------- # Comment/uncomment modules here to disable/enable them # Modules menu is defined in modules/eden/menu.py @@ -185,7 +287,7 @@ def config(settings): #description = "Central point to record details on People", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) - module_type = 10 + module_type = None )), ("org", Storage( name_nice = T("Organizations"), @@ -197,7 +299,7 @@ def config(settings): name_nice = T("Staff"), #description = "Human Resources Management", restricted = True, - module_type = 2, + module_type = None, )), ("vol", Storage( name_nice = T("Volunteers"), @@ -209,7 +311,7 @@ def config(settings): name_nice = T("Content Management"), #description = "Content Management System", restricted = True, - module_type = 10, + module_type = None, )), #("doc", Storage( # name_nice = T("Documents"), @@ -231,12 +333,12 @@ def config(settings): restricted = True, module_type = None, # Not displayed )), - #("inv", Storage( - # name_nice = T("Warehouses"), - # #description = "Receiving and Sending Items", - # restricted = True, - # module_type = 4 - #)), + ("inv", Storage( + name_nice = T("Warehouses"), + #description = "Receiving and Sending Items", + restricted = True, + module_type = 4 + )), #("asset", Storage( # name_nice = T("Assets"), # #description = "Recording and Assigning Assets", @@ -272,10 +374,10 @@ def config(settings): name_nice = T("Hospitals"), #description = "Helps to monitor status of hospitals", restricted = True, - module_type = 10 + module_type = 3 )), ("patient", Storage( - name_nice = T("Patient Tracking"), + name_nice = T("Patient"), #description = "Tracking of Patients", restricted = True, module_type = 10 diff --git a/modules/templates/Nepal/controllers.py b/modules/templates/Nepal/controllers.py index c7f83c6a9e..bb640db7ec 100644 --- a/modules/templates/Nepal/controllers.py +++ b/modules/templates/Nepal/controllers.py @@ -64,37 +64,38 @@ def __call__(self): item = "" output["item"] = item - menus = [{"title": T("Volunteers"), - "icon": "user", - "description": T("Manage people who have volunteered for your organization, their contact details, certicates and trainings."), - "module": "vol", - "function": "volunteer", + menus = [{"title": T("Organizations"), + "icon": "sitemap", + "description": T("List of Organizations responding with contact details and their activities to provide 3W (Who's Doing What Where)."), + "module": "org", + "function": "organisation", + "args": None, "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Shelters"), - "icon": "home", - "description": T("List of Shelters."), - "module": "cr", - "function": "shelter", + {"title": T("Volunteers"), + "icon": "user", + "description": T("Manage people volunteering for your organization, their contact details, certificates and trainings."), + "module": "vol", + "function": "volunteer", "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, {"title": T("Hospitals"), - "icon": "h-sign", - "description": T("List of Hospitals."), + "icon": "hospital-o", + "description": T("List of Hospitals and other Health Facilities."), "module": "hms", "function": "hospital", "buttons": [{"args": "summary", @@ -102,51 +103,81 @@ def __call__(self): "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Patients"), - "icon": "ambulance", - "description": T("List of Patients."), - "module": "patient", - "function": "patient", + {"title": T("Warehouses"), + "icon": "th", + "description": T("Manage Warehouses, their stock and shipments."), + "module": "inv", + "function": "index", + "buttons": [{"function": "warehouse", + "args": "summary", + "icon": "list", + "label": T("View"), + }, + {"function": "warehouse", + "args": "create", + "icon": "plus", + "label": T("Create"), + }] + }, + {"title": T("Resources"), + "icon": "cube", + "description": T("Resources that organizations have that are useful for response."), + "module": "org", + "function": "resource", + "args": None, "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Requests"), - "icon": "truck", - "description": T("Requests for goods or services."), - "module": "req", - "function": "req", - "args": None, + {"title": T("Shelters"), + "icon": "home", + "description": T("List of Shelters for displaced people."), + "module": "cr", + "function": "shelter", "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, - {"title": T("Resources"), - "icon": "wrench", - "description": T("Resources that organizations have that are useful for response."), - "module": "org", - "function": "resource", + {"title": T("Patients"), + "icon": "ambulance", + "description": T("Register and of Patients."), + "module": "patient", + "function": "patient", + "buttons": [{"args": "summary", + "icon": "list", + "label": T("View"), + }, + {"args": "create", + "icon": "plus", + "label": T("Create"), + }] + }, + {"title": T("Requests"), + "icon": "truck", + "description": T("Requests for resources or services."), + "module": "req", + "function": "req", "args": None, "buttons": [{"args": "summary", "icon": "list", "label": T("View"), }, {"args": "create", - "icon": "plus-sign", + "icon": "plus", "label": T("Create"), }] }, diff --git a/modules/templates/Nepal/css.cfg b/modules/templates/Nepal/css.cfg deleted file mode 100644 index 0bcec78d39..0000000000 --- a/modules/templates/Nepal/css.cfg +++ /dev/null @@ -1,43 +0,0 @@ -../themes/default/layout.css -../themes/default/xtheme-gray.css -../themes/default/footer.css -../themes/default/widgets.css -../themes/default/shortcut.css -../themes/default/homepage.css -bootstrap/font-awesome.css -plugins/jquery.cluetip.css -plugins/jquery.dataTables.css -plugins/jquery.dataTables.responsive.css -#ui/accordion.css -ui/core.css -ui/autocomplete.css -ui/button.css -ui/datepicker.css -ui/dialog.css -# Needed for Delphi -#ui/draggable.css -ui/menu.css -#ui/progressbar.css -ui/resizable.css -ui/selectmenu.css -ui/slider.css -#ui/sortable.css -#ui/spinner.css -ui/tabs.css -#ui/tooltip.css -ui/fgtimepicker.css -ui/multiselect.css -ui/timepicker-addon.css -foundation/jquery-ui.theme.css -gis/style.css -zocial/zocial.css -../themes/default/gis.css -../themes/foundation/map.css -../themes/default/mobile.css -../themes/default/print.css -d3/nv.d3.css -../themes/default/report.css -../themes/default/survey.css -../themes/default/style.css -#../themes/MY_THEME/style.css -# Final line required for parsing diff --git a/modules/templates/Nepal/menus.py b/modules/templates/Nepal/menus.py new file mode 100644 index 0000000000..bcf0d27b64 --- /dev/null +++ b/modules/templates/Nepal/menus.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +from gluon import current +from s3 import * +from s3layouts import * +try: + from .layouts import * +except ImportError: + pass +import s3menus as default + +# ============================================================================= +class S3OptionsMenu(default.S3OptionsMenu): + """ + Custom Application Options Menu + + Define one function per controller with the controller prefix as + function name and with "self" as its only argument (must be an + instance method!), and let it return the controller menu + definition as an instance of the layout (=an S3NavigationItem + subclass, standard: M). + + In the standard layout, the main item in a controller menu does + not have a label. If you want to re-use a menu for multiple + controllers, do *not* define a controller setting (c="xxx") in + the main item. + """ + + def __init__(self, name): + """ Constructor """ + + try: + self.menu = getattr(self, name)() + except: + self.menu = None + + # ------------------------------------------------------------------------- + @staticmethod + def inv(): + """ INV / Inventory """ + + ADMIN = current.session.s3.system_roles.ADMIN + + current.s3db.inv_recv_crud_strings() + inv_recv_list = current.response.s3.crud_strings.inv_recv.title_list + + settings = current.deployment_settings + use_adjust = lambda i: not settings.get_inv_direct_stock_edits() + use_commit = lambda i: settings.get_req_use_commit() + + return M()( + M("Receive", c="inv", f="recv")( + M("New", m="create"), + M("Exiting", vars = {"a":1}), # + M("Received Shipments", m="summary"), # + M("Timeline", args="timeline"), + ), + M("Send", c="inv", f="send")( + M("New", m="create"), + M("Exiting", vars = {"a":1}), # + M("Sent Shipments", m="summary"), # + M("Search Shipped Items", f="track_item"), + M("Timeline", args="timeline"), + ), + M("Stock", c="inv", f="inv_item", m="summary")( + M("Adjust Stock Levels", f="adj", check=use_adjust), + M("Kitting", f="kitting"), + M("Import", f="inv_item", m="import", p="create"), + ), + M("Warehouses", c="inv", f="warehouse")( + M("Create", m="create"), + M("Import", m="import", p="create"), + ), + M("Requests", c="req", f="req")( + M("Create", m="create"), + M("Requested Items", f="req_item"), + ), + M("Commitments", c="req", f="commit", check=use_commit)( + ), + M("Reports", c="inv", f="inv_item")( + M("Warehouse Stock", f="inv_item", m="report"), + M("Expiration Report", c="inv", f="track_item", + vars=dict(report="exp")), + M("Monetization Report", c="inv", f="inv_item", + vars=dict(report="mon")), + M("Utilization Report", c="inv", f="track_item", + vars=dict(report="util")), + M("Summary of Incoming Supplies", c="inv", f="track_item", + vars=dict(report="inc")), + M("Summary of Releases", c="inv", f="track_item", + vars=dict(report="rel")), + ), + M("Administration", restrict=[ADMIN])( + M("Items", c="supply", f="item", m="summary"), + M("Catalogs", c="supply", f="catalog"), + M("Item Categories", c="supply", f="item_category", + restrict=[ADMIN]), + M("Suppliers", c="inv", f="supplier"), + M("Facilities", c="inv", f="facility"), + M("Facility Types", c="inv", f="facility_type", + restrict=[ADMIN]), + M("Warehouse Types", c="inv", f="warehouse_type", + restrict=[ADMIN]), + ) + ) diff --git a/modules/templates/Nepal/tasks.cfg b/modules/templates/Nepal/tasks.cfg index 9aefce6c21..448a254507 100644 --- a/modules/templates/Nepal/tasks.cfg +++ b/modules/templates/Nepal/tasks.cfg @@ -43,3 +43,14 @@ org,office_type,default/office_type.csv,office_type.xsl # ----------------------------------------------------------------------------- cms,post,cms_post.csv,post.xsl # ============================================================================= +# DEMO Data Only +# Inventory +inv,inv_item,inv_item.csv,inv_item.xsl +# Requests +req,req,test/inv-mngt/req_req.csv,req.xsl +req,req_item,test/inv-mngt/req_item.csv,req_item.xsl +# The order in which the items are shipped is important +# so do not try to change the order or merge the following track_item files +inv,track_item,test/inv-mngt/track_item1.csv,track_item.xsl +inv,track_item,test/inv-mngt/track_item2.csv,track_item.xsl +inv,track_item,test/inv-mngt/track_item3.csv,track_item.xsl diff --git a/modules/templates/Nepal/views/index.html b/modules/templates/Nepal/views/index.html index a4d7585d4d..d4d87d9208 100644 --- a/modules/templates/Nepal/views/index.html +++ b/modules/templates/Nepal/views/index.html @@ -1,5 +1,5 @@ {{extend "layout.html"}} -
+
+ {{i=0}} {{for menu in menus:}} + {{i+=1}} + {{if i>4:}} + {{i=0}} +
+
+ {{pass}}
-

+

{{=menu["title"]}}

- + {{if "buttons" in menu:}} + + {{pass}}

{{=menu["description"]}}

{{pass}} diff --git a/modules/templates/Nepal/views/inv_index.html b/modules/templates/Nepal/views/inv_index.html new file mode 100644 index 0000000000..b53962f05c --- /dev/null +++ b/modules/templates/Nepal/views/inv_index.html @@ -0,0 +1,33 @@ +{{extend "layout.html"}} +