ode-ngjs-front 1.4.13-dev.202507291227 → 1.4.13-develop-integration.202507301459
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/668.js +21 -0
- package/dist/668.js.map +1 -0
- package/dist/ode-ngjs-front.js +2 -2
- package/dist/ode-ngjs-front.js.map +1 -1
- package/dist/ts/modules/widgets.module.d.ts +3 -1
- package/dist/ts/modules/widgets.module.d.ts.map +1 -1
- package/dist/ts/services/theme-helper.service.d.ts.map +1 -1
- package/dist/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.d.ts +2 -0
- package/dist/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.d.ts.map +1 -0
- package/dist/ts/widgets/screen-time-widget/screen-time-widget.widget.d.ts +84 -0
- package/dist/ts/widgets/screen-time-widget/screen-time-widget.widget.d.ts.map +1 -0
- package/dist/version.txt +1 -1
- package/dist/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js +2 -0
- package/dist/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js.map +1 -0
- package/dist/widgets/screen-time-widget/screen-time-widget.widget.js +2 -0
- package/dist/widgets/screen-time-widget/screen-time-widget.widget.js.map +1 -0
- package/package.json +3 -2
|
@@ -17,7 +17,9 @@ export declare enum KnownWidget {
|
|
|
17
17
|
lastInfos = "last-infos-widget",
|
|
18
18
|
edumalin = "edumalin-widget",
|
|
19
19
|
mediacentre = "mediacentre-widget",
|
|
20
|
-
cantine = "cantine-widget"
|
|
20
|
+
cantine = "cantine-widget",
|
|
21
|
+
ptitObservatoire = "ptit-observatoire-widget",
|
|
22
|
+
screenTime = "screen-time-widget"
|
|
21
23
|
}
|
|
22
24
|
export declare type WidgetLoader = (widgetName: String) => Promise<void>;
|
|
23
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets.module.d.ts","sourceRoot":"","sources":["../../../src/ts/modules/widgets.module.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAQ,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"widgets.module.d.ts","sourceRoot":"","sources":["../../../src/ts/modules/widgets.module.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAQ,OAAO,EAAE,MAAM,SAAS,CAAC;AA4CjD,oBAAY,WAAW;IACnB,SAAS,qBAA2B;IACpC,MAAM,kBAA2B;IACjC,MAAM,kBAA2B;IACjC,QAAQ,cAAqB;IAC7B,MAAM,kBAA2B;IACjC,KAAK,UAAoB;IACzB,QAAQ,oBAA2B;IACnC,GAAG,eAA2B;IAC9B,MAAM,YAAqB;IAC3B,YAAY,mBAAsB;IAClC,YAAY,wBAA2B;IACvC,QAAQ,oBAA2B;IACnC,WAAW,uBAA2B;IACtC,OAAO,mBAA2B;IAClC,SAAS,sBAA4B;IACrC,QAAQ,oBAA2B;IACnC,WAAW,uBAA2B;IACtC,OAAO,mBAA2B;IAClC,gBAAgB,6BAA6B;IAC7C,UAAU,uBAA4B;CAEzC;AACD,oBAAY,YAAY,GAAG,CAAC,UAAU,EAAC,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AA6Z9D;;GAEG;AACH,wBAAgB,eAAe,IAAG,OAAO,CAExC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-helper.service.d.ts","sourceRoot":"","sources":["../../../src/ts/services/theme-helper.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD;;GAEG;AACH,qBAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"theme-helper.service.d.ts","sourceRoot":"","sources":["../../../src/ts/services/theme-helper.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD;;GAEG;AACH,qBAAa,kBAAkB;IA+BvB,OAAO,CAAC,WAAW;IA9BvB,MAAM,CAAC,OAAO,WAAyB;IAEvC,OAAO,CAAC,YAAY,CAyBnB;gBAGW,WAAW,EAAC,eAAe;IAIvC,OAAO,KAAK,QAAQ,GAEnB;IAED,uCAAuC;IACvC,IAAI,GAAG,WAEN;IAED,8FAA8F;IACxF,qBAAqB,IAAG,OAAO,CAAC,MAAM,CAAC;IAW7C,4GAA4G;IACtG,oBAAoB,IAAG,OAAO,CAAC,MAAM,CAAC;IAM5C,SAAS,CAAE,GAAG,EAAC,MAAM,GAAG,MAAM;IAa9B;;;OAGG;IACH,mBAAmB,CAAE,QAAQ,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAYrD,4CAA4C;IAC5C,WAAW,CAAE,KAAK,EAAC,MAAM;IAWzB,iCAAiC;IAC3B,UAAU,CAAE,SAAS,EAAC,MAAM;IA8BlC,qEAAqE;IACrE,UAAU,IAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIlC,2FAA2F;IACrF,QAAQ,CAAE,KAAK,EAAC,UAAU;IAMhC;;OAEG;IACF,WAAW,CAAE,GAAG,EAAC,OAAO,GAAG,MAAM;IA2BlC,wCAAwC;IACxC,kBAAkB,CAAE,MAAM,EAAC,OAAO,GAAG,MAAM;CAG9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ptit-observatoire-widget.widget.d.ts","sourceRoot":"","sources":["../../../../src/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.ts"],"names":[],"mappings":"AAgIA,eAAO,MAAM,aAAa,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Moment } from "moment";
|
|
2
|
+
import 'moment/locale/fr';
|
|
3
|
+
export declare class Controller {
|
|
4
|
+
platform: {
|
|
5
|
+
readonly deploymentTag: string;
|
|
6
|
+
readonly cdnDomain: string;
|
|
7
|
+
readonly apps: {
|
|
8
|
+
initialize(app: import("ode-ts-client").App, alternativeApp?: boolean | undefined): Promise<void>;
|
|
9
|
+
getPublicConf(app: import("ode-ts-client").App): Promise<any>;
|
|
10
|
+
getWebAppConf(app: import("ode-ts-client").App): Promise<import("ode-ts-client").IWebApp | undefined>;
|
|
11
|
+
loadI18n(app: import("ode-ts-client").App): Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
readonly theme: import("ode-ts-client").ITheme;
|
|
14
|
+
readonly analytics: {
|
|
15
|
+
parameters<T extends import("ode-ts-client").ITrackingParams>(type: import("ode-ts-client").TrackingType): Promise<T | undefined>;
|
|
16
|
+
xiti(): Promise<import("ode-ts-client").IXitiTrackingParams | undefined>;
|
|
17
|
+
readonly status: import("ode-ts-client").AnalyticStatus;
|
|
18
|
+
};
|
|
19
|
+
readonly idiom: import("ode-ts-client").IIdiom;
|
|
20
|
+
listLanguages(): Promise<string[]>;
|
|
21
|
+
};
|
|
22
|
+
lang: import("ode-ts-client").IIdiom;
|
|
23
|
+
selectedUser: string;
|
|
24
|
+
viewMode: "weekly" | "daily";
|
|
25
|
+
userData: {
|
|
26
|
+
[key: string]: {
|
|
27
|
+
weekly: any;
|
|
28
|
+
daily: any;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
selectedDailyDate: string;
|
|
32
|
+
weekStart: Moment;
|
|
33
|
+
weekEnd: Moment;
|
|
34
|
+
updateChart: () => void;
|
|
35
|
+
todayOnCampus: number;
|
|
36
|
+
todayOffCampus: number;
|
|
37
|
+
todayTotal: number;
|
|
38
|
+
weeklyAvgOnCampus: number;
|
|
39
|
+
weeklyAvgOffCampus: number;
|
|
40
|
+
weeklyTotalAverage: number;
|
|
41
|
+
weeklyAvgSchoolUsePercentage: number;
|
|
42
|
+
weeklyAvgOutOfSchoolPercentage: number;
|
|
43
|
+
fixedTodayOnCampus: number;
|
|
44
|
+
fixedTodayOffCampus: number;
|
|
45
|
+
fixedTodayTotal: number;
|
|
46
|
+
fixedWeeklyAvgOnCampus: number;
|
|
47
|
+
fixedWeeklyAvgOffCampus: number;
|
|
48
|
+
fixedWeeklyTotalAverage: number;
|
|
49
|
+
fixedWeeklyAvgSchoolUsePercentage: number;
|
|
50
|
+
fixedWeeklyAvgOutOfSchoolPercentage: number;
|
|
51
|
+
customWeekMode: boolean;
|
|
52
|
+
customStartDate: string;
|
|
53
|
+
customEndDate: string;
|
|
54
|
+
isParent: boolean;
|
|
55
|
+
hasError: boolean;
|
|
56
|
+
errorMessage: string;
|
|
57
|
+
fetchDataForCurrentUser: () => void;
|
|
58
|
+
fetchLightboxData: () => void;
|
|
59
|
+
showLightbox: boolean;
|
|
60
|
+
showDatePicker: boolean;
|
|
61
|
+
children: {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
userId: string;
|
|
65
|
+
}[];
|
|
66
|
+
selectedChild: null;
|
|
67
|
+
selectedChildHistogram: string;
|
|
68
|
+
toggleDatePicker(show: boolean): void;
|
|
69
|
+
setDateFromPicker(date: string): void;
|
|
70
|
+
toggleLightbox(show: boolean): void;
|
|
71
|
+
private getCurrentSchoolYear;
|
|
72
|
+
private setSelectedDate;
|
|
73
|
+
private setSelectedWeek;
|
|
74
|
+
canGoToPreviousWeek(): boolean;
|
|
75
|
+
canGoToNextWeek(): boolean;
|
|
76
|
+
canGoToPreviousDay(): boolean;
|
|
77
|
+
canGoToNextDay(): boolean;
|
|
78
|
+
changeDay(offset: number): void;
|
|
79
|
+
changeWeek(offset: number): void;
|
|
80
|
+
get selectedDailyDateObj(): Date;
|
|
81
|
+
get weekLabel(): string;
|
|
82
|
+
}
|
|
83
|
+
export declare const odeModuleName = "odeCantineWidgetModule";
|
|
84
|
+
//# sourceMappingURL=screen-time-widget.widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-time-widget.widget.d.ts","sourceRoot":"","sources":["../../../../src/ts/widgets/screen-time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EAAE,OAAO,CAAS;IAEhC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAM;IAC9D,aAAa,OAAQ;IACrB,sBAAsB,SAAM;IAE5B,gBAAgB,CAAC,IAAI,EAAE,OAAO;IAI9B,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAO9B,cAAc,CAAC,IAAI,EAAE,OAAO;IAsBnC,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,eAAe;IAOjB,mBAAmB,IAAI,OAAO;IAO9B,eAAe,IAAI,OAAO;IAO1B,kBAAkB,IAAI,OAAO;IAO5B,cAAc,IAAI,OAAO;IAOzB,SAAS,CAAC,MAAM,EAAE,MAAM;IAMxB,UAAU,CAAC,MAAM,EAAE,MAAM;IAMhC,IAAW,oBAAoB,IAAI,IAAI,CAEtC;IAED,IAAW,SAAS,IAAI,MAAM,CAI7B;CACJ;AAmXD,eAAO,MAAM,aAAa,2BAA2B,CAAC"}
|
package/dist/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ode-ngjs-front
|
|
1
|
+
ode-ngjs-front 30/07/2025 15:00:25
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[443],{7601:(t,e,r)=>{r.d(e,{Z:()=>i});const i='<style>.ptit-observatoire-widget-container{box-sizing:border-box;background:#358284;padding:10px;border-radius:6px;overflow:hidden}.ptit-observatoire-widget-content{display:flex;flex-direction:column;gap:10px;box-sizing:border-box;width:100%;height:100%;background-color:#fff;border-radius:3px;padding:10px}.ptit-observatoire-widget-form{width:100%;display:flex;flex-direction:column;gap:10px}.ptit-observatoire-widget-select{background-color:#fff;padding:15px;border:1px solid #c1c1ca;color:#c1c1ca;border-radius:10px}.ptit-observatoire-submit-button{display:flex;align-items:center;gap:10px;background-color:#173a37;color:#fff;border:none;padding:10px 15px;border-radius:30px}.ptit-observatoire-plus-icon{display:flex;align-items:center;justify-content:center;line-height:100%;text-align:center;background-color:#2c6262;border-radius:50%;width:30px;height:30px}.ptit-observatoire-modal-form{display:flex;flex-direction:column;gap:15px}.ptit-observatoire-modal-form-legend{text-transform:uppercase;color:#7caaac;font-weight:700}.ptit-observatoire-modal-form-textarea{width:100%}.ptit-observatoire-modal-options-container{display:flex;flex-wrap:wrap;gap:5px}</style> <div class="ptit-observatoire-widget-container"> <div class="ptit-observatoire-widget-content"> <p> <i18n>ptitObservatoire.title</i18n> </p> <div class="widget-body" dnd-nodrag> <form class="ptit-observatoire-widget-form" ng-submit="ctrl.startObservation()"> <select class="ptit-observatoire-widget-select" name="student" ng-model="ctrl.formData.student_id"> <option value="" selected="selected"> </option> <option ng-repeat="student in ctrl.studentsList" value="{{student.id}}"> {{student.fullName}} </option> </select> <button type="submit" class="ptit-observatoire-submit-button"> <span class="ptit-observatoire-plus-icon">+</span> <span> <i18n>ptitObservatoire.newObservation</i18n> </span> </button> </form> </div> </div> <ode-modal visible="ctrl.showLightbox" on-close="ctrl.showLightbox=false" size="lg" dnd-nodrag> <ode-modal-title> <h2> <i18n>ptitObservatoire.modal.title</i18n> </h2> </ode-modal-title> <ode-modal-body> <form class="ptit-observatoire-modal-form" ng-submit="ctrl.handleObservationSubmit(); ctrl.showLightbox=false"> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.observation</i18n> </legend> <textarea class="ptit-observatoire-modal-form-textarea" name="content" ng-model="ctrl.formData[\'content\']" i18n-placeholder="ptitObservatoire.modal.textarea.placeholder"></textarea> </fieldset> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.evaluation</i18n> </legend> <label for="strengths"> <input type="radio" id="strength" name="assessment_type" ng-model="ctrl.formData[\'assessment_type\']" ng-value="\'strength\'"/> <i18n>ptitObservatoire.modal.evaluation.strength</i18n> </label> <label for="neutral"> <input type="radio" id="neutral" name="assessment_type" ng-model="ctrl.formData[\'assessment_type\']" ng-value="\'neutral\'"/> <i18n>ptitObservatoire.modal.evaluation.neutral</i18n> </label> <label for="difficulties"> <input type="radio" id="difficulties" name="assessment_type" ng-model="ctrl.formData[\'assessment_type\']" ng-value="\'difficulties\'"/> <i18n>ptitObservatoire.modal.evaluation.difficulties</i18n> </label> </fieldset> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.categories</i18n> </legend> <div class="ptit-observatoire-modal-options-container"> <label ng-repeat="category in ctrl.observationCategories"> <input type="radio" name="{{category.name}}" ng-model="ctrl.formData[\'category_id\']" ng-value="category.id"/> {{ category.name }} </label> </div> </fieldset> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.options</i18n> </legend> <label> <input type="checkbox" ng-model="ctrl.formData[\'private\']"/> <i18n>ptitObservatoire.modal.options.private</i18n> </label> </fieldset> <button type="submit" class="ptit-observatoire-submit-button"> <i18n>ptitObservatoire.modal.save</i18n> </button> </form> </ode-modal-body> </ode-modal> </div>'},5883:function(t,e,r){var i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(function(o,n){function a(t){try{l(i.next(t))}catch(t){n(t)}}function s(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,s)}l((i=i.apply(t,e||[])).next())})},n=this&&this.__generator||function(t,e){var r,i,o,n,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(n){return function(s){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(o=2&n[0]?i.return:n[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,n[1])).done)return o;switch(i=0,o&&(n=[2&n[0],o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,i=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var s=a(r(4202)),l=r(9419),d=r(6731),c=function(){function t(){this.formData={},this.observationCategories=[],this.studentsList=[],this.showLightbox=!1}return t.prototype.startObservation=function(){this.formData.student_id&&(this.showLightbox=!0)},t.prototype.handleObservationSubmit=function(){return o(this,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return t={data:{type:"observations",attributes:i(i({},this.formData),{teacher_id:1,date:(new Date).toISOString().substring(0,10)})}},[4,this.saveObservation(t)];case 1:return e.sent(),[2]}})})},t.prototype.saveObservation=function(t){return o(this,void 0,void 0,function(){var e;return n(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,(0,l.http)().postJson("/appregistry/ptitObservatoire/observations",t)];case 1:return r.sent(),d.notify.success("ptitObservatoire.notify.save.success"),[3,3];case 2:return e=r.sent(),console.error("Error saving observation:",e),d.notify.error("ptitObservatoire.notify.save.error"),[3,3];case 3:return[2]}})})},t}(),u=function(){function t(){this.restrict="E",this.template=r(7601).Z,this.scope={},this.bindToController=!0,this.controller=[c],this.controllerAs="ctrl",this.require=["odePtitObservatoireWidget"]}return t.prototype.link=function(t,e,r,i){return o(this,void 0,void 0,function(){var e,r;return n(this,function(o){switch(o.label){case 0:return(e=i?i[0]:null)?[4,Promise.all([this.getObservationCategories(),this.getStudentsList()])]:[2];case 1:return r=o.sent(),e.observationCategories=r[0],e.studentsList=r[1],t.$applyAsync(),[2]}})})},t.prototype.getStudentsList=function(){return o(this,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,(0,l.http)().get("/appregistry/ptitObservatoire/students")];case 1:return[2,e.sent().map(function(t){return{id:t.id,fullName:t.attributes.full_name}})];case 2:return t=e.sent(),console.error("Error fetching students:",t),[2,[]];case 3:return[2]}})})},t.prototype.getObservationCategories=function(){return o(this,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,(0,l.http)().get("/appregistry/ptitObservatoire/observations/categories")];case 1:return[2,e.sent().map(function(t){return{id:t.id,name:t.attributes.name}})];case 2:return t=e.sent(),console.error("Error fetching categories:",t),[2,[]];case 3:return[2]}})})},t}();(0,l.notif)().onLangReady().promise.then(function(t){(0,l.conf)().Platform.idiom.addKeys(r(5512))}),e.odeModuleName="odePtitObservatoireWidgetModule",s.default.module(e.odeModuleName,[]).directive("odePtitObservatoireWidget",function(){return new u})},5512:t=>{t.exports=JSON.parse('{"ptitObservatoire.title":"Centraliser mes observations","ptitObservatoire.newObservation":"Nouvelle observation","ptitObservatoire.selectStudent":"Sélectionner un élève","ptitObservatoire.modal.title":"Saisie de l\'Observation","ptitObservatoire.modal.observation":"Observation","ptitObservatoire.modal.evaluation":"Évaluation","ptitObservatoire.modal.evaluation.strength":"Forces","ptitObservatoire.modal.evaluation.neutral":"Neutre","ptitObservatoire.modal.evaluation.difficulties":"Difficultés","ptitObservatoire.modal.categories":"Catégories","ptitObservatoire.modal.options":"Options","ptitObservatoire.modal.options.private":"Observation privée","ptitObservatoire.modal.save":"Enregistrer l\'observation","ptitObservatoire.notify.save.success":"Observation enregistrée avec succès","ptitObservatoire.notify.save.error":"Une erreur est survenue lors de l\'enregistrement de l\'observation","ptitObservatoire.modal.textarea.placeholder":"Je suis bienveillant et factuel : J\'écris ce que j\'ai vu et entendu"}')}}]);
|
|
2
|
+
//# sourceMappingURL=ptit-observatoire-widget.widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js","mappings":"gIAGA,QAFW,+iI,+wDCDX,iBACA,UACA,UAaA,0BACC,KAAAA,SAAsC,CAAC,EAChC,KAAAC,sBAA+C,GAC/C,KAAAC,aAA0B,GAC1B,KAAAC,cAAe,CAiCvB,QA9BC,YAAAC,iBAAA,WACKC,KAAKL,SAASM,aACjBD,KAAKF,cAAe,EAEtB,EAEM,YAAAI,wBAAN,W,8FAYC,OAXMC,EAAO,CACZC,KAAM,CACLC,KAAM,eACNC,WAAY,EAAF,KACNN,KAAKL,UAAQ,CAChB,WAAc,EACd,MAAQ,IAAIY,MAAOC,cAAcC,UAAU,EAAG,QAKjD,GAAMT,KAAKU,gBAAgBP,I,cAA3B,S,UAGK,YAAAO,gBAAN,SAAsBP,G,8FAEpB,O,sBAAA,IAAM,IAAAQ,QAAOC,SAAS,6CAA8CT,I,cAApE,SACA,EAAAU,OAAOC,QAAQ,wC,+BAEfC,QAAQC,MAAM,4BAA6B,GAC3C,EAAAH,OAAOG,MAAM,sC,6BAGhB,EArCA,GAwCA,0BACC,KAAAC,SAAW,IACX,KAAAC,SAAW,UACX,KAAAC,MAAQ,CAAC,EACT,KAAAC,kBAAmB,EACnB,KAAAC,WAAa,CAACC,GACd,KAAAC,aAAe,OACf,KAAAC,QAAU,CAAC,4BA8CZ,QA5CO,YAAAC,KAAN,SAAWN,EAAeO,EAAcC,EAAoBC,G,gGAI3D,OAHMC,EAA0BD,EAC5BA,EAAY,GACb,MAK+C,GAAME,QAAQC,IAAI,CACnE/B,KAAKgC,2BACLhC,KAAKiC,qBALL,I,cAGD,EAAkD,SAAjDJ,EAAKjC,sBAAqB,KAAEiC,EAAKhC,aAAY,KAK9CsB,EAAMe,c,UAGD,YAAAD,gBAAN,W,8FAEc,O,sBAAA,IAAM,IAAAtB,QAAOwB,IAAI,2C,OAE7B,MAAO,CAAP,EAFY,SAEDC,IAAI,SACdC,GACI,OACJC,GAAID,EAAQC,GACZC,SAAUF,EAAQ/B,WAAWkC,UAFzB,I,OAML,O,WADAzB,QAAQC,MAAM,2BAA4B,GACnC,CAAC,EAAD,I,uBAIH,YAAAgB,yBAAN,W,8FAEc,O,sBAAA,IAAM,IAAArB,QAAOwB,IAAI,0D,OAC7B,MAAO,CAAP,EADY,SACDC,IAAI,SAACK,GAA2D,OAC1EH,GAAIG,EAASH,GACbI,KAAMD,EAASnC,WAAWoC,KAFgD,I,OAM3E,O,WADA3B,QAAQC,MAAM,6BAA8B,GACrC,CAAC,EAAD,I,uBAGV,EArDA,IA6DA,IAAA2B,SACEC,cACAC,QAAQC,KAAK,SAACC,IAGZ,IAAAC,QAAOC,SAASC,MAAMC,QAAQ,EAAQ,MAGzC,GAIY,EAAAC,cAAgB,kCAC7B,UACEC,OAAO,EAAAD,cAAe,IACtBE,UAAU,4BApBZ,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<style>.ptit-observatoire-widget-container{box-sizing:border-box;background:#358284;padding:10px;border-radius:6px;overflow:hidden}.ptit-observatoire-widget-content{display:flex;flex-direction:column;gap:10px;box-sizing:border-box;width:100%;height:100%;background-color:#fff;border-radius:3px;padding:10px}.ptit-observatoire-widget-form{width:100%;display:flex;flex-direction:column;gap:10px}.ptit-observatoire-widget-select{background-color:#fff;padding:15px;border:1px solid #c1c1ca;color:#c1c1ca;border-radius:10px}.ptit-observatoire-submit-button{display:flex;align-items:center;gap:10px;background-color:#173a37;color:#fff;border:none;padding:10px 15px;border-radius:30px}.ptit-observatoire-plus-icon{display:flex;align-items:center;justify-content:center;line-height:100%;text-align:center;background-color:#2c6262;border-radius:50%;width:30px;height:30px}.ptit-observatoire-modal-form{display:flex;flex-direction:column;gap:15px}.ptit-observatoire-modal-form-legend{text-transform:uppercase;color:#7caaac;font-weight:700}.ptit-observatoire-modal-form-textarea{width:100%}.ptit-observatoire-modal-options-container{display:flex;flex-wrap:wrap;gap:5px}</style> <div class=\\\"ptit-observatoire-widget-container\\\"> <div class=\\\"ptit-observatoire-widget-content\\\"> <p> <i18n>ptitObservatoire.title</i18n> </p> <div class=\\\"widget-body\\\" dnd-nodrag> <form class=\\\"ptit-observatoire-widget-form\\\" ng-submit=\\\"ctrl.startObservation()\\\"> <select class=\\\"ptit-observatoire-widget-select\\\" name=\\\"student\\\" ng-model=\\\"ctrl.formData.student_id\\\"> <option value=\\\"\\\" selected=\\\"selected\\\"> </option> <option ng-repeat=\\\"student in ctrl.studentsList\\\" value=\\\"{{student.id}}\\\"> {{student.fullName}} </option> </select> <button type=\\\"submit\\\" class=\\\"ptit-observatoire-submit-button\\\"> <span class=\\\"ptit-observatoire-plus-icon\\\">+</span> <span> <i18n>ptitObservatoire.newObservation</i18n> </span> </button> </form> </div> </div> <ode-modal visible=\\\"ctrl.showLightbox\\\" on-close=\\\"ctrl.showLightbox=false\\\" size=\\\"lg\\\" dnd-nodrag> <ode-modal-title> <h2> <i18n>ptitObservatoire.modal.title</i18n> </h2> </ode-modal-title> <ode-modal-body> <form class=\\\"ptit-observatoire-modal-form\\\" ng-submit=\\\"ctrl.handleObservationSubmit(); ctrl.showLightbox=false\\\"> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.observation</i18n> </legend> <textarea class=\\\"ptit-observatoire-modal-form-textarea\\\" name=\\\"content\\\" ng-model=\\\"ctrl.formData['content']\\\" i18n-placeholder=\\\"ptitObservatoire.modal.textarea.placeholder\\\"></textarea> </fieldset> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.evaluation</i18n> </legend> <label for=\\\"strengths\\\"> <input type=\\\"radio\\\" id=\\\"strength\\\" name=\\\"assessment_type\\\" ng-model=\\\"ctrl.formData['assessment_type']\\\" ng-value=\\\"'strength'\\\"/> <i18n>ptitObservatoire.modal.evaluation.strength</i18n> </label> <label for=\\\"neutral\\\"> <input type=\\\"radio\\\" id=\\\"neutral\\\" name=\\\"assessment_type\\\" ng-model=\\\"ctrl.formData['assessment_type']\\\" ng-value=\\\"'neutral'\\\"/> <i18n>ptitObservatoire.modal.evaluation.neutral</i18n> </label> <label for=\\\"difficulties\\\"> <input type=\\\"radio\\\" id=\\\"difficulties\\\" name=\\\"assessment_type\\\" ng-model=\\\"ctrl.formData['assessment_type']\\\" ng-value=\\\"'difficulties'\\\"/> <i18n>ptitObservatoire.modal.evaluation.difficulties</i18n> </label> </fieldset> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.categories</i18n> </legend> <div class=\\\"ptit-observatoire-modal-options-container\\\"> <label ng-repeat=\\\"category in ctrl.observationCategories\\\"> <input type=\\\"radio\\\" name=\\\"{{category.name}}\\\" ng-model=\\\"ctrl.formData['category_id']\\\" ng-value=\\\"category.id\\\"/> {{ category.name }} </label> </div> </fieldset> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.options</i18n> </legend> <label> <input type=\\\"checkbox\\\" ng-model=\\\"ctrl.formData['private']\\\"/> <i18n>ptitObservatoire.modal.options.private</i18n> </label> </fieldset> <button type=\\\"submit\\\" class=\\\"ptit-observatoire-submit-button\\\"> <i18n>ptitObservatoire.modal.save</i18n> </button> </form> </ode-modal-body> </ode-modal> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, http, notif } from \"../../utils\";\nimport { notify } from \"../../services\";\n\ninterface Student {\n\tid: number,\n\tfullName: string\n}\n\ninterface ObservationCategory {\n\tid: number,\n\tname: string\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tformData: { [key: string]: string } = {};\n\tpublic observationCategories: ObservationCategory[] = [];\n\tpublic studentsList: Student[] = [];\n\tpublic showLightbox = false;\n\n\n\tstartObservation() {\n\t\tif (this.formData.student_id) {\n\t\t\tthis.showLightbox = true;\n\t\t}\n\t}\n\n\tasync handleObservationSubmit() {\n\t\tconst body = {\n\t\t\tdata: {\n\t\t\t\ttype: \"observations\",\n\t\t\t\tattributes: {\n\t\t\t\t\t...this.formData,\n\t\t\t\t\t\"teacher_id\": 1, // TODO: change when respone updated from ptit observatoire\n\t\t\t\t\t\"date\": new Date().toISOString().substring(0, 10),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this.saveObservation(body)\n\t}\n\n\tasync saveObservation(body: any): Promise<void> {\n\t\ttry {\n\t\t\tawait http().postJson(\"/appregistry/ptitObservatoire/observations\", body)\n\t\t\tnotify.success(\"ptitObservatoire.notify.save.success\")\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error saving observation:\", error);\n\t\t\tnotify.error(\"ptitObservatoire.notify.save.error\")\n\t\t}\n\t}\n}\n\n/* Directive */\nclass Directive implements IDirective<IScope, JQLite, IAttributes, IController[]> {\n\trestrict = 'E';\n\ttemplate = require('./ptit-observatoire-widget.widget.html').default;\n\tscope = {};\n\tbindToController = true;\n\tcontroller = [Controller];\n\tcontrollerAs = 'ctrl';\n\trequire = ['odePtitObservatoireWidget'];\n\n\tasync link(scope: IScope, elem: JQLite, attrs: IAttributes, controllers?: IController[]) {\n\t\tconst ctrl: Controller | null = controllers\n\t\t\t? (controllers[0] as Controller)\n\t\t\t: null;\n\t\tif (!ctrl) {\n\t\t\treturn;\n\t\t}\n\n\t\t[ctrl.observationCategories, ctrl.studentsList] = await Promise.all([\n\t\t\tthis.getObservationCategories(),\n\t\t\tthis.getStudentsList(),\n\t\t]);\n\n\t\tscope.$applyAsync();\n\t}\n\n\tasync getStudentsList(): Promise<Student[]> {\n\t\ttry {\n\t\t\tconst res = await http().get(\"/appregistry/ptitObservatoire/students\");\n\n\t\t\treturn res.map((\n\t\t\t\tstudent: { id: number, attributes: { full_name: string } }\n\t\t\t) => ({\n\t\t\t\tid: student.id,\n\t\t\t\tfullName: student.attributes.full_name\n\t\t\t}));\n\t\t} catch (e) {\n\t\t\tconsole.error(\"Error fetching students:\", e);\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tasync getObservationCategories(): Promise<ObservationCategory[]> {\n\t\ttry {\n\t\t\tconst res = await http().get(\"/appregistry/ptitObservatoire/observations/categories\");\n\t\t\treturn res.map((category: { id: number; attributes: { name: string } }) => ({\n\t\t\t\tid: category.id,\n\t\t\t\tname: category.attributes.name,\n\t\t\t}));\n\t\t} catch (e) {\n\t\t\tconsole.error(\"Error fetching categories:\", e);\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\n/** The P'tit observatoire widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif()\n\t.onLangReady()\n\t.promise.then((lang) => {\n\t\tswitch (lang) {\n\t\t\tdefault:\n\t\t\t\tconf().Platform.idiom.addKeys(require(\"./i18n/fr.json\"));\n\t\t\t\tbreak;\n\t\t}\n\t});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odePtitObservatoireWidgetModule\";\nangular\n\t.module(odeModuleName, [])\n\t.directive(\"odePtitObservatoireWidget\", DirectiveFactory);\n"],"names":["formData","observationCategories","studentsList","showLightbox","startObservation","this","student_id","handleObservationSubmit","body","data","type","attributes","Date","toISOString","substring","saveObservation","http","postJson","notify","success","console","error","restrict","template","scope","bindToController","controller","Controller","controllerAs","require","link","elem","attrs","controllers","ctrl","Promise","all","getObservationCategories","getStudentsList","$applyAsync","get","map","student","id","fullName","full_name","category","name","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[202],{5688:(e,t,o)=>{o.d(t,{Z:()=>r});const r='<style>.screen-time-summary{padding:16px;font-family:Roboto,sans-serif;display:flex;flex-direction:column;gap:12px}.title{padding-bottom:6px;font-size:16px;color:#4a4a4a;font-weight:700;border-bottom:1px solid #e0e0e0}.modal-body{margin:1rem 0!important}.summary-row{display:flex;gap:12px}.summary-row:nth-of-type(2){margin-top:10px}.summary-block{flex:1;background:#e5f5ff;border-radius:12px;padding:12px;box-shadow:0 1px 3px rgba(0,0,0,.1)}.summary-block .label{font-size:16px;color:#4a4a4a;font-weight:700;margin-bottom:4px}.summary-block .value{font-size:32px;color:#333}.percentage-bar-container{width:100%;height:10px;background-color:#e0e0e0;border-radius:5px;margin-top:5px;display:flex;overflow:hidden}.percentage-bar{height:100%;transition:width .5s ease-in-out;border-radius:5px}.legend{display:flex;gap:16px;align-items:center;margin-top:10px;font-size:10px;color:#333}.legend-item{display:flex;align-items:center;gap:6px}.legend-square{width:16px;height:16px;border-radius:4px}.custom-select{appearance:none;border:none;padding:8px 32px 8px 12px;border-radius:6px;font-size:16px;color:#333;font-family:Roboto,sans-serif;background:#fff url("data:image/svg+xml,%3Csvg fill=\'none\' stroke=\'%23666\' stroke-width=\'2\' viewBox=\'0 0 24 24\' xmlns=\'http://www.w3.org/2000/svg\'%3E%3Cpath stroke-linecap=\'round\' stroke-linejoin=\'round\' d=\'M19 9l-7 7-7-7\'%3E%3C/path%3E%3C/svg%3E") no-repeat right 10px center;background-size:16px;cursor:pointer;min-width:150px}.custom-select:focus{outline:0;box-shadow:0 0 0 2px rgba(42,156,200,.3)}.see-more{display:flex;justify-content:flex-end;margin-top:8px;padding-left:4px}.see-more button{background-color:transparent;border:none;font-family:Roboto,sans-serif;font-weight:600;font-size:16px;line-height:24px;padding:6px 12px;cursor:pointer;color:#2a9cc8;border-radius:4px;transition:background-color .2s ease}.see-more button:hover{background-color:#f0f8fc}.centered-controls{margin:0 auto 20px auto;width:fit-content;text-align:center}.view-controls{display:flex;width:100%;flex-direction:row;justify-content:flex-end;margin-bottom:16px}.control-group{display:flex;align-items:center}.close-button-container{display:flex;justify-content:flex-end;margin-top:20px}.close-button{width:84px;height:40px;padding:8px 16px;background:#ff8d2e;color:#fff;font-size:16px;font-weight:700;border:none;border-radius:8px;cursor:pointer;transition:background .3s ease}.close-button:hover{background:#e67c24}.date-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.nav-button{background:0 0;border:none;font-size:24px;cursor:pointer}.date-navigation{display:flex;align-items:center;justify-content:center;gap:1rem}.date-navigation button{background:0 0;border:none;font-size:1.5rem;cursor:pointer}.date-navigation button:disabled{color:#d3d3d3;cursor:not-allowed}.selected-date{cursor:pointer;font-weight:700}.error-message{background-color:#ffe5e5;color:#c00;border:1px solid #c00;padding:12px;border-radius:6px;font-size:14px;font-weight:500}.info-popover{position:absolute;z-index:10;display:block;width:90%;background-color:#fff;border:1px solid #e0e0e0;box-shadow:0 4px 6px 0 rgba(0,0,0,.08);font-size:1.5rem;line-height:1.8;padding:1rem;border-radius:6px}</style> <div class="screen-time-widget-container"> <div class="screen-time-summary"> <div class="title"> <div class="label"> <i18n>screenTime.title.uppercase</i18n> </div> </div> <div ng-if="ctrl.isParent"> <select id="userSelect" class="custom-select" ng-model="ctrl.selectedUser" ng-options="child.userId as child.name for child in ctrl.children" ng-change="ctrl.fetchDataForCurrentUser()"> </select> </div> <div class="error-message" ng-if="ctrl.errorMessage"> {{ ctrl.errorMessage }} </div> <div ng-if="!ctrl.errorMessage"> <div class="summary-row"> <div class="summary-block"> <div class="label"> <i18n>screenTime.today</i18n> </div> <div class="value">{{ ctrl.todayTotal | duration }}</div> </div> </div> <div class="summary-row"> <div class="summary-block"> <div class="label"> <i18n>screenTime.weekAverage</i18n> </div> <div class="value">{{ ctrl.weeklyTotalAverage | duration }}</div> </div> </div> <div class="legend"> <div class="see-more"> <button ng-click="ctrl.toggleLightbox(true)"> <i18n>screenTime.displayDetails</i18n> </button> </div> </div> </div> </div> <ode-modal visible="ctrl.showLightbox" on-close="ctrl.toggleLightbox(false)" size="lg" dnd-nodrag> <ode-modal-title> <h2> <i18n>screenTime.title.normal</i18n> <popover> <popover-opener><i class="fa-solid fa-circle-info"></i></popover-opener> <popover-content class="info-popover"> <ul> <li> <i18n>screenTime.information.first</i18n> </li> <li> <i18n>screenTime.information.second</i18n> </li> <li> <i18n>screenTime.information.third</i18n> </li> <li> <i18n>screenTime.information.fourth</i18n> </li> </ul> </popover-content> </popover> </h2> <div class="view-controls"> <div class="control-group"> <label style="font-size:14px" for="userSelect"> <i18n>screenTime.user</i18n> :</label> <div ng-if="ctrl.isParent"> <select id="userSelect" class="custom-select" ng-model="ctrl.selectedChildHistogram" ng-options="child.userId as child.name for child in ctrl.children"> </select> </div> </div> <div class="control-group"> <label for="viewMode"> <i18n>screenTime.viewMode</i18n> :</label> <select id="viewMode" class="custom-select" ng-model="ctrl.viewMode" ng-change="ctrl.updateChart()"> <option value="weekly"> [[ctrl.lang.translate("screenTime.viewMode.weekly")]] </option> <option value="daily"> [[ctrl.lang.translate("screenTime.viewMode.daily")]] </option> </select> </div> </div> </ode-modal-title> <ode-modal-body class="modal-body"> <div class="date-selectors centered-controls" ng-if="ctrl.showLightbox"> <div class="date-navigation" ng-if="ctrl.viewMode === \'daily\'"> <button ng-click="ctrl.changeDay(-1)" ng-disabled="!ctrl.canGoToPreviousDay()">←</button> <div ng-if="!ctrl.showDatePicker" class="selected-date" ng-click="ctrl.toggleDatePicker(true)"> {{ ctrl.selectedDailyDateObj | date:\'fullDate\' }} </div> <input type="date" ng-if="ctrl.showDatePicker" ng-model="ctrl.selectedDailyDate" ng-change="ctrl.setDateFromPicker(ctrl.selectedDailyDate)" ng-blur="ctrl.toggleDatePicker(false)" max="{{ ctrl.selectedDailyDate }}"/> <button ng-click="ctrl.changeDay(1)" ng-disabled="!ctrl.canGoToNextDay()">→</button> </div> <div class="date-navigation" ng-if="ctrl.viewMode === \'weekly\'"> <button ng-click="ctrl.changeWeek(-1)" ng-disabled="!ctrl.canGoToPreviousWeek()">←</button> <div class="selected-date">{{ ctrl.weekLabel }}</div> <button ng-click="ctrl.changeWeek(1)" ng-disabled="!ctrl.canGoToNextWeek()">→</button> </div> </div> <canvas id="myChart" style="width:100%;height:500px;max-height:500px"></canvas> </ode-modal-body> </ode-modal> </div>'},58:function(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=t.Controller=void 0;var a=r(o(4202)),i=o(9419),n=o(5668),s=r(o(381));o(4470),n.Chart.register.apply(n.Chart,n.registerables),s.default.locale("fr");var l=function(){function e(){this.platform=(0,i.conf)().Platform,this.lang=this.platform.idiom,this.selectedUser="",this.viewMode="weekly",this.userData={},this.selectedDailyDate=(0,s.default)().format("YYYY-MM-DD"),this.weekStart=(0,s.default)().startOf("isoWeek"),this.weekEnd=(0,s.default)().endOf("isoWeek"),this.updateChart=function(){},this.todayOnCampus=0,this.todayOffCampus=0,this.todayTotal=0,this.weeklyAvgOnCampus=0,this.weeklyAvgOffCampus=0,this.weeklyTotalAverage=0,this.weeklyAvgSchoolUsePercentage=0,this.weeklyAvgOutOfSchoolPercentage=0,this.fixedTodayOnCampus=0,this.fixedTodayOffCampus=0,this.fixedTodayTotal=0,this.fixedWeeklyAvgOnCampus=0,this.fixedWeeklyAvgOffCampus=0,this.fixedWeeklyTotalAverage=0,this.fixedWeeklyAvgSchoolUsePercentage=0,this.fixedWeeklyAvgOutOfSchoolPercentage=0,this.customWeekMode=!1,this.customStartDate="",this.customEndDate="",this.isParent=!1,this.hasError=!1,this.errorMessage="",this.fetchDataForCurrentUser=function(){},this.fetchLightboxData=function(){},this.showLightbox=!1,this.showDatePicker=!1,this.children=[],this.selectedChild=null,this.selectedChildHistogram=""}return e.prototype.toggleDatePicker=function(e){this.showDatePicker=e},e.prototype.setDateFromPicker=function(e){var t=(0,s.default)(e).format("YYYY-MM-DD");this.showDatePicker=!1,this.setSelectedDate(t),this.fetchLightboxData()},e.prototype.toggleLightbox=function(e){this.showLightbox=e,e&&(this.fixedTodayOnCampus=this.todayOnCampus,this.fixedTodayOffCampus=this.todayOffCampus,this.fixedTodayTotal=this.todayTotal,this.fixedWeeklyAvgOnCampus=this.weeklyAvgOnCampus,this.fixedWeeklyAvgOffCampus=this.weeklyAvgOffCampus,this.fixedWeeklyTotalAverage=this.weeklyTotalAverage,this.fixedWeeklyAvgSchoolUsePercentage=this.weeklyAvgSchoolUsePercentage,this.fixedWeeklyAvgOutOfSchoolPercentage=this.weeklyAvgOutOfSchoolPercentage,this.selectedDailyDate=(0,s.default)().format("YYYY-MM-DD"),this.weekStart=(0,s.default)().startOf("isoWeek"),this.weekEnd=(0,s.default)().endOf("isoWeek"),this.selectedChildHistogram=this.selectedUser)},e.prototype.getCurrentSchoolYear=function(){var e=(0,s.default)(),t=e.year(),o=e.month()<8?(0,s.default)({year:t-1,month:8,day:1}):(0,s.default)({year:t,month:8,day:1}),r=o.clone().add(1,"year").subtract(1,"day");return{schoolYearStart:o.startOf("day"),schoolYearEnd:r.endOf("day")}},e.prototype.setSelectedDate=function(e){var t=(0,s.default)(e);this.selectedDailyDate=t.format("YYYY-MM-DD"),this.weekStart=t.clone().startOf("isoWeek"),this.weekEnd=t.clone().endOf("isoWeek")},e.prototype.setSelectedWeek=function(e){this.weekStart=e.clone().startOf("isoWeek"),this.weekEnd=this.weekStart.clone().endOf("isoWeek"),this.selectedDailyDate=this.weekStart.format("YYYY-MM-DD")},e.prototype.canGoToPreviousWeek=function(){var e=this.weekStart.clone().subtract(1,"week"),t=this.getCurrentSchoolYear(),o=t.schoolYearStart,r=t.schoolYearEnd;return e.isBetween(o,r)},e.prototype.canGoToNextWeek=function(){var e=this.weekStart.clone().add(1,"week"),t=this.getCurrentSchoolYear(),o=t.schoolYearStart,r=t.schoolYearEnd;return e.isBetween(o,r)},e.prototype.canGoToPreviousDay=function(){var e=(0,s.default)(this.selectedDailyDate).subtract(1,"day"),t=this.getCurrentSchoolYear(),o=t.schoolYearStart,r=t.schoolYearEnd;return e.isBetween(o,r)},e.prototype.canGoToNextDay=function(){var e=(0,s.default)(this.selectedDailyDate).add(1,"day"),t=this.getCurrentSchoolYear(),o=t.schoolYearStart,r=t.schoolYearEnd;return e.isBetween(o,r)},e.prototype.changeDay=function(e){var t=(0,s.default)(this.selectedDailyDate).add(e,"days");this.setSelectedDate(t),this.fetchLightboxData()},e.prototype.changeWeek=function(e){var t=this.weekStart.clone().add(e,"weeks");this.setSelectedWeek(t),this.fetchLightboxData()},Object.defineProperty(e.prototype,"selectedDailyDateObj",{get:function(){return new Date(this.selectedDailyDate)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weekLabel",{get:function(){var e=this.weekStart.format("dddd D MMMM"),t=this.weekEnd.format("dddd D MMMM");return"du ".concat(e," au ").concat(t)},enumerable:!1,configurable:!0}),e}();function c(e,t,o,r,a,i){t.children=d(t);var n="/appregistry/screen-time/".concat(o,"/weekly?startDate=").concat(a,"&endDate=").concat(i),s="/appregistry/screen-time/".concat(o,"/daily?date=").concat(r);return Promise.all([e.get(n),e.get(s)]).then(function(e){var o=e[0],r=e[1];return t.hasError=!1,t.errorMessage="",{weekly:o.data.dailySummaries.reduce(function(e,t){return e[t.date]={duration:t.durationMinutes,schoolUsePercentage:t.schoolUsePercentage/100},e},{}),daily:r.data.durations.map(function(e){return{hour:e.hour,duration:e.durationMinutes,schoolUsePercentage:e.schoolUsePercentage/100}})}}).catch(function(e){return t.hasError=!0,404===(null==e?void 0:e.status)?t.errorMessage="Erreur lors de l’identification de l’utilisateur. Contactez l’administrateur de votre établissement.":t.errorMessage="Un problème technique est survenu. Si le problème persiste contactez l’administrateur de votre établissement.",console.error("Error fetching data for current user and dates:",e),Promise.reject(e)})}function d(e){var t=(0,i.session)().user.children;return e.isParent=!1,t&&Object.keys(t).length>0?(e.isParent=!0,Object.entries(t).map(function(e){var t=e[0],o=e[1];return{id:t,name:"".concat(o.firstName," ").concat(o.lastName),userId:t}})):[]}t.Controller=l;var u=function(){function e(){this.restrict="E",this.template=o(5688).Z,this.scope={},this.bindToController=!0,this.controller=[l],this.controllerAs="ctrl",this.require=["odeScreenTimeWidget"]}return e.prototype.link=function(e,t,o,r){var l=r?r[0]:null;if(l){var u=a.default.injector(["ng"]).get("$http"),f=(0,i.session)().user.userId;l.fetchDataForCurrentUser();var h=null,p=function(e,t,o,r){return"".concat(e,"_daily_").concat(t,"_weekly_").concat(o,"_").concat(r)};l.fetchDataForCurrentUser=function(){l.errorMessage="",l.hasError=!1;var t=p(l.selectedUser,(0,s.default)().format("YYYY-MM-DD"),(0,s.default)().startOf("isoWeek").format("YYYY-MM-DD"),(0,s.default)().endOf("isoWeek").format("YYYY-MM-DD"));c(u,l,l.selectedUser,(0,s.default)().format("YYYY-MM-DD"),(0,s.default)().startOf("isoWeek").format("YYYY-MM-DD"),(0,s.default)().endOf("isoWeek").format("YYYY-MM-DD")).then(function(o){var r,a,i,n,c,d,u,f,h,p;l.userData[t]={weekly:o.weekly,daily:o.daily},r=o.weekly,a=0,i=0,n=0,c=(0,s.default)().format("YYYY-MM-DD"),d=0,u=0,f=0,h=0,p=0,Object.keys(r).forEach(function(e){var t=r[e],o=t.duration||0,l=t.schoolUsePercentage||0,g=o*l,m=o*(1-l);a+=g,i+=m,n++,f+=g,h+=m,p+=o,(0,s.default)(e).format("YYYY-MM-DD")===c&&(d=g,u=m)}),l.todayOnCampus=d,l.todayOffCampus=u,l.todayTotal=d+u,l.weeklyAvgOnCampus=n>0?a/n:0,l.weeklyAvgOffCampus=n>0?i/n:0,l.weeklyTotalAverage=l.weeklyAvgOnCampus+l.weeklyAvgOffCampus,p>0?(l.weeklyAvgSchoolUsePercentage=f/p*100,l.weeklyAvgOutOfSchoolPercentage=h/p*100):(l.weeklyAvgSchoolUsePercentage=0,l.weeklyAvgOutOfSchoolPercentage=0),e.$applyAsync()}).catch(function(t){e.$applyAsync(),console.error("Error fetching initial data for current user:",t)})},l.fetchLightboxData=function(){var t=l.selectedChildHistogram||l.selectedUser;if(t){var o=p(t,l.selectedDailyDate,l.weekStart.format("YYYY-MM-DD"),l.weekEnd.format("YYYY-MM-DD"));c(u,l,t,l.selectedDailyDate,l.weekStart.format("YYYY-MM-DD"),l.weekEnd.format("YYYY-MM-DD")).then(function(t){l.userData[o]={weekly:t.weekly,daily:t.daily},l.showLightbox&&setTimeout(function(){return l.updateChart()},50),e.$applyAsync()}).catch(function(e){console.error("Error fetching data for lightbox:",e)})}},l.updateChart=function(){var e=t[0].querySelector("#myChart");if(e){var o=e.getContext("2d");if(o){var r=[],a=[],i=l.selectedChildHistogram||l.selectedUser,c=p(i,l.selectedDailyDate,l.weekStart.format("YYYY-MM-DD"),l.weekEnd.format("YYYY-MM-DD")),d=l.userData[c];if(d){var u="weekly"===l.viewMode?d.weekly:d.daily;if(u){if("weekly"===l.viewMode)Object.keys(u).sort().forEach(function(e){var t=u[e];r.push((0,s.default)(e).format("ddd D")),a.push(t.duration)});else u.forEach(function(e){r.push("".concat(e.hour,"h")),a.push(e.duration)});h?(h.data.labels=r,h.data.datasets[0].data=a,h.options={scales:{x:{stacked:!0},y:{stacked:!0,beginAtZero:!0,title:{display:!0,text:"weekly"===l.viewMode?"Heures":"Minutes"}}}},h.update()):h=new n.Chart(o,{type:"bar",data:{labels:r,datasets:[{label:"Usage total",data:a,backgroundColor:"#2A9CC8"}]},options:{plugins:{tooltip:{callbacks:{label:function(e){var t=e.raw;return"".concat(e.dataset.label,": ").concat(t," ").concat("weekly"===l.viewMode?"heures":"minutes")}}},legend:{display:!1,position:"bottom"}},responsive:!0,scales:{x:{stacked:!0},y:{stacked:!0,beginAtZero:!0,title:{display:!0,text:"weekly"===l.viewMode?"Heures":"Minutes"}}}}})}}}}},l.children=d(l),l.isParent&&l.children.length>0?(l.selectedUser||(l.selectedUser=l.children[0].userId),l.fetchDataForCurrentUser()):!l.isParent&&f?(l.selectedUser=f,l.fetchDataForCurrentUser()):(l.hasError=!0,l.errorMessage="Aucun utilisateur disponible pour afficher les données de temps d'écran.",e.$applyAsync()),e.$watch(function(){return l.viewMode},function(e,t){e!==t&&l.showLightbox&&setTimeout(function(){return l.updateChart()},50)}),e.$watch(function(){return l.selectedChildHistogram},function(e,t){e!==t&&l.showLightbox&&l.fetchLightboxData()}),e.$watch(function(){return l.showLightbox},function(e){e?(l.selectedChildHistogram=l.selectedUser,setTimeout(function(){l.updateChart()},100)):h&&(h.destroy(),h=null)})}},e}();t.odeModuleName="odeCantineWidgetModule",a.default.module(t.odeModuleName,[]).filter("duration",function(){return function(e){if(isNaN(e)||null===e||e<0)return"0m";var t=Math.floor(e),o=Math.floor(t/60),r=t%60,a="";return o>0&&(a+="".concat(o,"h")),(r>0||0===o&&0===t)&&(a+="".concat(r,"m")),a.trim()||"0m"}}).directive("odeScreenTimeWidget",function(){return new u}),(0,i.notif)().onLangReady().promise.then(function(e){(0,i.conf)().Platform.idiom.addKeys(o(1245))})},1245:e=>{e.exports=JSON.parse('{"screenTime.title.normal":"Temps d\'écran","screenTime.title.uppercase":"TEMPS D\'ÉCRAN","screenTime.today":"Aujourd\'hui","screenTime.weekAverage":"Moyenne de la semaine","screenTime.displayDetails":"Voir le détail","screenTime.user":"Utilisateur","screenTime.viewMode":"Affichage","screenTime.viewMode.weekly":"Hebdomadaire","screenTime.viewMode.daily":"Quotidien","screenTime.modal.close":"Fermer","screenTime.information.first":"\'Temps d\'écran\' est une fonctionnalité mise en place par le Département des Bouches-du-Rhône.","screenTime.information.second":"Elle permet de mesurer le temps d\'activité de l\'élève sur l\'ordinateur portable mis à disposition par le Département pendant le temps scolaire et en dehors du temps scolaire.","screenTime.information.third":"\'Temps d\'écran\' observe uniquement l\'ouverture et la fermeture de la session par l\'élève sur son ordinateur.","screenTime.information.fourth":"La fonctionnalité n\'enregistre aucune donnée personnelle d\'utilisation ou de navigation internet."}')}}]);
|
|
2
|
+
//# sourceMappingURL=screen-time-widget.widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widgets/screen-time-widget/screen-time-widget.widget.js","mappings":"gIAGA,QAFW,qmN,8LCDX,iBACA,UACA,UACA,YACA,QAEA,EAAAA,MAAMC,SAAQ,MAAd,EAAAD,MAAkB,EAAAE,eAClB,UAAOC,OAAO,MAGd,8BACW,KAAAC,UAAW,IAAAC,QAAOC,SAClB,KAAAC,KAAOC,KAAKJ,SAASK,MACrB,KAAAC,aAAuB,GACvB,KAAAC,SAA+B,SAE/B,KAAAC,SAA2D,CAAC,EAC5D,KAAAC,mBAA4B,eAASC,OAAO,cAC5C,KAAAC,WAAoB,eAASC,QAAQ,WACrC,KAAAC,SAAkB,eAASC,MAAM,WAEjC,KAAAC,YAA0B,WAAQ,EAElC,KAAAC,cAAgB,EAChB,KAAAC,eAAiB,EACjB,KAAAC,WAAa,EAEb,KAAAC,kBAAoB,EACpB,KAAAC,mBAAqB,EACrB,KAAAC,mBAAqB,EACrB,KAAAC,6BAAuC,EACvC,KAAAC,+BAAyC,EAGzC,KAAAC,mBAAqB,EACrB,KAAAC,oBAAsB,EACtB,KAAAC,gBAAkB,EAElB,KAAAC,uBAAyB,EACzB,KAAAC,wBAA0B,EAC1B,KAAAC,wBAA0B,EAC1B,KAAAC,kCAA4C,EAC5C,KAAAC,oCAA8C,EAK9C,KAAAC,gBAA0B,EAC1B,KAAAC,gBAA0B,GAC1B,KAAAC,cAAwB,GAExB,KAAAC,UAA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://ode-ngjs-front/./src/ts/widgets/screen-time-widget/screen-time-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<style>.screen-time-summary{padding:16px;font-family:Roboto,sans-serif;display:flex;flex-direction:column;gap:12px}.title{padding-bottom:6px;font-size:16px;color:#4a4a4a;font-weight:700;border-bottom:1px solid #e0e0e0}.modal-body{margin:1rem 0!important}.summary-row{display:flex;gap:12px}.summary-row:nth-of-type(2){margin-top:10px}.summary-block{flex:1;background:#e5f5ff;border-radius:12px;padding:12px;box-shadow:0 1px 3px rgba(0,0,0,.1)}.summary-block .label{font-size:16px;color:#4a4a4a;font-weight:700;margin-bottom:4px}.summary-block .value{font-size:32px;color:#333}.percentage-bar-container{width:100%;height:10px;background-color:#e0e0e0;border-radius:5px;margin-top:5px;display:flex;overflow:hidden}.percentage-bar{height:100%;transition:width .5s ease-in-out;border-radius:5px}.legend{display:flex;gap:16px;align-items:center;margin-top:10px;font-size:10px;color:#333}.legend-item{display:flex;align-items:center;gap:6px}.legend-square{width:16px;height:16px;border-radius:4px}.custom-select{appearance:none;border:none;padding:8px 32px 8px 12px;border-radius:6px;font-size:16px;color:#333;font-family:Roboto,sans-serif;background:#fff url(\\\"data:image/svg+xml,%3Csvg fill='none' stroke='%23666' stroke-width='2' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E\\\") no-repeat right 10px center;background-size:16px;cursor:pointer;min-width:150px}.custom-select:focus{outline:0;box-shadow:0 0 0 2px rgba(42,156,200,.3)}.see-more{display:flex;justify-content:flex-end;margin-top:8px;padding-left:4px}.see-more button{background-color:transparent;border:none;font-family:Roboto,sans-serif;font-weight:600;font-size:16px;line-height:24px;padding:6px 12px;cursor:pointer;color:#2a9cc8;border-radius:4px;transition:background-color .2s ease}.see-more button:hover{background-color:#f0f8fc}.centered-controls{margin:0 auto 20px auto;width:fit-content;text-align:center}.view-controls{display:flex;width:100%;flex-direction:row;justify-content:flex-end;margin-bottom:16px}.control-group{display:flex;align-items:center}.close-button-container{display:flex;justify-content:flex-end;margin-top:20px}.close-button{width:84px;height:40px;padding:8px 16px;background:#ff8d2e;color:#fff;font-size:16px;font-weight:700;border:none;border-radius:8px;cursor:pointer;transition:background .3s ease}.close-button:hover{background:#e67c24}.date-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.nav-button{background:0 0;border:none;font-size:24px;cursor:pointer}.date-navigation{display:flex;align-items:center;justify-content:center;gap:1rem}.date-navigation button{background:0 0;border:none;font-size:1.5rem;cursor:pointer}.date-navigation button:disabled{color:#d3d3d3;cursor:not-allowed}.selected-date{cursor:pointer;font-weight:700}.error-message{background-color:#ffe5e5;color:#c00;border:1px solid #c00;padding:12px;border-radius:6px;font-size:14px;font-weight:500}.info-popover{position:absolute;z-index:10;display:block;width:90%;background-color:#fff;border:1px solid #e0e0e0;box-shadow:0 4px 6px 0 rgba(0,0,0,.08);font-size:1.5rem;line-height:1.8;padding:1rem;border-radius:6px}</style> <div class=\\\"screen-time-widget-container\\\"> <div class=\\\"screen-time-summary\\\"> <div class=\\\"title\\\"> <div class=\\\"label\\\"> <i18n>screenTime.title.uppercase</i18n> </div> </div> <div ng-if=\\\"ctrl.isParent\\\"> <select id=\\\"userSelect\\\" class=\\\"custom-select\\\" ng-model=\\\"ctrl.selectedUser\\\" ng-options=\\\"child.userId as child.name for child in ctrl.children\\\" ng-change=\\\"ctrl.fetchDataForCurrentUser()\\\"> </select> </div> <div class=\\\"error-message\\\" ng-if=\\\"ctrl.errorMessage\\\"> {{ ctrl.errorMessage }} </div> <div ng-if=\\\"!ctrl.errorMessage\\\"> <div class=\\\"summary-row\\\"> <div class=\\\"summary-block\\\"> <div class=\\\"label\\\"> <i18n>screenTime.today</i18n> </div> <div class=\\\"value\\\">{{ ctrl.todayTotal | duration }}</div> </div> </div> <div class=\\\"summary-row\\\"> <div class=\\\"summary-block\\\"> <div class=\\\"label\\\"> <i18n>screenTime.weekAverage</i18n> </div> <div class=\\\"value\\\">{{ ctrl.weeklyTotalAverage | duration }}</div> </div> </div> <div class=\\\"legend\\\"> <div class=\\\"see-more\\\"> <button ng-click=\\\"ctrl.toggleLightbox(true)\\\"> <i18n>screenTime.displayDetails</i18n> </button> </div> </div> </div> </div> <ode-modal visible=\\\"ctrl.showLightbox\\\" on-close=\\\"ctrl.toggleLightbox(false)\\\" size=\\\"lg\\\" dnd-nodrag> <ode-modal-title> <h2> <i18n>screenTime.title.normal</i18n> <popover> <popover-opener><i class=\\\"fa-solid fa-circle-info\\\"></i></popover-opener> <popover-content class=\\\"info-popover\\\"> <ul> <li> <i18n>screenTime.information.first</i18n> </li> <li> <i18n>screenTime.information.second</i18n> </li> <li> <i18n>screenTime.information.third</i18n> </li> <li> <i18n>screenTime.information.fourth</i18n> </li> </ul> </popover-content> </popover> </h2> <div class=\\\"view-controls\\\"> <div class=\\\"control-group\\\"> <label style=\\\"font-size:14px\\\" for=\\\"userSelect\\\"> <i18n>screenTime.user</i18n> :</label> <div ng-if=\\\"ctrl.isParent\\\"> <select id=\\\"userSelect\\\" class=\\\"custom-select\\\" ng-model=\\\"ctrl.selectedChildHistogram\\\" ng-options=\\\"child.userId as child.name for child in ctrl.children\\\"> </select> </div> </div> <div class=\\\"control-group\\\"> <label for=\\\"viewMode\\\"> <i18n>screenTime.viewMode</i18n> :</label> <select id=\\\"viewMode\\\" class=\\\"custom-select\\\" ng-model=\\\"ctrl.viewMode\\\" ng-change=\\\"ctrl.updateChart()\\\"> <option value=\\\"weekly\\\"> [[ctrl.lang.translate(\\\"screenTime.viewMode.weekly\\\")]] </option> <option value=\\\"daily\\\"> [[ctrl.lang.translate(\\\"screenTime.viewMode.daily\\\")]] </option> </select> </div> </div> </ode-modal-title> <ode-modal-body class=\\\"modal-body\\\"> <div class=\\\"date-selectors centered-controls\\\" ng-if=\\\"ctrl.showLightbox\\\"> <div class=\\\"date-navigation\\\" ng-if=\\\"ctrl.viewMode === 'daily'\\\"> <button ng-click=\\\"ctrl.changeDay(-1)\\\" ng-disabled=\\\"!ctrl.canGoToPreviousDay()\\\">←</button> <div ng-if=\\\"!ctrl.showDatePicker\\\" class=\\\"selected-date\\\" ng-click=\\\"ctrl.toggleDatePicker(true)\\\"> {{ ctrl.selectedDailyDateObj | date:'fullDate' }} </div> <input type=\\\"date\\\" ng-if=\\\"ctrl.showDatePicker\\\" ng-model=\\\"ctrl.selectedDailyDate\\\" ng-change=\\\"ctrl.setDateFromPicker(ctrl.selectedDailyDate)\\\" ng-blur=\\\"ctrl.toggleDatePicker(false)\\\" max=\\\"{{ ctrl.selectedDailyDate }}\\\"/> <button ng-click=\\\"ctrl.changeDay(1)\\\" ng-disabled=\\\"!ctrl.canGoToNextDay()\\\">→</button> </div> <div class=\\\"date-navigation\\\" ng-if=\\\"ctrl.viewMode === 'weekly'\\\"> <button ng-click=\\\"ctrl.changeWeek(-1)\\\" ng-disabled=\\\"!ctrl.canGoToPreviousWeek()\\\">←</button> <div class=\\\"selected-date\\\">{{ ctrl.weekLabel }}</div> <button ng-click=\\\"ctrl.changeWeek(1)\\\" ng-disabled=\\\"!ctrl.canGoToNextWeek()\\\">→</button> </div> </div> <canvas id=\\\"myChart\\\" style=\\\"width:100%;height:500px;max-height:500px\\\"></canvas> </ode-modal-body> </ode-modal> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope, IHttpService } from \"angular\";\nimport { conf, notif, session } from \"../../utils\";\nimport { Chart, registerables } from \"chart.js\";\nimport moment, { Moment } from \"moment\";\nimport 'moment/locale/fr';\n\nChart.register(...registerables);\nmoment.locale('fr');\n\n// Controller\nexport class Controller {\n public platform = conf().Platform;\n public lang = this.platform.idiom;\n public selectedUser: string = \"\";\n public viewMode: \"weekly\" | \"daily\" = \"weekly\";\n\n public userData: { [key: string]: { weekly: any, daily: any } } = {};\n public selectedDailyDate: string = moment().format('YYYY-MM-DD');\n public weekStart: Moment = moment().startOf('isoWeek'); // Monday\n public weekEnd: Moment = moment().endOf('isoWeek'); // Sunday\n\n public updateChart: () => void = () => { };\n\n public todayOnCampus = 0;\n public todayOffCampus = 0;\n public todayTotal = 0;\n\n public weeklyAvgOnCampus = 0;\n public weeklyAvgOffCampus = 0;\n public weeklyTotalAverage = 0;\n public weeklyAvgSchoolUsePercentage: number = 0;\n public weeklyAvgOutOfSchoolPercentage: number = 0;\n\n // new props\n public fixedTodayOnCampus = 0;\n public fixedTodayOffCampus = 0;\n public fixedTodayTotal = 0;\n\n public fixedWeeklyAvgOnCampus = 0;\n public fixedWeeklyAvgOffCampus = 0;\n public fixedWeeklyTotalAverage = 0;\n public fixedWeeklyAvgSchoolUsePercentage: number = 0;\n public fixedWeeklyAvgOutOfSchoolPercentage: number = 0;\n\n\n // end of new \n\n public customWeekMode: boolean = false;\n public customStartDate: string = \"\";\n public customEndDate: string = \"\";\n\n public isParent: boolean = false;\n\n public hasError: boolean = false;\n public errorMessage: string = \"\";\n\n public fetchDataForCurrentUser: () => void = () => { };\n public fetchLightboxData: () => void = () => { };\n\n public showLightbox: boolean = false;\n public showDatePicker: boolean = false;\n\n public children: { id: string; name: string; userId: string }[] = [];\n public selectedChild = null;\n public selectedChildHistogram = \"\";\n\n public toggleDatePicker(show: boolean) {\n this.showDatePicker = show;\n }\n\n public setDateFromPicker(date: string) {\n const newDate = moment(date).format('YYYY-MM-DD');\n this.showDatePicker = false;\n this.setSelectedDate(newDate);\n this.fetchLightboxData();\n }\n\n public toggleLightbox(show: boolean) {\n this.showLightbox = show;\n if (show) {\n // Store the current summary values when lightbox opens\n this.fixedTodayOnCampus = this.todayOnCampus;\n this.fixedTodayOffCampus = this.todayOffCampus;\n this.fixedTodayTotal = this.todayTotal;\n this.fixedWeeklyAvgOnCampus = this.weeklyAvgOnCampus;\n this.fixedWeeklyAvgOffCampus = this.weeklyAvgOffCampus;\n this.fixedWeeklyTotalAverage = this.weeklyTotalAverage;\n this.fixedWeeklyAvgSchoolUsePercentage = this.weeklyAvgSchoolUsePercentage;\n this.fixedWeeklyAvgOutOfSchoolPercentage = this.weeklyAvgOutOfSchoolPercentage;\n\n // Initialize lightbox dates to current date/week\n this.selectedDailyDate = moment().format('YYYY-MM-DD');\n this.weekStart = moment().startOf('isoWeek');\n this.weekEnd = moment().endOf('isoWeek');\n this.selectedChildHistogram = this.selectedUser;\n\n }\n }\n\n private getCurrentSchoolYear(): { schoolYearStart: moment.Moment, schoolYearEnd: moment.Moment } {\n const today = moment();\n const currentYear = today.year();\n const currentMonth = today.month();\n\n // If current month is less than september, school year is the previous one\n const schoolYearStart = currentMonth < 8\n ? moment({ year: currentYear - 1, month: 8, day: 1 }) // 1st september of previous school year\n : moment({ year: currentYear, month: 8, day: 1 }); // 1st september of current school year\n\n const schoolYearEnd = schoolYearStart\n .clone()\n .add(1, 'year')\n .subtract(1, 'day'); // 31 august of next school year\n\n return {\n schoolYearStart: schoolYearStart.startOf('day'),\n schoolYearEnd: schoolYearEnd.endOf('day'),\n };\n }\n\n private setSelectedDate(date: string | moment.Moment) {\n const momentDate = moment(date);\n\n this.selectedDailyDate = momentDate.format('YYYY-MM-DD');\n\n this.weekStart = momentDate.clone().startOf('isoWeek');\n this.weekEnd = momentDate.clone().endOf('isoWeek');\n }\n\n private setSelectedWeek(weekStart: moment.Moment) {\n this.weekStart = weekStart.clone().startOf('isoWeek');\n this.weekEnd = this.weekStart.clone().endOf('isoWeek');\n\n this.selectedDailyDate = this.weekStart.format('YYYY-MM-DD');\n }\n\n public canGoToPreviousWeek(): boolean {\n const offsetWeekStart = this.weekStart.clone().subtract(1, 'week');\n const { schoolYearStart, schoolYearEnd } = this.getCurrentSchoolYear();\n\n return offsetWeekStart.isBetween(schoolYearStart, schoolYearEnd);\n }\n\n public canGoToNextWeek(): boolean {\n const offsetWeekStart = this.weekStart.clone().add(1, 'week');\n const { schoolYearStart, schoolYearEnd } = this.getCurrentSchoolYear();\n\n return offsetWeekStart.isBetween(schoolYearStart, schoolYearEnd);\n }\n\n public canGoToPreviousDay(): boolean {\n const offsetDayStart = moment(this.selectedDailyDate).subtract(1, 'day');\n const { schoolYearStart, schoolYearEnd } = this.getCurrentSchoolYear();\n\n return offsetDayStart.isBetween(schoolYearStart, schoolYearEnd);\n }\n\n public canGoToNextDay(): boolean {\n const offsetDayStart = moment(this.selectedDailyDate).add(1, 'day');\n const { schoolYearStart, schoolYearEnd } = this.getCurrentSchoolYear();\n\n return offsetDayStart.isBetween(schoolYearStart, schoolYearEnd);\n }\n\n public changeDay(offset: number) {\n const newDate = moment(this.selectedDailyDate).add(offset, 'days');\n this.setSelectedDate(newDate);\n this.fetchLightboxData();\n }\n\n public changeWeek(offset: number) {\n const newWeekStart = this.weekStart.clone().add(offset, 'weeks');\n this.setSelectedWeek(newWeekStart);\n this.fetchLightboxData();\n }\n\n public get selectedDailyDateObj(): Date {\n return new Date(this.selectedDailyDate);\n }\n\n public get weekLabel(): string {\n const start = this.weekStart.format('dddd D MMMM');\n const end = this.weekEnd.format('dddd D MMMM');\n return `du ${start} au ${end}`;\n }\n}\n\nfunction fetchAllScreenTimeDataForUserAndDates($http: IHttpService, ctrl: Controller, userId: string, dailyDate: string, startDate: string, endDate: string): Promise<{ weekly: any, daily: any }> {\n ctrl.children = fetchChildren(ctrl);\n\n const weeklyEndpoint = `/appregistry/screen-time/${userId}/weekly?startDate=${startDate}&endDate=${endDate}`;\n const dailyEndpoint = `/appregistry/screen-time/${userId}/daily?date=${dailyDate}`;\n\n return Promise.all([\n $http.get(weeklyEndpoint),\n $http.get(dailyEndpoint)\n ]).then(([weeklyResponse, dailyResponse]: [any, any]) => {\n ctrl.hasError = false;\n ctrl.errorMessage = \"\";\n return {\n weekly: weeklyResponse.data.dailySummaries.reduce((acc: any, day: any) => {\n acc[day.date] = {\n duration: day.durationMinutes,\n schoolUsePercentage: day.schoolUsePercentage / 100 // convert to ratio\n };\n return acc;\n }, {}),\n daily: dailyResponse.data.durations.map((hour: any) => ({\n hour: hour.hour,\n duration: hour.durationMinutes,\n schoolUsePercentage: hour.schoolUsePercentage / 100 // convert to ratio\n }))\n };\n }).catch(error => {\n ctrl.hasError = true;\n\n if (error?.status === 404) {\n ctrl.errorMessage = \"Erreur lors de l’identification de l’utilisateur. Contactez l’administrateur de votre établissement.\";\n } else {\n ctrl.errorMessage = \"Un problème technique est survenu. Si le problème persiste contactez l’administrateur de votre établissement.\";\n }\n\n console.error(\"Error fetching data for current user and dates:\", error);\n return Promise.reject(error);\n });\n}\n\nfunction fetchChildren(ctrl: Controller) {\n const childrenObj = session().user.children;\n ctrl.isParent = false;\n\n if (childrenObj && Object.keys(childrenObj).length > 0) {\n ctrl.isParent = true;\n\n return Object.entries(childrenObj).map(([userId, childData]) => {\n const child = childData as { firstName: string; lastName: string };\n return {\n id: userId,\n name: `${child.firstName} ${child.lastName}`,\n userId: userId\n };\n });\n } else {\n return [];\n }\n}\n\nclass Directive implements IDirective<IScope, JQLite, IAttributes, IController[]> {\n restrict = \"E\";\n template = require(\"./screen-time-widget.widget.html\").default;\n scope = {};\n bindToController = true;\n controller = [Controller];\n controllerAs = \"ctrl\";\n require = [\"odeScreenTimeWidget\"];\n\n link(scope: IScope, elem: angular.IAugmentedJQuery, attrs: IAttributes, controllers?: IController[]) {\n const ctrl: Controller | null = controllers ? (controllers[0] as Controller) : null;\n if (!ctrl) return;\n\n const $http = angular.injector([\"ng\"]).get<IHttpService>(\"$http\");\n const currentUserId = session().user.userId;\n\n ctrl.fetchDataForCurrentUser();\n\n let chartInstance: Chart | null = null;\n\n // Function to update the summary values from the pre-fetched weekly data\n const updateSummary = (weeklyData: any) => {\n let totalOnCampus = 0;\n let totalOffCampus = 0;\n let daysCount = 0;\n const today = moment().format(\"YYYY-MM-DD\");\n let todayOnCampusTemp = 0;\n let todayOffCampusTemp = 0;\n\n let weeklyTotalSchoolUseDuration = 0;\n let weeklyTotalOutOfSchoolDuration = 0;\n let weeklyTotalOverallDuration = 0;\n\n Object.keys(weeklyData).forEach(dateStr => {\n const entry = weeklyData[dateStr];\n const duration = entry.duration || 0;\n const schoolUsePct = entry.schoolUsePercentage || 0;\n\n const onCampus = duration * schoolUsePct;\n const offCampus = duration * (1 - schoolUsePct);\n\n totalOnCampus += onCampus;\n totalOffCampus += offCampus;\n daysCount++;\n\n weeklyTotalSchoolUseDuration += onCampus;\n weeklyTotalOutOfSchoolDuration += offCampus;\n weeklyTotalOverallDuration += duration;\n\n if (moment(dateStr).format(\"YYYY-MM-DD\") === today) {\n todayOnCampusTemp = onCampus;\n todayOffCampusTemp = offCampus;\n }\n });\n\n ctrl.todayOnCampus = todayOnCampusTemp;\n ctrl.todayOffCampus = todayOffCampusTemp;\n ctrl.todayTotal = todayOnCampusTemp + todayOffCampusTemp;\n ctrl.weeklyAvgOnCampus = daysCount > 0 ? totalOnCampus / daysCount : 0;\n ctrl.weeklyAvgOffCampus = daysCount > 0 ? totalOffCampus / daysCount : 0;\n ctrl.weeklyTotalAverage = ctrl.weeklyAvgOnCampus + ctrl.weeklyAvgOffCampus;\n\n if (weeklyTotalOverallDuration > 0) {\n ctrl.weeklyAvgSchoolUsePercentage = (weeklyTotalSchoolUseDuration / weeklyTotalOverallDuration) * 100;\n ctrl.weeklyAvgOutOfSchoolPercentage = (weeklyTotalOutOfSchoolDuration / weeklyTotalOverallDuration) * 100;\n } else {\n ctrl.weeklyAvgSchoolUsePercentage = 0;\n ctrl.weeklyAvgOutOfSchoolPercentage = 0;\n }\n };\n\n // Helper to generate a unique key for caching data based on user and date range\n const generateDataKey = (userId: string, dailyDate: string, startDate: string, endDate: string) => {\n return `${userId}_daily_${dailyDate}_weekly_${startDate}_${endDate}`;\n };\n\n // New function assigned to ctrl.fetchDataForCurrentUser to be called from HTML\n ctrl.fetchDataForCurrentUser = () => {\n ctrl.errorMessage = \"\";\n ctrl.hasError = false;\n const currentKey = generateDataKey(\n ctrl.selectedUser,\n moment().format('YYYY-MM-DD'), // Always use today's date for initial load\n moment().startOf('isoWeek').format('YYYY-MM-DD'),\n moment().endOf('isoWeek').format('YYYY-MM-DD')\n );\n\n // Fetch initial summary data (today and current week)\n fetchAllScreenTimeDataForUserAndDates(\n $http,\n ctrl,\n ctrl.selectedUser,\n moment().format('YYYY-MM-DD'),\n moment().startOf('isoWeek').format('YYYY-MM-DD'),\n moment().endOf('isoWeek').format('YYYY-MM-DD')\n ).then((data) => {\n ctrl.userData[currentKey] = { weekly: data.weekly, daily: data.daily };\n updateSummary(data.weekly); // Update the main summary values\n scope.$applyAsync();\n }).catch(error => {\n scope.$applyAsync();\n console.error(\"Error fetching initial data for current user:\", error);\n });\n };\n\n ctrl.fetchLightboxData = () => {\n\n const userIdForLightbox = ctrl.selectedChildHistogram || ctrl.selectedUser;\n\n if (!userIdForLightbox) return;\n\n const currentKey = generateDataKey(\n userIdForLightbox,\n ctrl.selectedDailyDate,\n ctrl.weekStart.format('YYYY-MM-DD'),\n ctrl.weekEnd.format('YYYY-MM-DD')\n );\n\n fetchAllScreenTimeDataForUserAndDates(\n $http,\n ctrl,\n userIdForLightbox,\n ctrl.selectedDailyDate,\n ctrl.weekStart.format('YYYY-MM-DD'),\n ctrl.weekEnd.format('YYYY-MM-DD')\n ).then((data) => {\n ctrl.userData[currentKey] = { weekly: data.weekly, daily: data.daily };\n if (ctrl.showLightbox) {\n setTimeout(() => ctrl.updateChart(), 50);\n }\n scope.$applyAsync();\n }).catch(error => {\n console.error(\"Error fetching data for lightbox:\", error);\n });\n };\n\n ctrl.updateChart = () => {\n const canvas = elem[0].querySelector<HTMLCanvasElement>(\"#myChart\");\n if (!canvas) return;\n\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return;\n\n let labels: string[] = [];\n let totalTimes: number[] = [];\n\n const userIdForChart = ctrl.selectedChildHistogram || ctrl.selectedUser;\n\n // Use the dates from the lightbox controls for the chart data key\n const currentDataKey = generateDataKey(\n userIdForChart,\n ctrl.selectedDailyDate,\n ctrl.weekStart.format('YYYY-MM-DD'),\n ctrl.weekEnd.format('YYYY-MM-DD')\n );\n const currentUserAndDateData = ctrl.userData[currentDataKey];\n\n if (!currentUserAndDateData) return;\n\n const dataToUse: any = ctrl.viewMode === \"weekly\" ? currentUserAndDateData.weekly : currentUserAndDateData.daily;\n if (!dataToUse) return;\n\n if (ctrl.viewMode === \"weekly\") {\n const sortedDates = Object.keys(dataToUse).sort();\n\n sortedDates.forEach(dataStr => {\n const entry = dataToUse[dataStr];\n labels.push(moment(dataStr).format('ddd D'));\n totalTimes.push(entry.duration);\n })\n } else {\n dataToUse.forEach((hourData: any) => {\n labels.push(`${hourData.hour}h`);\n totalTimes.push(hourData.duration);\n });\n }\n\n // If the chart already exists, we simply update it\n if (chartInstance) {\n chartInstance.data.labels = labels;\n chartInstance.data.datasets[0].data = totalTimes;\n\n chartInstance.options = {\n scales: {\n x: {\n stacked: true\n },\n y: {\n stacked: true,\n beginAtZero: true,\n title: {\n display: true,\n text: ctrl.viewMode === \"weekly\" ? \"Heures\" : \"Minutes\"\n }\n }\n }\n }\n\n chartInstance.update();\n } else {\n chartInstance = new Chart(ctx, {\n type: \"bar\",\n data: {\n labels,\n datasets: [\n {\n label: \"Usage total\",\n data: totalTimes,\n backgroundColor: \"#2A9CC8\"\n }\n ]\n },\n options: {\n plugins: {\n tooltip: {\n callbacks: {\n label: function (context) {\n const value = context.raw;\n return `${context.dataset.label}: ${value} ${ctrl.viewMode === \"weekly\" ? \"heures\" : \"minutes\"}`;\n }\n }\n },\n legend: {\n display: false,\n position: \"bottom\"\n }\n },\n responsive: true,\n scales: {\n x: {\n stacked: true\n },\n y: {\n stacked: true,\n beginAtZero: true,\n title: {\n display: true,\n text: ctrl.viewMode === \"weekly\" ? \"Heures\" : \"Minutes\"\n }\n }\n }\n }\n });\n }\n };\n\n ctrl.children = fetchChildren(ctrl);\n\n // Determine the user whose data should be fetched on load\n if (ctrl.isParent && ctrl.children.length > 0) {\n // If a parent, and has children, default to the first child if no child is selected yet\n if (!ctrl.selectedUser) {\n ctrl.selectedUser = ctrl.children[0].userId;\n }\n ctrl.fetchDataForCurrentUser();\n } else if (!ctrl.isParent && currentUserId) {\n // If not a parent, and current user ID is available, fetch data for themselves\n ctrl.selectedUser = currentUserId; // Set selectedUser to the current logged-in user's ID\n ctrl.fetchDataForCurrentUser();\n } else {\n // No children AND no current user ID (or other error condition)\n ctrl.hasError = true;\n ctrl.errorMessage = \"Aucun utilisateur disponible pour afficher les données de temps d'écran.\";\n scope.$applyAsync(); // Ensure the error message is displayed\n }\n\n // Watch for changes in view mode (within lightbox): only updates the chart\n scope.$watch(() => ctrl.viewMode, (newVal, oldVal) => {\n if (newVal !== oldVal && ctrl.showLightbox) {\n setTimeout(() => ctrl.updateChart(), 50);\n }\n });\n // Watch for selectedUser changes within the lightbox to update chart data\n scope.$watch(() => ctrl.selectedChildHistogram, (newVal, oldVal) => { // Changed from ctrl.selectedUser\n if (newVal !== oldVal && ctrl.showLightbox) {\n ctrl.fetchLightboxData();\n }\n });\n\n // Watch for lightbox visibility changes\n scope.$watch(() => ctrl.showLightbox, (isVisible: boolean) => {\n if (isVisible) {\n // When lightbox opens:\n // 1. Set selectedChildHistogram. This will trigger the selectedChildHistogram watch,\n // which will then call fetchLightboxData() (the single desired API call).\n ctrl.selectedChildHistogram = ctrl.selectedUser;\n\n // 2. Schedule chart update after a short delay, allowing fetchLightboxData() to begin.\n setTimeout(() => {\n ctrl.updateChart();\n }, 100);\n } else {\n // When lightbox closes\n if (chartInstance) {\n chartInstance.destroy();\n chartInstance = null;\n }\n }\n });\n\n }\n}\n\n// Factory function for the directive\nfunction DirectiveFactory() {\n return new Directive();\n}\n\n// Define the module name\nexport const odeModuleName = \"odeCantineWidgetModule\";\n\n// Angular module definition\nangular\n .module(odeModuleName, [])\n // Define the custom 'duration' filter\n .filter('duration', function () {\n return function (input: number) {\n if (isNaN(input) || input === null || input < 0) {\n return '0m';\n }\n\n const totalMinutes = Math.floor(input);\n const hours = Math.floor(totalMinutes / 60);\n const minutes = totalMinutes % 60;\n\n let result = '';\n\n if (hours > 0) {\n result += `${hours}h`;\n }\n if (minutes > 0 || (hours === 0 && totalMinutes === 0)) {\n result += `${minutes}m`;\n }\n\n return result.trim() || '0m';\n };\n })\n\n // Register the directive\n .directive(\"odeScreenTimeWidget\", DirectiveFactory);\n\n// Internationalization setup\nnotif()\n .onLangReady()\n .promise.then((lang) => {\n switch (lang) {\n default:\n conf().Platform.idiom.addKeys(require(\"./i18n/fr.json\"));\n break;\n }\n });\n"],"names":["Chart","register","registerables","locale","platform","conf","Platform","lang","this","idiom","selectedUser","viewMode","userData","selectedDailyDate","format","weekStart","startOf","weekEnd","endOf","updateChart","todayOnCampus","todayOffCampus","todayTotal","weeklyAvgOnCampus","weeklyAvgOffCampus","weeklyTotalAverage","weeklyAvgSchoolUsePercentage","weeklyAvgOutOfSchoolPercentage","fixedTodayOnCampus","fixedTodayOffCampus","fixedTodayTotal","fixedWeeklyAvgOnCampus","fixedWeeklyAvgOffCampus","fixedWeeklyTotalAverage","fixedWeeklyAvgSchoolUsePercentage","fixedWeeklyAvgOutOfSchoolPercentage","customWeekMode","customStartDate","customEndDate","isParent","hasError","errorMessage","fetchDataForCurrentUser","fetchLightboxData","showLightbox","showDatePicker","children","selectedChild","selectedChildHistogram","toggleDatePicker","show","setDateFromPicker","date","newDate","setSelectedDate","toggleLightbox","getCurrentSchoolYear","today","currentYear","year","schoolYearStart","month","day","schoolYearEnd","clone","add","subtract","momentDate","setSelectedWeek","canGoToPreviousWeek","offsetWeekStart","isBetween","canGoToNextWeek","canGoToPreviousDay","offsetDayStart","canGoToNextDay","changeDay","offset","changeWeek","newWeekStart","Date","start","end","fetchAllScreenTimeDataForUserAndDates","$http","ctrl","userId","dailyDate","startDate","endDate","fetchChildren","weeklyEndpoint","dailyEndpoint","Promise","all","get","then","weeklyResponse","dailyResponse","weekly","data","dailySummaries","reduce","acc","duration","durationMinutes","schoolUsePercentage","daily","durations","map","hour","catch","error","status","console","reject","childrenObj","session","user","Object","keys","length","entries","child","id","name","firstName","lastName","Controller","restrict","template","scope","bindToController","controller","controllerAs","require","link","elem","attrs","controllers","injector","currentUserId","chartInstance","generateDataKey","currentKey","weeklyData","totalOnCampus","totalOffCampus","daysCount","todayOnCampusTemp","todayOffCampusTemp","weeklyTotalSchoolUseDuration","weeklyTotalOutOfSchoolDuration","weeklyTotalOverallDuration","forEach","dateStr","entry","schoolUsePct","onCampus","offCampus","$applyAsync","userIdForLightbox","setTimeout","canvas","querySelector","ctx","getContext","labels","totalTimes","userIdForChart","currentDataKey","currentUserAndDateData","dataToUse","sort","dataStr","push","hourData","datasets","options","scales","x","stacked","y","beginAtZero","title","display","text","update","type","label","backgroundColor","plugins","tooltip","callbacks","context","value","raw","dataset","legend","position","responsive","$watch","newVal","oldVal","isVisible","destroy","odeModuleName","module","filter","input","isNaN","totalMinutes","Math","floor","hours","minutes","result","trim","directive","Directive","notif","onLangReady","promise","addKeys"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ode-ngjs-front",
|
|
3
|
-
"version": "1.4.13-
|
|
3
|
+
"version": "1.4.13-develop-integration.202507301459",
|
|
4
4
|
"description": "Open Digital Education Frontend Framework",
|
|
5
5
|
"homepage": "https://github.com/opendigitaleducation/ode-ngjs-front#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"watch": "npx webpack --config webpack.config.watch.js --env build_target=${npm_config_watch_springboard}/assets/js/ode-ngjs-front --watch"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"chart.js": "4.4.9",
|
|
29
30
|
"core-js": "3.9.1",
|
|
30
31
|
"humane-js": "3.2.2",
|
|
31
32
|
"moment": "2.29.1",
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"karma-chrome-launcher": "3.1.0",
|
|
53
54
|
"karma-jasmine": "4.0.1",
|
|
54
55
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
55
|
-
"ode-ts-client": "
|
|
56
|
+
"ode-ts-client": "develop-integration",
|
|
56
57
|
"terser-webpack-plugin": "5.1.4",
|
|
57
58
|
"ts-loader": "8.0.18",
|
|
58
59
|
"typescript": "4.6.4",
|