Validation by Team Member

This page explains the case when the receipt is only reviewed by team member and there is no user validation involved.

Admin Portal Team Member Journey

Team Members or Data Validators can log in to the admin portal using their mobile number and password. Data validators, designated as "cs_user," have restricted access and can only view the "Mandi-Receipt" and "Extract-Datas" modules within the admin portal, while access to other modules is restricted.

  • To handle restrictions for cs_user and other roles in the provided Python function get_user_permissions, we use conditional statements based on the user's roles and the requested resource name. Here's how the restrictions are applied:

    1. Superadmin Role:

      • Superadmins have full permissions (create, read, update, delete, export, import) for all resources by default.

    2. CS User Role and Resource "mandi-receipt":

      • cs users have permissions for create, read, and update operations on "mandi-receipt".

      • Deletion, exporting, and importing permissions are disabled.

    3. Resource "extract-data":

      • Users with roles data_extractor_intern or cs_user have permissions for create, read, and update operations.

      • Deletion is disabled.

      • Exporting and importing permissions are enabled.

    4. To create roles and define permissions within the get_user_permissions function in the admin view file, you would typically follow these steps:

      1. Define Role Names: Decide on the names of roles that will be used in your application. For example, "superadmin", "user", "data_extractor_intern", "cs_user", etc.

      2. Assign Permissions: Determine which permissions each role should have for different resources. This includes permissions such as create, read, update, delete, export, and import

User Admin Portal Login Workflow :

  • User's mobile number and secret password is created in person_table using mobile number and password user can be able to login.

  • Permission and Roles who can access this page roles are set in person table user have column roles. Users having roles superadmin or cs_user can access the mandi-receipt page

Data sent in mandi-receipt page: Data displayed on the "mandi-receipt" page is customized and managed through the following code snippet:

    if hasattr(resource_class, "admin_sale_receipt_controller"):
        status = request.args.get("status", default="pending")
        return resource_class.admin_sale_receipt_controller(
            resource_type, status
        )
  • This code snippet checks if the resource_class has an attribute named admin_sale_receipt_controller. If it does, it retrieves the status parameter from the request arguments (defaulting to "pending" if not provided) and then calls the admin_sale_receipt_controller method of the resource_class, passing the resource_type and status as arguments.

  • In the admin_view.py file, the admin_sale_receipt_controller function plays a pivotal role in managing data associated with sale receipts within the admin portal. This function serves as a central controller responsible for handling various types of receipt data, including pending receipts, rejected receipts, approved receipts, and other operational data.

    Moreover, the admin_sale_receipt_controller function also takes on the responsibility of rendering and displaying custom HTML pages within the admin portal. By leveraging this function, administrators can efficiently interact with and manage sale receipts, ensuring smooth operations and effective administration

  1. Mandi-Receipt Page :- There are three subpages: Pending Receipts, Rejected Receipts, and Approved Receipts. By default, the Pending Receipts page is selected when accessing this section.

    1. Pending Receipts:- On this page, receipts uploaded by users that have not undergone validation will be displayed, along with their details. Data Validators have the ability to approve, reject, and edit receipt details.

    2. Action User can perform : Approve Action: When a user approves the receipts, the receipt is marked as approved, and it is subsequently moved to the "Approved Receipts" page. Reject Action: During the rejection process, users are required to select a rejection reason from a list of options. Without selecting a rejection reason, users cannot proceed with rejecting the receipts. The rejection reasons are displayed using a pop-up modal containing checkboxes, allowing users to select multiple reasons for rejection. Rejected Receipt is moved to Rejected Receipts Page.

    3. Edit Action: When receipt details are edited, the previous details of the sale receipt are stored as a historical version in the sale receipts edit table. The edited details are saved in the sale receipt data.

    4. All actions can also be performed from the Rejected Receipts and Approved Receipts pages

Last updated