Skip to content

Commit

Permalink
Added cruise direction flag to positions. (#2105)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeburg authored Sep 27, 2024
1 parent 2167ce1 commit 5fd340c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 26 deletions.
4 changes: 4 additions & 0 deletions app/components/position-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
<f.checkbox @name="new_user_eligible"
@label="Grant to new accounts (Rangers, Applications, etc)"/>
</div>
<div class="col-12">
<f.checkbox @name="cruise_direction"
@label="Selectable position on the Cruise Direction interface"/>
</div>
</FormRow>
</fieldset>
<fieldset>
Expand Down
3 changes: 3 additions & 0 deletions app/components/position-table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
{{#if position.not_timesheet_eligible}}
{{fa-icon "ban" fixed=true right=1}} Used only for scheduling. Timesheet entries may not be created.<br>
{{/if}}
{{#if position.cruise_direction}}
{{fa-icon "people-group" fixed=true right=1}} Selectable on the Cruise Direction interface<br>
{{/if}}
{{#if position.contact_email}}
Contact email:
<MailTo @to={{position.contact_email}} />
Expand Down
33 changes: 10 additions & 23 deletions app/controllers/ops/cruise-direction.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ import dayjs from 'dayjs';
import {TYPE_SHIFT, TransportOptions} from "clubhouse/models/pod";
import {movePod} from 'clubhouse/utils/pod';
import {htmlSafe} from '@ember/template';
import {
DIRT,
DIRT_GREEN_DOT,
DIRT_POST_EVENT,
DIRT_PRE_EVENT,
DIRT_SHINY_PENNY, GREEN_DOT_MENTEE, GREEN_DOT_MENTOR,
TROUBLESHOOTER, TROUBLESHOOTER_MENTEE, TROUBLESHOOTER_MENTOR,
DOUBLE_O_7, RNR
} from "clubhouse/constants/positions";

export default class OpsCruiseDirectionController extends ClubhouseController {
@tracked shifts;
Expand All @@ -38,6 +29,10 @@ export default class OpsCruiseDirectionController extends ClubhouseController {

@tracked isNewPod = false;

@tracked positions;

@tracked showingPositions = false;

transportOptions = TransportOptions;

constructor() {
Expand Down Expand Up @@ -94,6 +89,11 @@ export default class OpsCruiseDirectionController extends ClubhouseController {
this._loadSelectedPod();
}

@action
togglePositions() {
this.showingPositions = !this.showingPositions;
}

/**
* Load the pods associated with a shift
*
Expand Down Expand Up @@ -231,20 +231,7 @@ export default class OpsCruiseDirectionController extends ClubhouseController {
this.timesheets = (await this.ajax.request('timesheet', {
data: {
is_on_duty: 1,
position_ids: [
DIRT,
DIRT_GREEN_DOT,
DIRT_POST_EVENT,
DIRT_PRE_EVENT,
DIRT_SHINY_PENNY,
DOUBLE_O_7,
GREEN_DOT_MENTEE,
GREEN_DOT_MENTOR,
RNR,
TROUBLESHOOTER,
TROUBLESHOOTER_MENTEE,
TROUBLESHOOTER_MENTOR
],
position_ids: this.positionIds,
include_photo: 1
}
})).timesheet;
Expand Down
1 change: 1 addition & 0 deletions app/models/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default class PositionModel extends Model {
@attr('boolean', {defaultValue: true}) active;
@attr('boolean', {defaultValue: false}) alert_when_becomes_empty;
@attr('boolean', {defaultValue: false}) alert_when_no_trainers;
@attr('boolean', {defaultValue: false}) cruise_direction;
@attr('boolean', {defaultValue: false}) deselect_on_team_join;
@attr('boolean', {defaultValue: false}) no_payroll_hours_adjustment;
@attr('boolean', {defaultValue: false}) mvr_eligible;
Expand Down
5 changes: 5 additions & 0 deletions app/routes/ops/cruise-direction.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ export default class OpsCruiseDirectionRoute extends ClubhouseRoute {
return RSVP.hash({
year,
shifts: this.ajax.request('slot/dirt-shift-times', {data: {year}}).then(({shifts}) => shifts),
positions: this.ajax.request('position', { data: { cruise_direction: 1, active: 1 }}).then(({position}) => position),
});
}

setupController(controller, model) {
const{positions} = model;
positions.sort((a,b) => a.title.localeCompare(b.title));
controller.year = model.year
controller.shifts = model.shifts;
controller.timesheets = model.timesheets;
controller.selectedShift = null;
controller.suggestedSlot = controller.shifts.filter((s) => s.has_started && !s.has_ended).slice(-1)[0];
controller.positions = positions;
controller.positionIds = positions.map((p) => +p.id);
}
}
19 changes: 16 additions & 3 deletions app/templates/ops/cruise-direction.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
<h1>Cruise Direction Pod Management</h1>

<p>
This page manages the Ranger pairs (aka pods) who are deployed in the field. Only individuals working Dirt,
Dirt - Pre-Event, Dirt Post-Event, Dirt - Shiny Penny, Dirt - Green Dot, RNR, and 007 shifts are available to select.
This page manages the Ranger pairs (aka pods) who are deployed in the field.
</p>
<p>
<a href {{action this.togglePositions}}>{{if this.showingPositions "Hide" "Show"}} Selectable Positions</a>
{{#if this.showingPositions}}
<div class="mt-1">
The following positions are selectable under this interface.
</div>
{{#each this.positions as |position|}}
{{position.title}}<br>
{{/each}}
{{/if}}
</p>
<p>
<LargeSelect
Expand Down Expand Up @@ -173,7 +183,10 @@
{{#if this.currentShiftOptions}}
<f.checkboxGroup @name="currentPeopleIds" @options={{this.currentShiftOptions}} @cols={{4}} />
{{else}}
No checked-in people found for Dirt, Dirt - Shiny Penny, Dirt Pre-Event or Dirt Post-Event shifts.
No checked-in people found for
{{#each this.positions as |position idx|~}}
{{~if idx ", "}}{{position.title~}}
{{~/each~}}.
{{/if}}
</div>
</FormRow>
Expand Down

0 comments on commit 5fd340c

Please sign in to comment.