ode-ngjs-front 1.4.12-develop-integration.202506191529 → 1.4.12-develop-b2school.202506231606

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.
@@ -1,2 +0,0 @@
1
- export declare const odeModuleName = "odePtitObservatoireWidgetModule";
2
- //# sourceMappingURL=ptit-observatoire-widget.widget.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,19 +0,0 @@
1
- interface ScreenTimeData {
2
- weekly: {
3
- [key: string]: number[];
4
- };
5
- daily: {
6
- [key: string]: {
7
- [hour: string]: number;
8
- };
9
- };
10
- }
11
- export declare class Controller {
12
- selectedUser: string;
13
- viewMode: "weekly" | "daily";
14
- screenTimeData: ScreenTimeData;
15
- updateChart: () => void;
16
- }
17
- export declare const odeModuleName = "odeCantineWidgetModule";
18
- export {};
19
- //# sourceMappingURL=screen-time-widget.widget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"screen-time-widget.widget.d.ts","sourceRoot":"","sources":["../../../../src/ts/widgets/screen-time-widget/screen-time-widget.widget.ts"],"names":[],"mappings":"AAQA,UAAU,cAAc;IACpB,MAAM,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC3B,CAAC;IACF,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KAC7C,CAAC;CACL;AAsCD,qBAAa,UAAU;IACZ,YAAY,EAAE,MAAM,CAAa;IACjC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAY;IACxC,cAAc,EAAE,cAAc,CAA6B;IAC3D,WAAW,EAAE,MAAM,IAAI,CAAa;CAC9C;AAyHD,eAAO,MAAM,aAAa,2BAA2B,CAAC"}
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
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,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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":""}
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[202],{5688:(e,t,n)=>{n.d(t,{Z:()=>i});const i='<div> <label for="userSelect">Choisir un utilisateur :</label> <select id="userSelect" ng-model="ctrl.selectedUser" ng-change="ctrl.updateChart()"> <option value="Mathieu">Mathieu</option> <option value="Jean">Jean</option> </select> <label for="viewMode">Mode :</label> <select id="viewMode" ng-model="ctrl.viewMode" ng-change="ctrl.updateChart()"> <option value="weekly">Hebdomadaire</option> <option value="daily">Quotidien</option> </select> </div> <canvas id="myChart" width="400" height="200"></canvas>'},58:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function l(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,l)}u((i=i.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,i,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(a=2&r[0]?i.return:r[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,i=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){o.label=r[1];break}if(6===r[0]&&o.label<a[1]){o.label=a[1],a=r;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(r);break}a[2]&&o.ops.pop(),o.trys.pop();continue}r=t.call(e,o)}catch(e){r=[6,e],i=0}finally{n=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}},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 o=r(n(4202)),l=n(9419),u=n(5668);u.Chart.register.apply(u.Chart,u.registerables);var s=function(){this.selectedUser="Mathieu",this.viewMode="weekly",this.screenTimeData={weekly:{},daily:{}},this.updateChart=function(){}};t.Controller=s;var c=function(){function e(){this.restrict="E",this.template=n(5688).Z,this.scope={},this.bindToController=!0,this.controller=[s],this.controllerAs="ctrl",this.require=["odeScreenTimeWidget"]}return e.prototype.link=function(e,t,n,r){return i(this,void 0,void 0,function(){var n,i;return a(this,function(a){return(n=r?r[0]:null)?(i=null,e.$evalAsync(function(){var a=t[0].querySelector("#myChart");if(a){var r=a.getContext("2d");r&&(i=new u.Chart(r,{type:"bar",data:{labels:[],datasets:[{label:"",data:[],borderWidth:1,backgroundColor:"#4e79a7"}]},options:{animation:!1,responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0},tooltip:{enabled:!1}},scales:{x:{ticks:{autoSkip:!0,maxTicksLimit:10}},y:{beginAtZero:!0}}}}),new Promise(function(e){setTimeout(function(){e({weekly:{Mathieu:[12,19,3,5,2,3,1],Jean:[5,8,6,7,4,2,3]},daily:{Mathieu:{"08:00":15,"09:00":10,"10:00":30,"11:00":20,"12:00":25,"13: 00":17,"16:00":5,"18:00":10,"20:00":8,"22:00":12,"23:00":4},Jean:{"07:00":5,"09:00":25,"10:00":10,"18:00":15}}})},100)}).then(function(e){n.screenTimeData=e,n.updateChart()}),n.updateChart=function(){i&&requestAnimationFrame(function(){var e=[],t=[];if("weekly"===n.viewMode)e=["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"],t=n.screenTimeData.weekly[n.selectedUser]||[];else{var a=n.screenTimeData.daily[n.selectedUser]||{};t=(e=Object.keys(a)).map(function(e){return a[e]})}i&&(i.data.labels=e,i.data.datasets[0].data=t,i.data.datasets[0].label="weekly"===n.viewMode?"Temps d'écran hebdo (heures)":"Temps d'écran aujourd'hui (minutes)",i.update())})},e.$watch(function(){return n.selectedUser},function(){return n.updateChart()}),e.$watch(function(){return n.viewMode},function(){return n.updateChart()}))}}),[2]):[2]})})},e}();(0,l.notif)().onLangReady().promise.then(function(e){(0,l.conf)().Platform.idiom.addKeys(n(1245))}),t.odeModuleName="odeCantineWidgetModule",o.default.module(t.odeModuleName,[]).directive("odeScreenTimeWidget",function(){return new c})},1245:e=>{e.exports={}}}]);
2
- //# sourceMappingURL=screen-time-widget.widget.js.map
@@ -1 +0,0 @@
1
- {"version":3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,sBAlBf,WACI,OAAO,IAAIC,CACf,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/screen-time-widget/screen-time-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/screen-time-widget/screen-time-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<div> <label for=\\\"userSelect\\\">Choisir un utilisateur :</label> <select id=\\\"userSelect\\\" ng-model=\\\"ctrl.selectedUser\\\" ng-change=\\\"ctrl.updateChart()\\\"> <option value=\\\"Mathieu\\\">Mathieu</option> <option value=\\\"Jean\\\">Jean</option> </select> <label for=\\\"viewMode\\\">Mode :</label> <select id=\\\"viewMode\\\" ng-model=\\\"ctrl.viewMode\\\" ng-change=\\\"ctrl.updateChart()\\\"> <option value=\\\"weekly\\\">Hebdomadaire</option> <option value=\\\"daily\\\">Quotidien</option> </select> </div> <canvas id=\\\"myChart\\\" width=\\\"400\\\" height=\\\"200\\\"></canvas>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, notif } from \"../../utils\";\nimport { Chart, registerables } from \"chart.js\";\n\n// Register Chart.js components\nChart.register(...registerables);\n\n// Screen time data structure\ninterface ScreenTimeData {\n weekly: {\n [key: string]: number[]; // per user, 7-day weekly data\n };\n daily: {\n [key: string]: { [hour: string]: number }; // per user, hourly screen time (e.g., \"09:00\": 30)\n };\n}\n// Mocked API function\nfunction fetchScreenTimeData(): Promise<ScreenTimeData> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({\n weekly: {\n Mathieu: [12, 19, 3, 5, 2, 3, 1],\n Jean: [5, 8, 6, 7, 4, 2, 3]\n },\n daily: {\n Mathieu: {\n \"08:00\": 15,\n \"09:00\": 10,\n \"10:00\": 30,\n \"11:00\": 20,\n \"12:00\": 25,\n \"13: 00\": 17,\n \"16:00\": 5,\n \"18:00\": 10,\n \"20:00\": 8,\n \"22:00\": 12,\n \"23:00\": 4\n },\n Jean: {\n \"07:00\": 5,\n \"09:00\": 25,\n \"10:00\": 10,\n \"18:00\": 15\n }\n }\n });\n }, 100);\n });\n}\n\n\n// Controller\nexport class Controller {\n public selectedUser: string = \"Mathieu\";\n public viewMode: \"weekly\" | \"daily\" = \"weekly\";\n public screenTimeData: ScreenTimeData = { weekly: {}, daily: {} };\n public updateChart: () => void = () => { };\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 async 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 let chartInstance: Chart | null = null;\n let debounceTimeout: any;\n\n // Wait for DOM render\n scope.$evalAsync(() => {\n const canvas = elem[0].querySelector<HTMLCanvasElement>(\"#myChart\");\n if (!canvas) return;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return;\n\n // Init blank chart first\n chartInstance = new Chart(ctx, {\n type: \"bar\",\n data: {\n labels: [],\n datasets: [{\n label: \"\",\n data: [],\n borderWidth: 1,\n backgroundColor: \"#4e79a7\"\n }]\n },\n options: {\n animation: false,\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n display: true\n },\n tooltip: {\n enabled: false\n }\n },\n scales: {\n x: {\n ticks: {\n autoSkip: true,\n maxTicksLimit: 10\n }\n },\n y: {\n beginAtZero: true\n }\n }\n }\n });\n\n // Fetch and update chart\n fetchScreenTimeData().then((data) => {\n ctrl.screenTimeData = data;\n ctrl.updateChart();\n });\n\n ctrl.updateChart = () => {\n if (!chartInstance) return;\n\n requestAnimationFrame(() => {\n let labels: string[] = [];\n let values: number[] = [];\n\n if (ctrl.viewMode === \"weekly\") {\n labels = [\"Lundi\", \"Mardi\", \"Mercredi\", \"Jeudi\", \"Vendredi\", \"Samedi\", \"Dimanche\"];\n values = ctrl.screenTimeData.weekly[ctrl.selectedUser] || [];\n } else {\n const daily = ctrl.screenTimeData.daily[ctrl.selectedUser] || {};\n labels = Object.keys(daily);\n values = labels.map(hour => daily[hour]);\n }\n\n if (chartInstance) {\n chartInstance.data.labels = labels;\n chartInstance.data.datasets[0].data = values;\n chartInstance.data.datasets[0].label =\n ctrl.viewMode === \"weekly\"\n ? \"Temps d'écran hebdo (heures)\"\n : \"Temps d'écran aujourd'hui (minutes)\";\n chartInstance.update();\n }\n\n });\n };\n\n\n // Watcher for view mode or user change (if you bind to select/input in HTML)\n scope.$watch(() => ctrl.selectedUser, () => ctrl.updateChart());\n scope.$watch(() => ctrl.viewMode, () => ctrl.updateChart());\n });\n }\n}\n\nfunction DirectiveFactory() {\n return new Directive();\n}\n\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\nexport const odeModuleName = \"odeCantineWidgetModule\";\n\nangular\n .module(odeModuleName, [])\n .directive(\"odeScreenTimeWidget\", DirectiveFactory);\n"],"names":["Chart","register","registerables","selectedUser","viewMode","screenTimeData","weekly","daily","updateChart","Controller","restrict","template","scope","bindToController","controller","controllerAs","require","link","elem","attrs","controllers","ctrl","chartInstance","$evalAsync","canvas","querySelector","ctx","getContext","type","data","labels","datasets","label","borderWidth","backgroundColor","options","animation","responsive","maintainAspectRatio","plugins","legend","display","tooltip","enabled","scales","x","ticks","autoSkip","maxTicksLimit","y","beginAtZero","Promise","resolve","setTimeout","Mathieu","Jean","then","requestAnimationFrame","values","Object","keys","map","hour","update","$watch","notif","onLangReady","promise","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}