ode-ngjs-front 1.4.11-develop-integration.202506041736 → 1.4.12-develop-integration.202506191529

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.
Files changed (48) hide show
  1. package/dist/668.js +2 -2
  2. package/dist/668.js.map +1 -1
  3. package/dist/669.js +1 -1
  4. package/dist/669.js.map +1 -1
  5. package/dist/ode-ngjs-front.js +4 -4
  6. package/dist/ode-ngjs-front.js.map +1 -1
  7. package/dist/version.txt +1 -1
  8. package/dist/widgets/agenda-widget/agenda-widget.widget.js +1 -1
  9. package/dist/widgets/agenda-widget/agenda-widget.widget.js.map +1 -1
  10. package/dist/widgets/bookmark-widget/bookmark-widget.widget.js +1 -1
  11. package/dist/widgets/bookmark-widget/bookmark-widget.widget.js.map +1 -1
  12. package/dist/widgets/briefme-widget/briefme-widget.widget.js +1 -1
  13. package/dist/widgets/briefme-widget/briefme-widget.widget.js.map +1 -1
  14. package/dist/widgets/calendar-widget/calendar-widget.widget.js +1 -1
  15. package/dist/widgets/calendar-widget/calendar-widget.widget.js.map +1 -1
  16. package/dist/widgets/cantine-widget/cantine-widget.widget.js +1 -1
  17. package/dist/widgets/cantine-widget/cantine-widget.widget.js.map +1 -1
  18. package/dist/widgets/carnet-de-bord/carnet-de-bord.widget.js +1 -1
  19. package/dist/widgets/carnet-de-bord/carnet-de-bord.widget.js.map +1 -1
  20. package/dist/widgets/cursus-widget/cursus-widget.widget.js +1 -1
  21. package/dist/widgets/cursus-widget/cursus-widget.widget.js.map +1 -1
  22. package/dist/widgets/dicodelazone-widget/dicodelazone-widget.widget.js +1 -1
  23. package/dist/widgets/dicodelazone-widget/dicodelazone-widget.widget.js.map +1 -1
  24. package/dist/widgets/edumalin-widget/edumalin-widget.widget.js +1 -1
  25. package/dist/widgets/edumalin-widget/edumalin-widget.widget.js.map +1 -1
  26. package/dist/widgets/last-infos-widget/last-infos-widget.widget.js +1 -1
  27. package/dist/widgets/last-infos-widget/last-infos-widget.widget.js.map +1 -1
  28. package/dist/widgets/maxicours-widget/maxicours-widget.widget.js +1 -1
  29. package/dist/widgets/maxicours-widget/maxicours-widget.widget.js.map +1 -1
  30. package/dist/widgets/mediacentre-widget/mediacentre-widget.widget.js +1 -1
  31. package/dist/widgets/mediacentre-widget/mediacentre-widget.widget.js.map +1 -1
  32. package/dist/widgets/my-apps/my-apps.widget.js +1 -1
  33. package/dist/widgets/my-apps/my-apps.widget.js.map +1 -1
  34. package/dist/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js +1 -1
  35. package/dist/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js.map +1 -1
  36. package/dist/widgets/qwant-widget/qwant-widget.widget.js +1 -1
  37. package/dist/widgets/qwant-widget/qwant-widget.widget.js.map +1 -1
  38. package/dist/widgets/record-me/record-me.widget.js +1 -1
  39. package/dist/widgets/record-me/record-me.widget.js.map +1 -1
  40. package/dist/widgets/rss-widget/rss-widget.widget.js +1 -1
  41. package/dist/widgets/rss-widget/rss-widget.widget.js.map +1 -1
  42. package/dist/widgets/school-widget/school-widget.widget.js +1 -1
  43. package/dist/widgets/school-widget/school-widget.widget.js.map +1 -1
  44. package/dist/widgets/screen-time-widget/screen-time-widget.widget.js +1 -1
  45. package/dist/widgets/screen-time-widget/screen-time-widget.widget.js.map +1 -1
  46. package/dist/widgets/universalis-widget/universalis-widget.widget.js +1 -1
  47. package/dist/widgets/universalis-widget/universalis-widget.widget.js.map +1 -1
  48. package/package.json +1 -1
@@ -1,2 +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"}')}}]);
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
2
  //# sourceMappingURL=ptit-observatoire-widget.widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js","mappings":"gIAGA,QAF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BAA4B,GACnC,CAAC,EAAD,I,yBAIH,YAAAgB,yBAAN,W,gGAEc,O,sBAAA,IAAM,IAAArB,QAAOwB,IAAI,0D,OAC7B,MAAO,CAAP,EADY,SACDC,KAAI,SAACK,GAA2D,OAC1EH,GAAIG,EAASH,GACbI,KAAMD,EAASnC,WAAWoC,KAFgD,K,OAM3E,O,WADA3B,QAAQC,MAAM,6BAA8B,GACrC,CAAC,EAAD,I,yBAGV,EArDA,IA6DA,IAAA2B,SACEC,cACAC,QAAQC,MAAK,SAACC,IAGZ,IAAAC,QAAOC,SAASC,MAAMC,QAAQ,EAAQ,MAGzC,IAIY,EAAAC,cAAgB,kCAC7B,UACEC,OAAO,EAAAD,cAAe,IACtBE,UAAU,6BApBZ,WACC,OAAO,IAAIC,CACZ,G","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
+ {"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,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wB,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":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[165],{8265:(t,e,n)=>{n.d(e,{Z:()=>a});const a=' <style>.widget-qwant .widget-header{border:0}.widget-qwant .widget-body img{margin:auto}</style> <div class="widget-qwant"> <div class="widget-header"> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message"> <div class="row row-cols-1 align-items-center"> <div class="mb-12"> <a href="https://www.qwant.com" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':\'qwant\'} })"> <img src="/assets/widgets/qwant/logo-qwant.svg" width="77" height="75" alt="Qwant"> </a> </div> </div> <form method="GET" target="_blank" action="https://www.qwant.com" autocomplete="off"> <div class="row row-cols-1 align-items-center"> <label class="sr-only" for="inputQwantQ" translate content="search"></label> <div class="input-group mb-2"> <input type="text" id="inputQwantQ" class="form-control" name="q" maxlength="255" i18n-placeholder="search"/> <input type="hidden" name="l" value="fr"/> <button class="btn btn-outline-secondary" aria-labelledby="inputQwantQ" ng-click="trackEvent($event, {detail:{\'search\':\'launch\'} })"> <i class="ic-search"></i> </button> </div> </div> </form> </div> </div> </div>'},3399:function(t,e,n){var a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var i=a(n(4202)),o=n(9419),d=function(){function t(){this.restrict="E",this.template=n(8265).Z}return t.prototype.link=function(t){t.trackEvent=function(t,e){var n,a;void 0===e.bubbles&&(e.bubbles=!0);var i=null;!e||"qwant"!==(null===(n=e.detail)||void 0===n?void 0:n.open)&&"string"!=typeof(null===(a=e.detail)||void 0===a?void 0:a.search)||(i=new CustomEvent(o.TrackedActionFromWidget.qwant,e)),i&&t.currentTarget&&t.currentTarget.dispatchEvent(i)}},t}();(0,o.notif)().onLangReady().promise.then((function(t){(0,o.conf)().Platform.idiom.addKeys(n(2467))})),e.odeModuleName="odeQwantModule",i.default.module(e.odeModuleName,[]).directive("odeQwant",(function(){return new d}))},2467:t=>{t.exports=JSON.parse('{"qwant-widget.widget.title":"Qwant","qwant-junior":"QwantJunior","qwant":"Qwant"}')}}]);
1
+ "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[165],{8265:(t,e,n)=>{n.d(e,{Z:()=>a});const a=' <style>.widget-qwant .widget-header{border:0}.widget-qwant .widget-body img{margin:auto}</style> <div class="widget-qwant"> <div class="widget-header"> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message"> <div class="row row-cols-1 align-items-center"> <div class="mb-12"> <a href="https://www.qwant.com" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':\'qwant\'} })"> <img src="/assets/widgets/qwant/logo-qwant.svg" width="77" height="75" alt="Qwant"> </a> </div> </div> <form method="GET" target="_blank" action="https://www.qwant.com" autocomplete="off"> <div class="row row-cols-1 align-items-center"> <label class="sr-only" for="inputQwantQ" translate content="search"></label> <div class="input-group mb-2"> <input type="text" id="inputQwantQ" class="form-control" name="q" maxlength="255" i18n-placeholder="search"/> <input type="hidden" name="l" value="fr"/> <button class="btn btn-outline-secondary" aria-labelledby="inputQwantQ" ng-click="trackEvent($event, {detail:{\'search\':\'launch\'} })"> <i class="ic-search"></i> </button> </div> </div> </form> </div> </div> </div>'},3399:function(t,e,n){var a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var i=a(n(4202)),o=n(9419),d=function(){function t(){this.restrict="E",this.template=n(8265).Z}return t.prototype.link=function(t){t.trackEvent=function(t,e){var n,a;void 0===e.bubbles&&(e.bubbles=!0);var i=null;!e||"qwant"!==(null===(n=e.detail)||void 0===n?void 0:n.open)&&"string"!=typeof(null===(a=e.detail)||void 0===a?void 0:a.search)||(i=new CustomEvent(o.TrackedActionFromWidget.qwant,e)),i&&t.currentTarget&&t.currentTarget.dispatchEvent(i)}},t}();(0,o.notif)().onLangReady().promise.then(function(t){(0,o.conf)().Platform.idiom.addKeys(n(2467))}),e.odeModuleName="odeQwantModule",i.default.module(e.odeModuleName,[]).directive("odeQwant",function(){return new d})},2467:t=>{t.exports=JSON.parse('{"qwant-widget.widget.title":"Qwant","qwant-junior":"QwantJunior","qwant":"Qwant"}')}}]);
2
2
  //# sourceMappingURL=qwant-widget.widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widgets/qwant-widget/qwant-widget.widget.js","mappings":"gIAGA,QAFW,guC,mLCDX,iBACA,UAGA,0BACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SAiBZ,QAfC,YAAAC,KAAA,SAAKC,GAEJA,EAAMC,WAAa,SAACC,EAASC,G,aAEJ,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAEjD,IAAIC,EAAQ,MACRF,GAAuB,WAAT,QAAR,EAAAA,EAAEG,cAAM,eAAEC,OAA4C,iBAAX,QAAR,EAAAJ,EAAEG,cAAM,eAAEE,UACtDH,EAAQ,IAAII,YAAa,EAAAC,wBAAwBC,MAAOR,IAErDE,GAASH,EAAEU,eACdV,EAAEU,cAAcC,cAAcR,EAEhC,CACD,EACD,EAnBA,IA2BA,IAAAS,SAAQC,cAAcC,QAAQC,MAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,IAIa,EAAAC,cAAgB,iBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,YAd9C,WACC,OAAO,IAAIC,CACZ,G","sources":["webpack://ode-ngjs-front/./src/ts/widgets/qwant-widget/qwant-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/qwant-widget/qwant-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \" <style>.widget-qwant .widget-header{border:0}.widget-qwant .widget-body img{margin:auto}</style> <div class=\\\"widget-qwant\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\"><i class=\\\"fas fa-grip-vertical\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <div class=\\\"mb-12\\\"> <a href=\\\"https://www.qwant.com\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'qwant'} })\\\"> <img src=\\\"/assets/widgets/qwant/logo-qwant.svg\\\" width=\\\"77\\\" height=\\\"75\\\" alt=\\\"Qwant\\\"> </a> </div> </div> <form method=\\\"GET\\\" target=\\\"_blank\\\" action=\\\"https://www.qwant.com\\\" autocomplete=\\\"off\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <label class=\\\"sr-only\\\" for=\\\"inputQwantQ\\\" translate content=\\\"search\\\"></label> <div class=\\\"input-group mb-2\\\"> <input type=\\\"text\\\" id=\\\"inputQwantQ\\\" class=\\\"form-control\\\" name=\\\"q\\\" maxlength=\\\"255\\\" i18n-placeholder=\\\"search\\\"/> <input type=\\\"hidden\\\" name=\\\"l\\\" value=\\\"fr\\\"/> <button class=\\\"btn btn-outline-secondary\\\" aria-labelledby=\\\"inputQwantQ\\\" ng-click=\\\"trackEvent($event, {detail:{'search':'launch'} })\\\"> <i class=\\\"ic-search\\\"></i> </button> </div> </div> </form> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, notif, TrackedAction, TrackedScope, TrackedActionFromWidget } from \"../../utils\";\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./qwant-widget.widget.html').default;\n\n\tlink(scope:TrackedScope) {\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && (p.detail?.open==='qwant' || typeof p.detail?.search==='string') ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.qwant, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The qwant widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeQwantModule\";\nangular.module( odeModuleName, []).directive( \"odeQwant\", DirectiveFactory );\n"],"names":["restrict","template","link","scope","trackEvent","e","p","bubbles","event","detail","open","search","CustomEvent","TrackedActionFromWidget","qwant","currentTarget","dispatchEvent","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
