PageSourceSearch

https://classic.ptotoday.com/components/com_store/app/profile/profile.controller.js?6ab4ec80cf312

js ptotoday.com collected 2026-09-24 09:26:22 UTC 2,599 bytes, 83 lines download raw bytes

1"use strict";
2angular
3  .module("sfmStore")
4  .controller("profileController", function (
5    $scope,
6    $state,
7    $profile,
8    $order,
9    $stateParams,
10    $analytics,
11    $sfmInvalidProfile
12  ) {
13    var vm = this;
14    vm.message = null;
15    vm.showGroupWarning = false;
16    vm.profile = vm.profile || {};
17    vm.school = vm.school || {};
18    vm.analytics = $analytics;
19    vm.invalidSchool = false;
20
21    $scope.$watch(
22      "vm.school",
23      function (newVal, oldVal) {
24        if (typeof newVal.id !== "undefined") {
25          vm.invalidSchool =
26            newVal.id == "164831" ||
27            newVal.id == "0" ||
28            newVal.id == "-1" ||
29            newVal.Zip == "00000" ||
30            newVal.Zip == "99999" ||
31            newVal.Zip == "55555" ||
32            newVal.State == "ZZ" ||
33            newVal.type == "school"
34            false;
35          if (vm.invalidSchool) {
36            $sfmInvalidProfile.showModal();
37          }
38        } else {
39          vm.invalidSchool = false;
40        }
41      },
42      true
43    );
44
45    $scope.$watch(
46      "vm.profile",
47      function (newVal, oldVal) {
48        if (newVal.id && newVal.school_id === null) {
49          vm.showGroupWarning = true;
50        }
51      },
52      true
53    );
54
55    /**
56     * This is where the magic happens.
57     *
58     * If a the profile form is valid we're going to hand off the user's profile to the
59     * $profile.saveProfile() function, if the profile has been modified an update will be processed and
60     * an http status of 201 is returned if a new profile is created, 200, if a profile is updated,
61     * and 304 if no update is required.
62     *
63     */
64    vm.onContinueClick = function () {
65      vm.profile.school_id = vm.school.id;
66      vm.profile.school_name = vm.school.School_Name;
67      $profile.saveProfile(vm.profile).then(function (res) {
68        var data = res.data.data;
69        data.send_to = data.send_to || "schl";
70        var toState = $stateParams.nextState || "storeHome";
71        var toParams = $stateParams.params || {};
72        // pick up on plus here with modified payload from profile.php. If for some reason this needs to be overwritten 
73        // downstream, the app will have no problem doing that. Developed this because newly created profiles within the store
74        // are not being identified as members of a plus group if school has plus
75        vm.school.plus = data.plus
76        $order.updateProfile(data);
77        $order.updateSchool(vm.school);
78        $state.go(toState, toParams);
79      });
80    };
81
82    $analytics.pushVirtualPageview(window.location.href);
83  });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.