FitTrackee/fittrackee/dist/static/js/workouts.59e60afb.js

2 lines
82 KiB
JavaScript
Raw Normal View History

2023-07-19 08:41:46 +02:00
"use strict";(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[401],{2537:function(t,e,o){o.d(e,{Z:function(){return nt}});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 v={id:"workout-form"},y=["onSubmit"],k={class:"form-items"},f={key:0,class:"form-item-radio"},_=["checked","disabled"],g={for:"withGpx"},S=["checked","disabled"],h={for:"withoutGpx"},b={class:"form-item"},U=["disabled"],T=["value"],O={key:1,class:"form-item"},E={for:"gpxFile"},D=["disabled"],I={class:"files-help info-box"},A={key:2,class:"form-item"},C={for:"title"},R=["required","disabled"],$={key:3},L={class:"workout-date-duration"},N={class:"form-item"},j={class:"workout-date-time"},x=["disabled"],z=["disabled"],W={class:"form-item"},F=["disabled"],B=["disabled"],H=["disabled"],P={class:"workout-data"},Z={class:"form-item"},M=["disabled"],q={class:"form-item"},K=["disabled"],G={class:"form-item"},Y=["disabled"],X={class:"form-item"},V={key:1},J={key:2,class:"form-buttons"},Q=["disabled"],tt=["onClick"];var et=(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)(),et=(0,d.o)(),ot=(0,i.tv)(),{authUser:at,workout:nt,isCreation:lt,loading:rt}=(0,l.BK)(e),st=(0,a.Fl)((()=>(0,m.xH)(e.sports,o,"is_active_for_user",nt.value.id?[nt.value.sport_id]:[]))),it=(0,a.Fl)((()=>et.getters[u.SY.GETTERS.APP_CONFIG])),ut=it.value.max_single_file_size?(0,p.Z)(it.value.max_single_file_size):"",dt=it.value.gpx_limit_import,ct=it.value.max_zip_file_size?(0,p.Z)(it.value.max_zip_file_size):"",pt=(0,a.Fl)((()=>et.getters[u.SY.GETTERS.ERROR_MESSAGES])),mt=(0,l.qj)({sport_id:"",title:"",notes:"",workoutDate:"",workoutTime:"",workoutDurationHour:"",workoutDurationMinutes:"",workoutDurationSeconds:"",workoutDistance:"",workoutAscent:"",workoutDescent:""}),wt=(0,l.iH)(e.workout.id?e.workout.with_gpx:e.isCreation);let vt=null;const yt=(0,l.iH)(!1),kt=(0,l.iH)([]);function ft(t){mt.notes=t}function _t(){wt.value=!wt.value,yt.value=!1}function gt(t){t.target.files&&(vt=t.target.files[0])}function St(t){if(mt.sport_id=`${t.sport_id}`,mt.title=t.title,mt.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(":");mt.workoutDistance=`${at.value.imperial_units?(0,w.sC)(t.distance,"km","mi",3):parseFloat(t.distance.toFixed(3))}`,mt.workoutDate=o.workout_date,mt.workoutTime=o.workout_time,mt.workoutDurationHour=a[0],mt.workoutDurationMinutes=a[1],mt.workoutDurationSeconds=a[2],mt.workoutAscent=null===t.ascent?"":`${at.value.imperial_units?(0,w.sC)(t.ascent,"m","ft",2):parseFloat(t.ascent.toFixed(2))}`,mt.workoutDescent=null===t.descent?"":`${at.value.imperial_units?(0,w.sC)(t.descent,"m","ft",2):parseFloat(t.descent.toFixed(2))}`}}function ht(){return kt.value.includes("workouts.INVALID_DISTANCE")}function bt(){return kt.value.includes("workouts.INVALID_DURATION")}function Ut(){return kt.value.includes("workouts.INVALID_ASCENT_OR_DESCENT")}function Tt(t){kt.value=[],t.title=mt.title,t.duration=3600*+mt.workoutDurationHour+60*+mt.workoutDurationMinutes+ +mt.workoutDurationSeconds,t.duration<=0&&kt.value.push("workouts.INVALID_DURATION"),t.distance=at.value.imperial_units?(0,w.sC)(+mt.workoutDistance,"mi","km",3):+mt.workoutDistance,t.distance<=0&&kt.value.push("workouts.INVALID_DISTANCE"),t.workout_date=`${mt.workoutDate} ${mt.workoutTime}`,t.ascent=""===mt.workoutAscent?null:at.value.imperial_units?(0,w.sC)(+mt.workoutAscent,"ft","m",3):+mt.workoutAscent,t.descent=""===mt.workoutDescent?null:at.value.imperial_units?(0,w.sC)(+mt.workoutDescent,"ft","m",3):+mt.workoutDescent,(null!==t.ascent&&null===t.descent||null===t.ascent&&null!==t.descent)&&kt.value.push("workouts.INVALID_ASCENT_OR_DESCENT")}function Ot(){const t={sport_id:+mt.sport_id,notes:mt.notes};if(e.workout.id)e.workout.with_gpx?t.title=mt.title:Tt(t),kt.value.length>0?et.commit(u.SY.MUTATIONS
//# sourceMappingURL=workouts.59e60afb.js.map