<?php 

echo '<!-- left list -->
    <div class="col-lg-3 col-md-3 hidden-sm hidden-xs" >
        <div class="left-list">';
include "includes/e-shop-left-list.php";
echo    '</div>
    </div>
    <!-- end left list -->';

$cs_info_storage = [
    'about_products'=>
    [
        'en'=>
        [
            'table_name'=>'about_products_en',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'About Our Products',
                'listItem'=>[
                    [
                        'title'=>'What makes Sayvour special?',
                        'detail'=>'All Sayvour’s chocolates and delicacies are freshly handmade and using quality ingredients from around the world with no preservatives. You can design your personalized messages on Sayvour’s chocolates and cookies.'
                    ],
                    [
                        'title'=>'Where are Sayvour’s products manufactured?',
                        'detail'=>'Sayvour is a licensed specialty chocolate and pastry confectionery in Hong Kong. All our products are manufactured in Hong Kong. 
    <b>Food Factory License Number: 2951805796</b>'
                    ],
                    [
                        'title'=>'Are Sayvour’s chocolates and delicacies suitable for everyone?',
                        'detail'=>'Using natural ingredients from around the world, our chocolates and delicacies are freshly handmade with no preservatives, alcohol or animal fat, we therefore consider our products are suitable for vegetarians; however they may contains traces of nuts, milk, egg, gluten, soy and wheat. Therefore, we would not recommend any of our recipes for a recipient with nut allergies, gluten intolerant or vegans/lactose intolerant. Kindly note that our chocolates and delicacies are not certified Halal food.'
                    ]
                ]
            ]
        ],
        'zh'=>
        [
            'table_name'=>'about_products_zh',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'有關Sayvour的產品',
                'listItem'=>[
                    [
                        'title'=>'Sayvour有什麼過人之處？',
                        'detail'=>'Sayvour所有朱古力和甜點都是即叫即做，新鮮人手製作﹐並選取世界各地高質量材料、不添加防腐劑。您更可以為Sayvour的朱古力和甜點設計獨一無二的訊息。'
                    ],
                    [
                        'title'=>'Sayvour的產品在哪裡生產？',
                        'detail'=>'Sayvour是一家在香港的持牌食物製造工場，自家研發各種不同口味的朱古力及糕餅。所有產品均在香港生產。
    <b>食物製造廠牌照號碼: 2951805796</b>'
                    ],
                    [
                        'title'=>'Sayvour的朱古力和甜點是否適合所有人食用？',
                        'detail'=>'我們的朱古力和甜點選用世界各地的天然食材，全是新鮮人手製作，不使用防腐劑、酒精或動物脂肪，因此我們認為Sayvour的產品適合素食者食用；但是產品當中可能含有微量的果仁、牛奶、雞蛋、麵筋、大豆和小麥，所以我們不建議對於果仁或麵筋有過敏的人士，或嚴格素食主義者食用我們的產品。此外也請留意我們的朱古力和甜點並不是清真食品。'
                    ]
                ]
            ]
        ]
    ],
    'usage'=>
    [
        'en'=>
        [
            'table_name'=>'usage_en',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'Tips to enjoy our products',
                'listItem'=>[
                    [
                        'title'=>'How should I store Sayvour products?',
                        'detail'=>'Chocolate and confectionary products are freshly handmade with no added preservatives and should be kept in a cool and dry (temperature between 16℃ - 18℃ and humidity below 60%) place away from odor, sunlight and intense heat. '
                    ],
                    [
                        'title'=>'How can I extend the chocolates fresh tasting period?',
                        'detail'=>'Since all our products are handmade without preservatives, the fresh tasting period is within 2 weeks. Chocolate tablets can be extended a bit longer to around 1 month as long as they are well kept under 18℃ and the humidity should remain below 60%. '
                    ],
                    [
                        'title'=>'How to "thaw out" the chocolates once they are taken out of storage?',
                        'detail'=>'Keep chocolates in plastic bags until the entire package has attained room temperature. Approximate thawing times for one box are 2 hours from refrigerator while 6 hours from freezer. '
                    ]
                ]
            ]
        ],
        'zh'=>
        [
            'table_name'=>'usage_zh',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'享用Sayvour產品的注意事項',
                'listItem'=>[
                    [
                        'title'=>'如何存放Sayvour的產品？',
                        'detail'=>'朱古力和糕餅全是新鮮人手製作，不添加防腐劑，需要保存在陰涼乾爽的位置，遠離異味、陽光直照和高熱。溫度介乎攝氏16至18度之間，濕度在60%以下。'
                    ],
                    [
                        'title'=>'如何可以延長朱古力的保鮮期？',
                        'detail'=>'由於我們所有產品全是新鮮人手製作，不添加防腐劑，保鮮期為兩星期。 只要保存在攝氏18℃以下及濕度在60%以下，朱古力薄片可以延長保鮮期至一個月左右。'
                    ],
                    [
                        'title'=>'如何為朱古力解凍？',
                        'detail'=>'把朱古力連同膠袋一併放置在室溫下解凍。從雪柜拿出來的朱古力，一盒的解凍時間大約需要兩小時；從冰格拿出來的需要大約六小時。 '
                    ]
                ]
            ]
        ]
    ],
    'about_ordering_delivery'=>
    [
        'en'=>
        [
            'table_name'=>'about_ordering_delivery_en',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'About Ordering & Delivery',
                'listItem'=>[
                    [
                        'title'=>'How can I buy the products? Can I still place an order if I don’t have a credit card?',
                        'detail'=>'You can buy our products through our website. Please keep the confirmation email for reference. You are welcome to settle the payment by bank transfer, PayPal or credit card.  An auto-confirmation email will be sent to your designated email address in five minutes after you complete the online transaction.'
                    ],
                    [
                        'title'=>'Can I cancel my order or change the item after the order confirmation?',
                        'detail'=>'Since all our products are freshly handmade, your order will only be confirmed once the full payment is settled. Order cancellation or change of items is not accepted after full payment is done. There is no policy for returns and refund.
    '
                    ],
                    [
                        'title'=>'Can I order the products overseas?',
                        'detail'=>'For the time being, we can provide local delivery service only. We are striving for better service and products so please visit our website for any updates. '
                    ],
                    [
                        'title'=>'How can be the products kept fresh during the delivery?',
                        'detail'=>'All our chocolate and confectionary products are packed with great care and delivered by SF Express with door-to-door refrigerated delivery service, ensure our products are well kept under air-conditioned temperature (16℃ - 18℃) and humidity below 60%. Temperature sensors are installed in delivery trucks to ensure the temperature stability during transportation.'
                    ],
                    [
                        'title'=>'How can I track my order?',
                        'detail'=>'Please call +852 2951 0005 to confirm and track the delivery arrangements. Please refer to Delivery Service for More details of our delivery service.'
                    ]
                ]
            ]
        ],
        'zh'=>
        [
            'table_name'=>'about_ordering_delivery_zh',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'有關訂單及送貨',
                'listItem'=>[
                    [
                        'title'=>'如何購買產品？如果我沒有信用卡，我可以訂購嗎？',
                        'detail'=>'您可以透過我們的網站訂購產品。歡迎使用銀行過數、PayPal或信用卡付款。當您完成了網上交易程序，一張自動發送的確認書將於五分鐘內寄到你指定的電郵地址中。請保存此電郵書作參考。'
                    ],
                    [
                        'title'=>'我可以在確認訂單後，取消訂單或更改已訂購的項目嗎？',
                        'detail'=>'由於我們的產品都是即叫即做，新鮮人手製作，所以只有客人繳付全數金額後，訂單才為確定。一旦全數金額已付，我們恕不接受訂單取消或更改訂購項目。我們沒有退貨或退款政策。'
                    ],
                    [
                        'title'=>'我可以在海外訂購產品嗎？',
                        'detail'=>'我們暫時只提供本地送貨服務。我們一直致力於提供更好的服務和產品，請密切注意我們網站上最新資訊。'
                    ],
                    [
                        'title'=>'在送貨期間如何為產品保鮮？',
                        'detail'=>'所有朱古力和甜點均小心包裹妥當，並交由順豐速遞公司以冷凍送遞服務運送，確保我們的產品保存在冷氣溫度中(16℃ - 18℃)及濕度在60%以下。運送貨車上裝有溫度感應器，以確保運送期間的溫度穩定性。'
                    ],
                    [
                        'title'=>'如何查詢我的訂單進度？',
                        'detail'=>'請致電+852 2951 0005確定及跟進送貨安排。更多送貨服務詳情請參閱送貨服務。'
                    ]
                ]
            ]
        ]
    ],
    'delivery'=>
    [
        'en'=>
        [
            'table_name'=>'delivery_en',
            'table_content'=>[
                'preface'=>[
                    'title'=>'Delivery Service',
                    'detail'=>'All our products are made to order freshly by hand and will be delivered to your designated address according to your scheduled delivery time. The earliest delivery time will be in 2 days upon your confirmation by 4pm from Monday to Thursday; or in 3 days upon your confirmation by 4pm from Friday to Sunday. No delivery on Sunday and public holidays.'
                    ],
                'end'=>'',
                'list_title'=>'Delivery Details:',
                'listItem'=>[
                    [
                        'title'=>'',
                        'detail'=>'Refrigerated delivery fee: $38 per location in Hong Kong excluding remote areas (free delivery for purchases over $800)'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Sayvour reserves the right for additional delivery charges due to special circumstances.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'The order will only be confirmed once the payment is settled. The date of delivery may be affected if the transfer is delayed. '
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Delivery hours are between 9:00am to 7:00pm. No delivery on Sundays and public holidays.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Delivery will be suspended if black rain signal/ typhoon signal No. 8 or above is hoisted.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Sayvour takes no responsibility when late delivery is caused by majeure events.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Sayvour is not liable for any unsuccessful delivery due to incorrect or insufficient information provided by the customer/ recipient.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'All items are subject to change without prior notice.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'All terms and conditions are subject to change without prior notice. Sayvour reserves the right to make the final decision on all matters of dispute.'
                    ],
                ]
            ]
        ],
        'zh'=>
        [
            'table_name'=>'delivery_zh',
            'table_content'=>[
                'preface'=>[
                    'title'=>'送貨服務',
                    'detail'=>'Sayvour 採用冷凍送遞服務運送朱古力，所有產品均即叫即製，顧客凡於星期一至四下午4時前成功下單， 在一般情況下，禮品將於2日後送至府上；若於星期五、六、日下午4時前成功下單，禮品將於3日後送達。星期日及公眾假期不設送貨。'
                ],
                'end'=>'',
                'list_title'=>'送遞服務細則:',
                'listItem'=>[
                    [
                        'title'=>'',
                        'detail'=>'冷凍送遞服務收費：香港境內每程HK$38, 不包括偏遠地區 (購物滿HK$800免運費)'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'在特殊情況下， Sayvour 保留徵收額外運輸費用的權利。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'訂單在收妥付款後方為確認。若付款延誤，送遞時間會受影響。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'送貨時段由上午9時至晚上7時。星期日及公眾假期不設送貨。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'若遇上黑色暴雨警告/八號或以上風球懸掛，送遞服務將會暫停。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Sayvour不承擔任何由不可抗力事件導致延誤的責任。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Sayvour 不承擔任何因客戶/收件人提供不正確資料，而導致送遞不成功的責任。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'所有產品如有更改，恕不另行通知。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'所有條款及細則如有更改，恕不另行通知。Sayvour保留對所有爭議事項的最終決定權。'
                    ],
                ]
            ]
        ]
    ],
    'terms'=>
    [
        'en'=>
        [
            'table_name'=>'terms_en',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'Terms & Conditions',
                'listItem'=>[
                    [
                        'title'=>'',
                        'detail'=>'All products are subject to availability.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Refunds and cancellation will not be accepted after order confirmation.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Orders will be confirmed within 3 working days after payment received.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'In the event of supply difficulties, Sayvour reserves the right to substitute the goods or packaging of equal value without prior notice.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'All our chocolate and pastry products are freshly made by hand and small discrepancies should be anticipated even in the same batch of products. '
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Chocolate and confectionary products are freshly handmade with no added preservatives and should be kept in a cool and dry place away from odor, sunlight and intense heat. Products should be kept between 16℃ - 20℃ with humidity below 60%.'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Sayvour reserves the right to amend the terms & conditions without prior notice.'
                    ]
                ]
            ]
        ],
    'zh'=>
        [
            'table_name'=>'terms_zh',
            'table_content'=>[
                'preface'=>'',
                'end'=>'',
                'list_title'=>'條款及細則:',
                'listItem'=>[
                    [
                        'title'=>'',
                        'detail'=>'所有產品之供應需視乎情況而定。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'訂單一經確認後，恕不接受取消及退款。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'收妥付款後，訂單會於3個工作日內確認。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'若產品供應短缺, Sayvour保留以其他相等價值的產品或包裝作取代選購貨品的權利。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'所有朱古力及糕餅均是新鮮人手製造，故每件產品可能會有些微偏差。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'所有朱古力及糕餅均是新鮮人手製造，無添加防腐劑，故產品需存放在乾涼及清爽位置，避免接觸太陽及熱力。朱古力需儲存在16-20度及濕度低於60%的地方。'
                    ],
                    [
                        'title'=>'',
                        'detail'=>'Sayvour 保留修改條款及細則的權利，並不作另行通知。'
                    ]
                ]
            ]
        ]
    ],
    'policy'=>
    [
        'en'=>
        [
            'table_name'=>'policy_en',
            'table_content'=>[
                'preface'=>[
                    'title'=>'',
                    'detail'=>'Welcome to Sayvour’s website. Sayvour respects the right to privacy of our website users. In order to protect the interests of all involved parties, Sayvour adopts the following policies on personal information:'
                    ],
                'end'=>[
                    'detail'=>'Sayvour reserves the right to amend this Privacy Policy at any time for any reason without prior notice. If you have any questions about this Privacy Policy, kindly contact us via email: <a href="mailto:info@sayvour.com.hk">info@sayvour.com.hk</a>'
                    ],
                'list_title'=>'Privacy Policy',
                'listItem'=>[
                    [
                        'title'=>'Information Collection and Use',
                        'detail'=>'Sayvour does not collect personally identifiable information from individuals unless they provide it to us voluntarily and knowingly. If you shop with us via our website we collect the following information: name, address, phone number, email address, billing information/ credit card information and etc. We use the information you supply for the purpose of providing the services you have requested and for internal purposes only. We may contact you via email to keep you up-to-date on the latest Sayvour news or product information.'
                    ],
                    [
                        'title'=>'Information Protection',
                        'detail'=>'Sayvour takes your privacy and security seriously, for this reason we have established physical security measures, electronic security and managerial controls that limit the potential for misuse of information by employees and contractors. Yet, you are solely responsible for your own internet connection risk incurred for accessing and connecting to the website.

    We share information with our affiliates or service providers in connection with providing services to you, such as confirming and tracking your order. Under no circumstances from above and except to comply with applicable laws or regulations will we use this information for anything not described in this privacy policy.'
                    ]
                ]
            ]
        ],
        'zh'=>
        [
            'table_name'=>'policy_zh',
            'table_content'=>[
                'preface'=>[
                    'title'=>'',
                    'detail'=>'歡迎您光臨Sayvour網站，為了讓您能夠安心使用本網站的各項服務與資訊，特此向您說明本網站的隱私權保護政策，以保障您的權益：'
                ],
                'end'=>[
                    'detail'=>'Sayvour公司對網站所有內容保留最終解釋權及保留修正私權保護政策的權利，並不作另行通知。若您對Sayvour網站中的私隱政策有任何問題，請電郵至<a href="mailto:info@sayvour.com.hk">info@sayvour.com.hk</a>與我們聯絡。'
                ],
                'list_title'=>'隱私政策',
                'listItem'=>[
                    [
                        'title'=>'個人資料的收集及使用',
                        'detail'=>'Sayvour收集的個人資訊都是您自願提供。當您選擇Sayvour的註冊服務或通過Sayvour的網站購買商品時，我們會收集以下資訊：姓名、地址、電話號碼、電子郵件地址、帳單資訊等，都是為提供您所要求的服務或所需的資訊。您提供的所有資訊均為我們內部之用，例如確認和跟蹤您的訂單、通過電子郵件發送相關資訊給您、讓您瞭解Sayvour的最新消息和產品資訊。'
                    ],
                    [
                        'title'=>'個人資料之保障',
                        'detail'=>'Sayvour重視您的隱私和安全。本網站設有相關的資訊安全設備及必要的安全防護措施，維護您提供的資訊或數據的安全性。但我們不能完全保證您線上提供的任何資訊的安全性，線上提供的任何資訊風險由您自己承擔。 

    Sayvour將會與承包商或服務提供者共用您的個人資訊，例如幫我們郵遞或完成訂單的公司。除此隱私聲明中所描述的或法律規定的情況外，未經您的同意，我們不會將您的個人資料提供給第三方。'
                    ]
                ]
            ]
        ]
    ]
];

