Exemple #1
0
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('edit_instructions_{0}'.format(self.instructions_sobject.get_code()))

        # Get a list of the components the instructions are attached to
        attached_components = get_components_attached_to_instructions(self.instructions_sobject)
        component_div = DivWdg()
        title_span = SpanWdg()

        if attached_components:
            title_span.add('The following Components are attached to this Instructions Document:')
            component_div.add(title_span)

            component_list = HtmlElement.ul()

            for component in attached_components:
                li = HtmlElement.li()
                li.add('{0} ({1})'.format(component.get('name'), component.get_code()))
                component_list.add(li)

            component_div.add(component_list)
        else:
            title_span.add('Instructions are not currently attached to any Components')
            component_div.add(title_span)

        outer_div.add(component_div)
        outer_div.add(get_instructions_textarea_wdg(self.instructions_sobject))

        submit_button = SubmitWdg('Submit Changes')
        submit_button.add_behavior(self.submit_button_behavior())
        submit_button.add_style('display', 'block')

        outer_div.add(submit_button)

        return outer_div
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('status_select_{0}'.format(self.task_sobject.get_code()))

        outer_div.add(get_task_status_select_wdg(self.task_sobject))

        submit_button = SubmitWdg('Submit Changes')
        submit_button.add_behavior(self.submit_button_behavior())
        submit_button.add_style('display', 'block')

        outer_div.add(submit_button)

        return outer_div
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('multiple_status_edit_{0}'.format(self.package_sobject.get_code()))

        outer_div.add(self.get_files_checkboxes())
        outer_div.add(get_file_in_package_status_select())

        submit_button = SubmitWdg('Submit Changes')
        submit_button.add_behavior(self.submit_button_behavior())
        submit_button.add_style('display', 'block')

        outer_div.add(submit_button)

        return outer_div
    def get_display(self):
        div_wdg = DivWdg()
        div_wdg.set_id('edit_file_{0}'.format(self.file_sobject.get_code()))

        # Add a text section for File Path
        div_wdg.add(get_label_widget('File Path'))
        div_wdg.add(get_text_input_wdg('file_path_input', pretext=self.file_sobject.get('file_path')))

        # Add a Select widget for Classification
        div_wdg.add(get_label_widget('Classification'))
        div_wdg.add(get_file_classification_select_wdg(selected=self.file_sobject.get('classification')))

        # Add the submit button
        submit_button = SubmitWdg('Submit')
        submit_button.add_behavior(self.submit_button_behavior())
        submit_button.add_style('display', 'block')

        div_wdg.add(submit_button)

        return div_wdg
