/** * {@inheritdoc} */ public function getValueOptions() { if (!isset($this->valueOptions)) { $this->valueTitle = t('Order status'); $this->valueOptions = array_merge(['_active' => t('Active')], OrderStatus::getOptionsList()); } }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $values) { $form['search'] = array('#type' => 'details', '#title' => t('Customize product report parameters'), '#description' => t('Adjust these values and update the report to build your custom product report. Once submitted, the report may be bookmarked for easy reference in the future.')); $form['search']['start_date'] = array('#type' => 'date', '#title' => t('Start date'), '#default_value' => array('month' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'n'), 'day' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'j'), 'year' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'Y'))); $form['search']['end_date'] = array('#type' => 'date', '#title' => t('End date'), '#default_value' => array('month' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'n'), 'day' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'j'), 'year' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'Y'))); $form['search']['status'] = array('#type' => 'checkboxes', '#title' => t('Order statuses'), '#description' => t('Only orders with selected statuses will be included in the report.'), '#options' => OrderStatus::getOptionsList(), '#default_value' => $values['status']); $form['search']['actions'] = array('#type' => 'actions'); $form['search']['actions']['submit'] = array('#type' => 'submit', '#value' => t('Update report')); return $form; }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $values = NULL) { $form['params'] = array('#type' => 'fieldset', '#title' => t('Customize tax report parameters'), '#description' => t('Adjust these values and update the report to build your sales tax report. Once submitted, the report may be bookmarked for easy reference in the future.')); $form['params']['start_date'] = array('#type' => 'date', '#title' => t('Start date'), '#default_value' => array('month' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'n'), 'day' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'j'), 'year' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'Y'))); $form['params']['end_date'] = array('#type' => 'date', '#title' => t('End date'), '#default_value' => array('month' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'n'), 'day' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'j'), 'year' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'Y'))); $stat = $values['status']; if ($stat === FALSE) { $stat = uc_report_order_statuses(); } $form['params']['status'] = array('#type' => 'select', '#title' => t('Order statuses'), '#description' => t('Only orders with selected statuses will be included in the report.') . '<br />' . t('Hold Ctrl + click to select multiple statuses.'), '#options' => OrderStatus::getOptionsList(), '#default_value' => $stat, '#multiple' => TRUE, '#size' => 5); $form['params']['actions'] = array('#type' => 'actions'); $form['params']['actions']['submit'] = array('#type' => 'submit', '#value' => t('Update report')); return $form; }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, OrderInterface $order = NULL) { $form['order_comment_field'] = array('#type' => 'details', '#title' => $this->t('Add an order comment')); $form['order_comment_field']['order_comment'] = array('#type' => 'textarea', '#description' => $this->t('Order comments are used primarily to communicate with the customer.')); $form['admin_comment_field'] = array('#type' => 'details', '#title' => $this->t('Add an admin comment')); $form['admin_comment_field']['admin_comment'] = array('#type' => 'textarea', '#description' => $this->t('Admin comments are only seen by store administrators.')); $form['current_status'] = array('#type' => 'value', '#value' => $order->getStatusId()); $form['order_id'] = array('#type' => 'value', '#value' => $order->id()); $form['controls'] = array('#type' => 'container', '#attributes' => array('class' => array('uc-inline-form')), '#weight' => 10); $form['controls']['status'] = array('#type' => 'select', '#title' => $this->t('Order status'), '#default_value' => $order->getStatusId(), '#options' => OrderStatus::getOptionsList()); $form['controls']['notify'] = array('#type' => 'checkbox', '#title' => $this->t('Send e-mail notification on update.')); $form['controls']['actions'] = array('#type' => 'actions'); $form['controls']['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Update'), '#button_type' => 'primary'); return $form; }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $values, $statuses) { $form['search'] = array('#type' => 'details', '#title' => $this->t('Customize sales report parameters'), '#description' => $this->t('Adjust these values and update the report to build your custom sales summary. Once submitted, the report may be bookmarked for easy reference in the future.')); $form['search']['start_date'] = array('#type' => 'date', '#title' => $this->t('Start date'), '#default_value' => array('month' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'n'), 'day' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'j'), 'year' => \Drupal::service('date.formatter')->format($values['start_date'], 'custom', 'Y'))); $form['search']['end_date'] = array('#type' => 'date', '#title' => $this->t('End date'), '#default_value' => array('month' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'n'), 'day' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'j'), 'year' => \Drupal::service('date.formatter')->format($values['end_date'], 'custom', 'Y'))); $form['search']['length'] = array('#type' => 'select', '#title' => $this->t('Results breakdown'), '#description' => $this->t('Large daily reports may take a long time to display.'), '#options' => array('day' => $this->t('daily'), 'week' => $this->t('weekly'), 'month' => $this->t('monthly'), 'year' => $this->t('yearly')), '#default_value' => $values['length']); if ($statuses === FALSE) { $statuses = uc_report_order_statuses(); } $form['search']['status'] = array('#type' => 'checkboxes', '#title' => $this->t('Order statuses'), '#description' => $this->t('Only orders with selected statuses will be included in the report.'), '#options' => OrderStatus::getOptionsList(), '#default_value' => $statuses); $form['search']['detail'] = array('#type' => 'checkbox', '#title' => $this->t('Show a detailed list of products ordered.'), '#default_value' => $values['detail']); $form['search']['actions'] = array('#type' => 'actions'); $form['search']['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Update report')); return $form; }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $args = NULL) { if (!isset($args['start_date'])) { $args['start_date'] = REQUEST_TIME; } if (!isset($args['end_date'])) { $args['end_date'] = REQUEST_TIME; } if (!isset($args['statuses'])) { $args['statuses'] = uc_report_order_statuses(); } $form['params'] = array('#type' => 'fieldset', '#title' => $this->t('Customize tax report parameters'), '#description' => $this->t('Adjust these values and update the report to build your sales tax report. Once submitted, the report may be bookmarked for easy reference in the future.')); $form['params']['start_date'] = array('#type' => 'datetime', '#title' => $this->t('Start date'), '#date_date_element' => 'date', '#date_time_element' => 'none', '#default_value' => DrupalDateTime::createFromTimestamp($args['start_date'])); $form['params']['end_date'] = array('#type' => 'datetime', '#title' => $this->t('End date'), '#date_date_element' => 'date', '#date_time_element' => 'none', '#default_value' => DrupalDateTime::createFromTimestamp($args['end_date'])); $form['params']['statuses'] = array('#type' => 'select', '#title' => $this->t('Order statuses'), '#description' => $this->t('Only orders with selected statuses will be included in the report.') . '<br />' . $this->t('Hold Ctrl + click to select multiple statuses.'), '#options' => OrderStatus::getOptionsList(), '#default_value' => $args['statuses'], '#multiple' => TRUE, '#size' => 5); $form['params']['actions'] = array('#type' => 'actions'); $form['params']['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Update report')); return $form; }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['status'] = array('#type' => 'select', '#title' => $this->t('Order status'), '#default_value' => $this->configuration['status'], '#options' => OrderStatus::getOptionsList()); $form['notify'] = array('#type' => 'checkbox', '#title' => $this->t('Send e-mail notification on update.'), '#default_value' => $this->configuration['notify']); return $form; }