class CS_Info {

    protected $_content,
            $_lang;

    public function __construct($cs_info_storage){
        $this->_content = $cs_info_storage;
        $matches = [];
        preg_match('/(?:\/)(en|zh)(?:\/)/',$_SERVER['REQUEST_URI'],$matches);
        $this->_lang = $matches[1] ;
    }

    public function createTable ($table_name){

        $result = '';
        $preface = '';
        $end = '';
        $list = '';
        $td = '';
        $th = '';
        foreach($this->_content[$table_name] as $lang=>$contents){
            if($lang != $this->_lang) continue;
            $th .= $this->_th($contents['table_content']['list_title']);
            $preface = empty($contents['table_content']['preface']) ? '' : $this->_createParagraph($contents['table_content']['preface']); 
            $end = empty($contents['table_content']['end']) ? '' : $this->_createParagraph($contents['table_content']['end']);
            $list = $this->_createOrderList($contents['table_content']['listItem']);
            $td .= $this->_td($preface.$list.$end);
        }
        $result = $this->_tr($th).$this->_tr($td);
        return $result = $this->_table($result);

    }

    private function _createParagraph($content){
        $result = '';
        $result .= empty($content['title']) ? '' : $this->_p($content['title']);
        $result .= empty($content['detail']) ? '' : $this->_p($content['detail']);
        return $this->_div($result);
    }

