(Edit: This is a follow-up to a previous question)
I'm working on complete redesign of a site that allows users to check out multiple machines for multiple users.
Here's what I have so far.
A front page that outputs two cfqueries.
One query is the active machines (ie, already checked out) It's a basic cfoutput query and displays the info based on the values of the query. I use a cfif statement to filter only the active machines (value = 1 if active in SQL)
It also outputs stuff like MAC, IP OS etc.
The other query is the inactive machines that a user can check out. It is also filtered based on whether it is active, this time by cfif query.active eq 0. This query has a few form fields so that the user can check the check boxes of devices to check in, enter in the require fields (userID and comments, basically) and submit it.
There is a dropdown menu at the bottom of this page that allows you to select the action, and the form passes in an action number (form.choose_action) that tells the cfc what it should do. IE if the action number is 4, that tells the cfc to send the person to the edit page and passes the deviceID along with it.
So basically I'm passing in the DeviceID in every situation, and the UserID only if the machine is active.
When the user clicks submit, it goes straight to a page which calls a cfc that does most of the heavy lifting.
All in all, this is an extremely poor solution, as it only really works well when one machine is being checked in or out at a time.
Here's a picture to better explain what's going on.
Here's what I would like:
Multiple devices can be selected and be checked in/checked out, hopefully using checkboxes in some way.
If checking a machine out for a user, UserIDs have to be somehow attached to the respective devices in the entry form (the inactive output query) and should be entered along with the deviceID in a single insert, if possible.
I want to be able to check in multiple devices, but also stop people from checking out machines that are active (as they are already checked out). Same goes for inactive machines, I would like to stop a user from checking in a machine that has yet to be checked out. As of now I'm just using number (ie if field is greater than 0 )
Some notes: Only one user is going to be using this at a time, so I don't have to worry about session stuff or having lots of people trying to check in the same device.
At the moment I currently push variables to a page which then passes the form data into a CFC, this might not be the best way to do it.
Really the big problem I'm having is from a design standpoint, my logic is very convoluted and inefficient. At the moment the only thing I could think of is passing the device values in through an array. But not sure if I could do this in a checkbox.
Thank you for your time.