Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 37 total)
  • Author
    Posts
  • in reply to: Date picker conditions #22823
    toni birdtoni bird
    Participant

    Hi Long, last doubt/question on this matter.

    If I have the following scenario :

    Group date with a date field that populates the date_to_text field ( just like you told me ) works well within the group. but when I clone this group does not work anymore because all fields get a new name ( i.e. start_date_hlksjdhfk) any way to make the cloned groups to work independently within the group itself? Many thanks

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'      => esc_html__( 'testing', 'text-domain' ),
            'id'         => 'testing',
            'post_types' => ['post'],
            'context'    => 'normal',
            'priority'   => 'high',
            'fields'     => [
                [
                    'id'            => $prefix . 'group_date',
                    'type'          => 'group',
                    'name'          => esc_html__( 'Group Date', 'text-domain' ),
                    'fields'        => [
                        [
                            'id'   => $prefix . 'start_date',
                            'type' => 'date',
                            'name' => esc_html__( 'Start_date', 'text-domain' ),
                        ],
                        [
                            'id'    => $prefix . 'date_to_text',
                            'type'  => 'text',
                            'name'  => esc_html__( 'Date to text', 'text-domain' ),
                            'class' => 'date_to_text',
                        ],
                    ],
                    'clone'         => 1,
                    'default_state' => 'expanded',
                    'clone_default' => 1,
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    in reply to: Date picker conditions #22821
    toni birdtoni bird
    Participant

    Hi Long,

    Great, many thanks

    in reply to: Date picker conditions #22810
    toni birdtoni bird
    Participant

    Hi Long,

    Does it also work with cloned groups?

    thanks

    in reply to: Date picker conditions #22809
    toni birdtoni bird
    Participant

    Hi Long,

    many thanks, works beautifully...

    regards

    in reply to: Date picker conditions #22791
    toni birdtoni bird
    Participant

    Hi Long,

    Many thanks for you help, can't wait to get de conditional date based on another date field working..... please let us know when is out...

    I've managed to get the javaScript working but only when the "date_to_text" field is outside a group , any chance to work inside groups? Start date is out and date_to_text is inside a group...

    thanks again

    in reply to: Front end form can save on custom database? #22557
    toni birdtoni bird
    Participant

    Hi Long, thanks for your help. will give it a try

    in reply to: Math calculations in views ? #22032
    toni birdtoni bird
    Participant

    Hi Long, thanks a lot, got it sorted.

    cheers

    in reply to: Math calculations in views ? #22008
    toni birdtoni bird
    Participant

    Hi again Long,

    Sorry for being a pain, but I don't know how to call the filter in views. I have added the code into my theme's functions.php file, but not sure how to call the function in views .
    I've tried {% set value = mb.rwmb_soma_staff_d_value %} but nothing happens. is this correct?

    thanks

    in reply to: Printing group array in views #21950
    toni birdtoni bird
    Participant

    Hi Long,

    Thanks again for your prompt reply, works like magic.

    cheers

    in reply to: Printing group array in views #21943
    toni birdtoni bird
    Participant

    sorry, my array actually come out like this:

    Array ( [0] => Array ( [equip] => Trator [equip_qtd] => 1 [_state] => collapsed ) [1] => Array ( [equip] => Retro-escavadeira [equip_qtd] => 3 [_state] => collapsed ) [2] => Array ( [equip] => Trator [equip_qtd] => 6 [_state] => collapsed ) )

    in reply to: Math calculations in views ? #21907
    toni birdtoni bird
    Participant

    Hi Long, thanks for your help again.

    cheers

    in reply to: Math calculations in views ? #21894
    toni birdtoni bird
    Participant

    Hi, not sure if I should open another topic, but it is still on the same matter.... I have a report system that my client creates a report on daily basis. client fills a custom fields form and when he publishes a post on views he gets a report page with a sum from values added to the fields. next day he duplicates the post ( post duplicator plugin) and just change the date and add new values to the fields.. My question is. how do I store the sum of values from yesterday's post (previous post) and sum with the new values from today's post ? and so on .... is it possible in views to do that? any work around?

    many thanks

    in reply to: Math calculations in views ? #21836
    toni birdtoni bird
    Participant

    Hi, Got it sorted, code

    {% set contract = date(post.site_finish  | date( 'Y/m/d') ).diff(date(post.site_start  | date( 'Y/m/d' ))) %}
              {% set contractDays = contract.days %}
              {% if contractDays == 1 %}
               1 day
              {% else %}
           {{ contractDays }} days
          {% endif %} 

    cheers

    in reply to: Math calculations in views ? #21834
    toni birdtoni bird
    Participant

    Hi, many thanks,

     {% set difference = date(post.site_start|date('d/m/Y')).diff(date(post.site_finish|date('d/m/Y'))) %}
                  {% set leftDays = difference.days %}
                  {{leftDays}}

    Not sure what is wrong.... but is not working....

    got the add and multiplier functions working, but the dates are not working.... I just get a "0" as result.

    thanks

    in reply to: Math calculations in views ? #21825
    toni birdtoni bird
    Participant

    Hi Long, thanks for your reply,

    I need to get number of days between 2 dates ( start and finish ) both values come from mb fields.
    I also need to add a couple of + and - operations based on other field values from this form.

    many thanks

Viewing 15 posts - 16 through 30 (of 37 total)