[쇼룸] 스케쥴 관리 yaml

셀렉트 쇼룸의 스케쥴 관리 페이지 YAML 코드입니다.

궁금한 점은 댓글이나 이메일, 서비스 내 채팅, 슬랙 등으로 편하게 문의주세요. 감사합니다.

menus:
  - path: schedule-manager
    name: 📅     스케쥴 관리
pages:
  - path: schedule-manager
    # class: container
    title: 스케쥴 관리
    subtitle: 광고 집행이 가능한 스케쥴을 확인할 수 있습니다.  
    blocks:             
      - type: top
        style:
          minHeight: 350px
        blocks:
          - type: tab
            tabOptions:
              autoload: 1
              tabs:
              - name: 대기중
                blocks:
                - type: query
                  name: 신청 내역
                  resource: mysql.qa
                  sqlType: select
                  sql: >
                    select r.status, r.id, r.created_at, r.start_date, r.end_date, r.product_id, p.name as product_name, r.account_id, a.name as account_name
                    from AdRequest as r
                      left join AdProduct as p on r.product_id = p.id
                      left join AdAccount as a on r.account_id = a.id
                      where r.status <> '상담완료'
                  paginationOptions:
                    enabled: true
                    perPage: 3
                  columns:
                    id:
                      label: ID
                      maxWidth: 200px
                    product_name:
                      label: 상품 이름
                    account_name:
                      label: 계정 이름
                    start_date:
                      label: 시작일
                      formatFn: date
                      maxWidth: 200px
                    end_date:
                      label: 종료일
                      formatFn: date
                      maxWidth: 200px
                    product_id:
                      label: 상품ID
                      maxWidth: 200px              
                    account_id:
                      label: 계정ID
                      maxWidth: 200px
                    status:
                      label: 상태
                      width: 180px
                      dropdown:
                        - 신청됨
                        - 상담중
                        - 상담완료
                      color:
                        신청됨: yellow
                        상담중: green
                        상담완료: blue
                      updateOptions:
                        type: query
                        resource: mysql.qa
                        sql: update AdRequest set status = :value where id = :id
                        params:
                          - key: id
                            valueFromRow: id
                    created_at:
                      label: 생성일
                      width: 200px

              - name: 상담완료
                blocks:

                - type: query
                  name: 신청 내역
                  resource: mysql.qa
                  sqlType: select
                  sql: >
                    select r.status, r.id, r.created_at, r.start_date, r.end_date, r.product_id, p.name as product_name, r.account_id, a.name as account_name
                    from AdRequest as r
                      left join AdProduct as p on r.product_id = p.id
                      left join AdAccount as a on r.account_id = a.id
                      where r.status = '상담완료'
                  paginationOptions:
                    enabled: true
                    perPage: 3
                  columns:
                    id:
                      label: ID
                      maxWidth: 200px
                    product_name:
                      label: 상품 이름
                    account_name:
                      label: 계정 이름
                    start_date:
                      label: 시작일
                      formatFn: date
                      maxWidth: 200px
                    end_date:
                      label: 종료일
                      formatFn: date
                      maxWidth: 200px
                    product_id:
                      label: 상품ID
                      maxWidth: 200px              
                    account_id:
                      label: 계정ID
                      maxWidth: 200px
                    status:
                      label: 상태
                      width: 180px
                      dropdown:
                        - 신청됨
                        - 상담중
                        - 상담완료
                      color:
                        신청됨: yellow
                        상담중: green
                        상담완료: blue
                      updateOptions:
                        type: query
                        resource: mysql.qa
                        sql: update AdRequest set status = :value where id = :id
                        params:
                          - key: id
                            valueFromRow: id
                    created_at:
                      label: 생성일
                      width: 200px

              - name: 전체
                blocks:
                - type: query
                  name: 신청 내역
                  resource: mysql.qa
                  sqlType: select
                  sql: >
                    select r.status, r.id, r.created_at, r.start_date, r.end_date, r.product_id, p.name as product_name, r.account_id, a.name as account_name
                    from AdRequest as r
                      left join AdProduct as p on r.product_id = p.id
                      left join AdAccount as a on r.account_id = a.id
                  paginationOptions:
                    enabled: true
                    perPage: 3
                  columns:
                    id:
                      label: ID
                      maxWidth: 200px
                    product_name:
                      label: 상품 이름
                    account_name:
                      label: 계정 이름
                    start_date:
                      label: 시작일
                      formatFn: date
                      maxWidth: 200px
                    end_date:
                      label: 종료일
                      formatFn: date
                      maxWidth: 200px
                    product_id:
                      label: 상품ID
                      maxWidth: 200px              
                    account_id:
                      label: 계정ID
                      maxWidth: 200px
                    status:
                      label: 상태
                      width: 180px
                      dropdown:
                        - 신청됨
                        - 상담중
                        - 상담완료
                      color:
                        신청됨: yellow
                        상담중: green
                        상담완료: blue
                      updateOptions:
                        type: query
                        resource: mysql.qa
                        sql: update AdRequest set status = :value where id = :id
                        params:
                          - key: id
                            valueFromRow: id
                    created_at:
                      label: 생성일
                      width: 200px
      - type: bottom
        blocks:         
          - type: left
            title: 스케쥴 조회
            style: >
              width: 75%  
            blocks:
              - type: query
                resource: mysql.qa
                sqlType: select
                sql: >
                  select id, name, max_slot, display_location
                  from AdProduct
                  where (LENGTH(:product_id)=0 OR id = :product_id)
                showDownload: false                  
                display: col-2
                params:
                  - key: product_id
                    valueFromSearch: product_id
                submitButton:
                  hidden: true
                columns:
                  created_at:
                    hidden: true
                  id:
                    label: ID
                  name:
                    label: 상품 이름
                  display_location:
                    label: 위치
                  max_slot:
                    label: 최대 슬롯

              - type: query
                name: 스케쥴
                resource: mysql.qa
                sqlType: select
                sql: >
                  select status, id, start_date, end_date, product_id, account_id, creative_id
                  from AdSchedule
                  where (LENGTH(:product_id)=0 OR product_id = :product_id) 
                  and (
                    (start_date >= :daterange1 and start_date <= :daterange2)
                    or (end_date <= :daterange1 and end_date >= :daterange2)
                  )      
                  and (LENGTH(:account_id)=0 OR account_id = :account_id)
                  order by start_date asc
                paginationOptions: 
                  enabled: true
                  perPage: 3
                showDownload: false                  
                submitButton:
                  type: primary-light
                  label: 검색
                columns:
                  id:
                    label: ID
                    maxWidth: 200px
                  created_at:
                    label: 생성일
                  account_id:
                    label: 계정ID
                    maxWidth: 200px
                  product_id:
                    label: 상품ID
                    maxWidth: 200px
                  start_date:
                    label: 시작일
                    formatFn: date
                    maxWidth: 200px
                  end_date:
                    label: 종료일
                    formatFn: date
                    maxWidth: 200px
                  status:
                    label: 상태
                    width: 200px
                    dropdown: 
                      - 신청됨
                      - 검수 진행중
                      - 게시 예정
                    color:
                      신청됨: yellow
                      검수 진행중: purple
                      게시 예정: green
                    updateOptions:
                      type: query
                      resource: mysql.qa
                      sql: update AdSchedule set status = :value where id = :id
                      params:
                        - key: id
                          valueFromRow: id
                  creative_id:
                    label: 소재ID
                    maxWidth: 200px
                    hidden: true
                params:
                  - key: daterange
                    label: 기간
                    range: true
                    format: date
                    defaultValueFn: >
                      return [
                        moment().add(-1, 'year').format('YYYY-MM-DD'),
                        moment().add(30, 'day').format('YYYY-MM-DD')
                      ]
                    showButtons: true  
                    shortcuts:
                    - label: 리셋
                      reset: true
                    - label: 지난주
                      relative: true # 상대적으로 처리. 여러번 클릭 가능
                      from:
                        offset: -7 # 차이값 (오프셋)
                        period: day # 단위
                      to:
                        offset: -7
                        period: day
                    - label: 다음주
                      relative: true
                      from:
                        offset: 7
                        period: day
                      to:
                        offset: 7
                        period: day
                  - key: product_id
                    label: 광고 상품
                    radioButtonGroup: true
                    radio:
                      - value: ''
                        label: 전체
                      - value: 1
                        label: 검색창 광고
                      - value: 2
                        label: 상단 배너
                      - value: 3
                        label: 사이드 배너
                      - value: 4
                        label: 중앙 배너
                      - value: 5
                        label: 하단 배너
                  - key: account_id
                    label: 계정ID
                    datalist: true
                    datalistFromQuery:
                      type: query
                      resource: mysql.qa
                      sqlType: select
                      sql: >
                        SELECT id AS 'value', name as 'label' 
                        FROM AdAccount
                    datalistPreview: true

          - type: right 
            style:
              width: 25%
              border: 0
              margin-left: 1rem
              margin-top: 1rem
            blocks:
              - type: query
                name: 스케쥴 추가
                resource: mysql.qa
                sqlType: insert
                sql: >
                  INSERT INTO AdSchedule
                  SET start_date = :start_date,
                      end_date = :end_date,
                      product_id = :product_id,
                      account_id = :account_id
                reloadAfterSubmit: true
                params:
                  - key: start_date
                    format: date
                    label: 시작일
                  - key: end_date
                    format: date
                    label: 종료일
                  - key: product_id
                    label: 상품
                    datalistPreview: true
                    datalistFromQuery:
                      type: query
                      resource: mysql.qa
                      sqlType: select
                      sql: >
                        SELECT id AS 'value', name as 'label' 
                        FROM AdProduct
                  - key: account_id
                    label: 계정
                    datalistPreview: true
                    datalistFromQuery:
                      type: query
                      resource: mysql.qa
                      sqlType: select
                      sql: >
                        SELECT id AS 'value', name as 'label' 
                        FROM AdAccount                            
1개의 좋아요