PageSourceSearch

https://www.catchkar.com/assets/ContentManagerImportView-D-92RL_9.js

js catchkar.com collected 2026-10-02 00:48:50 UTC 10,619 bytes, 1 lines download raw bytes

1import{b as O}from"./vendor-router-DBTS2sVD.js";import{l as V,i as J,p as Z,v as G}from"./index-CKqGCCsh.js";import{L as K,M as z}from"./authApi-CW96cmuJ.js";import{d as W,g as L,i as y,a3 as Q,h as P}from"./vendor-vuetify-BFqubWWH.js";import{f as h,e as F,y as Y,a2 as S,I as s,a5 as d,a1 as b,E as u,R as n,Z as c,a7 as $,a8 as x,F as ee,a6 as ae}from"./vendor-ChPkYPyN.js";const te=["dir"],le={class:"d-flex flex-wrap justify-space-between align-center ga-3"},oe={class:"text-h4 font-weight-black"},ne={class:"text-body-2 text-medium-emphasis mt-2"},ie=["innerHTML"],de={class:"text-body-2"},re={class:"d-flex justify-start ga-2 mt-4"},se={key:2,class:"mt-4"},ge={__name:"ContentManagerImportView",setup(ue){const w=h(null),m=h(!1),f=h(""),v=h(""),g=h(""),p=h(null),T=O(),R=F(()=>V.value==="de"?"de":V.value==="fa"?"fa":"en"),H=F(()=>J(V.value)),X={de:{title:"Content-Manager Import",subtitle:"CSV/XLSX-Datei für Jobtitel und optionale Felder importieren.",back:"Zurück",requiredColumnsHtml:"Pflichtspalten: <strong>domain_id</strong>, <strong>track_id</strong> und <strong>title_de</strong>. Domain/Track können als ID oder Name in <code>domain_id/domain</code> und <code>track_id/track</code> eingetragen werden. Sprachspalten <code>_de</code>, <code>_en</code> und <code>_fa</code> pro Feld ausfüllen.",fileInputLabel:"CSV- oder XLSX-Datei auswählen",fileInputPlaceholder:"Datei auswählen",selectedFilePrefix:"Ausgewählte Datei: ",noFileSelected:"Noch keine Datei ausgewählt.",templateDe:"Vorlage Deutsch",templateEn:"Vorlage Englisch",templateFa:"Vorlage Persisch",startImport:"Import starten",createdLabel:"Erstellt: ",updatedLabel:"Aktualisiert: ",skippedLabel:"Übersprungen: ",errorsLabel:"Fehler",rowLabel:"Zeile",chooseFileRule:"Bitte Datei auswählen.",fileTypeRule:"Nur CSV/XLSX-Datei erlaubt.",pleaseChooseFile:"Bitte Datei auswählen.",importDone:"Import abgeschlossen.",importFailed:"Import fehlgeschlagen.",apiNotFound:"API-Pfad nicht gefunden (404). Bitte Backend-Deployment und VITE_API_BASE_URL prüfen",unexpectedHtml:"Unerwartete HTML-Antwort vom Server. Bitte API-Konfiguration prüfen",templateDownloaded:"Vorlage wurde heruntergeladen.",xlsxFallback:"XLSX nicht verfügbar. CSV-Vorlage wurde heruntergeladen.",templateDownloadFailed:"Vorlagen-Download fehlgeschlagen."},en:{title:"Content Manager Import",subtitle:"Import a CSV/XLSX file for job titles and optional fields.",back:"Back",requiredColumnsHtml:"Required columns: <strong>domain_id</strong>, <strong>track_id</strong>, and <strong>title_de</strong>. Domain/track can be provided as ID or name in <code>domain_id/domain</code> and <code>track_id/track</code>. Fill language columns <code>_de</code>, <code>_en</code>, and <code>_fa</code> per field.",fileInputLabel:"Select CSV or XLSX file",fileInputPlaceholder:"Choose file",selectedFilePrefix:"Selected file: ",noFileSelected:"No file selected yet.",templateDe:"German template",templateEn:"English template",templateFa:"Persian template",startImport:"Start import",createdLabel:"Created: ",updatedLabel:"Updated: ",skippedLabel:"Skipped: ",errorsLabel:"Errors",rowLabel:"Row",chooseFileRule:"Please choose a file.",fileTypeRule:"Only CSV/XLSX files are allowed.",pleaseChooseFile:"Please choose a file.",importDone:"Import completed.",importFailed:"Import failed.",apiNotFound:"API path not found (404). Please check backend deployment and VITE_API_BASE_URL",unexpectedHtml:"Unexpected HTML response from server. Please check API configuration",templateDownloaded:"Template downloaded.",xlsxFallback:"XLSX was unavailable. CSV template was downloaded.",templateDownloadFailed:"Template download failed."},fa:{title:"Content Manager Import",subtitle:"Import a CSV/XLSX file for job titles and optional fields.",back:"Back",requiredColumnsHtml:"Required columns: <strong>domain_id</strong>, <strong>track_id</strong>, and <strong>title_de</strong>. Domain/track can be provided as ID or name in <code>domain_id/domain</code> and <code>track_id/track</code>. Fill language columns <code>_de</code>, <code>_en</code>, and <code>_fa</code> per field.",fileInputLabel:"Select CSV or XLSX file",fileInputPlaceholder:"Choose file",selectedFilePrefix:"Selected file: ",noFileSelected:"No file selected yet.",templateDe:"German template",templateEn:"English template",templateFa:"Persian template",startImport:"Start import",createdLabel:"Created: ",updatedLabel:"Updated: ",skippedLabel:"Skipped: ",errorsLabel:"Errors",rowLabel:"Row",chooseFileRule:"Please choose a file.",fileTypeRule:"Only CSV/XLSX files are allowed.",pleaseChooseFile:"Please choose a file.",importDone:"Import completed.",importFailed:"Import failed.",apiNotFound:"API path not found (404). Please check backend deployment and VITE_API_BASE_URL",unexpectedHtml:"Unexpected HTML response from server. Please check API configuration",templateDownloaded:"Template downloaded.",xlsxFallback:"XLSX was unavailable. CSV template was downloaded.",templateDownloadFailed:"Template download failed."}},t=F(()=>X[R.value]||X.en),C=F(()=>Array.isArray(w.value)?w.value[0]||null:w.value||null),U=l=>{const e=Array.isArray(l)?l[0]:l;if(!e)return t.value.chooseFileRule;const i=String((e==null?void 0:e.name)||""),a=i.includes(".")?i.split(".").pop().toLowerCase():"";return["csv","xlsx"].includes(a)||t.value.fileTypeRule};
1function _(){const e="https://api.catchkar.com".trim().replace(/\/+$/,"");return!e||e==="/"?"/api/":`${(e.toLowerCase().endsWith("/api")?e.slice(0,-4):e).replace(/\/+$/,"")}/api/`}function A(l){const e=String(l||"");return/<\s*!doctype html|<\s*html[\s>]/i.test(e)}function E(l){const e=String(l||"").replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().toLowerCase();return e.includes("not found")&&e.includes("requested resource")}async function M(){var l,e,i;if(v.value="",g.value="",p.value=null,!C.value){v.value=t.value.pleaseChooseFile;return}m.value=!0;try{const a=await K(C.value);p.value=a,g.value=`${t.value.importDone} ${t.value.createdLabel}${(a==null?void 0:a.created)??0}, ${t.value.updatedLabel}${(a==null?void 0:a.updated)??0}, ${t.value.skippedLabel}${(a==null?void 0:a.skipped)??0}.`}catch(a){const r=await I(a),o=(i=(e=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:e.errors)==null?void 0:i[0];v.value=r||(o?`${t.value.rowLabel} ${o.row}: ${o.error}`:"")||(a==null?void 0:a.message)||t.value.importFailed}finally{m.value=!1}}async function I(l){var i,a,r;const e=(i=l==null?void 0:l.response)==null?void 0:i.data;if(e&&typeof Blob<"u"&&e instanceof Blob)try{const o=await e.text();if(!o)return(l==null?void 0:l.message)||"";try{const k=JSON.parse(o);if(k!=null&&k.detail)return String(k.detail)}catch{}return A(o)?E(o)?`${t.value.apiNotFound} (${_()}).`:`${t.value.unexpectedHtml} (${_()}).`:o}catch{}if(typeof e=="string"&&e.trim()){const o=e.trim();return A(o)?E(o)?`${t.value.apiNotFound} (${_()}).`:`${t.value.unexpectedHtml} (${_()}).`:o}return((r=(a=l==null?void 0:l.response)==null?void 0:a.data)==null?void 0:r.detail)||(l==null?void 0:l.message)||""}async function B(l,e){const{blob:i,filename:a}=await z({lang:l,format:e}),r=window.URL.createObjectURL(i),o=document.createElement("a");o.href=r,o.download=a||`content-manager-import-template-${l}.${e}`,document.body.appendChild(o),o.click(),o.remove(),window.URL.revokeObjectURL(r)}async function D(l){var e;v.value="",g.value="",f.value=l;try{await B(l,"xlsx"),g.value=t.value.templateDownloaded}catch(i){const a=await I(i),r=Number(((e=i==null?void 0:i.response)==null?void 0:e.status)||0),o=String(a||"").toLowerCase();if(r>=500||o.includes("openpyxl")||o.includes("xlsx"))try{await B(l,"csv"),g.value=t.value.xlsxFallback;return}catch(j){const q=await I(j);v.value=q||t.value.templateDownloadFailed;return}v.value=a||t.value.templateDownloadFailed}finally{f.value=""}}function N(){T.push({name:"contentManager"})}return Y(()=>{Z(),G.value||T.push("/dashboard")}),(l,e)=>(b(),S("section",{class:"container-page py-8",dir:H.value?"rtl":"ltr"},[s(W,{class:"ck-panel pa-5 pa-sm-7 rounded-xl"},{default:d(()=>{var i;return[u("div",le,[u("div",null,[e[4]||(e[4]=u("div",{class:"text-overline text-secondary font-weight-bold"},"CatchKar",-1)),u("h1",oe,n(t.value.title),1),u("p",ne,n(t.value.subtitle),1)]),s(L,{variant:"outlined",class:"ck-pill",loading:m.value,onClick:N},{default:d(()=>[c(n(t.value.back),1)]),_:1},8,["loading"])]),v.value?(b(),$(y,{key:0,type:"error",variant:"tonal",class:"mt-4"},{default:d(()=>[c(n(v.value),1)]),_:1})):x("",!0),g.value?(b(),$(y,{key:1,type:"success",variant:"tonal",class:"mt-4"},{default:d(()=>[c(n(g.value),1)]),_:1})):x("",!0),s(y,{type:"info",variant:"tonal",class:"mt-4"},{default:d(()=>[u("span",{innerHTML:t.value.requiredColumnsHtml},null,8,ie)]),_:1}),s(Q,{modelValue:w.value,"onUpdate:modelValue":e[0]||(e[0]=a=>w.value=a),class:"mt-4",rules:[U],label:t.value.fileInputLabel,placeholder:t.value.fileInputPlaceholder,accept:".csv,.xlsx","prepend-icon":"$upload",density:"comfortable"},{selection:d(({fileNames:a})=>[u("span",de,n(a!=null&&a.length?`${t.value.selectedFilePrefix}${a.join(R.value==="fa"?"? ":", ")}`:t.value.noFileSelected),1)]),_:1},8,["modelValue","rules","label","placeholder"]),u("div",re,[s(L,{variant:"outlined",disabled:m.value||!!f.value,loading:f.value==="de",onClick:e[1]||(e[1]=a=>D("de"))},{default:d(()=>[c(n(t.value.templateDe),1)]),_:1},8,["disabled","loading"]),s(L,{variant:"outlined",disabled:m.value||!!f.value,loading:f.value==="en",onClick:e[2]||(e[2]=a=>D("en"))},{default:d(()=>[c(n(t.value.templateEn),1)]),_:1},8,["disabled","loading"]),s(L,{variant:"outlined",disabled:m.value||!!f.value,loading:f.value==="fa",onClick:e[3]||(e[3]=a=>D("fa"))},{default:d(()=>[c(n(t.value.templateFa),1)]),_:1},8,["disabled","loading"]),s(L,{color:"primary",disabled:!C.value||m.value,loading:m.value,onClick:M},{default:d(()=>[c(n(t.value.startImport),1)]),_:1},8,["disabled","loading"])]),p.value?(b(),S("div",se,[s(P,{color:"success",class:"ma-1"},{default:d(()=>[c(n(t.value.createdLabel)+n(p.value.created),1)]),_:1}),s(P,{color:"info",class:"ma-1"},{default:d(()=>[c(n(t.value.updatedLabel)+n(p.value.updated),1)]),_:1}),s(P,{color:"warning",class:"ma-1"},{default:d(()=>[c(n(t.value.skippedLabel)+n(p.value.skipped),1)]),_:1}
1),(i=p.value.errors)!=null&&i.length?(b(),$(y,{key:0,type:"error",variant:"outlined",class:"mt-3"},{default:d(()=>[u("div",null,n(t.value.errorsLabel)+" ("+n(p.value.errors.length)+"):",1),u("ul",null,[(b(!0),S(ee,null,ae(p.value.errors,(a,r)=>(b(),S("li",{key:r},n(t.value.rowLabel)+" "+n(a.row)+": "+n(a.error),1))),128))])]),_:1})):x("",!0)])):x("",!0)]}),_:1})],8,te))}};export{ge as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.