<commit_before><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/firebase-element/firebase-document.html">

<dom-module id="shokka-edit-user">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <firebase-document  location="{{userLocation}}"
                        data="{{user}}"></firebase-document>
    <paper-input label="Email" value={{user.email}}></paper-input>
    <paper-input label="End Date" value={{user.endDate}}></paper-input>
    <paper-input label="First Name" value={{user.fName}}></paper-input>
    <paper-input label="Graduation Date" value={{user.gradDate}}></paper-input>
    <paper-input label="Internship Date" value={{user.internDate}}></paper-input>
    <paper-input label="Last Name" value={{user.lName}}></paper-input>
    <h1>Managed Units:</h1>
    <template is="dom-repeat" items={{_toKeyArray(user.managedUnits)}} as="unitId">
      <shokka-unit-name base-ref="[[baseRef]]" org-id="[[orgId]]" unit-id="[[unitId]]"></shokka-unit-name>
    </template>
    <h1>Roles:</h1>
    <paper-checkbox checked="{{user.roles.employee}}">Employee</paper-checkbox>
    <paper-checkbox checked="{{user.roles.manager}}">Manager</paper-checkbox>
    <paper-checkbox checked="{{user.roles.admin}}">Administrator</paper-checkbox>
    <paper-input label="Start Date" value={{user.startDate}}></paper-input>
    <h1>Groups:</h1>
    <template is="dom-repeat" items={{_toKeyArray(user.units)}} as="unitId">
      <shokka-unit-name base-ref="[[baseRef]]" org-id="[[orgId]]" unit-id="[[unitId]]"></shokka-unit-name>
    </template>
  </template>

  <script>
    (function () {
      'use strict';

      Polymer({
        is: 'shokka-edit-user',
        properties: {
        },
        observers: [
          '_setUserLocation(baseRef, orgId, userId)'
        ],
        _setUserLocation: function(baseRef, orgId, userId) {
          this.userLocation = baseRef + '/orgs/' + orgId + '/users/' + userId;
        },
        _toKeyArray: function(obj = {}) {
          return Object.keys(obj);
        },
      });
    })();
  </script>

</dom-module><commit_msg>moved the different sections of user into into cards to make it more clear and asthetically pleasing.<commit_after><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/firebase-element/firebase-document.html">

<dom-module id="shokka-edit-user">
  <template>
    <style>
      :host {
        display: block;
      }
      paper-card {
        width: 50%;
      }
      #basic-info {
        width: 100%;
      }
    </style>
    <firebase-document  location="{{userLocation}}"
                        data="{{user}}"></firebase-document>

    <paper-card id="basic-info" heading="Basic Info">
      <paper-input label="Email" value={{user.email}}></paper-input>
      <paper-input label="Start Date" value={{user.startDate}}></paper-input>
      <paper-input label="End Date" value={{user.endDate}}></paper-input>
      <paper-input label="First Name" value={{user.fName}}></paper-input>
      <paper-input label="Graduation Date" value={{user.gradDate}}></paper-input>
      <paper-input label="Internship Date" value={{user.internDate}}></paper-input>
      <paper-input label="Last Name" value={{user.lName}}></paper-input>
    </paper-card>
    <paper-card heading="Roles">
      <paper-checkbox checked="{{user.roles.employee}}">Employee</paper-checkbox>
      <paper-checkbox checked="{{user.roles.manager}}">Manager</paper-checkbox>
      <paper-checkbox checked="{{user.roles.admin}}">Administrator</paper-checkbox>
    </paper-card>
    <template template is="dom-if" if="{{user.managedUnits}}">
      <paper-card heading="Managed Units">
        <template is="dom-repeat" items={{_toKeyArray(user.managedUnits)}} as="unitId">
          <shokka-unit-name base-ref="[[baseRef]]" org-id="[[orgId]]" unit-id="[[unitId]]"></shokka-unit-name>
        </template>
      </paper-card>
    </template>
    <paper-card heading="Groups">
      <template is="dom-repeat" items={{_toKeyArray(user.units)}} as="unitId">
        <shokka-unit-name base-ref="[[baseRef]]" org-id="[[orgId]]" unit-id="[[unitId]]"></shokka-unit-name>
      </template>
    </paper-card>
  </template>

  <script>
    (function () {
      'use strict';

      Polymer({
        is: 'shokka-edit-user',
        properties: {
        },
        observers: [
          '_setUserLocation(baseRef, orgId, userId)'
        ],
        _setUserLocation: function(baseRef, orgId, userId) {
          this.userLocation = baseRef + '/orgs/' + orgId + '/users/' + userId;
        },
        _toKeyArray: function(obj = {}) {
          return Object.keys(obj);
        },
      });
    })();
  </script>

</dom-module>
{'fraction_non_alphanumeric': 0.1770744225834046, 'fraction_numerical': 0.0032506415739948676, 'mean_word_length': 3.2423802612481856, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '670670', 'n_tokens_mistral': 1823, 'n_tokens_neox': 1802, 'n_words': 375}