The grammatical function of the phrase "اعطف على ذي الحاجه" (a'ṭif 'alā ḏī l-ḥājah) is predicate adjective.
Here's the breakdown:
اعطف (a'ṭif): This is the verb "to be kind to" or "to show compassion to" in the imperative form. It is masculine singular, second person (you).
على ('alā): This is a preposition that means "upon" or "to".
ذي (ḏī): This is the definite article for masculine nouns. It means "the".
الحاجه (l-ḥājah): This is a noun that means "the one in need" or "the needy". It is feminine singular, indefinite, and in the accusative case.
So, the entire phrase means "be kind to the one in need". The phrase "ذي الحاجه" (ḏī l-ḥājah) is acting as a predicate adjective, which describes the subject of the sentence (you). It is telling us what kind of person you should be.
Here are some other examples of predicate adjectives in Arabic:
الطالبُ ذكيٌّ (aṭ-ṭālibُ ḏakīyyun): The student is intelligent.
المرأةُ جميلةٌ (al-mar'atu jamīlatun): The woman is beautiful.
الكتابُ مُفيدٌ (al-kitābu mufīdun): The book is useful.
I hope this helps!