<template>
  <div class="slds-scope">
    <div class="slds-card slds-theme_default">
      <!-- Header Bar -->
      <div class="slds-p-around_medium slds-border_bottom">
        <div class="slds-grid slds-grid_vertical-align-center">
          <!-- Filter Button -->
          <div class="slds-col slds-grow-none slds-col_bump-right">
            <lightning-button-icon
              icon-name="utility:filterList"
              onclick={openFilterModal}
            ></lightning-button-icon>
          </div>
          <!-- /Filter Button -->

          <!-- Title (Date Range) -->
          <div class="slds-col slds-text-align_center">
            <h1 class="slds-text-heading_medium slds-truncate">
              {formattedStartDate} - {formattedEndDate}
            </h1>
          </div>
          <!-- /Title (Date Range) -->

          <!-- Date Navigation -->
          <div class="slds-col slds-grow-none">
            <div class="slds-show_inline-block">
              <lightning-button-icon
                icon-name="utility:left"
                variant="border-filled"
                onclick={navigateToPrevious}
              ></lightning-button-icon>
              <lightning-button
                label="Today"
                onclick={navigateToToday}
              ></lightning-button>
              <lightning-button-icon
                icon-name="utility:right"
                variant="border-filled"
                onclick={navigateToNext}
              ></lightning-button-icon>
            </div>
            <div class="slds-show_inline-block">
              <lightning-input
                label="Date"
                type="date"
                name="select-date"
                variant="label-hidden"
                class="lwc-datepicker slds-m-left_small"
                value={datePickerString}
                onchange={navigateToDay}
              ></lightning-input>
            </div>
            <!-- View Select -->
            <div class="slds-show_inline-block">
              <lightning-combobox
                value={view.value}
                options={view.options}
                onchange={handleViewChange}
                variant="label-hidden"
                class="slds-m-left_small"
              ></lightning-combobox>
              <!-- /View Select -->
            </div>
          </div>
          <!-- /Date Navigation -->
        </div>
        <!-- Filter Status -->
        <div if:true={_filterData.message} class="slds-m-top_x-small">
          <p class="slds-text-body_small slds-text-color_weak">
            {_filterData.message}
          </p>
        </div>
        <!-- /Filter Status -->
      </div>
      <!-- /Header Bar -->

      <!-- Gantt Chart -->
      <div class="slds-scrollable_x">
        <div class="slds-p-around_medium lwc-chart_container">
          <!-- Timeline -->
          <div class="slds-grid lwc-timeline">
            <div
              if:false={isResourceView}
              class="slds-col slds-size_1-of-6 slds-align-bottom "
            >
              <div class="slds-text-heading_medium slds-p-around_small">
                Resources
              </div>
            </div>
            <div class="slds-col">
              <div class="slds-grid">
                <template for:each={dates} for:item="date">
                  <div
                    key={date}
                    class="slds-col lwc-timeline_month-container"
                    style={date.style}
                  >
                    <div class="slds-grid">
                      <div class="slds-col slds-has-flexi-truncate">
                        <div
                          class="lwc-timeline_month slds-p-around_xx-small slds-theme_shade slds-text-align_center slds-text-color_weak slds-text-body_small slds-m-horizontal_x-small slds-truncate"
                        >
                          {date.name}
                        </div>
                      </div>
                    </div>
                    <div class="slds-grid">
                      <template for:each={date.days} for:item="day">
                        <div key={day} class={day.class}>
                          <div if:true={day.dayName}>{day.dayName}</div>
                          <div>{day.label}</div>
                        </div>
                      </template>
                    </div>
                  </div>
                </template>
              </div>
            </div>
          </div>
          <!-- /Timeline -->

          <!-- Allocation Table -->
          <!-- Resource Rows -->
          <template if:true={resources.length}>
            <template for:each={resources} for:item="resource">
              <c-gantt_chart_resource
                key={resource.Id}
                class="lwc-resource-component"
                is-resource-view={isResourceView}
                resource={resource}
                project-id={projectId}
                date-increment={view.slotSize}
                start-date={startDate}
                end-date={endDate}
                onrefresh={handleRefresh}
              ></c-gantt_chart_resource>
            </template>
          </template>
          <!-- /Resource Rows -->

          <!-- Empty State -->
          <div
            if:false={resources.length}
            class="slds-text-align_center slds-p-around_medium"
          >
            <span class="slds-text-color_weak">No Resources to Show</span>
          </div>
          <!-- /Empty State -->
          <!-- /Allocation Table -->

          <!-- Add Resource Button -->
          <div if:true={isProjectView} class="slds-m-top_medium">
            <lightning-button
              variant="neutral"
              label="Add Resource"
              icon-name="utility:add"
              onclick={openAddResourceModal}
            ></lightning-button>
          </div>
          <!-- /Add Resource Button -->
        </div>
      </div>
      <!-- /Gantt Chart -->
    </div>
  </div>

  <!-- Modals -->
  <!-- Add Resource Modal -->
  <c-gantt_chart_modal class="resource-modal">
    <span slot="title">Add Resource</span>
    <div slot="body" class="slds-form slds-form_stacked">
      <lightning-combobox
        label="Who is working on this?"
        options={resourceModalData.resources}
        placeholder="-- Select Resource --"
        onchange={handleResourceSelect}
      ></lightning-combobox>
    </div>
    <lightning-button
      slot="footer"
      variant="brand"
      label="Add Resource"
      onclick={addResourceById}
      class="slds-m-left_xx-small"
      disabled={resourceModalData.disabled}
    ></lightning-button>
  </c-gantt_chart_modal>
  <!-- /Add Resource Modal -->

  <!-- Filter Modal -->
  <c-gantt_chart_modal class="filter-modal" onclick={hideDropdowns}>
    <span slot="title">Filter</span>
    <div slot="body" class="slds-form slds-form_stacked">
      <div class="slds-text-align_right">
        <lightning-button
          label="Remove All"
          variant="base"
          onclick={clearFilters}
          disabled={filterModalData.disabled}
        ></lightning-button>
      </div>


      <div if:false={isProjectView} class="slds-form-element">
        <lightning-input
          type="search"
          label="Project"
          name="project-search"
          value={filterModalData.projectSearch}
          onchange={filterProjects}
          onfocus={filterProjects}
          onblur={clearFocus}
        ></lightning-input>
        <div
          if:true={filterModalData.projectOptions.length}
          class="slds-dropdown slds-dropdown_fluid slds-scrollable_y"
          role="listbox"
        >
          <ul class="slds-listbox slds-listbox_vertical" role="presentation">
            <template
              for:each={filterModalData.projectOptions}
              for:item="project"
            >
              <li
                key={project}
                role="presentation"
                class="slds-listbox__item"
              >
                <div
                  onclick={addProjectFilter}
                  data-id={project.Id}
                  data-name={project.Name}
                  class="slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta"
                  role="option"
                >
                  {project.Name}
                </div>
              </li>
            </template>
          </ul>
        </div>
        <template
          for:each={filterModalData.projects}
          for:item="project"
          for:index="index"
        >
          <lightning-pill
            key={project.name}
            value={project.name}
            label={project.name}
            onremove={removeProjectFilter}
            data-index={index}
          ></lightning-pill>
        </template>
      </div>

      <div if:false={isResourceView} class="slds-form-element">
        <lightning-input
          type="search"
          label="Role"
          name="role-search"
          value={filterModalData.roleSearch}
          onchange={filterRoles}
          onfocus={filterRoles}
          onblur={clearFocus}
        ></lightning-input>
        <div
          if:true={filterModalData.roleOptions.length}
          class="slds-dropdown slds-dropdown_fluid slds-scrollable_y"
          role="listbox"
        >
          <ul class="slds-listbox slds-listbox_vertical" role="presentation">
            <template for:each={filterModalData.roleOptions} for:item="role">
              <li key={role} role="presentation" class="slds-listbox__item">
                <div
                  onclick={addRoleFilter}
                  data-role={role}
                  class="slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta"
                  role="option"
                >
                  {role}
                </div>
              </li>
            </template>
          </ul>
        </div>
        <template
          for:each={filterModalData.roles}
          for:item="role"
          for:index="index"
        >
          <lightning-pill
            key={role}
            value={role}
            label={role}
            onremove={removeRoleFilter}
            data-index={index}
          ></lightning-pill>
        </template>
      </div>

      <lightning-combobox
        value={filterModalData.status}
        label="Status"
        options={filterModalData.statusOptions}
        onchange={setStatusFilter}
      ></lightning-combobox>
    </div>
    <lightning-button
      slot="footer"
      variant="brand"
      label="Apply"
      onclick={applyFilters}
      class="slds-m-left_xx-small"
    ></lightning-button>
  </c-gantt_chart_modal>
  <!-- /Filter Modal -->
  <!-- /Modals -->