Exemple #5
0
    def get_display(self):
        div_wdg = DivWdg()
        div_wdg.set_id('edit_file_{0}'.format(self.file_sobject.get_code()))

        # Add a text section for File Path
        div_wdg.add(get_label_widget('File Path'))
        div_wdg.add(
            get_text_input_wdg('file_path_input',
                               pretext=self.file_sobject.get('file_path')))

        # Add a Select widget for Classification
        div_wdg.add(get_label_widget('Classification'))
        div_wdg.add(
            get_file_classification_select_wdg(
                selected=self.file_sobject.get('classification')))

        # Add the submit button
        submit_button = SubmitWdg('Submit')
        submit_button.add_behavior(self.submit_button_behavior())
        submit_button.add_style('display', 'block')

        div_wdg.add(submit_button)

        return div_wdg
    def get_display(self):
        div_wdg = DivWdg()
        div_wdg.set_id('task_inspect_{0}'.format(self.task_sobject.get_code()))

        div_wdg.add(get_page_header(self.task_sobject.get('process')))
        div_wdg.add(HtmlElement.h4('Code: {0}'.format(self.task_sobject.get_code())))
        div_wdg.add(HtmlElement.h4('Package: {0} ({1})'.format(self.parent_component.get('name'),
                                                                 self.parent_component.get_code())))

        # Get the order that contains the parent component and display its information
        order_sobject = get_order_sobject_from_component_sobject(self.parent_component)
        div_wdg.add(HtmlElement.h4('Order: {0} ({1})'.format(order_sobject.get('name'), order_sobject.get_code())))

        div_wdg.add(HtmlElement.h4('<u>Status</u>'))
        div_wdg.add(get_task_status_select_wdg(self.task_sobject))

        div_wdg.add(HtmlElement.h4('<u>Estimated Hours: {0}</u>'.format(self.task_data.get('estimated_hours'))))

        change_estimated_hours_button = ButtonNewWdg(title='Change Estimated Hours', icon='TIME')
        change_estimated_hours_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Change Estimated Hours', 'widgets.ChangeEstimatedHoursForTaskWdg', self.task_sobject.get_search_key(),
                'Task', 'widgets.TaskInspectWdg', self.task_sobject.get_search_key()
            )
        )
        change_estimated_hours_button.add_style('display', 'inline-block')
        div_wdg.add(change_estimated_hours_button)

        add_input_file_button = ButtonNewWdg(title='Add Input Files', icon='INSERT_MULTI')
        add_input_file_button.add_behavior(
            obu.get_load_popup_widget_behavior('Add Input Files from Order',
                                               'widgets.AddInputFilesToTaskWdg',
                                               self.task_sobject.get_search_key())
        )
        add_input_file_button.add_style('display', 'inline-block')
        div_wdg.add(add_input_file_button)

        create_input_file_button = ButtonNewWdg(title='Create a new Input File', icon='ADD')
        create_input_file_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Create a new Input File', 'widgets.CreateNewInputFileForTaskWdg', self.task_sobject.get_search_key(),
                'Task', 'widgets.TaskInspectWdg', self.task_sobject.get_search_key()
            )
        )
        create_input_file_button.add_style('display', 'inline-block')
        div_wdg.add(create_input_file_button)

        move_input_file_to_output_button = ButtonNewWdg(title='Move Input File to Output', icon='RIGHT')
        move_input_file_to_output_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Move Input File to Output', 'widgets.MoveInputFileToOutputWdg', self.task_sobject.get_search_key(),
                'Task', 'widgets.TaskInspectWdg', self.task_sobject.get_search_key()
            )
        )
        move_input_file_to_output_button.add_style('display', 'inline-block')
        div_wdg.add(move_input_file_to_output_button)

        add_equipment_button = ButtonNewWdg(title='Add Equipment', icon='INSERT_MULTI')
        add_equipment_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior('Add Equipment', 'widgets.EquipmentInTaskWdg',
                                                           self.task_sobject.get_search_key(), 'Task',
                                                           'widgets.TaskInspectWdg', self.task_sobject.get_search_key())
        )
        add_equipment_button.add_style('display', 'inline-block')
        div_wdg.add(add_equipment_button)

        if self.parent_component.get_search_type() == u'twog/component?project=twog':
            div_wdg.add(HtmlElement.h4('<u>Instructions</u>'))

            instructions_code = self.parent_component.get('instructions_code')
            instructions = get_task_instructions_text_from_instructions_code(instructions_code,
                                                                             self.task_sobject.get('process'))

            if not instructions:
                instructions = 'Sorry, instructions have not been added yet.'

            div_wdg.add(self.parse_instruction_text(instructions.encode('utf-8')))
        elif self.parent_component.get_search_type() == u'twog/package?project=twog':
            div_wdg.add(HtmlElement.h4('<u>Instructions</u>'))

            instructions = self.parent_component.get('delivery_instructions')

            if not instructions:
                instructions = 'Sorry, instructions have not been added yet.'

            div_wdg.add(self.parse_instruction_text(instructions.encode('utf-8')))

        div_wdg.add(self.get_buttons_row())

        submit_button = SubmitWdg('Submit Changes')
        submit_button.add_behavior(self.submit_button_behavior())
        submit_button.add_style('display', 'block')

        div_wdg.add(submit_button)

        return div_wdg