<commit_before><?php
$pageTitle = "Profil";
$pageSubTitle = "Set profil";
include $template;

function htmlHead() {
  ?>
  <style>
    .mild-cyan{ background: rgba(210,230,255,0.6);}
    .cyan { background: rgba(210,230,255,1)}
    .mild-orange { background: rgba(255,230,210,0.6);}
    .orange { background: rgba(255,230,210,1);}

    .file-input img {max-height: 300px; max-width: 300px;}
  </style>
  <script src="/jslib/mine/file-input.js"></script>
  <script src="/jslib/moment.min.js"></script>
  <script>token = '<?= \Trust\Server::csrf_token() ?>';</script>
  <script>
    app.controller('ctrlProfil', function ($scope) {
      var init = JSON.parse($("#init").html());
      //$("#init").html('');
      $("#token").val(token);
      $scope.biodata = init.biodata;
      $scope.biodata.dob = (init.biodata.dob == null) ? null : new Date($scope.biodata.dob);
      $scope.img_profile = init.img_profile;
      $scope.category = init.category;
      $scope.organization = init.organization;
      $scope.addPhone = function () {
        $scope.biodata.phone.push('');
      };
      $scope.saveBiodata = function () {
        var oPost = {a: "biodata", biodata: $scope.biodata, token: token};
        tr.post("/users/profile", oPost, function (rep) {
          $.notify("Biodata has been saved", "success");
          $scope.biodata = rep.biodata;
          $scope.$apply();
        });
      };
      $scope.savePP = function () {
        tr.postForm("/users/profile", $("#form-PP")[0], function (rep) {
          $.notify("Profile Pic successfully changed", "success");
          $scope.img_profile = rep.img_profile;
          $scope.$apply();
        });
      };
      $scope.nullPP = function () {
        var oPost = {a: "nullPP", token: token};
        tr.post("/users/profile", oPost, function (rep) {
          $.notify("Profile pic changed to default.", "success");
          $scope.img_profile = rep.img_profile;
          $scope.$apply();
        });
      };
    });
  </script>
<?php }

function mainContent() {
  global $login;
  ?>
  <div class="row" ng-controller="ctrlProfil">
    <div class="col-md-offset-3 col-sm-6">
      <div class="panel panel-default">
        <div class="panel-body mild-cyan">
          <h2>User Profile</h2>
          <h4>Category: {{category}}<br />Organization: {{organization}}</h4>
          <!--Profile Picture-->
          <form id='form-PP' enctype="multipart/form-data" class="panel panel-default">
            <div class="panel-body bg-info">
              <input type="hidden" name="a" value="PP"/>
              <input type="hidden" name="token" value="" id="token"/>
              <div class='form-group'>
                <label for="profile_pic">Profile pic</label>
                <div class='file-input'>
                  <img ng-src='{{img_profile}}'/>
                  <input type="file" name='profile_pic'/>
                </div>
              </div>
              <button ng-click='savePP()' class='btn btn-success'><i class="fa fa-save"></i> Simpan</button>
              <button ng-click='nullPP()' class='btn btn-default'>Pakai PP Facebook</button>
            </div>
          </form>
          <!--End Profile Picture-->
          <!--Biodata-->
          <form class="panel panel-default">
            <div class="panel-body bg-info">
              <div class="form-group">
                <label for="name" class="control-label">Full Name</label>
                <input type="text" class="form-control" id="name" ng-model="biodata.name"/>
              </div>
              <div class="form-group"><commit_msg>Ganti teks PP facebook jadi PP Default.<commit_after><?php
$pageTitle = "Profil";
$pageSubTitle = "Set profil";
include $template;

function htmlHead() {
  ?>
  <style>
    .mild-cyan{ background: rgba(210,230,255,0.6);}
    .cyan { background: rgba(210,230,255,1)}
    .mild-orange { background: rgba(255,230,210,0.6);}
    .orange { background: rgba(255,230,210,1);}

    .file-input img {max-height: 300px; max-width: 300px;}
  </style>
  <script src="/jslib/mine/file-input.js"></script>
  <script src="/jslib/moment.min.js"></script>
  <script>token = '<?= \Trust\Server::csrf_token() ?>';</script>
  <script>
    app.controller('ctrlProfil', function ($scope) {
      var init = JSON.parse($("#init").html());
      //$("#init").html('');
      $("#token").val(token);
      $scope.biodata = init.biodata;
      $scope.biodata.dob = (init.biodata.dob == null) ? null : new Date($scope.biodata.dob);
      $scope.img_profile = init.img_profile;
      $scope.category = init.category;
      $scope.organization = init.organization;
      $scope.addPhone = function () {
        $scope.biodata.phone.push('');
      };
      $scope.saveBiodata = function () {
        var oPost = {a: "biodata", biodata: $scope.biodata, token: token};
        tr.post("/users/profile", oPost, function (rep) {
          $.notify("Biodata has been saved", "success");
          $scope.biodata = rep.biodata;
          $scope.$apply();
        });
      };
      $scope.savePP = function () {
        tr.postForm("/users/profile", $("#form-PP")[0], function (rep) {
          $.notify("Profile Pic successfully changed", "success");
          $scope.img_profile = rep.img_profile;
          $scope.$apply();
        });
      };
      $scope.nullPP = function () {
        var oPost = {a: "nullPP", token: token};
        tr.post("/users/profile", oPost, function (rep) {
          $.notify("Profile pic changed to default.", "success");
          $scope.img_profile = rep.img_profile;
          $scope.$apply();
        });
      };
    });
  </script>
<?php }

function mainContent() {
  global $login;
  ?>
  <div class="row" ng-controller="ctrlProfil">
    <div class="col-md-offset-3 col-sm-6">
      <div class="panel panel-default">
        <div class="panel-body mild-cyan">
          <h2>User Profile</h2>
          <h4>Category: {{category}}<br />Organization: {{organization}}</h4>
          <!--Profile Picture-->
          <form id='form-PP' enctype="multipart/form-data" class="panel panel-default">
            <div class="panel-body bg-info">
              <input type="hidden" name="a" value="PP"/>
              <input type="hidden" name="token" value="" id="token"/>
              <div class='form-group'>
                <label for="profile_pic">Profile pic</label>
                <div class='file-input'>
                  <img ng-src='{{img_profile}}'/>
                  <input type="file" name='profile_pic'/>
                </div>
              </div>
              <button ng-click='savePP()' class='btn btn-success'><i class="fa fa-save"></i> Simpan</button>
              <button ng-click='nullPP()' class='btn btn-default'>Pakai PP Default</button>
            </div>
          </form>
          <!--End Profile Picture-->
          <!--Biodata-->
          <form class="panel panel-default">
            <div class="panel-body bg-info">
              <div class="form-group">
                <label for="name" class="control-label">Full Name</label>
                <input type="text" class="form-control" id="name" ng-model="biodata.name"/>
              </div>
              <div class="form-group">
{'fraction_non_alphanumeric': 0.18879178804272437, 'fraction_numerical': 0.015258704397281176, 'mean_word_length': 2.283242258652095, 'pattern_counts': {'":': 0, '<': 109, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6688394', 'n_tokens_mistral': 2358, 'n_tokens_neox': 2248, 'n_words': 437}