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

2 lines
68 KiB
JavaScript
Raw Normal View History

2022-11-16 10:04:39 +01:00
"use strict";(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[401],{5926:function(t,e,o){o.d(e,{Z:function(){return Q}});o(7658);var a=o(5793),n=o(3577),l=o(2715),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"},I={for:"gpxFile"},D=["disabled"],O={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"},P=["disabled"],B=["disabled"],F=["disabled"],M={class:"form-item"},H=["disabled"],Z={class:"form-item"},q={key:1},G={key:2,class:"form-buttons"},K=["disabled"],V=["onClick"];var Y=(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)(),Y=(0,d.o)(),J=(0,i.tv)(),{authUser:X,workout:Q,isCreation:tt,loading:et}=(0,l.BK)(e),ot=(0,a.Fl)((()=>(0,m.xH)(e.sports,o,"is_active_for_user",Q.value.id?[Q.value.sport_id]:[]))),at=(0,a.Fl)((()=>Y.getters[u.SY.GETTERS.APP_CONFIG])),nt=at.value.max_single_file_size?(0,p.Z)(at.value.max_single_file_size):"",lt=at.value.gpx_limit_import,rt=at.value.max_zip_file_size?(0,p.Z)(at.value.max_zip_file_size):"",st=(0,a.Fl)((()=>Y.getters[u.SY.GETTERS.ERROR_MESSAGES])),it=(0,l.qj)({sport_id:"",title:"",notes:"",workoutDate:"",workoutTime:"",workoutDurationHour:"",workoutDurationMinutes:"",workoutDurationSeconds:"",workoutDistance:""}),ut=(0,l.iH)(e.workout.id?e.workout.with_gpx:e.isCreation);let dt=null;const ct=(0,l.iH)(!1),pt=(0,l.iH)([]);function mt(t){it.notes=t}function wt(){ut.value=!ut.value,ct.value=!1}function kt(t){t.target.files&&(dt=t.target.files[0])}function ft(t){if(it.sport_id=`${t.sport_id}`,it.title=t.title,it.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(":");it.workoutDistance=`${X.value.imperial_units?(0,w.sC)(t.distance,"km","mi",2):parseFloat(t.distance.toFixed(2))}`,it.workoutDate=o.workout_date,it.workoutTime=o.workout_time,it.workoutDurationHour=a[0],it.workoutDurationMinutes=a[1],it.workoutDurationSeconds=a[2]}}function _t(){return pt.value.includes("workouts.INVALID_DISTANCE")}function vt(){return pt.value.includes("workouts.INVALID_DURATION")}function gt(t){pt.value=[],t.title=it.title,t.duration=3600*+it.workoutDurationHour+60*+it.workoutDurationMinutes+ +it.workoutDurationSeconds,t.duration<=0&&pt.value.push("workouts.INVALID_DURATION"),t.distance=X.value.imperial_units?(0,w.sC)(+it.workoutDistance,"mi","km",3):+it.workoutDistance,t.distance<=0&&pt.value.push("workouts.INVALID_DISTANCE"),t.workout_date=`${it.workoutDate} ${it.workoutTime}`}function yt(){const t={sport_id:+it.sport_id,notes:it.notes};if(e.workout.id)e.workout.with_gpx?t.title=it.title:gt(t),Y.dispatch(u.aX.ACTIONS.EDIT_WORKOUT,{workoutId:e.workout.id,data:t});else if(ut.value){if(!dt){const t="workouts.NO_FILE_PROVIDED";return void Y.commit(u.SY.MUTATIONS.SET_ERROR_MESSAGES,t)}t.file=dt,Y.dispatch(u.aX.ACTIONS.ADD_WORKOUT,t)}else gt(t),pt.value.length>0?Y.commit(u.SY.MUTATIONS.SET_ERROR_MESSAGES,pt.value):Y.dispatch(u.aX.ACTIONS.ADD_WORKOUT_WITHOUT_GPX,t)}function St(){e.workout.id?J.push({name:"Workout",params:{workoutId:e.workout.id}}):J.go(-1)}function Ut(){ct.value=!0}return(0,a.bv)((()=>{e.workout.id&&ft(e.workout)})),(0,a.Ah)((()=>Y.commit(u.SY.MUTATIONS.EMPTY_ERROR_MESSAGES))),(0,a.YP)((()=>e.workout),(async(t,e)=>{t!==e&&t&&t.id&&ft(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-fo
//# sourceMappingURL=workouts.4c5396bb.js.map