</template>
 

HTML Online Editor & Compiler

Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML. You can also specify the stylesheet information in styles.css tab and scripts information in scripts.js tab and start coding.

About HTML

HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.

Syntax help

Fundamentals

  • Any HTML document must start with document declaration <!DOCTYPE html>
  • HTML documents begin with <html> and ends with </html>
  • Headings are defined with <h1> to <h6> where <h1> is the highest important heading and <h6> is the least important sub-heading.
  • Paragrahs are defined in <p>..</p> tag.
  • Links are defined in <a> tag.

    Example:

    <a href="https://onecompiler.com/html">HTML online compiler</a>
    
  • Images are defined in <img> tag, where src attribute consists of image name.
  • Buttons are defined in <button>..</button> tag
  • Lists are defined in <ul> for unordered/bullet list and <ol> for ordered/number list, and the list items are defined in <li>.

HTML Elements and Attributes

  • HTML element is everything present from start tag to end tag.
  • The text present between start and end tag is called HTML element content.
  • Anything can be a tagname but it's preferred to put the meaningful title to the content present as tag name.
  • Do not forget the end tag.
  • Elements with no content are called empty elements.
  • Elements can have attributes which provides additional information about the element.
  • In the below example, href is an attribute and a is the tag name.

    Example:

    <a href="https://onecompiler.com/html">HTML online compiler</a>
    

CSS

CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.

Example:

Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.

body{
  padding: 25px;
}
.title {
	color: #228B22;
	font-family: Candara;
}

HTML Tables

  • HTML Tables are defined in <table> tag.
  • Table row should be defined in <tr> tag
  • Table header should be defined in <th> tag
  • Table data should be defined in <td> tag
  • Table caption should be defined in <caption> tag

HTML-Javascript

  • Javascript is used in HTML pages to make them more interactive.
  • <script> is the tag used to write scripts in HTML
  • You can either reference a external script or write script code in this tag.

Example

<script src="script.js"></script>