<?php if ($site->sheet->pilots->where('role', 'Escalator')->count() < 4) { echo Modal::named('add_escalator')->withTitle('Add Escalator')->withButton(Button::withValue('Add Escalator')->block())->withBody(view('modals.add_escalator')->with('id', $site->id)->render()); } ?> <?php if ($site->sheet->pilots->where('role', 'Defanger')->count() == 0) { echo Modal::named('add_defanger')->withTitle('Add Defanger')->withButton(Button::withValue('Add Defanger')->block())->withBody(view('modals.add_defanger')->with('id', $site->id)->render()); } ?> <?php if ($site->sheet->pilots->where('role', 'Escalator')->count() == 4 && $site->sheet->pilots->where('role', 'Defanger')->count() == 1) { echo Modal::named('add_pilots')->withTitle('Add Pilots')->withButton(Button::withValue('Add Pilots')->block())->withBody(view('modals.add_pilots')->with('id', $site->id)->render()); } ?> </div> <?php } ?> <?php if (!$site->sheet->is_paid && $site->sheet->pilots()->whereNotIn('role', ['Bookmarker', 'Escalator', 'Defanger'])->count() > 0) { ?> <div class="jumbotron"> <?php if (!$site->finished && $site->active) { ?> <div> <?php
/** * Sets the button * * @param Button $button The button to open the modal with * @return $this */ public function withButton(Button $button = null) { if ($button) { $this->button = $button; } else { $button = new Button(); $this->button = $button->withValue('Open Modal'); } return $this; }
/** * Generates a form containing a single button that submits to the URL created by the set of options. * * Based on \Form::open(), \Form::submit() and \Form::close() * * @param string $name * @param array $options There are a few special options: * 'url' - open forms that point to named URL. E.G. ['url' => 'foo/bar'] * 'route' - open forms that point to named routes. E.G. ['route' => 'route.name'] * 'action' - open forms that point to controller actions. E.G. ['action' => 'Controller@method'] * 'method' - HTTP verb. Supported verbs are 'post', 'get', 'delete', 'patch', and 'put'. By default it will be 'post'. * 'data-remote' - If set to true, will allow the Unobtrusive JavaScript drivers to control the submit behavior. By default this behavior is an ajax submit. * 'data-confirm' - This will use the unobtrusive JavaScript driver to prompt with the question specified. If the user accepts, the link is processed normally, otherwise no action is taken. * 'form' - This array will be form attributes * 'formClass' - This controls the class of the form within which the submit button will be placed. By default it will be 'button_to'. * @return string */ function button_to($name, array $options = []) { $formOptions = ['method' => array_pull($options, 'method', 'post'), 'class' => array_pull($options, 'formClass', 'button_to')]; if (array_get($options, 'url')) { $formOptions['url'] = array_pull($options, 'url'); } if (array_get($options, 'route')) { $formOptions['route'] = array_pull($options, 'route'); } if (array_get($options, 'action')) { $formOptions['action'] = array_pull($options, 'action'); } if (array_get($options, 'data-remote')) { $formOptions['data-remote'] = array_pull($options, 'data-remote'); } if (array_get($options, 'data-confirm')) { $formOptions['data-confirm'] = array_pull($options, 'data-confirm'); } $formOptions = array_merge($formOptions, array_pull($options, 'form', [])); $submitButton = Form::submit($name, $options); if (class_exists('Button') && is_a(new Button(), '\\Illuminate\\Support\\Facades\\Facade') && method_exists(Button::getFacadeRoot(), 'withValue')) { $submitButton = Button::withValue($name)->withAttributes($options)->submit(); } return Form::open($formOptions) . '<div>' . $submitButton . '</div>' . Form::close(); }