Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

245 Zeilen
4.5 KiB

  1. import apollo from "../../lib/apollo.js";
  2. async function getTransaction(token = "") {
  3. var res = await apollo.query(
  4. `
  5. query {
  6. transactions{
  7. id
  8. order_id
  9. cust_name
  10. cust_telp
  11. cust_address
  12. product_img{
  13. url
  14. }
  15. product_name
  16. product_color
  17. product_quantity
  18. product_courier
  19. product_price
  20. }
  21. }`,
  22. token
  23. );
  24. return res;
  25. }
  26. async function getTransactionUnpaid(token = "") {
  27. var res = await apollo.query(
  28. `
  29. query {
  30. transactions(where: { status: "1" }){
  31. id
  32. order_id
  33. cust_name
  34. cust_telp
  35. cust_address
  36. product_img{
  37. url
  38. }
  39. product_name
  40. product_color
  41. product_quantity
  42. product_courier
  43. product_price
  44. }
  45. }`,
  46. token
  47. );
  48. return res;
  49. }
  50. async function PayTransactionUnpaid(token = "") {
  51. var res = await apollo.query(
  52. `
  53. query{
  54. transactions(where: { status: "1" }){
  55. id
  56. order_id
  57. cust_name
  58. cust_telp
  59. cust_address
  60. product_img{
  61. url
  62. }
  63. product_name
  64. product_color
  65. product_quantity
  66. product_courier
  67. product_price
  68. }
  69. }
  70. `,
  71. token
  72. );
  73. return res;
  74. }
  75. async function getTransactionPrepared(token = "") {
  76. var res = await apollo.query(
  77. `
  78. query {
  79. transactions(where: { status: "2" }){
  80. id
  81. order_id
  82. cust_name
  83. cust_telp
  84. cust_address
  85. product_img{
  86. url
  87. }
  88. product_name
  89. product_color
  90. product_quantity
  91. product_courier
  92. product_price
  93. }
  94. }`,
  95. token
  96. );
  97. return res;
  98. }
  99. async function getTransactionSending(token = "") {
  100. var res = await apollo.query(
  101. `
  102. query {
  103. transactions(where: { status: "3" }){
  104. id
  105. order_id
  106. cust_name
  107. cust_telp
  108. cust_address
  109. product_img{
  110. url
  111. }
  112. product_name
  113. product_color
  114. product_quantity
  115. product_courier
  116. product_price
  117. }
  118. }`,
  119. token
  120. );
  121. return res;
  122. }
  123. async function getTransactionFinished(token = "") {
  124. var res = await apollo.query(
  125. `
  126. query {
  127. transactions(where: { status: "4" }){
  128. id
  129. order_id
  130. cust_name
  131. cust_telp
  132. cust_address
  133. product_img{
  134. url
  135. }
  136. product_name
  137. product_color
  138. product_quantity
  139. product_courier
  140. product_price
  141. }
  142. }`,
  143. token
  144. );
  145. return res;
  146. }
  147. async function newTransactionYamaha(content, token = "") {
  148. var res = await apollo.mutation(
  149. `
  150. mutation($input : TransactionInput!){
  151. createTransaction( input:{data:$input} )
  152. {
  153. transaction{
  154. id
  155. }
  156. }
  157. }
  158. `,
  159. token,
  160. {
  161. input: content,
  162. }
  163. );
  164. return res;
  165. }
  166. async function newTransactionSuzuki(content, token = "") {
  167. var res = await apollo.mutation(
  168. `
  169. mutation($input : TransactionInput!){
  170. createTransaction( input:{data:$input} )
  171. {
  172. transactionSuzuki{
  173. id
  174. }
  175. }
  176. }
  177. `,
  178. token,
  179. {
  180. input: content,
  181. }
  182. );
  183. return res;
  184. }
  185. async function newTransactionHonda(content, token = "") {
  186. var res = await apollo.mutation(
  187. `
  188. mutation($input : TransactionInput!){
  189. createTransaction( input:{data:$input} )
  190. {
  191. transactionHonda{
  192. id
  193. }
  194. }
  195. }
  196. `,
  197. token,
  198. {
  199. input: content,
  200. }
  201. );
  202. return res;
  203. }
  204. async function newTransactionHino(content, token = "") {
  205. var res = await apollo.mutation(
  206. `
  207. mutation($input : TransactionInput!){
  208. createTransaction( input:{data:$input} )
  209. {
  210. transactionHino{
  211. id
  212. }
  213. }
  214. }
  215. `,
  216. token,
  217. {
  218. input: content,
  219. }
  220. );
  221. return res;
  222. }
  223. module.exports = {
  224. newTransactionYamaha: newTransactionYamaha,
  225. newTransactionSuzuki: newTransactionSuzuki,
  226. newTransactionHonda: newTransactionHonda,
  227. newTransactionHino: newTransactionHino,
  228. getTransaction: getTransaction,
  229. getTransactionUnpaid: getTransactionUnpaid,
  230. PayTransactionUnpaid: PayTransactionUnpaid,
  231. getTransactionPrepared: getTransactionPrepared,
  232. getTransactionSending: getTransactionSending,
  233. getTransactionFinished: getTransactionFinished,
  234. };