{% extends "commerce/_layouts/cp" %} {% set crumbs = [ { label: 'Commerce ' ~ 'Settings'|t('commerce'), url: url('commerce/settings') }, { label: 'Order Statuses'|t('commerce'), url: url('commerce/settings/orderstatuses') } ] %} {% set selectedSubnavItem = 'settings' %} {% set fullPageForm = true %} {% set selectedTab = 'settings' %} {% import "_includes/forms" as forms %} {% block content %} {{ redirectInput('commerce/settings/orderstatuses') }} {% if orderStatus.id %} {% endif %} {{ forms.textField({ label: "Name"|t('commerce'), first: true, instructions: "What this status will be called in the CP."|t('commerce'), id: 'name', name: 'name', value: orderStatus.name, errors: orderStatus.getErrors('name'), required: true }) }} {{ forms.textField({ label: "Handle"|t('commerce'), instructions: "How you’ll refer to this status in the templates."|t('commerce'), id: 'handle', class: 'code', name: 'handle', value: orderStatus.handle, errors: orderStatus.getErrors('handle'), required: true }) }} {{ forms.hidden({ id: 'color', name: 'color', value: orderStatus.color }) }} {% set colorField %}
{% endset %} {{ forms.field({ label: 'Color'|t('commerce'), instructions: 'Choose a color to represent the order’s status'|t },colorField) }} {% if not emails|length %} {{ forms.field({ label: 'Status Emails'|t('commerce'), instructions: ''~'You currently have no emails configured to select for this status.'|t~'', disabled: true }) }} {% else %} {{ forms.multiselectField({ label: 'Status Emails'|t('commerce'), instructions: 'Select the emails that will be sent when transitioning to this status.'|t('commerce'), id: 'emails', name: 'emails', options: emails, values: emailIds is defined ? emailIds : orderStatus.getEmailIds(), errors: orderStatus.getErrors('emails'), class: 'selectize fullwidth', }) }} {% endif %} {{ forms.checkboxField({ label: "New orders get this status by default"|t('commerce'), name: 'default', value: 1, checked: orderStatus.default, errors: orderStatus.getErrors('default') }) }} {% endblock %} {% js %} {% if not orderStatus.handle %}new Craft.HandleGenerator('#name', '#handle');{% endif %} $(function () { $colorSelect = $('#color-menu-btn'); new Garnish.MenuBtn($colorSelect, { onOptionSelect: function(data){ var val = $(data).data('val'); $('#color').val(val); var html = ""+Craft.uppercaseFirst(val); $colorSelect.html(html); } }); $('#emails').selectize({ plugins: ['remove_button'], dropdownParent: 'body' }); }); {% endjs %}