1
+ {"version":3,"file":"widgets/qwant-widget/qwant-widget.widget.js","mappings":"gIAGA,QAFW,guC,mLCDX,iBACA,UAGA,0BACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SAiBZ,QAfC,YAAAC,KAAA,SAAKC,GAEJA,EAAMC,WAAa,SAACC,EAASC,G,aAEJ,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAEjD,IAAIC,EAAQ,MACRF,GAAuB,WAAT,QAAR,EAAAA,EAAEG,cAAM,eAAEC,OAA4C,iBAAX,QAAR,EAAAJ,EAAEG,cAAM,eAAEE,UACtDH,EAAQ,IAAII,YAAa,EAAAC,wBAAwBC,MAAOR,IAErDE,GAASH,EAAEU,eACdV,EAAEU,cAAcC,cAAcR,EAEhC,CACD,EACD,EAnBA,IA2BA,IAAAS,SAAQC,cAAcC,QAAQC,KAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,GAIa,EAAAC,cAAgB,iBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,WAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/qwant-widget/qwant-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/qwant-widget/qwant-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \" <style>.widget-qwant .widget-header{border:0}.widget-qwant .widget-body img{margin:auto}</style> <div class=\\\"widget-qwant\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\"><i class=\\\"fas fa-grip-vertical\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <div class=\\\"mb-12\\\"> <a href=\\\"https://www.qwant.com\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'qwant'} })\\\"> <img src=\\\"/assets/widgets/qwant/logo-qwant.svg\\\" width=\\\"77\\\" height=\\\"75\\\" alt=\\\"Qwant\\\"> </a> </div> </div> <form method=\\\"GET\\\" target=\\\"_blank\\\" action=\\\"https://www.qwant.com\\\" autocomplete=\\\"off\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <label class=\\\"sr-only\\\" for=\\\"inputQwantQ\\\" translate content=\\\"search\\\"></label> <div class=\\\"input-group mb-2\\\"> <input type=\\\"text\\\" id=\\\"inputQwantQ\\\" class=\\\"form-control\\\" name=\\\"q\\\" maxlength=\\\"255\\\" i18n-placeholder=\\\"search\\\"/> <input type=\\\"hidden\\\" name=\\\"l\\\" value=\\\"fr\\\"/> <button class=\\\"btn btn-outline-secondary\\\" aria-labelledby=\\\"inputQwantQ\\\" ng-click=\\\"trackEvent($event, {detail:{'search':'launch'} })\\\"> <i class=\\\"ic-search\\\"></i> </button> </div> </div> </form> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, notif, TrackedAction, TrackedScope, TrackedActionFromWidget } from \"../../utils\";\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./qwant-widget.widget.html').default;\n\n\tlink(scope:TrackedScope) {\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && (p.detail?.open==='qwant' || typeof p.detail?.search==='string') ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.qwant, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The qwant widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeQwantModule\";\nangular.module( odeModuleName, []).directive( \"odeQwant\", DirectiveFactory );\n"],"names":["restrict","template","link","scope","trackEvent","e","p","bubbles","event","detail","open","search","CustomEvent","TrackedActionFromWidget","qwant","currentTarget","dispatchEvent","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[932],{7072:(e,d,i)=>{i.d(d,{Z:()=>t});const t=' <div class="widget-record"> <div class="widget-header"> <div class="subtitle"><i18n>record-me.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body flex-wrap justify-content-center" ode-recorder dnd-nodrag></div> </div> '},1317:function(e,d,i){var t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0}),d.odeModuleName=void 0;var o=t(i(4202)),r=i(9419),s=function(){this.restrict="E",this.template=i(7072).Z};(0,r.notif)().onLangReady().promise.then((function(e){(0,r.conf)().Platform.idiom.addKeys(i(6299))})),d.odeModuleName="odeRecordMeModule",o.default.module(d.odeModuleName,[]).directive("odeRecordMe",(function(){return new s}))},6299:e=>{e.exports=JSON.parse('{"record-me.widget.title":"Le studio"}')}}]);
1
+ "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[932],{7072:(e,d,i)=>{i.d(d,{Z:()=>t});const t=' <div class="widget-record"> <div class="widget-header"> <div class="subtitle"><i18n>record-me.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body flex-wrap justify-content-center" ode-recorder dnd-nodrag></div> </div> '},1317:function(e,d,i){var t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0}),d.odeModuleName=void 0;var o=t(i(4202)),r=i(9419),s=function(){this.restrict="E",this.template=i(7072).Z};(0,r.notif)().onLangReady().promise.then(function(e){(0,r.conf)().Platform.idiom.addKeys(i(6299))}),d.odeModuleName="odeRecordMeModule",o.default.module(d.odeModuleName,[]).directive("odeRecordMe",function(){return new s})},6299:e=>{e.exports=JSON.parse('{"record-me.widget.title":"Le studio"}')}}]);
2
2
  //# sourceMappingURL=record-me.widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widgets/record-me/record-me.widget.js","mappings":"gIAGA,QAFW,0X,mLCDX,iBACA,UAGA,aACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SACZ,GAQA,IAAAC,SAAQC,cAAcC,QAAQC,MAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,IAIa,EAAAC,cAAgB,oBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,eAd9C,WACC,OAAO,IAAIC,CACZ,G","sources":["webpack://ode-ngjs-front/./src/ts/widgets/record-me/record-me.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/record-me/record-me.widget.ts"],"sourcesContent":["// Module\nvar code = \" <div class=\\\"widget-record\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>record-me.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body flex-wrap justify-content-center\\\" ode-recorder dnd-nodrag></div> </div> \";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, notif } from \"../../utils\";\n\n/* Directive */\nclass Directive implements IDirective<IScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./record-me.widget.html').default;\n}\n\n/** The my-apps widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeRecordMeModule\";\nangular.module( odeModuleName, []).directive( \"odeRecordMe\", DirectiveFactory );\n"],"names":["restrict","template","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
1
+ {"version":3,"file":"widgets/record-me/record-me.widget.js","mappings":"gIAGA,QAFW,0X,mLCDX,iBACA,UAGA,aACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SACZ,GAQA,IAAAC,SAAQC,cAAcC,QAAQC,KAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,GAIa,EAAAC,cAAgB,oBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,cAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/record-me/record-me.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/record-me/record-me.widget.ts"],"sourcesContent":["// Module\nvar code = \" <div class=\\\"widget-record\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>record-me.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body flex-wrap justify-content-center\\\" ode-recorder dnd-nodrag></div> </div> \";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, notif } from \"../../utils\";\n\n/* Directive */\nclass Directive implements IDirective<IScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./record-me.widget.html').default;\n}\n\n/** The my-apps widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeRecordMeModule\";\nangular.module( odeModuleName, []).directive( \"odeRecordMe\", DirectiveFactory );\n"],"names":["restrict","template","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[390],{4643:(e,t,i)=>{i.d(t,{Z:()=>n});const n=' <div class="widget-rss"> <div class="widget-header"> <div class="subtitle"><i18n>rss-widget.widget.title</i18n></div> <div class="widget-options"> <div class="tools"> <a href="#" class="tool tool-option" i18n-title="rss-widget.widget.channel.config" ng-if="ctrl.canAddFeed" ng-click="ctrl.display.edition = true"> <i class="fas fa-cog"></i> </a> </div> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-click="ctrl.display.edition = true" ng-if="ctrl.channel===undefined || ctrl.channel.feeds.length === 0"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class="widget-empty-message link" ng-if="ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class="rss-feed" ng-if="ctrl.feeds !== undefined" ng-repeat="feed in ctrl.feeds track by $index"> <div class="feed-title" ng-click="ctrl.showOrHideFeed($index)">[[feed.title]]</div> <ul class="list" ng-show="ctrl.display.selectedFeed === [[$index]]"> <li class="item link" ng-repeat="item in feed.Items track by $index"> <a href="[[item.link]]" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':item.link} })"> <div class="title">[[item.title]]</div> <div class="meta">[[ctrl.formatDate(item.pubDate)]]</div> <div class="meta" ng-bind-html="item.description"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible="ctrl.display.edition" on-close="ctrl.display.edition = false" dnd-nodrag> <ode-modal-title> <i18n ng-if="!ctrl.display.feedEdition">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if="ctrl.display.feedEdition">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if="!ctrl.display.feedEdition"> <p ng-if="ctrl.channel.feeds.length === 0"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class="table table-hover" ng-if="ctrl.channel.feeds.length > 0"> <thead> <tr class="bg-secondary text-light"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class="c-pointer" ng-repeat="feed in ctrl.channel.feeds track by $index" ng-class="{ \'table-active\' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }"> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click="ctrl.removeFeed($index)"> <button type="button" class="btn-close" aria-label="Close"></button> </td> </tr> </tbody> </table> </div> <form autocomplete="off" id="formFeedEdition" ng-if="ctrl.display.feedEdition"> <div class="form-group row"> <label for="inputFeedTitle" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.title.placeholder" id="inputFeedTitle" class="form-control" ng-model="ctrl.selectedFeed.title"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedUrl" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.url.placeholder" id="inputFeedUrl" class="form-control" ng-model="ctrl.selectedFeed.link"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedShow" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class="col-sm-8"> <select id="inputFeedShow" class="form-control" ng-options="n for n in ctrl.showValues" ng-model="ctrl.selectedFeed.show"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if="!ctrl.display.feedEdition && ctrl.canAddFeed"> <button class="btn btn-primary" ng-click="ctrl.openFeedEdition()" translate content="rss-widget.widget.channel.feed.add"></button> </div> <div ng-if="ctrl.display.feedEdition"> <button form="formFeedEdition" type="reset" class="btn btn-light" ng-click="ctrl.closeFeedEdition()"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form="formFeedEdition" type="submit" class="btn btn-primary" ng-click="ctrl.saveFeed()"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>'},7377:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var d=n(i(4202)),l=i(9419),s=function(){function e(){this.channel=void 0,this.feeds=[],this.totalFeeds=10,this.defaultShow=3,this.showValues=[1,2,3,4,5,6,7,8,9,10],this.display={edition:!1,feedEdition:!1,selectedFeed:0}}return e.prototype.initFeeds=function(){var e=this;return void 0===this.channel?(0,l.http)().get("/rss/channels").then((function(t){return t&&t.length>0?e.channel=t[0]:e.channel={feeds:[]},e.loadFeeds(0)})).catch((function(t){console.warn("[widget.rss] failed to initFeeds: ",t),e.channel={feeds:[]}})):this.loadFeeds(0)},e.prototype.loadFeeds=function(e){var t=this;return this.feeds=[],Promise.all(this.channel.feeds.map((function(i){var n=i.title;return null!==i.link&&""!==i.link?(0,l.http)().get("/rss/feed/items?url="+encodeURIComponent(i.link)+"&force="+e).then((function(e){"object"!=typeof e||e.title||(e.title=n),200===e.status&&t.feeds.length<t.totalFeeds&&(void 0!==e.Items&&null!=i.show&&e.Items.length>i.show&&(e.Items=e.Items.slice(0,i.show)),t.feeds.push(e))})).catch((function(e){console.warn("[widget.rss] failed to loadFeeds: ",e)})):Promise.resolve()}))).then((function(e){}))},Object.defineProperty(e.prototype,"canAddFeed",{get:function(){var e=$(window).width();return this.channel&&this.channel.feeds.length<this.totalFeeds&&("number"!=typeof e||e>=992)},enumerable:!1,configurable:!0}),e.prototype.openFeedEdition=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds?(this.selectedFeed=d.default.copy(this.channel.feeds[e]),this.selectedFeedIndex=e):(this.selectedFeed={title:"",link:"",show:3},this.selectedFeedIndex=-1),this.display.feedEdition=!0},e.prototype.closeFeedEdition=function(){this.display.feedEdition=!1,this.selectedFeed=void 0,this.selectedFeedIndex=void 0},e.prototype.removeFeed=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds&&(this.channel.feeds.splice(e,1),this.saveChannel())},e.prototype.validFeed=function(e){return e&&e.title&&""!==e.title.trim()&&e.link&&""!==e.link.trim()},e.prototype.saveFeed=function(){"number"==typeof this.selectedFeedIndex&&this.validFeed(this.selectedFeed)&&this.selectedFeed&&(this.selectedFeedIndex>=0&&this.selectedFeedIndex<this.totalFeeds?this.channel.feeds[this.selectedFeedIndex]=this.selectedFeed:this.channel.feeds.push(this.selectedFeed),this.saveChannel()),this.closeFeedEdition()},e.prototype.saveChannel=function(){this.channel._id?this.editChannel():this.createChannel()},e.prototype.createChannel=function(){var e=this;this.channel?(0,l.http)().postJson("/rss/channel",this.channel).then((function(t){e.channel._id=t._id,e.loadFeeds(0)})):console.log("createChannel : channel is undefined")},e.prototype.editChannel=function(){var e=this;this.channel&&this.channel._id?(0,l.http)().putJson("/rss/channel/"+this.channel._id,{feeds:this.channel.feeds}).then((function(t){e.loadFeeds(0)})):console.log("editChannel : channel is undefined")},e.prototype.showOrHideFeed=function(e){this.display.selectedFeed===e?this.display.selectedFeed=void 0:this.display.selectedFeed=e},e.prototype.formatDate=function(e){return("number"==typeof e?l.L10n.unix(e):l.L10n.moment(e,void 0,"en")).locale("fr").format("dddd DD MMMM YYYY HH:mm")},e}(),o=function(){function e(){this.restrict="E",this.template=i(4643).Z,this.controller=[s],this.controllerAs="ctrl",this.require=["odeRssWidget"]}return e.prototype.link=function(e,t,i,n){var d=n?n[0]:null;d&&(d.initFeeds().then((function(){e.$apply()})),e.trackEvent=function(e,t){var i;void 0===t.bubbles&&(t.bubbles=!0);var n=null;t&&"string"==typeof(null===(i=t.detail)||void 0===i?void 0:i.open)&&(n=new CustomEvent(l.TrackedActionFromWidget.rss,t)),n&&e.currentTarget&&e.currentTarget.dispatchEvent(n)})},e}();(0,l.notif)().onLangReady().promise.then((function(e){(0,l.conf)().Platform.idiom.addKeys(i(2546))})),t.odeModuleName="odeRssWidgetModule",d.default.module(t.odeModuleName,[]).directive("odeRssWidget",(function(){return new o}))},2546:e=>{e.exports=JSON.parse('{"rss-widget.widget.title":"RSS","rss-widget.widget.channel.config":"Configurer","rss-widget.widget.channel.feed.add":"Ajouter un flux","rss-widget.widget.channel.feed.cancel":"Retour","rss-widget.widget.channel.feed.edit":"Edition d\'un flux","rss-widget.widget.channel.feed.list":"Liste des flux","rss-widget.widget.channel.feed.no.result":"Aucun résultat","rss-widget.widget.channel.feed.read.more":"Voir plus","rss-widget.widget.channel.feed.remove":"Supprimer le flux","rss-widget.widget.channel.feed.save":"Enregistrer","rss-widget.widget.channel.feed.show":"Nombre d\'articles à afficher","rss-widget.widget.channel.feed.title":"Titre","rss-widget.widget.channel.feed.update":"Actualiser","rss-widget.widget.channel.feed.url":"Adresse du flux","rss-widget.widget.channel.refresh":"Rafraîchir","rss-widget.widget.channel.undefined":"Aucun flux configuré","rss-widget.widget.channel.feed.title.placeholder":"Saisissez le titre du nouveau flux RSS","rss-widget.widget.channel.feed.url.placeholder":"Saisissez l\'Url du nouveau flux RSS","rss-widget.widget.empty.info":"Ajoutez un flux RSS pour voir vos derniers articles"}')}}]);
1
+ "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[390],{4643:(e,t,i)=>{i.d(t,{Z:()=>n});const n=' <div class="widget-rss"> <div class="widget-header"> <div class="subtitle"><i18n>rss-widget.widget.title</i18n></div> <div class="widget-options"> <div class="tools"> <a href="#" class="tool tool-option" i18n-title="rss-widget.widget.channel.config" ng-if="ctrl.canAddFeed" ng-click="ctrl.display.edition = true"> <i class="fas fa-cog"></i> </a> </div> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-click="ctrl.display.edition = true" ng-if="ctrl.channel===undefined || ctrl.channel.feeds.length === 0"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class="widget-empty-message link" ng-if="ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class="rss-feed" ng-if="ctrl.feeds !== undefined" ng-repeat="feed in ctrl.feeds track by $index"> <div class="feed-title" ng-click="ctrl.showOrHideFeed($index)">[[feed.title]]</div> <ul class="list" ng-show="ctrl.display.selectedFeed === [[$index]]"> <li class="item link" ng-repeat="item in feed.Items track by $index"> <a href="[[item.link]]" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':item.link} })"> <div class="title">[[item.title]]</div> <div class="meta">[[ctrl.formatDate(item.pubDate)]]</div> <div class="meta" ng-bind-html="item.description"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible="ctrl.display.edition" on-close="ctrl.display.edition = false" dnd-nodrag> <ode-modal-title> <i18n ng-if="!ctrl.display.feedEdition">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if="ctrl.display.feedEdition">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if="!ctrl.display.feedEdition"> <p ng-if="ctrl.channel.feeds.length === 0"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class="table table-hover" ng-if="ctrl.channel.feeds.length > 0"> <thead> <tr class="bg-secondary text-light"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class="c-pointer" ng-repeat="feed in ctrl.channel.feeds track by $index" ng-class="{ \'table-active\' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }"> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click="ctrl.removeFeed($index)"> <button type="button" class="btn-close" aria-label="Close"></button> </td> </tr> </tbody> </table> </div> <form autocomplete="off" id="formFeedEdition" ng-if="ctrl.display.feedEdition"> <div class="form-group row"> <label for="inputFeedTitle" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.title.placeholder" id="inputFeedTitle" class="form-control" ng-model="ctrl.selectedFeed.title"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedUrl" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.url.placeholder" id="inputFeedUrl" class="form-control" ng-model="ctrl.selectedFeed.link"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedShow" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class="col-sm-8"> <select id="inputFeedShow" class="form-control" ng-options="n for n in ctrl.showValues" ng-model="ctrl.selectedFeed.show"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if="!ctrl.display.feedEdition && ctrl.canAddFeed"> <button class="btn btn-primary" ng-click="ctrl.openFeedEdition()" translate content="rss-widget.widget.channel.feed.add"></button> </div> <div ng-if="ctrl.display.feedEdition"> <button form="formFeedEdition" type="reset" class="btn btn-light" ng-click="ctrl.closeFeedEdition()"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form="formFeedEdition" type="submit" class="btn btn-primary" ng-click="ctrl.saveFeed()"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>'},7377:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var d=n(i(4202)),l=i(9419),s=function(){function e(){this.channel=void 0,this.feeds=[],this.totalFeeds=10,this.defaultShow=3,this.showValues=[1,2,3,4,5,6,7,8,9,10],this.display={edition:!1,feedEdition:!1,selectedFeed:0}}return e.prototype.initFeeds=function(){var e=this;return void 0===this.channel?(0,l.http)().get("/rss/channels").then(function(t){return t&&t.length>0?e.channel=t[0]:e.channel={feeds:[]},e.loadFeeds(0)}).catch(function(t){console.warn("[widget.rss] failed to initFeeds: ",t),e.channel={feeds:[]}}):this.loadFeeds(0)},e.prototype.loadFeeds=function(e){var t=this;return this.feeds=[],Promise.all(this.channel.feeds.map(function(i){var n=i.title;return null!==i.link&&""!==i.link?(0,l.http)().get("/rss/feed/items?url="+encodeURIComponent(i.link)+"&force="+e).then(function(e){"object"!=typeof e||e.title||(e.title=n),200===e.status&&t.feeds.length<t.totalFeeds&&(void 0!==e.Items&&null!=i.show&&e.Items.length>i.show&&(e.Items=e.Items.slice(0,i.show)),t.feeds.push(e))}).catch(function(e){console.warn("[widget.rss] failed to loadFeeds: ",e)}):Promise.resolve()})).then(function(e){})},Object.defineProperty(e.prototype,"canAddFeed",{get:function(){var e=$(window).width();return this.channel&&this.channel.feeds.length<this.totalFeeds&&("number"!=typeof e||e>=992)},enumerable:!1,configurable:!0}),e.prototype.openFeedEdition=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds?(this.selectedFeed=d.default.copy(this.channel.feeds[e]),this.selectedFeedIndex=e):(this.selectedFeed={title:"",link:"",show:3},this.selectedFeedIndex=-1),this.display.feedEdition=!0},e.prototype.closeFeedEdition=function(){this.display.feedEdition=!1,this.selectedFeed=void 0,this.selectedFeedIndex=void 0},e.prototype.removeFeed=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds&&(this.channel.feeds.splice(e,1),this.saveChannel())},e.prototype.validFeed=function(e){return e&&e.title&&""!==e.title.trim()&&e.link&&""!==e.link.trim()},e.prototype.saveFeed=function(){"number"==typeof this.selectedFeedIndex&&this.validFeed(this.selectedFeed)&&this.selectedFeed&&(this.selectedFeedIndex>=0&&this.selectedFeedIndex<this.totalFeeds?this.channel.feeds[this.selectedFeedIndex]=this.selectedFeed:this.channel.feeds.push(this.selectedFeed),this.saveChannel()),this.closeFeedEdition()},e.prototype.saveChannel=function(){this.channel._id?this.editChannel():this.createChannel()},e.prototype.createChannel=function(){var e=this;this.channel?(0,l.http)().postJson("/rss/channel",this.channel).then(function(t){e.channel._id=t._id,e.loadFeeds(0)}):console.log("createChannel : channel is undefined")},e.prototype.editChannel=function(){var e=this;this.channel&&this.channel._id?(0,l.http)().putJson("/rss/channel/"+this.channel._id,{feeds:this.channel.feeds}).then(function(t){e.loadFeeds(0)}):console.log("editChannel : channel is undefined")},e.prototype.showOrHideFeed=function(e){this.display.selectedFeed===e?this.display.selectedFeed=void 0:this.display.selectedFeed=e},e.prototype.formatDate=function(e){return("number"==typeof e?l.L10n.unix(e):l.L10n.moment(e,void 0,"en")).locale("fr").format("dddd DD MMMM YYYY HH:mm")},e}(),o=function(){function e(){this.restrict="E",this.template=i(4643).Z,this.controller=[s],this.controllerAs="ctrl",this.require=["odeRssWidget"]}return e.prototype.link=function(e,t,i,n){var d=n?n[0]:null;d&&(d.initFeeds().then(function(){e.$apply()}),e.trackEvent=function(e,t){var i;void 0===t.bubbles&&(t.bubbles=!0);var n=null;t&&"string"==typeof(null===(i=t.detail)||void 0===i?void 0:i.open)&&(n=new CustomEvent(l.TrackedActionFromWidget.rss,t)),n&&e.currentTarget&&e.currentTarget.dispatchEvent(n)})},e}();(0,l.notif)().onLangReady().promise.then(function(e){(0,l.conf)().Platform.idiom.addKeys(i(2546))}),t.odeModuleName="odeRssWidgetModule",d.default.module(t.odeModuleName,[]).directive("odeRssWidget",function(){return new o})},2546:e=>{e.exports=JSON.parse('{"rss-widget.widget.title":"RSS","rss-widget.widget.channel.config":"Configurer","rss-widget.widget.channel.feed.add":"Ajouter un flux","rss-widget.widget.channel.feed.cancel":"Retour","rss-widget.widget.channel.feed.edit":"Edition d\'un flux","rss-widget.widget.channel.feed.list":"Liste des flux","rss-widget.widget.channel.feed.no.result":"Aucun résultat","rss-widget.widget.channel.feed.read.more":"Voir plus","rss-widget.widget.channel.feed.remove":"Supprimer le flux","rss-widget.widget.channel.feed.save":"Enregistrer","rss-widget.widget.channel.feed.show":"Nombre d\'articles à afficher","rss-widget.widget.channel.feed.title":"Titre","rss-widget.widget.channel.feed.update":"Actualiser","rss-widget.widget.channel.feed.url":"Adresse du flux","rss-widget.widget.channel.refresh":"Rafraîchir","rss-widget.widget.channel.undefined":"Aucun flux configuré","rss-widget.widget.channel.feed.title.placeholder":"Saisissez le titre du nouveau flux RSS","rss-widget.widget.channel.feed.url.placeholder":"Saisissez l\'Url du nouveau flux RSS","rss-widget.widget.empty.info":"Ajoutez un flux RSS pour voir vos derniers articles"}')}}]);
2
2
  //# sourceMappingURL=rss-widget.widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widgets/rss-widget/rss-widget.widget.js","mappings":"gIAGA,QAFW,63I,mLCDX,iBACA,UA8BA,0BACC,KAAAA,aAAkBC,EAClB,KAAAC,MAAe,GAGf,KAAAC,WAAa,GACb,KAAAC,YAAc,EACd,KAAAC,WAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAChC,KAAAC,QAII,CACHC,SAAS,EACTC,aAAa,EACbC,aAAc,EAgJhB,QA7IC,YAAAC,UAAA,sBACC,YAAoBT,IAAjBU,KAAKX,SACA,IAAAY,QAAOC,IAAe,iBAC5BC,MAAM,SAAAC,GAMN,OALGA,GAAYA,EAASC,OAAS,EAChC,EAAKhB,QAAUe,EAAS,GAExB,EAAKf,QAAU,CAACE,MAAM,IAEhB,EAAKe,UAAU,EACvB,IACCC,OAAO,SAAAC,GACPC,QAAQC,KAAK,qCAAsCF,GACnD,EAAKnB,QAAU,CAACE,MAAM,GACvB,IAEOS,KAAKM,UAAU,EAExB,EAEQ,YAAAA,UAAR,SAAmBK,GAAnB,WAEC,OADAX,KAAKT,MAA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AAAC,KAAKC,KAAKF,GAEV,EAAAC,KAAKE,OAAOH,OAAM9D,EAAW,OAEzBkE,OAAO,MAAMC,OAAO,0BACvC,EACD,EA/JA,GAkKA,0BACI,KAAAC,SAAW,IACd,KAAAC,SAAW,UACX,KAAAC,WAAa,CAACC,GACd,KAAAC,aAAe,OACZ,KAAAC,QAAU,CAAC,eAyBf,QAvBI,YAAA7C,KAAA,SAAK8C,EAAoBC,EAAaC,EAAmBC,GACrD,IAAMC,EAAuBD,EAAcA,EAAY,GAAmB,KAC1EC,IAGNA,EAAKrE,YAAYI,MAAM,WACtB6D,EAAMK,QACP,IAGAL,EAAMM,WAAa,SAAC9D,EAAS+D,G,WAEJ,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAEjD,IAAIC,EAAQ,KACRF,GAA6B,iBAAT,QAAR,EAAAA,EAAEG,cAAM,eAAEC,QACzBF,EAAQ,IAAIG,YAAa,EAAAC,wBAAwBC,IAAKP,IAEnDE,GAASjE,EAAEuE,eACdvE,EAAEuE,cAAcC,cAAcP,EAEhC,EACD,EACD,EA9BA,IAsCA,IAAAQ,SAAQC,cAAcC,QAAQhF,MAAM,SAAAiF,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,IAIa,EAAAC,cAAgB,qBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,gBAd9C,WACC,OAAO,IAAIC,CACZ,G","sources":["webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \" <div class=\\\"widget-rss\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>rss-widget.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"tools\\\"> <a href=\\\"#\\\" class=\\\"tool tool-option\\\" i18n-title=\\\"rss-widget.widget.channel.config\\\" ng-if=\\\"ctrl.canAddFeed\\\" ng-click=\\\"ctrl.display.edition = true\\\"> <i class=\\\"fas fa-cog\\\"></i> </a> </div> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message link\\\" ng-click=\\\"ctrl.display.edition = true\\\" ng-if=\\\"ctrl.channel===undefined || ctrl.channel.feeds.length === 0\\\"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class=\\\"widget-empty-message link\\\" ng-if=\\\"ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0\\\"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class=\\\"rss-feed\\\" ng-if=\\\"ctrl.feeds !== undefined\\\" ng-repeat=\\\"feed in ctrl.feeds track by $index\\\"> <div class=\\\"feed-title\\\" ng-click=\\\"ctrl.showOrHideFeed($index)\\\">[[feed.title]]</div> <ul class=\\\"list\\\" ng-show=\\\"ctrl.display.selectedFeed === [[$index]]\\\"> <li class=\\\"item link\\\" ng-repeat=\\\"item in feed.Items track by $index\\\"> <a href=\\\"[[item.link]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':item.link} })\\\"> <div class=\\\"title\\\">[[item.title]]</div> <div class=\\\"meta\\\">[[ctrl.formatDate(item.pubDate)]]</div> <div class=\\\"meta\\\" ng-bind-html=\\\"item.description\\\"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible=\\\"ctrl.display.edition\\\" on-close=\\\"ctrl.display.edition = false\\\" dnd-nodrag> <ode-modal-title> <i18n ng-if=\\\"!ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if=\\\"ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if=\\\"!ctrl.display.feedEdition\\\"> <p ng-if=\\\"ctrl.channel.feeds.length === 0\\\"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class=\\\"table table-hover\\\" ng-if=\\\"ctrl.channel.feeds.length > 0\\\"> <thead> <tr class=\\\"bg-secondary text-light\\\"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class=\\\"c-pointer\\\" ng-repeat=\\\"feed in ctrl.channel.feeds track by $index\\\" ng-class=\\\"{ 'table-active' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }\\\"> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click=\\\"ctrl.removeFeed($index)\\\"> <button type=\\\"button\\\" class=\\\"btn-close\\\" aria-label=\\\"Close\\\"></button> </td> </tr> </tbody> </table> </div> <form autocomplete=\\\"off\\\" id=\\\"formFeedEdition\\\" ng-if=\\\"ctrl.display.feedEdition\\\"> <div class=\\\"form-group row\\\"> <label for=\\\"inputFeedTitle\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.title.placeholder\\\" id=\\\"inputFeedTitle\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.title\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedUrl\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.url.placeholder\\\" id=\\\"inputFeedUrl\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.link\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedShow\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class=\\\"col-sm-8\\\"> <select id=\\\"inputFeedShow\\\" class=\\\"form-control\\\" ng-options=\\\"n for n in ctrl.showValues\\\" ng-model=\\\"ctrl.selectedFeed.show\\\"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if=\\\"!ctrl.display.feedEdition && ctrl.canAddFeed\\\"> <button class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.openFeedEdition()\\\" translate content=\\\"rss-widget.widget.channel.feed.add\\\"></button> </div> <div ng-if=\\\"ctrl.display.feedEdition\\\"> <button form=\\\"formFeedEdition\\\" type=\\\"reset\\\" class=\\\"btn btn-light\\\" ng-click=\\\"ctrl.closeFeedEdition()\\\"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form=\\\"formFeedEdition\\\" type=\\\"submit\\\" class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.saveFeed()\\\"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { L10n, conf, notif, http, TrackedAction, TrackedScope, TrackedActionFromWidget } from \"../../utils\";\n\ntype Feed = {title:string, link:string, show?:number};\ntype Channel = {\n\t_id?:string;\n\tfeeds: Array<Feed>;\n\towner?: {\n\t userId: string;\n\t displayName: string;\n\t};\n\tcreated?: {\n\t \"$date\": number\n\t};\n\tmodified?: {\n\t \"$date\": number\n\t};\n}\ntype RssContent = {\n\ttitle: string;\n\tlink: string;\n\tdescription: string;\n\tpubDate: string;\n}\ntype FeedContent = RssContent & {\n\tlanguage: string;\n\tItems: Array<RssContent>;\n\tstatus: number;\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tchannel:Channel = undefined as unknown as Channel;\n\tfeeds:Feed[] = [];\n\tselectedFeed?:Feed;\n\tselectedFeedIndex?:number;\n\ttotalFeeds = 10; // limit of feeds\n\tdefaultShow = 3; // limit of article by feeds\n\tshowValues = [1,2,3,4,5,6,7,8,9,10];\n\tdisplay:{\n\t\tedition:boolean;\n\t\tfeedEdition:boolean;\n\t\tselectedFeed?:number;\n\t} = {\n\t\tedition: false,\n\t\tfeedEdition: false,\n\t\tselectedFeed: 0\n\t};\n\n\tinitFeeds():Promise<void> {\n\t\tif(this.channel === undefined){\n\t\t\treturn http().get<Channel[]>('/rss/channels')\n\t\t\t.then( channels => {\n\t\t\t\tif(channels && channels.length > 0) {\n\t\t\t\t\tthis.channel = channels[0];\n\t\t\t\t} else {\n\t\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t\t}\n\t\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t\t})\n\t\t\t.catch( e => {\n\t\t\t\tconsole.warn(\"[widget.rss] failed to initFeeds: \", e)\n\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t});\n\t\t} else {\n\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t}\n\t}\n\n\tprivate loadFeeds( force:number ):Promise<void> {\n\t\tthis.feeds = [];\n\t\treturn Promise.all( this.channel.feeds.map( feed => {\n\t\t\tconst mytitle = feed.title;\n\t\t\tif(feed.link !== null && feed.link !== \"\"){\n\t\t\t\treturn http().get<FeedContent>('/rss/feed/items?url=' + encodeURIComponent(feed.link) + '&force=' + force)\n\t\t\t\t.then( result => {\n\t\t\t\t\tif(typeof result===\"object\" && !result.title) result.title = mytitle;\n\t\t\t\t\tif(result.status===200 && this.feeds.length < this.totalFeeds){\n\t\t\t\t\t\tif(result.Items !== undefined && feed.show != undefined && result.Items.length > feed.show){\n\t\t\t\t\t\t\tresult.Items = result.Items.slice(0, feed.show);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.feeds.push(result);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch( e => {\n\t\t\t\t\tconsole.warn(\"[widget.rss] failed to loadFeeds: \", e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn Promise.resolve();\n\t\t\t}\n\t\t}))\n\t\t.then( results => {} );\n\t};\n\n\tpublic get canAddFeed():boolean {\n\t\tconst ww = $(window).width();\n\t\treturn (this.channel && this.channel.feeds.length < this.totalFeeds) && (typeof ww!==\"number\" || ww >= 992);\n\t}\n\t\n\topenFeedEdition(index:number) {\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.selectedFeed = angular.copy(this.channel.feeds[index]);\n\t\t\tthis.selectedFeedIndex = index;\n\t\t}else{\n\t\t\tthis.selectedFeed = {title:\"\", link:\"\", show:3};\n\t\t\tthis.selectedFeedIndex = -1;\n\t\t}\n\t\tthis.display.feedEdition = true;\n\t}\n\t\n\tcloseFeedEdition() {\n\t\tthis.display.feedEdition = false;\n\t\tthis.selectedFeed = undefined;\n\t\tthis.selectedFeedIndex = undefined;\n\t}\n\t\n\tremoveFeed(index:number){\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.channel.feeds.splice(index, 1);\n\t\t\tthis.saveChannel();\n\t\t}\n\t}\n\n\tvalidFeed( feed?:Feed ){\n\t\treturn (feed && feed.title && feed.title.trim()!==\"\" && feed.link && feed.link.trim()!==\"\");\n\t}\n\t\n\tsaveFeed(){\n\t\tif(typeof this.selectedFeedIndex===\"number\" && this.validFeed(this.selectedFeed)){\n\t\t\tif( this.selectedFeed ) {\n\t\t\t\tif(this.selectedFeedIndex >= 0 && this.selectedFeedIndex < this.totalFeeds){\n\t\t\t\t\tthis.channel.feeds[this.selectedFeedIndex] = this.selectedFeed;\n\t\t\t\t}else{\n\t\t\t\t\tthis.channel.feeds.push(this.selectedFeed);\n\t\t\t\t}\n\t\t\t\tthis.saveChannel();\n\t\t\t}\n\t\t}\n\t\tthis.closeFeedEdition();\n\t}\n\n\tsaveChannel(){\n\t\tif(this.channel._id) {\n\t\t\tthis.editChannel();\n\t\t}\n\t\telse{\n\t\t\tthis.createChannel();\n\t\t}\n\t}\n\n\tcreateChannel() {\n\t\tif(this.channel){\n\t\t\thttp().postJson('/rss/channel', this.channel)\n\t\t\t.then( response => {\n\t\t\t\tthis.channel._id = response._id;\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"createChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\teditChannel() {\n\t\tif(this.channel && this.channel._id){\n\t\t\thttp().putJson('/rss/channel/' + this.channel._id, {feeds: this.channel.feeds})\n\t\t\t.then( response => {\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"editChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\tshowOrHideFeed( index:number ){\n\t\tif(this.display.selectedFeed === index){\n\t\t\tthis.display.selectedFeed = undefined;\n\t\t} else {\n\t\t\tthis.display.selectedFeed = index;\n\t\t}\n\t}\n\t\n\tformatDate( date:any ){\n\t\tvar momentDate;\n\t\tif (typeof date === \"number\"){\n\t\t\tmomentDate = L10n.unix(date);\n\t\t} else {\n\t\t\tmomentDate = L10n.moment(date, undefined, 'en');\n\t\t}\n\t\treturn momentDate.locale('fr').format('dddd DD MMMM YYYY HH:mm');\n\t};\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./rss-widget.widget.html').default;\n\tcontroller = [Controller];\n\tcontrollerAs = 'ctrl';\n require = ['odeRssWidget'];\n\n link(scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]): void {\n const ctrl:Controller|null = controllers ? controllers[0] as Controller : null;\n\t\tif( ! ctrl ) return;\n\n\t\t// init channel & feeds\n\t\tctrl.initFeeds().then( () => {\n\t\t\tscope.$apply();\n\t\t});\n\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && typeof p.detail?.open==='string' ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.rss, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The rss-widget widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeRssWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeRssWidget\", DirectiveFactory );\n"],"names":["channel","undefined","feeds","totalFeeds","defaultShow","showValues","display","edition","feedEdition","selectedFeed","initFeeds","this","http","get","then","channels","length","loadFeeds","catch","e","console","warn","force","Promise","all","map","feed","mytitle","title","link","encodeURIComponent","result","status","Items","show","slice","push","resolve","results","ww","$","window","width","openFeedEdition","index","copy","selectedFeedIndex","closeFeedEdition","removeFeed","splice","saveChannel","validFeed","trim","saveFeed","_id","editChannel","createChannel","postJson","response","log","putJson","showOrHideFeed","formatDate","date","L10n","unix","moment","locale","format","restrict","template","controller","Controller","controllerAs","require","scope","elem","attrs","controllers","ctrl","$apply","trackEvent","p","bubbles","event","detail","open","CustomEvent","TrackedActionFromWidget","rss","currentTarget","dispatchEvent","notif","onLangReady","promise","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
1
+ {"version":3,"file":"widgets/rss-widget/rss-widget.widget.js","mappings":"gIAGA,QAFW,63I,mLCDX,iBACA,UA8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vE,EAAEuE,cAAcC,cAAcP,EAEhC,EACD,EACD,EA9BA,IAsCA,IAAAQ,SAAQC,cAAcC,QAAQhF,KAAM,SAAAiF,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,GAIa,EAAAC,cAAgB,qBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,eAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \" <div class=\\\"widget-rss\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>rss-widget.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"tools\\\"> <a href=\\\"#\\\" class=\\\"tool tool-option\\\" i18n-title=\\\"rss-widget.widget.channel.config\\\" ng-if=\\\"ctrl.canAddFeed\\\" ng-click=\\\"ctrl.display.edition = true\\\"> <i class=\\\"fas fa-cog\\\"></i> </a> </div> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message link\\\" ng-click=\\\"ctrl.display.edition = true\\\" ng-if=\\\"ctrl.channel===undefined || ctrl.channel.feeds.length === 0\\\"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class=\\\"widget-empty-message link\\\" ng-if=\\\"ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0\\\"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class=\\\"rss-feed\\\" ng-if=\\\"ctrl.feeds !== undefined\\\" ng-repeat=\\\"feed in ctrl.feeds track by $index\\\"> <div class=\\\"feed-title\\\" ng-click=\\\"ctrl.showOrHideFeed($index)\\\">[[feed.title]]</div> <ul class=\\\"list\\\" ng-show=\\\"ctrl.display.selectedFeed === [[$index]]\\\"> <li class=\\\"item link\\\" ng-repeat=\\\"item in feed.Items track by $index\\\"> <a href=\\\"[[item.link]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':item.link} })\\\"> <div class=\\\"title\\\">[[item.title]]</div> <div class=\\\"meta\\\">[[ctrl.formatDate(item.pubDate)]]</div> <div class=\\\"meta\\\" ng-bind-html=\\\"item.description\\\"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible=\\\"ctrl.display.edition\\\" on-close=\\\"ctrl.display.edition = false\\\" dnd-nodrag> <ode-modal-title> <i18n ng-if=\\\"!ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if=\\\"ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if=\\\"!ctrl.display.feedEdition\\\"> <p ng-if=\\\"ctrl.channel.feeds.length === 0\\\"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class=\\\"table table-hover\\\" ng-if=\\\"ctrl.channel.feeds.length > 0\\\"> <thead> <tr class=\\\"bg-secondary text-light\\\"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class=\\\"c-pointer\\\" ng-repeat=\\\"feed in ctrl.channel.feeds track by $index\\\" ng-class=\\\"{ 'table-active' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }\\\"> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click=\\\"ctrl.removeFeed($index)\\\"> <button type=\\\"button\\\" class=\\\"btn-close\\\" aria-label=\\\"Close\\\"></button> </td> </tr> </tbody> </table> </div> <form autocomplete=\\\"off\\\" id=\\\"formFeedEdition\\\" ng-if=\\\"ctrl.display.feedEdition\\\"> <div class=\\\"form-group row\\\"> <label for=\\\"inputFeedTitle\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.title.placeholder\\\" id=\\\"inputFeedTitle\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.title\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedUrl\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.url.placeholder\\\" id=\\\"inputFeedUrl\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.link\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedShow\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class=\\\"col-sm-8\\\"> <select id=\\\"inputFeedShow\\\" class=\\\"form-control\\\" ng-options=\\\"n for n in ctrl.showValues\\\" ng-model=\\\"ctrl.selectedFeed.show\\\"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if=\\\"!ctrl.display.feedEdition && ctrl.canAddFeed\\\"> <button class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.openFeedEdition()\\\" translate content=\\\"rss-widget.widget.channel.feed.add\\\"></button> </div> <div ng-if=\\\"ctrl.display.feedEdition\\\"> <button form=\\\"formFeedEdition\\\" type=\\\"reset\\\" class=\\\"btn btn-light\\\" ng-click=\\\"ctrl.closeFeedEdition()\\\"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form=\\\"formFeedEdition\\\" type=\\\"submit\\\" class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.saveFeed()\\\"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { L10n, conf, notif, http, TrackedAction, TrackedScope, TrackedActionFromWidget } from \"../../utils\";\n\ntype Feed = {title:string, link:string, show?:number};\ntype Channel = {\n\t_id?:string;\n\tfeeds: Array<Feed>;\n\towner?: {\n\t userId: string;\n\t displayName: string;\n\t};\n\tcreated?: {\n\t \"$date\": number\n\t};\n\tmodified?: {\n\t \"$date\": number\n\t};\n}\ntype RssContent = {\n\ttitle: string;\n\tlink: string;\n\tdescription: string;\n\tpubDate: string;\n}\ntype FeedContent = RssContent & {\n\tlanguage: string;\n\tItems: Array<RssContent>;\n\tstatus: number;\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tchannel:Channel = undefined as unknown as Channel;\n\tfeeds:Feed[] = [];\n\tselectedFeed?:Feed;\n\tselectedFeedIndex?:number;\n\ttotalFeeds = 10; // limit of feeds\n\tdefaultShow = 3; // limit of article by feeds\n\tshowValues = [1,2,3,4,5,6,7,8,9,10];\n\tdisplay:{\n\t\tedition:boolean;\n\t\tfeedEdition:boolean;\n\t\tselectedFeed?:number;\n\t} = {\n\t\tedition: false,\n\t\tfeedEdition: false,\n\t\tselectedFeed: 0\n\t};\n\n\tinitFeeds():Promise<void> {\n\t\tif(this.channel === undefined){\n\t\t\treturn http().get<Channel[]>('/rss/channels')\n\t\t\t.then( channels => {\n\t\t\t\tif(channels && channels.length > 0) {\n\t\t\t\t\tthis.channel = channels[0];\n\t\t\t\t} else {\n\t\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t\t}\n\t\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t\t})\n\t\t\t.catch( e => {\n\t\t\t\tconsole.warn(\"[widget.rss] failed to initFeeds: \", e)\n\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t});\n\t\t} else {\n\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t}\n\t}\n\n\tprivate loadFeeds( force:number ):Promise<void> {\n\t\tthis.feeds = [];\n\t\treturn Promise.all( this.channel.feeds.map( feed => {\n\t\t\tconst mytitle = feed.title;\n\t\t\tif(feed.link !== null && feed.link !== \"\"){\n\t\t\t\treturn http().get<FeedContent>('/rss/feed/items?url=' + encodeURIComponent(feed.link) + '&force=' + force)\n\t\t\t\t.then( result => {\n\t\t\t\t\tif(typeof result===\"object\" && !result.title) result.title = mytitle;\n\t\t\t\t\tif(result.status===200 && this.feeds.length < this.totalFeeds){\n\t\t\t\t\t\tif(result.Items !== undefined && feed.show != undefined && result.Items.length > feed.show){\n\t\t\t\t\t\t\tresult.Items = result.Items.slice(0, feed.show);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.feeds.push(result);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch( e => {\n\t\t\t\t\tconsole.warn(\"[widget.rss] failed to loadFeeds: \", e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn Promise.resolve();\n\t\t\t}\n\t\t}))\n\t\t.then( results => {} );\n\t};\n\n\tpublic get canAddFeed():boolean {\n\t\tconst ww = $(window).width();\n\t\treturn (this.channel && this.channel.feeds.length < this.totalFeeds) && (typeof ww!==\"number\" || ww >= 992);\n\t}\n\t\n\topenFeedEdition(index:number) {\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.selectedFeed = angular.copy(this.channel.feeds[index]);\n\t\t\tthis.selectedFeedIndex = index;\n\t\t}else{\n\t\t\tthis.selectedFeed = {title:\"\", link:\"\", show:3};\n\t\t\tthis.selectedFeedIndex = -1;\n\t\t}\n\t\tthis.display.feedEdition = true;\n\t}\n\t\n\tcloseFeedEdition() {\n\t\tthis.display.feedEdition = false;\n\t\tthis.selectedFeed = undefined;\n\t\tthis.selectedFeedIndex = undefined;\n\t}\n\t\n\tremoveFeed(index:number){\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.channel.feeds.splice(index, 1);\n\t\t\tthis.saveChannel();\n\t\t}\n\t}\n\n\tvalidFeed( feed?:Feed ){\n\t\treturn (feed && feed.title && feed.title.trim()!==\"\" && feed.link && feed.link.trim()!==\"\");\n\t}\n\t\n\tsaveFeed(){\n\t\tif(typeof this.selectedFeedIndex===\"number\" && this.validFeed(this.selectedFeed)){\n\t\t\tif( this.selectedFeed ) {\n\t\t\t\tif(this.selectedFeedIndex >= 0 && this.selectedFeedIndex < this.totalFeeds){\n\t\t\t\t\tthis.channel.feeds[this.selectedFeedIndex] = this.selectedFeed;\n\t\t\t\t}else{\n\t\t\t\t\tthis.channel.feeds.push(this.selectedFeed);\n\t\t\t\t}\n\t\t\t\tthis.saveChannel();\n\t\t\t}\n\t\t}\n\t\tthis.closeFeedEdition();\n\t}\n\n\tsaveChannel(){\n\t\tif(this.channel._id) {\n\t\t\tthis.editChannel();\n\t\t}\n\t\telse{\n\t\t\tthis.createChannel();\n\t\t}\n\t}\n\n\tcreateChannel() {\n\t\tif(this.channel){\n\t\t\thttp().postJson('/rss/channel', this.channel)\n\t\t\t.then( response => {\n\t\t\t\tthis.channel._id = response._id;\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"createChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\teditChannel() {\n\t\tif(this.channel && this.channel._id){\n\t\t\thttp().putJson('/rss/channel/' + this.channel._id, {feeds: this.channel.feeds})\n\t\t\t.then( response => {\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"editChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\tshowOrHideFeed( index:number ){\n\t\tif(this.display.selectedFeed === index){\n\t\t\tthis.display.selectedFeed = undefined;\n\t\t} else {\n\t\t\tthis.display.selectedFeed = index;\n\t\t}\n\t}\n\t\n\tformatDate( date:any ){\n\t\tvar momentDate;\n\t\tif (typeof date === \"number\"){\n\t\t\tmomentDate = L10n.unix(date);\n\t\t} else {\n\t\t\tmomentDate = L10n.moment(date, undefined, 'en');\n\t\t}\n\t\treturn momentDate.locale('fr').format('dddd DD MMMM YYYY HH:mm');\n\t};\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./rss-widget.widget.html').default;\n\tcontroller = [Controller];\n\tcontrollerAs = 'ctrl';\n require = ['odeRssWidget'];\n\n link(scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]): void {\n const ctrl:Controller|null = controllers ? controllers[0] as Controller : null;\n\t\tif( ! ctrl ) return;\n\n\t\t// init channel & feeds\n\t\tctrl.initFeeds().then( () => {\n\t\t\tscope.$apply();\n\t\t});\n\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && typeof p.detail?.open==='string' ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.rss, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The rss-widget widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeRssWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeRssWidget\", DirectiveFactory );\n"],"names":["channel","undefined","feeds","totalFeeds","defaultShow","showValues","display","edition","feedEdition","selectedFeed","initFeeds","this","http","get","then","channels","length","loadFeeds","catch","e","console","warn","force","Promise","all","map","feed","mytitle","title","link","encodeURIComponent","result","status","Items","show","slice","push","resolve","results","ww","$","window","width","openFeedEdition","index","copy","selectedFeedIndex","closeFeedEdition","removeFeed","splice","saveChannel","validFeed","trim","saveFeed","_id","editChannel","createChannel","postJson","response","log","putJson","showOrHideFeed","formatDate","date","L10n","unix","moment","locale","format","restrict","template","controller","Controller","controllerAs","require","scope","elem","attrs","controllers","ctrl","$apply","trackEvent","p","bubbles","event","detail","open","CustomEvent","TrackedActionFromWidget","rss","currentTarget","dispatchEvent","notif","onLangReady","promise","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[306],{4257:(e,t,n)=>{n.d(t,{Z:()=>o});const o='<div class="widget-school"> <div class="widget-body"> <div class="widget-school-header" ng-style="ctrl.getWidgetStyle()"> <div class="d-flex align-items-center"> <div class="me-16"> <a href="/userbook/mon-compte" class="avatar-link" i18n-title="navbar.myaccount" ng-click="trackEvent($event, {detail:{\'open\':\'profile\'} })"> <img data-ng-src="[[ctrl.avatar ? ctrl.avatar+\'?thumbnail=48x48\' : \'\']]" alt="{{ctrl.description.displayName}}"/> </a> </div> <div class="flex-grow-1"> <div class="name">{{ctrl.description.displayName}}</div> <div ng-if="!ctrl.hasManySchools" class="school">{{ctrl.selectedSchool.name}}</div> <div ng-if="ctrl.hasManySchools" class="dropdown"> <div class="school-multiple dropdown-toggle" role="button" id="ddSchoolWidgetSchool" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a href="" class="text-white">{{ctrl.selectedSchool.name}}</a> </div> <div class="school-choice dropdown-menu" aria-labelledby="ddSchoolWidgetSchool"> <div tabindex="0" role="button" class="dropdown-item" ng-repeat="school in ctrl.description.schools" ng-click="ctrl.onSchoolSelected($index)" ng-keydown="ctrl.onSchoolSelected($index, $event)"> {{school.name}} </div> </div> </div> </div> </div> </div> <div class="btn-group"> <a href="/userbook/annuaire#/search" class="btn btn-secondary rounded-pill" ng-if="ctrl.isStudent" ng-click="trackEvent($event, {detail:{\'open\':\'student.class\'} })" translate content="school-widget.widget.my.classroom"></a> <a ng-href="{{ctrl.getUrlTeachersOfMyClass()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isStudent" ng-click="trackEvent($event, {detail:{\'open\':\'student.teachers\'} })" translate content="school-widget.widget.my.team"></a> <a ng-href="{{ctrl.getUrlStudentsOfMyClasses()}}" class="btn btn-secondary rounded-pill" ng-if="ctrl.isTeacher" ng-click="trackEvent($event, {detail:{\'open\':\'teacher.students\'} })" translate content="school-widget.widget.my.classrooms"></a> <a ng-href="{{ctrl.getUrlSchoolTeachers()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isTeacher" ng-click="trackEvent($event, {detail:{\'open\':\'teacher.teachers\'} })" translate content="school-widget.widget.school.team"></a> <a ng-href="{{ctrl.getUrlTeachersOfMyChildren()}}" class="btn btn-secondary rounded-pill" ng-if="ctrl.isRelative" ng-click="trackEvent($event, {detail:{\'open\':\'relative.teachers\'} })" translate content="school-widget.widget.school.team"></a> <a ng-href="{{ctrl.getUrlSchoolPersonnels()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isRelative" ng-click="trackEvent($event, {detail:{\'open\':\'relative.direction\'} })" translate content="school-widget.widget.school.managers"></a> <a ng-href="{{ctrl.getUrlSchoolPersonnelsAndTeachers()}}" class="btn btn-secondary rounded-pill" ng-if="ctrl.isPersonnel" ng-click="trackEvent($event, {detail:{\'open\':\'personnel.personnels\'} })" translate content="school-widget.widget.school.personnelAndTeachers"></a> <a ng-href="{{ctrl.getUrlStudents()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isPersonnel" ng-click="trackEvent($event, {detail:{\'open\':\'personnel.students\'} })" translate content="school-widget.widget.students"></a> </div> </div> </div> '},5623:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,s){function l(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,i)}c((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,s,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,o=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(r=l.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){l=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){l.label=s[1];break}if(6===s[0]&&l.label<r[1]){l.label=r[1],r=s;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(s);break}r[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var l=s(n(4202)),i=n(5262),c=n(9419),a=function(){function e(e){this.themeHelperSvc=e}return Object.defineProperty(e.prototype,"me",{get:function(){return(0,c.session)().user},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"description",{get:function(){return(0,c.session)().description},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"avatar",{get:function(){return(0,c.session)().avatarUrl},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){var e,t;return o(this,void 0,void 0,(function(){var n,o,s=this;return r(this,(function(r){switch(r.label){case 0:return this._userPref=null===(e=i.WidgetFrameworkFactory.instance().list.find((function(e){return e.platformConf.name===i.WIDGET_NAME.SCHOOL})))||void 0===e?void 0:e.userPref,n=this,[4,this.themeHelperSvc.getBootstrapThemePath()];case 1:return n.themePath=r.sent(),[4,(0,c.notif)().onSessionReady().promise];case 2:return r.sent(),o=0,(null===(t=this._userPref)||void 0===t?void 0:t.schoolId)&&l.default.isArray(this.description.schools)&&(o=this.description.schools.findIndex((function(e){var t;return e.id===(null===(t=s._userPref)||void 0===t?void 0:t.schoolId)})),o<0&&(o=0)),this.setSelectedSchool(o),[2]}}))}))},e.prototype.getWidgetStyle=function(){return{"background-image":"url("+this.themePath+"/images/widget-3.png)"}},e.prototype.onSchoolSelected=function(e,t){var n;return(!t||"keydown"===t.type&&(13===t.which||32===t.which))&&(this._userPref&&this.setSelectedSchool(e)&&(this._userPref.schoolId=null===(n=this.selectedSchool)||void 0===n?void 0:n.id,i.WidgetFrameworkFactory.instance().saveUserPrefs()),!0)},e.prototype.setSelectedSchool=function(e){return 0<=e&&e<this.description.schools.length&&this.selectedSchool!==this.description.schools[e]&&(this.selectedSchool=this.description.schools[e],!0)},e.prototype.getDefaultUrl=function(){return"/userbook/annuaire#/search"},e.prototype.getUrlTeachersOfMyClass=function(){var e=this.getDefaultUrl();if(this.me.classes&&this.me.classes.length>0){e+="?filters=groups&profile=Teacher";for(var t=0,n=this.me.classes;t<n.length;t++){e+="&class="+n[t]}}return e},e.prototype.getUrlStudentsOfMyClasses=function(){var e=this.getDefaultUrl()+"?filters=groups&profile=Student";this.selectedSchool&&(e+="&structure="+this.selectedSchool.id);for(var t=0,n=this.me.classes;t<n.length;t++){e+="&class="+n[t]}return e},e.prototype.getUrlSchoolTeachers=function(){return this.selectedSchool?"/userbook/annuaire#/search?filters=groups&structure="+this.selectedSchool.id+"&profile=Teacher":this.getDefaultUrl()},e.prototype.getUrlTeachersOfMyChildren=function(){for(var e=this.getDefaultUrl()+"?filters=groups&profile=Teacher",t=0,n=this.me.classes;t<n.length;t++){e+="&class="+n[t]}return e},e.prototype.getUrlSchoolPersonnels=function(){return this.selectedSchool?"/userbook/annuaire#/search?filters=users&structure="+this.selectedSchool.id+"&profile=Personnel":this.getDefaultUrl()},e.prototype.getUrlSchoolPersonnelsAndTeachers=function(){return this.selectedSchool?"/userbook/annuaire#/search?filters=users&structure="+this.selectedSchool.id+"&profile=Personnel&profile=Teacher":this.getDefaultUrl()},e.prototype.getUrlStudents=function(){var e=this.getDefaultUrl()+"?filters=groups&profile=Student";return this.selectedSchool&&(e+="&structure="+this.selectedSchool.id),e},Object.defineProperty(e.prototype,"hasManySchools",{get:function(){return this.description.schools.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStudent",{get:function(){return"ELEVE"===this.me.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isTeacher",{get:function(){return"ENSEIGNANT"===this.me.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRelative",{get:function(){return"PERSRELELEVE"===this.me.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPersonnel",{get:function(){return"PERSEDUCNAT"===this.me.type},enumerable:!1,configurable:!0}),e}(),d=function(){function e(){this.restrict="E",this.template=n(4257).Z,this.controller=["odeThemeHelperService",a],this.controllerAs="ctrl",this.require=["odeSchoolWidget"]}return e.prototype.link=function(e,t,n,s){return o(this,void 0,void 0,(function(){var t;return r(this,(function(n){switch(n.label){case 0:return(t=s?s[0]:null)?[4,t.initialize()]:[2];case 1:return n.sent(),e.$apply(),e.trackEvent=function(e,t){var n;void 0===t.bubbles&&(t.bubbles=!0);var o=null;(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.open)&&-1!==["student.class","student.teachers","teacher.students","teacher.teachers","relative.teachers","relative.direction","profile"].indexOf(t.detail.open)&&(o=new CustomEvent(c.TrackedActionFromWidget.school,t)),o&&e.currentTarget&&e.currentTarget.dispatchEvent(o)},[2]}}))}))},e}();(0,c.notif)().onLangReady().promise.then((function(e){(0,c.conf)().Platform.idiom.addKeys(n(3926))})),t.odeModuleName="odeSchoolWidgetModule",l.default.module(t.odeModuleName,[]).directive("odeSchoolWidget",(function(){return new d}))},3926:e=>{e.exports=JSON.parse('{"school-widget.widget.my.classroom":"Ma classe","school-widget.widget.my.classrooms":"Mes classes","school-widget.widget.my.team":"Mes enseignants","school-widget.widget.school.team":"Équipe enseignante","school-widget.widget.school.managers":"Personnels","school-widget.widget.school.personnelAndTeachers":"Personnels et Enseignants","school-widget.widget.students":"Élèves","school-widget":"Mon réseau"}')}}]);
1
+ "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[306],{4257:(e,t,n)=>{n.d(t,{Z:()=>o});const o='<div class="widget-school"> <div class="widget-body"> <div class="widget-school-header" ng-style="ctrl.getWidgetStyle()"> <div class="d-flex align-items-center"> <div class="me-16"> <a href="/userbook/mon-compte" class="avatar-link" i18n-title="navbar.myaccount" ng-click="trackEvent($event, {detail:{\'open\':\'profile\'} })"> <img data-ng-src="[[ctrl.avatar ? ctrl.avatar+\'?thumbnail=48x48\' : \'\']]" alt="{{ctrl.description.displayName}}"/> </a> </div> <div class="flex-grow-1"> <div class="name">{{ctrl.description.displayName}}</div> <div ng-if="!ctrl.hasManySchools" class="school">{{ctrl.selectedSchool.name}}</div> <div ng-if="ctrl.hasManySchools" class="dropdown"> <div class="school-multiple dropdown-toggle" role="button" id="ddSchoolWidgetSchool" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a href="" class="text-white">{{ctrl.selectedSchool.name}}</a> </div> <div class="school-choice dropdown-menu" aria-labelledby="ddSchoolWidgetSchool"> <div tabindex="0" role="button" class="dropdown-item" ng-repeat="school in ctrl.description.schools" ng-click="ctrl.onSchoolSelected($index)" ng-keydown="ctrl.onSchoolSelected($index, $event)"> {{school.name}} </div> </div> </div> </div> </div> </div> <div class="btn-group"> <a href="/userbook/annuaire#/search" class="btn btn-secondary rounded-pill" ng-if="ctrl.isStudent" ng-click="trackEvent($event, {detail:{\'open\':\'student.class\'} })" translate content="school-widget.widget.my.classroom"></a> <a ng-href="{{ctrl.getUrlTeachersOfMyClass()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isStudent" ng-click="trackEvent($event, {detail:{\'open\':\'student.teachers\'} })" translate content="school-widget.widget.my.team"></a> <a ng-href="{{ctrl.getUrlStudentsOfMyClasses()}}" class="btn btn-secondary rounded-pill" ng-if="ctrl.isTeacher" ng-click="trackEvent($event, {detail:{\'open\':\'teacher.students\'} })" translate content="school-widget.widget.my.classrooms"></a> <a ng-href="{{ctrl.getUrlSchoolTeachers()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isTeacher" ng-click="trackEvent($event, {detail:{\'open\':\'teacher.teachers\'} })" translate content="school-widget.widget.school.team"></a> <a ng-href="{{ctrl.getUrlTeachersOfMyChildren()}}" class="btn btn-secondary rounded-pill" ng-if="ctrl.isRelative" ng-click="trackEvent($event, {detail:{\'open\':\'relative.teachers\'} })" translate content="school-widget.widget.school.team"></a> <a ng-href="{{ctrl.getUrlSchoolPersonnels()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isRelative" ng-click="trackEvent($event, {detail:{\'open\':\'relative.direction\'} })" translate content="school-widget.widget.school.managers"></a> <a ng-href="{{ctrl.getUrlSchoolPersonnelsAndTeachers()}}" class="btn btn-secondary rounded-pill" ng-if="ctrl.isPersonnel" ng-click="trackEvent($event, {detail:{\'open\':\'personnel.personnels\'} })" translate content="school-widget.widget.school.personnelAndTeachers"></a> <a ng-href="{{ctrl.getUrlStudents()}}" class="btn btn-outline-secondary rounded-pill" ng-if="ctrl.isPersonnel" ng-click="trackEvent($event, {detail:{\'open\':\'personnel.students\'} })" translate content="school-widget.widget.students"></a> </div> </div> </div> '},5623:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,s){function l(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,i)}c((o=o.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,o,r,s,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,o=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(r=l.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){l=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){l.label=s[1];break}if(6===s[0]&&l.label<r[1]){l.label=r[1],r=s;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(s);break}r[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var l=s(n(4202)),i=n(5262),c=n(9419),a=function(){function e(e){this.themeHelperSvc=e}return Object.defineProperty(e.prototype,"me",{get:function(){return(0,c.session)().user},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"description",{get:function(){return(0,c.session)().description},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"avatar",{get:function(){return(0,c.session)().avatarUrl},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){var e,t;return o(this,void 0,void 0,function(){var n,o,s=this;return r(this,function(r){switch(r.label){case 0:return this._userPref=null===(e=i.WidgetFrameworkFactory.instance().list.find(function(e){return e.platformConf.name===i.WIDGET_NAME.SCHOOL}))||void 0===e?void 0:e.userPref,n=this,[4,this.themeHelperSvc.getBootstrapThemePath()];case 1:return n.themePath=r.sent(),[4,(0,c.notif)().onSessionReady().promise];case 2:return r.sent(),o=0,(null===(t=this._userPref)||void 0===t?void 0:t.schoolId)&&l.default.isArray(this.description.schools)&&(o=this.description.schools.findIndex(function(e){var t;return e.id===(null===(t=s._userPref)||void 0===t?void 0:t.schoolId)}),o<0&&(o=0)),this.setSelectedSchool(o),[2]}})})},e.prototype.getWidgetStyle=function(){return{"background-image":"url("+this.themePath+"/images/widget-3.png)"}},e.prototype.onSchoolSelected=function(e,t){var n;return(!t||"keydown"===t.type&&(13===t.which||32===t.which))&&(this._userPref&&this.setSelectedSchool(e)&&(this._userPref.schoolId=null===(n=this.selectedSchool)||void 0===n?void 0:n.id,i.WidgetFrameworkFactory.instance().saveUserPrefs()),!0)},e.prototype.setSelectedSchool=function(e){return 0<=e&&e<this.description.schools.length&&this.selectedSchool!==this.description.schools[e]&&(this.selectedSchool=this.description.schools[e],!0)},e.prototype.getDefaultUrl=function(){return"/userbook/annuaire#/search"},e.prototype.getUrlTeachersOfMyClass=function(){var e=this.getDefaultUrl();if(this.me.classes&&this.me.classes.length>0){e+="?filters=groups&profile=Teacher";for(var t=0,n=this.me.classes;t<n.length;t++){e+="&class="+n[t]}}return e},e.prototype.getUrlStudentsOfMyClasses=function(){var e=this.getDefaultUrl()+"?filters=groups&profile=Student";this.selectedSchool&&(e+="&structure="+this.selectedSchool.id);for(var t=0,n=this.me.classes;t<n.length;t++){e+="&class="+n[t]}return e},e.prototype.getUrlSchoolTeachers=function(){return this.selectedSchool?"/userbook/annuaire#/search?filters=groups&structure="+this.selectedSchool.id+"&profile=Teacher":this.getDefaultUrl()},e.prototype.getUrlTeachersOfMyChildren=function(){for(var e=this.getDefaultUrl()+"?filters=groups&profile=Teacher",t=0,n=this.me.classes;t<n.length;t++){e+="&class="+n[t]}return e},e.prototype.getUrlSchoolPersonnels=function(){return this.selectedSchool?"/userbook/annuaire#/search?filters=users&structure="+this.selectedSchool.id+"&profile=Personnel":this.getDefaultUrl()},e.prototype.getUrlSchoolPersonnelsAndTeachers=function(){return this.selectedSchool?"/userbook/annuaire#/search?filters=users&structure="+this.selectedSchool.id+"&profile=Personnel&profile=Teacher":this.getDefaultUrl()},e.prototype.getUrlStudents=function(){var e=this.getDefaultUrl()+"?filters=groups&profile=Student";return this.selectedSchool&&(e+="&structure="+this.selectedSchool.id),e},Object.defineProperty(e.prototype,"hasManySchools",{get:function(){return this.description.schools.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStudent",{get:function(){return"ELEVE"===this.me.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isTeacher",{get:function(){return"ENSEIGNANT"===this.me.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRelative",{get:function(){return"PERSRELELEVE"===this.me.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPersonnel",{get:function(){return"PERSEDUCNAT"===this.me.type},enumerable:!1,configurable:!0}),e}(),d=function(){function e(){this.restrict="E",this.template=n(4257).Z,this.controller=["odeThemeHelperService",a],this.controllerAs="ctrl",this.require=["odeSchoolWidget"]}return e.prototype.link=function(e,t,n,s){return o(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return(t=s?s[0]:null)?[4,t.initialize()]:[2];case 1:return n.sent(),e.$apply(),e.trackEvent=function(e,t){var n;void 0===t.bubbles&&(t.bubbles=!0);var o=null;(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.open)&&-1!==["student.class","student.teachers","teacher.students","teacher.teachers","relative.teachers","relative.direction","profile"].indexOf(t.detail.open)&&(o=new CustomEvent(c.TrackedActionFromWidget.school,t)),o&&e.currentTarget&&e.currentTarget.dispatchEvent(o)},[2]}})})},e}();(0,c.notif)().onLangReady().promise.then(function(e){(0,c.conf)().Platform.idiom.addKeys(n(3926))}),t.odeModuleName="odeSchoolWidgetModule",l.default.module(t.odeModuleName,[]).directive("odeSchoolWidget",function(){return new d})},3926:e=>{e.exports=JSON.parse('{"school-widget.widget.my.classroom":"Ma classe","school-widget.widget.my.classrooms":"Mes classes","school-widget.widget.my.team":"Mes enseignants","school-widget.widget.school.team":"Équipe enseignante","school-widget.widget.school.managers":"Personnels","school-widget.widget.school.personnelAndTeachers":"Personnels et Enseignants","school-widget.widget.students":"Élèves","school-widget":"Mon réseau"}')}}]);
2
2
  //# sourceMappingURL=school-widget.widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widgets/school-widget/school-widget.widget.js","mappings":"gIAGA,QAFW,4rG,8iDCDX,iBACA,UACA,UAIA,aACC,WACSA,GAAA,KAAAA,eAAAA,CACN,CAkIJ,OAhIC,sBAAY,iBAAE,C,IAAd,WACC,OAAO,IAAAC,WAAUC,IAClB,E,gCACA,sBAAc,0BAAW,C,IAAzB,WACC,OAAO,IAAAD,WAAUE,WAClB,E,gCACA,sBAAc,qBAAM,C,IAApB,WACC,OAAO,IAAAF,WAAUG,SAClB,E,gCAIa,YAAAC,WAAb,W,iHAEkB,OADjBC,KAAKC,UAAuG,QAA3F,IAAAC,uBAAuBC,WAAWC,KAAKC,MAAM,SAAAC,GAAK,OAAAA,EAAEC,aAAaC,OAAO,EAAAC,YAAYC,MAAlC,WAAyC,eAAEC,SAC9G,EAAAX,KAAiB,GAAMA,KAAKN,eAAekB,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BA4BZ,QA1BU,YAAAC,KAAN,SAAWC,EAAoBC,EAAaC,EAAmBC,G,gGAEjE,OADYC,EAAuBD,EAAcA,EAAY,GAAmB,MAGhF,GAAMC,EAAKzD,cAFE,I,cAEb,SACAqD,EAAMK,SAGNL,EAAMM,WAAa,SAACC,EAASC,G,WAEJ,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAEjD,IAAIC,EAAQ,MACC,QAAT,EAAAF,aAAC,EAADA,EAAGG,cAAM,eAAEC,QAKe,IAJ5B,CAAC,gBAAkB,mBAClB,mBAAqB,mBACrB,oBAAqB,qBACrB,WACCC,QAAQL,EAAEG,OAAOC,QACpBF,EAAQ,IAAII,YAAa,EAAAC,wBAAwB7C,OAAQsC,IAEtDE,GAASH,EAAES,eACdT,EAAES,cAAcC,cAAcP,EAEhC,E,YAEF,EAjCA,IAyCA,IAAAhD,SAAQwD,cAActD,QAAQuD,MAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,IAIa,EAAAC,cAAgB,wBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,mBAd9C,WACC,OAAO,IAAIC,CACZ,G","sources":["webpack://ode-ngjs-front/./src/ts/widgets/school-widget/school-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/school-widget/school-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<div class=\\\"widget-school\\\"> <div class=\\\"widget-body\\\"> <div class=\\\"widget-school-header\\\" ng-style=\\\"ctrl.getWidgetStyle()\\\"> <div class=\\\"d-flex align-items-center\\\"> <div class=\\\"me-16\\\"> <a href=\\\"/userbook/mon-compte\\\" class=\\\"avatar-link\\\" i18n-title=\\\"navbar.myaccount\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'profile'} })\\\"> <img data-ng-src=\\\"[[ctrl.avatar ? ctrl.avatar+'?thumbnail=48x48' : '']]\\\" alt=\\\"{{ctrl.description.displayName}}\\\"/> </a> </div> <div class=\\\"flex-grow-1\\\"> <div class=\\\"name\\\">{{ctrl.description.displayName}}</div> <div ng-if=\\\"!ctrl.hasManySchools\\\" class=\\\"school\\\">{{ctrl.selectedSchool.name}}</div> <div ng-if=\\\"ctrl.hasManySchools\\\" class=\\\"dropdown\\\"> <div class=\\\"school-multiple dropdown-toggle\\\" role=\\\"button\\\" id=\\\"ddSchoolWidgetSchool\\\" data-bs-toggle=\\\"dropdown\\\" aria-haspopup=\\\"true\\\" aria-expanded=\\\"false\\\"> <a href=\\\"\\\" class=\\\"text-white\\\">{{ctrl.selectedSchool.name}}</a> </div> <div class=\\\"school-choice dropdown-menu\\\" aria-labelledby=\\\"ddSchoolWidgetSchool\\\"> <div tabindex=\\\"0\\\" role=\\\"button\\\" class=\\\"dropdown-item\\\" ng-repeat=\\\"school in ctrl.description.schools\\\" ng-click=\\\"ctrl.onSchoolSelected($index)\\\" ng-keydown=\\\"ctrl.onSchoolSelected($index, $event)\\\"> {{school.name}} </div> </div> </div> </div> </div> </div> <div class=\\\"btn-group\\\"> <a href=\\\"/userbook/annuaire#/search\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isStudent\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'student.class'} })\\\" translate content=\\\"school-widget.widget.my.classroom\\\"></a> <a ng-href=\\\"{{ctrl.getUrlTeachersOfMyClass()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isStudent\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'student.teachers'} })\\\" translate content=\\\"school-widget.widget.my.team\\\"></a> <a ng-href=\\\"{{ctrl.getUrlStudentsOfMyClasses()}}\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isTeacher\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'teacher.students'} })\\\" translate content=\\\"school-widget.widget.my.classrooms\\\"></a> <a ng-href=\\\"{{ctrl.getUrlSchoolTeachers()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isTeacher\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'teacher.teachers'} })\\\" translate content=\\\"school-widget.widget.school.team\\\"></a> <a ng-href=\\\"{{ctrl.getUrlTeachersOfMyChildren()}}\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isRelative\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'relative.teachers'} })\\\" translate content=\\\"school-widget.widget.school.team\\\"></a> <a ng-href=\\\"{{ctrl.getUrlSchoolPersonnels()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isRelative\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'relative.direction'} })\\\" translate content=\\\"school-widget.widget.school.managers\\\"></a> <a ng-href=\\\"{{ctrl.getUrlSchoolPersonnelsAndTeachers()}}\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isPersonnel\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'personnel.personnels'} })\\\" translate content=\\\"school-widget.widget.school.personnelAndTeachers\\\"></a> <a ng-href=\\\"{{ctrl.getUrlStudents()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isPersonnel\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'personnel.students'} })\\\" translate content=\\\"school-widget.widget.students\\\"></a> </div> </div> </div> \";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective } from \"angular\";\nimport { IUserDescription, IUserInfo, School, WidgetFrameworkFactory, WidgetUserPref, WIDGET_NAME } from \"ode-ts-client\";\nimport { conf, notif, session, TrackedScope, TrackedAction, TrackedActionFromWidget } from \"../../utils\";\nimport { ThemeHelperService } from \"../../services\";\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tconstructor( \n\t\tprivate themeHelperSvc:ThemeHelperService\n\t) {}\n\n\tprivate get me():IUserInfo {\n\t\treturn session().user;\n\t}\n\tprotected get description():IUserDescription {\n\t\treturn session().description;\n\t}\n\tprotected get avatar():string {\n\t\treturn session().avatarUrl;\n\t}\n\n\tprivate _userPref?:WidgetUserPref;\n\n\tpublic async initialize() {\n\t\tthis._userPref = WidgetFrameworkFactory.instance().list.find( w => w.platformConf.name===WIDGET_NAME.SCHOOL)?.userPref;\n\t\tthis.themePath = await this.themeHelperSvc.getBootstrapThemePath();\n\t\tawait notif().onSessionReady().promise;\n\n\t\t// #WB-22, memorize the latest school choice\n\t\tlet defaultIndex = 0;\n\t\tif( this._userPref?.schoolId && angular.isArray(this.description.schools) ) {\n\t\t\tdefaultIndex = this.description.schools.findIndex( school => school.id===this._userPref?.schoolId );\n\t\t\tif( defaultIndex < 0 ) {\n\t\t\t\tdefaultIndex = 0;\n\t\t\t}\n\t\t}\n\t\tthis.setSelectedSchool( defaultIndex );\n\t}\n\n\tprivate selectedSchool?:School;\n\tprivate themePath?:string;\n\n\tprotected getWidgetStyle() {\n\t\treturn {\n\t\t\t'background-image': \"url(\"+ this.themePath +\"/images/widget-3.png)\"\n\t\t};\n\t}\n\n\tprotected onSchoolSelected( idx:number, ev?:JQuery.Event ) {\n\t\t// If an event is given, and related to pressing the enter or spacebar key.\n\t\tif( !ev || (ev.type==='keydown' && (ev.which===13 || ev.which===32)) ) {\t\n\t\t\tif( this._userPref && this.setSelectedSchool(idx) ) {\n\t\t\t\t// Selected school changed => #WB-22, memorize the latest school choice\n\t\t\t\tthis._userPref.schoolId = this.selectedSchool?.id;\n\t\t\t\tWidgetFrameworkFactory.instance().saveUserPrefs();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate setSelectedSchool( idx:number ):boolean {\n\t\tif( 0 <= idx && idx < this.description.schools.length && this.selectedSchool !== this.description.schools[idx]) {\n\t\t\tthis.selectedSchool = this.description.schools[idx];\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate getDefaultUrl() {\n\t\treturn \"/userbook/annuaire#/search\";\n\t}\n\t\n\tprotected getUrlTeachersOfMyClass() {\n\t\tlet url = this.getDefaultUrl();\n\t\tif( this.me.classes && this.me.classes.length>0 ) {\n\t\t\turl += \"?filters=groups&profile=Teacher\";\n\t\t\tfor( let clazz of this.me.classes ) {\n\t\t\t\turl += \"&class=\"+clazz;\n\t\t\t}\n\t\t}\n\t\treturn url;\n\t}\n\tprotected getUrlStudentsOfMyClasses() {\n\t\tlet url = this.getDefaultUrl() + \"?filters=groups&profile=Student\";\n\t\tif( this.selectedSchool ) {\n\t\t\turl += \"&structure=\"+this.selectedSchool.id;\n\t\t}\n\t\tfor( let clazz of this.me.classes ) {\n\t\t\turl += \"&class=\"+clazz;\n\t\t}\n\t\treturn url;\n\t}\n\tprotected getUrlSchoolTeachers() {\n\t\tif( this.selectedSchool )\n\t\t\treturn \"/userbook/annuaire#/search?filters=groups&structure=\"+this.selectedSchool.id+\"&profile=Teacher\";\n\t\treturn this.getDefaultUrl();\n\t}\n\tprotected getUrlTeachersOfMyChildren() {\n\t\tlet url = this.getDefaultUrl() + \"?filters=groups&profile=Teacher\";\n\t\tfor( let clazz of this.me.classes ) {\n\t\t\turl += \"&class=\"+clazz;\n\t\t}\n\t\treturn url;\n\t}\n\tprotected getUrlSchoolPersonnels() {\n\t\tif( this.selectedSchool )\n\t\t\treturn \"/userbook/annuaire#/search?filters=users&structure=\"+this.selectedSchool.id+\"&profile=Personnel\";\n\t\treturn this.getDefaultUrl();\n\t}\n\tprotected getUrlSchoolPersonnelsAndTeachers() {\n\t\tif( this.selectedSchool )\n\t\t\treturn \"/userbook/annuaire#/search?filters=users&structure=\"+this.selectedSchool.id+\"&profile=Personnel&profile=Teacher\";\n\t\treturn this.getDefaultUrl();\n\t}\n\tprotected getUrlStudents() { \n\t\tlet url = this.getDefaultUrl() + \"?filters=groups&profile=Student\";\n\t\tif( this.selectedSchool ) {\n\t\t\turl += \"&structure=\"+this.selectedSchool.id;\n\t\t}\n\t\treturn url;\n\t}\n\n\tprotected get hasManySchools() {\n\t\treturn this.description.schools.length > 1;\n\t}\n\n\tprotected get isStudent():boolean {\n\t\treturn this.me.type===\"ELEVE\";\n\t}\n\tprotected get isTeacher():boolean {\n\t\treturn this.me.type===\"ENSEIGNANT\";\n\t}\n\tprotected get isRelative():boolean {\n\t\treturn this.me.type===\"PERSRELELEVE\";\n\t}\n\tprotected get isPersonnel():boolean {\n\t\treturn this.me.type===\"PERSEDUCNAT\";\n\t}\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./school-widget.widget.html').default;\n\tcontroller = [\"odeThemeHelperService\", Controller];\n\tcontrollerAs = 'ctrl';\n\trequire = ['odeSchoolWidget'];\n\n async link(scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]) {\n const ctrl:Controller|null = controllers ? controllers[0] as Controller : null;\n\t\tif( ! ctrl ) return;\n\n\t\tawait ctrl.initialize();\n\t\tscope.$apply();\n\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p?.detail?.open &&\n\t\t\t\t\t['student.class'\t\t,'student.teachers'\n\t\t\t\t\t,'teacher.students'\t\t,'teacher.teachers'\n\t\t\t\t\t,'relative.teachers'\t,'relative.direction'\n\t\t\t\t\t,'profile'\n\t\t\t\t\t].indexOf(p.detail.open)!==-1 ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.school, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The school-widget widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeSchoolWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeSchoolWidget\", DirectiveFactory );\n"],"names":["themeHelperSvc","session","user","description","avatarUrl","initialize","this","_userPref","WidgetFrameworkFactory","instance","list","find","w","platformConf","name","WIDGET_NAME","SCHOOL","userPref","getBootstrapThemePath","themePath","notif","onSessionReady","promise","defaultIndex","schoolId","isArray","schools","findIndex","school","id","setSelectedSchool","getWidgetStyle","onSchoolSelected","idx","ev","type","which","selectedSchool","saveUserPrefs","length","getDefaultUrl","getUrlTeachersOfMyClass","url","me","classes","getUrlStudentsOfMyClasses","getUrlSchoolTeachers","getUrlTeachersOfMyChildren","getUrlSchoolPersonnels","getUrlSchoolPersonnelsAndTeachers","getUrlStudents","restrict","template","controller","Controller","controllerAs","require","link","scope","elem","attrs","controllers","ctrl","$apply","trackEvent","e","p","bubbles","event","detail","open","indexOf","CustomEvent","TrackedActionFromWidget","currentTarget","dispatchEvent","onLangReady","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
1
+ {"version":3,"file":"widgets/school-widget/school-widget.widget.js","mappings":"gIAGA,QAFW,4rG,0iDCDX,iBACA,UACA,UAIA,aACC,WACSA,GAAA,KAAAA,eAAAA,CACN,CAkIJ,OAhIC,sBAAY,iBAAE,C,IAAd,WACC,OAAO,IAAAC,WAAUC,IAClB,E,gCACA,sBAAc,0BAAW,C,IAAzB,WACC,OAAO,IAAAD,WAAUE,WAClB,E,gCACA,sBAAc,qBAAM,C,IAApB,WACC,OAAO,IAAAF,WAAUG,SAClB,E,gCAIa,YAAAC,WAAb,W,+GAEkB,OADjBC,KAAKC,UAAuG,QAA3F,IAAAC,uBAAuBC,WAAWC,KAAKC,KAAM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wIA,0BACI,KAAAgB,SAAW,IACd,KAAAC,SAAW,UACX,KAAAC,WAAa,CAAC,wBAAyBC,GACvC,KAAAC,aAAe,OACf,KAAAC,QAAU,CAAC,kBA4BZ,QA1BU,YAAAC,KAAN,SAAWC,EAAoBC,EAAaC,EAAmBC,G,8FAEjE,OADYC,EAAuBD,EAAcA,EAAY,GAAmB,MAGhF,GAAMC,EAAKzD,cAFE,I,cAEb,SACAqD,EAAMK,SAGNL,EAAMM,WAAa,SAACC,EAASC,G,WAEJ,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAEjD,IAAIC,EAAQ,MACC,QAAT,EAAAF,aAAC,EAADA,EAAGG,cAAM,eAAEC,QAKe,IAJ5B,CAAC,gBAAkB,mBAClB,mBAAqB,mBACrB,oBAAqB,qBACrB,WACCC,QAAQL,EAAEG,OAAOC,QACpBF,EAAQ,IAAII,YAAa,EAAAC,wBAAwB7C,OAAQsC,IAEtDE,GAASH,EAAES,eACdT,EAAES,cAAcC,cAAcP,EAEhC,E,UAEF,EAjCA,IAyCA,IAAAhD,SAAQwD,cAActD,QAAQuD,KAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,GAIa,EAAAC,cAAgB,wBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,kBAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/school-widget/school-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/school-widget/school-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<div class=\\\"widget-school\\\"> <div class=\\\"widget-body\\\"> <div class=\\\"widget-school-header\\\" ng-style=\\\"ctrl.getWidgetStyle()\\\"> <div class=\\\"d-flex align-items-center\\\"> <div class=\\\"me-16\\\"> <a href=\\\"/userbook/mon-compte\\\" class=\\\"avatar-link\\\" i18n-title=\\\"navbar.myaccount\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'profile'} })\\\"> <img data-ng-src=\\\"[[ctrl.avatar ? ctrl.avatar+'?thumbnail=48x48' : '']]\\\" alt=\\\"{{ctrl.description.displayName}}\\\"/> </a> </div> <div class=\\\"flex-grow-1\\\"> <div class=\\\"name\\\">{{ctrl.description.displayName}}</div> <div ng-if=\\\"!ctrl.hasManySchools\\\" class=\\\"school\\\">{{ctrl.selectedSchool.name}}</div> <div ng-if=\\\"ctrl.hasManySchools\\\" class=\\\"dropdown\\\"> <div class=\\\"school-multiple dropdown-toggle\\\" role=\\\"button\\\" id=\\\"ddSchoolWidgetSchool\\\" data-bs-toggle=\\\"dropdown\\\" aria-haspopup=\\\"true\\\" aria-expanded=\\\"false\\\"> <a href=\\\"\\\" class=\\\"text-white\\\">{{ctrl.selectedSchool.name}}</a> </div> <div class=\\\"school-choice dropdown-menu\\\" aria-labelledby=\\\"ddSchoolWidgetSchool\\\"> <div tabindex=\\\"0\\\" role=\\\"button\\\" class=\\\"dropdown-item\\\" ng-repeat=\\\"school in ctrl.description.schools\\\" ng-click=\\\"ctrl.onSchoolSelected($index)\\\" ng-keydown=\\\"ctrl.onSchoolSelected($index, $event)\\\"> {{school.name}} </div> </div> </div> </div> </div> </div> <div class=\\\"btn-group\\\"> <a href=\\\"/userbook/annuaire#/search\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isStudent\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'student.class'} })\\\" translate content=\\\"school-widget.widget.my.classroom\\\"></a> <a ng-href=\\\"{{ctrl.getUrlTeachersOfMyClass()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isStudent\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'student.teachers'} })\\\" translate content=\\\"school-widget.widget.my.team\\\"></a> <a ng-href=\\\"{{ctrl.getUrlStudentsOfMyClasses()}}\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isTeacher\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'teacher.students'} })\\\" translate content=\\\"school-widget.widget.my.classrooms\\\"></a> <a ng-href=\\\"{{ctrl.getUrlSchoolTeachers()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isTeacher\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'teacher.teachers'} })\\\" translate content=\\\"school-widget.widget.school.team\\\"></a> <a ng-href=\\\"{{ctrl.getUrlTeachersOfMyChildren()}}\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isRelative\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'relative.teachers'} })\\\" translate content=\\\"school-widget.widget.school.team\\\"></a> <a ng-href=\\\"{{ctrl.getUrlSchoolPersonnels()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isRelative\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'relative.direction'} })\\\" translate content=\\\"school-widget.widget.school.managers\\\"></a> <a ng-href=\\\"{{ctrl.getUrlSchoolPersonnelsAndTeachers()}}\\\" class=\\\"btn btn-secondary rounded-pill\\\" ng-if=\\\"ctrl.isPersonnel\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'personnel.personnels'} })\\\" translate content=\\\"school-widget.widget.school.personnelAndTeachers\\\"></a> <a ng-href=\\\"{{ctrl.getUrlStudents()}}\\\" class=\\\"btn btn-outline-secondary rounded-pill\\\" ng-if=\\\"ctrl.isPersonnel\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'personnel.students'} })\\\" translate content=\\\"school-widget.widget.students\\\"></a> </div> </div> </div> \";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective } from \"angular\";\nimport { IUserDescription, IUserInfo, School, WidgetFrameworkFactory, WidgetUserPref, WIDGET_NAME } from \"ode-ts-client\";\nimport { conf, notif, session, TrackedScope, TrackedAction, TrackedActionFromWidget } from \"../../utils\";\nimport { ThemeHelperService } from \"../../services\";\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tconstructor( \n\t\tprivate themeHelperSvc:ThemeHelperService\n\t) {}\n\n\tprivate get me():IUserInfo {\n\t\treturn session().user;\n\t}\n\tprotected get description():IUserDescription {\n\t\treturn session().description;\n\t}\n\tprotected get avatar():string {\n\t\treturn session().avatarUrl;\n\t}\n\n\tprivate _userPref?:WidgetUserPref;\n\n\tpublic async initialize() {\n\t\tthis._userPref = WidgetFrameworkFactory.instance().list.find( w => w.platformConf.name===WIDGET_NAME.SCHOOL)?.userPref;\n\t\tthis.themePath = await this.themeHelperSvc.getBootstrapThemePath();\n\t\tawait notif().onSessionReady().promise;\n\n\t\t// #WB-22, memorize the latest school choice\n\t\tlet defaultIndex = 0;\n\t\tif( this._userPref?.schoolId && angular.isArray(this.description.schools) ) {\n\t\t\tdefaultIndex = this.description.schools.findIndex( school => school.id===this._userPref?.schoolId );\n\t\t\tif( defaultIndex < 0 ) {\n\t\t\t\tdefaultIndex = 0;\n\t\t\t}\n\t\t}\n\t\tthis.setSelectedSchool( defaultIndex );\n\t}\n\n\tprivate selectedSchool?:School;\n\tprivate themePath?:string;\n\n\tprotected getWidgetStyle() {\n\t\treturn {\n\t\t\t'background-image': \"url(\"+ this.themePath +\"/images/widget-3.png)\"\n\t\t};\n\t}\n\n\tprotected onSchoolSelected( idx:number, ev?:JQuery.Event ) {\n\t\t// If an event is given, and related to pressing the enter or spacebar key.\n\t\tif( !ev || (ev.type==='keydown' && (ev.which===13 || ev.which===32)) ) {\t\n\t\t\tif( this._userPref && this.setSelectedSchool(idx) ) {\n\t\t\t\t// Selected school changed => #WB-22, memorize the latest school choice\n\t\t\t\tthis._userPref.schoolId = this.selectedSchool?.id;\n\t\t\t\tWidgetFrameworkFactory.instance().saveUserPrefs();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate setSelectedSchool( idx:number ):boolean {\n\t\tif( 0 <= idx && idx < this.description.schools.length && this.selectedSchool !== this.description.schools[idx]) {\n\t\t\tthis.selectedSchool = this.description.schools[idx];\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate getDefaultUrl() {\n\t\treturn \"/userbook/annuaire#/search\";\n\t}\n\t\n\tprotected getUrlTeachersOfMyClass() {\n\t\tlet url = this.getDefaultUrl();\n\t\tif( this.me.classes && this.me.classes.length>0 ) {\n\t\t\turl += \"?filters=groups&profile=Teacher\";\n\t\t\tfor( let clazz of this.me.classes ) {\n\t\t\t\turl += \"&class=\"+clazz;\n\t\t\t}\n\t\t}\n\t\treturn url;\n\t}\n\tprotected getUrlStudentsOfMyClasses() {\n\t\tlet url = this.getDefaultUrl() + \"?filters=groups&profile=Student\";\n\t\tif( this.selectedSchool ) {\n\t\t\turl += \"&structure=\"+this.selectedSchool.id;\n\t\t}\n\t\tfor( let clazz of this.me.classes ) {\n\t\t\turl += \"&class=\"+clazz;\n\t\t}\n\t\treturn url;\n\t}\n\tprotected getUrlSchoolTeachers() {\n\t\tif( this.selectedSchool )\n\t\t\treturn \"/userbook/annuaire#/search?filters=groups&structure=\"+this.selectedSchool.id+\"&profile=Teacher\";\n\t\treturn this.getDefaultUrl();\n\t}\n\tprotected getUrlTeachersOfMyChildren() {\n\t\tlet url = this.getDefaultUrl() + \"?filters=groups&profile=Teacher\";\n\t\tfor( let clazz of this.me.classes ) {\n\t\t\turl += \"&class=\"+clazz;\n\t\t}\n\t\treturn url;\n\t}\n\tprotected getUrlSchoolPersonnels() {\n\t\tif( this.selectedSchool )\n\t\t\treturn \"/userbook/annuaire#/search?filters=users&structure=\"+this.selectedSchool.id+\"&profile=Personnel\";\n\t\treturn this.getDefaultUrl();\n\t}\n\tprotected getUrlSchoolPersonnelsAndTeachers() {\n\t\tif( this.selectedSchool )\n\t\t\treturn \"/userbook/annuaire#/search?filters=users&structure=\"+this.selectedSchool.id+\"&profile=Personnel&profile=Teacher\";\n\t\treturn this.getDefaultUrl();\n\t}\n\tprotected getUrlStudents() { \n\t\tlet url = this.getDefaultUrl() + \"?filters=groups&profile=Student\";\n\t\tif( this.selectedSchool ) {\n\t\t\turl += \"&structure=\"+this.selectedSchool.id;\n\t\t}\n\t\treturn url;\n\t}\n\n\tprotected get hasManySchools() {\n\t\treturn this.description.schools.length > 1;\n\t}\n\n\tprotected get isStudent():boolean {\n\t\treturn this.me.type===\"ELEVE\";\n\t}\n\tprotected get isTeacher():boolean {\n\t\treturn this.me.type===\"ENSEIGNANT\";\n\t}\n\tprotected get isRelative():boolean {\n\t\treturn this.me.type===\"PERSRELELEVE\";\n\t}\n\tprotected get isPersonnel():boolean {\n\t\treturn this.me.type===\"PERSEDUCNAT\";\n\t}\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./school-widget.widget.html').default;\n\tcontroller = [\"odeThemeHelperService\", Controller];\n\tcontrollerAs = 'ctrl';\n\trequire = ['odeSchoolWidget'];\n\n async link(scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]) {\n const ctrl:Controller|null = controllers ? controllers[0] as Controller : null;\n\t\tif( ! ctrl ) return;\n\n\t\tawait ctrl.initialize();\n\t\tscope.$apply();\n\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p?.detail?.open &&\n\t\t\t\t\t['student.class'\t\t,'student.teachers'\n\t\t\t\t\t,'teacher.students'\t\t,'teacher.teachers'\n\t\t\t\t\t,'relative.teachers'\t,'relative.direction'\n\t\t\t\t\t,'profile'\n\t\t\t\t\t].indexOf(p.detail.open)!==-1 ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.school, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The school-widget widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\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 = \"odeSchoolWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeSchoolWidget\", DirectiveFactory );\n"],"names":["themeHelperSvc","session","user","description","avatarUrl","initialize","this","_userPref","WidgetFrameworkFactory","instance","list","find","w","platformConf","name","WIDGET_NAME","SCHOOL","userPref","getBootstrapThemePath","themePath","notif","onSessionReady","promise","defaultIndex","schoolId","isArray","schools","findIndex","school","id","setSelectedSchool","getWidgetStyle","onSchoolSelected","idx","ev","type","which","selectedSchool","saveUserPrefs","length","getDefaultUrl","getUrlTeachersOfMyClass","url","me","classes","getUrlStudentsOfMyClasses","getUrlSchoolTeachers","getUrlTeachersOfMyChildren","getUrlSchoolPersonnels","getUrlSchoolPersonnelsAndTeachers","getUrlStudents","restrict","template","controller","Controller","controllerAs","require","link","scope","elem","attrs","controllers","ctrl","$apply","trackEvent","e","p","bubbles","event","detail","open","indexOf","CustomEvent","TrackedActionFromWidget","currentTarget","dispatchEvent","onLangReady","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
@@ -1,2 +1,2 @@
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={}}}]);
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
2
  //# sourceMappingURL=screen-time-widget.widget.js.map