TechnologyRediscovery / codenforce

municipal code enforcement database application
GNU General Public License v3.0
2 stars 3 forks source link

Create object manage pages for random Occ Utility tables #214

Open edarsow opened 2 years ago

edarsow commented 2 years ago

Field inspections are conducted any time an officer looks at a property and records information about its state. This could be a formal inspection for a permit, in which case the officer would enter the building, look around, etc. Field inspections also happen if the officer is driving by on a public road and visually observes a violation of municipal code.

The field inspection form will include a few drop down boxes that allow the user to easily classify various features of that inspection. Tables in the DB already exist for the objects, and Java object representations also exist, but the management pages do not.

Please use iconManage.xhtml as a template for creating management pages for these objects:

UI Suggestions

The component is legacy. We want to update to the PrimeFaces layout tool, which attempts to be mobile responsive and makes layout really simple.

 <div class="p-grid">
     <div class="p-col-6">Internal ID</div>
     <div class="p-col-6">Fancy Jazz</div>
</div>

Mulit-use grid/form ideas

Ben (JURPLEL) created a slick UI that operates like this

toggleEditMode method

When the edit button is pushed, all it needs to do is call the toggleEditMode() method, and that method decides if the object we were editing is new (in which case we need to write new) or update, in which case we write updates. See the citations.xhtml as a sample

  /**
     * Listener for user requests to edit a citation's status record 
     */
   public void onCitationStatusLogEditModeToggle(){
        // clicking done means save edits
        if(citationStatusEditMode){
            if(currentCitationStatusLogEntry != null && currentCitationStatusLogEntry.getLogEntryID() == 0){
                onStatusLogEntryAddCommitButtonChange(null);
                System.out.println("citationBB.onStatusLogEntryAddCommitButtonChange | called on status edit mode toggle");
            } else {
                onStatusLogEntryEditCommitButtonChange(null);
                System.out.println("citationBB.onStatusLogEntryEditCommitButtonChange | called on status edit mode toggle");
            }
            refreshCurrentCitation();
        }
        citationStatusEditMode = !citationStatusEditMode;
        System.out.println("CitationBB.onCitationStatusLogEditModeToggle | citationStatusEditMode val is " + citationStatusEditMode);
   } 

OccInspectionDetermination

This object is populated from the table called occinspectiondetermination The integration methods exist but should not be trusted in the OccInspectionIntegrator.java class

Converter

You'll also need to make a converter class which allows these to go in drop-drown boxes. Use the icon converter as a template. This converter name will go into a converter parameter tag inside a selectOneMenu for choosing these.

sql inserts

Please write a SQL insert script that creates records that reflect the initial categories listed in the specs:

Event Categories

To allow the user to choose an event category that goes with a determination, you'll want to ask the EventCoordinator for a list of possible event categories given a specific type. For Occ inspection stuff, you could write code in your initBean() method that looks like this:

EventCoordinator ec = getEventCoordinator();
eventCategoryList = ec.determinePermittedEventCategories(EventType.Occupancy, getSessionBean().getSessUser());

OccInspectionCause

The java object is OccInspectionCause.java The table is occinspectioncause

converter class

You'll also need to make a converter class which allows these to go in drop-drown boxes. Use the icon converter as a template. This converter name will go into a converter parameter tag inside a selectOneMenu for choosing these.

sql inserts

Please write insert for these initial items:

Create infrastructure for OccInspectionRequirement

Using the prowess you acquired in the previous tasks, create the entire stack for a new object called OccInspectionRequirement that contains items that the officer is assigning as additional stuff a homeowner has to do.

Design requirement table

Use the CREATE SEQUENCE AND CREATE TABLE code in this sample patch to help you write SQL for this new table. The fields should at least include

design linking table

Let's call this occinspectionrequirementassigned: When we make an occupancy inspection actually require one of these records in the occinspectionrequirement table, we make an entry in this second table, which will have a composite primary key of its FK to a record in the occinspectionrequirement table and in the occinspection table. This table will also have fields to track if the requirement was satisfied

templates to use for this table structure

Use the citation sub-family as a template

Create sql inserts

For these initial values in the requirement table

Manage OccInspectionRequirements

Create a simple page for adding, editing, removing entries to the primary requirement table.

DuskXua commented 2 years ago

There is no user table to link to, what table are we using for that?

DuskXua commented 2 years ago

public.login userid

edarsow commented 2 years ago

users are reflected as a record in the table login and a session is only given to users whose login has valid records in the usermuniauthperiod table. lots of logic exists for auditing UMAPs before issuing a credential at a certain rank for a given muni scour the patch scripts for naming conventions on foreign keys, etc don't forget to dedicate hours to reading the official postgresql docs on the SQL stuff. most answers lie within

DuskXua commented 2 years ago

Is the Requirement table a utility table or are we adding requirements constantly? It seems like the requirement assigned table will have additions to it constantly as it will be used to assign various requirements to inspections.

If this is the case do we would need the date created and created in the requirement assigned table, not the assigned. The requirement table would be a utility table and would need a management page as well.

edarsow commented 2 years ago

MF and ECD conference: no need for userID and timestamp on requirement table itself. FK to user remains an active requirement on the linking table.