Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* eslint-disable */
  2.  
  3. import {sanitizeString} from '@@/pocket/fn';
  4.  
  5. export const state = () => ({
  6.   searchDossiersEnCours: '',
  7.   selectedUserKey: '',
  8.   tableHeaders: [
  9.     {text: 'Dossier', align: 'left', sortable: false, value: 'id'},
  10.     {text: 'Client', align: 'left', sortable: true, value: 'client'},
  11.     {text: 'Mission', align: 'left', sortable: true, value: 'mission'},
  12.     {
  13.       text: 'Type',
  14.       align: 'left',
  15.       sortable: true,
  16.       value: 'type',
  17.     },
  18.     {text: 'Demandeur', align: 'left', sortable: true, value: 'demandeur'},
  19.     {
  20.       text: 'Validateur',
  21.       align: 'left',
  22.       sortable: true,
  23.       value: 'validateur',
  24.     },
  25.     {text: 'Associé', align: 'left', sortable: true, value: 'associe'},
  26.     // {
  27.     //   text: 'Statut',
  28.     //   align: 'left',
  29.     //   sortable: true,
  30.     //   value: 'statut',
  31.     // },
  32.     {text: 'Actions', align: 'left', sortable: false, value: 'actions'},
  33.   ],
  34.   tableData: [
  35.     {
  36.       id: '37350',
  37.       client: 'PHARMACIE VENOIX',
  38.       mission: '2018-08',
  39.       debutPeriode: '2018-08',
  40.       finPeriode: '2018-08',
  41.       type: 'Situation',
  42.       demandeur: 'J.BOISSEL',
  43.       validateur: 'J.BOISSEL',
  44.       associe: 'E.BATTEUR',
  45.       statut: 0,
  46.       modification: '2018-11-26 à 9H57',
  47.       actions: '',
  48.       commentaires: '',
  49.       documents: [],
  50.       destinataires: [],
  51.       juridique: {},
  52.       facturation: {},
  53.       suiviMission: {},
  54.     },
  55.     {
  56.       id: '42263',
  57.       client: 'ERIADIS',
  58.       mission: '2018-08',
  59.       debutPeriode: '2018-08',
  60.       finPeriode: '2018-08',
  61.       type: 'Bilan',
  62.       demandeur: 'J.BOISSEL',
  63.       validateur: 'A.JAN',
  64.       associe: 'E.BATTEUR',
  65.       statut: -1,
  66.       modification: '2019-03-06 à 11H25',
  67.       actions: '',
  68.       commentaires: '',
  69.       documents: [],
  70.       destinataires: [],
  71.       juridique: {},
  72.       facturation: {},
  73.       suiviMission: {},
  74.     },
  75.     {
  76.       id: '92105',
  77.       client: 'ENFANTILLAGE',
  78.       mission: '2018-08',
  79.       debutPeriode: '2018-08',
  80.       finPeriode: '2018-08',
  81.       type: 'Bilan',
  82.       demandeur: 'J.AKAKPO',
  83.       validateur: 'A.JAN',
  84.       associe: 'E.BATTEUR',
  85.       statut: 1,
  86.       modification: '2019-03-25 à 09H35',
  87.       actions: '',
  88.       commentaires: '',
  89.       documents: [],
  90.       destinataires: [],
  91.       juridique: {},
  92.       facturation: {},
  93.       suiviMission: {},
  94.     },
  95.     {
  96.       id: '92240',
  97.       client: 'FAVEDIST',
  98.       mission: '2018-08',
  99.       debutPeriode: '2018-08',
  100.       finPeriode: '2018-08',
  101.       type: 'Situation',
  102.       demandeur: 'J.BOISSEL',
  103.       validateur: 'A.JAN',
  104.       associe: 'M.LEROUX',
  105.       statut: 3,
  106.       modification: '2019-03-06 à 14H12',
  107.       actions: '',
  108.       commentaires: '',
  109.       documents: [],
  110.       destinataires: [],
  111.       juridique: {},
  112.       facturation: {},
  113.       suiviMission: {},
  114.     },
  115.     {
  116.       id: '63660',
  117.       client: 'HORTENSE SYLVAIN',
  118.       mission: '2018-08',
  119.       debutPeriode: '2018-08',
  120.       finPeriode: '2018-08',
  121.       type: 'Bilan',
  122.       demandeur: 'J.AKAKPO',
  123.       validateur: 'J.BOISSEL',
  124.       associe: 'M.LEROUX',
  125.       statut: 2,
  126.       modification: '2018-12-16 à 16H18',
  127.       actions: '',
  128.       commentaires: '',
  129.       documents: [],
  130.       destinataires: [],
  131.       juridique: {},
  132.       facturation: {},
  133.       suiviMission: {},
  134.     },
  135.   ],
  136.   dossiersATraiter: [
  137.     {
  138.       id: '92105',
  139.       client: 'ENFANTILLAGE',
  140.       mission: '2018-08',
  141.       debutPeriode: '2018-08',
  142.       finPeriode: '2018-08',
  143.       type: 'Bilan',
  144.       demandeur: 'J.AKAKPO',
  145.       validateur: 'A.JAN',
  146.       associe: 'E.BATTEUR',
  147.       statut: 1,
  148.       modification: '2019-03-25 à 09H35',
  149.       actions: '',
  150.       commentaires: '',
  151.       documents: [],
  152.       destinataires: [],
  153.       juridique: {},
  154.       facturation: {},
  155.       suiviMission: {},
  156.       comments: "<strong class='text--danger'>180</strong> jours après l'envoi limite de la liasse fiscale <br> (Mission: août 2018)",
  157.     },
  158.     {
  159.       id: '37350',
  160.       client: 'PHARMACIE VENOIX',
  161.       mission: '2018-08',
  162.       debutPeriode: '2018-08',
  163.       finPeriode: '2018-08',
  164.       type: 'Situation',
  165.       demandeur: 'J.BOISSEL',
  166.       validateur: 'J.BOISSEL',
  167.       associe: 'E.BATTEUR',
  168.       statut: 0,
  169.       modification: '2018-11-26 à 9H57',
  170.       actions: '',
  171.       commentaires: '',
  172.       documents: [],
  173.       destinataires: [],
  174.       juridique: {},
  175.       facturation: {},
  176.       suiviMission: {},
  177.       comments: "<strong class='text--danger'>180</strong> jours après l'envoi limite de la liasse fiscale <br> (Mission: août 2018)",
  178.     },
  179.     {
  180.       id: '42263',
  181.       client: 'ERIADIS',
  182.       mission: '2018-08',
  183.       debutPeriode: '2018-08',
  184.       finPeriode: '2018-08',
  185.       type: 'Bilan',
  186.       demandeur: 'J.BOISSEL',
  187.       validateur: 'A.JAN',
  188.       associe: 'E.BATTEUR',
  189.       statut: -1,
  190.       modification: '2019-03-06 à 11H25',
  191.       actions: '',
  192.       commentaires: '',
  193.       documents: [],
  194.       destinataires: [],
  195.       juridique: {},
  196.       facturation: {},
  197.       suiviMission: {},
  198.       comments: "<strong class='text--danger'>180</strong> jours après l'envoi limite de la liasse fiscale <br> (Mission: août 2018)",
  199.     },
  200.     {
  201.       id: '63660',
  202.       client: 'HORTENSE SYLVAIN',
  203.       mission: '2018-08',
  204.       debutPeriode: '2018-08',
  205.       finPeriode: '2018-08',
  206.       type: 'Bilan',
  207.       demandeur: 'J.AKAKPO',
  208.       validateur: 'J.BOISSEL',
  209.       associe: 'M.LEROUX',
  210.       statut: 2,
  211.       modification: '2018-12-16 à 16H18',
  212.       actions: '',
  213.       commentaires: '',
  214.       documents: [],
  215.       destinataires: [],
  216.       juridique: {},
  217.       facturation: {},
  218.       suiviMission: {},
  219.       comments: "<strong class='text--danger'>180</strong> jours après l'envoi limite de la liasse fiscale <br> (Mission: août 2018)",
  220.     },
  221.   ],
  222.   showFoldersFrom: 'forMe',
  223. });
  224.  
  225. export const actions = {};
  226.  
  227. export const getters = {
  228.   searchDossiersEnCours: state => state.searchDossiersEnCours,
  229.   showFoldersFrom: state => state.showFoldersFrom,
  230.   selectedUserKey: state => state.selectedUserKey,
  231.   tableHeaders: state => state.tableHeaders,
  232.   tableData: state => {
  233.     return [
  234.       ...state.tableData
  235.         .filter (_ => {
  236.           if (state.showFoldersFrom !== 'all' && !!state.selectedUserKey) {
  237.             return [
  238.               sanitizeString (_.demandeur),
  239.               sanitizeString (_.validateur),
  240.               sanitizeString (_.associe),
  241.             ].includes (sanitizeString (state.selectedUserKey));
  242.           }
  243.  
  244.           return true;
  245.         })
  246.         .filter (_ => {
  247.           return (
  248.             sanitizeString (_.id).includes (
  249.               sanitizeString (state.searchDossiersEnCours)
  250.             ) ||
  251.             sanitizeString (_.dossier).includes (
  252.               sanitizeString (state.searchDossiersEnCours)
  253.             ) ||
  254.             sanitizeString (_.client).includes (
  255.               sanitizeString (state.searchDossiersEnCours)
  256.             ) ||
  257.             sanitizeString (_.mission).includes (
  258.               sanitizeString (state.searchDossiersEnCours)
  259.             ) ||
  260.             sanitizeString (_.respClient).includes (
  261.               sanitizeString (state.searchDossiersEnCours)
  262.             )
  263.           );
  264.         }),
  265.     ];
  266.   },
  267.  
  268.   // Dossiers à traiter
  269.   dossiersATraiter: state => {
  270.     return [
  271.       ...state.dossiersATraiter
  272.         .filter (_ => {
  273.           if (state.showFoldersFrom !== 'all' && !!state.selectedUserKey) {
  274.             return [
  275.               sanitizeString (_.demandeur),
  276.               sanitizeString (_.validateur),
  277.               sanitizeString (_.associe),
  278.             ].includes (sanitizeString (state.selectedUserKey));
  279.           }
  280.  
  281.           return true;
  282.         })
  283.         .filter (_ => {
  284.           return (
  285.             sanitizeString (_.id).includes (
  286.               sanitizeString (state.searchDossiersEnCours)
  287.             ) ||
  288.             sanitizeString (_.dossier).includes (
  289.               sanitizeString (state.searchDossiersEnCours)
  290.             ) ||
  291.             sanitizeString (_.client).includes (
  292.               sanitizeString (state.searchDossiersEnCours)
  293.             ) ||
  294.             sanitizeString (_.mission).includes (
  295.               sanitizeString (state.searchDossiersEnCours)
  296.             ) ||
  297.             sanitizeString (_.respClient).includes (
  298.               sanitizeString (state.searchDossiersEnCours)
  299.             )
  300.           );
  301.         })
  302.         .concat ([{header: 'Missions à traiter'}]),
  303.     ].reverse ();
  304.   },
  305.  
  306.   // Avec un index du statut => le texte correspondant
  307.   statutText: (state, statutIndex) => {
  308.     return statutIndex => {
  309.       const map = {
  310.         '-1': 'A traiter',
  311.         0: 'Brouillon',
  312.         1: 'Validation',
  313.         2: 'Signature',
  314.         3: 'Finalisation',
  315.       };
  316.  
  317.       return map[statutIndex] || '';
  318.     };
  319.   },
  320.  
  321.   // Avec un index du statut => la couleur correspondante
  322.   statutColor: (state, statutIndex) => {
  323.     return statutIndex => {
  324.       const map = {
  325.         '-1': 'red',
  326.         0: '#607D8B',
  327.         1: 'info',
  328.         2: 'warning',
  329.         3: 'success',
  330.       };
  331.  
  332.       return map[statutIndex] || 'black';
  333.     };
  334.   },
  335.  
  336.   // Avec un index du statut => la valeur correspondante
  337.   statutValue: (state, statutIndex) => {
  338.     return statutIndex => {
  339.       const map = {
  340.         '-1': 5,
  341.         0: 20,
  342.         1: 35,
  343.         2: 65,
  344.         3: 85,
  345.       };
  346.  
  347.       return map[statutIndex] || 0;
  348.     };
  349.   },
  350.  
  351.   // Get modal data
  352.   modalData: state => {
  353.     return id => {
  354.       return {...state.tableData.filter (_ => _.id === id)[0]};
  355.     };
  356.   },
  357. };
  358.  
  359. export const mutations = {
  360.   UPDATE_SHOW_FOLDERS_FROM: (state, payload) => {
  361.     state.showFoldersFrom = payload.showFoldersFrom;
  362.     state.selectedUserKey = payload.selectedUserKey;
  363.   },
  364.   UPDATE_SEARCH_DOSSIERS_EN_COURS: (state, payload) => {
  365.     state.searchDossiersEnCours = payload.data;
  366.   },
  367. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement