Menu

#83 Color of booking according to room

open
nobody
None
1
2019-07-20
2019-06-25
Anonymous
No

Hi. Mind to guide how to change the color of booking based on rooms?

Discussion

  • Campbell Morrison

    You'd have to modify the MRBS code to give the bookings a class or data attribute based on their room id and then use CSS for the colour. But I'm not sure why you'd want to do this anyway? In the day view all bookings for a room are in the same column and in the week and month views you only see bookings for one room anyway.

    By the way, for future queries such as this could you raise a Support Request ticket please? Patches are intended for people contributing patches. Thanks.

     
  • Anonymous

    Anonymous - 2019-06-27

    Can you show a sample for it? Because I want to differetiate the booking by room so that everyone can get clearer view

     
  • Campbell Morrison

    I'm sorry, I'm afraid I don't have time to work out how to do it. Maybe somebody else does, or else you will have to figure it out yourself. The code that creates the bookings display is in functions_table.inc.

     
  • Anonymous

    Anonymous - 2019-07-18

    If I change this
    $column[$s][$n]["color"] = $entry['room_id'];

    will it chnage the colour according to room?

     
    • Campbell Morrison

      You'd have to add an alpha character to the colour to keep the CSS happy, eg

      $column[$s][$n]["color"] = 'R' . $entry['room_id'];
      

      and then add CSS rules to give the rooms colours, eg

      .R1 {
        background-color: red;
      }
      
      .R2 {
        background-color: blue;
      }
      
       
      • Anonymous

        Anonymous - 2019-07-18

        Means add the css color inside the function_table.inc or at the styling.inc?

         
        • Campbell Morrison

          Neither. Create a custom CSS file (see systemdefaults.inc.php for how to do this) and add the rules there.

           
  • Anonymous

    Anonymous - 2019-07-18

    Or can i know where to set the booking to have only one colour no matter of what type

     
    • Campbell Morrison

      Either change your config file so that there is only one type (assuming you don't want to use types) or else edit the colours for the types in Themes/default/styling.inc.

       
      • Anonymous

        Anonymous - 2019-07-18

        I changed to this
        $color_types = "#DC143C";

        But it still does not show the color that i chose despite any type.

         
        • Campbell Morrison

          It needs to be an array, eg

          $color_types = array(
              'A' => "#DC143C",
              'B' => "#DC143C",
              'C' => "#DC143C",
              'D' => "#DC143C",
              'E' => "#DC143C",
              'F' => "#DC143C",
              'G' => "#DC143C",
              'H' => "#DC143C",
              'I' => "#DC143C",
              'J' => "#DC143C"); 
          
           
  • Anonymous

    Anonymous - 2019-07-19

    I changed

    $color_types = array(
        'A' => "#99cc66",
        'B' => "#99cc66",
        'C' => "#99cc66",
        'D' => "#99cc66",
        'E' => "#99cc66",
        'F' => "#99cc66",
        'G' => "#99cc66",
        'H' => "#99cc66",
        'I' => "#99cc66",
        'J' => "#99cc66");
    

    but however it only shows one color. I changes the type to the facilities needed or not but however seems like not working.

     

    Last edit: Campbell Morrison 2019-07-19
    • Campbell Morrison

      but however it only shows one color.

      Isn't that what you want? You asked "Or can i know where to set the booking to have only one colour no matter of what type".

       
  • Anonymous

    Anonymous - 2019-07-19

    The color code that I set is not that color. However it didnt show that color.

     
  • Campbell Morrison

    Have a look in your browser's Developer Tools to see what is happening. I suspect that some other change you have made is over-riding that change. Or else try the change on a standard version of MRBS with no other changes.