FitTrackee/fittrackee/dist/static/js/workouts.664239b3.js

2 lines
69 KiB
JavaScript
Raw Normal View History

2023-02-26 18:57:47 +01:00
"use strict";(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[401],{2238: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 k={id:"workout-form"},_=["onSubmit"],v={class:"form-items"},f={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"},P=["disabled"],F=["disabled"],B=["disabled"],H={class:"workout-data"},M={class:"form-item"},q=["disabled"],Z={class:"form-item"},G=["disabled"],K={class:"form-item"},V=["disabled"],Y={class:"form-item"},X={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 kt=null;const _t=(0,l.iH)(!1),vt=(0,l.iH)([]);function ft(t){mt.notes=t}function gt(){wt.value=!wt.value,_t.value=!1}function yt(t){t.target.files&&(kt=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 Ut(){return vt.value.includes("workouts.INVALID_DISTANCE")}function ht(){return vt.value.includes("workouts.INVALID_DURATION")}function bt(){return vt.value.includes("workouts.INVALID_ASCENT_OR_DESCENT")}function Tt(t){vt.value=[],t.title=mt.title,t.duration=3600*+mt.workoutDurationHour+60*+mt.workoutDurationMinutes+ +mt.workoutDurationSeconds,t.duration<=0&&vt.value.push("workouts.INVALID_DURATION"),t.distance=at.value.imperial_units?(0,w.sC)(+mt.workoutDistance,"mi","km",3):+mt.workoutDistance,t.distance<=0&&vt.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)&&vt.value.push("workouts.INVALID_ASCENT_OR_DESCENT")}function Et(){const t={sport_id:+mt.sport_id,notes:mt.notes};if(e.workout.id)e.workout.with_gpx?t.title=mt.title:Tt(t),vt.value.length>0?et.commit(u.SY.MUTATIONS
2023-03-05 11:16:51 +01:00
//# sourceMappingURL=workouts.664239b3.js.map