Custom Fields
Re-Envisioned
Support General Is there any way to create timeslots ?

This topic contains 7 replies, has 2 voices, and was last updated by  Anh Tran 3 weeks, 4 days ago.

  • Creator
    Topic
  • #16618
    Resolved
    Akram ul haq
    Participant

    Hi
    Is there any way to create timeslots based on date in metabox custom post. As we have extensions bought but now need timeslots created based on date selection.

    Is there any possibility with any extension or give some code help please.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #16621

    Akram ul haq
    Participant

    Hi,

    Its been a while and did not get even a single response from your side. Where is premimum support now ??? I am un hurry and nothing here at all …

    #16622

    Anh Tran
    Keymaster

    Hi Akram,

    Please give us some time to answer your ticket. Your ticket was submitted at 2:37 AM and I’m answering now.

    Can you provide more details on the meaning of time slots you’re trying to create? Are there any rules for time slots?

    #16625

    Akram ul haq
    Participant

    Hi,

    Thank you for reply sorry for my quicky aplroach as my client is co firming if I will be able to do this or not etc … so i need solution quickly.

    Scenario is that I will have 7 day selections from Monday to Sunday.

    Now lets say client selects Monday as 10am to 10pm as start and end time along with any break like 15 minutes etc … once he/she saves it should generate timeslots as per selection feom 10am to 10pm which will be used for booking in the website.

    I seen a lot documentation but was unable to grab how I can do this ? But I am sure metabox io can do thus because for me it dies every thing when ever needed. But honestly this time I have stuck and have no clue what to do …

    Once monday done client can add his/her time slots for each day or can set a day as off fully as well …

    Thanks

    #16627

    Akram ul haq
    Participant

    If client choses 10am as start time … 12am as end time and says he needs 8 slots and rest time may be 10 minuts and clicks create slots button slots should be created.

    Slots will be like
    10am 10:15am
    10:15m 10:30am
    10:30am 10:45am
    10:45am 11:00am

    11:00am 11:15am
    11:15am 11:30am
    11:30am 11:45am
    11:45am 12:00am

    Its 8 slots done … and we may adjust rest time in it as well then our slot period may become 10 minutes or whatever etc … this is requirements

    #16628

    Anh Tran
    Keymaster

    If your clients want to set time slots for each day, then you can use Meta Box Group to do that, something like this (this is a group field):

    [
        'type' => 'group',
        'name' => 'Time Slots',
        'clone' => true,
        'fields' => [
            [
                'id' => 'start',
                'type' => 'time',
                'name' => 'Start',
            ],
    
            [
                'id' => 'end',
                'type' => 'time',
                'name' => 'End',
            ],
        ],
    ]

    Then you can get the slots in the front end for your booking app:

    echo '<select>';
    $slots = rwmb_meta( 'slots' );
    foreach ( $slots as $k => $slot ) {
        echo '<option value="' . $k . '">' . $slot['start'] . ' - ' . $slot['end'] . '</option>';
    }
    echo '</select>';

    Some notes: Your problem is very specific and what I’m trying to help you here is just an idea how to do that. This is out of the support scope. So, please understand it’s might not a correct/final solution.

    #16630

    Akram ul haq
    Participant

    Yes I already came with this but the issue client may add time slots duplicate I think. Because if he/she has to pick time from a drop down then he she may chose same time again … is there any way to avoid it ? But this will also be time consuming for user to create those things manually … just provide me this solution as well so I can take a final decision … really nice thought and yes I was right metabox io does every thing for me … yayyyy 🙂

    #16631

    Anh Tran
    Keymaster

    is there any way to avoid it ?

    I’m afraid not. You might need to work on jQueryUI date picker to prevent this from happening.

    But this will also be time consuming for user to create those things manually

    You can also set the default value for groups. See the docs for details: https://docs.metabox.io/extensions/meta-box-group/#setting-default-group-values

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.