Skip to content

Commit

Permalink
U4X-269 : Request for information on the possibility of printing oper…
Browse files Browse the repository at this point in the history
…ation notes such as Goods Received Note (#54)

* ft : setup printing

* setup print

* add  print

* remove unneccesary code

* fix lint errors

* refactor

* fix stock module non-display

* add received notes, receipt print
  • Loading branch information
jabahum authored Jan 11, 2024
1 parent 23f3d84 commit b2ff56f
Show file tree
Hide file tree
Showing 22 changed files with 1,812 additions and 60 deletions.
27 changes: 10 additions & 17 deletions src/config-schema.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import { Type, validator } from "@openmrs/esm-framework";
import { Type } from "@openmrs/esm-framework";
export const configSchema = {
casualGreeting: {
_type: Type.Boolean,
printItemCost: {
type: Type.Boolean,
_default: false,
_description: "Whether to use a casual greeting (or a formal one).",
_description: "Whether to print item costs on the print out",
},
whoToGreet: {
_type: Type.Array,
_default: ["World"],
_description:
"Who should be greeted. Names will be separated by a comma and space.",
_elements: {
_type: Type.String,
},
_validators: [
validator((v) => v.length > 0, "At least one person must be greeted."),
],
printBalanceOnHand: {
type: Type.Boolean,
_default: false,
_description: "Whether to print balance on hand on the print out",
},
};

export type Config = {
casualGreeting: boolean;
whoToGreet: Array<string>;
printItemCost: boolean;
printBalanceOnHand: boolean;
};
86 changes: 86 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,89 @@ export const PRINT_LOGO =
export const PRINT_LOGO_TEXT = "Ministry of Health";

export const MAIN_STORE_LOCATION_TAG = "Main Store";

export const BASE_OPENMRS_APP_URL = "/openmrs/";

export const STOCKMGMT_RESOURCE_URL = "/openmrs/stockmanagement/spa.page/";
export const STOCKMGMT_SPA_PAGE_URL = "/openmrs/stockmanagement/spa.page";
export const URL_PRINT_LOGO = () =>
PRINT_LOGO
? `${BASE_OPENMRS_APP_URL}${PRINT_LOGO}`
: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
export const CLOSE_PRINT_AFTER_PRINT = true;
export const ALLOW_STOCK_ISSUE_WITHOUT_REQUISITION = false;

export const BASE_URL_CONFIGURED = BASE_OPENMRS_APP_URL;
export const LOGIN_URL = BASE_OPENMRS_APP_URL + "login.htm";

export const ROUTING_BASE_URL = "/";
export const URL_STOCK_HOME = ROUTING_BASE_URL + "home";

export const URL_STOCK_OPERATIONS = ROUTING_BASE_URL + "stock-operations";
export const URL_STOCK_OPERATIONS_ROUTES = URL_STOCK_OPERATIONS + "/*";
export const URL_STOCK_OPERATIONS_NEW = URL_STOCK_OPERATIONS + "/new/*";
export const URL_STOCK_OPERATIONS_NEW_OPERATION = (
name: string,
requisitionUuid?: string
): string =>
`${URL_STOCK_OPERATIONS}/new/${name}${
requisitionUuid ? `?requisition=${requisitionUuid}` : ""
}`;
export const URL_STOCK_OPERATIONS_EDIT = URL_STOCK_OPERATIONS + "/:id";
export const URL_STOCK_OPERATIONS_REDIRECT = (
uuid: string,
tab?: string
): string =>
`${URL_STOCK_OPERATIONS}/redirect/${uuid}${tab ? `?tab=${tab}` : ""}`;
export const URL_STOCK_OPERATION = (uuid: string, tab?: string): string =>
`${URL_STOCK_OPERATIONS}/${uuid}${tab ? `?tab=${tab}` : ""}`;

export const URL_USER_ROLE_SCOPES = ROUTING_BASE_URL + "user-role-scopes";
export const URL_USER_ROLE_SCOPES_ROUTES = URL_USER_ROLE_SCOPES + "/*";
export const URL_USER_ROLE_SCOPES_NEW = URL_USER_ROLE_SCOPES + "/new";
export const URL_USER_ROLE_SCOPES_EDIT = URL_USER_ROLE_SCOPES + "/:id";
export const URL_USER_ROLE_SCOPE = (uuid: string): string =>
`${URL_USER_ROLE_SCOPES}/${uuid}`;

export const URL_STOCK_ITEMS = ROUTING_BASE_URL + "stock-items";
export const URL_STOCK_ITEMS_ROUTES = ROUTING_BASE_URL + "stock-items/*";
export const URL_STOCK_ITEMS_NEW = URL_STOCK_ITEMS + "/new";
export const URL_STOCK_ITEMS_EDIT = URL_STOCK_ITEMS + "/:id";
export const URL_STOCK_ITEM = (uuid: string, tab?: string): string =>
`${URL_STOCK_ITEMS}/${uuid}${tab ? `?tab=${tab}` : ""}`;
export const URL_STOCK_ITEMS_REDIRECT = (uuid: string, tab?: string): string =>
`${URL_STOCK_ITEMS}/redirect/${uuid}${tab ? `?tab=${tab}` : ""}`;
export const URL_IMPORT_ERROR_FILE = (importSessionId: string) =>
`${BASE_OPENMRS_APP_URL}ws/rest/v1/stockmanagement/stockitemimport?id=${importSessionId}`;
export const URL_IMPORT_TEMPLATE_FILE = `${BASE_OPENMRS_APP_URL}moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx`;

export const URL_STOCK_SOURCES = ROUTING_BASE_URL + "stock-sources";
export const URL_STOCK_SOURCES_ROUTES = URL_STOCK_SOURCES + "/*";

export const URL_SIGN_IN = ROUTING_BASE_URL + "sign-in";
export const URL_SIGN_OUT = ROUTING_BASE_URL + "sign-out";

export const URL_ACCESS_DENIED = ROUTING_BASE_URL + "access-denied";
export const URL_NOT_FOUND = "/*";
export const URL_WILDCARD = "*";

export const REACT_ROUTER_PREFIX = "#";

export const URL_LOCATIONS = ROUTING_BASE_URL + "locations";
export const URL_LOCATIONS_ROUTES = ROUTING_BASE_URL + "locations/*";
export const URL_LOCATIONS_NEW = () =>
`${BASE_OPENMRS_APP_URL}admin/locations/location.form`;
export const URL_LOCATIONS_EDIT = (id: number) =>
`${BASE_OPENMRS_APP_URL}admin/locations/location.form?locationId=${id}`;

export const URL_STOCK_REPORTS = ROUTING_BASE_URL + "stock-reports";
export const URL_STOCK_REPORTS_ROUTES = ROUTING_BASE_URL + "stock-reports/*";
export const URL_STOCK_REPORT = (uuid: string): string =>
`${URL_STOCK_REPORTS}/${uuid}`;
export const URL_BATCH_JOB_ARTIFACT = (
uuid: string,
download: boolean
): string =>
`${BASE_OPENMRS_APP_URL}ws/rest/v1/stockmanagement/batchjobartifact?id=${uuid}${
download ? "&download=1" : ""
}`;
Loading

0 comments on commit b2ff56f

Please sign in to comment.