2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{_ as ve}from"./BasicMainCard-6a209b66.js";import{_ as fe}from"./BasicModal.vue_vue_type_style_index_0_lang-5906452a.js";import{_ as be}from"./BasicTextArea.vue_vue_type_style_index_0_lang-59a988dc.js";import{_ as ge,u as V}from"./useBaseTable-36a578d2.js";import{_ as xe}from"./BasicInput.vue_vue_type_style_index_0_lang-1d8eafa9.js";import{_ as ye}from"./button.vue_vue_type_style_index_0_lang-8d279d3c.js";import{I as R}from"./Icon-66e4762f.js";import{_ as he}from"./InputDatePicker.vue_vue_type_script_setup_true_lang-ca333a85.js";import{t as we,a as Se}from"./useDataTime-9d6aa2eb.js";import{H as c,_ as Te,d as ke,g as m,K as D,h as qe,v as Ie,o as K,c as J,b as a,w as d,a as n,e as C,j as p,E as W,k as Ee,C as _}from"./index-23e11ebb.js";import{T as X}from"./index-edb526a6.js";import{M as G}from"./index-9227ec88.js";import{S as z}from"./fa_IR-7046f8f0.js";import{T as U}from"./shallowequal-c0c30dbc.js";import"./_plugin-vue_export-helper-80f83411.js";import"./index-1da12123.js";import"./Col-2dd17677.js";import"./vnode-c21a367b.js";import"./isPlainObject-b53c2fec.js";import"./index-1e67613f.js";import"./index-956ab9e6.js";import"./FormItemContext-28dcc8c8.js";import"./useState-9bab46e8.js";import"./lodash-94e4bf0b.js";import"./index-464e86be.js";import"./pickAttrs-deed8a82.js";import"./toArray-b4b91f87.js";import"./usePrice-7afab779.js";import"./useRefs-c7f510f3.js";const Oe=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:e=>e.record.index+1},{title:"ارسالکننده",dataIndex:"submitter_name",key:"submitter_name",width:120},{title:"منبع",dataIndex:"template_source",key:"template_source",width:100},{title:"سوال",dataIndex:"question_text",key:"question_text"},{title:"گزینه ۱",dataIndex:"option1_text",key:"option1_text",width:120},{title:"گزینه ۲",dataIndex:"option2_text",key:"option2_text",width:120},{title:"تاریخ ارسال",dataIndex:"created_at",key:"created_at",width:130,customRender:e=>we(e.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center",width:120}],Pe=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:e=>e.record.index+1},{title:"سوال",dataIndex:"question_text",key:"question_text"},{title:"گزینه ۱",dataIndex:"option1_text",key:"option1_text",width:110},{title:"گزینه ۲",dataIndex:"option2_text",key:"option2_text",width:110},{title:"پاسخ صحیح",dataIndex:"correct_option",key:"correct_option",width:90,align:"center",customRender:e=>`گزینه ${e.record.correct_option}`},{title:"ترتیب",dataIndex:"sort_order",key:"sort_order",width:70,align:"center",customRender:e=>(e.record.sort_order??0)+1},{title:"تاریخ انتشار",dataIndex:"publish_date",key:"publish_date",width:120,customRender:e=>Se(e.record.publish_date)},{title:"طراح",dataIndex:"designer_name",key:"designer_name",width:110,customRender:e=>e.record.designer_user_id?e.record.designer_name||"کاربر":"-"},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center",width:100}];function H(e){var l;if(!e)return"خطا در ذخیره سوال";const i=e;return String(i.message??((l=i.error)==null?void 0:l.message)??"")||"خطا در ذخیره سوال"}function M(e){throw new Error(H(e))}const f={BASE_POINTS:"daily_question_base_points",SUBSCRIPTION_BONUS:"daily_question_subscription_bonus",SUBMISSION_REWARD:"daily_question_submission_reward",TEMPLATE_PREFIX:"daily_question_template_prefix",TEMPLATE_SOURCES:"daily_question_template_sources"};function Re(e){if(!e)return[];try{const i=JSON.parse(e);return Array.isArray(i)?i.map(String):[]}catch{return e.split(",").map(i=>i.trim()).filter(Boolean)}}async function Ce(){const{data:e,error:i}=await c.from("configs").select("key, value").in("key",Object.values(f));if(i)throw i;const r=Object.fromEntries((e||[]).map(l=>[l.key,l.value]));return{base_points:Number(r[f.BASE_POINTS]??10),subscription_bonus:Number(r[f.SUBSCRIPTION_BONUS]??5),submission_reward:
|