    public function _createOrderList ($storage){
        $result = '';
        $temp_item = '';
        foreach($storage as $item){
            $temp_item = '';
            $temp_item .= isset($item['title']) ? $this->_li_title($item['title']) : '' ;
            $temp_item .= $this->_li_detail($item['detail']);
            $result .= $this->_li($temp_item);
        }
        return $this->_ol($result);
    }

    private static function _li_title ($content){
        return "<p class='li_title'>{$content}</p>";
    }

    private static function _li_detail ($content){
        return "<p class='li_detail'>{$content}</div>";
    }

    private static function _th($content){
        return "<th style='width:50%;'>{$content}</th>";
    }

    private static function _tr($content){
        return "<tr>{$content}</tr>";
    }

    private static function _td($content){
        return "<td>{$content}</td>";
    }

    private static function _table($content){
        return "<table class='cs_info table table-hover table-striped'>{$content}</table>";
    }

    private static function _ol($content){
        return "<ol>{$content}</ol>";
    }

    private static function _li($content){
        return "<li>{$content}</li>";
    }

    private static function _div($content){
        return "<div>{$content}</div>";
    }

    private static function _p($content){
        return "<p>{$content}</p>";
    }

    private static function _span($content){
        return "<span>{$content}</span>";
    }
}


$cs_info = new CS_Info($cs_info_storage);

echo "<div class='col-lg-8 col-md-9 col-sm-12 col-xs-12 '>";

if(isset($_GET['cs_info'])){
    switch ($_GET['cs_info']) {
        case 'FAQ': 
            echo $cs_info->createTable('about_products').$cs_info->createTable('usage').$cs_info->createTable('about_ordering_delivery'); break;
        case 'Delivery_Service': 
            echo $cs_info->createTable('delivery'); break;
        case 'Terms_Conditions': 
            echo $cs_info->createTable('terms'); break;
        case 'Privacy_Policy': 
            echo $cs_info->createTable('policy'); break;
        default : echo $cs_info->createTable('usage');
    }
}

echo "</div>";

?>

