I needed a report to show what equipment was reserved by which members and when, and also needed to be searchable. I created the report using Views, by added in two new views relationships. The attached patch contains the new views relationships, as well as the final view that was created.

Cheers,
Stella

Comments

stella’s picture

StatusFileSize
new13.23 KB

patch re-roll

iPeat’s picture

Extremely useful please add to base code

darrick’s picture

Thank you @stella. This patch is great. I plan to work with kreynen on fixing all the current views. I'd like to use a view based on a calendar view. Possible a separate module called merci_views.

darrick’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

I committed the patch to the current 2.x-dev branch. I only committed the relationship definitions in merci.views.inc. The default view created is helpful in figuring out how to create a view using the new relationship but I feel it could be cleaner.

Maybe it would be a good idea to close this issue and then reopen a new issue for default views and menu items in Merci.

darrick’s picture

StatusFileSize
new125.23 KB

I've been working on the theme to easily view reservations by item. Currently not sure what to do about reservations with only placeholders vs. reservations with assigned items. I've attached the image for the sake of discussion.

linneawilliams’s picture

StatusFileSize
new52.67 KB

I'm using the new views relationship (thank you for that!). I'm trying to build a calendar view of reservations with an exposed filter on equipment (select an item to see its availability). I've gotten pretty far, but I'm struggling with two things.

1) making the reservable item exposed filter a drop down, rather than text box.

2) getting the week to show a time grid and have the reservations span times like in darrick's grid.jpg.

Anyone out there? MERCI is so close to serving my needs really well.....

Attached is my view in progress.

kreynen’s picture

I think this snippet may help with #1...

function YOURMODULE_utility_form_views_exposed_form_alter(&$form, $form_state) {

  $options = merci_build_reservable_items(null,null);

  //dsm($options['options']);
 
  $bucket_options = array();
  $bucket_options['All'] = '<Any>';
  $resource_options = array();
  $resource_options[''] = '<Any>';

  foreach($options['options'] as $key => $value){
    if($key == 'Buckets'){
      foreach($value as $type => $desc){
        $bucket_options[$type] = $desc;
      }
    } else if(is_array($value)){
      foreach($value as $nid => $desc){
        $resource_options[$nid] =  $desc;
      }
    }
  }

  $form['nid'] = array(
    '#type' => "select",
    '#options' => $resource_options,
    '#description' => 'Resource Type',
    );

  $form['type_1'] = array(
    '#type' => "select",
    '#options' => $bucket_options,
    '#description' => 'Bucket Type',
    );
}

darrick’s picture

What exact type of filter did you choose? I use node:nid with a relationship of "Reserved item node id" for filtering on resources. For buckets I use Node:type with a relationship of "Reserved placeholder item node id".

I'm also working on the calendar view for the reservations to span time blocks. Which I plan to commit to the merci_views module.

linneawilliams’s picture

@darrick: I used a Node:Title with relationship "reserved item node id" for the resources. Which I assumed would work, but now that I test it, it seems to not find anything. Alas. I suppose I could use node-id (works fine), but that wouldn't be ideal for the users.

I don't have a lot of items, so I thought a drop down that would show all reservable items would serve my purpose. Plus, then people wouldn't need to know the exact names of each device.

@kreynen: I'll play with the above code with my sysadmin partner. He doesn't give me access to hack at code, which is probably for the best because I *love* hacking at code. Hahaha!

What's your timeline for the MERCI views module?

iPeat’s picture

Status: Needs review » Fixed

Just going through and checking old issues that I added or commented on I believe this one has been resolved as this functionality does exist now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.