FitTrackee/fittrackee/dist/static/js/workouts.4abcd6a2.js

2 lines
68 KiB
JavaScript
Raw Normal View History

2022-09-18 15:40:53 +02:00
"use strict";(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[401],{2528:function(t,e,o){o.d(e,{Z:function(){return et}});o(7658);var a=o(6252),n=o(3577),l=o(2262),r=o(9963),s=o(9150),i=o(2201),u=o(5801),d=o(9917),c=o(6558),p=o(8966),m=o(631),w=o(3649);const k={id:"workout-form"},f=["onSubmit"],_={class:"form-items"},v={key:0,class:"form-item-radio"},g=["checked","disabled"],y={for:"withGpx"},S=["checked","disabled"],U={for:"withoutGpx"},h={class:"form-item"},b=["disabled"],T=["value"],E={key:1,class:"form-item"},D={for:"gpxFile"},O=["disabled"],I={class:"files-help info-box"},A={key:2,class:"form-item"},C={for:"title"},R=["required","disabled"],$={key:3},N={class:"workout-date-duration"},x={class:"form-item"},z={class:"workout-date-time"},L=["disabled"],j=["disabled"],W={class:"form-item"},B=["disabled"],P=(0,a.Uk)(" : "),F=["disabled"],H=(0,a.Uk)(" : "),M=["disabled"],Z={class:"form-item"},q=["disabled"],G={class:"form-item"},K={key:1},Y={key:2,class:"form-buttons"},V=["disabled"],J=["onClick"];var X=(0,a.aZ)({__name:"WorkoutEdition",props:{authUser:null,sports:null,isCreation:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},workout:{default:()=>({})}},setup(t){const e=t,{t:o}=(0,s.QT)(),X=(0,d.o)(),Q=(0,i.tv)(),{authUser:tt,workout:et,isCreation:ot,loading:at}=(0,l.BK)(e),nt=(0,a.Fl)((()=>(0,m.xH)(e.sports,o,"is_active_for_user",et.value.id?[et.value.sport_id]:[]))),lt=(0,a.Fl)((()=>X.getters[u.SY.GETTERS.APP_CONFIG])),rt=lt.value.max_single_file_size?(0,p.Z)(lt.value.max_single_file_size):"",st=lt.value.gpx_limit_import,it=lt.value.max_zip_file_size?(0,p.Z)(lt.value.max_zip_file_size):"",ut=(0,a.Fl)((()=>X.getters[u.SY.GETTERS.ERROR_MESSAGES])),dt=(0,l.qj)({sport_id:"",title:"",notes:"",workoutDate:"",workoutTime:"",workoutDurationHour:"",workoutDurationMinutes:"",workoutDurationSeconds:"",workoutDistance:""}),ct=(0,l.iH)(e.workout.id?e.workout.with_gpx:e.isCreation);let pt=null;const mt=(0,l.iH)(!1);function wt(t){dt.notes=t}function kt(){ct.value=!ct.value,mt.value=!1}function ft(t){t.target.files&&(pt=t.target.files[0])}function _t(t){if(dt.sport_id=`${t.sport_id}`,dt.title=t.title,dt.notes=t.notes,!t.with_gpx){const o=(0,c.Jo)((0,c.eB)(t.workout_date,e.authUser.timezone),"yyyy-MM-dd"),a=t.duration.split(":");dt.workoutDistance=`${tt.value.imperial_units?(0,w.sC)(t.distance,"km","mi",2):parseFloat(t.distance.toFixed(2))}`,dt.workoutDate=o.workout_date,dt.workoutTime=o.workout_time,dt.workoutDurationHour=a[0],dt.workoutDurationMinutes=a[1],dt.workoutDurationSeconds=a[2]}}function vt(t){t.title=dt.title,t.distance=tt.value.imperial_units?(0,w.sC)(+dt.workoutDistance,"mi","km",3):+dt.workoutDistance,t.duration=3600*+dt.workoutDurationHour+60*+dt.workoutDurationMinutes+ +dt.workoutDurationSeconds,t.workout_date=`${dt.workoutDate} ${dt.workoutTime}`}function gt(){const t={sport_id:+dt.sport_id,notes:dt.notes};if(e.workout.id)e.workout.with_gpx?t.title=dt.title:vt(t),X.dispatch(u.aX.ACTIONS.EDIT_WORKOUT,{workoutId:e.workout.id,data:t});else if(ct.value){if(!pt){const t="workouts.NO_FILE_PROVIDED";return void X.commit(u.SY.MUTATIONS.SET_ERROR_MESSAGES,t)}t.file=pt,X.dispatch(u.aX.ACTIONS.ADD_WORKOUT,t)}else vt(t),X.dispatch(u.aX.ACTIONS.ADD_WORKOUT_WITHOUT_GPX,t)}function yt(){e.workout.id?Q.push({name:"Workout",params:{workoutId:e.workout.id}}):Q.go(-1)}function St(){mt.value=!0}return(0,a.bv)((()=>{e.workout.id&&_t(e.workout)})),(0,a.Ah)((()=>X.commit(u.SY.MUTATIONS.EMPTY_ERROR_MESSAGES))),(0,a.YP)((()=>e.workout),(async(t,e)=>{t!==e&&t&&t.id&&_t(t)})),(t,e)=>{const o=(0,a.up)("CustomTextArea"),s=(0,a.up)("ErrorMessage"),i=(0,a.up)("Loader"),u=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",{id:"workout-edition",class:(0,n.C_)(["center-card with-margin",{"center-form":(0,l.SU)(et)&&(0,l.SU)(et).with_gpx}])},[(0,a.Wm)(u,null,{title:(0,a.w5)((()=>[(0,a.Uk)((0,n.zw)(t.$t(`workouts.${(0,l.SU)(ot)?"ADD":"EDIT"}_WORKOUT`)),1)])),content:(0,a.w5)((()=>[(0,a._)("div",k,[(0,a._)("form",{class:(0,n.C_)({errors:mt.value}),onSubmit:(0,r.iM)(gt,["prevent"])},[(0,a._)("div",_,[(0,
2022-09-19 10:59:57 +02:00
//# sourceMappingURL=workouts.4abcd6a2.js.map